diff options
Diffstat (limited to 'phpBB/includes/functions_acp.php')
-rw-r--r-- | phpBB/includes/functions_acp.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index af419c4288..d944d9bd62 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -89,6 +89,7 @@ function adm_page_footer($copyright_html = true) {
global $db, $config, $template, $user, $auth, $cache;
global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $request;
// Output page creation time
if (defined('DEBUG'))
@@ -96,7 +97,7 @@ function adm_page_footer($copyright_html = true) $mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
- if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
+ if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
{
$db->sql_report('display');
}
@@ -300,7 +301,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) }
/**
-* Going through a config array and validate values, writing errors to $error. The validation method accepts parameters separated by ':' for string and int.
+* Going through a config array and validate values, writing errors to $error. The validation method accepts parameters separated by ':' for string and int.
* The first parameter defines the type to be used, the second the lower bound and the third the upper bound. Only the type is required.
*/
function validate_config_vars($config_vars, &$cfg_array, &$error)
@@ -337,7 +338,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) {
$error[] = sprintf($user->lang['SETTING_TOO_SHORT'], $user->lang[$config_definition['lang']], $validator[$min]);
}
- else if (isset($validator[$max]) && $length > $validator[$max])
+ else if (isset($validator[$max]) && $length > $validator[2])
{
$error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$config_definition['lang']], $validator[$max]);
}
@@ -496,15 +497,18 @@ function validate_range($value_ary, &$error) global $user;
$column_types = array(
- 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1),
+ 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1),
'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535),
- 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
- 'INT' => array('php_type' => 'int', 'min' => (int) 0x80000000, 'max' => (int) 0x7fffffff),
+ 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
+ // Do not use (int) 0x80000000 - it evaluates to different
+ // values on 32-bit and 64-bit systems.
+ // Apparently -2147483648 is a float on 32-bit systems,
+ // despite fitting in an int, thus explicit cast is needed.
+ 'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff),
'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127),
'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255),
);
-
foreach ($value_ary as $value)
{
$column = explode(':', $value['column_type']);
@@ -522,7 +526,7 @@ function validate_range($value_ary, &$error) switch ($type['php_type'])
{
case 'string' :
- $max = (isset($column[1])) ? min($column[1], $type['max']) : $type['max'];
+ $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max'];
if (strlen($value['value']) > $max)
{
$error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max);
@@ -530,8 +534,8 @@ function validate_range($value_ary, &$error) break;
case 'int':
- $min = (isset($column[1])) ? max($column[1], $type['min']) : $type['min'];
- $max = (isset($column[2])) ? min($column[2], $type['max']) : $type['max'];
+ $min = (isset($column[1])) ? max($column[1],$type['min']) : $type['min'];
+ $max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max'];
if ($value['value'] < $min)
{
$error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$value['lang']], $min);
|