mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9776] Delete poll if no poll options were submitted.
This commit is contained in:
commit
3df4b83cd3
2 changed files with 21 additions and 4 deletions
|
@ -1855,9 +1855,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
|
|
||||||
case 'edit_topic':
|
case 'edit_topic':
|
||||||
case 'edit_first_post':
|
case 'edit_first_post':
|
||||||
if (isset($poll['poll_options']) && !empty($poll['poll_options']))
|
if (isset($poll['poll_options']))
|
||||||
{
|
{
|
||||||
$poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
|
$poll_start = ($poll['poll_start'] || empty($poll['poll_options'])) ? $poll['poll_start'] : $current_time;
|
||||||
$poll_length = $poll['poll_length'] * 86400;
|
$poll_length = $poll['poll_length'] * 86400;
|
||||||
if ($poll_length < 0)
|
if ($poll_length < 0)
|
||||||
{
|
{
|
||||||
|
@ -2005,11 +2005,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Poll Tables
|
// Update Poll Tables
|
||||||
if (isset($poll['poll_options']) && !empty($poll['poll_options']))
|
if (isset($poll['poll_options']))
|
||||||
{
|
{
|
||||||
$cur_poll_options = array();
|
$cur_poll_options = array();
|
||||||
|
|
||||||
if ($poll['poll_start'] && $mode == 'edit')
|
if ($mode == 'edit')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . POLL_OPTIONS_TABLE . '
|
FROM ' . POLL_OPTIONS_TABLE . '
|
||||||
|
|
|
@ -902,6 +902,23 @@ if ($submit || $preview || $refresh)
|
||||||
$message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS'];
|
$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'] != ''))
|
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.
|
// We have a poll but the editing user is not permitted to create/edit it.
|
||||||
|
|
Loading…
Add table
Reference in a new issue