Rename the PMA_Config global variable to config

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2021-03-08 15:03:12 -03:00
parent db2af18aff
commit 7e33d227f5
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
81 changed files with 220 additions and 220 deletions

View File

@ -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';

View File

@ -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;
}

View File

@ -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);

View File

@ -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
);
}
}

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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;

View File

@ -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(

View File

@ -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(

View File

@ -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;

View File

@ -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();

View File

@ -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,

View File

@ -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

View File

@ -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']
);

View File

@ -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(__(

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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 '<p>' , sprintf(
__(
'You probably did not create a configuration file.'

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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(),
]);
}

View File

@ -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) {

View File

@ -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');
}
/**

View File

@ -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;

View File

@ -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(

View File

@ -51,7 +51,7 @@ class Template
global $cfg;
/** @var Config|null $config */
$config = $GLOBALS['PMA_Config'];
$config = $GLOBALS['config'];
if (static::$twig !== null) {
return;
}

View File

@ -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;
}

View File

@ -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'];
}

View File

@ -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());

View File

@ -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';

View File

@ -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(

View File

@ -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 */

View File

@ -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();

View File

@ -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
}

View File

@ -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;

View File

@ -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'));

View File

@ -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'] = '';

View File

@ -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

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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'

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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']),

View File

@ -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';

View File

@ -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';

View File

@ -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();

View File

@ -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'] = '';

View File

@ -15,7 +15,7 @@ class PdfTest extends AbstractTestCase
{
parent::setUp();
parent::setGlobalConfig();
$GLOBALS['PMA_Config']->enableBc();
$GLOBALS['config']->enableBc();
}
/**

View File

@ -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';

View File

@ -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'] = '';

View File

@ -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';

View File

@ -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';

View File

@ -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

View File

@ -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)

View File

@ -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
);

View File

@ -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';
}

View File

@ -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';

View File

@ -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));
}

View File

@ -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',

View File

@ -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&',