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'];
57 if (! empty($_REQUEST['db'])) {
59 if (! empty($_REQUEST['table'])) {
60 $page = $GLOBALS['cfg']['DefaultTabTable'];
62 $page = $GLOBALS['cfg']['DefaultTabDatabase'];
69 * Check if it is an ajax request to reload the recent tables list.
71 require_once 'libraries/RecentFavoriteTable.class.php';
72 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
73 $response = PMA_Response
::getInstance();
76 PMA_RecentFavoriteTable
::getInstance('recent')->getHtmlList()
81 if ($GLOBALS['PMA_Config']->isGitRevision()) {
82 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
83 PMA_printGitRevision();
86 echo '<div id="is_git_revision"></div>';
89 // Handles some variables that may have been sent by the calling script
91 $GLOBALS['table'] = '';
94 // Any message to display?
95 if (! empty($message)) {
96 echo PMA_Util
::getMessage($message);
100 $common_url_query = PMA_URL_getCommon('', '');
102 // when $server > 0, a server has been chosen so we can display
103 // all MySQL-related information
105 include 'libraries/server_common.inc.php';
106 include 'libraries/StorageEngine.class.php';
108 // Use the verbose name of the server instead of the hostname
111 if (! empty($cfg['Server']['verbose'])) {
112 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
113 if ($GLOBALS['cfg']['ShowServerInfo']) {
114 $server_info .= ' (';
117 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
118 $server_info .= $GLOBALS['dbi']->getHostInfo();
120 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
123 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
125 // should we add the port info here?
126 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
127 ?
$GLOBALS['cfg']['Server']['verbose']
128 : $GLOBALS['cfg']['Server']['host']);
131 echo '<div id="maincontainer">' . "\n";
132 // Anchor for favorite tables synchronization.
133 echo PMA_RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
134 echo '<div id="main_pane_left">';
135 if ($server > 0 ||
count($cfg['Servers']) > 1
137 if ($cfg['DBG']['demo']) {
138 echo '<div class="group">';
139 echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
140 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
143 'You are using the demo server. You can do anything here, but '
144 . 'please do not change root, debian-sys-maint and pma users. '
145 . 'More information is available at %s.'
147 '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
152 echo '<div class="group">';
153 echo '<h2>' . __('General Settings') . '</h2>';
157 * Displays the MySQL servers choice form
159 if ($cfg['ServerDefault'] == 0
160 ||
(! $cfg['NavigationDisplayServers']
161 && (count($cfg['Servers']) > 1
162 ||
($server == 0 && count($cfg['Servers']) == 1)))
164 echo '<li id="li_select_server" class="no_bullets" >';
165 include_once 'libraries/select_server.lib.php';
166 echo PMA_Util
::getImage('s_host.png') . " " . PMA_selectServer(true, true);
171 * Displays the mysql server related links
173 if ($server > 0 && ! PMA_DRIZZLE
) {
174 include_once 'libraries/check_user_privileges.lib.php';
176 // Logout for advanced authentication
177 if ($cfg['Server']['auth_type'] != 'config') {
178 if ($cfg['ShowChgPassword']) {
179 $conditional_class = 'ajax';
181 PMA_Util
::getImage('s_passwd.png') . " " . __('Change password'),
182 'li_change_password',
183 'user_password.php?' . $common_url_query,
186 'change_password_anchor',
192 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
193 echo ' <form method="post" action="index.php">' . "\n"
194 . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
195 . ' <label for="select_collation_connection">' . "\n"
196 . ' ' . PMA_Util
::getImage('s_asci.png') . " "
197 . __('Server connection collation') . "\n"
198 // put the doc link in the form so that it appears on the same line
199 . PMA_Util
::showMySQLDocu('Charset-connection')
203 . PMA_generateCharsetDropdownBox(
204 PMA_CSDROPDOWN_COLLATION
,
205 'collation_connection',
206 'select_collation_connection',
207 $collation_connection,
214 } // end of if ($server > 0 && !PMA_DRIZZLE)
219 echo '<div class="group">';
220 echo '<h2>' . __('Appearance Settings') . '</h2>';
223 // Displays language selection combo
224 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
225 echo '<li id="li_select_lang" class="no_bullets">';
226 include_once 'libraries/display_select_lang.lib.php';
227 echo PMA_Util
::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
231 // ThemeManager if available
233 if ($GLOBALS['cfg']['ThemeManager']) {
234 echo '<li id="li_select_theme" class="no_bullets">';
235 echo PMA_Util
::getImage('s_theme.png') . " "
236 . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
239 echo '<li id="li_select_fontsize">';
240 echo PMA_Config
::getFontsizeForm();
250 PMA_Util
::getImage('b_tblops.png') . " " . __('More settings'),
251 'li_user_preferences',
252 'prefs_manage.php?' . $common_url_query,
265 echo '<div id="main_pane_right">';
268 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
270 echo '<div class="group">';
271 echo '<h2>' . __('Database server') . '</h2>';
274 __('Server:') . ' ' . $server_info,
278 __('Server type:') . ' ' . PMA_Util
::getServerType(),
282 __('Server version:')
284 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
288 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
292 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
296 echo ' <li id="li_select_mysql_charset">';
297 echo ' ' . __('Server charset:') . ' '
298 . ' <span lang="en" dir="ltr">';
301 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
303 echo ' (' . $mysql_charset_map['utf-8'] . ')'
310 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
311 echo '<div class="group">';
312 echo '<h2>' . __('Web server') . '</h2>';
314 if ($GLOBALS['cfg']['ShowServerInfo']) {
315 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
318 $client_version_str = $GLOBALS['dbi']->getClientInfo();
319 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
320 $client_version_str = 'libmysql - ' . $client_version_str;
323 __('Database client version:') . ' ' . $client_version_str,
324 'li_mysql_client_version'
327 $php_ext_string = __('PHP extension:') . ' ';
328 if (PMA_DatabaseInterface
::checkDbExtension('mysqli')) {
329 $extension = 'mysqli';
331 $extension = 'mysql';
333 $php_ext_string .= $extension . ' '
334 . PMA_Util
::showPHPDocu('book.' . $extension . '.php');
338 'li_used_php_extension'
343 if ($cfg['ShowPhpInfo']) {
345 __('Show PHP information'),
347 'phpinfo.php?' . $common_url_query,
356 echo '<div class="group pmagroup">';
357 echo '<h2>phpMyAdmin</h2>';
360 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
361 // support here and does not allow request to http once using https.
362 if ($GLOBALS['cfg']['VersionCheck']
363 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT
!= 'IE')
365 $class = 'jsversioncheck';
368 __('Version information:') . ' ' . PMA_VERSION
,
379 PMA_Util
::getDocuLink('index'),
386 PMA_linkURL('http://wiki.phpmyadmin.net/'),
391 // does not work if no target specified, don't know why
393 __('Official Homepage'),
395 PMA_linkURL('http://www.phpMyAdmin.net/'),
402 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
409 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
414 __('List of changes'),
416 PMA_linkURL('changelog.php'),
428 * Warning if using the default MySQL privileged account
431 && $cfg['Server']['user'] == 'root'
432 && $cfg['Server']['password'] == ''
436 'Your configuration file contains settings (root with no password)'
437 . ' that correspond to the default MySQL privileged account.'
438 . ' Your MySQL server is running with this default, is open to'
439 . ' intrusion, and you really should fix this security hole by'
440 . ' setting a password for user \'root\'.'
447 * As we try to handle charsets by ourself, mbstring overloads just
448 * break it, see bug 1063821.
450 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
453 'You have enabled mbstring.func_overload in your PHP '
454 . 'configuration. This option is incompatible with phpMyAdmin '
455 . 'and might cause some data to be corrupted!'
462 * mbstring is used for handling multibyte inside parser, so it is good
463 * to tell user something might be broken without it, see bug #1063149.
465 if (! @extension_loaded
('mbstring')) {
468 'The mbstring PHP extension was not found and you seem to be using'
469 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
470 . ' is unable to split strings correctly and it may result in'
471 . ' unexpected results.'
478 * Check whether session.gc_maxlifetime limits session validity.
480 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
481 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
483 __('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.'),
489 * Check whether LoginCookieValidity is limited by LoginCookieStore.
491 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
492 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
495 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
501 * Check if user does not have defined blowfish secret and it is being used.
503 if (! empty($_SESSION['auto_blowfish_secret'])
504 && empty($GLOBALS['cfg']['blowfish_secret'])
507 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
513 * Check for existence of config directory which should not exist in
514 * production environment.
516 if (file_exists('config')) {
518 __('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.'),
524 $cfgRelation = PMA_getRelationsParam();
525 if (! $cfgRelation['allworks']
526 && $cfg['PmaNoRelation_DisableWarning'] == false
528 $msg = PMA_Message
::notice(__('The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click %shere%s.'));
530 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
531 . $common_url_query . '">',
534 $msg->addParam('</a>', false);
535 /* Show error if user has configured something, notice elsewhere */
536 if (!empty($cfg['Servers'][$server]['pmadb'])) {
544 * Warning about different MySQL library and server version
545 * (a difference on the third digit does not count).
546 * If someday there is a constant that we can check about mysqlnd,
547 * we can use it instead of strpos().
548 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
549 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
552 if (isset($GLOBALS['dbi'])
554 && $cfg['ServerLibraryDifference_DisableWarning'] == false
556 $_client_info = $GLOBALS['dbi']->getClientInfo();
558 && strpos($_client_info, 'mysqlnd') === false
559 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(PMA_MYSQL_INT_VERSION
, 0, 3)
564 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
567 PMA_MYSQL_STR_VERSION
,
569 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
576 unset($_client_info);
580 * Warning about Suhosin only if its simulation mode is not enabled
582 if ($cfg['SuhosinDisableWarning'] == false
583 && @ini_get
('suhosin.request.max_value_length')
584 && @ini_get
('suhosin.simulation') == '0'
588 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
597 * Warning about incomplete translations.
599 * The data file is created while creating release by ./scripts/remove-incomplete-mo
601 if (file_exists('libraries/language_stats.inc.php')) {
602 include 'libraries/language_stats.inc.php';
604 * This message is intentionally not translated, because we're
605 * handling incomplete translations here and focus on english
608 if (isset($GLOBALS['language_stats'][$lang])
609 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
612 'You are using an incomplete translation, please help to make it '
613 . 'better by [a@http://www.phpmyadmin.net/home_page/improve.php'
614 . '#translate@_blank]contributing[/a].',
621 * prints list item for main page
623 * @param string $name displayed text
624 * @param string $listId id, used for css styles
625 * @param string $url make item as link with $url as target
626 * @param string $mysql_help_page display a link to MySQL's manual
627 * @param string $target special target for $url
628 * @param string $a_id id for the anchor,
629 * used for jQuery to hook in functions
630 * @param string $class class for the li element
631 * @param string $a_class class for the anchor element
635 function PMA_printListItem($name, $listId = null, $url = null,
636 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
639 echo '<li id="' . $listId . '"';
640 if (null !== $class) {
641 echo ' class="' . $class . '"';
645 echo '<a href="' . $url . '"';
646 if (null !== $target) {
647 echo ' target="' . $target . '"';
650 echo ' id="' . $a_id . '"';
652 if (null != $a_class) {
653 echo ' class="' . $a_class . '"';
663 if (null !== $mysql_help_page) {
664 echo PMA_Util
::showMySQLDocu($mysql_help_page);