1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/9776] Delete poll if no poll options were submitted.

PHPBB3-9776
This commit is contained in:
Joas Schilling
2011-10-13 19:25:15 +02:00
parent 86f8851c40
commit 4fae5eef68
2 changed files with 21 additions and 4 deletions

View File

@@ -904,6 +904,23 @@ if ($submit || $preview || $refresh)
$message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS'];
}*/
}
else if ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id))
{
// The user removed all poll options, this is equal to deleting the poll.
$poll = array(
'poll_title' => '',
'poll_length' => 0,
'poll_max_options' => 0,
'poll_option_text' => '',
'poll_start' => 0,
'poll_last_vote' => 0,
'poll_vote_change' => 0,
'poll_options' => array(),
);
$post_data['poll_options'] = $post_data['poll_title'] = '';
$post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0;
}
else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != ''))
{
// We have a poll but the editing user is not permitted to create/edit it.