1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 12:33:29 +01:00

Merge branch '3.1.x'

This commit is contained in:
Joas Schilling 2015-06-04 17:51:09 +02:00
commit a2643f8e67

View File

@ -1245,6 +1245,7 @@ if ($submit || $preview || $refresh)
* *
* @event core.posting_modify_submission_errors * @event core.posting_modify_submission_errors
* @var array post_data Array with post data * @var array post_data Array with post data
* @var array poll Array with poll data from post (must be used instead of the post_data equivalent)
* @var string mode What action to take if the form is submitted * @var string mode What action to take if the form is submitted
* post|reply|quote|edit|delete|bump|smilies|popup * post|reply|quote|edit|delete|bump|smilies|popup
* @var string page_title Title of the mode page * @var string page_title Title of the mode page
@ -1255,9 +1256,11 @@ if ($submit || $preview || $refresh)
* @var array error Any error strings; a non-empty array aborts form submission. * @var array error Any error strings; a non-empty array aborts form submission.
* NOTE: Should be actual language strings, NOT language keys. * NOTE: Should be actual language strings, NOT language keys.
* @since 3.1.0-RC5 * @since 3.1.0-RC5
* @change 3.1.5-RC1 Added poll array to the event
*/ */
$vars = array( $vars = array(
'post_data', 'post_data',
'poll',
'mode', 'mode',
'page_title', 'page_title',
'post_id', 'post_id',
@ -1816,6 +1819,30 @@ $page_data = array(
'S_IN_POSTING' => true, 'S_IN_POSTING' => true,
); );
// Build custom bbcodes array
display_custom_bbcodes();
// Poll entry
if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
&& $auth->acl_get('f_poll', $forum_id))
{
$page_data = array_merge($page_data, array(
'S_SHOW_POLL_BOX' => true,
'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false,
'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),
'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
'POLL_LENGTH' => $post_data['poll_length'],
)
);
}
/** /**
* This event allows you to modify template variables for the posting screen * This event allows you to modify template variables for the posting screen
* *
@ -1854,6 +1881,7 @@ $page_data = array(
* post_id, topic_id, forum_id, submit, preview, save, load, * post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser * delete, cancel, refresh, error, page_data, message_parser
* @change 3.1.2-RC1 Removed 'delete' var as it does not exist * @change 3.1.2-RC1 Removed 'delete' var as it does not exist
* @change 3.1.5-RC1 Added poll variables to the page_data array
*/ */
$vars = array( $vars = array(
'post_data', 'post_data',
@ -1882,29 +1910,6 @@ extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', co
// Start assigning vars for main posting page ... // Start assigning vars for main posting page ...
$template->assign_vars($page_data); $template->assign_vars($page_data);
// Build custom bbcodes array
display_custom_bbcodes();
// Poll entry
if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
&& $auth->acl_get('f_poll', $forum_id))
{
$template->assign_vars(array(
'S_SHOW_POLL_BOX' => true,
'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false,
'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']),
'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
'POLL_LENGTH' => $post_data['poll_length'])
);
}
// Show attachment box for adding attachments if true // Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype); $allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);