Replace `global` keyword with `$GLOBALS`
[phpmyadmin.git] / js / messages.php
blob2844458935e8b9fd9bf1ee6d2f6a518cb6e80588
1 <?php
3 declare(strict_types=1);
5 use PhpMyAdmin\Common;
6 use PhpMyAdmin\Controllers\JavaScriptMessagesController;
7 use PhpMyAdmin\OutputBuffering;
9 if (! defined('ROOT_PATH')) {
10 // phpcs:disable PSR1.Files.SideEffects
11 define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
12 // phpcs:enable
15 if (PHP_VERSION_ID < 70205) {
16 die('<p>PHP 7.2.5+ is required.</p><p>Currently installed version is: ' . PHP_VERSION . '</p>');
19 // phpcs:disable PSR1.Files.SideEffects
20 define('PHPMYADMIN', true);
21 // phpcs:enable
23 require_once ROOT_PATH . 'libraries/constants.php';
25 /**
26 * Activate autoloader
28 if (! @is_readable(AUTOLOAD_FILE)) {
29 die(
30 '<p>File <samp>' . AUTOLOAD_FILE . '</samp> missing or not readable.</p>'
31 . '<p>Most likely you did not run Composer to '
32 . '<a href="https://docs.phpmyadmin.net/en/latest/setup.html#installing-from-git">'
33 . 'install library files</a>.</p>'
37 require AUTOLOAD_FILE;
39 chdir('..');
41 // Send correct type.
42 header('Content-Type: text/javascript; charset=UTF-8');
44 // Cache output in client - the nocache query parameter makes sure that this file is reloaded when config changes.
45 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' GMT');
47 $GLOBALS['isMinimumCommon'] = true;
48 // phpcs:disable PSR1.Files.SideEffects
49 define('PMA_PATH_TO_BASEDIR', '../');
50 define('PMA_NO_SESSION', true);
51 // phpcs:enable
53 Common::run();
55 $buffer = OutputBuffering::getInstance();
56 $buffer->start();
58 register_shutdown_function(static function (): void {
59 echo OutputBuffering::getInstance()->getContents();
60 });
62 /** @var JavaScriptMessagesController $controller */
63 $controller = $GLOBALS['containerBuilder']->get(JavaScriptMessagesController::class);
64 $controller();