"._NOPOLL."";
else {
$pollopts = explode("|#|", $currentpoll['poll_opts']);
$content .= "
".$currentpoll['poll_question']."
";
if(isMEMBER) {
$voted = dbquery("SELECT vote_id FROM ".TABLEPREFIX."fanfiction_poll_votes WHERE vote_poll = '".$currentpoll['poll_id']."' AND vote_user = '".USERUID."'");
list($voter) = dbrow($voted);
}
if(empty($voter) && isMEMBER) {
$content .= "";
$content .= write_message("
"._POLLRESULTS."
");
}
else {
$votes = dbquery("SELECT COUNT(vote_opt) as count, vote_opt FROM ".TABLEPREFIX."fanfiction_poll_votes WHERE vote_poll = '".$currentpoll['poll_id']."' GROUP BY vote_opt ORDER BY vote_opt");
if(isset($blocks['poll']['bar']) && file_exists($blocks['poll']['bar'])) $bar = $blocks['poll']['bar'];
else $bar = "blocks/poll/bar.jpg";
$totalvotes = 0;
while($optvotes = dbassoc($votes)) {
$results[$optvotes['vote_opt']] = $optvotes['count'];
$totalvotes = $optvotes['count'] ? $optvotes['count'] + $totalvotes : $totalvotes;
}
foreach($pollopts as $num => $opt) {
unset($percent);
if(!empty($results[($num + 1)])) $percent = floor(($results[($num + 1)] / $totalvotes) * 100);
else $percent = 0;
$content .= "$opt

$percent%
";
}
}
}
$content .= "";
?>