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';
20 * pass variables to child pages
25 'collation_connection',
29 foreach ($drops as $each_drop) {
30 if (array_key_exists($each_drop, $_GET)) {
31 unset($_GET[$each_drop]);
34 unset($drops, $each_drop);
37 * Black list of all scripts to which front-end must submit data.
38 * Such scripts must not be loaded on home page.
41 $target_blacklist = array (
42 'import.php', 'export.php'
45 // If we have a valid target, let's load that script instead
46 if (! empty($_REQUEST['target'])
47 && is_string($_REQUEST['target'])
48 && ! preg_match('/^index/', $_REQUEST['target'])
49 && ! in_array($_REQUEST['target'], $target_blacklist)
50 && in_array($_REQUEST['target'], $goto_whitelist)
52 include $_REQUEST['target'];
56 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
61 if (! empty($_REQUEST['db'])) {
63 if (! empty($_REQUEST['table'])) {
64 $page = $GLOBALS['cfg']['DefaultTabTable'];
66 $page = $GLOBALS['cfg']['DefaultTabDatabase'];
73 * Check if it is an ajax request to reload the recent tables list.
75 require_once 'libraries/RecentFavoriteTable.class.php';
76 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
77 $response = PMA_Response
::getInstance();
80 PMA_RecentFavoriteTable
::getInstance('recent')->getHtmlList()
85 if ($GLOBALS['PMA_Config']->isGitRevision()) {
86 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
87 PMA_printGitRevision();
90 echo '<div id="is_git_revision"></div>';
93 // Handles some variables that may have been sent by the calling script
95 $GLOBALS['table'] = '';
98 // Any message to display?
99 if (! empty($message)) {
100 echo PMA_Util
::getMessage($message);
104 $common_url_query = PMA_URL_getCommon();
105 $mysql_cur_user_and_host = '';
107 // when $server > 0, a server has been chosen so we can display
108 // all MySQL-related information
110 include 'libraries/server_common.inc.php';
111 include 'libraries/StorageEngine.class.php';
113 // Use the verbose name of the server instead of the hostname
116 if (! empty($cfg['Server']['verbose'])) {
117 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
118 if ($GLOBALS['cfg']['ShowServerInfo']) {
119 $server_info .= ' (';
122 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
123 $server_info .= $GLOBALS['dbi']->getHostInfo();
125 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
128 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
130 // should we add the port info here?
131 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
132 ?
$GLOBALS['cfg']['Server']['verbose']
133 : $GLOBALS['cfg']['Server']['host']);
136 echo '<div id="maincontainer">' . "\n";
137 // Anchor for favorite tables synchronization.
138 echo PMA_RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
139 echo '<div id="main_pane_left">';
140 if ($server > 0 ||
count($cfg['Servers']) > 1
142 if ($cfg['DBG']['demo']) {
143 echo '<div class="group">';
144 echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
145 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
148 'You are using the demo server. You can do anything here, but '
149 . 'please do not change root, debian-sys-maint and pma users. '
150 . 'More information is available at %s.'
152 '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
157 echo '<div class="group">';
158 echo '<h2>' . __('General Settings') . '</h2>';
162 * Displays the MySQL servers choice form
164 if ($cfg['ServerDefault'] == 0
165 ||
(! $cfg['NavigationDisplayServers']
166 && (count($cfg['Servers']) > 1
167 ||
($server == 0 && count($cfg['Servers']) == 1)))
169 echo '<li id="li_select_server" class="no_bullets" >';
170 include_once 'libraries/select_server.lib.php';
171 echo PMA_Util
::getImage('s_host.png') . " " . PMA_selectServer(true, true);
176 * Displays the mysql server related links
178 if ($server > 0 && ! PMA_DRIZZLE
) {
179 include_once 'libraries/check_user_privileges.lib.php';
181 // Logout for advanced authentication
182 if ($cfg['Server']['auth_type'] != 'config') {
183 if ($cfg['ShowChgPassword']) {
184 $conditional_class = 'ajax';
186 PMA_Util
::getImage('s_passwd.png') . " " . __('Change password'),
187 'li_change_password',
188 'user_password.php' . $common_url_query,
191 'change_password_anchor',
197 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
198 echo ' <form method="post" action="index.php">' . "\n"
199 . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
200 . ' <label for="select_collation_connection">' . "\n"
201 . ' ' . PMA_Util
::getImage('s_asci.png') . " "
202 . __('Server connection collation') . "\n"
203 // put the doc link in the form so that it appears on the same line
204 . PMA_Util
::showMySQLDocu('Charset-connection')
208 . PMA_generateCharsetDropdownBox(
209 PMA_CSDROPDOWN_COLLATION
,
210 'collation_connection',
211 'select_collation_connection',
212 $collation_connection,
218 } // end of if ($server > 0 && !PMA_DRIZZLE)
223 echo '<div class="group">';
224 echo '<h2>' . __('Appearance Settings') . '</h2>';
227 // Displays language selection combo
228 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
229 echo '<li id="li_select_lang" class="no_bullets">';
230 include_once 'libraries/display_select_lang.lib.php';
231 echo PMA_Util
::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
235 // ThemeManager if available
237 if ($GLOBALS['cfg']['ThemeManager']) {
238 echo '<li id="li_select_theme" class="no_bullets">';
239 echo PMA_Util
::getImage('s_theme.png') . " "
240 . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
243 echo '<li id="li_select_fontsize">';
244 echo PMA_Config
::getFontsizeForm();
254 PMA_Util
::getImage('b_tblops.png') . " " . __('More settings'),
255 'li_user_preferences',
256 'prefs_manage.php' . $common_url_query,
269 echo '<div id="main_pane_right">';
272 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
274 echo '<div class="group">';
275 echo '<h2>' . __('Database server') . '</h2>';
278 __('Server:') . ' ' . $server_info,
282 __('Server type:') . ' ' . PMA_Util
::getServerType(),
286 __('Server version:')
288 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
292 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
296 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
300 echo ' <li id="li_select_mysql_charset">';
301 echo ' ' . __('Server charset:') . ' '
302 . ' <span lang="en" dir="ltr">';
305 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
307 echo ' (' . $mysql_charset_map['utf-8'] . ')'
314 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
315 echo '<div class="group">';
316 echo '<h2>' . __('Web server') . '</h2>';
318 if ($GLOBALS['cfg']['ShowServerInfo']) {
319 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
322 $client_version_str = $GLOBALS['dbi']->getClientInfo();
323 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
324 $client_version_str = 'libmysql - ' . $client_version_str;
327 __('Database client version:') . ' ' . $client_version_str,
328 'li_mysql_client_version'
331 $php_ext_string = __('PHP extension:') . ' ';
332 if (PMA_DatabaseInterface
::checkDbExtension('mysqli')) {
333 $extension = 'mysqli';
335 $extension = 'mysql';
337 $php_ext_string .= $extension . ' '
338 . PMA_Util
::showPHPDocu('book.' . $extension . '.php');
342 'li_used_php_extension'
345 $php_version_string = __('PHP version:') . ' ' . phpversion();
349 'li_used_php_version'
354 if ($cfg['ShowPhpInfo']) {
356 __('Show PHP information'),
358 'phpinfo.php' . $common_url_query,
367 echo '<div class="group pmagroup">';
368 echo '<h2>phpMyAdmin</h2>';
371 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
372 // support here and does not allow request to http once using https.
373 if ($GLOBALS['cfg']['VersionCheck']
374 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT
!= 'IE')
376 $class = 'jsversioncheck';
379 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
390 PMA_Util
::getDocuLink('index'),
397 PMA_linkURL('http://wiki.phpmyadmin.net/'),
402 // does not work if no target specified, don't know why
404 __('Official Homepage'),
406 PMA_linkURL('http://www.phpMyAdmin.net/'),
413 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
420 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
425 __('List of changes'),
427 'changelog.php' . PMA_URL_getCommon(),
439 * Warning if using the default MySQL privileged account
442 && $cfg['Server']['user'] == 'root'
443 && $cfg['Server']['password'] == ''
447 'You are connected as \'root\' with no password, which'
448 . ' corresponds to the default MySQL privileged account.'
449 . ' Your MySQL server is running with this default, is open to'
450 . ' intrusion, and you really should fix this security hole by'
451 . ' setting a password for user \'root\'.'
458 * As we try to handle charsets by ourself, mbstring overloads just
459 * break it, see bug 1063821.
461 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
464 'You have enabled mbstring.func_overload in your PHP '
465 . 'configuration. This option is incompatible with phpMyAdmin '
466 . 'and might cause some data to be corrupted!'
473 * mbstring is used for handling multibytes inside parser, so it is good
474 * to tell user something might be broken without it, see bug #1063149.
476 if (! @extension_loaded
('mbstring')) {
479 'The mbstring PHP extension was not found and you seem to be using'
480 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
481 . ' is unable to split strings correctly and it may result in'
482 . ' unexpected results.'
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'] ) {
495 __('Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@_blank]session.gc_maxlifetime[/a] is lower than cookie validity configured in phpMyAdmin, because of this, your login might expire sooner than configured in phpMyAdmin.'),
502 * Check whether LoginCookieValidity is limited by LoginCookieStore.
504 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
505 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
508 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
514 * Check if user does not have defined blowfish secret and it is being used.
516 if (! empty($_SESSION['encryption_key'])
517 && empty($GLOBALS['cfg']['blowfish_secret'])
520 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
526 * Check for existence of config directory which should not exist in
527 * production environment.
529 if (file_exists('config')) {
531 __('Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. It is strongly recommended to remove it once phpMyAdmin has been configured. Otherwise the security of your server may be compromised by unauthorized people downloading your configuration.'),
537 $cfgRelation = PMA_getRelationsParam();
538 if (! $cfgRelation['allworks']
539 && $cfg['PmaNoRelation_DisableWarning'] == false
542 'The phpMyAdmin configuration storage is not completely '
543 . 'configured, some extended features have been deactivated. '
544 . '%sFind out why%s. '
546 if ($cfg['ZeroConf'] == true) {
547 $msg_text .= '<br> ' .
549 'Or alternately go to \'Operations\' tab of any database '
550 . 'to set it up there.'
553 $msg = PMA_Message
::notice($msg_text);
555 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php'
556 . $common_url_query . '">',
559 $msg->addParam('</a>', false);
560 /* Show error if user has configured something, notice elsewhere */
561 if (!empty($cfg['Servers'][$server]['pmadb'])) {
569 * Warning about different MySQL library and server version
570 * (a difference on the third digit does not count).
571 * If someday there is a constant that we can check about mysqlnd,
572 * we can use it instead of strpos().
573 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
574 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
576 * We also do not warn if MariaDB is detected, as it has its own version
579 if (isset($GLOBALS['dbi'])
581 && $cfg['ServerLibraryDifference_DisableWarning'] == false
583 /** @var PMA_String $pmaString */
584 $pmaString = $GLOBALS['PMA_String'];
586 $_client_info = $GLOBALS['dbi']->getClientInfo();
588 && /*overload*/mb_strpos($_client_info, 'mysqlnd') === false
589 && /*overload*/mb_strpos(PMA_MYSQL_STR_VERSION
, 'MariaDB') === false
590 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(
591 PMA_MYSQL_INT_VERSION
, 0, 3
597 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
600 PMA_MYSQL_STR_VERSION
,
602 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
609 unset($_client_info);
613 * Warning about Suhosin only if its simulation mode is not enabled
615 if ($cfg['SuhosinDisableWarning'] == false
616 && @ini_get
('suhosin.request.max_value_length')
617 && @ini_get
('suhosin.simulation') == '0'
621 __('Server running with Suhosin. Please refer to %sdocumentation%s 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@http://www.phpmyadmin.net/home_page/improve.php'
647 . '#translate@_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 '<li id="' . $listId . '"';
673 if (null !== $class) {
674 echo ' class="' . $class . '"';
678 echo '<a href="' . $url . '"';
679 if (null !== $target) {
680 echo ' target="' . $target . '"';
683 echo ' id="' . $a_id . '"';
685 if (null != $a_class) {
686 echo ' class="' . $a_class . '"';
696 if (null !== $mysql_help_page) {
697 echo PMA_Util
::showMySQLDocu($mysql_help_page);