2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Concatenates several js files to reduce the number of
5 * http requests sent to the server
12 // Close session early as we won't write anything there
13 session_write_close();
16 header('Content-Type: text/javascript; charset=UTF-8');
17 // Enable browser cache for 1 hour
18 header('Expires: ' . gmdate('D, d M Y H:i:s', time() +
3600) . ' GMT');
20 // When a token is not presented, even though whitelisted arrays are removed
21 // in PMA_removeRequestVars(). This is a workaround for that.
22 $_GET['scripts'] = json_encode($_GET['scripts']);
24 // Avoid loading the full common.inc.php because this would add many
25 // non-js-compatible stuff like DOCTYPE
26 define('PMA_MINIMUM_COMMON', true);
27 require_once './libraries/common.inc.php';
29 require_once './libraries/OutputBuffering.class.php';
30 $buffer = PMA_OutputBuffering
::getInstance();
32 register_shutdown_function(
34 echo PMA_OutputBuffering
::getInstance()->getContents();
38 $_GET['scripts'] = json_decode($_GET['scripts']);
39 if (! empty($_GET['scripts']) && is_array($_GET['scripts'])) {
40 foreach ($_GET['scripts'] as $script) {
44 $path = explode("/", $script);
45 foreach ($path as $index => $filename) {
46 // Allow alphanumeric, "." and "-" chars only, no files starting
48 if (preg_match("@^[\w][\w\.-]+$@", $filename)) {
49 $script_name .= DIRECTORY_SEPARATOR
. $filename;
53 // Output file contents
54 if (preg_match("@\.js$@", $script_name) && is_readable($script_name)) {
55 readfile($script_name);
61 if (isset($_GET['call_done'])) {
62 echo "AJAX.scriptHandler.done();";