diff options
author | Chris Smith <toonarmy@phpbb.com> | 2010-03-06 18:15:55 +0000 |
---|---|---|
committer | Chris Smith <toonarmy@phpbb.com> | 2010-09-09 23:42:20 +0100 |
commit | 264ef66c5c5b5498df2a04e011ed0127c6fe4324 (patch) | |
tree | 748614171e0fdefc4c30b68bf9c3cb86b817704d | |
parent | 2e891c5eba78d68796dc6854d5805af2e3978641 (diff) | |
download | forums-264ef66c5c5b5498df2a04e011ed0127c6fe4324.tar forums-264ef66c5c5b5498df2a04e011ed0127c6fe4324.tar.gz forums-264ef66c5c5b5498df2a04e011ed0127c6fe4324.tar.bz2 forums-264ef66c5c5b5498df2a04e011ed0127c6fe4324.tar.xz forums-264ef66c5c5b5498df2a04e011ed0127c6fe4324.zip |
[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
-rw-r--r-- | phpBB/adm/index.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 4c568cf441..92bcf90039 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -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 |