From 7e33d227f554171a88399de6860577d48f837d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 8 Mar 2021 15:03:12 -0300 Subject: [PATCH] Rename the PMA_Config global variable to config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .../classes/Command/CacheWarmupCommand.php | 6 ++-- libraries/classes/Config/FormDisplay.php | 8 ++--- libraries/classes/Config/PageSettings.php | 2 +- libraries/classes/Config/Validator.php | 4 +-- .../Preferences/ExportController.php | 6 ++-- .../Preferences/FeaturesController.php | 6 ++-- .../Preferences/ImportController.php | 6 ++-- .../Preferences/MainPanelController.php | 6 ++-- .../Preferences/ManageController.php | 32 +++++++++---------- .../Preferences/NavigationController.php | 6 ++-- .../Controllers/Preferences/SqlController.php | 6 ++-- libraries/classes/Core.php | 12 +++---- libraries/classes/Encoding.php | 2 +- libraries/classes/ErrorReport.php | 4 +-- libraries/classes/Export.php | 8 ++--- libraries/classes/Export/Options.php | 8 ++--- libraries/classes/File.php | 2 +- libraries/classes/Header.php | 10 +++--- libraries/classes/LanguageManager.php | 16 +++++----- libraries/classes/Logging.php | 4 +-- .../Plugins/Auth/AuthenticationConfig.php | 2 +- .../Plugins/Auth/AuthenticationCookie.php | 24 +++++++------- .../classes/Plugins/AuthenticationPlugin.php | 4 +-- .../classes/Plugins/Import/ImportShp.php | 2 +- libraries/classes/Plugins/TwoFactor/Key.php | 4 +-- libraries/classes/Plugins/TwoFactorPlugin.php | 6 ++-- libraries/classes/Sanitize.php | 2 +- libraries/classes/Setup/ConfigGenerator.php | 2 +- libraries/classes/Setup/Index.php | 2 +- libraries/classes/Template.php | 2 +- libraries/classes/ThemeManager.php | 10 +++--- libraries/classes/Url.php | 10 +++--- libraries/common.inc.php | 26 +++++++-------- scripts/console | 4 +-- setup/lib/common.inc.php | 4 +-- test/bootstrap-dist.php | 4 +-- test/bootstrap-static.php | 10 +++--- test/classes/AbstractTestCase.php | 10 +++--- test/classes/Config/FormDisplayTest.php | 2 +- test/classes/Config/Forms/FormListTest.php | 2 +- test/classes/Config/PageSettingsTest.php | 2 +- test/classes/ConfigTest.php | 2 +- .../ExportTemplateControllerTest.php | 6 ++-- .../Server/BinlogControllerTest.php | 2 +- .../Server/CollationsControllerTest.php | 2 +- .../Server/DatabasesControllerTest.php | 2 +- .../Server/EnginesControllerTest.php | 2 +- .../Server/PluginsControllerTest.php | 2 +- .../Server/Status/AdvisorControllerTest.php | 2 +- .../Server/Status/MonitorControllerTest.php | 2 +- .../Server/Status/ProcessesControllerTest.php | 2 +- .../Server/Status/QueriesControllerTest.php | 2 +- .../Server/Status/StatusControllerTest.php | 2 +- .../Server/Status/VariablesControllerTest.php | 2 +- .../Server/VariablesControllerTest.php | 2 +- .../Table/FindReplaceControllerTest.php | 2 +- .../TransformationOverviewControllerTest.php | 2 +- test/classes/CoreTest.php | 12 +++---- test/classes/Database/EventsTest.php | 2 +- test/classes/Database/RoutinesTest.php | 2 +- test/classes/Database/TriggersTest.php | 2 +- test/classes/Display/ResultsTest.php | 2 +- test/classes/ErrorReportTest.php | 2 +- test/classes/Export/OptionsTest.php | 4 +-- test/classes/FooterTest.php | 2 +- test/classes/HeaderTest.php | 2 +- test/classes/LanguageTest.php | 24 +++++++------- .../classes/Navigation/NavigationTreeTest.php | 2 +- test/classes/PdfTest.php | 2 +- .../Plugins/Auth/AuthenticationConfigTest.php | 2 +- .../Plugins/Auth/AuthenticationCookieTest.php | 22 ++++++------- .../Plugins/Auth/AuthenticationHttpTest.php | 2 +- .../Plugins/Auth/AuthenticationSignonTest.php | 2 +- .../TransformationPluginsTest.php | 2 +- test/classes/Server/PrivilegesTest.php | 4 +-- test/classes/Setup/ConfigGeneratorTest.php | 2 +- test/classes/ThemeTest.php | 2 +- test/classes/TrackingTest.php | 4 +-- test/classes/TwoFactorTest.php | 10 +++--- test/classes/UserPreferencesTest.php | 4 +-- test/classes/UtilTest.php | 2 +- 81 files changed, 220 insertions(+), 220 deletions(-) diff --git a/libraries/classes/Command/CacheWarmupCommand.php b/libraries/classes/Command/CacheWarmupCommand.php index ce4209e652..f02c66331b 100644 --- a/libraries/classes/Command/CacheWarmupCommand.php +++ b/libraries/classes/Command/CacheWarmupCommand.php @@ -112,12 +112,12 @@ final class CacheWarmupCommand extends Command private function warmUpTwigCache(OutputInterface $output): int { - global $cfg, $PMA_Config, $dbi; + global $cfg, $config, $dbi; $output->writeln('Warming up the twig cache', OutputInterface::VERBOSITY_VERBOSE); $cfg['environment'] = 'production'; - $PMA_Config = new Config(CONFIG_FILE); - $PMA_Config->set('environment', $cfg['environment']); + $config = new Config(CONFIG_FILE); + $config->set('environment', $cfg['environment']); $dbi = new DatabaseInterface(new DbiDummy()); $tplDir = ROOT_PATH . 'templates'; $tmpDir = ROOT_PATH . 'twig-templates'; diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index f7fcb205d9..b89f8abaa0 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -112,7 +112,7 @@ class FormDisplay */ public function __construct(ConfigFile $cf) { - $this->formDisplayTemplate = new FormDisplayTemplate($GLOBALS['PMA_Config']); + $this->formDisplayTemplate = new FormDisplayTemplate($GLOBALS['config']); $this->configFile = $cf; // initialize validators Validator::getValidators($this->configFile); @@ -594,7 +594,7 @@ class FormDisplay $values = []; $toSave = []; - $isSetupScript = $GLOBALS['PMA_Config']->get('is_setup'); + $isSetupScript = $GLOBALS['config']->get('is_setup'); if ($isSetupScript) { $this->loadUserprefsInfo(); } @@ -814,7 +814,7 @@ class FormDisplay $this->userprefsKeys = array_flip(UserFormList::getFields()); // read real config for user preferences display - $userPrefsDisallow = $GLOBALS['PMA_Config']->get('is_setup') + $userPrefsDisallow = $GLOBALS['config']->get('is_setup') ? $this->configFile->get('UserprefsDisallow', []) : $GLOBALS['cfg']['UserprefsDisallow']; $this->userprefsDisallow = array_flip($userPrefsDisallow ?? []); @@ -899,7 +899,7 @@ class FormDisplay $opts['comment_warning'] = true; } - if ($GLOBALS['PMA_Config']->get('is_setup')) { + if ($GLOBALS['config']->get('is_setup')) { return; } diff --git a/libraries/classes/Config/PageSettings.php b/libraries/classes/Config/PageSettings.php index 9992bc6c4f..a5dcac7b36 100644 --- a/libraries/classes/Config/PageSettings.php +++ b/libraries/classes/Config/PageSettings.php @@ -72,7 +72,7 @@ class PageSettings $this->groupName = $formGroupName; - $cf = new ConfigFile($GLOBALS['PMA_Config']->baseSettings); + $cf = new ConfigFile($GLOBALS['config']->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new $formClass($cf); diff --git a/libraries/classes/Config/Validator.php b/libraries/classes/Config/Validator.php index cb469dac67..f887811c0a 100644 --- a/libraries/classes/Config/Validator.php +++ b/libraries/classes/Config/Validator.php @@ -69,7 +69,7 @@ class Validator } $validators = $cf->getDbEntry('_validators', []); - if ($GLOBALS['PMA_Config']->get('is_setup')) { + if ($GLOBALS['config']->get('is_setup')) { return $validators; } @@ -92,7 +92,7 @@ class Validator $uv[$i] = Core::arrayRead( mb_substr($uv[$i], 6), - $GLOBALS['PMA_Config']->baseSettings + $GLOBALS['config']->baseSettings ); } } diff --git a/libraries/classes/Controllers/Preferences/ExportController.php b/libraries/classes/Controllers/Preferences/ExportController.php index b363c40457..dd4c16d7f8 100644 --- a/libraries/classes/Controllers/Preferences/ExportController.php +++ b/libraries/classes/Controllers/Preferences/ExportController.php @@ -43,9 +43,9 @@ class ExportController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new ExportForm($cf, 1); @@ -68,7 +68,7 @@ class ExportController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Controllers/Preferences/FeaturesController.php b/libraries/classes/Controllers/Preferences/FeaturesController.php index ad82e5b70a..a3b5c9e6c6 100644 --- a/libraries/classes/Controllers/Preferences/FeaturesController.php +++ b/libraries/classes/Controllers/Preferences/FeaturesController.php @@ -43,9 +43,9 @@ class FeaturesController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new FeaturesForm($cf, 1); @@ -68,7 +68,7 @@ class FeaturesController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Controllers/Preferences/ImportController.php b/libraries/classes/Controllers/Preferences/ImportController.php index 9f28e43274..862679497e 100644 --- a/libraries/classes/Controllers/Preferences/ImportController.php +++ b/libraries/classes/Controllers/Preferences/ImportController.php @@ -43,9 +43,9 @@ class ImportController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new ImportForm($cf, 1); @@ -68,7 +68,7 @@ class ImportController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Controllers/Preferences/MainPanelController.php b/libraries/classes/Controllers/Preferences/MainPanelController.php index 81e278954a..d6c8c7d8ee 100644 --- a/libraries/classes/Controllers/Preferences/MainPanelController.php +++ b/libraries/classes/Controllers/Preferences/MainPanelController.php @@ -43,9 +43,9 @@ class MainPanelController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new MainForm($cf, 1); @@ -68,7 +68,7 @@ class MainPanelController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Controllers/Preferences/ManageController.php b/libraries/classes/Controllers/Preferences/ManageController.php index 280797a34f..f46c611fd7 100644 --- a/libraries/classes/Controllers/Preferences/ManageController.php +++ b/libraries/classes/Controllers/Preferences/ManageController.php @@ -62,10 +62,10 @@ class ManageController extends AbstractController public function index(): void { - global $cf, $error, $filename, $json, $PMA_Config, $lang, $max_upload_size; - global $new_config, $config, $return_url, $form_display, $all_ok, $params, $query, $route; + global $cf, $error, $filename, $json, $config, $lang, $max_upload_size; + global $new_config, $return_url, $form_display, $all_ok, $params, $query, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $error = ''; @@ -129,9 +129,9 @@ class ManageController extends AbstractController // hide header message $_SESSION['userprefs_autoload'] = true; - $config = json_decode($json, true); + $configuration = json_decode($json, true); $return_url = $_POST['return_url'] ?? null; - if (! is_array($config)) { + if (! is_array($configuration)) { if (! isset($error)) { $error = __('Could not import configuration'); } @@ -144,7 +144,7 @@ class ManageController extends AbstractController $new_config = array_merge($new_config, $cf->getConfigArray()); } - $new_config = array_merge($new_config, $config); + $new_config = array_merge($new_config, $configuration); $_POST_bak = $_POST; foreach ($new_config as $k => $v) { $_POST[str_replace('/', '-', (string) $k)] = $v; @@ -184,19 +184,19 @@ class ManageController extends AbstractController $params = []; $tmanager = ThemeManager::getInstance(); if ( - isset($config['ThemeDefault']) - && $tmanager->theme->getId() != $config['ThemeDefault'] - && $tmanager->checkTheme($config['ThemeDefault']) + isset($configuration['ThemeDefault']) + && $tmanager->theme->getId() != $configuration['ThemeDefault'] + && $tmanager->checkTheme($configuration['ThemeDefault']) ) { - $tmanager->setActiveTheme($config['ThemeDefault']); + $tmanager->setActiveTheme($configuration['ThemeDefault']); $tmanager->setThemeCookie(); } if ( - isset($config['lang']) - && $config['lang'] != $lang + isset($configuration['lang']) + && $configuration['lang'] != $lang ) { - $params['lang'] = $config['lang']; + $params['lang'] = $configuration['lang']; } // save settings @@ -220,7 +220,7 @@ class ManageController extends AbstractController } // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $this->userPreferences->redirect($return_url ?? '', $params); return; @@ -232,8 +232,8 @@ class ManageController extends AbstractController $result = $this->userPreferences->save([]); if ($result === true) { $params = []; - $PMA_Config->removeCookie('pma_collaction_connection'); - $PMA_Config->removeCookie('pma_lang'); + $config->removeCookie('pma_collaction_connection'); + $config->removeCookie('pma_lang'); $this->userPreferences->redirect('index.php?route=/preferences/manage', $params); return; diff --git a/libraries/classes/Controllers/Preferences/NavigationController.php b/libraries/classes/Controllers/Preferences/NavigationController.php index 6fdb112626..fca9decb4f 100644 --- a/libraries/classes/Controllers/Preferences/NavigationController.php +++ b/libraries/classes/Controllers/Preferences/NavigationController.php @@ -43,9 +43,9 @@ class NavigationController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new NaviForm($cf, 1); @@ -68,7 +68,7 @@ class NavigationController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Controllers/Preferences/SqlController.php b/libraries/classes/Controllers/Preferences/SqlController.php index 386b6cb788..0e7bd6bd8e 100644 --- a/libraries/classes/Controllers/Preferences/SqlController.php +++ b/libraries/classes/Controllers/Preferences/SqlController.php @@ -43,9 +43,9 @@ class SqlController extends AbstractController public function index(): void { global $cfg, $cf, $error, $tabHash, $hash; - global $server, $PMA_Config, $route; + global $server, $config, $route; - $cf = new ConfigFile($PMA_Config->baseSettings); + $cf = new ConfigFile($config->baseSettings); $this->userPreferences->pageInit($cf); $formDisplay = new SqlForm($cf, 1); @@ -68,7 +68,7 @@ class SqlController extends AbstractController $twoFactor->save(); if ($result === true) { // reload config - $PMA_Config->loadUserPreferences(); + $config->loadUserPreferences(); $tabHash = $_POST['tab_hash'] ?? null; $hash = ltrim($tabHash, '#'); $this->userPreferences->redirect( diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 66865939b9..d612a2307b 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -277,8 +277,8 @@ class Core * (this can happen on early fatal error) */ if ( - isset($dbi, $GLOBALS['PMA_Config']) && $dbi !== null - && $GLOBALS['PMA_Config']->get('is_setup') === false + isset($dbi, $GLOBALS['config']) && $dbi !== null + && $GLOBALS['config']->get('is_setup') === false && Response::getInstance()->isAjax() ) { $response = Response::getInstance(); @@ -540,7 +540,7 @@ class Core */ public static function sendHeaderLocation(string $uri, bool $use_refresh = false): void { - if ($GLOBALS['PMA_Config']->get('PMA_IS_IIS') && mb_strlen($uri) > 600) { + if ($GLOBALS['config']->get('PMA_IS_IIS') && mb_strlen($uri) > 600) { Response::getInstance()->disable(); $template = new Template(); @@ -554,7 +554,7 @@ class Core * like /phpmyadmin/index.php/ which some web servers happily accept. */ if ($uri[0] === '.') { - $uri = $GLOBALS['PMA_Config']->getRootPath() . substr($uri, 2); + $uri = $GLOBALS['config']->getRootPath() . substr($uri, 2); } $response = Response::getInstance(); @@ -570,7 +570,7 @@ class Core // bug #1523784: IE6 does not like 'Refresh: 0', it // results in a blank page // but we need it when coming from the cookie login panel) - if ($GLOBALS['PMA_Config']->get('PMA_IS_IIS') && $use_refresh) { + if ($GLOBALS['config']->get('PMA_IS_IIS') && $use_refresh) { $response->header('Refresh: 0; ' . $uri); } else { $response->header('Location: ' . $uri); @@ -781,7 +781,7 @@ class Core parse_str($arr['query'] ?? '', $vars); $query = http_build_query(['url' => $vars['url']]); - if ($GLOBALS['PMA_Config'] !== null && $GLOBALS['PMA_Config']->get('is_setup')) { + if ($GLOBALS['config'] !== null && $GLOBALS['config']->get('is_setup')) { $url = '../url.php?' . $query; } else { $url = './url.php?' . $query; diff --git a/libraries/classes/Encoding.php b/libraries/classes/Encoding.php index d66da8d67c..12002366ed 100644 --- a/libraries/classes/Encoding.php +++ b/libraries/classes/Encoding.php @@ -302,7 +302,7 @@ class Encoding return $file; } - $tmpfname = (string) tempnam($GLOBALS['PMA_Config']->getUploadTempDir(), $enc); + $tmpfname = (string) tempnam($GLOBALS['config']->getUploadTempDir(), $enc); $fpd = fopen($tmpfname, 'wb'); $fps = fopen($file, 'r'); self::kanjiChangeOrder(); diff --git a/libraries/classes/ErrorReport.php b/libraries/classes/ErrorReport.php index 872595981d..9a143ceef4 100644 --- a/libraries/classes/ErrorReport.php +++ b/libraries/classes/ErrorReport.php @@ -73,7 +73,7 @@ class ErrorReport */ public function getData(string $exceptionType = 'js'): array { - global $PMA_Config; + global $config; $relParams = $this->relation->getRelationsParam(); // common params for both, php & js exceptions @@ -84,7 +84,7 @@ class ErrorReport 'user_os' => PMA_USR_OS, 'server_software' => $_SERVER['SERVER_SOFTWARE'], 'user_agent_string' => $_SERVER['HTTP_USER_AGENT'], - 'locale' => $PMA_Config->getCookie('pma_lang'), + 'locale' => $config->getCookie('pma_lang'), 'configuration_storage' => $relParams['db'] === null ? 'disabled' : 'enabled', 'php_version' => PHP_VERSION, diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index 6aeca9f0b4..3c011daa8a 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -364,7 +364,7 @@ class Export ): array { if ($export_type === 'server') { if (! empty($remember_template)) { - $GLOBALS['PMA_Config']->setUserValue( + $GLOBALS['config']->setUserValue( 'pma_server_filename_template', 'Export/file_template_server', $filename_template @@ -372,7 +372,7 @@ class Export } } elseif ($export_type === 'database') { if (! empty($remember_template)) { - $GLOBALS['PMA_Config']->setUserValue( + $GLOBALS['config']->setUserValue( 'pma_db_filename_template', 'Export/file_template_database', $filename_template @@ -380,7 +380,7 @@ class Export } } elseif ($export_type === 'raw') { if (! empty($remember_template)) { - $GLOBALS['PMA_Config']->setUserValue( + $GLOBALS['config']->setUserValue( 'pma_raw_filename_template', 'Export/file_template_raw', $filename_template @@ -388,7 +388,7 @@ class Export } } else { if (! empty($remember_template)) { - $GLOBALS['PMA_Config']->setUserValue( + $GLOBALS['config']->setUserValue( 'pma_table_filename_template', 'Export/file_template_table', $filename_template diff --git a/libraries/classes/Export/Options.php b/libraries/classes/Export/Options.php index 18b13c5872..0e5293ee4e 100644 --- a/libraries/classes/Export/Options.php +++ b/libraries/classes/Export/Options.php @@ -219,27 +219,27 @@ final class Options private function getFileNameTemplate(string $exportType, ?string $filename = null): string { - global $cfg, $PMA_Config; + global $cfg, $config; if ($filename !== null) { return $filename; } if ($exportType === 'database') { - return (string) $PMA_Config->getUserValue( + return (string) $config->getUserValue( 'pma_db_filename_template', $cfg['Export']['file_template_database'] ); } if ($exportType === 'table') { - return (string) $PMA_Config->getUserValue( + return (string) $config->getUserValue( 'pma_table_filename_template', $cfg['Export']['file_template_table'] ); } - return (string) $PMA_Config->getUserValue( + return (string) $config->getUserValue( 'pma_server_filename_template', $cfg['Export']['file_template_server'] ); diff --git a/libraries/classes/File.php b/libraries/classes/File.php index 571dea1fa4..9c1798a3a1 100644 --- a/libraries/classes/File.php +++ b/libraries/classes/File.php @@ -549,7 +549,7 @@ class File return true; } - $tmp_subdir = $GLOBALS['PMA_Config']->getUploadTempDir(); + $tmp_subdir = $GLOBALS['config']->getUploadTempDir(); if ($tmp_subdir === null) { // cannot create directory or access, point user to FAQ 1.11 $this->errorMessage = Message::error(__( diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index 1c72e0c7f6..a64d9260b8 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -147,7 +147,7 @@ class Header // (detection will be done in JavaScript) $this->userprefsOfferImport = false; if ( - $GLOBALS['PMA_Config']->get('user_preferences') === 'session' + $GLOBALS['config']->get('user_preferences') === 'session' && ! isset($_SESSION['userprefs_autoload']) ) { $this->userprefsOfferImport = true; @@ -205,7 +205,7 @@ class Header $this->scripts->addFile('drag_drop_import.js'); } - if (! $GLOBALS['PMA_Config']->get('DisableShortcutKeys')) { + if (! $GLOBALS['config']->get('DisableShortcutKeys')) { $this->scripts->addFile('shortcuts_handler.js'); } @@ -253,8 +253,8 @@ class Header 'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'], 'session_gc_maxlifetime' => (int) ini_get('session.gc_maxlifetime'), 'logged_in' => isset($dbi) ? $dbi->isConnected() : false, - 'is_https' => $GLOBALS['PMA_Config']->isHttps(), - 'rootPath' => $GLOBALS['PMA_Config']->getRootPath(), + 'is_https' => $GLOBALS['config']->isHttps(), + 'rootPath' => $GLOBALS['config']->getRootPath(), 'arg_separator' => Url::getArgSeparator(), 'PMA_VERSION' => PMA_VERSION, ]; @@ -398,7 +398,7 @@ class Header $this->sendHttpHeaders(); $baseDir = defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; - $uniqueValue = $GLOBALS['PMA_Config']->getThemeUniqueValue(); + $uniqueValue = $GLOBALS['config']->getThemeUniqueValue(); $themePath = $theme instanceof Theme ? $theme->getPath() : ''; $version = self::getVersionParameter(); diff --git a/libraries/classes/LanguageManager.php b/libraries/classes/LanguageManager.php index 5746ca7fd6..6c684438f9 100644 --- a/libraries/classes/LanguageManager.php +++ b/libraries/classes/LanguageManager.php @@ -784,11 +784,11 @@ class LanguageManager public function availableLocales() { if (! $this->availableLocales) { - if (! isset($GLOBALS['PMA_Config']) || empty($GLOBALS['PMA_Config']->get('FilterLanguages'))) { + if (! isset($GLOBALS['config']) || empty($GLOBALS['config']->get('FilterLanguages'))) { $this->availableLocales = $this->listLocaleDir(); } else { $this->availableLocales = preg_grep( - '@' . $GLOBALS['PMA_Config']->get('FilterLanguages') . '@', + '@' . $GLOBALS['config']->get('FilterLanguages') . '@', $this->listLocaleDir() ); } @@ -896,8 +896,8 @@ class LanguageManager public function selectLanguage() { // check forced language - if (! empty($GLOBALS['PMA_Config']->get('Lang'))) { - $lang = $this->getLanguage($GLOBALS['PMA_Config']->get('Lang')); + if (! empty($GLOBALS['config']->get('Lang'))) { + $lang = $this->getLanguage($GLOBALS['config']->get('Lang')); if ($lang !== false) { return $lang; } @@ -927,8 +927,8 @@ class LanguageManager } // check previous set language - if (! empty($GLOBALS['PMA_Config']->getCookie('pma_lang'))) { - $lang = $this->getLanguage($GLOBALS['PMA_Config']->getCookie('pma_lang')); + if (! empty($GLOBALS['config']->getCookie('pma_lang'))) { + $lang = $this->getLanguage($GLOBALS['config']->getCookie('pma_lang')); if ($lang !== false) { return $lang; } @@ -961,8 +961,8 @@ class LanguageManager } // Didn't catch any valid lang : we use the default settings - if (isset($langs[$GLOBALS['PMA_Config']->get('DefaultLang')])) { - return $langs[$GLOBALS['PMA_Config']->get('DefaultLang')]; + if (isset($langs[$GLOBALS['config']->get('DefaultLang')])) { + return $langs[$GLOBALS['config']->get('DefaultLang')]; } // Fallback to English diff --git a/libraries/classes/Logging.php b/libraries/classes/Logging.php index b4d4ad2c1a..2e24fcd7c2 100644 --- a/libraries/classes/Logging.php +++ b/libraries/classes/Logging.php @@ -33,7 +33,7 @@ class Logging */ public static function getLogDestination() { - $log_file = $GLOBALS['PMA_Config']->get('AuthLog'); + $log_file = $GLOBALS['config']->get('AuthLog'); /* Autodetect */ if ($log_file === 'auto') { @@ -82,7 +82,7 @@ class Logging } /* Do not log successful authentications */ - if (! $GLOBALS['PMA_Config']->get('AuthLogSuccess') && $status === 'ok') { + if (! $GLOBALS['config']->get('AuthLogSuccess') && $status === 'ok') { return; } diff --git a/libraries/classes/Plugins/Auth/AuthenticationConfig.php b/libraries/classes/Plugins/Auth/AuthenticationConfig.php index 8bb8cb92f6..203db819e1 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationConfig.php +++ b/libraries/classes/Plugins/Auth/AuthenticationConfig.php @@ -107,7 +107,7 @@ class AuthenticationConfig extends AuthenticationPlugin trigger_error(__('Access denied!'), E_USER_NOTICE); } else { // Check whether user has configured something - if ($GLOBALS['PMA_Config']->sourceMtime == 0) { + if ($GLOBALS['config']->sourceMtime == 0) { echo '

' , sprintf( __( 'You probably did not create a configuration file.' diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index 51d42790ae..4050e859e5 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -395,7 +395,7 @@ class AuthenticationCookie extends AuthenticationPlugin // and $this->password variables from cookies // check cookies - $serverCookie = $GLOBALS['PMA_Config']->getCookie('pmaUser-' . $GLOBALS['server']); + $serverCookie = $GLOBALS['config']->getCookie('pmaUser-' . $GLOBALS['server']); if (empty($serverCookie)) { return false; } @@ -446,7 +446,7 @@ class AuthenticationCookie extends AuthenticationPlugin } // check password cookie - $serverCookie = $GLOBALS['PMA_Config']->getCookie('pmaAuth-' . $GLOBALS['server']); + $serverCookie = $GLOBALS['config']->getCookie('pmaAuth-' . $GLOBALS['server']); if (empty($serverCookie)) { return false; @@ -606,7 +606,7 @@ class AuthenticationCookie extends AuthenticationPlugin { // Name and password cookies need to be refreshed each time // Duration = one month for username - $GLOBALS['PMA_Config']->setCookie( + $GLOBALS['config']->setCookie( 'pmaUser-' . $GLOBALS['server'], $this->cookieEncrypt( $username, @@ -630,7 +630,7 @@ class AuthenticationCookie extends AuthenticationPlugin } // Duration = as configured - $GLOBALS['PMA_Config']->setCookie( + $GLOBALS['config']->setCookie( 'pmaAuth-' . $GLOBALS['server'], $this->cookieEncrypt( json_encode($payload), @@ -661,7 +661,7 @@ class AuthenticationCookie extends AuthenticationPlugin parent::showFailure($failure); // Deletes password cookie and displays the login form - $GLOBALS['PMA_Config']->removeCookie('pmaAuth-' . $GLOBALS['server']); + $GLOBALS['config']->removeCookie('pmaAuth-' . $GLOBALS['server']); $conn_error = $this->getErrorMessage($failure); @@ -956,23 +956,23 @@ class AuthenticationCookie extends AuthenticationPlugin */ public function logOut() { - global $PMA_Config; + global $config; // -> delete password cookie(s) if ($GLOBALS['cfg']['LoginCookieDeleteAll']) { foreach ($GLOBALS['cfg']['Servers'] as $key => $val) { - $PMA_Config->removeCookie('pmaAuth-' . $key); - if (! $PMA_Config->issetCookie('pmaAuth-' . $key)) { + $config->removeCookie('pmaAuth-' . $key); + if (! $config->issetCookie('pmaAuth-' . $key)) { continue; } - $PMA_Config->removeCookie('pmaAuth-' . $key); + $config->removeCookie('pmaAuth-' . $key); } } else { $cookieName = 'pmaAuth-' . $GLOBALS['server']; - $PMA_Config->removeCookie($cookieName); - if ($PMA_Config->issetCookie($cookieName)) { - $PMA_Config->removeCookie($cookieName); + $config->removeCookie($cookieName); + if ($config->issetCookie($cookieName)) { + $config->removeCookie($cookieName); } } diff --git a/libraries/classes/Plugins/AuthenticationPlugin.php b/libraries/classes/Plugins/AuthenticationPlugin.php index eb46840e2d..f1f49250ee 100644 --- a/libraries/classes/Plugins/AuthenticationPlugin.php +++ b/libraries/classes/Plugins/AuthenticationPlugin.php @@ -119,7 +119,7 @@ abstract class AuthenticationPlugin */ public function logOut() { - global $PMA_Config; + global $config; /* Obtain redirect URL (before doing logout) */ if (! empty($GLOBALS['cfg']['Server']['LogoutURL'])) { @@ -141,7 +141,7 @@ abstract class AuthenticationPlugin && $GLOBALS['cfg']['Server']['auth_type'] === 'cookie' ) { foreach ($GLOBALS['cfg']['Servers'] as $key => $val) { - if (! $PMA_Config->issetCookie('pmaAuth-' . $key)) { + if (! $config->issetCookie('pmaAuth-' . $key)) { continue; } diff --git a/libraries/classes/Plugins/Import/ImportShp.php b/libraries/classes/Plugins/Import/ImportShp.php index eb5357082e..aa323fbe4c 100644 --- a/libraries/classes/Plugins/Import/ImportShp.php +++ b/libraries/classes/Plugins/Import/ImportShp.php @@ -114,7 +114,7 @@ class ImportShp extends ImportPlugin $temp_dbf_file = false; // We need dbase extension to handle .dbf file if (extension_loaded('dbase')) { - $temp = $GLOBALS['PMA_Config']->getTempDir('shp'); + $temp = $GLOBALS['config']->getTempDir('shp'); // If we can extract the zip archive to 'TempDir' // and use the files in it for import if ($compression === 'application/zip' && $temp !== null) { diff --git a/libraries/classes/Plugins/TwoFactor/Key.php b/libraries/classes/Plugins/TwoFactor/Key.php index 7f924bdfea..70929a8ea4 100644 --- a/libraries/classes/Plugins/TwoFactor/Key.php +++ b/libraries/classes/Plugins/TwoFactor/Key.php @@ -131,7 +131,7 @@ class Key extends TwoFactorPlugin return $this->template->render('login/twofactor/key', [ 'request' => json_encode($request), - 'is_https' => $GLOBALS['PMA_Config']->isHttps(), + 'is_https' => $GLOBALS['config']->isHttps(), ]); } @@ -159,7 +159,7 @@ class Key extends TwoFactorPlugin return $this->template->render('login/twofactor/key_configure', [ 'request' => json_encode($registrationData['request']), 'signatures' => json_encode($registrationData['signatures']), - 'is_https' => $GLOBALS['PMA_Config']->isHttps(), + 'is_https' => $GLOBALS['config']->isHttps(), ]); } diff --git a/libraries/classes/Plugins/TwoFactorPlugin.php b/libraries/classes/Plugins/TwoFactorPlugin.php index f10662d3fb..5235ae5ad0 100644 --- a/libraries/classes/Plugins/TwoFactorPlugin.php +++ b/libraries/classes/Plugins/TwoFactorPlugin.php @@ -154,9 +154,9 @@ class TwoFactorPlugin */ public function getAppId($return_url) { - global $PMA_Config; + global $config; - $url = $PMA_Config->get('PmaAbsoluteUri'); + $url = $config->get('PmaAbsoluteUri'); $parsed = []; if (! empty($url)) { $parsedUrl = parse_url($url); @@ -167,7 +167,7 @@ class TwoFactorPlugin } if (! isset($parsed['scheme']) || strlen($parsed['scheme']) === 0) { - $parsed['scheme'] = $PMA_Config->isHttps() ? 'https' : 'http'; + $parsed['scheme'] = $config->isHttps() ? 'https' : 'http'; } if (! isset($parsed['host']) || strlen($parsed['host']) === 0) { diff --git a/libraries/classes/Sanitize.php b/libraries/classes/Sanitize.php index edf3130e0a..0ee7e60a78 100644 --- a/libraries/classes/Sanitize.php +++ b/libraries/classes/Sanitize.php @@ -91,7 +91,7 @@ class Sanitize */ public static function isSetup(): bool { - return $GLOBALS['PMA_Config'] !== null && $GLOBALS['PMA_Config']->get('is_setup'); + return $GLOBALS['config'] !== null && $GLOBALS['config']->get('is_setup'); } /** diff --git a/libraries/classes/Setup/ConfigGenerator.php b/libraries/classes/Setup/ConfigGenerator.php index fa52f392d7..650bfcd451 100644 --- a/libraries/classes/Setup/ConfigGenerator.php +++ b/libraries/classes/Setup/ConfigGenerator.php @@ -45,7 +45,7 @@ class ConfigGenerator . '/**' . $crlf . ' * Generated configuration file' . $crlf . ' * Generated by: phpMyAdmin ' - . $GLOBALS['PMA_Config']->get('PMA_VERSION') + . $GLOBALS['config']->get('PMA_VERSION') . ' setup script' . $crlf . ' * Date: ' . gmdate(DATE_RFC1123) . $crlf . ' */' . $crlf . $crlf; diff --git a/libraries/classes/Setup/Index.php b/libraries/classes/Setup/Index.php index 095968be8a..0425e7c0c6 100644 --- a/libraries/classes/Setup/Index.php +++ b/libraries/classes/Setup/Index.php @@ -163,7 +163,7 @@ class Index } $version_local = $versionInformation->versionToInt( - $GLOBALS['PMA_Config']->get('PMA_VERSION') + $GLOBALS['config']->get('PMA_VERSION') ); if ($version_local === false) { self::messagesSet( diff --git a/libraries/classes/Template.php b/libraries/classes/Template.php index da2742c959..24a03791ce 100644 --- a/libraries/classes/Template.php +++ b/libraries/classes/Template.php @@ -51,7 +51,7 @@ class Template global $cfg; /** @var Config|null $config */ - $config = $GLOBALS['PMA_Config']; + $config = $GLOBALS['config']; if (static::$twig !== null) { return; } diff --git a/libraries/classes/ThemeManager.php b/libraries/classes/ThemeManager.php index 8f00a04764..cadc6ba762 100644 --- a/libraries/classes/ThemeManager.php +++ b/libraries/classes/ThemeManager.php @@ -181,11 +181,11 @@ class ThemeManager */ public function getThemeCookie() { - global $PMA_Config; + global $config; $name = $this->getThemeCookieName(); - if ($PMA_Config->issetCookie($name)) { - return $PMA_Config->getCookie($name); + if ($config->issetCookie($name)) { + return $config->getCookie($name); } return false; @@ -201,14 +201,14 @@ class ThemeManager public function setThemeCookie(): bool { $themeId = $this->theme !== null ? (string) $this->theme->id : ''; - $GLOBALS['PMA_Config']->setCookie( + $GLOBALS['config']->setCookie( $this->getThemeCookieName(), $themeId, $this->themeDefault ); // force a change of a dummy session variable to avoid problems // with the caching of phpmyadmin.css.php - $GLOBALS['PMA_Config']->set('theme-update', $themeId); + $GLOBALS['config']->set('theme-update', $themeId); return true; } diff --git a/libraries/classes/Url.php b/libraries/classes/Url.php index 14c38090fb..ffbe204894 100644 --- a/libraries/classes/Url.php +++ b/libraries/classes/Url.php @@ -42,7 +42,7 @@ class Url $indent = 0, $skip = [] ) { - global $PMA_Config; + global $config; if (is_array($db)) { $params =& $db; @@ -64,7 +64,7 @@ class Url $params['server'] = $GLOBALS['server']; } - if (empty($PMA_Config->getCookie('pma_lang')) && ! empty($GLOBALS['lang'])) { + if (empty($config->getCookie('pma_lang')) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } @@ -213,7 +213,7 @@ class Url */ public static function getCommonRaw($params = [], $divider = '?') { - global $PMA_Config; + global $config; $separator = self::getArgSeparator(); @@ -222,14 +222,14 @@ class Url isset($GLOBALS['server']) && $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault'] && ! isset($params['server']) - && ! $PMA_Config->get('is_setup') + && ! $config->get('is_setup') ) { $params['server'] = $GLOBALS['server']; } // Can be null when the user is missing an extension. // See: Core::checkExtensions() - if ($PMA_Config !== null && empty($PMA_Config->getCookie('pma_lang')) && ! empty($GLOBALS['lang'])) { + if ($config !== null && empty($config->getCookie('pma_lang')) && ! empty($GLOBALS['lang'])) { $params['lang'] = $GLOBALS['lang']; } diff --git a/libraries/common.inc.php b/libraries/common.inc.php index ccad8ea2a7..9a1ff0e6b7 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -47,7 +47,7 @@ use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\ThemeManager; use PhpMyAdmin\Tracker; -global $containerBuilder, $error_handler, $PMA_Config, $server, $dbi; +global $containerBuilder, $error_handler, $config, $server, $dbi; global $lang, $cfg, $isConfigLoading, $auth_plugin, $route, $theme; global $url_params, $goto, $back, $db, $table, $sql_query, $token_mismatch; @@ -136,9 +136,9 @@ $isConfigLoading = false; * Force reading of config file, because we removed sensitive values * in the previous iteration. * - * @var Config $PMA_Config + * @var Config $config */ -$PMA_Config = $containerBuilder->get('config'); +$config = $containerBuilder->get('config'); register_shutdown_function([Config::class, 'fatalErrorHandler']); @@ -146,7 +146,7 @@ register_shutdown_function([Config::class, 'fatalErrorHandler']); * include session handling after the globals, to prevent overwriting */ if (! defined('PMA_NO_SESSION')) { - Session::setUp($PMA_Config, $error_handler); + Session::setUp($config, $error_handler); } /** @@ -161,7 +161,7 @@ if (! defined('PMA_NO_SESSION')) { $url_params = []; $containerBuilder->setParameter('url_params', $url_params); -Core::setGotoAndBackGlobals($containerBuilder, $PMA_Config); +Core::setGotoAndBackGlobals($containerBuilder, $config); Core::checkTokenRequestParam(); @@ -195,8 +195,8 @@ $language->activate(); * check for errors occurred while loading configuration * this check is done here after loading language files to present errors in locale */ -$PMA_Config->checkPermissions(); -$PMA_Config->checkErrors(); +$config->checkPermissions(); +$config->checkErrors(); /* Check server configuration */ Core::checkConfiguration(); @@ -206,14 +206,14 @@ Core::checkRequest(); /* setup servers LABEL_setup_servers */ -$PMA_Config->checkServers(); +$config->checkServers(); /** * current server * * @global integer $server */ -$server = $PMA_Config->selectServer(); +$server = $config->selectServer(); $url_params['server'] = $server; $containerBuilder->setParameter('server', $server); $containerBuilder->setParameter('url_params', $url_params); @@ -222,7 +222,7 @@ $containerBuilder->setParameter('url_params', $url_params); * BC - enable backward compatibility * exports all configuration settings into globals ($cfg global) */ -$PMA_Config->enableBc(); +$config->enableBc(); /* setup themes LABEL_theme_setup */ @@ -237,7 +237,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { * * @todo should be done in PhpMyAdmin\Config */ - $PMA_Config->setCookie('pma_lang', (string) $lang); + $config->setCookie('pma_lang', (string) $lang); ThemeManager::getInstance()->setThemeCookie(); @@ -246,7 +246,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { $containerBuilder->setAlias('dbi', DatabaseInterface::class); if (! empty($cfg['Server'])) { - $PMA_Config->getLoginCookieValidityFromCache($server); + $config->getLoginCookieValidityFromCache($server); $auth_plugin = Plugins::getAuthPlugin(); $auth_plugin->authenticate(); @@ -303,7 +303,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { } // load user preferences -$PMA_Config->loadUserPreferences(); +$config->loadUserPreferences(); $containerBuilder->set('theme_manager', ThemeManager::getInstance()); diff --git a/scripts/console b/scripts/console index daa77be2e7..9cb4d8561c 100755 --- a/scripts/console +++ b/scripts/console @@ -38,8 +38,8 @@ if (! class_exists(Application::class)) { } $cfg['environment'] = 'production'; -$PMA_Config = new Config(CONFIG_FILE); -$PMA_Config->set('environment', $cfg['environment']); +$config = new Config(CONFIG_FILE); +$config->set('environment', $cfg['environment']); $dbi = new DatabaseInterface(new DbiDummy()); $tplDir = ROOT_PATH . 'templates'; $tmpDir = ROOT_PATH . 'twig-templates'; diff --git a/setup/lib/common.inc.php b/setup/lib/common.inc.php index 26566e5ab4..573f1fb1e6 100644 --- a/setup/lib/common.inc.php +++ b/setup/lib/common.inc.php @@ -24,8 +24,8 @@ require_once ROOT_PATH . 'libraries/common.inc.php'; restore_error_handler(); // Save current language in a cookie, required since we use PMA_MINIMUM_COMMON -$GLOBALS['PMA_Config']->setCookie('pma_lang', (string) $GLOBALS['lang']); -$GLOBALS['PMA_Config']->set('is_setup', true); +$GLOBALS['config']->setCookie('pma_lang', (string) $GLOBALS['lang']); +$GLOBALS['config']->set('is_setup', true); $GLOBALS['ConfigFile'] = new ConfigFile(); $GLOBALS['ConfigFile']->setPersistKeys( diff --git a/test/bootstrap-dist.php b/test/bootstrap-dist.php index aa39313a6c..196719f2f9 100644 --- a/test/bootstrap-dist.php +++ b/test/bootstrap-dist.php @@ -47,8 +47,8 @@ require_once ROOT_PATH . 'libraries/vendor_config.php'; require_once AUTOLOAD_FILE; Loader::loadFunctions(); -$GLOBALS['PMA_Config'] = new Config(); -$GLOBALS['PMA_Config']->set('environment', 'development'); +$GLOBALS['config'] = new Config(); +$GLOBALS['config']->set('environment', 'development'); $GLOBALS['cfg']['environment'] = 'development'; /* Load Database interface */ diff --git a/test/bootstrap-static.php b/test/bootstrap-static.php index 89928afa73..eaad98f717 100644 --- a/test/bootstrap-static.php +++ b/test/bootstrap-static.php @@ -30,18 +30,18 @@ require_once AUTOLOAD_FILE; $GLOBALS['cfg'] = $cfg; $GLOBALS['server'] = 0; -$GLOBALS['PMA_Config'] = new Config(); +$GLOBALS['config'] = new Config(); // phpcs:disable PSR1.Files.SideEffects -define('PMA_VERSION', $GLOBALS['PMA_Config']->get('PMA_VERSION')); +define('PMA_VERSION', $GLOBALS['config']->get('PMA_VERSION')); define('PMA_PATH_TO_BASEDIR', ''); // phpcs:enable $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36' . ' (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36'; -$GLOBALS['PMA_Config']->checkClient(); -$GLOBALS['PMA_Config']->checkWebServerOs(); -$GLOBALS['PMA_Config']->enableBc();// Defines constants, phpstan:level=1 +$GLOBALS['config']->checkClient(); +$GLOBALS['config']->checkWebServerOs(); +$GLOBALS['config']->enableBc();// Defines constants, phpstan:level=1 Loader::loadFunctions(); diff --git a/test/classes/AbstractTestCase.php b/test/classes/AbstractTestCase.php index 33580426e7..5f801c0ca4 100644 --- a/test/classes/AbstractTestCase.php +++ b/test/classes/AbstractTestCase.php @@ -126,9 +126,9 @@ abstract class AbstractTestCase extends TestCase protected function setGlobalConfig(): void { - global $PMA_Config; - $PMA_Config = new Config(); - $PMA_Config->set('environment', 'development'); + global $config; + $config = new Config(); + $config->set('environment', 'development'); } protected function setTheme(): void @@ -169,11 +169,11 @@ abstract class AbstractTestCase extends TestCase protected function defineVersionConstants(): void { - global $PMA_Config; + global $config; // Initialize PMA_VERSION variable // phpcs:disable PSR1.Files.SideEffects if (! defined('PMA_VERSION')) { - define('PMA_VERSION', $PMA_Config->get('PMA_VERSION')); + define('PMA_VERSION', $config->get('PMA_VERSION')); } // phpcs:enable } diff --git a/test/classes/Config/FormDisplayTest.php b/test/classes/Config/FormDisplayTest.php index b546e2b48c..e7fad34d6f 100644 --- a/test/classes/Config/FormDisplayTest.php +++ b/test/classes/Config/FormDisplayTest.php @@ -503,7 +503,7 @@ class FormDisplayTest extends AbstractTestCase $opts['comment_warning'] ); - $GLOBALS['PMA_Config']->set('is_setup', false); + $GLOBALS['config']->set('is_setup', false); $GLOBALS['cfg']['MaxDbList'] = 10; $GLOBALS['cfg']['MaxTableList'] = 10; diff --git a/test/classes/Config/Forms/FormListTest.php b/test/classes/Config/Forms/FormListTest.php index a6c8608272..164ac6e50b 100644 --- a/test/classes/Config/Forms/FormListTest.php +++ b/test/classes/Config/Forms/FormListTest.php @@ -27,7 +27,7 @@ class FormListTest extends AbstractTestCase */ public function testForms(string $class, string $prefix): void { - $cf = new ConfigFile($GLOBALS['PMA_Config']->baseSettings); + $cf = new ConfigFile($GLOBALS['config']->baseSettings); /* Static API */ $this->assertTrue($class::isValid('Export')); diff --git a/test/classes/Config/PageSettingsTest.php b/test/classes/Config/PageSettingsTest.php index 8282e44721..28f6f58620 100644 --- a/test/classes/Config/PageSettingsTest.php +++ b/test/classes/Config/PageSettingsTest.php @@ -21,7 +21,7 @@ class PageSettingsTest extends AbstractTestCase parent::setLanguage(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; $GLOBALS['table'] = ''; diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php index 00e9336c64..290d96855d 100644 --- a/test/classes/ConfigTest.php +++ b/test/classes/ConfigTest.php @@ -61,7 +61,7 @@ class ConfigTest extends AbstractTestCase $GLOBALS['server'] = 0; $_SESSION['git_location'] = '.git'; $_SESSION['is_git_revision'] = true; - $GLOBALS['PMA_Config'] = new Config(CONFIG_FILE); + $GLOBALS['config'] = new Config(CONFIG_FILE); $GLOBALS['cfg']['ProxyUrl'] = ''; //for testing file permissions diff --git a/test/classes/Controllers/ExportTemplateControllerTest.php b/test/classes/Controllers/ExportTemplateControllerTest.php index 7a6523c788..ec5c666f6c 100644 --- a/test/classes/Controllers/ExportTemplateControllerTest.php +++ b/test/classes/Controllers/ExportTemplateControllerTest.php @@ -26,13 +26,13 @@ class ExportTemplateControllerTest extends AbstractTestCase protected function setUp(): void { - global $dbi, $PMA_Config; + global $dbi, $config; $this->setGlobalDbi(); parent::setTheme(); - $PMA_Config = new Config(); - $PMA_Config->enableBc(); + $config = new Config(); + $config->enableBc(); $_SESSION = [' PMA_token ' => 'token']; $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/BinlogControllerTest.php b/test/classes/Controllers/Server/BinlogControllerTest.php index 8d7ec60b5a..1f4611b57e 100644 --- a/test/classes/Controllers/Server/BinlogControllerTest.php +++ b/test/classes/Controllers/Server/BinlogControllerTest.php @@ -23,7 +23,7 @@ class BinlogControllerTest extends AbstractTestCase $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['MaxRows'] = 10; $GLOBALS['cfg']['ServerDefault'] = 'server'; diff --git a/test/classes/Controllers/Server/CollationsControllerTest.php b/test/classes/Controllers/Server/CollationsControllerTest.php index 43cc0cd92f..ad1528bc0b 100644 --- a/test/classes/Controllers/Server/CollationsControllerTest.php +++ b/test/classes/Controllers/Server/CollationsControllerTest.php @@ -21,7 +21,7 @@ class CollationsControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::defineVersionConstants(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; diff --git a/test/classes/Controllers/Server/DatabasesControllerTest.php b/test/classes/Controllers/Server/DatabasesControllerTest.php index 7bdf6abd04..20831665d7 100644 --- a/test/classes/Controllers/Server/DatabasesControllerTest.php +++ b/test/classes/Controllers/Server/DatabasesControllerTest.php @@ -23,7 +23,7 @@ class DatabasesControllerTest extends AbstractTestCase parent::setUp(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'pma_test'; diff --git a/test/classes/Controllers/Server/EnginesControllerTest.php b/test/classes/Controllers/Server/EnginesControllerTest.php index 897b2135b8..4c871f17f2 100644 --- a/test/classes/Controllers/Server/EnginesControllerTest.php +++ b/test/classes/Controllers/Server/EnginesControllerTest.php @@ -25,7 +25,7 @@ class EnginesControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::defineVersionConstants(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; diff --git a/test/classes/Controllers/Server/PluginsControllerTest.php b/test/classes/Controllers/Server/PluginsControllerTest.php index f7f7647629..ea1ee5a2ad 100644 --- a/test/classes/Controllers/Server/PluginsControllerTest.php +++ b/test/classes/Controllers/Server/PluginsControllerTest.php @@ -23,7 +23,7 @@ class PluginsControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::defineVersionConstants(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; diff --git a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php index a696166d04..3d7cafaf79 100644 --- a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php +++ b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php @@ -28,7 +28,7 @@ class AdvisorControllerTest extends AbstractTestCase parent::setUp(); $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php index 42d257ad84..66c49ba4a0 100644 --- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php +++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php @@ -22,7 +22,7 @@ class MonitorControllerTest extends AbstractTestCase parent::setUp(); $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index 4a36e43ca5..4d024ddfc2 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -23,7 +23,7 @@ class ProcessesControllerTest extends AbstractTestCase parent::setUp(); $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php index 6b66f2b18b..3b5ff5b368 100644 --- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php +++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php @@ -24,7 +24,7 @@ class QueriesControllerTest extends AbstractTestCase parent::setUp(); $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php index ac842a19c4..098b3b9bee 100644 --- a/test/classes/Controllers/Server/Status/StatusControllerTest.php +++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php @@ -19,7 +19,7 @@ class StatusControllerTest extends AbstractTestCase parent::setUp(); $GLOBALS['text_dir'] = 'ltr'; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php index b6918d1d40..4bf8ece8b2 100644 --- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php @@ -20,7 +20,7 @@ class VariablesControllerTest extends AbstractTestCase parent::setUp(); parent::defineVersionConstants(); parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); parent::setTheme(); $GLOBALS['text_dir'] = 'ltr'; diff --git a/test/classes/Controllers/Server/VariablesControllerTest.php b/test/classes/Controllers/Server/VariablesControllerTest.php index 6d837d3a44..37a79bbcc2 100644 --- a/test/classes/Controllers/Server/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/VariablesControllerTest.php @@ -27,7 +27,7 @@ class VariablesControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::setLanguage(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['server'] = 1; diff --git a/test/classes/Controllers/Table/FindReplaceControllerTest.php b/test/classes/Controllers/Table/FindReplaceControllerTest.php index 05fc12efde..9618180259 100644 --- a/test/classes/Controllers/Table/FindReplaceControllerTest.php +++ b/test/classes/Controllers/Table/FindReplaceControllerTest.php @@ -20,7 +20,7 @@ class FindReplaceControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::defineVersionConstants(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; diff --git a/test/classes/Controllers/TransformationOverviewControllerTest.php b/test/classes/Controllers/TransformationOverviewControllerTest.php index c297d41aea..80512d23a4 100644 --- a/test/classes/Controllers/TransformationOverviewControllerTest.php +++ b/test/classes/Controllers/TransformationOverviewControllerTest.php @@ -21,7 +21,7 @@ class TransformationOverviewControllerTest extends AbstractTestCase parent::setGlobalConfig(); parent::setTheme(); $GLOBALS['text_dir'] = 'ltr'; - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'db'; diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php index 884828d625..e9336818ee 100644 --- a/test/classes/CoreTest.php +++ b/test/classes/CoreTest.php @@ -584,8 +584,8 @@ class CoreTest extends AbstractNetworkTestCase public function testSendHeaderLocationWithoutSidWithIis(): void { $GLOBALS['server'] = 0; - $GLOBALS['PMA_Config']->enableBc(); - $GLOBALS['PMA_Config']->set('PMA_IS_IIS', true); + $GLOBALS['config']->enableBc(); + $GLOBALS['config']->set('PMA_IS_IIS', true); $testUri = 'https://example.com/test.php'; @@ -603,8 +603,8 @@ class CoreTest extends AbstractNetworkTestCase { $GLOBALS['server'] = 0; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); - $GLOBALS['PMA_Config']->set('PMA_IS_IIS', null); + $GLOBALS['config']->enableBc(); + $GLOBALS['config']->set('PMA_IS_IIS', null); $testUri = 'https://example.com/test.php'; @@ -619,8 +619,8 @@ class CoreTest extends AbstractNetworkTestCase { $GLOBALS['server'] = 0; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); - $GLOBALS['PMA_Config']->set('PMA_IS_IIS', true); + $GLOBALS['config']->enableBc(); + $GLOBALS['config']->set('PMA_IS_IIS', true); // over 600 chars $testUri = 'https://example.com/test.php?testlonguri=over600chars&test=test' diff --git a/test/classes/Database/EventsTest.php b/test/classes/Database/EventsTest.php index 2cfa82bb2c..6ae7d94c3c 100644 --- a/test/classes/Database/EventsTest.php +++ b/test/classes/Database/EventsTest.php @@ -25,7 +25,7 @@ class EventsTest extends AbstractTestCase parent::setLanguage(); parent::setTheme(); $GLOBALS['text_dir'] = 'ltr'; - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 0; $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; diff --git a/test/classes/Database/RoutinesTest.php b/test/classes/Database/RoutinesTest.php index e935e2face..c86c2e705e 100644 --- a/test/classes/Database/RoutinesTest.php +++ b/test/classes/Database/RoutinesTest.php @@ -26,7 +26,7 @@ class RoutinesTest extends AbstractTestCase parent::defineVersionConstants(); parent::setLanguage(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['ActionLinksMode'] = 'icons'; $GLOBALS['server'] = 0; diff --git a/test/classes/Database/TriggersTest.php b/test/classes/Database/TriggersTest.php index fcbbcf1be1..c8e07da341 100644 --- a/test/classes/Database/TriggersTest.php +++ b/test/classes/Database/TriggersTest.php @@ -25,7 +25,7 @@ class TriggersTest extends AbstractTestCase parent::setLanguage(); parent::setTheme(); $GLOBALS['server'] = 0; - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['db'] = 'pma_test'; $GLOBALS['table'] = 'table'; diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index 585947c39d..42c12d056d 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -56,7 +56,7 @@ class ResultsTest extends AbstractTestCase $GLOBALS['table'] = 'table'; $GLOBALS['PMA_PHP_SELF'] = 'index.php'; $this->object = new DisplayResults('as', '', 0, '', ''); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['cfg']['Server']['DisableIS'] = false; $_SESSION[' HMAC_secret '] = 'test'; diff --git a/test/classes/ErrorReportTest.php b/test/classes/ErrorReportTest.php index 3bce795eb0..ba082dcbcf 100644 --- a/test/classes/ErrorReportTest.php +++ b/test/classes/ErrorReportTest.php @@ -42,7 +42,7 @@ class ErrorReportTest extends AbstractTestCase $_SERVER['SERVER_SOFTWARE'] = 'SERVER_SOFTWARE'; $_SERVER['HTTP_USER_AGENT'] = 'HTTP_USER_AGENT'; $_COOKIE['pma_lang'] = 'en'; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); if (! defined('PMA_USR_BROWSER_AGENT')) { define('PMA_USR_BROWSER_AGENT', 'Other'); diff --git a/test/classes/Export/OptionsTest.php b/test/classes/Export/OptionsTest.php index 52b3422af6..af2ab681fb 100644 --- a/test/classes/Export/OptionsTest.php +++ b/test/classes/Export/OptionsTest.php @@ -24,7 +24,7 @@ class OptionsTest extends AbstractTestCase parent::setUp(); parent::setLanguage(); parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['host'] = 'localhost'; $GLOBALS['cfg']['Server']['user'] = 'pma_user'; $GLOBALS['server'] = 0; @@ -43,7 +43,7 @@ class OptionsTest extends AbstractTestCase ->method('getUserValue') ->will($this->returnValue('user value for test')); - $GLOBALS['PMA_Config'] = $pmaconfig; + $GLOBALS['config'] = $pmaconfig; $this->export = new Options( new Relation($GLOBALS['dbi']), diff --git a/test/classes/FooterTest.php b/test/classes/FooterTest.php index d9f3094170..6a0a31d366 100644 --- a/test/classes/FooterTest.php +++ b/test/classes/FooterTest.php @@ -34,7 +34,7 @@ class FooterTest extends AbstractTestCase $GLOBALS['db'] = ''; $GLOBALS['table'] = ''; $GLOBALS['text_dir'] = 'ltr'; - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['verbose'] = 'verbose host'; $GLOBALS['server'] = '1'; diff --git a/test/classes/HeaderTest.php b/test/classes/HeaderTest.php index 0f48683868..ef8d9371b0 100644 --- a/test/classes/HeaderTest.php +++ b/test/classes/HeaderTest.php @@ -36,7 +36,7 @@ class HeaderTest extends AbstractTestCase $GLOBALS['db'] = 'db'; $GLOBALS['table'] = ''; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Servers'] = []; $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['verbose'] = 'verbose host'; diff --git a/test/classes/LanguageTest.php b/test/classes/LanguageTest.php index 7cd442deb9..904d6f390a 100644 --- a/test/classes/LanguageTest.php +++ b/test/classes/LanguageTest.php @@ -41,13 +41,13 @@ class LanguageTest extends AbstractTestCase */ public function testAvailable(): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', 'cs|en$'); + $GLOBALS['config']->set('FilterLanguages', 'cs|en$'); $langs = $this->manager->availableLocales(); $this->assertCount(2, $langs); $this->assertContains('cs', $langs); - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('FilterLanguages', ''); } /** @@ -55,7 +55,7 @@ class LanguageTest extends AbstractTestCase */ public function testAllAvailable(): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('FilterLanguages', ''); $langs = $this->manager->availableLocales(); @@ -97,7 +97,7 @@ class LanguageTest extends AbstractTestCase */ public function testMySQLLocale(): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('FilterLanguages', ''); $czech = $this->manager->getLanguage('cs'); $this->assertNotFalse($czech); $this->assertEquals('cs_CZ', $czech->getMySQLLocale()); @@ -121,7 +121,7 @@ class LanguageTest extends AbstractTestCase */ public function testGet(): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('FilterLanguages', ''); $lang = $this->manager->getLanguage('cs'); $this->assertNotEquals(false, $lang); $this->assertEquals('Czech', $lang->getEnglishName()); @@ -154,27 +154,27 @@ class LanguageTest extends AbstractTestCase string $default, string $expect ): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); - $GLOBALS['PMA_Config']->set('Lang', $lang); - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('Lang', $lang); + $GLOBALS['config']->set('is_https', false); $_POST['lang'] = $post; $_GET['lang'] = $get; $_COOKIE['pma_lang'] = $cookie; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $accept; $_SERVER['HTTP_USER_AGENT'] = $agent; - $GLOBALS['PMA_Config']->set('DefaultLang', $default); + $GLOBALS['config']->set('DefaultLang', $default); $lang = $this->manager->selectLanguage(); $this->assertEquals($expect, $lang->getEnglishName()); - $GLOBALS['PMA_Config']->set('Lang', ''); + $GLOBALS['config']->set('Lang', ''); $_POST['lang'] = ''; $_GET['lang'] = ''; $_COOKIE['pma_lang'] = ''; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = ''; $_SERVER['HTTP_USER_AGENT'] = ''; - $GLOBALS['PMA_Config']->set('DefaultLang', 'en'); + $GLOBALS['config']->set('DefaultLang', 'en'); } /** @@ -288,7 +288,7 @@ class LanguageTest extends AbstractTestCase */ public function testGettext(string $locale): void { - $GLOBALS['PMA_Config']->set('FilterLanguages', ''); + $GLOBALS['config']->set('FilterLanguages', ''); /* We should be able to set the language */ $this->manager->getLanguage($locale)->activate(); diff --git a/test/classes/Navigation/NavigationTreeTest.php b/test/classes/Navigation/NavigationTreeTest.php index 6a0ddd715d..9777496583 100644 --- a/test/classes/Navigation/NavigationTreeTest.php +++ b/test/classes/Navigation/NavigationTreeTest.php @@ -25,7 +25,7 @@ class NavigationTreeTest extends AbstractTestCase parent::setGlobalConfig(); parent::setTheme(); $GLOBALS['server'] = 1; - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['host'] = 'localhost'; $GLOBALS['cfg']['Server']['user'] = 'user'; $GLOBALS['cfg']['Server']['pmadb'] = ''; diff --git a/test/classes/PdfTest.php b/test/classes/PdfTest.php index 68388906a8..af860dc3ff 100644 --- a/test/classes/PdfTest.php +++ b/test/classes/PdfTest.php @@ -15,7 +15,7 @@ class PdfTest extends AbstractTestCase { parent::setUp(); parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); } /** diff --git a/test/classes/Plugins/Auth/AuthenticationConfigTest.php b/test/classes/Plugins/Auth/AuthenticationConfigTest.php index caa8615777..702274720e 100644 --- a/test/classes/Plugins/Auth/AuthenticationConfigTest.php +++ b/test/classes/Plugins/Auth/AuthenticationConfigTest.php @@ -26,7 +26,7 @@ class AuthenticationConfigTest extends AbstractTestCase parent::setLanguage(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 0; $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php index 485d97def1..5ede365d49 100644 --- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -39,7 +39,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase parent::setLanguage(); parent::setTheme(); parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 0; $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['db'] = 'db'; @@ -429,7 +429,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase public function testAuthHeaderPartial(): void { - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); $GLOBALS['cfg']['LoginCookieDeleteAll'] = false; $GLOBALS['cfg']['Servers'] = [ 1, @@ -476,8 +476,8 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = ''; $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $GLOBALS['cfg']['LoginCookieDeleteAll'] = true; - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('PmaAbsoluteUri', ''); + $GLOBALS['config']->set('is_https', false); $GLOBALS['cfg']['Servers'] = [1]; $_COOKIE['pmaAuth-0'] = 'test'; @@ -500,8 +500,8 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = ''; $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $GLOBALS['cfg']['LoginCookieDeleteAll'] = false; - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('PmaAbsoluteUri', ''); + $GLOBALS['config']->set('is_https', false); $GLOBALS['cfg']['Servers'] = [1]; $GLOBALS['server'] = 1; $GLOBALS['cfg']['Server'] = ['auth_type' => 'cookie']; @@ -600,7 +600,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['cfg']['CaptchaResponseParam'] = ''; $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = ''; $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); // mock for blowfish function $this->object = $this->getMockBuilder(AuthenticationCookie::class) @@ -639,7 +639,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $_SESSION['browser_access_time']['default'] = time() - 1000; $GLOBALS['cfg']['LoginCookieValidity'] = 1440; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); // mock for blowfish function $this->object = $this->getMockBuilder(AuthenticationCookie::class) @@ -682,7 +682,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $GLOBALS['cfg']['LoginCookieValidity'] = 0; $_SESSION['browser_access_time']['default'] = -1; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); // mock for blowfish function $this->object = $this->getMockBuilder(AuthenticationCookie::class) @@ -722,7 +722,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $GLOBALS['server'] = 2; $GLOBALS['cfg']['LoginCookieStore'] = true; $GLOBALS['from_cookie'] = true; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); $this->object->storeCredentials(); @@ -1138,7 +1138,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase public function testPasswordChange(): void { $newPassword = 'PMAPASSWD2'; - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); $GLOBALS['cfg']['AllowArbitraryServer'] = true; $GLOBALS['pma_auth_server'] = 'b 2'; $_SESSION['encryption_key'] = ''; diff --git a/test/classes/Plugins/Auth/AuthenticationHttpTest.php b/test/classes/Plugins/Auth/AuthenticationHttpTest.php index 7217c8fbca..969114ed33 100644 --- a/test/classes/Plugins/Auth/AuthenticationHttpTest.php +++ b/test/classes/Plugins/Auth/AuthenticationHttpTest.php @@ -27,7 +27,7 @@ class AuthenticationHttpTest extends AbstractNetworkTestCase parent::setUp(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Servers'] = []; $GLOBALS['server'] = 0; $GLOBALS['db'] = 'db'; diff --git a/test/classes/Plugins/Auth/AuthenticationSignonTest.php b/test/classes/Plugins/Auth/AuthenticationSignonTest.php index cdd05e25ce..bff9968081 100644 --- a/test/classes/Plugins/Auth/AuthenticationSignonTest.php +++ b/test/classes/Plugins/Auth/AuthenticationSignonTest.php @@ -31,7 +31,7 @@ class AuthenticationSignonTest extends AbstractNetworkTestCase parent::setLanguage(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['server'] = 0; $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; diff --git a/test/classes/Plugins/Transformations/TransformationPluginsTest.php b/test/classes/Plugins/Transformations/TransformationPluginsTest.php index 90c17d9ce2..75e0eb1346 100644 --- a/test/classes/Plugins/Transformations/TransformationPluginsTest.php +++ b/test/classes/Plugins/Transformations/TransformationPluginsTest.php @@ -61,7 +61,7 @@ class TransformationPluginsTest extends AbstractTestCase // For Image_*_Inline plugin parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['Server'] = 1; // For Date Format plugin diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php index 316436a6ba..1dcc31623e 100644 --- a/test/classes/Server/PrivilegesTest.php +++ b/test/classes/Server/PrivilegesTest.php @@ -41,7 +41,7 @@ class PrivilegesTest extends AbstractTestCase parent::setLanguage(); parent::setGlobalConfig(); parent::setTheme(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfgRelation'] = []; $GLOBALS['cfgRelation']['menuswork'] = false; @@ -76,7 +76,7 @@ class PrivilegesTest extends AbstractTestCase ->disableOriginalConstructor() ->getMock(); - $GLOBALS['PMA_Config'] = $pmaconfig; + $GLOBALS['config'] = $pmaconfig; //Mock DBI $dbi = $this->getMockBuilder(DatabaseInterface::class) diff --git a/test/classes/Setup/ConfigGeneratorTest.php b/test/classes/Setup/ConfigGeneratorTest.php index 91f87ef6b8..23a25f81c6 100644 --- a/test/classes/Setup/ConfigGeneratorTest.php +++ b/test/classes/Setup/ConfigGeneratorTest.php @@ -59,7 +59,7 @@ class ConfigGeneratorTest extends AbstractTestCase "/**\n" . " * Generated configuration file\n" . ' * Generated by: phpMyAdmin ' . - $GLOBALS['PMA_Config']->get('PMA_VERSION') . " setup script\n", + $GLOBALS['config']->get('PMA_VERSION') . " setup script\n", $result ); diff --git a/test/classes/ThemeTest.php b/test/classes/ThemeTest.php index a83c065693..86e40fb1f9 100644 --- a/test/classes/ThemeTest.php +++ b/test/classes/ThemeTest.php @@ -31,7 +31,7 @@ class ThemeTest extends AbstractTestCase $this->backup = $theme; $theme = $this->object; parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['server'] = '99'; } diff --git a/test/classes/TrackingTest.php b/test/classes/TrackingTest.php index b94e28c251..a836cdd82d 100644 --- a/test/classes/TrackingTest.php +++ b/test/classes/TrackingTest.php @@ -29,9 +29,9 @@ class TrackingTest extends AbstractTestCase parent::defineVersionConstants(); parent::setTheme(); - global $PMA_Config; + global $config; - $PMA_Config->enableBc(); + $config->enableBc(); $GLOBALS['server'] = 1; $GLOBALS['db'] = 'PMA_db'; diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php index 5af5af3e85..1036fe5645 100644 --- a/test/classes/TwoFactorTest.php +++ b/test/classes/TwoFactorTest.php @@ -209,18 +209,18 @@ class TwoFactorTest extends AbstractTestCase public function testKeyAppId(): void { $object = new TwoFactor('user'); - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', 'http://demo.example.com'); + $GLOBALS['config']->set('PmaAbsoluteUri', 'http://demo.example.com'); $this->assertEquals('http://demo.example.com', $object->getBackend()->getAppId(true)); $this->assertEquals('demo.example.com', $object->getBackend()->getAppId(false)); - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', 'https://demo.example.com:123'); + $GLOBALS['config']->set('PmaAbsoluteUri', 'https://demo.example.com:123'); $this->assertEquals('https://demo.example.com:123', $object->getBackend()->getAppId(true)); $this->assertEquals('demo.example.com', $object->getBackend()->getAppId(false)); - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); - $GLOBALS['PMA_Config']->set('is_https', true); + $GLOBALS['config']->set('PmaAbsoluteUri', ''); + $GLOBALS['config']->set('is_https', true); $_SERVER['HTTP_HOST'] = 'pma.example.com'; $this->assertEquals('https://pma.example.com', $object->getBackend()->getAppId(true)); $this->assertEquals('pma.example.com', $object->getBackend()->getAppId(false)); - $GLOBALS['PMA_Config']->set('is_https', false); + $GLOBALS['config']->set('is_https', false); $this->assertEquals('http://pma.example.com', $object->getBackend()->getAppId(true)); $this->assertEquals('pma.example.com', $object->getBackend()->getAppId(false)); } diff --git a/test/classes/UserPreferencesTest.php b/test/classes/UserPreferencesTest.php index 4f913cd37d..a371083de9 100644 --- a/test/classes/UserPreferencesTest.php +++ b/test/classes/UserPreferencesTest.php @@ -344,8 +344,8 @@ class UserPreferencesTest extends AbstractNetworkTestCase $this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash'); - $GLOBALS['PMA_Config']->set('PmaAbsoluteUri', ''); - $GLOBALS['PMA_Config']->set('PMA_IS_IIS', false); + $GLOBALS['config']->set('PmaAbsoluteUri', ''); + $GLOBALS['config']->set('PMA_IS_IIS', false); $this->userPreferences->redirect( 'file.html', diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index c023afeff5..d6225e2612 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -633,7 +633,7 @@ class UtilTest extends AbstractTestCase public function testExpandUserString(string $in, string $out): void { parent::setGlobalConfig(); - $GLOBALS['PMA_Config']->enableBc(); + $GLOBALS['config']->enableBc(); $GLOBALS['cfg'] = [ 'Server' => [ 'host' => 'host&',