From 8fcc943b7e7aa68d621d1c566c1c7239d9c2d579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 12 Feb 2016 12:19:26 +0100 Subject: [PATCH 1/2] Avoid javascript errors on invalid location hash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #11948 Signed-off-by: Michal Čihař --- ChangeLog | 1 + js/config.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 566c546e16..0cdc9e6bd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ phpMyAdmin - ChangeLog - issue #11940 Silent errors from checking local documentation - issue #11944 Fixed error on servers with disabled php_uname - issue #11946 Correctly store and report file upload errors +- issue #11948 Avoid javascript errors on invalid location hash 4.5.4.1 (2016-01-29) - issue #11892 Error with PMA 4.4.15.3 diff --git a/js/config.js b/js/config.js index 61e4481296..d3d5d71f23 100644 --- a/js/config.js +++ b/js/config.js @@ -600,7 +600,7 @@ AJAX.registerOnload('config.js', function () { var tab_check_fnc = function () { if (location.hash != prev_hash) { prev_hash = location.hash; - if (location.hash.match(/^#tab_.+/) && $('#' + location.hash.substr(5)).length) { + if (location.hash.match(/^#tab_[a-zA-Z0-9_]+/) && $('#' + location.hash.substr(5)).length) { setTab(location.hash.substr(5)); } } From e50a445d17525a8f04e57241a58f3517d1abaa86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 12 Feb 2016 12:43:30 +0100 Subject: [PATCH 2/2] Define is_ajax_request earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes PHP warning on configuration errors. Fixes #11950 Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/common.inc.php | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cdc9e6bd6..5a6cc33667 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ phpMyAdmin - ChangeLog - issue #11944 Fixed error on servers with disabled php_uname - issue #11946 Correctly store and report file upload errors - issue #11948 Avoid javascript errors on invalid location hash +- issue #11950 Fix PHP warning on configuration errors 4.5.4.1 (2016-01-29) - issue #11892 Error with PMA 4.4.15.3 diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 773e8a3200..c12a04c639 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -207,6 +207,20 @@ foreach (get_defined_vars() as $key => $value) { } unset($key, $value, $variables_whitelist); +/** + * @global boolean $GLOBALS['is_ajax_request'] + * @todo should this be moved to the variables init section above? + * + * Check if the current request is an AJAX request, and set is_ajax_request + * accordingly. Suppress headers, footers and unnecessary output if set to + * true + */ +if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { + $GLOBALS['is_ajax_request'] = true; +} else { + $GLOBALS['is_ajax_request'] = false; +} + /** * Subforms - some functions need to be called by form, cause of the limited URL @@ -1175,20 +1189,6 @@ $GLOBALS['PMA_Config']->set('default_server', ''); /* Tell tracker that it can actually work */ PMA_Tracker::enable(); -/** - * @global boolean $GLOBALS['is_ajax_request'] - * @todo should this be moved to the variables init section above? - * - * Check if the current request is an AJAX request, and set is_ajax_request - * accordingly. Suppress headers, footers and unnecessary output if set to - * true - */ -if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { - $GLOBALS['is_ajax_request'] = true; -} else { - $GLOBALS['is_ajax_request'] = false; -} - if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) { PMA_fatalError(__("GLOBALS overwrite attempt")); }