mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-28 10:40:28 +02:00
[ticket/9066] Move regex into get_preg_expression function and add tests
PHPBB3-9066
This commit is contained in:
@@ -3486,6 +3486,10 @@ function get_preg_expression($mode)
|
||||
$inline = ($mode == 'relative_url') ? ')' : '';
|
||||
return "(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?";
|
||||
break;
|
||||
|
||||
case 'table_prefix':
|
||||
return '#^[a-zA-Z][a-zA-Z0-9_]*$#';
|
||||
break;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@@ -546,7 +546,7 @@ class install_install extends module
|
||||
$error[] = $lang['INST_ERR_NO_DB'];
|
||||
$connect_test = false;
|
||||
}
|
||||
else if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $data['table_prefix'], $result))
|
||||
else if (!preg_match(get_preg_expression('table_prefix'), $data['table_prefix']))
|
||||
{
|
||||
$error[] = $lang['INST_ERR_DB_INVALID_PREFIX'];
|
||||
$connect_test = false;
|
||||
|
Reference in New Issue
Block a user