diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index 61592863c0..b681155ac6 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -174,6 +174,22 @@ class Advisor $this->runResult[$type][] = $rule; } + private function ruleExprEvaluate_var1($matches) + { + // '/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie' + return '1'; //isset($this->runResult[\'fired\'] + } + + private function ruleExprEvaluate_var2($matches) + { + // '/\b(\w+)\b/e' + return isset($this->variables[$matches[1]]) + ? (is_numeric($this->variables[$matches[1]]) + ? $this->variables[$matches[1]] + : '"'.$this->variables[$matches[1]].'"') + : $matches[1]; + } + // Runs a code expression, replacing variable names with their respective values // ignoreUntil: if > 0, it doesn't replace any variables until that string position, but still evaluates the whole expr function ruleExprEvaluate($expr, $ignoreUntil = 0) @@ -182,13 +198,14 @@ class Advisor $exprIgnore = substr($expr,0,$ignoreUntil); $expr = substr($expr,$ignoreUntil); } - $expr = preg_replace('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie','1',$expr); //isset($this->runResult[\'fired\'] - $expr = preg_replace('/\b(\w+)\b/e','isset($this->variables[\'\1\']) ? (!is_numeric($this->variables[\'\1\']) ? \'"\'.$this->variables[\'\1\'].\'"\' : $this->variables[\'\1\']) : \'\1\'', $expr); + $expr = preg_replace_callback('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Ui', array($this, 'ruleExprEvaluate_var1'), $expr); + $expr = preg_replace_callback('/\b(\w+)\b/', array($this, 'ruleExprEvaluate_var2'), $expr); if ($ignoreUntil > 0) { $expr = $exprIgnore . $expr; } $value = 0; $err = 0; + ob_start(); eval('$value = '.$expr.';'); $err = ob_get_contents(); diff --git a/libraries/advisory_rules.txt b/libraries/advisory_rules.txt index f13f838890..b2aa21df38 100644 --- a/libraries/advisory_rules.txt +++ b/libraries/advisory_rules.txt @@ -111,7 +111,7 @@ rule 'Distribution' rule 'MySQL Architecture' system_memory - value > 3072*1024 && !preg_match('/64/',version_compile_machine) + value > 3072*1024 && !preg_match('/64/',version_compile_machine) && !preg_match('/64/',version_compile_os) MySQL is not compiled as a 64-bit package. Your memory capacity is above 3 GiB (assuming the Server is on localhost), so MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL. Available memory on this host: %s | implode(' ',PMA_formatByteDown(value*1024, 2, 2)) diff --git a/libraries/url_generating.lib.php b/libraries/url_generating.lib.php index e3cc02a215..388412520a 100644 --- a/libraries/url_generating.lib.php +++ b/libraries/url_generating.lib.php @@ -9,13 +9,14 @@ /** * Generates text with hidden inputs. * - * @see PMA_generate_common_url() - * @param string optional database name - * (can also be an array of parameters) - * @param string optional table name - * @param int indenting level - * @param string do not generate a hidden field for this parameter - * (can be an array of strings) + * @param string $db optional database name + * (can also be an array of parameters) + * @param string $table optional table name + * @param int $indent indenting level + * @param string $skip do not generate a hidden field for this parameter + * (can be an array of strings) + * + * @see PMA_generate_common_url() * * @return string string with input fields * @@ -27,7 +28,6 @@ * @global boolean whether recoding is allowed or not * * @access public - * */ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array()) { @@ -48,15 +48,16 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $ } if (! empty($GLOBALS['server']) - && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) { + && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] + ) { $params['server'] = $GLOBALS['server']; } - if (empty($_COOKIE['pma_lang']) - && ! empty($GLOBALS['lang'])) { + if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } if (empty($_COOKIE['pma_collation_connection']) - && ! empty($GLOBALS['collation_connection'])) { + && ! empty($GLOBALS['collation_connection']) + ) { $params['collation_connection'] = $GLOBALS['collation_connection']; } @@ -102,8 +103,9 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $ * * * - * @param array $values - * @param string $pre + * @param array $values hidden values + * @param string $pre prefix + * * @return string form fields of type hidden */ function PMA_getHiddenFields($values, $pre = '') @@ -160,19 +162,20 @@ function PMA_getHiddenFields($values, $pre = '') * // script.php?server=1&lang=en * * - * @param mixed assoc. array with url params or optional string with database name - * if first param is an array there is also an ? prefixed to the url + * @param mixed assoc. array with url params or optional string with database name + * if first param is an array there is also an ? prefixed to the url * - * @param string - if first param is array: 'html' to use htmlspecialchars() - * on the resulting URL (for a normal URL displayed in HTML) - * or something else to avoid using htmlspecialchars() (for - * a URL sent via a header); if not set,'html' is assumed - * - if first param is not array: optional table name + * @param string - if first param is array: 'html' to use htmlspecialchars() + * on the resulting URL (for a normal URL displayed in HTML) + * or something else to avoid using htmlspecialchars() (for + * a URL sent via a header); if not set,'html' is assumed + * - if first param is not array: optional table name + * + * @param string - if first param is array: optional character to + * use instead of '?' + * - if first param is not array: optional character to use + * instead of '&' for dividing URL parameters * - * @param string - if first param is array: optional character to - * use instead of '?' - * - if first param is not array: optional character to use - * instead of '&' for dividing URL parameters * @return string string with URL parameters * @access public */ @@ -219,17 +222,18 @@ function PMA_generate_common_url() if (isset($GLOBALS['server']) && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] - // avoid overwriting when creating navi panel links to servers - && ! isset($params['server'])) { + // avoid overwriting when creating navi panel links to servers + && ! isset($params['server']) + ) { $params['server'] = $GLOBALS['server']; } - if (empty($_COOKIE['pma_lang']) - && ! empty($GLOBALS['lang'])) { + if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } if (empty($_COOKIE['pma_collation_connection']) - && ! empty($GLOBALS['collation_connection'])) { + && ! empty($GLOBALS['collation_connection']) + ) { $params['collation_connection'] = $GLOBALS['collation_connection']; } @@ -256,7 +260,9 @@ function PMA_generate_common_url() * extracted from arg_separator.input as set in php.ini * we do not use arg_separator.output to avoid problems with & and & * - * @param string whether to encode separator or not, currently 'none' or 'html' + * @param string $encode whether to encode separator or not, + * currently 'none' or 'html' + * * @return string character used for separating url parts usally ; or & * @access public */ @@ -278,13 +284,13 @@ function PMA_get_arg_separator($encode = 'none') } switch ($encode) { - case 'html': - return htmlentities($separator); - break; - case 'text' : - case 'none' : - default : - return $separator; + case 'html': + return htmlentities($separator); + break; + case 'text' : + case 'none' : + default : + return $separator; } } diff --git a/libraries/user_preferences.inc.php b/libraries/user_preferences.inc.php index 1b042171cf..8295100e30 100644 --- a/libraries/user_preferences.inc.php +++ b/libraries/user_preferences.inc.php @@ -27,9 +27,12 @@ $tabs_icons = array( 'Import' => 'ic_b_import', 'Export' => 'ic_b_export'); echo '