Translated using Weblate (Spanish)
[phpmyadmin.git] / index.php
blobcdf4ed3010994a9ba9fc585235bc27cf67c9e0b6
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /**
9 * Gets some core libraries and displays a top message if required
11 require_once 'libraries/common.inc.php';
13 /**
14 * display Git revision if requested
16 require_once 'libraries/display_git_revision.lib.php';
18 /**
19 * pass variables to child pages
21 $drops = array(
22 'lang',
23 'server',
24 'collation_connection',
25 'db',
26 'table'
28 foreach ($drops as $each_drop) {
29 if (array_key_exists($each_drop, $_GET)) {
30 unset($_GET[$each_drop]);
33 unset($drops, $each_drop);
35 // If we have a valid a valid target, lets load that script instead
36 if (! empty($_REQUEST['target'])
37 && is_string($_REQUEST['target'])
38 && ! preg_match('/^index/', $_REQUEST['target'])
39 && in_array($_REQUEST['target'], $goto_whitelist)
40 ) {
41 include $_REQUEST['target'];
42 exit;
45 /**
46 * Check if it is an ajax request to reload the recent tables list.
48 require_once 'libraries/RecentTable.class.php';
49 if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
50 $response = PMA_Response::getInstance();
51 $response->addJSON(
52 'options',
53 PMA_RecentTable::getInstance()->getHtmlSelectOption()
55 exit;
58 if ($GLOBALS['PMA_Config']->isGitRevision()) {
59 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
60 PMA_printGitRevision();
61 exit;
63 echo '<div id="is_git_revision"></div>';
66 // Handles some variables that may have been sent by the calling script
67 $GLOBALS['db'] = '';
68 $GLOBALS['table'] = '';
69 $show_query = '1';
71 // Any message to display?
72 if (! empty($message)) {
73 echo PMA_Util::getMessage($message);
74 unset($message);
77 $common_url_query = PMA_generate_common_url('', '');
79 // when $server > 0, a server has been chosen so we can display
80 // all MySQL-related information
81 if ($server > 0) {
82 include 'libraries/server_common.inc.php';
83 include 'libraries/StorageEngine.class.php';
85 // Use the verbose name of the server instead of the hostname
86 // if a value is set
87 $server_info = '';
88 if (! empty($cfg['Server']['verbose'])) {
89 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
90 if ($GLOBALS['cfg']['ShowServerInfo']) {
91 $server_info .= ' (';
94 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
95 $server_info .= PMA_DBI_get_host_info();
97 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
98 $server_info .= ')';
100 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
102 // should we add the port info here?
103 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
104 ? $GLOBALS['cfg']['Server']['verbose']
105 : $GLOBALS['cfg']['Server']['host']);
108 echo '<div id="maincontainer">' . "\n";
109 echo '<div id="main_pane_left">';
110 if ($server > 0
111 || (! $cfg['NavigationDisplayServers'] && count($cfg['Servers']) > 1)
113 echo '<div class="group">';
114 echo '<h2>' . __('General Settings') . '</h2>';
115 echo '<ul>';
118 * Displays the MySQL servers choice form
120 if (! $cfg['NavigationDisplayServers']
121 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)
123 echo '<li id="li_select_server">';
124 include_once 'libraries/select_server.lib.php';
125 echo PMA_selectServer(true, true);
126 echo '</li>';
130 * Displays the mysql server related links
132 if ($server > 0 && ! PMA_DRIZZLE) {
133 include_once 'libraries/check_user_privileges.lib.php';
135 // Logout for advanced authentication
136 if ($cfg['Server']['auth_type'] != 'config') {
137 if ($cfg['ShowChgPassword']) {
138 if ($GLOBALS['cfg']['AjaxEnable']) {
139 $conditional_class = 'ajax';
140 } else {
141 $conditional_class = null;
143 PMA_printListItem(
144 __('Change password'),
145 'li_change_password',
146 'user_password.php?' . $common_url_query,
147 null,
148 null,
149 'change_password_anchor',
150 null,
151 $conditional_class
154 } // end if
155 echo ' <li id="li_select_mysql_collation">';
156 echo ' <form method="post" action="index.php">' . "\n"
157 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
158 . ' <label for="select_collation_connection">' . "\n"
159 . ' ' . __('Server connection collation') . "\n"
160 // put the doc link in the form so that it appears on the same line
161 . PMA_Util::showMySQLDocu(
162 'MySQL_Database_Administration',
163 'Charset-connection'
165 . ': ' . "\n"
166 . ' </label>' . "\n"
168 . PMA_generateCharsetDropdownBox(
169 PMA_CSDROPDOWN_COLLATION,
170 'collation_connection',
171 'select_collation_connection',
172 $collation_connection,
173 true,
175 true
177 . ' </form>' . "\n"
178 . ' </li>' . "\n";
179 } // end of if ($server > 0 && !PMA_DRIZZLE)
180 echo '</ul>';
181 echo '</div>';
184 echo '<div class="group">';
185 echo '<h2>' . __('Appearance Settings') . '</h2>';
186 echo ' <ul>';
188 // Displays language selection combo
189 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
190 echo '<li id="li_select_lang">';
191 include_once 'libraries/display_select_lang.lib.php';
192 echo PMA_getLanguageSelectorHtml();
193 echo '</li>';
196 // ThemeManager if available
198 if ($GLOBALS['cfg']['ThemeManager']) {
199 echo '<li id="li_select_theme">';
200 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
201 echo '</li>';
203 echo '<li id="li_select_fontsize">';
204 echo PMA_Config::getFontsizeForm();
205 echo '</li>';
207 echo '</ul>';
209 // User preferences
211 if ($server > 0) {
212 echo '<ul>';
213 echo PMA_printListItem(
214 __('More settings'),
215 'li_user_preferences',
216 'prefs_manage.php?' . $common_url_query
218 echo '</ul>';
221 echo '</div>';
224 echo '</div>';
225 echo '<div id="main_pane_right">';
228 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
230 echo '<div class="group">';
231 echo '<h2>' . __('Database server') . '</h2>';
232 echo '<ul>' . "\n";
233 PMA_printListItem(
234 __('Server') . ': ' . $server_info,
235 'li_server_info'
237 PMA_printListItem(
238 __('Software') . ': ' . PMA_Util::getServerType(),
239 'li_server_type'
241 PMA_printListItem(
242 __('Software version') . ': ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
243 'li_server_version'
245 PMA_printListItem(
246 __('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
247 'li_mysql_proto'
249 PMA_printListItem(
250 __('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
251 'li_user_info'
254 echo ' <li id="li_select_mysql_charset">';
255 echo ' ' . __('Server charset') . ': '
256 . ' <span lang="en" dir="ltr">'
257 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']] . "\n"
258 . ' (' . $mysql_charset_map['utf-8'] . ')' . "\n"
259 . ' </span>' . "\n"
260 . ' </li>' . "\n";
261 echo ' </ul>';
262 echo ' </div>';
265 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
266 echo '<div class="group">';
267 echo '<h2>' . __('Web server') . '</h2>';
268 echo '<ul>';
269 if ($GLOBALS['cfg']['ShowServerInfo']) {
270 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
272 if ($server > 0) {
273 $client_version_str = PMA_DBI_get_client_info();
274 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
275 && in_array($GLOBALS['cfg']['Server']['extension'], array('mysql', 'mysqli'))
277 $client_version_str = 'libmysql - ' . $client_version_str;
279 PMA_printListItem(
280 __('Database client version') . ': ' . $client_version_str,
281 'li_mysql_client_version'
284 $php_ext_string = __('PHP extension') . ': '
285 . $GLOBALS['cfg']['Server']['extension'] . ' '
286 . PMA_Util::showPHPDocu(
287 'book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'
289 PMA_printListItem(
290 $php_ext_string,
291 'li_used_php_extension'
296 if ($cfg['ShowPhpInfo']) {
297 PMA_printListItem(
298 __('Show PHP information'),
299 'li_phpinfo',
300 'phpinfo.php?' . $common_url_query,
301 null,
302 '_blank'
305 echo ' </ul>';
306 echo ' </div>';
309 echo '<div class="group pmagroup">';
310 echo '<h2>phpMyAdmin</h2>';
311 echo '<ul>';
312 $class = null;
313 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
314 // support here and does not allow request to http once using https.
315 if ($GLOBALS['cfg']['VersionCheck']
316 && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')
318 $class = 'jsversioncheck';
320 PMA_printListItem(
321 __('Version information') . ': ' . PMA_VERSION,
322 'li_pma_version',
323 null,
324 null,
325 null,
326 null,
327 $class
329 PMA_printListItem(
330 __('Documentation'),
331 'li_pma_docs',
332 PMA_Util::getDocuLink('index'),
333 null,
334 '_blank'
336 PMA_printListItem(
337 __('Wiki'),
338 'li_pma_wiki',
339 PMA_linkURL('http://wiki.phpmyadmin.net/'),
340 null,
341 '_blank'
344 // does not work if no target specified, don't know why
345 PMA_printListItem(
346 __('Official Homepage'),
347 'li_pma_homepage',
348 PMA_linkURL('http://www.phpMyAdmin.net/'),
349 null,
350 '_blank'
352 PMA_printListItem(
353 __('Contribute'),
354 'li_pma_contribute',
355 PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'),
356 null,
357 '_blank'
359 PMA_printListItem(
360 __('Get support'),
361 'li_pma_support',
362 PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'),
363 null,
364 '_blank'
366 PMA_printListItem(
367 __('List of changes'),
368 'li_pma_changes',
369 PMA_linkURL('changelog.php'),
370 null,
371 '_blank'
374 </ul>
375 </div>
377 </div>
379 </div>
381 <?php
383 * Warning if using the default MySQL privileged account
385 if ($server != 0
386 && $cfg['Server']['user'] == 'root'
387 && $cfg['Server']['password'] == ''
389 trigger_error(
390 __('Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user \'root\'.'),
391 E_USER_WARNING
396 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
397 * break it, see bug 1063821.
399 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
400 trigger_error(
401 __('You have enabled mbstring.func_overload in your PHP configuration. This option is incompatible with phpMyAdmin and might cause some data to be corrupted!'),
402 E_USER_WARNING
407 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
408 * to tell user something might be broken without it, see bug #1063149.
410 if (! @extension_loaded('mbstring')) {
411 trigger_error(
412 __('The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.'),
413 E_USER_WARNING
418 * Check whether session.gc_maxlifetime limits session validity.
420 $gc_time = (int)@ini_get('session.gc_maxlifetime');
421 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
422 trigger_error(
423 __('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.'),
424 E_USER_WARNING
429 * Check whether LoginCookieValidity is limited by LoginCookieStore.
431 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
432 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
434 trigger_error(
435 __('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'),
436 E_USER_WARNING
441 * Check if user does not have defined blowfish secret and it is being used.
443 if (! empty($_SESSION['auto_blowfish_secret'])
444 && empty($GLOBALS['cfg']['blowfish_secret'])
446 trigger_error(
447 __('The configuration file now needs a secret passphrase (blowfish_secret).'),
448 E_USER_WARNING
453 * Check for existence of config directory which should not exist in
454 * production environment.
456 if (file_exists('config')) {
457 trigger_error(
458 __('Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'),
459 E_USER_WARNING
463 if ($server > 0) {
464 $cfgRelation = PMA_getRelationsParam();
465 if (! $cfgRelation['allworks']
466 && $cfg['PmaNoRelation_DisableWarning'] == false
468 $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.'));
469 $msg->addParam(
470 '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">',
471 false
473 $msg->addParam('</a>', false);
474 /* Show error if user has configured something, notice elsewhere */
475 if (!empty($cfg['Servers'][$server]['pmadb'])) {
476 $msg->isError(true);
478 $msg->display();
479 } // end if
483 * Warning about different MySQL library and server version
484 * (a difference on the third digit does not count).
485 * If someday there is a constant that we can check about mysqlnd,
486 * we can use it instead of strpos().
487 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
488 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for
489 * Drizzle servers.
491 if (function_exists('PMA_DBI_get_client_info') && !PMA_DRIZZLE) {
492 $_client_info = PMA_DBI_get_client_info();
493 if ($server > 0
494 && strpos($_client_info, 'mysqlnd') === false
495 && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)
497 trigger_error(
498 PMA_sanitize(
499 sprintf(
500 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
501 $_client_info,
502 substr(
503 PMA_MYSQL_STR_VERSION,
505 strpos(PMA_MYSQL_STR_VERSION . '-', '-')
509 E_USER_NOTICE
512 unset($_client_info);
516 * Warning about Suhosin
518 if ($cfg['SuhosinDisableWarning'] == false
519 && @ini_get('suhosin.request.max_value_length')
521 trigger_error(
522 sprintf(
523 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
524 '[doc@faq1-38]',
525 '[/doc]'
527 E_USER_WARNING
532 * Warning about mcrypt.
534 if (! function_exists('mcrypt_encrypt')
535 && ! $GLOBALS['cfg']['McryptDisableWarning']
537 PMA_warnMissingExtension('mcrypt');
541 * Warning about incomplete translations.
543 * The data file is created while creating release by ./scripts/remove-incomplete-mo
545 if (file_exists('libraries/language_stats.inc.php')) {
546 include 'libraries/language_stats.inc.php';
548 * This message is intentionally not translated, because we're
549 * handling incomplete translations here and focus on english
550 * speaking users.
552 if (isset($GLOBALS['language_stats'][$lang])
553 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
555 trigger_error(
556 'You are using an incomplete translation, please help to make it better by <a href="http://www.phpmyadmin.net/home_page/improve.php#translate" target="_blank">contributing</a>.',
557 E_USER_NOTICE
563 * prints list item for main page
565 * @param string $name displayed text
566 * @param string $id id, used for css styles
567 * @param string $url make item as link with $url as target
568 * @param string $mysql_help_page display a link to MySQL's manual
569 * @param string $target special target for $url
570 * @param string $a_id id for the anchor,
571 * used for jQuery to hook in functions
572 * @param string $class class for the li element
573 * @param string $a_class class for the anchor element
575 * @return void
577 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null,
578 $target = null, $a_id = null, $class = null, $a_class = null
580 echo '<li id="' . $id . '"';
581 if (null !== $class) {
582 echo ' class="' . $class . '"';
584 echo '>';
585 if (null !== $url) {
586 echo '<a href="' . $url . '"';
587 if (null !== $target) {
588 echo ' target="' . $target . '"';
590 if (null != $a_id) {
591 echo ' id="' . $a_id .'"';
593 if (null != $a_class) {
594 echo ' class="' . $a_class .'"';
596 echo '>';
599 echo $name;
601 if (null !== $url) {
602 echo '</a>' . "\n";
604 if (null !== $mysql_help_page) {
605 echo PMA_Util::showMySQLDocu('', $mysql_help_page);
607 echo '</li>';