2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 use PhpMyAdmin\Charsets
;
11 use PhpMyAdmin\LanguageManager
;
12 use PhpMyAdmin\Message
;
13 use PhpMyAdmin\RecentFavoriteTable
;
14 use PhpMyAdmin\Response
;
15 use PhpMyAdmin\Sanitize
;
16 use PhpMyAdmin\ThemeManager
;
20 * Gets some core libraries and displays a top message if required
22 require_once 'libraries/common.inc.php';
25 * display Git revision if requested
27 require_once 'libraries/display_git_revision.lib.php';
30 * pass variables to child pages
35 'collation_connection',
39 foreach ($drops as $each_drop) {
40 if (array_key_exists($each_drop, $_GET)) {
41 unset($_GET[$each_drop]);
44 unset($drops, $each_drop);
47 * Black list of all scripts to which front-end must submit data.
48 * Such scripts must not be loaded on home page.
51 $target_blacklist = array (
52 'import.php', 'export.php'
55 // If we have a valid target, let's load that script instead
56 if (! empty($_REQUEST['target'])
57 && is_string($_REQUEST['target'])
58 && ! preg_match('/^index/', $_REQUEST['target'])
59 && ! in_array($_REQUEST['target'], $target_blacklist)
60 && in_array($_REQUEST['target'], $goto_whitelist)
62 include $_REQUEST['target'];
66 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
71 if (! empty($_REQUEST['db'])) {
73 if (! empty($_REQUEST['table'])) {
74 $page = PhpMyAdmin\Util
::getScriptNameForOption(
75 $GLOBALS['cfg']['DefaultTabTable'], 'table'
78 $page = PhpMyAdmin\Util
::getScriptNameForOption(
79 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
86 $response = Response
::getInstance();
88 * Check if it is an ajax request to reload the recent tables list.
90 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
93 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
98 if ($GLOBALS['PMA_Config']->isGitRevision()) {
99 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
100 PMA_printGitRevision();
103 echo '<div id="is_git_revision"></div>';
106 // Handles some variables that may have been sent by the calling script
108 $GLOBALS['table'] = '';
111 // Any message to display?
112 if (! empty($message)) {
113 echo PhpMyAdmin\Util
::getMessage($message);
116 if (isset($_SESSION['partial_logout'])) {
118 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
120 unset($_SESSION['partial_logout']);
123 $common_url_query = Url
::getCommon();
124 $mysql_cur_user_and_host = '';
126 // when $server > 0, a server has been chosen so we can display
127 // all MySQL-related information
129 include 'libraries/server_common.inc.php';
131 // Use the verbose name of the server instead of the hostname
134 if (! empty($cfg['Server']['verbose'])) {
135 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
136 if ($GLOBALS['cfg']['ShowServerInfo']) {
137 $server_info .= ' (';
140 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
141 $server_info .= $GLOBALS['dbi']->getHostInfo();
143 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
146 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
148 // should we add the port info here?
149 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
150 ?
$GLOBALS['cfg']['Server']['verbose']
151 : $GLOBALS['cfg']['Server']['host']);
154 echo '<div id="maincontainer">' , "\n";
155 // Anchor for favorite tables synchronization.
156 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
157 echo '<div id="main_pane_left">';
158 if ($server > 0 ||
count($cfg['Servers']) > 1
160 if ($cfg['DBG']['demo']) {
161 echo '<div class="group">';
162 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
163 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
166 'You are using the demo server. You can do anything here, but '
167 . 'please do not change root, debian-sys-maint and pma users. '
168 . 'More information is available at %s.'
170 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
175 echo '<div class="group">';
176 echo '<h2>' , __('General settings') , '</h2>';
180 * Displays the MySQL servers choice form
182 if ($cfg['ServerDefault'] == 0
183 ||
(! $cfg['NavigationDisplayServers']
184 && (count($cfg['Servers']) > 1
185 ||
($server == 0 && count($cfg['Servers']) == 1)))
187 echo '<li id="li_select_server" class="no_bullets" >';
188 include_once 'libraries/select_server.lib.php';
189 echo PhpMyAdmin\Util
::getImage('s_host.png') , " "
190 , PMA_selectServer(true, true);
195 * Displays the mysql server related links
198 include_once 'libraries/check_user_privileges.lib.php';
200 // Logout for advanced authentication
201 if ($cfg['Server']['auth_type'] != 'config') {
202 if ($cfg['ShowChgPassword']) {
203 $conditional_class = 'ajax';
205 PhpMyAdmin\Util
::getImage('s_passwd.png') . " " . __(
208 'li_change_password',
209 'user_password.php' . $common_url_query,
212 'change_password_anchor',
218 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
219 echo ' <form method="post" action="index.php">' , "\n"
220 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
221 . ' <label for="select_collation_connection">' . "\n"
222 . ' ' . PhpMyAdmin\Util
::getImage('s_asci.png')
223 . " " . __('Server connection collation') . "\n"
224 // put the doc link in the form so that it appears on the same line
225 . PhpMyAdmin\Util
::showMySQLDocu('Charset-connection')
229 . Charsets
::getCollationDropdownBox(
230 'collation_connection',
231 'select_collation_connection',
232 $collation_connection,
238 } // end of if ($server > 0)
243 echo '<div class="group">';
244 echo '<h2>' , __('Appearance settings') , '</h2>';
247 // Displays language selection combo
248 $language_manager = LanguageManager
::getInstance();
249 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
250 echo '<li id="li_select_lang" class="no_bullets">';
252 echo PhpMyAdmin\Util
::getImage('s_lang.png') , " "
253 , $language_manager->getSelectorDisplay();
257 // ThemeManager if available
259 if ($GLOBALS['cfg']['ThemeManager']) {
260 echo '<li id="li_select_theme" class="no_bullets">';
261 echo PhpMyAdmin\Util
::getImage('s_theme.png') , " "
262 , ThemeManager
::getInstance()->getHtmlSelectBox();
265 echo '<li id="li_select_fontsize">';
266 echo PhpMyAdmin\Config
::getFontsizeForm();
276 PhpMyAdmin\Util
::getImage('b_tblops.png') . " " . __(
279 'li_user_preferences',
280 'prefs_manage.php' . $common_url_query,
293 echo '<div id="main_pane_right">';
296 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
298 echo '<div class="group">';
299 echo '<h2>' , __('Database server') , '</h2>';
302 __('Server:') . ' ' . $server_info,
306 __('Server type:') . ' ' . PhpMyAdmin\Util
::getServerType(),
310 __('Server connection:') . ' ' . PhpMyAdmin\Util
::getServerSSL(),
314 __('Server version:')
316 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
320 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
324 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
328 echo ' <li id="li_select_mysql_charset">';
329 echo ' ' , __('Server charset:') , ' '
330 . ' <span lang="en" dir="ltr">';
331 $unicode = Charsets
::$mysql_charset_map['utf-8'];
332 $charsets = Charsets
::getMySQLCharsetsDescriptions();
333 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
340 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
341 echo '<div class="group">';
342 echo '<h2>' , __('Web server') , '</h2>';
344 if ($GLOBALS['cfg']['ShowServerInfo']) {
345 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
348 $client_version_str = $GLOBALS['dbi']->getClientInfo();
349 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
350 $client_version_str = 'libmysql - ' . $client_version_str;
353 __('Database client version:') . ' ' . $client_version_str,
354 'li_mysql_client_version'
357 $php_ext_string = __('PHP extension:') . ' ';
359 $extensions = PhpMyAdmin\Util
::listPHPExtensions();
361 foreach ($extensions as $extension) {
362 $php_ext_string .= ' ' . $extension
363 . PhpMyAdmin\Util
::showPHPDocu('book.' . $extension . '.php');
368 'li_used_php_extension'
371 $php_version_string = __('PHP version:') . ' ' . phpversion();
375 'li_used_php_version'
380 if ($cfg['ShowPhpInfo']) {
382 __('Show PHP information'),
384 'phpinfo.php' . $common_url_query,
393 echo '<div class="group pmagroup">';
394 echo '<h2>phpMyAdmin</h2>';
397 if ($GLOBALS['cfg']['VersionCheck']) {
398 $class = 'jsversioncheck';
401 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
412 PhpMyAdmin\Util
::getDocuLink('index'),
417 // does not work if no target specified, don't know why
419 __('Official Homepage'),
421 Core
::linkURL('https://www.phpmyadmin.net/'),
428 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
435 Core
::linkURL('https://www.phpmyadmin.net/support/'),
440 __('List of changes'),
442 'changelog.php' . Url
::getCommon(),
449 'license.php' . Url
::getCommon(),
461 * mbstring is used for handling multibytes inside parser, so it is good
462 * to tell user something might be broken without it, see bug #1063149.
464 if (! @extension_loaded
('mbstring')) {
467 'The mbstring PHP extension was not found and you seem to be using'
468 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
469 . ' is unable to split strings correctly and it may result in'
470 . ' unexpected results.'
477 * Missing functionality
479 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
482 'The curl extension was not found and allow_url_fopen is '
483 . 'disabled. Due to this some features such as error reporting '
484 . 'or version check are disabled.'
489 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
491 * Check whether session.gc_maxlifetime limits session validity.
493 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
494 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
497 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
498 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
499 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
500 'in phpMyAdmin, because of this, your login might expire sooner ' .
501 'than configured in phpMyAdmin.'
509 * Check whether LoginCookieValidity is limited by LoginCookieStore.
511 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
512 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
516 'Login cookie store is lower than cookie validity configured in ' .
517 'phpMyAdmin, because of this, your login will expire sooner than ' .
518 'configured in phpMyAdmin.'
525 * Check if user does not have defined blowfish secret and it is being used.
527 if (! empty($_SESSION['encryption_key'])) {
528 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
531 'The configuration file now needs a secret passphrase (blowfish_secret).'
535 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
538 'The secret passphrase in configuration (blowfish_secret) is too short.'
546 * Check for existence of config directory which should not exist in
547 * production environment.
549 if (@file_exists
('config')) {
552 'Directory [code]config[/code], which is used by the setup script, ' .
553 'still exists in your phpMyAdmin directory. It is strongly ' .
554 'recommended to remove it once phpMyAdmin has been configured. ' .
555 'Otherwise the security of your server may be compromised by ' .
556 'unauthorized people downloading your configuration.'
563 $cfgRelation = PMA_getRelationsParam();
564 if (! $cfgRelation['allworks']
565 && $cfg['PmaNoRelation_DisableWarning'] == false
568 'The phpMyAdmin configuration storage is not completely '
569 . 'configured, some extended features have been deactivated. '
570 . '%sFind out why%s. '
572 if ($cfg['ZeroConf'] == true) {
573 $msg_text .= '<br>' .
575 'Or alternately go to \'Operations\' tab of any database '
576 . 'to set it up there.'
579 $msg = PhpMyAdmin\Message
::notice($msg_text);
580 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
581 $msg->addParamHtml('</a>');
582 /* Show error if user has configured something, notice elsewhere */
583 if (!empty($cfg['Servers'][$server]['pmadb'])) {
591 * Warning about Suhosin only if its simulation mode is not enabled
593 if ($cfg['SuhosinDisableWarning'] == false
594 && @ini_get
('suhosin.request.max_value_length')
595 && @ini_get
('suhosin.simulation') == '0'
600 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
601 'for possible issues.'
610 /* Missing template cache */
611 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
614 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
615 $GLOBALS['PMA_Config']->get('TempDir')
622 * Warning about incomplete translations.
624 * The data file is created while creating release by ./scripts/remove-incomplete-mo
626 if (@file_exists
('libraries/language_stats.inc.php')) {
627 include 'libraries/language_stats.inc.php';
629 * This message is intentionally not translated, because we're
630 * handling incomplete translations here and focus on english
633 if (isset($GLOBALS['language_stats'][$lang])
634 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
637 'You are using an incomplete translation, please help to make it '
638 . 'better by [a@https://www.phpmyadmin.net/translate/'
639 . '@_blank]contributing[/a].',
646 * prints list item for main page
648 * @param string $name displayed text
649 * @param string $listId id, used for css styles
650 * @param string $url make item as link with $url as target
651 * @param string $mysql_help_page display a link to MySQL's manual
652 * @param string $target special target for $url
653 * @param string $a_id id for the anchor,
654 * used for jQuery to hook in functions
655 * @param string $class class for the li element
656 * @param string $a_class class for the anchor element
660 function PMA_printListItem($name, $listId = null, $url = null,
661 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
664 echo PhpMyAdmin\Template
::get('list/item')
676 'mysql_help_page' => $mysql_help_page,