From aca6e64669079abc385f3094d8b6c186d9b46082 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 6 Nov 2015 10:20:05 +0100 Subject: [ticket/14272] Only use maxlength and size for allowed input elements PHPBB3-14272 --- phpBB/includes/acp/acp_attachments.php | 4 ++-- phpBB/includes/acp/acp_board.php | 4 ++-- phpBB/includes/functions_acp.php | 27 +++++++++++++++------------ 3 files changed, 19 insertions(+), 16 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 4956aab241..b0e0711b22 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1735,8 +1735,8 @@ class acp_attachments $size_var = $filesize['si_identifier']; $value = $filesize['value']; - // size="8" and maxlength="15" attributes as a fallback for browsers that do not support type="number" yet. - return ' '; + // size and maxlength must not be specified for input of type number + return ' '; } /** diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 4a1c74fd77..cec621e89d 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -842,7 +842,7 @@ class acp_board { global $user; - return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; } /** @@ -870,7 +870,7 @@ class acp_board { global $user; - return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; } /** diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index d566336d26..bd12c3dd5c 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -254,6 +254,16 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) case 'text': case 'url': case 'email': + case 'tel': + case 'search': + // maxlength and size are only valid for these types and will be + // ignored for other input types. + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; + + $tpl = ''; + break; + case 'color': case 'date': case 'time': @@ -261,39 +271,32 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) case 'datetime-local': case 'month': case 'range': - case 'search': - case 'tel': case 'week': - $size = (int) $tpl_type[1]; - $maxlength = (int) $tpl_type[2]; - - $tpl = ''; + $tpl = ''; break; case 'number': - $min = $max = $maxlength = ''; + $max = ''; $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false; if ( isset($tpl_type[2]) ) { $max = (int) $tpl_type[2]; - $maxlength = strlen( (string) $max ); } - $tpl = ''; + $tpl = ''; break; case 'dimension': - $min = $max = $maxlength = $size = ''; + $max = ''; $min = (int) $tpl_type[1]; if ( isset($tpl_type[2]) ) { $max = (int) $tpl_type[2]; - $size = $maxlength = strlen( (string) $max ); } - $tpl = ' x '; + $tpl = ' x '; break; case 'textarea': -- cgit v1.2.1