$tccell1l>");
$divisor = "----------------------------------";
$ch = $co = "";
debugprint("WOULD HAVE INSERTED:
");
if($createdWithPassthru == "yes") {
if (is_array($choiceaddjs)) {
debugprint("JAVASCRIPT INSERTS:
------
");
foreach($choiceaddjs as $i=>$ch) {
$co = $choicecoloraddjs[$i]; // cleaning poll color:
$co = preg_replace("'^#(.*?)$'", "\\1", $co); // remove prefix # if given
$co = preg_replace("'[^a-zA-Z0-9]'", "", $co); // only alphanumerics, please
$co = substr($co, 0, 6); // and cut at six chars of length
debugprint("INSERT INTO poll_choices (id,poll,choice,color) VALUES (NULL,".$thread['poll'].",'".addslashes(stripslashes($ch))."','".addslashes(stripslashes($co))."')
");
mysql_query("INSERT INTO poll_choices (id,poll,choice,color) VALUES (NULL,".$thread['poll'].",'".addslashes(stripslashes($ch))."','".addslashes(stripslashes($co))."')");
}
}
} else {
if (is_array($choiceadd) && $choiceadddoadd) {
debugprint("NON-JAVASCRIPT INSERTS:
------
");
foreach($choiceadd as $i=>$ch) {
$co = $choicecoloradd[$i]; // cleaning poll color:
$co = preg_replace("'^#(.*?)$'", "\\1", $co); // remove prefix # if given
$co = preg_replace("'[^a-zA-Z0-9]'", "", $co); // only alphanumerics, please
$co = substr($co, 0, 6); // and cut at six chars of length
debugprint ("INSERT INTO poll_choices (id,poll,choice,color) VALUES (NULL,".$thread['poll'].",'".addslashes(stripslashes($ch))."','".addslashes(stripslashes($co))."')
");
mysql_query("INSERT INTO poll_choices (id,poll,choice,color) VALUES (NULL,".$thread['poll'].",'".addslashes(stripslashes($ch))."','".addslashes(stripslashes($co))."')");
}
}
}
$pollc=mysql_query("SELECT id,choice,color FROM poll_choices WHERE poll=".$thread['poll']);
while($pc = mysql_fetch_array($pollc)) { $pollchoices[$pc['id']] = $pc; }
if (is_array($choice)) {
debugprint("
CHANGED ITEMS:
------
");
foreach($choice as $i=>$ch) {
$i = intval($i);
$co = $choicecolor[$i]; // cleaning poll color:
$co = preg_replace("'^#(.*?)$'", "\\1", $co); // remove prefix # if given
$co = preg_replace("'[^a-zA-Z0-9]'", "", $co); // only alphanumerics, please
$co = substr($co, 0, 6); // and cut at six chars of length
if ($choiceremove[$i]) {
if (@mysql_num_rows(mysql_query("SELECT * FROM pollvotes WHERE choice=$id"))>0) {
debugprint("WON'T DELETE CHOICE \"$ch\" (COLOR \"$co\") - HAS VOTES
");
} else {
debugprint("DELETE FROM poll_choices WHERE id=$i
");
mysql_query("DELETE FROM poll_choices WHERE id=$i");
debugprint(" # CHOICE \"$ch\" (COLOR \"$co\")
");
}
} else if (($ch != $pollchoices[$i]['choice'] && trim($ch) != "") || ($co != $pollchoices[$i]['color'] && trim($co) != "")) {
debugprint("UPDATE poll_choices SET choice='".addslashes(stripslashes($ch))."', color='".addslashes(stripslashes($co))."' WHERE id=$i
");
mysql_query("UPDATE poll_choices SET choice='".addslashes(stripslashes($ch))."', color='".addslashes(stripslashes($co))."' WHERE id=$i");
debugprint(" # CHOICE \"$ch\" (COLOR \"$co\")
");
} else {
debugprint("WON'T CHANGE CHOICE \"$ch\" (COLOR \"$co\") - NOT CHANGED OR EMPTY COLOR/CHOICE
");
}
}
}
debugprint("
OTHER CHANGES:
-----
");
$pollclosed = intval($pollclosed); $polldbl = intval($polldbl);
debugprint("UPDATE poll SET question='".addslashes(stripslashes($pollqu))."',briefing='".addslashes(stripslashes($pollbr))."',closed=$pollclosed,doublevote=$polldbl WHERE id=".$thread['poll']."
");
mysql_query("UPDATE poll SET question='".addslashes(stripslashes($pollqu))."',briefing='".addslashes(stripslashes($pollbr))."',closed=$pollclosed,doublevote=$polldbl WHERE id=".$thread['poll']);
debugprint("
$divisor
_POST:");
if (is_debug()) { print_r($_POST); }
debugprint("
");
print $tblend;
/* $posticons[$iconid]=str_replace("\n",'',$posticons[$iconid]);
if(!$delete){
$icon=$posticons[$iconid];
if($custposticon) $icon=$custposticon;
mysql_query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." edited thread $id\", \"$userip\")");
mysql_query("UPDATE threads SET forum=$forummove,closed=$closed,title='".addslashes($subject)."',icon='".addslashes($icon)."',sticky=$sticky WHERE id=$id");
if($forummove!=$forumid){
mysql_query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid."moved thread $id from $forumid to $forummove\", \"$userip\")");
$numposts=$thread[replies]+1;
$t1=mysql_fetch_array(mysql_query("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1"));
$t2=mysql_fetch_array(mysql_query("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forummove ORDER BY lastpostdate DESC LIMIT 1"));
mysql_query("UPDATE forums SET numposts=numposts-$numposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
mysql_query("UPDATE forums SET numposts=numposts+$numposts,numthreads=numthreads+1,lastpostdate=$t2[lastpostdate],lastpostuser=$t2[lastposter] WHERE id=$forummove");
}
}else{
mysql_query("INSERT INTO actionlog (atime, adesc, aip) VALUES (".ctime().", \"User ".$loguserid." deleted thread $id - ip $REMOTE_ADDR\", \"$userip\")");
mysql_query("DELETE FROM threads WHERE id=$id");
mysql_query("DELETE FROM posts WHERE thread=$id");
$numdeletedposts=$thread[replies]+1;
$t1=mysql_fetch_array(mysql_query("SELECT lastpostdate,lastposter FROM threads WHERE forum=$forumid ORDER BY lastpostdate DESC LIMIT 1"));
mysql_query("UPDATE forums SET numposts=numposts-$numdeletedposts,numthreads=numthreads-1,lastpostdate=$t1[lastpostdate],lastpostuser=$t1[lastposter] WHERE id=$forumid");
}*/
}else
print "
$tccell1 Couldn't edit the poll. Either you didn't enter an existing username,
or you haven't entered the right password for the username, or you are not allowed to edit this poll.
".redirect("thread.php?id=$id",'return to the poll',0);
}
print $footer;
if($stamptime){printtimedif($startingtime);}
?>