$error_message_tz = sprintf(__('Unable to use timezone %1$s for server %2$d. ' . 'Please check your configuration setting for ' . '[em]$cfg[\'Servers\'][%3$d][\'SessionTimeZone\'][/em]. ' . 'phpMyAdmin is currently using the default time zone ' . 'of the database server.'), $cfg['Servers'][$GLOBALS['server']]['SessionTimeZone'], $GLOBALS['server'], $GLOBALS['server']); $GLOBALS['error_handler']->addError($error_message_tz, E_USER_WARNING, '', '', false); } } if (!$controllink) { /* * Open separate connection for control queries, this is needed * to avoid problems with table locking used in main connection * and phpMyAdmin issuing queries to configuration storage, which * is not locked by that time. */ $controllink = $GLOBALS['dbi']->connect(DatabaseInterface::CONNECT_USER); } $auth_plugin->storeUserCredentials(); /* Log success */ Logging::logUser($cfg['Server']['user']); if (PMA_MYSQL_INT_VERSION < $cfg['MysqlMinVersion']['internal']) { PMA_fatalError(__('You should upgrade to %s %s or later.'), array('MySQL', $cfg['MysqlMinVersion']['human'])); } /** * Type handling object. */ $GLOBALS['PMA_Types'] = new TypesMySQL(); // Loads closest context to this version. SqlParser\Context::loadClosest('MySql' . PMA_MYSQL_INT_VERSION); // Sets the default delimiter (if specified). if (!empty($_REQUEST['sql_delimiter'])) { SqlParser\Lexer::$DEFAULT_DELIMITER = $_REQUEST['sql_delimiter']; } // TODO: Set SQL modes too. /**
/** * connects to the database server * * @param string $user user name * @param string $password user password * @param bool $is_controluser whether this is a control user connection * @param array $server host/port/socket/persistent * @param bool $auxiliary_connection (when true, don't go back to login if * connection fails) * * @return mixed false on error or a connection object on success */ public function connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false) { $result = $this->_extension->connect($user, $password, $is_controluser, $server, $auxiliary_connection); if ($result) { if (!$auxiliary_connection && !$is_controluser) { $GLOBALS['dbi']->postConnect($result); } return $result; } if ($is_controluser) { trigger_error(__('Connection for controluser as defined in your ' . 'configuration failed.'), E_USER_WARNING); return false; } // Do not go back to main login if connection failed // (currently used only in unit testing) if ($auxiliary_connection) { return false; } Logging::logUser($user, 'mysql-denied'); $GLOBALS['auth_plugin']->authFails(); return $result; }
/** * connects to the database server * * @param integer $mode Connection mode on of CONNECT_USER, CONNECT_CONTROL * or CONNECT_AUXILIARY. * @param array $server Server information like host/port/socket/persistent * * @return mixed false on error or a connection object on success */ public function connect($mode, $server = null) { list($user, $password, $server) = $this->getConnectionParams($mode, $server); if (is_null($user) || is_null($password)) { trigger_error(__('Missing connection parameters!'), E_USER_WARNING); return false; } // Do not show location and backtrace for connection errors $GLOBALS['error_handler']->setHideLocation(true); $result = $this->_extension->connect($user, $password, $server); $GLOBALS['error_handler']->setHideLocation(false); if ($result) { /* Run post connect for user connections */ if ($mode == DatabaseInterface::CONNECT_USER) { $this->postConnect($result); } return $result; } if ($mode == DatabaseInterface::CONNECT_CONTROL) { trigger_error(__('Connection for controluser as defined in your ' . 'configuration failed.'), E_USER_WARNING); return false; } else { if ($mode == DatabaseInterface::CONNECT_AUXILIARY) { // Do not go back to main login if connection failed // (currently used only in unit testing) return false; } } Logging::logUser($user, 'mysql-denied'); $GLOBALS['auth_plugin']->authFails(); return $result; }