From b143069be065daeb7254bddfc84a8b2183c1e344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 8 Jun 2017 16:13:56 +0200 Subject: [PATCH] Simplify generating URL for php generated js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use URL::getCommon() instead of constructing URL manually. This fixes regression introduced by e317e481acaac54617fc20b96063a3f05e490733. Signed-off-by: Michal Čihař --- libraries/Header.php | 10 +++------- libraries/Scripts.php | 9 +++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libraries/Header.php b/libraries/Header.php index e21906e243..b754c20aa8 100644 --- a/libraries/Header.php +++ b/libraries/Header.php @@ -150,9 +150,7 @@ class Header // Localised strings $this->_scripts->addFile('jquery/jquery.min.js'); $this->_scripts->addFile('jquery/jquery-migrate-3.0.0.js'); - $this->_scripts->addFile( - 'whitelist.php' . URL::getCommon(), false, true - ); + $this->_scripts->addFile('whitelist.php'); $this->_scripts->addFile('sprintf.js'); $this->_scripts->addFile('ajax.js'); $this->_scripts->addFile('keyhandler.js'); @@ -179,7 +177,7 @@ class Header // Here would not be a good place to add CodeMirror because // the user preferences have not been merged at this point - $this->_scripts->addFile('messages.php' . URL::getCommon()); + $this->_scripts->addFile('messages.php'); // Append the theme id to this url to invalidate // the cache on a theme change. Though this might be // unavailable for fatal errors. @@ -188,9 +186,7 @@ class Header } else { $theme_id = 'default'; } - $this->_scripts->addFile( - 'get_image.js.php?theme=' . $theme_id - ); + $this->_scripts->addFile('get_image.js.php', false, array('theme' => $theme_id)); $this->_scripts->addFile('config.js'); $this->_scripts->addFile('doclinks.js'); $this->_scripts->addFile('functions.js'); diff --git a/libraries/Scripts.php b/libraries/Scripts.php index 2c8e9ecae9..f7a6152763 100644 --- a/libraries/Scripts.php +++ b/libraries/Scripts.php @@ -48,9 +48,8 @@ class Scripts $scripts = array(); $separator = URL::getArgSeparator(); foreach ($files as $value) { - if (mb_strpos($value['filename'], "?") !== false) { - $file_name = $value['filename'] . $separator - . Header::getVersionParameter(); + if (mb_strpos($value['filename'], ".php") !== false) { + $file_name = $value['filename'] . URL::getCommon($value['params'] + array('v' => PMA_VERSION)); if ($value['before_statics'] === true) { $first_dynamic_scripts .= "