2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
authorize();
|
|
|
|
|
|
|
|
$ThreadID = $_POST['threadid'];
|
|
|
|
$NewOption = $_POST['new_option'];
|
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
if (!is_number($ThreadID)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
2013-05-05 08:00:31 +00:00
|
|
|
if (!check_perms('site_moderate_forums')) {
|
2013-07-10 00:08:53 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT ForumID
|
|
|
|
FROM forums_topics
|
|
|
|
WHERE ID = $ThreadID");
|
2011-05-14 08:00:05 +00:00
|
|
|
list($ForumID) = $DB->next_record();
|
2013-05-05 08:00:31 +00:00
|
|
|
if (!in_array($ForumID, $ForumsRevealVoters)) {
|
2011-05-14 08:00:05 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
}
|
2013-07-10 00:08:53 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT Answers
|
|
|
|
FROM forums_polls
|
|
|
|
WHERE TopicID = $ThreadID");
|
|
|
|
if (!$DB->has_results()) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
|
|
|
list($Answers) = $DB->next_record(MYSQLI_NUM, false);
|
|
|
|
$Answers = unserialize($Answers);
|
|
|
|
$Answers[] = $NewOption;
|
|
|
|
$Answers = serialize($Answers);
|
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE forums_polls
|
|
|
|
SET Answers = '".db_string($Answers)."'
|
2013-07-10 00:08:53 +00:00
|
|
|
WHERE TopicID = $ThreadID");
|
|
|
|
$Cache->delete_value("polls_$ThreadID");
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-07-10 00:08:53 +00:00
|
|
|
header("Location: forums.php?action=viewthread&threadid=$ThreadID");
|