Merge branch '3.1.x' into 3.2.x

This commit is contained in:
Marc Alexander 2016-10-23 11:48:56 +02:00
commit 2a038d45df
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -2021,8 +2021,9 @@ function check_link_hash($token, $link_name)
/** /**
* Add a secret token to the form (requires the S_FORM_TOKEN template variable) * Add a secret token to the form (requires the S_FORM_TOKEN template variable)
* @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply * @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply
* @param string $template_variable_suffix A string that is appended to the name of the template variable to which the form elements are assigned
*/ */
function add_form_key($form_name) function add_form_key($form_name, $template_variable_suffix = '')
{ {
global $config, $template, $user, $phpbb_dispatcher; global $config, $template, $user, $phpbb_dispatcher;
@ -2044,8 +2045,10 @@ function add_form_key($form_name)
* @var string s_fields Generated hidden fields * @var string s_fields Generated hidden fields
* @var string token Form token * @var string token Form token
* @var string token_sid User session ID * @var string token_sid User session ID
* @var string template_variable_suffix The string that is appended to template variable name
* *
* @since 3.1.0-RC3 * @since 3.1.0-RC3
* @changed 3.1.11-RC1 Added template_variable_suffix
*/ */
$vars = array( $vars = array(
'form_name', 'form_name',
@ -2053,12 +2056,11 @@ function add_form_key($form_name)
's_fields', 's_fields',
'token', 'token',
'token_sid', 'token_sid',
'template_variable_suffix',
); );
extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars))); extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars)));
$template->assign_vars(array( $template->assign_var('S_FORM_TOKEN' . $template_variable_suffix, $s_fields);
'S_FORM_TOKEN' => $s_fields,
));
} }
/** /**