mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/14325] Preserve event variable BC
PHPBB3-14325
This commit is contained in:
@@ -230,7 +230,7 @@ function h_radio($name, $input_ary, $input_default = false, $id = false, $key =
|
||||
/**
|
||||
* Build configuration template for acp configuration pages
|
||||
*/
|
||||
function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
|
||||
{
|
||||
global $user, $module, $phpbb_dispatcher;
|
||||
|
||||
@@ -238,18 +238,18 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
$name = 'config[' . $config_key . ']';
|
||||
|
||||
// Make sure there is no notice printed out for non-existent config options (we simply set them)
|
||||
if (!isset($new[$config_key]))
|
||||
if (!isset($new_ary[$config_key]))
|
||||
{
|
||||
$new[$config_key] = '';
|
||||
$new_ary[$config_key] = '';
|
||||
}
|
||||
|
||||
switch ($tpl_type[0])
|
||||
{
|
||||
case 'password':
|
||||
if ($new[$config_key] !== '')
|
||||
if ($new_ary[$config_key] !== '')
|
||||
{
|
||||
// replace passwords with asterixes
|
||||
$new[$config_key] = '********';
|
||||
$new_ary[$config_key] = '********';
|
||||
}
|
||||
case 'text':
|
||||
case 'url':
|
||||
@@ -267,7 +267,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
$size = (int) $tpl_type[1];
|
||||
$maxlength = (int) $tpl_type[2];
|
||||
|
||||
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
|
||||
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new_ary[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
@@ -279,7 +279,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
$maxlength = strlen( (string) $max );
|
||||
}
|
||||
|
||||
$tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new[$config_key] . '" />';
|
||||
$tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new_ary[$config_key] . '" />';
|
||||
break;
|
||||
|
||||
case 'dimension':
|
||||
@@ -293,19 +293,19 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
$size = $maxlength = strlen( (string) $max );
|
||||
}
|
||||
|
||||
$tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />';
|
||||
$tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new_ary[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new_ary[$config_key . '_height'] . '" />';
|
||||
break;
|
||||
|
||||
case 'textarea':
|
||||
$rows = (int) $tpl_type[1];
|
||||
$cols = (int) $tpl_type[2];
|
||||
|
||||
$tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>';
|
||||
$tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new_ary[$config_key] . '</textarea>';
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
$key_yes = ($new[$config_key]) ? ' checked="checked"' : '';
|
||||
$key_no = (!$new[$config_key]) ? ' checked="checked"' : '';
|
||||
$key_yes = ($new_ary[$config_key]) ? ' checked="checked"' : '';
|
||||
$key_no = (!$new_ary[$config_key]) ? ' checked="checked"' : '';
|
||||
|
||||
$tpl_type_cond = explode('_', $tpl_type[1]);
|
||||
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
|
||||
@@ -342,7 +342,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
switch ($value)
|
||||
{
|
||||
case '{CONFIG_VALUE}':
|
||||
$value = $new[$config_key];
|
||||
$value = $new_ary[$config_key];
|
||||
break;
|
||||
|
||||
case '{KEY}':
|
||||
@@ -355,7 +355,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
}
|
||||
else
|
||||
{
|
||||
$args = array($new[$config_key], $key);
|
||||
$args = array($new_ary[$config_key], $key);
|
||||
}
|
||||
|
||||
$return = call_user_func_array($call, $args);
|
||||
@@ -383,7 +383,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
$tpl .= $vars['append'];
|
||||
}
|
||||
|
||||
$new_ary = $new;
|
||||
$new = $new_ary;
|
||||
/**
|
||||
* Overwrite the html code we display for the config value
|
||||
*
|
||||
@@ -393,17 +393,16 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
* 1 [optional] => string: size, int: minimum
|
||||
* 2 [optional] => string: max. length, int: maximum
|
||||
* @var string key Should be used for the id attribute in html
|
||||
* @var array new_ary Array with the config values we display
|
||||
* @var array new Array with the config values we display
|
||||
* @var string name Should be used for the name attribute
|
||||
* @var array vars Array with the options for the config
|
||||
* @var string tpl The resulting html code we display
|
||||
* @since 3.1.0-a1
|
||||
* @change 3.2.0-a1 Replaced new with new_ary
|
||||
*/
|
||||
$vars = array('tpl_type', 'key', 'new_ary', 'name', 'vars', 'tpl');
|
||||
$vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl');
|
||||
extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars)));
|
||||
$new = $new_ary;
|
||||
unset($new_ary);
|
||||
$new_ary = $new;
|
||||
unset($new);
|
||||
|
||||
return $tpl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user