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'])) {
60 * Check if it is an ajax request to reload the recent tables list.
62 require_once 'libraries/RecentFavoriteTable.class.php';
63 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
64 $response = PMA_Response
::getInstance();
67 PMA_RecentFavoriteTable
::getInstance('recent')->getHtmlList()
72 if ($GLOBALS['PMA_Config']->isGitRevision()) {
73 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
74 PMA_printGitRevision();
77 echo '<div id="is_git_revision"></div>';
80 // Handles some variables that may have been sent by the calling script
82 $GLOBALS['table'] = '';
85 // Any message to display?
86 if (! empty($message)) {
87 echo PMA_Util
::getMessage($message);
91 $common_url_query = PMA_URL_getCommon('', '');
92 $mysql_cur_user_and_host = '';
94 // when $server > 0, a server has been chosen so we can display
95 // all MySQL-related information
97 include 'libraries/server_common.inc.php';
98 include 'libraries/StorageEngine.class.php';
100 // Use the verbose name of the server instead of the hostname
103 if (! empty($cfg['Server']['verbose'])) {
104 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
105 if ($GLOBALS['cfg']['ShowServerInfo']) {
106 $server_info .= ' (';
109 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
110 $server_info .= $GLOBALS['dbi']->getHostInfo();
112 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
115 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
117 // should we add the port info here?
118 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
119 ?
$GLOBALS['cfg']['Server']['verbose']
120 : $GLOBALS['cfg']['Server']['host']);
123 echo '<div id="maincontainer">' . "\n";
124 // Anchor for favorite tables synchronization.
125 echo PMA_RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
126 echo '<div id="main_pane_left">';
127 if ($server > 0 ||
count($cfg['Servers']) > 1
129 if ($cfg['DBG']['demo']) {
130 echo '<div class="group">';
131 echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
132 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
135 'You are using the demo server. You can do anything here, but '
136 . 'please do not change root, debian-sys-maint and pma users. '
137 . 'More information is available at %s.'
139 '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
144 echo '<div class="group">';
145 echo '<h2>' . __('General Settings') . '</h2>';
149 * Displays the MySQL servers choice form
151 if ($cfg['ServerDefault'] == 0
152 ||
(! $cfg['NavigationDisplayServers']
153 && (count($cfg['Servers']) > 1
154 ||
($server == 0 && count($cfg['Servers']) == 1)))
156 echo '<li id="li_select_server" class="no_bullets" >';
157 include_once 'libraries/select_server.lib.php';
158 echo PMA_Util
::getImage('s_host.png') . " " . PMA_selectServer(true, true);
163 * Displays the mysql server related links
165 if ($server > 0 && ! PMA_DRIZZLE
) {
166 include_once 'libraries/check_user_privileges.lib.php';
168 // Logout for advanced authentication
169 if ($cfg['Server']['auth_type'] != 'config') {
170 if ($cfg['ShowChgPassword']) {
171 $conditional_class = 'ajax';
173 PMA_Util
::getImage('s_passwd.png') . " " . __('Change password'),
174 'li_change_password',
175 'user_password.php?' . $common_url_query,
178 'change_password_anchor',
184 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
185 echo ' <form method="post" action="index.php">' . "\n"
186 . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
187 . ' <label for="select_collation_connection">' . "\n"
188 . ' ' . PMA_Util
::getImage('s_asci.png') . " "
189 . __('Server connection collation') . "\n"
190 // put the doc link in the form so that it appears on the same line
191 . PMA_Util
::showMySQLDocu('Charset-connection')
195 . PMA_generateCharsetDropdownBox(
196 PMA_CSDROPDOWN_COLLATION
,
197 'collation_connection',
198 'select_collation_connection',
199 $collation_connection,
205 } // end of if ($server > 0 && !PMA_DRIZZLE)
210 echo '<div class="group">';
211 echo '<h2>' . __('Appearance Settings') . '</h2>';
214 // Displays language selection combo
215 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
216 echo '<li id="li_select_lang" class="no_bullets">';
217 include_once 'libraries/display_select_lang.lib.php';
218 echo PMA_Util
::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
222 // ThemeManager if available
224 if ($GLOBALS['cfg']['ThemeManager']) {
225 echo '<li id="li_select_theme" class="no_bullets">';
226 echo PMA_Util
::getImage('s_theme.png') . " "
227 . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
230 echo '<li id="li_select_fontsize">';
231 echo PMA_Config
::getFontsizeForm();
241 PMA_Util
::getImage('b_tblops.png') . " " . __('More settings'),
242 'li_user_preferences',
243 'prefs_manage.php?' . $common_url_query,
256 echo '<div id="main_pane_right">';
259 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
261 echo '<div class="group">';
262 echo '<h2>' . __('Database server') . '</h2>';
265 __('Server:') . ' ' . $server_info,
269 __('Server type:') . ' ' . PMA_Util
::getServerType(),
273 __('Server version:')
275 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
279 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
283 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
287 echo ' <li id="li_select_mysql_charset">';
288 echo ' ' . __('Server charset:') . ' '
289 . ' <span lang="en" dir="ltr">';
292 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
294 echo ' (' . $mysql_charset_map['utf-8'] . ')'
301 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
302 echo '<div class="group">';
303 echo '<h2>' . __('Web server') . '</h2>';
305 if ($GLOBALS['cfg']['ShowServerInfo']) {
306 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
309 $client_version_str = $GLOBALS['dbi']->getClientInfo();
310 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
311 $client_version_str = 'libmysql - ' . $client_version_str;
314 __('Database client version:') . ' ' . $client_version_str,
315 'li_mysql_client_version'
318 $php_ext_string = __('PHP extension:') . ' ';
319 if (PMA_DatabaseInterface
::checkDbExtension('mysqli')) {
320 $extension = 'mysqli';
322 $extension = 'mysql';
324 $php_ext_string .= $extension . ' '
325 . PMA_Util
::showPHPDocu('book.' . $extension . '.php');
329 'li_used_php_extension'
334 if ($cfg['ShowPhpInfo']) {
336 __('Show PHP information'),
338 'phpinfo.php?' . $common_url_query,
347 echo '<div class="group pmagroup">';
348 echo '<h2>phpMyAdmin</h2>';
351 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
352 // support here and does not allow request to http once using https.
353 if ($GLOBALS['cfg']['VersionCheck']
354 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT
!= 'IE')
356 $class = 'jsversioncheck';
359 __('Version information:') . ' ' . PMA_VERSION
,
370 PMA_Util
::getDocuLink('index'),
377 PMA_linkURL('http://wiki.phpmyadmin.net/'),
382 // does not work if no target specified, don't know why
384 __('Official Homepage'),
386 PMA_linkURL('http://www.phpMyAdmin.net/'),
393 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
400 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
405 __('List of changes'),
407 PMA_linkURL('changelog.php'),
419 * Warning if using the default MySQL privileged account
422 && $cfg['Server']['user'] == 'root'
423 && $cfg['Server']['password'] == ''
427 'Your configuration file contains settings (root with no password)'
428 . ' that correspond to the default MySQL privileged account.'
429 . ' Your MySQL server is running with this default, is open to'
430 . ' intrusion, and you really should fix this security hole by'
431 . ' setting a password for user \'root\'.'
438 * As we try to handle charsets by ourself, mbstring overloads just
439 * break it, see bug 1063821.
441 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
444 'You have enabled mbstring.func_overload in your PHP '
445 . 'configuration. This option is incompatible with phpMyAdmin '
446 . 'and might cause some data to be corrupted!'
453 * mbstring is used for handling multibyte inside parser, so it is good
454 * to tell user something might be broken without it, see bug #1063149.
456 if (! @extension_loaded
('mbstring')) {
459 'The mbstring PHP extension was not found and you seem to be using'
460 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
461 . ' is unable to split strings correctly and it may result in'
462 . ' unexpected results.'
469 * Check whether session.gc_maxlifetime limits session validity.
471 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
472 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
474 __('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 will expire sooner than configured in phpMyAdmin.'),
480 * Check whether LoginCookieValidity is limited by LoginCookieStore.
482 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
483 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
486 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
492 * Check if user does not have defined blowfish secret and it is being used.
494 if (! empty($_SESSION['encryption_key'])
495 && empty($GLOBALS['cfg']['blowfish_secret'])
498 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
504 * Check for existence of config directory which should not exist in
505 * production environment.
507 if (file_exists('config')) {
509 __('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.'),
515 $cfgRelation = PMA_getRelationsParam();
516 if (! $cfgRelation['allworks']
517 && $cfg['PmaNoRelation_DisableWarning'] == false
520 'The phpMyAdmin configuration storage is not completely '
521 . 'configured, some extended features have been deactivated. '
522 . '%sFind out why%s. '
524 if ($cfg['ZeroConf'] == true) {
526 '<br> '
527 . 'Or alternately go to \'Operations\' tab of any database '
528 . 'to set it up there.'
531 $msg = PMA_Message
::notice($msg_text);
533 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
534 . $common_url_query . '">',
537 $msg->addParam('</a>', false);
538 /* Show error if user has configured something, notice elsewhere */
539 if (!empty($cfg['Servers'][$server]['pmadb'])) {
547 * Warning about different MySQL library and server version
548 * (a difference on the third digit does not count).
549 * If someday there is a constant that we can check about mysqlnd,
550 * we can use it instead of strpos().
551 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
552 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
555 if (isset($GLOBALS['dbi'])
557 && $cfg['ServerLibraryDifference_DisableWarning'] == false
559 /** @var PMA_String $pmaString */
560 $pmaString = $GLOBALS['PMA_String'];
562 $_client_info = $GLOBALS['dbi']->getClientInfo();
564 && $pmaString->strpos($_client_info, 'mysqlnd') === false
565 && $pmaString->substr(PMA_MYSQL_CLIENT_API
, 0, 3) != $pmaString->substr(
566 PMA_MYSQL_INT_VERSION
, 0, 3
572 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
575 PMA_MYSQL_STR_VERSION
,
577 $pmaString->strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
584 unset($_client_info);
588 * Warning about Suhosin only if its simulation mode is not enabled
590 if ($cfg['SuhosinDisableWarning'] == false
591 && @ini_get
('suhosin.request.max_value_length')
592 && @ini_get
('suhosin.simulation') == '0'
596 __('Server running with Suhosin. Please refer to %sdocumentation%s 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@http://www.phpmyadmin.net/home_page/improve.php'
622 . '#translate@_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 '<li id="' . $listId . '"';
648 if (null !== $class) {
649 echo ' class="' . $class . '"';
653 echo '<a href="' . $url . '"';
654 if (null !== $target) {
655 echo ' target="' . $target . '"';
658 echo ' id="' . $a_id . '"';
660 if (null != $a_class) {
661 echo ' class="' . $a_class . '"';
671 if (null !== $mysql_help_page) {
672 echo PMA_Util
::showMySQLDocu($mysql_help_page);