[feature/new-tz-handling] Allow phpbb prefix for user data validation functions

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-07-16 18:41:30 +02:00
parent f5bb145040
commit b61ac43abe

View file

@ -1248,6 +1248,16 @@ function validate_data($data, $val_ary)
$function = array_shift($validate); $function = array_shift($validate);
array_unshift($validate, $data[$var]); array_unshift($validate, $data[$var]);
if (function_exists('phpbb_validate_' . $function))
{
if ($result = call_user_func_array('phpbb_validate_' . $function, $validate))
{
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
}
}
else
{
if ($result = call_user_func_array('validate_' . $function, $validate)) if ($result = call_user_func_array('validate_' . $function, $validate))
{ {
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted. // Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
@ -1255,6 +1265,7 @@ function validate_data($data, $val_ary)
} }
} }
} }
}
return $error; return $error;
} }
@ -1407,7 +1418,7 @@ function validate_language_iso_name($lang_iso)
* a string which will be used as the error message * a string which will be used as the error message
* (with the variable name appended) * (with the variable name appended)
*/ */
function validate_timezone($timezone) function phpbb_validate_timezone($timezone)
{ {
return (in_array($timezone, DateTimeZone::listIdentifiers())) ? false : 'TIMEZONE_INVALID'; return (in_array($timezone, DateTimeZone::listIdentifiers())) ? false : 'TIMEZONE_INVALID';
} }