get_value('polls_'.$TopicID)) { $DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$TopicID."'"); list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1)); $Answers = unserialize($Answers); $DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$TopicID' AND Vote <> '0' GROUP BY Vote"); $VoteArray = $DB->to_array(false, MYSQLI_NUM); $Votes = array(); foreach ($VoteArray as $VoteSet) { list($Key,$Value) = $VoteSet; $Votes[$Key] = $Value; } for ($i = 1, $il = count($Answers); $i <= $il; ++$i) { if (!isset($Votes[$i])) { $Votes[$i] = 0; } } } if (isset($_POST['feature'])) { if (!$Featured || $Featured == '0000-00-00 00:00:00') { $Featured = sqltime(); $Cache->cache_value('polls_featured',$TopicID,0); $DB->query('UPDATE forums_polls SET Featured=\''.sqltime().'\' WHERE TopicID=\''.$TopicID.'\''); } } if (isset($_POST['close'])) { $Closed = !$Closed; $DB->query('UPDATE forums_polls SET Closed=\''.$Closed.'\' WHERE TopicID=\''.$TopicID.'\''); } $Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,$Featured,$Closed), 0); header('Location: '.$_SERVER['HTTP_REFERER']); die();