2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PMA\libraries\Response
;
9 use PMA\libraries\RecentFavoriteTable
;
10 use PMA\libraries\URL
;
11 use PMA\libraries\Sanitize
;
12 use PMA\libraries\Charsets
;
13 use PMA\libraries\ThemeManager
;
14 use PMA\libraries\LanguageManager
;
17 * Gets some core libraries and displays a top message if required
19 require_once 'libraries/common.inc.php';
22 * display Git revision if requested
24 require_once 'libraries/display_git_revision.lib.php';
27 * pass variables to child pages
32 'collation_connection',
36 foreach ($drops as $each_drop) {
37 if (array_key_exists($each_drop, $_GET)) {
38 unset($_GET[$each_drop]);
41 unset($drops, $each_drop);
44 * Black list of all scripts to which front-end must submit data.
45 * Such scripts must not be loaded on home page.
48 $target_blacklist = array (
49 'import.php', 'export.php'
52 // If we have a valid target, let's load that script instead
53 if (! empty($_REQUEST['target'])
54 && is_string($_REQUEST['target'])
55 && ! preg_match('/^index/', $_REQUEST['target'])
56 && ! in_array($_REQUEST['target'], $target_blacklist)
57 && in_array($_REQUEST['target'], $goto_whitelist)
59 include $_REQUEST['target'];
63 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
68 if (! empty($_REQUEST['db'])) {
70 if (! empty($_REQUEST['table'])) {
71 $page = PMA\libraries\Util
::getScriptNameForOption(
72 $GLOBALS['cfg']['DefaultTabTable'], 'table'
75 $page = PMA\libraries\Util
::getScriptNameForOption(
76 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
83 $response = Response
::getInstance();
85 * Check if it is an ajax request to reload the recent tables list.
87 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
90 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
95 if ($GLOBALS['PMA_Config']->isGitRevision()) {
96 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
97 PMA_printGitRevision();
100 echo '<div id="is_git_revision"></div>';
103 // Handles some variables that may have been sent by the calling script
105 $GLOBALS['table'] = '';
108 // Any message to display?
109 if (! empty($message)) {
110 echo PMA\libraries\Util
::getMessage($message);
114 $common_url_query = URL
::getCommon();
115 $mysql_cur_user_and_host = '';
117 // when $server > 0, a server has been chosen so we can display
118 // all MySQL-related information
120 include 'libraries/server_common.inc.php';
122 // Use the verbose name of the server instead of the hostname
125 if (! empty($cfg['Server']['verbose'])) {
126 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
127 if ($GLOBALS['cfg']['ShowServerInfo']) {
128 $server_info .= ' (';
131 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
132 $server_info .= $GLOBALS['dbi']->getHostInfo();
134 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
137 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
139 // should we add the port info here?
140 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
141 ?
$GLOBALS['cfg']['Server']['verbose']
142 : $GLOBALS['cfg']['Server']['host']);
145 echo '<div id="maincontainer">' , "\n";
146 // Anchor for favorite tables synchronization.
147 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
148 echo '<div id="main_pane_left">';
149 if ($server > 0 ||
count($cfg['Servers']) > 1
151 if ($cfg['DBG']['demo']) {
152 echo '<div class="group">';
153 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
154 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
157 'You are using the demo server. You can do anything here, but '
158 . 'please do not change root, debian-sys-maint and pma users. '
159 . 'More information is available at %s.'
161 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
166 echo '<div class="group">';
167 echo '<h2>' , __('General settings') , '</h2>';
171 * Displays the MySQL servers choice form
173 if ($cfg['ServerDefault'] == 0
174 ||
(! $cfg['NavigationDisplayServers']
175 && (count($cfg['Servers']) > 1
176 ||
($server == 0 && count($cfg['Servers']) == 1)))
178 echo '<li id="li_select_server" class="no_bullets" >';
179 include_once 'libraries/select_server.lib.php';
180 echo PMA\libraries\Util
::getImage('s_host.png') , " "
181 , PMA_selectServer(true, true);
186 * Displays the mysql server related links
189 include_once 'libraries/check_user_privileges.lib.php';
191 // Logout for advanced authentication
192 if ($cfg['Server']['auth_type'] != 'config') {
193 if ($cfg['ShowChgPassword']) {
194 $conditional_class = 'ajax';
196 PMA\libraries\Util
::getImage('s_passwd.png') . " " . __(
199 'li_change_password',
200 'user_password.php' . $common_url_query,
203 'change_password_anchor',
209 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
210 echo ' <form method="post" action="index.php">' , "\n"
211 . URL
::getHiddenInputs(null, null, 4, 'collation_connection')
212 . ' <label for="select_collation_connection">' . "\n"
213 . ' ' . PMA\libraries\Util
::getImage('s_asci.png')
214 . " " . __('Server connection collation') . "\n"
215 // put the doc link in the form so that it appears on the same line
216 . PMA\libraries\Util
::showMySQLDocu('Charset-connection')
220 . Charsets
::getCollationDropdownBox(
221 'collation_connection',
222 'select_collation_connection',
223 $collation_connection,
229 } // end of if ($server > 0)
234 echo '<div class="group">';
235 echo '<h2>' , __('Appearance settings') , '</h2>';
238 // Displays language selection combo
239 if (empty($cfg['Lang'])) {
240 echo '<li id="li_select_lang" class="no_bullets">';
242 echo PMA\libraries\Util
::getImage('s_lang.png') , " "
243 , LanguageManager
::getInstance()->getSelectorDisplay();
247 // ThemeManager if available
249 if ($GLOBALS['cfg']['ThemeManager']) {
250 echo '<li id="li_select_theme" class="no_bullets">';
251 echo PMA\libraries\Util
::getImage('s_theme.png') , " "
252 , ThemeManager
::getInstance()->getHtmlSelectBox();
255 echo '<li id="li_select_fontsize">';
256 echo PMA\libraries\Config
::getFontsizeForm();
266 PMA\libraries\Util
::getImage('b_tblops.png') . " " . __(
269 'li_user_preferences',
270 'prefs_manage.php' . $common_url_query,
283 echo '<div id="main_pane_right">';
286 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
288 echo '<div class="group">';
289 echo '<h2>' , __('Database server') , '</h2>';
292 __('Server:') . ' ' . $server_info,
296 __('Server type:') . ' ' . PMA\libraries\Util
::getServerType(),
300 __('Server version:')
302 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
306 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
310 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
314 echo ' <li id="li_select_mysql_charset">';
315 echo ' ' , __('Server charset:') , ' '
316 . ' <span lang="en" dir="ltr">';
317 $unicode = Charsets
::$mysql_charset_map['utf-8'];
318 $charsets = Charsets
::getMySQLCharsetsDescriptions();
319 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
326 if ($GLOBALS['cfg']['ShowServerInfo']) {
327 echo '<div class="group">';
328 echo '<h2>' , __('Web server') , '</h2>';
330 if ($GLOBALS['cfg']['ShowServerInfo']) {
331 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
334 $client_version_str = $GLOBALS['dbi']->getClientInfo();
335 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
336 $client_version_str = 'libmysql - ' . $client_version_str;
339 __('Database client version:') . ' ' . $client_version_str,
340 'li_mysql_client_version'
343 $php_ext_string = __('PHP extension:') . ' ';
345 $extensions = PMA\libraries\Util
::listPHPExtensions();
347 foreach ($extensions as $extension) {
348 $php_ext_string .= ' ' . $extension
349 . PMA\libraries\Util
::showPHPDocu('book.' . $extension . '.php');
354 'li_used_php_extension'
357 $php_version_string = __('PHP version:') . ' ' . phpversion();
361 'li_used_php_version'
370 echo '<div class="group pmagroup">';
371 echo '<h2>phpMyAdmin</h2>';
374 if ($GLOBALS['cfg']['VersionCheck']) {
375 $class = 'jsversioncheck';
378 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
389 PMA\libraries\Util
::getDocuLink('index'),
394 // does not work if no target specified, don't know why
396 __('Official Homepage'),
398 PMA_linkURL('https://www.phpmyadmin.net/'),
405 PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
412 PMA_linkURL('https://www.phpmyadmin.net/support/'),
417 __('List of changes'),
419 'changelog.php' . URL
::getCommon(),
426 'license.php' . URL
::getCommon(),
438 * mbstring is used for handling multibytes inside parser, so it is good
439 * to tell user something might be broken without it, see bug #1063149.
441 if (! @extension_loaded
('mbstring')) {
444 'The mbstring PHP extension was not found and you seem to be using'
445 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
446 . ' is unable to split strings correctly and it may result in'
447 . ' unexpected results.'
454 * Missing functionality
456 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
459 'The curl extension was not found and allow_url_fopen is '
460 . 'disabled. Due to this some features such as error reporting '
461 . 'or version check are disabled.'
466 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
468 * Check whether session.gc_maxlifetime limits session validity.
470 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
471 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
474 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
475 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
476 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
477 'in phpMyAdmin, because of this, your login might expire sooner ' .
478 'than configured in phpMyAdmin.'
486 * Check whether LoginCookieValidity is limited by LoginCookieStore.
488 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
489 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
493 'Login cookie store is lower than cookie validity configured in ' .
494 'phpMyAdmin, because of this, your login will expire sooner than ' .
495 'configured in phpMyAdmin.'
502 * Check if user does not have defined blowfish secret and it is being used.
504 if (! empty($_SESSION['encryption_key'])) {
505 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
508 'The configuration file now needs a secret passphrase (blowfish_secret).'
512 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
515 'The secret passphrase in configuration (blowfish_secret) is too short.'
523 * Check for existence of config directory which should not exist in
524 * production environment.
526 if (@file_exists
('config')) {
529 'Directory [code]config[/code], which is used by the setup script, ' .
530 'still exists in your phpMyAdmin directory. It is strongly ' .
531 'recommended to remove it once phpMyAdmin has been configured. ' .
532 'Otherwise the security of your server may be compromised by ' .
533 'unauthorized people downloading your configuration.'
540 $cfgRelation = PMA_getRelationsParam();
541 if (! $cfgRelation['allworks']
542 && $cfg['PmaNoRelation_DisableWarning'] == false
545 'The phpMyAdmin configuration storage is not completely '
546 . 'configured, some extended features have been deactivated. '
547 . '%sFind out why%s. '
549 if ($cfg['ZeroConf'] == true) {
550 $msg_text .= '<br>' .
552 'Or alternately go to \'Operations\' tab of any database '
553 . 'to set it up there.'
556 $msg = PMA\libraries\Message
::notice($msg_text);
557 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
558 $msg->addParamHtml('</a>');
559 /* Show error if user has configured something, notice elsewhere */
560 if (!empty($cfg['Servers'][$server]['pmadb'])) {
568 * Warning about different MySQL library and server version
569 * (a difference on the third digit does not count).
570 * If someday there is a constant that we can check about mysqlnd,
571 * we can use it instead of strpos().
572 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
573 * We also do not warn if MariaDB is detected, as it has its own version
576 if (isset($GLOBALS['dbi'])
577 && $cfg['ServerLibraryDifference_DisableWarning'] == false
579 $_client_info = $GLOBALS['dbi']->getClientInfo();
581 && mb_strpos($_client_info, 'mysqlnd') === false
582 && mb_strpos(PMA_MYSQL_STR_VERSION
, 'MariaDB') === false
583 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(
584 PMA_MYSQL_INT_VERSION
, 0, 3
591 'Your PHP MySQL library version %s differs from your ' .
592 'MySQL server version %s. This may cause unpredictable ' .
597 PMA_MYSQL_STR_VERSION
,
599 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
606 unset($_client_info);
610 * Warning about Suhosin only if its simulation mode is not enabled
612 if ($cfg['SuhosinDisableWarning'] == false
613 && @ini_get
('suhosin.request.max_value_length')
614 && @ini_get
('suhosin.simulation') == '0'
619 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
620 'for possible issues.'
630 * Warning about incomplete translations.
632 * The data file is created while creating release by ./scripts/remove-incomplete-mo
634 if (@file_exists
('libraries/language_stats.inc.php')) {
635 include 'libraries/language_stats.inc.php';
637 * This message is intentionally not translated, because we're
638 * handling incomplete translations here and focus on english
641 if (isset($GLOBALS['language_stats'][$lang])
642 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
645 'You are using an incomplete translation, please help to make it '
646 . 'better by [a@https://www.phpmyadmin.net/translate/'
647 . '@_blank]contributing[/a].',
654 * prints list item for main page
656 * @param string $name displayed text
657 * @param string $listId id, used for css styles
658 * @param string $url make item as link with $url as target
659 * @param string $mysql_help_page display a link to MySQL's manual
660 * @param string $target special target for $url
661 * @param string $a_id id for the anchor,
662 * used for jQuery to hook in functions
663 * @param string $class class for the li element
664 * @param string $a_class class for the anchor element
668 function PMA_printListItem($name, $listId = null, $url = null,
669 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
672 echo PMA\libraries\Template
::get('list/item')
684 'mysql_help_page' => $mysql_help_page,