mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/8935] Prevent setting maximum avatar dimensions less than the minimums.
This change actually applies to any configruation setting that is a pair of values one representing the maximum and one minimum. This change enforces that the maximum value cannot be less than the minimum value. PHPBB3-8935
This commit is contained in:
parent
2e891c5eba
commit
264ef66c5c
1 changed files with 14 additions and 0 deletions
|
@ -432,6 +432,20 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
|
|||
{
|
||||
$error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]);
|
||||
}
|
||||
|
||||
if (strpos($config_name, '_max') !== false)
|
||||
{
|
||||
// Min/max pairs of settings should ensure that min <= max
|
||||
// Replace _max with _min to find the name of the minimum
|
||||
// corresponding configuration variable
|
||||
$min_name = str_replace('_max', '_min', $config_name);
|
||||
|
||||
if (isset($cfg_array[$min_name]) && is_numeric($cfg_array[$min_name]) && $cfg_array[$config_name] < $cfg_array[$min_name])
|
||||
{
|
||||
// A minimum value exists and the maximum value is less than it
|
||||
$error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], (int) $cfg_array[$min_name]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Absolute path
|
||||
|
|
Loading…
Add table
Reference in a new issue