[ticket/11538] Merge calls to validate_data() in acp_groups

PHPBB3-11538
This commit is contained in:
Marc Alexander 2013-05-19 11:38:11 +02:00
parent b49ce5eb3a
commit 373e26ca74

View file

@ -413,20 +413,21 @@ class acp_groups
} }
} }
// Validate the length of "Maximum number of allowed recipients per private message" setting. /*
// We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value * Validate the length of "Maximum number of allowed recipients per private message" setting.
// which is the lowest amongst DBMSes supported by phpBB3 * We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value
if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215)))) * which is the lowest amongst DBMSes supported by phpBB3.
{ * Also validate the submitted colour value.
// Replace "error" string with its real, localised form */
$error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error)); $validation_checks = array(
} 'max_recipients' => array('num', false, 0, 16777215),
'colour' => array('hex_colour'),
);
// Validate submitted colour value if ($validation_error = validate_data($submit_ary, $validation_checks))
if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour'))))
{ {
// Replace "error" string with its real, localised form // Replace "error" string with its real, localised form
$error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error)); $error = array_merge($error, array_map(array(&$user, 'lang'), $validation_error));
} }
if (!sizeof($error)) if (!sizeof($error))