messages.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. use PhpMyAdmin\Controllers\JavaScriptMessagesController;
  4. use PhpMyAdmin\OutputBuffering;
  5. global $containerBuilder;
  6. if (! defined('ROOT_PATH')) {
  7. // phpcs:disable PSR1.Files.SideEffects
  8. define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
  9. // phpcs:enable
  10. }
  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 file is reloaded when config changes.
  15. header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
  16. // Avoid loading the full common.inc.php because this would add many non-js-compatible stuff like DOCTYPE.
  17. // phpcs:disable PSR1.Files.SideEffects
  18. define('PMA_MINIMUM_COMMON', true);
  19. define('PMA_PATH_TO_BASEDIR', '../');
  20. define('PMA_NO_SESSION', true);
  21. // phpcs:enable
  22. require_once ROOT_PATH . 'libraries/common.inc.php';
  23. $buffer = OutputBuffering::getInstance();
  24. $buffer->start();
  25. register_shutdown_function(static function () {
  26. echo OutputBuffering::getInstance()->getContents();
  27. });
  28. /** @var JavaScriptMessagesController $controller */
  29. $controller = $containerBuilder->get(JavaScriptMessagesController::class);
  30. $controller->index();