2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PMA\libraries\RecentFavoriteTable
;
10 use PMA\libraries\Sanitize
;
11 use PMA\libraries\Charsets
;
12 use PMA\libraries\ThemeManager
;
13 use PMA\libraries\LanguageManager
;
16 * Gets some core libraries and displays a top message if required
18 require_once 'libraries/common.inc.php';
21 * display Git revision if requested
23 require_once 'libraries/display_git_revision.lib.php';
26 * pass variables to child pages
31 'collation_connection',
35 foreach ($drops as $each_drop) {
36 if (array_key_exists($each_drop, $_GET)) {
37 unset($_GET[$each_drop]);
40 unset($drops, $each_drop);
43 * Black list of all scripts to which front-end must submit data.
44 * Such scripts must not be loaded on home page.
47 $target_blacklist = array (
48 'import.php', 'export.php'
51 // If we have a valid target, let's load that script instead
52 if (! empty($_REQUEST['target'])
53 && is_string($_REQUEST['target'])
54 && ! preg_match('/^index/', $_REQUEST['target'])
55 && ! in_array($_REQUEST['target'], $target_blacklist)
56 && in_array($_REQUEST['target'], $goto_whitelist)
58 include $_REQUEST['target'];
62 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
67 if (! empty($_REQUEST['db'])) {
69 if (! empty($_REQUEST['table'])) {
70 $page = PMA\libraries\Util
::getScriptNameForOption(
71 $GLOBALS['cfg']['DefaultTabTable'], 'table'
74 $page = PMA\libraries\Util
::getScriptNameForOption(
75 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
83 * Check if it is an ajax request to reload the recent tables list.
85 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
86 $response = PMA\libraries\Response
::getInstance();
89 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
94 if ($GLOBALS['PMA_Config']->isGitRevision()) {
95 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
96 PMA_printGitRevision();
99 echo '<div id="is_git_revision"></div>';
102 // Handles some variables that may have been sent by the calling script
104 $GLOBALS['table'] = '';
107 // Any message to display?
108 if (! empty($message)) {
109 echo PMA\libraries\Util
::getMessage($message);
113 $common_url_query = URL
::getCommon();
114 $mysql_cur_user_and_host = '';
116 // when $server > 0, a server has been chosen so we can display
117 // all MySQL-related information
119 include 'libraries/server_common.inc.php';
121 // Use the verbose name of the server instead of the hostname
124 if (! empty($cfg['Server']['verbose'])) {
125 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
126 if ($GLOBALS['cfg']['ShowServerInfo']) {
127 $server_info .= ' (';
130 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
131 $server_info .= $GLOBALS['dbi']->getHostInfo();
133 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
136 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
138 // should we add the port info here?
139 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
140 ?
$GLOBALS['cfg']['Server']['verbose']
141 : $GLOBALS['cfg']['Server']['host']);
144 echo '<div id="maincontainer">' , "\n";
145 // Anchor for favorite tables synchronization.
146 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
147 echo '<div id="main_pane_left">';
148 if ($server > 0 ||
count($cfg['Servers']) > 1
150 if ($cfg['DBG']['demo']) {
151 echo '<div class="group">';
152 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
153 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
156 'You are using the demo server. You can do anything here, but '
157 . 'please do not change root, debian-sys-maint and pma users. '
158 . 'More information is available at %s.'
160 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
165 echo '<div class="group">';
166 echo '<h2>' , __('General settings') , '</h2>';
170 * Displays the MySQL servers choice form
172 if ($cfg['ServerDefault'] == 0
173 ||
(! $cfg['NavigationDisplayServers']
174 && (count($cfg['Servers']) > 1
175 ||
($server == 0 && count($cfg['Servers']) == 1)))
177 echo '<li id="li_select_server" class="no_bullets" >';
178 include_once 'libraries/select_server.lib.php';
179 echo PMA\libraries\Util
::getImage('s_host.png') , " "
180 , PMA_selectServer(true, true);
185 * Displays the mysql server related links
188 include_once 'libraries/check_user_privileges.lib.php';
190 // Logout for advanced authentication
191 if ($cfg['Server']['auth_type'] != 'config') {
192 if ($cfg['ShowChgPassword']) {
193 $conditional_class = 'ajax';
195 PMA\libraries\Util
::getImage('s_passwd.png') . " " . __(
198 'li_change_password',
199 'user_password.php' . $common_url_query,
202 'change_password_anchor',
208 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
209 echo ' <form method="post" action="index.php">' , "\n"
210 . URL
::getHiddenInputs(null, null, 4, 'collation_connection')
211 . ' <label for="select_collation_connection">' . "\n"
212 . ' ' . PMA\libraries\Util
::getImage('s_asci.png')
213 . " " . __('Server connection collation') . "\n"
214 // put the doc link in the form so that it appears on the same line
215 . PMA\libraries\Util
::showMySQLDocu('Charset-connection')
219 . Charsets
::getCollationDropdownBox(
220 'collation_connection',
221 'select_collation_connection',
222 $collation_connection,
228 } // end of if ($server > 0)
233 echo '<div class="group">';
234 echo '<h2>' , __('Appearance settings') , '</h2>';
237 // Displays language selection combo
238 if (empty($cfg['Lang'])) {
239 echo '<li id="li_select_lang" class="no_bullets">';
241 echo PMA\libraries\Util
::getImage('s_lang.png') , " "
242 , LanguageManager
::getInstance()->getSelectorDisplay();
246 // ThemeManager if available
248 if ($GLOBALS['cfg']['ThemeManager']) {
249 echo '<li id="li_select_theme" class="no_bullets">';
250 echo PMA\libraries\Util
::getImage('s_theme.png') , " "
251 , ThemeManager
::getInstance()->getHtmlSelectBox();
254 echo '<li id="li_select_fontsize">';
255 echo PMA\libraries\Config
::getFontsizeForm();
265 PMA\libraries\Util
::getImage('b_tblops.png') . " " . __(
268 'li_user_preferences',
269 'prefs_manage.php' . $common_url_query,
282 echo '<div id="main_pane_right">';
285 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
287 echo '<div class="group">';
288 echo '<h2>' , __('Database server') , '</h2>';
291 __('Server:') . ' ' . $server_info,
295 __('Server type:') . ' ' . PMA\libraries\Util
::getServerType(),
299 __('Server version:')
301 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
305 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
309 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
313 echo ' <li id="li_select_mysql_charset">';
314 echo ' ' , __('Server charset:') , ' '
315 . ' <span lang="en" dir="ltr">';
316 $unicode = Charsets
::$mysql_charset_map['utf-8'];
317 $charsets = Charsets
::getMySQLCharsetsDescriptions();
318 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
325 if ($GLOBALS['cfg']['ShowServerInfo']) {
326 echo '<div class="group">';
327 echo '<h2>' , __('Web server') , '</h2>';
329 if ($GLOBALS['cfg']['ShowServerInfo']) {
330 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
333 $client_version_str = $GLOBALS['dbi']->getClientInfo();
334 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
335 $client_version_str = 'libmysql - ' . $client_version_str;
338 __('Database client version:') . ' ' . $client_version_str,
339 'li_mysql_client_version'
342 $php_ext_string = __('PHP extension:') . ' ';
344 $extensions = PMA\libraries\Util
::listPHPExtensions();
346 foreach ($extensions as $extension) {
347 $php_ext_string .= ' ' . $extension
348 . PMA\libraries\Util
::showPHPDocu('book.' . $extension . '.php');
353 'li_used_php_extension'
356 $php_version_string = __('PHP version:') . ' ' . phpversion();
360 'li_used_php_version'
369 echo '<div class="group pmagroup">';
370 echo '<h2>phpMyAdmin</h2>';
373 if ($GLOBALS['cfg']['VersionCheck']) {
374 $class = 'jsversioncheck';
377 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
388 PMA\libraries\Util
::getDocuLink('index'),
393 // does not work if no target specified, don't know why
395 __('Official Homepage'),
397 PMA_linkURL('https://www.phpMyAdmin.net/'),
404 PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
411 PMA_linkURL('https://www.phpmyadmin.net/support/'),
416 __('List of changes'),
418 'changelog.php' . URL
::getCommon(),
425 'license.php' . URL
::getCommon(),
437 * mbstring is used for handling multibytes inside parser, so it is good
438 * to tell user something might be broken without it, see bug #1063149.
440 if (! @extension_loaded
('mbstring')) {
443 'The mbstring PHP extension was not found and you seem to be using'
444 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
445 . ' is unable to split strings correctly and it may result in'
446 . ' unexpected results.'
453 * Missing functionality
455 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
458 'The curl extension was not found and allow_url_fopen is '
459 . 'disabled. Due to this some features such as error reporting '
460 . 'or version check are disabled.'
465 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
467 * Check whether session.gc_maxlifetime limits session validity.
469 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
470 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
473 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
474 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
475 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
476 'in phpMyAdmin, because of this, your login might expire sooner ' .
477 'than configured in phpMyAdmin.'
485 * Check whether LoginCookieValidity is limited by LoginCookieStore.
487 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
488 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
492 'Login cookie store is lower than cookie validity configured in ' .
493 'phpMyAdmin, because of this, your login will expire sooner than ' .
494 'configured in phpMyAdmin.'
501 * Check if user does not have defined blowfish secret and it is being used.
503 if (! empty($_SESSION['encryption_key'])) {
504 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
507 'The configuration file now needs a secret passphrase (blowfish_secret).'
511 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
514 'The secret passphrase in configuration (blowfish_secret) is too short.'
522 * Check for existence of config directory which should not exist in
523 * production environment.
525 if (@file_exists
('config')) {
528 'Directory [code]config[/code], which is used by the setup script, ' .
529 'still exists in your phpMyAdmin directory. It is strongly ' .
530 'recommended to remove it once phpMyAdmin has been configured. ' .
531 'Otherwise the security of your server may be compromised by ' .
532 'unauthorized people downloading your configuration.'
539 $cfgRelation = PMA_getRelationsParam();
540 if (! $cfgRelation['allworks']
541 && $cfg['PmaNoRelation_DisableWarning'] == false
544 'The phpMyAdmin configuration storage is not completely '
545 . 'configured, some extended features have been deactivated. '
546 . '%sFind out why%s. '
548 if ($cfg['ZeroConf'] == true) {
549 $msg_text .= '<br>' .
551 'Or alternately go to \'Operations\' tab of any database '
552 . 'to set it up there.'
555 $msg = PMA\libraries\Message
::notice($msg_text);
556 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
557 $msg->addParamHtml('</a>');
558 /* Show error if user has configured something, notice elsewhere */
559 if (!empty($cfg['Servers'][$server]['pmadb'])) {
567 * Warning about different MySQL library and server version
568 * (a difference on the third digit does not count).
569 * If someday there is a constant that we can check about mysqlnd,
570 * we can use it instead of strpos().
571 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
572 * We also do not warn if MariaDB is detected, as it has its own version
575 if (isset($GLOBALS['dbi'])
576 && $cfg['ServerLibraryDifference_DisableWarning'] == false
578 $_client_info = $GLOBALS['dbi']->getClientInfo();
580 && mb_strpos($_client_info, 'mysqlnd') === false
581 && mb_strpos(PMA_MYSQL_STR_VERSION
, 'MariaDB') === false
582 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(
583 PMA_MYSQL_INT_VERSION
, 0, 3
590 'Your PHP MySQL library version %s differs from your ' .
591 'MySQL server version %s. This may cause unpredictable ' .
596 PMA_MYSQL_STR_VERSION
,
598 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
605 unset($_client_info);
609 * Warning about Suhosin only if its simulation mode is not enabled
611 if ($cfg['SuhosinDisableWarning'] == false
612 && @ini_get
('suhosin.request.max_value_length')
613 && @ini_get
('suhosin.simulation') == '0'
618 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
619 'for possible issues.'
629 * Warning about incomplete translations.
631 * The data file is created while creating release by ./scripts/remove-incomplete-mo
633 if (@file_exists
('libraries/language_stats.inc.php')) {
634 include 'libraries/language_stats.inc.php';
636 * This message is intentionally not translated, because we're
637 * handling incomplete translations here and focus on english
640 if (isset($GLOBALS['language_stats'][$lang])
641 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
644 'You are using an incomplete translation, please help to make it '
645 . 'better by [a@https://www.phpmyadmin.net/translate/'
646 . '@_blank]contributing[/a].',
653 * prints list item for main page
655 * @param string $name displayed text
656 * @param string $listId id, used for css styles
657 * @param string $url make item as link with $url as target
658 * @param string $mysql_help_page display a link to MySQL's manual
659 * @param string $target special target for $url
660 * @param string $a_id id for the anchor,
661 * used for jQuery to hook in functions
662 * @param string $class class for the li element
663 * @param string $a_class class for the anchor element
667 function PMA_printListItem($name, $listId = null, $url = null,
668 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
671 echo PMA\libraries\Template
::get('list/item')
683 'mysql_help_page' => $mysql_help_page,