diff options
author | Senky <jakubsenko@gmail.com> | 2013-02-06 22:43:52 +0100 |
---|---|---|
committer | Senky <jakubsenko@gmail.com> | 2013-05-20 18:41:32 +0200 |
commit | 6c0f3513d99c3af965bdc8a03b2bae9978477c27 (patch) | |
tree | 82f25937c843cf49da183134ef36a5dda1619880 /phpBB/includes/functions_acp.php | |
parent | cf9d407493d76cee76987edf38ae0191360bb661 (diff) | |
download | forums-6c0f3513d99c3af965bdc8a03b2bae9978477c27.tar forums-6c0f3513d99c3af965bdc8a03b2bae9978477c27.tar.gz forums-6c0f3513d99c3af965bdc8a03b2bae9978477c27.tar.bz2 forums-6c0f3513d99c3af965bdc8a03b2bae9978477c27.tar.xz forums-6c0f3513d99c3af965bdc8a03b2bae9978477c27.zip |
[ticket/11010] replacing maxlenght with max
PHPBB3-11010
Diffstat (limited to 'phpBB/includes/functions_acp.php')
-rw-r--r-- | phpBB/includes/functions_acp.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 3aca1af229..d3b1942180 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -258,25 +258,27 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) break; case 'number': - $min = (int) $tpl_type[1]; - $max = $maxlength = (int) $tpl_type[2]; - - // $tpl_type[3] is not always present - if (!isset($tpl_type[3]) || (isset($tpl_type[3]) && $tpl_type[3] != 'true')) + $min = $max = $maxlength = ''; + $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false; + if ( isset($tpl_type[2]) ) { - $max = str_repeat('9', $max); + $max = (int) $tpl_type[2]; + $maxlength = strlen( (string) $max ); } - $tpl = '<input id="' . $key . '" type="number" maxlength="' . (($maxlength) ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />'; + $tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="' . $name . '" value="' . $new[$config_key] . '" />'; break; case 'dimension': + $min = $max = $maxlength = ''; $min = (int) $tpl_type[1]; - $max = $maxlength = (int) $tpl_type[2]; - - $max = str_repeat('9', $max); + if ( isset($tpl_type[2]) ) + { + $max = (int) $tpl_type[2]; + $maxlength = strlen( (string) $max ); + } - $tpl = '<input id="' . $key . '" type="number" maxlength="' . (($maxlength) ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number" maxlength="' . (($maxlength) ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />'; + $tpl = '<input id="' . $key . '" type="number" maxlength="' . (($maxlength != '') ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number" maxlength="' . (($maxlength != '') ? $maxlength : 255) . '" min="' . $min . '" max="' . $max . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />'; break; case 'textarea': |