1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 23:55:26 +02:00

Merge pull request #2306 from marc1706/ticket/12407

[ticket/12407] Allow changing of post_data, etc. at end of posting.php

* marc1706/ticket/12407:
  [ticket/12407] Remove merge marker from posting.php
  [ticket/12407] Fix incorrect @since line in event
  [ticket/12407] Merge @change in doc block of event
  [ticket/12407] Assign template variables again after merging develop-ascraeus
  [ticket/12407] Add message_parser as passed variable to event
  [ticket/12407] Allow changing of post_data, etc. at end of posting.php
This commit is contained in:
Joas Schilling 2014-05-11 10:16:44 +02:00
commit 491d50a994

View File

@ -1491,8 +1491,8 @@ $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_up
add_form_key('posting'); add_form_key('posting');
// Start assigning vars for main posting page ... // Build array of variables for main posting page
$template->assign_vars(array( $page_data = array(
'L_POST_A' => $page_title, 'L_POST_A' => $page_title,
'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']),
@ -1560,24 +1560,46 @@ $template->assign_vars(array(
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data),
'S_IN_POSTING' => true, 'S_IN_POSTING' => true,
)); );
/** /**
* This event allows you to modify template variables for the posting screen * This event allows you to modify template variables for the posting screen
* *
* @event core.posting_modify_template_vars * @event core.posting_modify_template_vars
* @var array post_data Array with post data * @var array post_data Array with post data
* @var array moderators Array with forum moderators * @var array moderators Array with forum moderators
* @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
* @var bool s_topic_icons Whether or not to show the topic icons * @var bool s_topic_icons Whether or not to show the topic icons
* @var string form_enctype If attachments are allowed for this form the value of * @var string form_enctype If attachments are allowed for this form
* this is "multipart/form-data" else it is the empty string * "multipart/form-data" or empty string
* @var string s_action The URL to submit the POST data to * @var string s_action The URL to submit the POST data to
* @var string s_hidden_fields The concatenated input tags of the form's hidden fields * @var string s_hidden_fields Concatenated hidden input tags of posting form
* @var int post_id ID of the post
* @var int topic_id ID of the topic
* @var int forum_id ID of the forum
* @var bool submit Whether or not the form has been submitted
* @var bool preview Whether or not the post is being previewed
* @var bool save Whether or not a draft is being saved
* @var bool load Whether or not a draft is being loaded
* @var bool delete Whether or not the post is being deleted
* @var bool cancel Whether or not to cancel the form (returns to
* viewtopic or viewforum depending on if the user
* is posting a new topic or editing a post)
* @var array error Any error strings; a non-empty array aborts
* form submission.
* NOTE: Should be actual language strings, NOT
* language keys.
* @var bool refresh Whether or not to retain previously submitted data
* @var array page_data Posting page data that should be passed to the
* posting page via $template->assign_vars()
* @var object message_parser The message parser object
* @since 3.1.0-a1 * @since 3.1.0-a1
* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, s_topic_icons, form_enctype, s_action, s_hidden_fields * @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title,
* s_topic_icons, form_enctype, s_action, s_hidden_fields,
* post_id, topic_id, forum_id, submit, preview, save, load,
* delete, cancel, refresh, error, page_data, message_parser
*/ */
$vars = array( $vars = array(
'post_data', 'post_data',
@ -1588,9 +1610,25 @@ $vars = array(
'form_enctype', 'form_enctype',
's_action', 's_action',
's_hidden_fields', 's_hidden_fields',
'post_id',
'topic_id',
'forum_id',
'submit',
'preview',
'save',
'load',
'delete',
'cancel',
'refresh',
'error',
'page_data',
'message_parser',
); );
extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars))); extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars)));
// Start assigning vars for main posting page ...
$template->assign_vars($page_data);
// Build custom bbcodes array // Build custom bbcodes array
display_custom_bbcodes(); display_custom_bbcodes();