Gazelle/sections/forums/delete_poll_option.php
What.CD f76e290493 Abstracting the compose box for staffpms
Allow FLS to assign to staff or forum staff

Allow FLS to unresolve all FLS PMs

empty commit (testing debug site)

empty commit (again)

Permissions can only be created up to your current level

Permissions can only be altered up to your current level

Image proxy should function correctly with SSL now

Forums can only be altered up to your current level

Adding option to delete polls

Remove ghost resolver bug

Fixing autocomplete escpaing

improved .gitignore

Adding debug to all ajax pages

Fixed escaping on autocomplete pages
2011-07-13 08:00:06 +00:00

36 lines
989 B
PHP

<?
authorize();
if(!check_perms("site_moderate_forums")) {
error(404);
}
$ThreadID = $_GET['threadid'];
$PollOption = $_GET['vote'];
if(is_number($ThreadID) && is_number($PollOption)) {
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = $ThreadID");
list($ForumID) = $DB->next_record();
if(!in_array($ForumID, $ForumsRevealVoters)) {
error(403);
}
$DB->query("SELECT Answers FROM forums_polls WHERE TopicID = ".$ThreadID);
if($DB->record_count() < 1) {
error(404);
}
list($Answers) = $DB->next_record(MYSQLI_NUM, false);
$Answers = unserialize($Answers);
unset($Answers[$PollOption]);
$Answers = serialize($Answers);
$DB->query("UPDATE forums_polls SET Answers = '".db_string($Answers)."' WHERE TopicID = ".$ThreadID);
$DB->query("DELETE FROM forums_polls_votes WHERE Vote = ".$PollOption." AND TopicID = ".$ThreadID);
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
} else {
error(404);
}