added japanese language
[openemr.git] / phpmyadmin / index.php
bloba4889c2f25fc041230560404b1adc53fa2e04d2c
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Main loader script
6 * @package PhpMyAdmin
7 */
9 /**
10 * Gets some core libraries and displays a top message if required
12 require_once 'libraries/common.inc.php';
14 /**
15 * display Git revision if requested
17 require_once 'libraries/display_git_revision.lib.php';
19 /**
20 * pass variables to child pages
22 $drops = array(
23 'lang',
24 'server',
25 'collation_connection',
26 'db',
27 'table'
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)
51 ) {
52 include $_REQUEST['target'];
53 exit;
56 /**
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();
62 $response->addJSON(
63 'list',
64 PMA_RecentFavoriteTable::getInstance('recent')->getHtmlList()
66 exit;
69 if ($GLOBALS['PMA_Config']->isGitRevision()) {
70 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
71 PMA_printGitRevision();
72 exit;
74 echo '<div id="is_git_revision"></div>';
77 // Handles some variables that may have been sent by the calling script
78 $GLOBALS['db'] = '';
79 $GLOBALS['table'] = '';
80 $show_query = '1';
82 // Any message to display?
83 if (! empty($message)) {
84 echo PMA_Util::getMessage($message);
85 unset($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
92 if ($server > 0) {
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
97 // if a value is set
98 $server_info = '';
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']) {
109 $server_info .= ')';
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">';
129 printf(
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>'
137 echo '</p>';
138 echo '</div>';
140 echo '<div class="group">';
141 echo '<h2>' . __('General Settings') . '</h2>';
142 echo '<ul>';
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);
155 echo '</li>';
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';
168 PMA_printListItem(
169 PMA_Util::getImage('s_passwd.png') . " " . __('Change password'),
170 'li_change_password',
171 'user_password.php?' . $common_url_query,
172 null,
173 null,
174 'change_password_anchor',
175 "no_bullets",
176 $conditional_class
179 } // end if
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')
188 . ': ' . "\n"
189 . ' </label>' . "\n"
191 . PMA_generateCharsetDropdownBox(
192 PMA_CSDROPDOWN_COLLATION,
193 'collation_connection',
194 'select_collation_connection',
195 $collation_connection,
196 true,
198 true
200 . ' </form>' . "\n"
201 . ' </li>' . "\n";
202 } // end of if ($server > 0 && !PMA_DRIZZLE)
203 echo '</ul>';
204 echo '</div>';
207 echo '<div class="group">';
208 echo '<h2>' . __('Appearance Settings') . '</h2>';
209 echo ' <ul>';
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();
216 echo '</li>';
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();
225 echo '</li>';
227 echo '<li id="li_select_fontsize">';
228 echo PMA_Config::getFontsizeForm();
229 echo '</li>';
231 echo '</ul>';
233 // User preferences
235 if ($server > 0) {
236 echo '<ul>';
237 PMA_printListItem(
238 PMA_Util::getImage('b_tblops.png') . " " . __('More settings'),
239 'li_user_preferences',
240 'prefs_manage.php?' . $common_url_query,
241 null,
242 null,
243 null,
244 "no_bullets"
246 echo '</ul>';
249 echo '</div>';
252 echo '</div>';
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>';
260 echo '<ul>' . "\n";
261 PMA_printListItem(
262 __('Server:') . ' ' . $server_info,
263 'li_server_info'
265 PMA_printListItem(
266 __('Server type:') . ' ' . PMA_Util::getServerType(),
267 'li_server_type'
269 PMA_printListItem(
270 __('Server version:')
271 . ' '
272 . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
273 'li_server_version'
275 PMA_printListItem(
276 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
277 'li_mysql_proto'
279 PMA_printListItem(
280 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
281 'li_user_info'
284 echo ' <li id="li_select_mysql_charset">';
285 echo ' ' . __('Server charset:') . ' '
286 . ' <span lang="en" dir="ltr">';
287 if (! PMA_DRIZZLE) {
288 echo ' '
289 . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
291 echo ' (' . $mysql_charset_map['utf-8'] . ')'
292 . ' </span>'
293 . ' </li>'
294 . ' </ul>'
295 . ' </div>';
298 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
299 echo '<div class="group">';
300 echo '<h2>' . __('Web server') . '</h2>';
301 echo '<ul>';
302 if ($GLOBALS['cfg']['ShowServerInfo']) {
303 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
305 if ($server > 0) {
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;
310 PMA_printListItem(
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';
318 } else {
319 $extension = 'mysql';
321 $php_ext_string .= $extension . ' '
322 . PMA_Util::showPHPDocu('book.' . $extension . '.php');
324 PMA_printListItem(
325 $php_ext_string,
326 'li_used_php_extension'
331 if ($cfg['ShowPhpInfo']) {
332 PMA_printListItem(
333 __('Show PHP information'),
334 'li_phpinfo',
335 'phpinfo.php?' . $common_url_query,
336 null,
337 '_blank'
340 echo ' </ul>';
341 echo ' </div>';
344 echo '<div class="group pmagroup">';
345 echo '<h2>phpMyAdmin</h2>';
346 echo '<ul>';
347 $class = null;
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';
355 PMA_printListItem(
356 __('Version information:') . ' ' . PMA_VERSION,
357 'li_pma_version',
358 null,
359 null,
360 null,
361 null,
362 $class
364 PMA_printListItem(
365 __('Documentation'),
366 'li_pma_docs',
367 PMA_Util::getDocuLink('index'),
368 null,
369 '_blank'
371 PMA_printListItem(
372 __('Wiki'),
373 'li_pma_wiki',
374 PMA_linkURL('http://wiki.phpmyadmin.net/'),
375 null,
376 '_blank'
379 // does not work if no target specified, don't know why
380 PMA_printListItem(
381 __('Official Homepage'),
382 'li_pma_homepage',
383 PMA_linkURL('http://www.phpMyAdmin.net/'),
384 null,
385 '_blank'
387 PMA_printListItem(
388 __('Contribute'),
389 'li_pma_contribute',
390 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
391 null,
392 '_blank'
394 PMA_printListItem(
395 __('Get support'),
396 'li_pma_support',
397 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
398 null,
399 '_blank'
401 PMA_printListItem(
402 __('List of changes'),
403 'li_pma_changes',
404 PMA_linkURL('changelog.php'),
405 null,
406 '_blank'
408 echo ' </ul>';
409 echo ' </div>';
411 echo '</div>';
413 echo '</div>';
416 * Warning if using the default MySQL privileged account
418 if ($server != 0
419 && $cfg['Server']['user'] == 'root'
420 && $cfg['Server']['password'] == ''
422 trigger_error(
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\'.'
430 E_USER_WARNING
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) {
439 trigger_error(
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!'
445 E_USER_WARNING
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')) {
454 trigger_error(
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.'
461 E_USER_WARNING
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'] ) {
470 trigger_error(
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.'),
472 E_USER_WARNING
477 * Check whether LoginCookieValidity is limited by LoginCookieStore.
479 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
480 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
482 trigger_error(
483 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
484 E_USER_WARNING
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'])
494 trigger_error(
495 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
496 E_USER_WARNING
501 * Check for existence of config directory which should not exist in
502 * production environment.
504 if (file_exists('config')) {
505 trigger_error(
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.'),
507 E_USER_WARNING
511 if ($server > 0) {
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.'));
517 $msg->addParam(
518 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
519 . $common_url_query . '">',
520 false
522 $msg->addParam('</a>', false);
523 /* Show error if user has configured something, notice elsewhere */
524 if (!empty($cfg['Servers'][$server]['pmadb'])) {
525 $msg->isError(true);
527 $msg->display();
528 } // end if
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
538 * Drizzle servers.
540 if (isset($GLOBALS['dbi'])
541 && !PMA_DRIZZLE
542 && $cfg['ServerLibraryDifference_DisableWarning'] == false
544 $_client_info = $GLOBALS['dbi']->getClientInfo();
545 if ($server > 0
546 && strpos($_client_info, 'mysqlnd') === false
547 && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)
549 trigger_error(
550 PMA_sanitize(
551 sprintf(
552 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
553 $_client_info,
554 substr(
555 PMA_MYSQL_STR_VERSION,
557 strpos(PMA_MYSQL_STR_VERSION . '-', '-')
561 E_USER_NOTICE
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'
574 trigger_error(
575 sprintf(
576 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
577 '[doc@faq1-38]',
578 '[/doc]'
580 E_USER_WARNING
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
594 * speaking users.
596 if (isset($GLOBALS['language_stats'][$lang])
597 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
599 trigger_error(
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].',
603 E_USER_NOTICE
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
621 * @return void
623 function PMA_printListItem($name, $listId = null, $url = null,
624 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
625 $a_class = null
627 echo '<li id="' . $listId . '"';
628 if (null !== $class) {
629 echo ' class="' . $class . '"';
631 echo '>';
632 if (null !== $url) {
633 echo '<a href="' . $url . '"';
634 if (null !== $target) {
635 echo ' target="' . $target . '"';
637 if (null != $a_id) {
638 echo ' id="' . $a_id . '"';
640 if (null != $a_class) {
641 echo ' class="' . $a_class . '"';
643 echo '>';
646 echo $name;
648 if (null !== $url) {
649 echo '</a>' . "\n";
651 if (null !== $mysql_help_page) {
652 echo PMA_Util::showMySQLDocu($mysql_help_page);
654 echo '</li>';