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 * Check if it is an ajax request to reload the recent tables list.
59 require_once 'libraries/RecentFavoriteTable.class.php';
60 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
61 $response = PMA_Response
::getInstance();
64 PMA_RecentFavoriteTable
::getInstance('recent')->getHtmlList()
69 if ($GLOBALS['PMA_Config']->isGitRevision()) {
70 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
71 PMA_printGitRevision();
74 echo '<div id="is_git_revision"></div>';
77 // Handles some variables that may have been sent by the calling script
79 $GLOBALS['table'] = '';
82 // Any message to display?
83 if (! empty($message)) {
84 echo PMA_Util
::getMessage($message);
88 $common_url_query = PMA_URL_getCommon('', '');
90 // when $server > 0, a server has been chosen so we can display
91 // all MySQL-related information
93 include 'libraries/server_common.inc.php';
94 include 'libraries/StorageEngine.class.php';
96 // Use the verbose name of the server instead of the hostname
99 if (! empty($cfg['Server']['verbose'])) {
100 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
101 if ($GLOBALS['cfg']['ShowServerInfo']) {
102 $server_info .= ' (';
105 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
106 $server_info .= $GLOBALS['dbi']->getHostInfo();
108 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
111 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
113 // should we add the port info here?
114 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
115 ?
$GLOBALS['cfg']['Server']['verbose']
116 : $GLOBALS['cfg']['Server']['host']);
119 echo '<div id="maincontainer">' . "\n";
120 // Anchor for favorite tables synchronization.
121 echo PMA_RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
122 echo '<div id="main_pane_left">';
123 if ($server > 0 ||
count($cfg['Servers']) > 1
125 if ($cfg['DBG']['demo']) {
126 echo '<div class="group">';
127 echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
128 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
131 'You are using the demo server. You can do anything here, but '
132 . 'please do not change root, debian-sys-maint and pma users. '
133 . 'More information is available at %s.'
135 '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>'
140 echo '<div class="group">';
141 echo '<h2>' . __('General Settings') . '</h2>';
145 * Displays the MySQL servers choice form
147 if ($cfg['ServerDefault'] == 0
148 ||
(! $cfg['NavigationDisplayServers']
149 && (count($cfg['Servers']) > 1
150 ||
($server == 0 && count($cfg['Servers']) == 1)))
152 echo '<li id="li_select_server" class="no_bullets" >';
153 include_once 'libraries/select_server.lib.php';
154 echo PMA_Util
::getImage('s_host.png') . " " . PMA_selectServer(true, true);
159 * Displays the mysql server related links
161 if ($server > 0 && ! PMA_DRIZZLE
) {
162 include_once 'libraries/check_user_privileges.lib.php';
164 // Logout for advanced authentication
165 if ($cfg['Server']['auth_type'] != 'config') {
166 if ($cfg['ShowChgPassword']) {
167 $conditional_class = 'ajax';
169 PMA_Util
::getImage('s_passwd.png') . " " . __('Change password'),
170 'li_change_password',
171 'user_password.php?' . $common_url_query,
174 'change_password_anchor',
180 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
181 echo ' <form method="post" action="index.php">' . "\n"
182 . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection')
183 . ' <label for="select_collation_connection">' . "\n"
184 . ' ' . PMA_Util
::getImage('s_asci.png') . " "
185 . __('Server connection collation') . "\n"
186 // put the doc link in the form so that it appears on the same line
187 . PMA_Util
::showMySQLDocu('Charset-connection')
191 . PMA_generateCharsetDropdownBox(
192 PMA_CSDROPDOWN_COLLATION
,
193 'collation_connection',
194 'select_collation_connection',
195 $collation_connection,
202 } // end of if ($server > 0 && !PMA_DRIZZLE)
207 echo '<div class="group">';
208 echo '<h2>' . __('Appearance Settings') . '</h2>';
211 // Displays language selection combo
212 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
213 echo '<li id="li_select_lang" class="no_bullets">';
214 include_once 'libraries/display_select_lang.lib.php';
215 echo PMA_Util
::getImage('s_lang.png') . " " . PMA_getLanguageSelectorHtml();
219 // ThemeManager if available
221 if ($GLOBALS['cfg']['ThemeManager']) {
222 echo '<li id="li_select_theme" class="no_bullets">';
223 echo PMA_Util
::getImage('s_theme.png') . " "
224 . $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
227 echo '<li id="li_select_fontsize">';
228 echo PMA_Config
::getFontsizeForm();
238 PMA_Util
::getImage('b_tblops.png') . " " . __('More settings'),
239 'li_user_preferences',
240 'prefs_manage.php?' . $common_url_query,
253 echo '<div id="main_pane_right">';
256 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
258 echo '<div class="group">';
259 echo '<h2>' . __('Database server') . '</h2>';
262 __('Server:') . ' ' . $server_info,
266 __('Server type:') . ' ' . PMA_Util
::getServerType(),
270 __('Server version:')
272 . PMA_MYSQL_STR_VERSION
. ' - ' . PMA_MYSQL_VERSION_COMMENT
,
276 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
280 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
284 echo ' <li id="li_select_mysql_charset">';
285 echo ' ' . __('Server charset:') . ' '
286 . ' <span lang="en" dir="ltr">';
289 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
291 echo ' (' . $mysql_charset_map['utf-8'] . ')'
298 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
299 echo '<div class="group">';
300 echo '<h2>' . __('Web server') . '</h2>';
302 if ($GLOBALS['cfg']['ShowServerInfo']) {
303 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
306 $client_version_str = $GLOBALS['dbi']->getClientInfo();
307 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
308 $client_version_str = 'libmysql - ' . $client_version_str;
311 __('Database client version:') . ' ' . $client_version_str,
312 'li_mysql_client_version'
315 $php_ext_string = __('PHP extension:') . ' ';
316 if (PMA_DatabaseInterface
::checkDbExtension('mysqli')) {
317 $extension = 'mysqli';
319 $extension = 'mysql';
321 $php_ext_string .= $extension . ' '
322 . PMA_Util
::showPHPDocu('book.' . $extension . '.php');
326 'li_used_php_extension'
331 if ($cfg['ShowPhpInfo']) {
333 __('Show PHP information'),
335 'phpinfo.php?' . $common_url_query,
344 echo '<div class="group pmagroup">';
345 echo '<h2>phpMyAdmin</h2>';
348 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
349 // support here and does not allow request to http once using https.
350 if ($GLOBALS['cfg']['VersionCheck']
351 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT
!= 'IE')
353 $class = 'jsversioncheck';
356 __('Version information:') . ' ' . PMA_VERSION
,
367 PMA_Util
::getDocuLink('index'),
374 PMA_linkURL('http://wiki.phpmyadmin.net/'),
379 // does not work if no target specified, don't know why
381 __('Official Homepage'),
383 PMA_linkURL('http://www.phpMyAdmin.net/'),
390 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
397 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
402 __('List of changes'),
404 PMA_linkURL('changelog.php'),
416 * Warning if using the default MySQL privileged account
419 && $cfg['Server']['user'] == 'root'
420 && $cfg['Server']['password'] == ''
424 'Your configuration file contains settings (root with no password)'
425 . ' that correspond to the default MySQL privileged account.'
426 . ' Your MySQL server is running with this default, is open to'
427 . ' intrusion, and you really should fix this security hole by'
428 . ' setting a password for user \'root\'.'
435 * As we try to handle charsets by ourself, mbstring overloads just
436 * break it, see bug 1063821.
438 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
441 'You have enabled mbstring.func_overload in your PHP '
442 . 'configuration. This option is incompatible with phpMyAdmin '
443 . 'and might cause some data to be corrupted!'
450 * mbstring is used for handling multibyte inside parser, so it is good
451 * to tell user something might be broken without it, see bug #1063149.
453 if (! @extension_loaded
('mbstring')) {
456 'The mbstring PHP extension was not found and you seem to be using'
457 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
458 . ' is unable to split strings correctly and it may result in'
459 . ' unexpected results.'
466 * Check whether session.gc_maxlifetime limits session validity.
468 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
469 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
471 __('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.'),
477 * Check whether LoginCookieValidity is limited by LoginCookieStore.
479 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
480 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
483 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
489 * Check if user does not have defined blowfish secret and it is being used.
491 if (! empty($_SESSION['auto_blowfish_secret'])
492 && empty($GLOBALS['cfg']['blowfish_secret'])
495 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
501 * Check for existence of config directory which should not exist in
502 * production environment.
504 if (file_exists('config')) {
506 __('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.'),
512 $cfgRelation = PMA_getRelationsParam();
513 if (! $cfgRelation['allworks']
514 && $cfg['PmaNoRelation_DisableWarning'] == false
516 $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.'));
518 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
519 . $common_url_query . '">',
522 $msg->addParam('</a>', false);
523 /* Show error if user has configured something, notice elsewhere */
524 if (!empty($cfg['Servers'][$server]['pmadb'])) {
532 * Warning about different MySQL library and server version
533 * (a difference on the third digit does not count).
534 * If someday there is a constant that we can check about mysqlnd,
535 * we can use it instead of strpos().
536 * If no default server is set, $GLOBALS['dbi'] is not defined yet.
537 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
540 if (isset($GLOBALS['dbi'])
542 && $cfg['ServerLibraryDifference_DisableWarning'] == false
544 $_client_info = $GLOBALS['dbi']->getClientInfo();
546 && strpos($_client_info, 'mysqlnd') === false
547 && substr(PMA_MYSQL_CLIENT_API
, 0, 3) != substr(PMA_MYSQL_INT_VERSION
, 0, 3)
552 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
555 PMA_MYSQL_STR_VERSION
,
557 strpos(PMA_MYSQL_STR_VERSION
. '-', '-')
564 unset($_client_info);
568 * Warning about Suhosin only if its simulation mode is not enabled
570 if ($cfg['SuhosinDisableWarning'] == false
571 && @ini_get
('suhosin.request.max_value_length')
572 && @ini_get
('suhosin.simulation') == '0'
576 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
585 * Warning about incomplete translations.
587 * The data file is created while creating release by ./scripts/remove-incomplete-mo
589 if (file_exists('libraries/language_stats.inc.php')) {
590 include 'libraries/language_stats.inc.php';
592 * This message is intentionally not translated, because we're
593 * handling incomplete translations here and focus on english
596 if (isset($GLOBALS['language_stats'][$lang])
597 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
600 'You are using an incomplete translation, please help to make it '
601 . 'better by [a@http://www.phpmyadmin.net/home_page/improve.php'
602 . '#translate@_blank]contributing[/a].',
609 * prints list item for main page
611 * @param string $name displayed text
612 * @param string $listId id, used for css styles
613 * @param string $url make item as link with $url as target
614 * @param string $mysql_help_page display a link to MySQL's manual
615 * @param string $target special target for $url
616 * @param string $a_id id for the anchor,
617 * used for jQuery to hook in functions
618 * @param string $class class for the li element
619 * @param string $a_class class for the anchor element
623 function PMA_printListItem($name, $listId = null, $url = null,
624 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
627 echo '<li id="' . $listId . '"';
628 if (null !== $class) {
629 echo ' class="' . $class . '"';
633 echo '<a href="' . $url . '"';
634 if (null !== $target) {
635 echo ' target="' . $target . '"';
638 echo ' id="' . $a_id . '"';
640 if (null != $a_class) {
641 echo ' class="' . $a_class . '"';
651 if (null !== $mysql_help_page) {
652 echo PMA_Util
::showMySQLDocu($mysql_help_page);