whitelist.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Exporting of $goto_whitelist from PHP to Javascript
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (!defined('TESTSUITE')) {
  9. chdir('..');
  10. // Send correct type:
  11. header('Content-Type: text/javascript; charset=UTF-8');
  12. // Cache output in client - the nocache query parameter makes sure that this
  13. // file is reloaded when config changes
  14. header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
  15. // Avoid loading the full common.inc.php because this would add many
  16. // non-js-compatible stuff like DOCTYPE
  17. define('PMA_MINIMUM_COMMON', true);
  18. define('PMA_PATH_TO_BASEDIR', '../');
  19. require_once './libraries/common.inc.php';
  20. // Close session early as we won't write anything there
  21. session_write_close();
  22. }
  23. $buffer = PhpMyAdmin\OutputBuffering::getInstance();
  24. $buffer->start();
  25. if (!defined('TESTSUITE')) {
  26. register_shutdown_function(
  27. function () {
  28. echo PhpMyAdmin\OutputBuffering::getInstance()->getContents();
  29. }
  30. );
  31. }
  32. echo "var PMA_gotoWhitelist = new Array();\n";
  33. $i = -1;
  34. foreach ($GLOBALS['goto_whitelist'] as $one_whitelist) {
  35. $i++;
  36. echo 'PMA_gotoWhitelist[' , $i , ']="' , $one_whitelist , '";' , "\n";
  37. }