Output buffering for static JS

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-04-09 14:07:36 +05:30
parent 214e54ceec
commit 847fa854e6
2 changed files with 20 additions and 1 deletions

View File

@ -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

View File

@ -495,7 +495,9 @@ if ($token_mismatch) {
/* Permit redirection with token-mismatch in url.php */
'url',
/* Permit session expiry flag */
'session_expired'
'session_expired',
/* JS loading */
'scripts', 'call_done'
);
/**
* Allow changing themes in test/theme.php