mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
Merge pull request #4021 from marc1706/ticket/14272
[ticket/14272] Use html5 valid input elements * marc1706/ticket/14272: [ticket/14272] Allow input of floats for filesize [ticket/14272] Use input type number instead of text in avatars [ticket/14272] Assign min and max values for avatar driver settings [ticket/14272] Define min and max values for avatar width and height [ticket/14272] Disable not toggled form elements [ticket/14272] Make sure phpbb_avatar_manager was defined [ticket/14272] Remove useless check [ticket/14272] Fix invalid or missing min/max settings [ticket/14272] Assign min/max for all allowed types [ticket/14272] Only use maxlength and size for allowed input elements
This commit is contained in:
@@ -256,46 +256,49 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||
case 'text':
|
||||
case 'url':
|
||||
case 'email':
|
||||
case 'color':
|
||||
case 'date':
|
||||
case 'time':
|
||||
case 'datetime':
|
||||
case 'datetime-local':
|
||||
case 'month':
|
||||
case 'range':
|
||||
case 'search':
|
||||
case 'tel':
|
||||
case 'week':
|
||||
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 = '<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"' : '') . ' />';
|
||||
break;
|
||||
|
||||
case 'color':
|
||||
case 'datetime':
|
||||
case 'datetime-local':
|
||||
case 'month':
|
||||
case 'week':
|
||||
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '" name="' . $name . '" value="' . $new[$config_key] . '" />';
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
case 'time':
|
||||
case 'number':
|
||||
$min = $max = $maxlength = '';
|
||||
case 'range':
|
||||
$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 = '<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="' . $tpl_type[0] . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new[$config_key] . '" />';
|
||||
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 = '<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"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />';
|
||||
break;
|
||||
|
||||
case 'textarea':
|
||||
|
Reference in New Issue
Block a user