whitelist.php 1.3 KB

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