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
;
15 * Gets some core libraries and displays a top message if required
17 require_once 'libraries/common.inc.php';
20 * display Git revision if requested
22 require_once 'libraries/display_git_revision.lib.php';
25 * pass variables to child pages
30 'collation_connection',
34 foreach ($drops as $each_drop) {
35 if (array_key_exists($each_drop, $_GET)) {
36 unset($_GET[$each_drop]);
39 unset($drops, $each_drop);
42 * Black list of all scripts to which front-end must submit data.
43 * Such scripts must not be loaded on home page.
46 $target_blacklist = array (
47 'import.php', 'export.php'
50 // If we have a valid target, let's load that script instead
51 if (! empty($_REQUEST['target'])
52 && is_string($_REQUEST['target'])
53 && ! preg_match('/^index/', $_REQUEST['target'])
54 && ! in_array($_REQUEST['target'], $target_blacklist)
55 && in_array($_REQUEST['target'], $goto_whitelist)
57 include $_REQUEST['target'];
61 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
66 if (! empty($_REQUEST['db'])) {
68 if (! empty($_REQUEST['table'])) {
69 $page = PMA\libraries\Util
::getScriptNameForOption(
70 $GLOBALS['cfg']['DefaultTabTable'], 'table'
73 $page = PMA\libraries\Util
::getScriptNameForOption(
74 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
82 * Check if it is an ajax request to reload the recent tables list.
84 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
85 $response = PMA\libraries\Response
::getInstance();
88 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
93 if ($GLOBALS['PMA_Config']->isGitRevision()) {
94 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
95 PMA_printGitRevision();
98 echo '<div id="is_git_revision"></div>';
101 // Handles some variables that may have been sent by the calling script
103 $GLOBALS['table'] = '';
106 // Any message to display?
107 if (! empty($message)) {
108 echo PMA\libraries\Util
::getMessage($message);
112 $common_url_query = URL
::getCommon();
113 $mysql_cur_user_and_host = '';
115 // when $server > 0, a server has been chosen so we can display
116 // all MySQL-related information
118 include 'libraries/server_common.inc.php';
120 // Use the verbose name of the server instead of the hostname
123 if (! empty($cfg['Server']['verbose'])) {
124 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
125 if ($GLOBALS['cfg']['ShowServerInfo']) {
126 $server_info .= ' (';
129 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
130 $server_info .= $GLOBALS['dbi']->getHostInfo();
132 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
135 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
137 // should we add the port info here?
138 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
139 ?
$GLOBALS['cfg']['Server']['verbose']
140 : $GLOBALS['cfg']['Server']['host']);
143 echo '<div id="maincontainer">' , "\n";
144 // Anchor for favorite tables synchronization.
145 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
146 echo '<div id="main_pane_left">';
147 if ($server > 0 ||
count($cfg['Servers']) > 1
149 if ($cfg['DBG']['demo']) {
150 echo '<div class="group">';
151 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
152 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
155 'You are using the demo server. You can do anything here, but '
156 . 'please do not change root, debian-sys-maint and pma users. '
157 . 'More information is available at %s.'
159 '<a href="url.php?url=https://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
164 echo '<div class="group">';
165 echo '<h2>' , __('General settings') , '</h2>';
169 * Displays the MySQL servers choice form
171 if ($cfg['ServerDefault'] == 0
172 ||
(! $cfg['NavigationDisplayServers']
173 && (count($cfg['Servers']) > 1
174 ||
($server == 0 && count($cfg['Servers']) == 1)))
176 echo '<li id="li_select_server" class="no_bullets" >';
177 include_once 'libraries/select_server.lib.php';
178 echo PMA\libraries\Util
::getImage('s_host.png') , " "
179 , PMA_selectServer(true, true);
184 * Displays the mysql server related links
187 include_once 'libraries/check_user_privileges.lib.php';
189 // Logout for advanced authentication
190 if ($cfg['Server']['auth_type'] != 'config') {
191 if ($cfg['ShowChgPassword']) {
192 $conditional_class = 'ajax';
194 PMA\libraries\Util
::getImage('s_passwd.png') . " " . __(
197 'li_change_password',
198 'user_password.php' . $common_url_query,
201 'change_password_anchor',
207 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
208 echo ' <form method="post" action="index.php">' , "\n"
209 . URL
::getHiddenInputs(null, null, 4, 'collation_connection')
210 . ' <label for="select_collation_connection">' . "\n"
211 . ' ' . PMA\libraries\Util
::getImage('s_asci.png')
212 . " " . __('Server connection collation') . "\n"
213 // put the doc link in the form so that it appears on the same line
214 . PMA\libraries\Util
::showMySQLDocu('Charset-connection')
218 . Charsets
::getCollationDropdownBox(
219 'collation_connection',
220 'select_collation_connection',
221 $collation_connection,
227 } // end of if ($server > 0)
232 echo '<div class="group">';
233 echo '<h2>' , __('Appearance settings') , '</h2>';
236 // Displays language selection combo
237 if (empty($cfg['Lang'])) {
238 echo '<li id="li_select_lang" class="no_bullets">';
239 include_once 'libraries/display_select_lang.lib.php';
240 echo PMA\libraries\Util
::getImage('s_lang.png') , " "
241 , PMA_getLanguageSelectorHtml();
245 // ThemeManager if available
247 if ($GLOBALS['cfg']['ThemeManager']) {
248 echo '<li id="li_select_theme" class="no_bullets">';
249 echo PMA\libraries\Util
::getImage('s_theme.png') , " "
250 , ThemeManager
::getInstance()->getHtmlSelectBox();
253 echo '<li id="li_select_fontsize">';
254 echo PMA\libraries\Config
::getFontsizeForm();
264 PMA\libraries\Util
::getImage('b_tblops.png') . " " . __(
267 'li_user_preferences',
268 'prefs_manage.php' . $common_url_query,
281 echo '<div id="main_pane_right">';
284 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
286 echo '<div class="group">';
287 echo '<h2>' , __('Database server') , '</h2>';
290 __('Server:') . ' ' . $server_info,
294 __('Server type:') . ' ' . PMA\libraries\Util
::getServerType(),
298 __('Server version:')
300 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
304 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
308 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
312 echo ' <li id="li_select_mysql_charset">';
313 echo ' ' , __('Server charset:') , ' '
314 . ' <span lang="en" dir="ltr">';
315 $unicode = Charsets
::$mysql_charset_map['utf-8'];
316 $charsets = Charsets
::getMySQLCharsetsDescriptions();
317 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
324 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
325 echo '<div class="group">';
326 echo '<h2>' , __('Web server') , '</h2>';
328 if ($GLOBALS['cfg']['ShowServerInfo']) {
329 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
332 $client_version_str = $GLOBALS['dbi']->getClientInfo();
333 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
334 $client_version_str = 'libmysql - ' . $client_version_str;
337 __('Database client version:') . ' ' . $client_version_str,
338 'li_mysql_client_version'
341 $php_ext_string = __('PHP extension:') . ' ';
343 $extensions = PMA\libraries\Util
::listPHPExtensions();
345 foreach ($extensions as $extension) {
346 $php_ext_string .= ' ' . $extension
347 . PMA\libraries\Util
::showPHPDocu('book.' . $extension . '.php');
352 'li_used_php_extension'
355 $php_version_string = __('PHP version:') . ' ' . phpversion();
359 'li_used_php_version'
364 if ($cfg['ShowPhpInfo']) {
366 __('Show PHP information'),
368 'phpinfo.php' . $common_url_query,
377 echo '<div class="group pmagroup">';
378 echo '<h2>phpMyAdmin</h2>';
381 if ($GLOBALS['cfg']['VersionCheck']) {
382 $class = 'jsversioncheck';
385 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
396 PMA\libraries\Util
::getDocuLink('index'),
401 // does not work if no target specified, don't know why
403 __('Official Homepage'),
405 PMA_linkURL('https://www.phpMyAdmin.net/'),
412 PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
419 PMA_linkURL('https://www.phpmyadmin.net/support/'),
424 __('List of changes'),
426 'changelog.php' . URL
::getCommon(),
433 'license.php' . URL
::getCommon(),
445 * As we try to handle charsets by ourself, mbstring overloads just
446 * break it, see bug 1063821.
448 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
451 'You have enabled mbstring.func_overload in your PHP '
452 . 'configuration. This option is incompatible with phpMyAdmin '
453 . 'and might cause some data to be corrupted!'
460 * mbstring is used for handling multibytes inside parser, so it is good
461 * to tell user something might be broken without it, see bug #1063149.
463 if (! @extension_loaded
('mbstring')) {
466 'The mbstring PHP extension was not found and you seem to be using'
467 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
468 . ' is unable to split strings correctly and it may result in'
469 . ' unexpected results.'
476 * Missing functionality
478 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
481 'The curl extension was not found and allow_url_fopen is '
482 . 'disabled. Due to this some features such as error reporting '
483 . 'or version check are disabled.'
488 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
490 * Check whether session.gc_maxlifetime limits session validity.
492 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
493 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
496 'Your PHP parameter [a@https://php.net/manual/en/session.' .
497 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
498 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
499 'in phpMyAdmin, because of this, your login might expire sooner ' .
500 'than configured in phpMyAdmin.'
508 * Check whether LoginCookieValidity is limited by LoginCookieStore.
510 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
511 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
515 'Login cookie store is lower than cookie validity configured in ' .
516 'phpMyAdmin, because of this, your login will expire sooner than ' .
517 'configured in phpMyAdmin.'
524 * Check if user does not have defined blowfish secret and it is being used.
526 if (! empty($_SESSION['encryption_key'])
527 && empty($GLOBALS['cfg']['blowfish_secret'])
531 'The configuration file now needs a secret passphrase (blowfish_secret).'
538 * Check for existence of config directory which should not exist in
539 * production environment.
541 if (@file_exists
('config')) {
544 'Directory [code]config[/code], which is used by the setup script, ' .
545 'still exists in your phpMyAdmin directory. It is strongly ' .
546 'recommended to remove it once phpMyAdmin has been configured. ' .
547 'Otherwise the security of your server may be compromised by ' .
548 'unauthorized people downloading your configuration.'
555 $cfgRelation = PMA_getRelationsParam();
556 if (! $cfgRelation['allworks']
557 && $cfg['PmaNoRelation_DisableWarning'] == false
560 'The phpMyAdmin configuration storage is not completely '
561 . 'configured, some extended features have been deactivated. '
562 . '%sFind out why%s. '
564 if ($cfg['ZeroConf'] == true) {
565 $msg_text .= '<br>' .
567 'Or alternately go to \'Operations\' tab of any database '
568 . 'to set it up there.'
571 $msg = PMA\libraries\Message
::notice($msg_text);
572 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
573 $msg->addParamHtml('</a>');
574 /* Show error if user has configured something, notice elsewhere */
575 if (!empty($cfg['Servers'][$server]['pmadb'])) {
583 * Warning about different MySQL library and server version
584 * (a difference on the third digit does not count).
585 * If someday there is a constant that we can check about mysqlnd,
586 * we can use it instead of strpos().
587 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
588 * We also do not warn if MariaDB is detected, as it has its own version
591 if (isset($GLOBALS['dbi'])
592 && $cfg['ServerLibraryDifference_DisableWarning'] == false
594 $_client_info = $GLOBALS['dbi']->getClientInfo();
596 && mb_strpos($_client_info, 'mysqlnd') === false
597 && mb_strpos(PMA_MYSQL_STR_VERSION
, 'MariaDB') === false
598 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(
599 PMA_MYSQL_INT_VERSION
, 0, 3
606 'Your PHP MySQL library version %s differs from your ' .
607 'MySQL server version %s. This may cause unpredictable ' .
612 PMA_MYSQL_STR_VERSION
,
614 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
621 unset($_client_info);
625 * Warning about Suhosin only if its simulation mode is not enabled
627 if ($cfg['SuhosinDisableWarning'] == false
628 && @ini_get
('suhosin.request.max_value_length')
629 && @ini_get
('suhosin.simulation') == '0'
634 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
635 'for possible issues.'
645 * Warning about incomplete translations.
647 * The data file is created while creating release by ./scripts/remove-incomplete-mo
649 if (@file_exists
('libraries/language_stats.inc.php')) {
650 include 'libraries/language_stats.inc.php';
652 * This message is intentionally not translated, because we're
653 * handling incomplete translations here and focus on english
656 if (isset($GLOBALS['language_stats'][$lang])
657 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
660 'You are using an incomplete translation, please help to make it '
661 . 'better by [a@https://www.phpmyadmin.net/translate/'
662 . '@_blank]contributing[/a].',
669 * prints list item for main page
671 * @param string $name displayed text
672 * @param string $listId id, used for css styles
673 * @param string $url make item as link with $url as target
674 * @param string $mysql_help_page display a link to MySQL's manual
675 * @param string $target special target for $url
676 * @param string $a_id id for the anchor,
677 * used for jQuery to hook in functions
678 * @param string $class class for the li element
679 * @param string $a_class class for the anchor element
683 function PMA_printListItem($name, $listId = null, $url = null,
684 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
687 echo PMA\libraries\Template
::get('list/item')
699 'mysql_help_page' => $mysql_help_page,