2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PMA\libraries\Message
;
9 use PMA\libraries\Response
;
10 use PMA\libraries\RecentFavoriteTable
;
11 use PMA\libraries\URL
;
12 use PMA\libraries\Sanitize
;
13 use PMA\libraries\Charsets
;
14 use PMA\libraries\ThemeManager
;
15 use PMA\libraries\LanguageManager
;
18 * Gets some core libraries and displays a top message if required
20 require_once 'libraries/common.inc.php';
23 * display Git revision if requested
25 require_once 'libraries/display_git_revision.lib.php';
28 * pass variables to child pages
33 'collation_connection',
37 foreach ($drops as $each_drop) {
38 if (array_key_exists($each_drop, $_GET)) {
39 unset($_GET[$each_drop]);
42 unset($drops, $each_drop);
45 * Black list of all scripts to which front-end must submit data.
46 * Such scripts must not be loaded on home page.
49 $target_blacklist = array (
50 'import.php', 'export.php'
53 // If we have a valid target, let's load that script instead
54 if (! empty($_REQUEST['target'])
55 && is_string($_REQUEST['target'])
56 && ! preg_match('/^index/', $_REQUEST['target'])
57 && ! in_array($_REQUEST['target'], $target_blacklist)
58 && in_array($_REQUEST['target'], $goto_whitelist)
60 include $_REQUEST['target'];
64 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
69 if (! empty($_REQUEST['db'])) {
71 if (! empty($_REQUEST['table'])) {
72 $page = PMA\libraries\Util
::getScriptNameForOption(
73 $GLOBALS['cfg']['DefaultTabTable'], 'table'
76 $page = PMA\libraries\Util
::getScriptNameForOption(
77 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
84 $response = Response
::getInstance();
86 * Check if it is an ajax request to reload the recent tables list.
88 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
91 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
96 if ($GLOBALS['PMA_Config']->isGitRevision()) {
97 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
98 PMA_printGitRevision();
101 echo '<div id="is_git_revision"></div>';
104 // Handles some variables that may have been sent by the calling script
106 $GLOBALS['table'] = '';
109 // Any message to display?
110 if (! empty($message)) {
111 echo PMA\libraries\Util
::getMessage($message);
114 if (isset($_SESSION['partial_logout'])) {
116 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
118 unset($_SESSION['partial_logout']);
121 $common_url_query = URL
::getCommon();
122 $mysql_cur_user_and_host = '';
124 // when $server > 0, a server has been chosen so we can display
125 // all MySQL-related information
127 include 'libraries/server_common.inc.php';
129 // Use the verbose name of the server instead of the hostname
132 if (! empty($cfg['Server']['verbose'])) {
133 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
134 if ($GLOBALS['cfg']['ShowServerInfo']) {
135 $server_info .= ' (';
138 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
139 $server_info .= $GLOBALS['dbi']->getHostInfo();
141 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
144 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
146 // should we add the port info here?
147 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
148 ?
$GLOBALS['cfg']['Server']['verbose']
149 : $GLOBALS['cfg']['Server']['host']);
152 echo '<div id="maincontainer">' , "\n";
153 // Anchor for favorite tables synchronization.
154 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
155 echo '<div id="main_pane_left">';
156 if ($server > 0 ||
count($cfg['Servers']) > 1
158 if ($cfg['DBG']['demo']) {
159 echo '<div class="group">';
160 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
161 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
164 'You are using the demo server. You can do anything here, but '
165 . 'please do not change root, debian-sys-maint and pma users. '
166 . 'More information is available at %s.'
168 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
173 echo '<div class="group">';
174 echo '<h2>' , __('General settings') , '</h2>';
178 * Displays the MySQL servers choice form
180 if ($cfg['ServerDefault'] == 0
181 ||
(! $cfg['NavigationDisplayServers']
182 && (count($cfg['Servers']) > 1
183 ||
($server == 0 && count($cfg['Servers']) == 1)))
185 echo '<li id="li_select_server" class="no_bullets" >';
186 include_once 'libraries/select_server.lib.php';
187 echo PMA\libraries\Util
::getImage('s_host.png') , " "
188 , PMA_selectServer(true, true);
193 * Displays the mysql server related links
196 include_once 'libraries/check_user_privileges.lib.php';
198 // Logout for advanced authentication
199 if ($cfg['Server']['auth_type'] != 'config') {
200 if ($cfg['ShowChgPassword']) {
201 $conditional_class = 'ajax';
203 PMA\libraries\Util
::getImage('s_passwd.png') . " " . __(
206 'li_change_password',
207 'user_password.php' . $common_url_query,
210 'change_password_anchor',
216 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
217 echo ' <form method="post" action="index.php">' , "\n"
218 . URL
::getHiddenInputs(null, null, 4, 'collation_connection')
219 . ' <label for="select_collation_connection">' . "\n"
220 . ' ' . PMA\libraries\Util
::getImage('s_asci.png')
221 . " " . __('Server connection collation') . "\n"
222 // put the doc link in the form so that it appears on the same line
223 . PMA\libraries\Util
::showMySQLDocu('Charset-connection')
227 . Charsets
::getCollationDropdownBox(
228 'collation_connection',
229 'select_collation_connection',
230 $collation_connection,
236 } // end of if ($server > 0)
241 echo '<div class="group">';
242 echo '<h2>' , __('Appearance settings') , '</h2>';
245 // Displays language selection combo
246 $language_manager = LanguageManager
::getInstance();
247 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
248 echo '<li id="li_select_lang" class="no_bullets">';
250 echo PMA\libraries\Util
::getImage('s_lang.png') , " "
251 , $language_manager->getSelectorDisplay();
255 // ThemeManager if available
257 if ($GLOBALS['cfg']['ThemeManager']) {
258 echo '<li id="li_select_theme" class="no_bullets">';
259 echo PMA\libraries\Util
::getImage('s_theme.png') , " "
260 , ThemeManager
::getInstance()->getHtmlSelectBox();
263 echo '<li id="li_select_fontsize">';
264 echo PMA\libraries\Config
::getFontsizeForm();
274 PMA\libraries\Util
::getImage('b_tblops.png') . " " . __(
277 'li_user_preferences',
278 'prefs_manage.php' . $common_url_query,
291 echo '<div id="main_pane_right">';
294 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
296 echo '<div class="group">';
297 echo '<h2>' , __('Database server') , '</h2>';
300 __('Server:') . ' ' . $server_info,
304 __('Server type:') . ' ' . PMA\libraries\Util
::getServerType(),
308 __('Server version:')
310 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
314 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
318 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
322 echo ' <li id="li_select_mysql_charset">';
323 echo ' ' , __('Server charset:') , ' '
324 . ' <span lang="en" dir="ltr">';
325 $unicode = Charsets
::$mysql_charset_map['utf-8'];
326 $charsets = Charsets
::getMySQLCharsetsDescriptions();
327 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
334 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
335 echo '<div class="group">';
336 echo '<h2>' , __('Web server') , '</h2>';
338 if ($GLOBALS['cfg']['ShowServerInfo']) {
339 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
342 $client_version_str = $GLOBALS['dbi']->getClientInfo();
343 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
344 $client_version_str = 'libmysql - ' . $client_version_str;
347 __('Database client version:') . ' ' . $client_version_str,
348 'li_mysql_client_version'
351 $php_ext_string = __('PHP extension:') . ' ';
353 $extensions = PMA\libraries\Util
::listPHPExtensions();
355 foreach ($extensions as $extension) {
356 $php_ext_string .= ' ' . $extension
357 . PMA\libraries\Util
::showPHPDocu('book.' . $extension . '.php');
362 'li_used_php_extension'
365 $php_version_string = __('PHP version:') . ' ' . phpversion();
369 'li_used_php_version'
374 if ($cfg['ShowPhpInfo']) {
376 __('Show PHP information'),
378 'phpinfo.php' . $common_url_query,
387 echo '<div class="group pmagroup">';
388 echo '<h2>phpMyAdmin</h2>';
391 if ($GLOBALS['cfg']['VersionCheck']) {
392 $class = 'jsversioncheck';
395 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
406 PMA\libraries\Util
::getDocuLink('index'),
411 // does not work if no target specified, don't know why
413 __('Official Homepage'),
415 PMA_linkURL('https://www.phpmyadmin.net/'),
422 PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
429 PMA_linkURL('https://www.phpmyadmin.net/support/'),
434 __('List of changes'),
436 'changelog.php' . URL
::getCommon(),
443 'license.php' . URL
::getCommon(),
455 * mbstring is used for handling multibytes inside parser, so it is good
456 * to tell user something might be broken without it, see bug #1063149.
458 if (! @extension_loaded
('mbstring')) {
461 'The mbstring PHP extension was not found and you seem to be using'
462 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
463 . ' is unable to split strings correctly and it may result in'
464 . ' unexpected results.'
471 * Missing functionality
473 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
476 'The curl extension was not found and allow_url_fopen is '
477 . 'disabled. Due to this some features such as error reporting '
478 . 'or version check are disabled.'
483 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
485 * Check whether session.gc_maxlifetime limits session validity.
487 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
488 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
491 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
492 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
493 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
494 'in phpMyAdmin, because of this, your login might expire sooner ' .
495 'than configured in phpMyAdmin.'
503 * Check whether LoginCookieValidity is limited by LoginCookieStore.
505 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
506 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
510 'Login cookie store is lower than cookie validity configured in ' .
511 'phpMyAdmin, because of this, your login will expire sooner than ' .
512 'configured in phpMyAdmin.'
519 * Check if user does not have defined blowfish secret and it is being used.
521 if (! empty($_SESSION['encryption_key'])) {
522 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
525 'The configuration file now needs a secret passphrase (blowfish_secret).'
529 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
532 'The secret passphrase in configuration (blowfish_secret) is too short.'
540 * Check for existence of config directory which should not exist in
541 * production environment.
543 if (@file_exists
('config')) {
546 'Directory [code]config[/code], which is used by the setup script, ' .
547 'still exists in your phpMyAdmin directory. It is strongly ' .
548 'recommended to remove it once phpMyAdmin has been configured. ' .
549 'Otherwise the security of your server may be compromised by ' .
550 'unauthorized people downloading your configuration.'
557 $cfgRelation = PMA_getRelationsParam();
558 if (! $cfgRelation['allworks']
559 && $cfg['PmaNoRelation_DisableWarning'] == false
562 'The phpMyAdmin configuration storage is not completely '
563 . 'configured, some extended features have been deactivated. '
564 . '%sFind out why%s. '
566 if ($cfg['ZeroConf'] == true) {
567 $msg_text .= '<br>' .
569 'Or alternately go to \'Operations\' tab of any database '
570 . 'to set it up there.'
573 $msg = PMA\libraries\Message
::notice($msg_text);
574 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
575 $msg->addParamHtml('</a>');
576 /* Show error if user has configured something, notice elsewhere */
577 if (!empty($cfg['Servers'][$server]['pmadb'])) {
585 * Warning about Suhosin only if its simulation mode is not enabled
587 if ($cfg['SuhosinDisableWarning'] == false
588 && @ini_get
('suhosin.request.max_value_length')
589 && @ini_get
('suhosin.simulation') == '0'
594 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
595 'for possible issues.'
605 * Warning about incomplete translations.
607 * The data file is created while creating release by ./scripts/remove-incomplete-mo
609 if (@file_exists
('libraries/language_stats.inc.php')) {
610 include 'libraries/language_stats.inc.php';
612 * This message is intentionally not translated, because we're
613 * handling incomplete translations here and focus on english
616 if (isset($GLOBALS['language_stats'][$lang])
617 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
620 'You are using an incomplete translation, please help to make it '
621 . 'better by [a@https://www.phpmyadmin.net/translate/'
622 . '@_blank]contributing[/a].',
629 * prints list item for main page
631 * @param string $name displayed text
632 * @param string $listId id, used for css styles
633 * @param string $url make item as link with $url as target
634 * @param string $mysql_help_page display a link to MySQL's manual
635 * @param string $target special target for $url
636 * @param string $a_id id for the anchor,
637 * used for jQuery to hook in functions
638 * @param string $class class for the li element
639 * @param string $a_class class for the anchor element
643 function PMA_printListItem($name, $listId = null, $url = null,
644 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
647 echo PMA\libraries\Template
::get('list/item')
659 'mysql_help_page' => $mysql_help_page,