diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-04-09 11:37:36 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-04-09 11:37:36 +0300 |
commit | 847fa854e6b755ef83692d30c8a28a13476bde77 (patch) | |
tree | 3cdb11f847519842e5a90f9fb83b94605cd53fef /js/get_scripts.js.php | |
parent | 214e54ceec5210a7f881ae987d05431bbf6d3ddd (diff) |
Output buffering for static JS
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/get_scripts.js.php')
-rw-r--r-- | js/get_scripts.js.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/get_scripts.js.php b/js/get_scripts.js.php index fdeddf4c3b..742213e0f1 100644 --- a/js/get_scripts.js.php +++ b/js/get_scripts.js.php @@ -17,6 +17,23 @@ header('Content-Type: text/javascript; charset=UTF-8'); // Enable browser cache for 1 hour header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT'); +// When a token is not presented, even though whitelisted arrays are removed +// in PMA_removeRequestVars(). This is a workaround for that. +$_GET['scripts'] = json_encode($_GET['scripts']); + +// Avoid loading the full common.inc.php because this would add many +// non-js-compatible stuff like DOCTYPE +define('PMA_MINIMUM_COMMON', true); +require_once './libraries/common.inc.php'; + +include_once './libraries/OutputBuffering.class.php'; +$buffer = PMA_OutputBuffering::getInstance(); +$buffer->start(); +register_shutdown_function(function() { + echo PMA_OutputBuffering::getInstance()->getContents(); +}); + +$_GET['scripts'] = json_decode($_GET['scripts']); if (! empty($_GET['scripts']) && is_array($_GET['scripts'])) { foreach ($_GET['scripts'] as $script) { // Sanitise filename |