summary refs log tree commit diff stats
path: root/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions.php')
-rwxr-xr-xincludes/functions.php48
1 files changed, 47 insertions, 1 deletions
diff --git a/includes/functions.php b/includes/functions.php index 9eb1634..090e9d0 100755 --- a/includes/functions.php +++ b/includes/functions.php
@@ -272,7 +272,7 @@ function displayRelated($title, $avoid = 0)
272 $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], 272 $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'],
273 'CODED' => $getrelated3[$i]['slug'], 273 'CODED' => $getrelated3[$i]['slug'],
274 'AUTHOR' => $getrelated3[$i]['author'], 274 'AUTHOR' => $getrelated3[$i]['author'],
275 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y',strtotime($getrelated3[$i]['pubDate'])))); 275 'DATE' => date('F jS Y',strtotime($getrelated3[$i]['pubDate']))));
276 $i++; 276 $i++;
277 } 277 }
278 278
@@ -304,4 +304,50 @@ function getCommentUrl($getcomment3)
304 } 304 }
305} 305}
306 306
307function getPollOfTheWeek($id = -1)
308{
309 static $showed_form = false;
310
311 $potw = new FITemplate('polloftheweek');
312
313 if ($id == -1)
314 {
315 $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1";
316 } else {
317 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $id;
318 }
319 $getpoll2 = mysql_query($getpoll);
320 $getpoll3 = mysql_fetch_array($getpoll2);
321
322 $potw->add('QUESTION', $getpoll3['question']);
323 $potw->add('OPTION1', $getpoll3['option1']);
324 $potw->add('OPTION2', $getpoll3['option2']);
325 $potw->add('OPTION3', $getpoll3['option3']);
326 $potw->add('OPTION4', $getpoll3['option4']);
327
328 $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\"";
329 $getip2 = mysql_query($getip);
330 $getip3 = mysql_fetch_array($getip2);
331
332 if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && ($id == -1) && ($showed_form == false))
333 {
334 $potw->adds_block('FORM',array('exi'=>1));
335 $showed_form = true;
336 } else {
337 $potw->adds_block('DISPLAY',array('exi'=>1));
338
339 $potw->add('PERCENT1', getpercent($getpoll3,'1'));
340 $potw->add('PERCENT2', getpercent($getpoll3,'2'));
341 $potw->add('PERCENT3', getpercent($getpoll3,'3'));
342 $potw->add('PERCENT4', getpercent($getpoll3,'4'));
343 }
344
345 ob_start();
346 $potw->display();
347 $result = ob_get_contents();
348 ob_end_clean();
349
350 return $result;
351}
352
307?> 353?>