2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 use PhpMyAdmin\Charsets
;
11 use PhpMyAdmin\Display\GitRevision
;
12 use PhpMyAdmin\LanguageManager
;
13 use PhpMyAdmin\Message
;
14 use PhpMyAdmin\RecentFavoriteTable
;
15 use PhpMyAdmin\Relation
;
16 use PhpMyAdmin\Response
;
17 use PhpMyAdmin\Sanitize
;
18 use PhpMyAdmin\ThemeManager
;
22 * Gets some core libraries and displays a top message if required
24 require_once 'libraries/common.inc.php';
27 * pass variables to child pages
32 'collation_connection',
36 foreach ($drops as $each_drop) {
37 if (array_key_exists($each_drop, $_GET)) {
38 unset($_GET[$each_drop]);
41 unset($drops, $each_drop);
44 * Black list of all scripts to which front-end must submit data.
45 * Such scripts must not be loaded on home page.
48 $target_blacklist = array (
49 'import.php', 'export.php'
52 // If we have a valid target, let's load that script instead
53 if (! empty($_REQUEST['target'])
54 && is_string($_REQUEST['target'])
55 && ! preg_match('/^index/', $_REQUEST['target'])
56 && ! in_array($_REQUEST['target'], $target_blacklist)
57 && in_array($_REQUEST['target'], $goto_whitelist)
59 include $_REQUEST['target'];
63 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
68 if (! empty($_REQUEST['db'])) {
70 if (! empty($_REQUEST['table'])) {
71 $page = PhpMyAdmin\Util
::getScriptNameForOption(
72 $GLOBALS['cfg']['DefaultTabTable'], 'table'
75 $page = PhpMyAdmin\Util
::getScriptNameForOption(
76 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
83 $response = Response
::getInstance();
85 * Check if it is an ajax request to reload the recent tables list.
87 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
90 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
95 if ($GLOBALS['PMA_Config']->isGitRevision()) {
96 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
100 echo '<div id="is_git_revision"></div>';
103 // Handles some variables that may have been sent by the calling script
105 $GLOBALS['table'] = '';
108 // Any message to display?
109 if (! empty($message)) {
110 echo PhpMyAdmin\Util
::getMessage($message);
113 if (isset($_SESSION['partial_logout'])) {
115 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
117 unset($_SESSION['partial_logout']);
120 $common_url_query = Url
::getCommon();
121 $mysql_cur_user_and_host = '';
123 // when $server > 0, a server has been chosen so we can display
124 // all MySQL-related information
126 include 'libraries/server_common.inc.php';
128 // Use the verbose name of the server instead of the hostname
131 if (! empty($cfg['Server']['verbose'])) {
132 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
133 if ($GLOBALS['cfg']['ShowServerInfo']) {
134 $server_info .= ' (';
137 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
138 $server_info .= $GLOBALS['dbi']->getHostInfo();
140 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
143 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
145 // should we add the port info here?
146 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
147 ?
$GLOBALS['cfg']['Server']['verbose']
148 : $GLOBALS['cfg']['Server']['host']);
151 echo '<div id="maincontainer">' , "\n";
152 // Anchor for favorite tables synchronization.
153 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
154 echo '<div id="main_pane_left">';
155 if ($server > 0 ||
count($cfg['Servers']) > 1
157 if ($cfg['DBG']['demo']) {
158 echo '<div class="group">';
159 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
160 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
163 'You are using the demo server. You can do anything here, but '
164 . 'please do not change root, debian-sys-maint and pma users. '
165 . 'More information is available at %s.'
167 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
172 echo '<div class="group">';
173 echo '<h2>' , __('General settings') , '</h2>';
177 * Displays the MySQL servers choice form
179 if ($cfg['ServerDefault'] == 0
180 ||
(! $cfg['NavigationDisplayServers']
181 && (count($cfg['Servers']) > 1
182 ||
($server == 0 && count($cfg['Servers']) == 1)))
184 echo '<li id="li_select_server" class="no_bullets" >';
185 include_once 'libraries/select_server.lib.php';
186 echo PhpMyAdmin\Util
::getImage('s_host.png') , " "
187 , PMA_selectServer(true, true);
192 * Displays the mysql server related links
195 include_once 'libraries/check_user_privileges.lib.php';
197 // Logout for advanced authentication
198 if ($cfg['Server']['auth_type'] != 'config') {
199 if ($cfg['ShowChgPassword']) {
200 $conditional_class = 'ajax';
202 PhpMyAdmin\Util
::getImage('s_passwd.png') . " " . __(
205 'li_change_password',
206 'user_password.php' . $common_url_query,
209 'change_password_anchor',
215 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
216 echo ' <form method="post" action="index.php">' , "\n"
217 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
218 . ' <label for="select_collation_connection">' . "\n"
219 . ' ' . PhpMyAdmin\Util
::getImage('s_asci.png')
220 . " " . __('Server connection collation') . "\n"
221 // put the doc link in the form so that it appears on the same line
222 . PhpMyAdmin\Util
::showMySQLDocu('Charset-connection')
226 . Charsets
::getCollationDropdownBox(
227 'collation_connection',
228 'select_collation_connection',
229 $collation_connection,
235 } // end of if ($server > 0)
240 echo '<div class="group">';
241 echo '<h2>' , __('Appearance settings') , '</h2>';
244 // Displays language selection combo
245 $language_manager = LanguageManager
::getInstance();
246 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
247 echo '<li id="li_select_lang" class="no_bullets">';
249 echo PhpMyAdmin\Util
::getImage('s_lang.png') , " "
250 , $language_manager->getSelectorDisplay();
254 // ThemeManager if available
256 if ($GLOBALS['cfg']['ThemeManager']) {
257 echo '<li id="li_select_theme" class="no_bullets">';
258 echo PhpMyAdmin\Util
::getImage('s_theme.png') , " "
259 , ThemeManager
::getInstance()->getHtmlSelectBox();
262 echo '<li id="li_select_fontsize">';
263 echo PhpMyAdmin\Config
::getFontsizeForm();
273 PhpMyAdmin\Util
::getImage('b_tblops.png') . " " . __(
276 'li_user_preferences',
277 'prefs_manage.php' . $common_url_query,
290 echo '<div id="main_pane_right">';
293 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
295 echo '<div class="group">';
296 echo '<h2>' , __('Database server') , '</h2>';
299 __('Server:') . ' ' . $server_info,
303 __('Server type:') . ' ' . PhpMyAdmin\Util
::getServerType(),
307 __('Server connection:') . ' ' . PhpMyAdmin\Util
::getServerSSL(),
311 __('Server version:')
313 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
317 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
321 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
325 echo ' <li id="li_select_mysql_charset">';
326 echo ' ' , __('Server charset:') , ' '
327 . ' <span lang="en" dir="ltr">';
328 $unicode = Charsets
::$mysql_charset_map['utf-8'];
329 $charsets = Charsets
::getMySQLCharsetsDescriptions();
330 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
337 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
338 echo '<div class="group">';
339 echo '<h2>' , __('Web server') , '</h2>';
341 if ($GLOBALS['cfg']['ShowServerInfo']) {
342 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
345 $client_version_str = $GLOBALS['dbi']->getClientInfo();
346 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
347 $client_version_str = 'libmysql - ' . $client_version_str;
350 __('Database client version:') . ' ' . $client_version_str,
351 'li_mysql_client_version'
354 $php_ext_string = __('PHP extension:') . ' ';
356 $extensions = PhpMyAdmin\Util
::listPHPExtensions();
358 foreach ($extensions as $extension) {
359 $php_ext_string .= ' ' . $extension
360 . PhpMyAdmin\Util
::showPHPDocu('book.' . $extension . '.php');
365 'li_used_php_extension'
368 $php_version_string = __('PHP version:') . ' ' . phpversion();
372 'li_used_php_version'
377 if ($cfg['ShowPhpInfo']) {
379 __('Show PHP information'),
381 'phpinfo.php' . $common_url_query,
390 echo '<div class="group pmagroup">';
391 echo '<h2>phpMyAdmin</h2>';
394 if ($GLOBALS['cfg']['VersionCheck']) {
395 $class = 'jsversioncheck';
398 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
409 PhpMyAdmin\Util
::getDocuLink('index'),
414 // does not work if no target specified, don't know why
416 __('Official Homepage'),
418 Core
::linkURL('https://www.phpmyadmin.net/'),
425 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
432 Core
::linkURL('https://www.phpmyadmin.net/support/'),
437 __('List of changes'),
439 'changelog.php' . Url
::getCommon(),
446 'license.php' . Url
::getCommon(),
458 * mbstring is used for handling multibytes inside parser, so it is good
459 * to tell user something might be broken without it, see bug #1063149.
461 if (! @extension_loaded
('mbstring')) {
464 'The mbstring PHP extension was not found and you seem to be using'
465 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
466 . ' is unable to split strings correctly and it may result in'
467 . ' unexpected results.'
474 * Missing functionality
476 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
479 'The curl extension was not found and allow_url_fopen is '
480 . 'disabled. Due to this some features such as error reporting '
481 . 'or version check are disabled.'
486 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
488 * Check whether session.gc_maxlifetime limits session validity.
490 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
491 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
494 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
495 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
496 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
497 'in phpMyAdmin, because of this, your login might expire sooner ' .
498 'than configured in phpMyAdmin.'
506 * Check whether LoginCookieValidity is limited by LoginCookieStore.
508 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
509 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
513 'Login cookie store is lower than cookie validity configured in ' .
514 'phpMyAdmin, because of this, your login will expire sooner than ' .
515 'configured in phpMyAdmin.'
522 * Check if user does not have defined blowfish secret and it is being used.
524 if (! empty($_SESSION['encryption_key'])) {
525 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
528 'The configuration file now needs a secret passphrase (blowfish_secret).'
532 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
535 'The secret passphrase in configuration (blowfish_secret) is too short.'
543 * Check for existence of config directory which should not exist in
544 * production environment.
546 if (@file_exists
('config')) {
549 'Directory [code]config[/code], which is used by the setup script, ' .
550 'still exists in your phpMyAdmin directory. It is strongly ' .
551 'recommended to remove it once phpMyAdmin has been configured. ' .
552 'Otherwise the security of your server may be compromised by ' .
553 'unauthorized people downloading your configuration.'
560 $cfgRelation = Relation
::getRelationsParam();
561 if (! $cfgRelation['allworks']
562 && $cfg['PmaNoRelation_DisableWarning'] == false
565 'The phpMyAdmin configuration storage is not completely '
566 . 'configured, some extended features have been deactivated. '
567 . '%sFind out why%s. '
569 if ($cfg['ZeroConf'] == true) {
570 $msg_text .= '<br>' .
572 'Or alternately go to \'Operations\' tab of any database '
573 . 'to set it up there.'
576 $msg = PhpMyAdmin\Message
::notice($msg_text);
577 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
578 $msg->addParamHtml('</a>');
579 /* Show error if user has configured something, notice elsewhere */
580 if (!empty($cfg['Servers'][$server]['pmadb'])) {
588 * Warning about Suhosin only if its simulation mode is not enabled
590 if ($cfg['SuhosinDisableWarning'] == false
591 && @ini_get
('suhosin.request.max_value_length')
592 && @ini_get
('suhosin.simulation') == '0'
597 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
598 'for possible issues.'
607 /* Missing template cache */
608 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
611 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
612 $GLOBALS['PMA_Config']->get('TempDir')
619 * Warning about incomplete translations.
621 * The data file is created while creating release by ./scripts/remove-incomplete-mo
623 if (@file_exists
('libraries/language_stats.inc.php')) {
624 include 'libraries/language_stats.inc.php';
626 * This message is intentionally not translated, because we're
627 * handling incomplete translations here and focus on english
630 if (isset($GLOBALS['language_stats'][$lang])
631 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
634 'You are using an incomplete translation, please help to make it '
635 . 'better by [a@https://www.phpmyadmin.net/translate/'
636 . '@_blank]contributing[/a].',
643 * prints list item for main page
645 * @param string $name displayed text
646 * @param string $listId id, used for css styles
647 * @param string $url make item as link with $url as target
648 * @param string $mysql_help_page display a link to MySQL's manual
649 * @param string $target special target for $url
650 * @param string $a_id id for the anchor,
651 * used for jQuery to hook in functions
652 * @param string $class class for the li element
653 * @param string $a_class class for the anchor element
657 function PMA_printListItem($name, $listId = null, $url = null,
658 $mysql_help_page = null, $target = null, $a_id = null, $class = null,
661 echo PhpMyAdmin\Template
::get('list/item')
673 'mysql_help_page' => $mysql_help_page,