2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 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\Server\Select
;
19 use PhpMyAdmin\ThemeManager
;
22 use PhpMyAdmin\UserPreferences
;
25 * Gets some core libraries and displays a top message if required
27 require_once 'libraries/common.inc.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 && Core
::checkPageValidity($_REQUEST['target'], [], true)
62 include $_REQUEST['target'];
66 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
70 // user selected font size
71 if (isset($_POST['set_fontsize']) && preg_match('/^[0-9.]+(px|em|pt|\%)$/', $_POST['set_fontsize'])) {
72 $GLOBALS['PMA_Config']->setUserValue(
75 $_POST['set_fontsize'],
78 header('Location: index.php' . Url
::getCommonRaw());
81 // if user selected a theme
82 if (isset($_POST['set_theme'])) {
83 $tmanager = ThemeManager
::getInstance();
84 $tmanager->setActiveTheme($_POST['set_theme']);
85 $tmanager->setThemeCookie();
87 $userPreferences = new UserPreferences();
88 $prefs = $userPreferences->load();
89 $prefs["config_data"]["ThemeDefault"] = $_POST['set_theme'];
90 $userPreferences->save($prefs["config_data"]);
92 header('Location: index.php' . Url
::getCommonRaw());
95 // Change collation connection
96 if (isset($_POST['collation_connection'])) {
97 $GLOBALS['PMA_Config']->setUserValue(
99 'DefaultConnectionCollation',
100 $_POST['collation_connection'],
103 header('Location: index.php' . Url
::getCommonRaw());
109 if (! empty($_REQUEST['db'])) {
111 if (! empty($_REQUEST['table'])) {
112 $page = Util
::getScriptNameForOption(
113 $GLOBALS['cfg']['DefaultTabTable'], 'table'
116 $page = Util
::getScriptNameForOption(
117 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
124 $response = Response
::getInstance();
126 * Check if it is an ajax request to reload the recent tables list.
128 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
131 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
136 if ($GLOBALS['PMA_Config']->isGitRevision()) {
137 // If ajax request to get revision
138 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
139 GitRevision
::display();
142 // Else show empty html
143 echo '<div id="is_git_revision"></div>';
146 // Handles some variables that may have been sent by the calling script
148 $GLOBALS['table'] = '';
151 // Any message to display?
152 if (! empty($message)) {
153 echo Util
::getMessage($message);
156 if (isset($_SESSION['partial_logout'])) {
158 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
160 unset($_SESSION['partial_logout']);
163 $common_url_query = Url
::getCommon();
164 $mysql_cur_user_and_host = '';
166 // when $server > 0, a server has been chosen so we can display
167 // all MySQL-related information
169 include 'libraries/server_common.inc.php';
171 // Use the verbose name of the server instead of the hostname
174 if (! empty($cfg['Server']['verbose'])) {
175 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
176 if ($GLOBALS['cfg']['ShowServerInfo']) {
177 $server_info .= ' (';
180 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
181 $server_info .= $GLOBALS['dbi']->getHostInfo();
183 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
186 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
188 // should we add the port info here?
189 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
190 ?
$GLOBALS['cfg']['Server']['verbose']
191 : $GLOBALS['cfg']['Server']['host']);
194 echo '<div id="maincontainer">' , "\n";
195 // Anchor for favorite tables synchronization.
196 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
197 echo '<div id="main_pane_left">';
198 if ($server > 0 ||
count($cfg['Servers']) > 1
200 if ($cfg['DBG']['demo']) {
201 echo '<div class="group">';
202 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
203 echo '<p class="cfg_dbg_demo">';
206 'You are using the demo server. You can do anything here, but '
207 . 'please do not change root, debian-sys-maint and pma users. '
208 . 'More information is available at %s.'
210 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
215 echo '<div class="group">';
216 echo '<h2>' , __('General settings') , '</h2>';
220 * Displays the MySQL servers choice form
222 if ($cfg['ServerDefault'] == 0
223 ||
(! $cfg['NavigationDisplayServers']
224 && (count($cfg['Servers']) > 1
225 ||
($server == 0 && count($cfg['Servers']) == 1)))
227 echo '<li id="li_select_server" class="no_bullets" >';
228 echo Util
::getImage('s_host') , " "
229 , Select
::render(true, true);
234 * Displays the mysql server related links
237 include_once 'libraries/check_user_privileges.inc.php';
239 // Logout for advanced authentication
240 if ($cfg['Server']['auth_type'] != 'config') {
241 if ($cfg['ShowChgPassword']) {
242 $conditional_class = 'ajax';
244 Util
::getImage('s_passwd') . " " . __(
247 'li_change_password',
248 'user_password.php' . $common_url_query,
251 'change_password_anchor',
257 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
258 echo ' <form class="disableAjax" method="post" action="index.php">' , "\n"
259 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
260 . ' <label for="select_collation_connection">' . "\n"
261 . ' ' . Util
::getImage('s_asci')
262 . " " . __('Server connection collation') . "\n"
263 // put the doc link in the form so that it appears on the same line
264 . Util
::showMySQLDocu('Charset-connection')
268 . Charsets
::getCollationDropdownBox(
270 $GLOBALS['cfg']['Server']['DisableIS'],
271 'collation_connection',
272 'select_collation_connection',
273 $collation_connection,
279 } // end of if ($server > 0)
284 echo '<div class="group">';
285 echo '<h2>' , __('Appearance settings') , '</h2>';
288 // Displays language selection combo
289 $language_manager = LanguageManager
::getInstance();
290 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
291 echo '<li id="li_select_lang" class="no_bullets">';
293 echo Util
::getImage('s_lang') , " "
294 , $language_manager->getSelectorDisplay();
298 // ThemeManager if available
300 if ($GLOBALS['cfg']['ThemeManager']) {
301 echo '<li id="li_select_theme" class="no_bullets">';
302 echo Util
::getImage('s_theme') , " "
303 , ThemeManager
::getInstance()->getHtmlSelectBox();
306 echo '<li id="li_select_fontsize">';
307 echo Config
::getFontsizeForm();
317 Util
::getImage('b_tblops') . " " . __(
320 'li_user_preferences',
321 'prefs_manage.php' . $common_url_query,
334 echo '<div id="main_pane_right">';
337 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
339 echo '<div class="group">';
340 echo '<h2>' , __('Database server') , '</h2>';
343 __('Server:') . ' ' . $server_info,
347 __('Server type:') . ' ' . Util
::getServerType(),
351 __('Server connection:') . ' ' . Util
::getServerSSL(),
355 __('Server version:')
357 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
361 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
365 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
369 echo ' <li id="li_select_mysql_charset">';
370 echo ' ' , __('Server charset:') , ' '
371 . ' <span lang="en" dir="ltr">';
372 $unicode = Charsets
::$mysql_charset_map['utf-8'];
373 $charsets = Charsets
::getMySQLCharsetsDescriptions(
375 $GLOBALS['cfg']['Server']['DisableIS']
377 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
384 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
385 echo '<div class="group">';
386 echo '<h2>' , __('Web server') , '</h2>';
388 if ($GLOBALS['cfg']['ShowServerInfo']) {
389 Core
::printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
392 $client_version_str = $GLOBALS['dbi']->getClientInfo();
393 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
394 $client_version_str = 'libmysql - ' . $client_version_str;
397 __('Database client version:') . ' ' . $client_version_str,
398 'li_mysql_client_version'
401 $php_ext_string = __('PHP extension:') . ' ';
403 $extensions = Util
::listPHPExtensions();
405 foreach ($extensions as $extension) {
406 $php_ext_string .= ' ' . $extension
407 . Util
::showPHPDocu('book.' . $extension . '.php');
412 'li_used_php_extension'
415 $php_version_string = __('PHP version:') . ' ' . phpversion();
419 'li_used_php_version'
424 if ($cfg['ShowPhpInfo']) {
426 __('Show PHP information'),
428 'phpinfo.php' . $common_url_query,
437 echo '<div class="group pmagroup">';
438 echo '<h2>phpMyAdmin</h2>';
441 if ($GLOBALS['cfg']['VersionCheck']) {
442 $class = 'jsversioncheck';
445 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
456 Util
::getDocuLink('index'),
461 // does not work if no target specified, don't know why
463 __('Official Homepage'),
465 Core
::linkURL('https://www.phpmyadmin.net/'),
472 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
479 Core
::linkURL('https://www.phpmyadmin.net/support/'),
484 __('List of changes'),
486 'changelog.php' . Url
::getCommon(),
493 'license.php' . Url
::getCommon(),
505 * mbstring is used for handling multibytes inside parser, so it is good
506 * to tell user something might be broken without it, see bug #1063149.
508 if (! extension_loaded('mbstring')) {
511 'The mbstring PHP extension was not found and you seem to be using'
512 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
513 . ' is unable to split strings correctly and it may result in'
514 . ' unexpected results.'
521 * Missing functionality
523 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
526 'The curl extension was not found and allow_url_fopen is '
527 . 'disabled. Due to this some features such as error reporting '
528 . 'or version check are disabled.'
533 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
535 * Check whether session.gc_maxlifetime limits session validity.
537 $gc_time = (int)ini_get('session.gc_maxlifetime');
538 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
541 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
542 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
543 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
544 'in phpMyAdmin, because of this, your login might expire sooner ' .
545 'than configured in phpMyAdmin.'
553 * Check whether LoginCookieValidity is limited by LoginCookieStore.
555 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
556 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
560 'Login cookie store is lower than cookie validity configured in ' .
561 'phpMyAdmin, because of this, your login will expire sooner than ' .
562 'configured in phpMyAdmin.'
569 * Check if user does not have defined blowfish secret and it is being used.
571 if (! empty($_SESSION['encryption_key'])) {
572 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
575 'The configuration file now needs a secret passphrase (blowfish_secret).'
579 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
582 'The secret passphrase in configuration (blowfish_secret) is too short.'
590 * Check for existence of config directory which should not exist in
591 * production environment.
593 if (@file_exists
('config')) {
596 'Directory [code]config[/code], which is used by the setup script, ' .
597 'still exists in your phpMyAdmin directory. It is strongly ' .
598 'recommended to remove it once phpMyAdmin has been configured. ' .
599 'Otherwise the security of your server may be compromised by ' .
600 'unauthorized people downloading your configuration.'
606 $relation = new Relation();
609 $cfgRelation = $relation->getRelationsParam();
610 if (! $cfgRelation['allworks']
611 && $cfg['PmaNoRelation_DisableWarning'] == false
614 'The phpMyAdmin configuration storage is not completely '
615 . 'configured, some extended features have been deactivated. '
616 . '%sFind out why%s. '
618 if ($cfg['ZeroConf'] == true) {
619 $msg_text .= '<br>' .
621 'Or alternately go to \'Operations\' tab of any database '
622 . 'to set it up there.'
625 $msg = Message
::notice($msg_text);
626 $msg->addParamHtml('<a href="./chk_rel.php" data-post="' . $common_url_query . '">');
627 $msg->addParamHtml('</a>');
628 /* Show error if user has configured something, notice elsewhere */
629 if (!empty($cfg['Servers'][$server]['pmadb'])) {
637 * Warning about Suhosin only if its simulation mode is not enabled
639 if ($cfg['SuhosinDisableWarning'] == false
640 && ini_get('suhosin.request.max_value_length')
641 && ini_get('suhosin.simulation') == '0'
646 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
647 'for possible issues.'
656 /* Missing template cache */
657 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
660 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
661 $GLOBALS['PMA_Config']->get('TempDir')
668 * Warning about incomplete translations.
670 * The data file is created while creating release by ./scripts/remove-incomplete-mo
672 if (@file_exists
('libraries/language_stats.inc.php')) {
673 include 'libraries/language_stats.inc.php';
675 * This message is intentionally not translated, because we're
676 * handling incomplete translations here and focus on english
679 if (isset($GLOBALS['language_stats'][$lang])
680 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
683 'You are using an incomplete translation, please help to make it '
684 . 'better by [a@https://www.phpmyadmin.net/translate/'
685 . '@_blank]contributing[/a].',