2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 * Gets some core libraries and displays a top message if required
12 require_once 'libraries/common.inc.php';
15 * display Git revision if requested
17 require_once 'libraries/display_git_revision.lib.php';
18 require_once 'libraries/Template.class.php';
21 * pass variables to child pages
26 'collation_connection',
30 foreach ($drops as $each_drop) {
31 if (array_key_exists($each_drop, $_GET)) {
32 unset($_GET[$each_drop]);
35 unset($drops, $each_drop);
38 * Black list of all scripts to which front-end must submit data.
39 * Such scripts must not be loaded on home page.
42 $target_blacklist = array (
43 'import.php', 'export.php'
46 // If we have a valid target, let's load that script instead
47 if (! empty($_REQUEST['target'])
48 && is_string($_REQUEST['target'])
49 && ! preg_match('/^index/', $_REQUEST['target'])
50 && ! in_array($_REQUEST['target'], $target_blacklist)
51 && in_array($_REQUEST['target'], $goto_whitelist)
53 include $_REQUEST['target'];
57 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
62 if (! empty($_REQUEST['db'])) {
64 if (! empty($_REQUEST['table'])) {
65 $page = PMA_Util
::getScriptNameForOption(
66 $GLOBALS['cfg']['DefaultTabTable'], 'table'
69 $page = PMA_Util
::getScriptNameForOption(
70 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
78 * Check if it is an ajax request to reload the recent tables list.
80 require_once 'libraries/RecentFavoriteTable.class.php';
81 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
82 $response = PMA_Response
::getInstance();
85 PMA_RecentFavoriteTable
::getInstance('recent')->getHtmlList()
90 if ($GLOBALS['PMA_Config']->isGitRevision()) {
91 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
92 PMA_printGitRevision();
95 echo '<div id="is_git_revision"></div>';
98 // Handles some variables that may have been sent by the calling script
100 $GLOBALS['table'] = '';
103 // Any message to display?
104 if (! empty($message)) {
105 echo PMA_Util
::getMessage($message);
109 $common_url_query = PMA_URL_getCommon();
110 $mysql_cur_user_and_host = '';
112 // when $server > 0, a server has been chosen so we can display
113 // all MySQL-related information
115 include 'libraries/server_common.inc.php';
116 include 'libraries/StorageEngine.class.php';
118 // Use the verbose name of the server instead of the hostname
121 if (! empty($cfg['Server']['verbose'])) {
122 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
123 if ($GLOBALS['cfg']['ShowServerInfo']) {
124 $server_info .= ' (';
127 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
128 $server_info .= $GLOBALS['dbi']->getHostInfo();
130 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
133 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
135 // should we add the port info here?
136 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
137 ?
$GLOBALS['cfg']['Server']['verbose']
138 : $GLOBALS['cfg']['Server']['host']);
141 echo '<div id="maincontainer">' . "\n";
142 // Anchor for favorite tables synchronization.
143 echo PMA_RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
144 echo '<div id="main_pane_left">';
145 if ($server > 0 ||
count($cfg['Servers']) > 1
147 if ($cfg['DBG']['demo']) {
148 echo '<div class="group">';
149 echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
150 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
153 'You are using the demo server. You can do anything here, but '
154 . 'please do not change root, debian-sys-maint and pma users. '
155 . 'More information is available at %s.'
157 '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
162 echo '<div class="group">';
163 echo '<h2>' . __('General settings') . '</h2>';
167 * Displays the MySQL servers choice form
169 if ($cfg['ServerDefault'] == 0
170 ||
(! $cfg['NavigationDisplayServers']
171 && (count($cfg['Servers']) > 1
172 ||
($server == 0 && count($cfg['Servers']) == 1)))
174 echo '<li id="li_select_server" class="no_bullets" >';
175 include_once 'libraries/select_server.lib.php';
176 echo PMA_Util
::getImage('s_host.png') . " " . PMA_selectServer(true, true);
181 * Displays the mysql server related links
183 if ($server > 0 && ! PMA_DRIZZLE
) {
184 include_once 'libraries/check_user_privileges.lib.php';
186 // Logout for advanced authentication
187 if ($cfg['Server']['auth_type'] != 'config') {
188 if ($cfg['ShowChgPassword']) {
189 $conditional_class = 'ajax';
191 PMA_Util
::getImage('s_passwd.png') . " " . __('Change password'),
192 'li_change_password',
193 'user_password.php' . $common_url_query,
196 'change_password_anchor',
202 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
203 echo ' <form method="post" action="index.php">' . "\n"
204 . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
205 . ' <label for="select_collation_connection">' . "\n"
206 . ' ' . PMA_Util
::getImage('s_asci.png') . " "
207 . __('Server connection collation') . "\n"
208 // put the doc link in the form so that it appears on the same line
209 . PMA_Util
::showMySQLDocu('Charset-connection')
213 . PMA_generateCharsetDropdownBox(
214 PMA_CSDROPDOWN_COLLATION
,
215 'collation_connection',
216 'select_collation_connection',
217 $collation_connection,
223 } // end of if ($server > 0 && !PMA_DRIZZLE)
228 echo '<div class="group">';
229 echo '<h2>' . __('Appearance settings') . '</h2>';
232 // Displays language selection combo
233 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
234 echo '<li id="li_select_lang" class="no_bullets">';
235 include_once 'libraries/display_select_lang.lib.php';
236 echo PMA_Util
::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
240 // ThemeManager if available
242 if ($GLOBALS['cfg']['ThemeManager']) {
243 echo '<li id="li_select_theme" class="no_bullets">';
244 echo PMA_Util
::getImage('s_theme.png') . " "
245 . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
248 echo '<li id="li_select_fontsize">';
249 echo PMA_Config
::getFontsizeForm();
259 PMA_Util
::getImage('b_tblops.png') . " " . __('More settings'),
260 'li_user_preferences',
261 'prefs_manage.php' . $common_url_query,
274 echo '<div id="main_pane_right">';
277 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
279 echo '<div class="group">';
280 echo '<h2>' . __('Database server') . '</h2>';
283 __('Server:') . ' ' . $server_info,
287 __('Server type:') . ' ' . PMA_Util
::getServerType(),
291 __('Server version:')
293 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
297 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
301 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
305 echo ' <li id="li_select_mysql_charset">';
306 echo ' ' . __('Server charset:') . ' '
307 . ' <span lang="en" dir="ltr">';
310 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
312 echo ' (' . $mysql_charset_map['utf-8'] . ')'
319 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
320 echo '<div class="group">';
321 echo '<h2>' . __('Web server') . '</h2>';
323 if ($GLOBALS['cfg']['ShowServerInfo']) {
324 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
327 $client_version_str = $GLOBALS['dbi']->getClientInfo();
328 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
329 $client_version_str = 'libmysql - ' . $client_version_str;
332 __('Database client version:') . ' ' . $client_version_str,
333 'li_mysql_client_version'
336 $php_ext_string = __('PHP extension:') . ' ';
337 if (PMA_DatabaseInterface
::checkDbExtension('mysqli')) {
338 $extension = 'mysqli';
340 $extension = 'mysql';
342 $php_ext_string .= $extension . ' '
343 . PMA_Util
::showPHPDocu('book.' . $extension . '.php');
347 'li_used_php_extension'
350 $php_version_string = __('PHP version:') . ' ' . phpversion();
354 'li_used_php_version'
359 if ($cfg['ShowPhpInfo']) {
361 __('Show PHP information'),
363 'phpinfo.php' . $common_url_query,
372 echo '<div class="group pmagroup">';
373 echo '<h2>phpMyAdmin</h2>';
376 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
377 // support here and does not allow request to http once using https.
378 if ($GLOBALS['cfg']['VersionCheck']
379 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT
!= 'IE')
381 $class = 'jsversioncheck';
384 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
395 PMA_Util
::getDocuLink('index'),
402 PMA_linkURL('http://wiki.phpmyadmin.net/'),
407 // does not work if no target specified, don't know why
409 __('Official Homepage'),
411 PMA_linkURL('http://www.phpMyAdmin.net/'),
418 PMA_linkURL('https://www.phpmyadmin.net/contribute/'),
425 PMA_linkURL('https://www.phpmyadmin.net/support/'),
430 __('List of changes'),
432 'changelog.php' . PMA_URL_getCommon(),
444 * Warning if using the default MySQL privileged account
447 && $cfg['Server']['user'] == 'root'
448 && $cfg['Server']['password'] == ''
452 'You are connected as \'root\' with no password, which'
453 . ' corresponds to the default MySQL privileged account.'
454 . ' Your MySQL server is running with this default, is open to'
455 . ' intrusion, and you really should fix this security hole by'
456 . ' setting a password for user \'root\'.'
463 * As we try to handle charsets by ourself, mbstring overloads just
464 * break it, see bug 1063821.
466 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
469 'You have enabled mbstring.func_overload in your PHP '
470 . 'configuration. This option is incompatible with phpMyAdmin '
471 . 'and might cause some data to be corrupted!'
478 * mbstring is used for handling multibytes inside parser, so it is good
479 * to tell user something might be broken without it, see bug #1063149.
481 if (! @extension_loaded
('mbstring')) {
484 'The mbstring PHP extension was not found and you seem to be using'
485 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
486 . ' is unable to split strings correctly and it may result in'
487 . ' unexpected results.'
493 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
495 * Check whether session.gc_maxlifetime limits session validity.
497 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
498 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
501 'Your PHP parameter [a@http://php.net/manual/en/session.' .
502 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
503 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
504 'in phpMyAdmin, because of this, your login might expire sooner ' .
505 'than configured in phpMyAdmin.'
513 * Check whether LoginCookieValidity is limited by LoginCookieStore.
515 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
516 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
520 'Login cookie store is lower than cookie validity configured in ' .
521 'phpMyAdmin, because of this, your login will expire sooner than ' .
522 'configured in phpMyAdmin.'
529 * Check if user does not have defined blowfish secret and it is being used.
531 if (! empty($_SESSION['encryption_key'])
532 && empty($GLOBALS['cfg']['blowfish_secret'])
536 'The configuration file now needs a secret passphrase (blowfish_secret).'
543 * Check for existence of config directory which should not exist in
544 * production environment.
546 if (file_exists('config')) {
549 'Directory [code]config[/code], which is used by the setup script, ' .
550 'still exists in your phpMyAdmin directory. It is strongly ' .
551 'recommended to remove it once phpMyAdmin has been configured. ' .
552 'Otherwise the security of your server may be compromised by ' .
553 'unauthorized people downloading your configuration.'
560 $cfgRelation = PMA_getRelationsParam();
561 if (! $cfgRelation['allworks']
562 && $cfg['PmaNoRelation_DisableWarning'] == false
565 'The phpMyAdmin configuration storage is not completely '
566 . 'configured, some extended features have been deactivated. '
567 . '%sFind out why%s. '
569 if ($cfg['ZeroConf'] == true) {
570 $msg_text .= '<br> ' .
572 'Or alternately go to \'Operations\' tab of any database '
573 . 'to set it up there.'
576 $msg = PMA_Message
::notice($msg_text);
578 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php'
579 . $common_url_query . '">',
582 $msg->addParam('</a>', false);
583 /* Show error if user has configured something, notice elsewhere */
584 if (!empty($cfg['Servers'][$server]['pmadb'])) {
592 * Warning about different MySQL library and server version
593 * (a difference on the third digit does not count).
594 * If someday there is a constant that we can check about mysqlnd,
595 * we can use it instead of strpos().
596 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
597 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
599 * We also do not warn if MariaDB is detected, as it has its own version
602 if (isset($GLOBALS['dbi'])
604 && $cfg['ServerLibraryDifference_DisableWarning'] == false
606 /** @var PMA_String $pmaString */
607 $pmaString = $GLOBALS['PMA_String'];
609 $_client_info = $GLOBALS['dbi']->getClientInfo();
611 && /*overload*/mb_strpos($_client_info, 'mysqlnd') === false
612 && /*overload*/mb_strpos(PMA_MYSQL_STR_VERSION
, 'MariaDB') === false
613 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(
614 PMA_MYSQL_INT_VERSION
, 0, 3
621 'Your PHP MySQL library version %s differs from your ' .
622 'MySQL server version %s. This may cause unpredictable ' .
627 PMA_MYSQL_STR_VERSION
,
629 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
636 unset($_client_info);
640 * Warning about Suhosin only if its simulation mode is not enabled
642 if ($cfg['SuhosinDisableWarning'] == false
643 && @ini_get
('suhosin.request.max_value_length')
644 && @ini_get
('suhosin.simulation') == '0'
649 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
650 'for possible issues.'
660 * Warning about incomplete translations.
662 * The data file is created while creating release by ./scripts/remove-incomplete-mo
664 if (file_exists('libraries/language_stats.inc.php')) {
665 include 'libraries/language_stats.inc.php';
667 * This message is intentionally not translated, because we're
668 * handling incomplete translations here and focus on english
671 if (isset($GLOBALS['language_stats'][$lang])
672 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
675 'You are using an incomplete translation, please help to make it '
676 . 'better by [a@https://www.phpmyadmin.net/translate/'
677 . '@_blank]contributing[/a].',
684 * prints list item for main page
686 * @param string $name displayed text
687 * @param string $listId id, used for css styles
688 * @param string $url make item as link with $url as target
689 * @param string $mysql_help_page display a link to MySQL's manual
690 * @param string $target special target for $url
691 * @param string $a_id id for the anchor,
692 * used for jQuery to hook in functions
693 * @param string $class class for the li element
694 * @param string $a_class class for the anchor element
698 function PMA_printListItem($name, $listId = null, $url = null,
699 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
702 echo PMA\Template
::get('list/item')
714 'mysql_help_page' => $mysql_help_page,