2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 declare(strict_types
=1);
10 use PhpMyAdmin\Charsets
;
11 use PhpMyAdmin\Config
;
13 use PhpMyAdmin\Display\GitRevision
;
14 use PhpMyAdmin\LanguageManager
;
15 use PhpMyAdmin\Message
;
16 use PhpMyAdmin\RecentFavoriteTable
;
17 use PhpMyAdmin\Relation
;
18 use PhpMyAdmin\Response
;
19 use PhpMyAdmin\Sanitize
;
20 use PhpMyAdmin\Server\Select
;
21 use PhpMyAdmin\ThemeManager
;
24 use PhpMyAdmin\UserPreferences
;
27 * Gets some core libraries and displays a top message if required
29 require_once 'libraries/common.inc.php';
32 * pass variables to child pages
37 'collation_connection',
41 foreach ($drops as $each_drop) {
42 if (array_key_exists($each_drop, $_GET)) {
43 unset($_GET[$each_drop]);
46 unset($drops, $each_drop);
49 * Black list of all scripts to which front-end must submit data.
50 * Such scripts must not be loaded on home page.
54 'import.php', 'export.php'
57 // If we have a valid target, let's load that script instead
58 if (! empty($_REQUEST['target'])
59 && is_string($_REQUEST['target'])
60 && ! preg_match('/^index/', $_REQUEST['target'])
61 && ! in_array($_REQUEST['target'], $target_blacklist)
62 && Core
::checkPageValidity($_REQUEST['target'], [], true)
64 include $_REQUEST['target'];
68 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
72 // if user selected a theme
73 if (isset($_POST['set_theme'])) {
74 $tmanager = ThemeManager
::getInstance();
75 $tmanager->setActiveTheme($_POST['set_theme']);
76 $tmanager->setThemeCookie();
78 $userPreferences = new UserPreferences();
79 $prefs = $userPreferences->load();
80 $prefs["config_data"]["ThemeDefault"] = $_POST['set_theme'];
81 $userPreferences->save($prefs["config_data"]);
83 header('Location: index.php' . Url
::getCommonRaw());
86 // Change collation connection
87 if (isset($_POST['collation_connection'])) {
88 $GLOBALS['PMA_Config']->setUserValue(
90 'DefaultConnectionCollation',
91 $_POST['collation_connection'],
94 header('Location: index.php' . Url
::getCommonRaw());
100 if (! empty($_REQUEST['db'])) {
102 if (! empty($_REQUEST['table'])) {
103 $page = Util
::getScriptNameForOption(
104 $GLOBALS['cfg']['DefaultTabTable'],
108 $page = Util
::getScriptNameForOption(
109 $GLOBALS['cfg']['DefaultTabDatabase'],
117 $response = Response
::getInstance();
119 * Check if it is an ajax request to reload the recent tables list.
121 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
124 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
129 if ($GLOBALS['PMA_Config']->isGitRevision()) {
130 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
131 GitRevision
::display();
134 echo '<div id="is_git_revision"></div>';
137 // Handles some variables that may have been sent by the calling script
139 $GLOBALS['table'] = '';
142 // Any message to display?
143 if (! empty($message)) {
144 echo Util
::getMessage($message);
147 if (isset($_SESSION['partial_logout'])) {
149 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
151 unset($_SESSION['partial_logout']);
154 $common_url_query = Url
::getCommon();
155 $mysql_cur_user_and_host = '';
157 // when $server > 0, a server has been chosen so we can display
158 // all MySQL-related information
160 include 'libraries/server_common.inc.php';
162 // Use the verbose name of the server instead of the hostname
165 if (! empty($cfg['Server']['verbose'])) {
166 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
167 if ($GLOBALS['cfg']['ShowServerInfo']) {
168 $server_info .= ' (';
171 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
172 $server_info .= $GLOBALS['dbi']->getHostInfo();
174 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
177 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
179 // should we add the port info here?
180 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
181 ?
$GLOBALS['cfg']['Server']['verbose']
182 : $GLOBALS['cfg']['Server']['host']);
185 echo '<div id="maincontainer">' , "\n";
186 // Anchor for favorite tables synchronization.
187 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
188 echo '<div id="main_pane_left">';
189 if ($server > 0 ||
count($cfg['Servers']) > 1
191 if ($cfg['DBG']['demo']) {
192 echo '<div class="group">';
193 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
194 echo '<p class="cfg_dbg_demo">';
197 'You are using the demo server. You can do anything here, but '
198 . 'please do not change root, debian-sys-maint and pma users. '
199 . 'More information is available at %s.'
201 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
206 echo '<div class="group">';
207 echo '<h2>' , __('General settings') , '</h2>';
211 * Displays the MySQL servers choice form
213 if ($cfg['ServerDefault'] == 0
214 ||
(! $cfg['NavigationDisplayServers']
215 && (count($cfg['Servers']) > 1
216 ||
($server == 0 && count($cfg['Servers']) == 1)))
218 echo '<li id="li_select_server" class="no_bullets" >';
219 echo Util
::getImage('s_host') , " "
220 , Select
::render(true, true);
225 * Displays the mysql server related links
228 include_once 'libraries/check_user_privileges.inc.php';
230 // Logout for advanced authentication
231 if ($cfg['Server']['auth_type'] != 'config') {
232 if ($cfg['ShowChgPassword']) {
233 $conditional_class = 'ajax';
235 Util
::getImage('s_passwd') . " " . __(
238 'li_change_password',
239 'user_password.php' . $common_url_query,
242 'change_password_anchor',
248 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
249 echo ' <form class="disableAjax" method="post" action="index.php">' , "\n"
250 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
251 . ' <label for="select_collation_connection">' . "\n"
252 . ' ' . Util
::getImage('s_asci')
253 . " " . __('Server connection collation') . "\n"
254 // put the doc link in the form so that it appears on the same line
255 . Util
::showMySQLDocu('Charset-connection')
259 . Charsets
::getCollationDropdownBox(
261 $GLOBALS['cfg']['Server']['DisableIS'],
262 'collation_connection',
263 'select_collation_connection',
264 $collation_connection,
270 } // end of if ($server > 0)
275 echo '<div class="group">';
276 echo '<h2>' , __('Appearance settings') , '</h2>';
279 // Displays language selection combo
280 $language_manager = LanguageManager
::getInstance();
281 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
282 echo '<li id="li_select_lang" class="no_bullets">';
284 echo Util
::getImage('s_lang') , " "
285 , $language_manager->getSelectorDisplay();
289 // ThemeManager if available
291 if ($GLOBALS['cfg']['ThemeManager']) {
292 echo '<li id="li_select_theme" class="no_bullets">';
293 echo Util
::getImage('s_theme') , " "
294 , ThemeManager
::getInstance()->getHtmlSelectBox();
305 Util
::getImage('b_tblops') . " " . __(
308 'li_user_preferences',
309 'prefs_manage.php' . $common_url_query,
322 echo '<div id="main_pane_right">';
325 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
326 echo '<div class="group">';
327 echo '<h2>' , __('Database server') , '</h2>';
330 __('Server:') . ' ' . $server_info,
334 __('Server type:') . ' ' . Util
::getServerType(),
338 __('Server connection:') . ' ' . Util
::getServerSSL(),
342 __('Server version:')
344 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
348 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
352 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
356 echo ' <li id="li_select_mysql_charset">';
357 echo ' ' , __('Server charset:') , ' '
358 . ' <span lang="en" dir="ltr">';
359 $unicode = Charsets
::$mysql_charset_map['utf-8'];
360 $charsets = Charsets
::getMySQLCharsetsDescriptions(
362 $GLOBALS['cfg']['Server']['DisableIS']
364 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
371 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
372 echo '<div class="group">';
373 echo '<h2>' , __('Web server') , '</h2>';
375 if ($GLOBALS['cfg']['ShowServerInfo']) {
376 Core
::printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
379 $client_version_str = $GLOBALS['dbi']->getClientInfo();
380 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
381 $client_version_str = 'libmysql - ' . $client_version_str;
384 __('Database client version:') . ' ' . $client_version_str,
385 'li_mysql_client_version'
388 $php_ext_string = __('PHP extension:') . ' ';
390 $extensions = Util
::listPHPExtensions();
392 foreach ($extensions as $extension) {
393 $php_ext_string .= ' ' . $extension
394 . Util
::showPHPDocu('book.' . $extension . '.php');
399 'li_used_php_extension'
402 $php_version_string = __('PHP version:') . ' ' . phpversion();
406 'li_used_php_version'
411 if ($cfg['ShowPhpInfo']) {
413 __('Show PHP information'),
415 'phpinfo.php' . $common_url_query,
424 echo '<div class="group pmagroup">';
425 echo '<h2>phpMyAdmin</h2>';
428 if ($GLOBALS['cfg']['VersionCheck']) {
429 $class = 'jsversioncheck';
432 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
443 Util
::getDocuLink('index'),
448 // does not work if no target specified, don't know why
450 __('Official Homepage'),
452 Core
::linkURL('https://www.phpmyadmin.net/'),
459 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
466 Core
::linkURL('https://www.phpmyadmin.net/support/'),
471 __('List of changes'),
473 'changelog.php' . Url
::getCommon(),
480 'license.php' . Url
::getCommon(),
492 * mbstring is used for handling multibytes inside parser, so it is good
493 * to tell user something might be broken without it, see bug #1063149.
495 if (! extension_loaded('mbstring')) {
498 'The mbstring PHP extension was not found and you seem to be using'
499 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
500 . ' is unable to split strings correctly and it may result in'
501 . ' unexpected results.'
508 * Missing functionality
510 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
513 'The curl extension was not found and allow_url_fopen is '
514 . 'disabled. Due to this some features such as error reporting '
515 . 'or version check are disabled.'
520 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
522 * Check whether session.gc_maxlifetime limits session validity.
524 $gc_time = (int)ini_get('session.gc_maxlifetime');
525 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity']) {
528 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
529 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
530 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
531 'in phpMyAdmin, because of this, your login might expire sooner ' .
532 'than configured in phpMyAdmin.'
540 * Check whether LoginCookieValidity is limited by LoginCookieStore.
542 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
543 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
547 'Login cookie store is lower than cookie validity configured in ' .
548 'phpMyAdmin, because of this, your login will expire sooner than ' .
549 'configured in phpMyAdmin.'
556 * Warning if using the default MySQL controluser account
559 && isset($GLOBALS['cfg']['Server']['controluser']) && $GLOBALS['cfg']['Server']['controluser'] == 'pma'
560 && isset($GLOBALS['cfg']['Server']['controlpass']) && $GLOBALS['cfg']['Server']['controlpass'] == 'pmapass'
563 __('Your server is running with default values for the controluser and password (controlpass) and is open to intrusion; you really should fix this security weakness by changing the password for controluser \'pma\'.'),
570 * Check if user does not have defined blowfish secret and it is being used.
572 if (! empty($_SESSION['encryption_key'])) {
573 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
576 'The configuration file now needs a secret passphrase (blowfish_secret).'
580 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
583 'The secret passphrase in configuration (blowfish_secret) is too short.'
591 * Check for existence of config directory which should not exist in
592 * production environment.
594 if (@file_exists
('config')) {
597 'Directory [code]config[/code], which is used by the setup script, ' .
598 'still exists in your phpMyAdmin directory. It is strongly ' .
599 'recommended to remove it once phpMyAdmin has been configured. ' .
600 'Otherwise the security of your server may be compromised by ' .
601 'unauthorized people downloading your configuration.'
607 $relation = new Relation($GLOBALS['dbi']);
610 $cfgRelation = $relation->getRelationsParam();
611 if (! $cfgRelation['allworks']
612 && $cfg['PmaNoRelation_DisableWarning'] == false
615 'The phpMyAdmin configuration storage is not completely '
616 . 'configured, some extended features have been deactivated. '
617 . '%sFind out why%s. '
619 if ($cfg['ZeroConf'] == true) {
620 $msg_text .= '<br>' .
622 'Or alternately go to \'Operations\' tab of any database '
623 . 'to set it up there.'
626 $msg = Message
::notice($msg_text);
627 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
628 $msg->addParamHtml('</a>');
629 /* Show error if user has configured something, notice elsewhere */
630 if (!empty($cfg['Servers'][$server]['pmadb'])) {
638 * Warning about Suhosin only if its simulation mode is not enabled
640 if ($cfg['SuhosinDisableWarning'] == false
641 && ini_get('suhosin.request.max_value_length')
642 && ini_get('suhosin.simulation') == '0'
647 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
648 'for possible issues.'
657 /* Missing template cache */
658 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
661 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
662 $GLOBALS['PMA_Config']->get('TempDir')
669 * Warning about incomplete translations.
671 * The data file is created while creating release by ./scripts/remove-incomplete-mo
673 if (@file_exists
('libraries/language_stats.inc.php')) {
674 include 'libraries/language_stats.inc.php';
676 * This message is intentionally not translated, because we're
677 * handling incomplete translations here and focus on english
680 if (isset($GLOBALS['language_stats'][$lang])
681 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
684 'You are using an incomplete translation, please help to make it '
685 . 'better by [a@https://www.phpmyadmin.net/translate/'
686 . '@_blank]contributing[/a].',