diff --git a/system/pages/polls.php b/system/pages/polls.php index dcc781c2..b7bc0ba1 100644 --- a/system/pages/polls.php +++ b/system/pages/polls.php @@ -26,26 +26,26 @@ function getColorByPercent($percent) } $number_of_rows = 0; $showed = false; - $link = "polls"; // your link to polls in index.php - $dark = $config['darkborder']; - $light = $config['lightborder']; - $time = time(); - $POLLS = $db->query('SELECT * FROM '.$db->tableName('z_polls').''); - $level = 20; // need level to vote + $link = "polls"; // your link to polls in index.php + $dark = $config['darkborder']; + $light = $config['lightborder']; + $time = time(); + $POLLS = $db->query('SELECT * FROM '.$db->tableName('z_polls').''); + $level = 20; // need level to vote - if(empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) // list of polls - { - $active = $db->query('SELECT * FROM `z_polls` where `end` > '.$time.''); // active polls - $closed = $db->query('SELECT * FROM `z_polls` where `end` < '.$time.' order by `end` desc'); // closed polls - /* Active Polls */ - echo ''; - echo ''; - $bgcolor = getStyle($number_of_rows++); + if(empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) // list of polls + { + $active = $db->query('SELECT * FROM `z_polls` where `end` > '.$time.''); // active polls + $closed = $db->query('SELECT * FROM `z_polls` where `end` < '.$time.' order by `end` desc'); // closed polls + /* Active Polls */ + echo '
Active Polls
TopicEnd
'; + echo ''; + $bgcolor = getStyle($number_of_rows++); $empty_active = false; - foreach($active as $poll) - { - echo ' - + foreach($active as $poll) + { + echo ' + '; - $empty_active = true; - } + $empty_active = true; + } - if(!$empty_active) - { - echo ''; - } + if(!$empty_active) + { + echo ''; + } - echo "
Active Polls
TopicEnd
There are no active polls.
There are no active polls.


"; - /* Closed Polls */ - echo ''; - echo ''; + echo "
Closed Polls
TopicEnd


"; + /* Closed Polls */ + echo ''; + echo ''; $bgcolor = getStyle($number_of_rows++); $empty_closed = false; - foreach($closed as $poll) - { - echo ' - + foreach($closed as $poll) + { + echo ' + '; - $empty_closed = true; - } + $empty_closed = true; + } - if(!$empty_closed) - { - echo ''; - } + if(!$empty_closed) + { + echo ''; + } - echo "
Closed Polls
TopicEnd
There are no closed polls.
There are no closed polls.
"; - $showed=true; - } + echo ""; + $showed=true; + } if(!$logged) { @@ -104,43 +104,43 @@ function getColorByPercent($percent) return; } - /* Checking Account */ + /* Checking Account */ $allow = false; - $account_players = $account_logged->getPlayers(); - foreach($account_players as $player) - { - $player = $player->getLevel(); - if($player >= $level) - $allow=true; - } + $account_players = $account_logged->getPlayers(); + foreach($account_players as $player) + { + $player = $player->getLevel(); + if($player >= $level) + $allow=true; + } - if(!empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) - { - foreach($POLLS as $POLL) - { - if($_REQUEST['id'] == $POLL['id']) - { - $ANSWERS = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).' order by `answer_id`'); - $votes_all = $POLL['votes_all']; + if(!empty($_REQUEST['id']) and (!isset($_REQUEST['control']) || $_REQUEST['control'] != "true")) + { + foreach($POLLS as $POLL) + { + if($_REQUEST['id'] == $POLL['id']) + { + $ANSWERS = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).' order by `answer_id`'); + $votes_all = $POLL['votes_all']; - if($votes_all == 0) - { - $i=1; - foreach($ANSWERS as $answer) - { - $percent[$i] = 0; - $i++; - } - } - else - { - $i=1; - foreach($ANSWERS as $answer) - { - $percent[$i] = round(((100*$answer['votes'])/$votes_all),2); - $i++; - } - } + if($votes_all == 0) + { + $i=1; + foreach($ANSWERS as $answer) + { + $percent[$i] = 0; + $i++; + } + } + else + { + $i=1; + foreach($ANSWERS as $answer) + { + $percent[$i] = round(((100*$answer['votes'])/$votes_all),2); + $i++; + } + } ?>