diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 5561838bb4..15dbce4311 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -244,77 +244,83 @@ $theme = ThemeManager::initializeTheme(); /** @var DatabaseInterface $dbi */ $dbi = null; -if (! defined('PMA_MINIMUM_COMMON')) { - /** - * save some settings in cookies - * - * @todo should be done in PhpMyAdmin\Config - */ - $config->setCookie('pma_lang', (string) $lang); +if (defined('PMA_MINIMUM_COMMON')) { + $config->loadUserPreferences(); + $containerBuilder->set('theme_manager', ThemeManager::getInstance()); + Tracker::enable(); - ThemeManager::getInstance()->setThemeCookie(); - - $dbi = DatabaseInterface::load(); - $containerBuilder->set(DatabaseInterface::class, $dbi); - $containerBuilder->setAlias('dbi', DatabaseInterface::class); - - if (! empty($cfg['Server'])) { - $config->getLoginCookieValidityFromCache($server); - - $auth_plugin = Plugins::getAuthPlugin(); - $auth_plugin->authenticate(); - - Core::connectToDatabaseServer($dbi, $auth_plugin); - - $auth_plugin->rememberCredentials(); - - $auth_plugin->checkTwoFactor(); - - /* Log success */ - Logging::logUser($cfg['Server']['user']); - - if ($dbi->getVersion() < $cfg['MysqlMinVersion']['internal']) { - Core::fatalError( - __('You should upgrade to %s %s or later.'), - [ - 'MySQL', - $cfg['MysqlMinVersion']['human'], - ] - ); - } - - // Sets the default delimiter (if specified). - if (! empty($_REQUEST['sql_delimiter'])) { - Lexer::$DEFAULT_DELIMITER = $_REQUEST['sql_delimiter']; - } - - // TODO: Set SQL modes too. - } else { // end server connecting - $response = Response::getInstance(); - $response->getHeader()->disableMenuAndConsole(); - $response->getFooter()->setMinimal(); - } - - $response = Response::getInstance(); - - Profiling::check($dbi, $response); - - /* - * There is no point in even attempting to process - * an ajax request if there is a token mismatch - */ - if ($response->isAjax() && $_SERVER['REQUEST_METHOD'] === 'POST' && $token_mismatch) { - $response->setRequestStatus(false); - $response->addJSON( - 'message', - Message::error(__('Error: Token mismatch')) - ); - exit; - } - - $containerBuilder->set('response', Response::getInstance()); + return; } +/** + * save some settings in cookies + * + * @todo should be done in PhpMyAdmin\Config + */ +$config->setCookie('pma_lang', (string) $lang); + +ThemeManager::getInstance()->setThemeCookie(); + +$dbi = DatabaseInterface::load(); +$containerBuilder->set(DatabaseInterface::class, $dbi); +$containerBuilder->setAlias('dbi', DatabaseInterface::class); + +if (! empty($cfg['Server'])) { + $config->getLoginCookieValidityFromCache($server); + + $auth_plugin = Plugins::getAuthPlugin(); + $auth_plugin->authenticate(); + + Core::connectToDatabaseServer($dbi, $auth_plugin); + + $auth_plugin->rememberCredentials(); + + $auth_plugin->checkTwoFactor(); + + /* Log success */ + Logging::logUser($cfg['Server']['user']); + + if ($dbi->getVersion() < $cfg['MysqlMinVersion']['internal']) { + Core::fatalError( + __('You should upgrade to %s %s or later.'), + [ + 'MySQL', + $cfg['MysqlMinVersion']['human'], + ] + ); + } + + // Sets the default delimiter (if specified). + if (! empty($_REQUEST['sql_delimiter'])) { + Lexer::$DEFAULT_DELIMITER = $_REQUEST['sql_delimiter']; + } + + // TODO: Set SQL modes too. +} else { // end server connecting + $response = Response::getInstance(); + $response->getHeader()->disableMenuAndConsole(); + $response->getFooter()->setMinimal(); +} + +$response = Response::getInstance(); + +Profiling::check($dbi, $response); + +/* + * There is no point in even attempting to process + * an ajax request if there is a token mismatch + */ +if ($response->isAjax() && $_SERVER['REQUEST_METHOD'] === 'POST' && $token_mismatch) { + $response->setRequestStatus(false); + $response->addJSON( + 'message', + Message::error(__('Error: Token mismatch')) + ); + exit; +} + +$containerBuilder->set('response', Response::getInstance()); + // load user preferences $config->loadUserPreferences(); @@ -323,11 +329,6 @@ $containerBuilder->set('theme_manager', ThemeManager::getInstance()); /* Tell tracker that it can actually work */ Tracker::enable(); -if ( - ! defined('PMA_MINIMUM_COMMON') - && ! empty($server) - && isset($cfg['ZeroConf']) - && $cfg['ZeroConf'] == true -) { +if (! empty($server) && isset($cfg['ZeroConf']) && $cfg['ZeroConf'] === true) { $dbi->postConnectControl(); }