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
;
24 * Gets some core libraries and displays a top message if required
26 require_once 'libraries/common.inc.php';
29 * pass variables to child pages
34 'collation_connection',
38 foreach ($drops as $each_drop) {
39 if (array_key_exists($each_drop, $_GET)) {
40 unset($_GET[$each_drop]);
43 unset($drops, $each_drop);
46 * Black list of all scripts to which front-end must submit data.
47 * Such scripts must not be loaded on home page.
50 $target_blacklist = array (
51 'import.php', 'export.php'
54 // If we have a valid target, let's load that script instead
55 if (! empty($_REQUEST['target'])
56 && is_string($_REQUEST['target'])
57 && ! preg_match('/^index/', $_REQUEST['target'])
58 && ! in_array($_REQUEST['target'], $target_blacklist)
59 && Core
::checkPageValidity($_REQUEST['target'])
61 include $_REQUEST['target'];
65 if (isset($_REQUEST['ajax_request']) && ! empty($_REQUEST['access_time'])) {
69 // user selected font size
70 if (isset($_POST['set_fontsize']) && preg_match('/^[0-9.]+(px|em|pt|\%)$/', $_POST['set_fontsize'])) {
71 $GLOBALS['PMA_Config']->setUserValue(
74 $_POST['set_fontsize'],
77 header('Location: index.php' . Url
::getCommonRaw());
80 // if user selected a theme
81 if (isset($_POST['set_theme'])) {
82 $tmanager = ThemeManager
::getInstance();
83 $tmanager->setActiveTheme($_POST['set_theme']);
84 $tmanager->setThemeCookie();
85 header('Location: index.php' . Url
::getCommonRaw());
88 // Change collation connection
89 if (isset($_POST['collation_connection'])) {
90 $GLOBALS['PMA_Config']->setUserValue(
92 'DefaultConnectionCollation',
93 $_POST['collation_connection'],
96 header('Location: index.php' . Url
::getCommonRaw());
102 if (! empty($_REQUEST['db'])) {
104 if (! empty($_REQUEST['table'])) {
105 $page = Util
::getScriptNameForOption(
106 $GLOBALS['cfg']['DefaultTabTable'], 'table'
109 $page = Util
::getScriptNameForOption(
110 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
117 $response = Response
::getInstance();
119 * Check if it is an ajax request to reload the recent tables list.
121 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
124 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
129 if ($GLOBALS['PMA_Config']->isGitRevision()) {
130 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
131 GitRevision
::display();
134 echo '<div id="is_git_revision"></div>';
137 // Handles some variables that may have been sent by the calling script
139 $GLOBALS['table'] = '';
142 // Any message to display?
143 if (! empty($message)) {
144 echo Util
::getMessage($message);
147 if (isset($_SESSION['partial_logout'])) {
149 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
151 unset($_SESSION['partial_logout']);
154 $common_url_query = Url
::getCommon();
155 $mysql_cur_user_and_host = '';
157 // when $server > 0, a server has been chosen so we can display
158 // all MySQL-related information
160 include 'libraries/server_common.inc.php';
162 // Use the verbose name of the server instead of the hostname
165 if (! empty($cfg['Server']['verbose'])) {
166 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
167 if ($GLOBALS['cfg']['ShowServerInfo']) {
168 $server_info .= ' (';
171 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
172 $server_info .= $GLOBALS['dbi']->getHostInfo();
174 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
177 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
179 // should we add the port info here?
180 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
181 ?
$GLOBALS['cfg']['Server']['verbose']
182 : $GLOBALS['cfg']['Server']['host']);
185 echo '<div id="maincontainer">' , "\n";
186 // Anchor for favorite tables synchronization.
187 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
188 echo '<div id="main_pane_left">';
189 if ($server > 0 ||
count($cfg['Servers']) > 1
191 if ($cfg['DBG']['demo']) {
192 echo '<div class="group">';
193 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
194 echo '<p class="cfg_dbg_demo">';
197 'You are using the demo server. You can do anything here, but '
198 . 'please do not change root, debian-sys-maint and pma users. '
199 . 'More information is available at %s.'
201 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
206 echo '<div class="group">';
207 echo '<h2>' , __('General settings') , '</h2>';
211 * Displays the MySQL servers choice form
213 if ($cfg['ServerDefault'] == 0
214 ||
(! $cfg['NavigationDisplayServers']
215 && (count($cfg['Servers']) > 1
216 ||
($server == 0 && count($cfg['Servers']) == 1)))
218 echo '<li id="li_select_server" class="no_bullets" >';
219 echo Util
::getImage('s_host') , " "
220 , Select
::render(true, true);
225 * Displays the mysql server related links
228 include_once 'libraries/check_user_privileges.inc.php';
230 // Logout for advanced authentication
231 if ($cfg['Server']['auth_type'] != 'config') {
232 if ($cfg['ShowChgPassword']) {
233 $conditional_class = 'ajax';
235 Util
::getImage('s_passwd') . " " . __(
238 'li_change_password',
239 'user_password.php' . $common_url_query,
242 'change_password_anchor',
248 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
249 echo ' <form class="disableAjax" method="post" action="index.php">' , "\n"
250 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
251 . ' <label for="select_collation_connection">' . "\n"
252 . ' ' . Util
::getImage('s_asci')
253 . " " . __('Server connection collation') . "\n"
254 // put the doc link in the form so that it appears on the same line
255 . Util
::showMySQLDocu('Charset-connection')
259 . Charsets
::getCollationDropdownBox(
261 $GLOBALS['cfg']['Server']['DisableIS'],
262 'collation_connection',
263 'select_collation_connection',
264 $collation_connection,
270 } // end of if ($server > 0)
275 echo '<div class="group">';
276 echo '<h2>' , __('Appearance settings') , '</h2>';
279 // Displays language selection combo
280 $language_manager = LanguageManager
::getInstance();
281 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
282 echo '<li id="li_select_lang" class="no_bullets">';
284 echo Util
::getImage('s_lang') , " "
285 , $language_manager->getSelectorDisplay();
289 // ThemeManager if available
291 if ($GLOBALS['cfg']['ThemeManager']) {
292 echo '<li id="li_select_theme" class="no_bullets">';
293 echo Util
::getImage('s_theme') , " "
294 , ThemeManager
::getInstance()->getHtmlSelectBox();
297 echo '<li id="li_select_fontsize">';
298 echo Config
::getFontsizeForm();
308 Util
::getImage('b_tblops') . " " . __(
311 'li_user_preferences',
312 'prefs_manage.php' . $common_url_query,
325 echo '<div id="main_pane_right">';
328 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
330 echo '<div class="group">';
331 echo '<h2>' , __('Database server') , '</h2>';
334 __('Server:') . ' ' . $server_info,
338 __('Server type:') . ' ' . Util
::getServerType(),
342 __('Server connection:') . ' ' . Util
::getServerSSL(),
346 __('Server version:')
348 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
352 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
356 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
360 echo ' <li id="li_select_mysql_charset">';
361 echo ' ' , __('Server charset:') , ' '
362 . ' <span lang="en" dir="ltr">';
363 $unicode = Charsets
::$mysql_charset_map['utf-8'];
364 $charsets = Charsets
::getMySQLCharsetsDescriptions(
366 $GLOBALS['cfg']['Server']['DisableIS']
368 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
375 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
376 echo '<div class="group">';
377 echo '<h2>' , __('Web server') , '</h2>';
379 if ($GLOBALS['cfg']['ShowServerInfo']) {
380 Core
::printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
383 $client_version_str = $GLOBALS['dbi']->getClientInfo();
384 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
385 $client_version_str = 'libmysql - ' . $client_version_str;
388 __('Database client version:') . ' ' . $client_version_str,
389 'li_mysql_client_version'
392 $php_ext_string = __('PHP extension:') . ' ';
394 $extensions = Util
::listPHPExtensions();
396 foreach ($extensions as $extension) {
397 $php_ext_string .= ' ' . $extension
398 . Util
::showPHPDocu('book.' . $extension . '.php');
403 'li_used_php_extension'
406 $php_version_string = __('PHP version:') . ' ' . phpversion();
410 'li_used_php_version'
415 if ($cfg['ShowPhpInfo']) {
417 __('Show PHP information'),
419 'phpinfo.php' . $common_url_query,
428 echo '<div class="group pmagroup">';
429 echo '<h2>phpMyAdmin</h2>';
432 if ($GLOBALS['cfg']['VersionCheck']) {
433 $class = 'jsversioncheck';
436 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
447 Util
::getDocuLink('index'),
452 // does not work if no target specified, don't know why
454 __('Official Homepage'),
456 Core
::linkURL('https://www.phpmyadmin.net/'),
463 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
470 Core
::linkURL('https://www.phpmyadmin.net/support/'),
475 __('List of changes'),
477 'changelog.php' . Url
::getCommon(),
484 'license.php' . Url
::getCommon(),
496 * mbstring is used for handling multibytes inside parser, so it is good
497 * to tell user something might be broken without it, see bug #1063149.
499 if (! extension_loaded('mbstring')) {
502 'The mbstring PHP extension was not found and you seem to be using'
503 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
504 . ' is unable to split strings correctly and it may result in'
505 . ' unexpected results.'
512 * Missing functionality
514 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
517 'The curl extension was not found and allow_url_fopen is '
518 . 'disabled. Due to this some features such as error reporting '
519 . 'or version check are disabled.'
524 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
526 * Check whether session.gc_maxlifetime limits session validity.
528 $gc_time = (int)ini_get('session.gc_maxlifetime');
529 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
532 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
533 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
534 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
535 'in phpMyAdmin, because of this, your login might expire sooner ' .
536 'than configured in phpMyAdmin.'
544 * Check whether LoginCookieValidity is limited by LoginCookieStore.
546 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
547 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
551 'Login cookie store is lower than cookie validity configured in ' .
552 'phpMyAdmin, because of this, your login will expire sooner than ' .
553 'configured in phpMyAdmin.'
560 * Check if user does not have defined blowfish secret and it is being used.
562 if (! empty($_SESSION['encryption_key'])) {
563 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
566 'The configuration file now needs a secret passphrase (blowfish_secret).'
570 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
573 'The secret passphrase in configuration (blowfish_secret) is too short.'
581 * Check for existence of config directory which should not exist in
582 * production environment.
584 if (@file_exists
('config')) {
587 'Directory [code]config[/code], which is used by the setup script, ' .
588 'still exists in your phpMyAdmin directory. It is strongly ' .
589 'recommended to remove it once phpMyAdmin has been configured. ' .
590 'Otherwise the security of your server may be compromised by ' .
591 'unauthorized people downloading your configuration.'
597 $relation = new Relation();
600 $cfgRelation = $relation->getRelationsParam();
601 if (! $cfgRelation['allworks']
602 && $cfg['PmaNoRelation_DisableWarning'] == false
605 'The phpMyAdmin configuration storage is not completely '
606 . 'configured, some extended features have been deactivated. '
607 . '%sFind out why%s. '
609 if ($cfg['ZeroConf'] == true) {
610 $msg_text .= '<br>' .
612 'Or alternately go to \'Operations\' tab of any database '
613 . 'to set it up there.'
616 $msg = Message
::notice($msg_text);
617 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
618 $msg->addParamHtml('</a>');
619 /* Show error if user has configured something, notice elsewhere */
620 if (!empty($cfg['Servers'][$server]['pmadb'])) {
628 * Warning about Suhosin only if its simulation mode is not enabled
630 if ($cfg['SuhosinDisableWarning'] == false
631 && ini_get('suhosin.request.max_value_length')
632 && ini_get('suhosin.simulation') == '0'
637 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
638 'for possible issues.'
647 /* Missing template cache */
648 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
651 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
652 $GLOBALS['PMA_Config']->get('TempDir')
659 * Warning about incomplete translations.
661 * The data file is created while creating release by ./scripts/remove-incomplete-mo
663 if (@file_exists
('libraries/language_stats.inc.php')) {
664 include 'libraries/language_stats.inc.php';
666 * This message is intentionally not translated, because we're
667 * handling incomplete translations here and focus on english
670 if (isset($GLOBALS['language_stats'][$lang])
671 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
674 'You are using an incomplete translation, please help to make it '
675 . 'better by [a@https://www.phpmyadmin.net/translate/'
676 . '@_blank]contributing[/a].',