$opt) { if(strlen($final) > 0) $final .= "#"; $n = $num + 1; $final .= (isset($results[$n]) ? $results[$n] : "0"); } $closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = '" . time() . "' WHERE poll_id = '".$currentpoll['poll_id']."'"); if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`"); $output .= write_message(_ACTIONSUCCESSFUL); } if(isset($_POST['submit'])) { $poll_question = escapestring(descript(stripslashes($_POST['poll_question']))); $opts = explode("\r\n", ltrim(strip_tags(preg_replace( '!

!iU', "\r\n", stripslashes(trim($_POST['poll_opts']))), preg_replace("!

!iu", "", $allowed_tags)))); $new_opts = array( ); foreach($opts as $opt) { if(strlen(trim(preg_replace("! !", " ", $opt))) > 0) $new_opts[] = $opt; } $new_opts = escapestring(implode("|#|", $new_opts)); $newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', '" . time() . "')"); include("blocks/".$blocks['poll']['file']); $output .= "

"._CURRENT.":
$content

"; } if($currentpoll && !isset($_POST['close_current'])) { include("blocks/".$blocks['poll']['file']); $output .= "
"._CURRENT.":
$content

"; $output .= "
"; } else { $output .= "

"; if($tinyMCE) $output .= "
"; $output .= "
"; $output .= "
"; } $oldpolls = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end != 0 ORDER BY poll_id DESC"); if(dbnumrows($oldpolls)) { $output .= ""; while($poll = dbassoc($oldpolls)) { $output .= ""; } $output .= "
"._POLLQUESTION.""._OPTIONS."
".stripslashes($poll['poll_question']).""._DELETE."

"; } ?>