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());
91 if (! empty($_REQUEST['db'])) {
93 if (! empty($_REQUEST['table'])) {
94 $page = Util
::getScriptNameForOption(
95 $GLOBALS['cfg']['DefaultTabTable'], 'table'
98 $page = Util
::getScriptNameForOption(
99 $GLOBALS['cfg']['DefaultTabDatabase'], 'database'
106 $response = Response
::getInstance();
108 * Check if it is an ajax request to reload the recent tables list.
110 if ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
113 RecentFavoriteTable
::getInstance('recent')->getHtmlList()
118 if ($GLOBALS['PMA_Config']->isGitRevision()) {
119 if (isset($_REQUEST['git_revision']) && $response->isAjax()) {
120 GitRevision
::display();
123 echo '<div id="is_git_revision"></div>';
126 // Handles some variables that may have been sent by the calling script
128 $GLOBALS['table'] = '';
131 // Any message to display?
132 if (! empty($message)) {
133 echo Util
::getMessage($message);
136 if (isset($_SESSION['partial_logout'])) {
138 __('You were logged out from one server, to logout completely from phpMyAdmin, you need to logout from all servers.')
140 unset($_SESSION['partial_logout']);
143 $common_url_query = Url
::getCommon();
144 $mysql_cur_user_and_host = '';
146 // when $server > 0, a server has been chosen so we can display
147 // all MySQL-related information
149 include 'libraries/server_common.inc.php';
151 // Use the verbose name of the server instead of the hostname
154 if (! empty($cfg['Server']['verbose'])) {
155 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
156 if ($GLOBALS['cfg']['ShowServerInfo']) {
157 $server_info .= ' (';
160 if ($GLOBALS['cfg']['ShowServerInfo'] ||
empty($cfg['Server']['verbose'])) {
161 $server_info .= $GLOBALS['dbi']->getHostInfo();
163 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
166 $mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
168 // should we add the port info here?
169 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
170 ?
$GLOBALS['cfg']['Server']['verbose']
171 : $GLOBALS['cfg']['Server']['host']);
174 echo '<div id="maincontainer">' , "\n";
175 // Anchor for favorite tables synchronization.
176 echo RecentFavoriteTable
::getInstance('favorite')->getHtmlSyncFavoriteTables();
177 echo '<div id="main_pane_left">';
178 if ($server > 0 ||
count($cfg['Servers']) > 1
180 if ($cfg['DBG']['demo']) {
181 echo '<div class="group">';
182 echo '<h2>' , __('phpMyAdmin Demo Server') , '</h2>';
183 echo '<p style="margin: 0.5em 1em 0.5em 1em">';
186 'You are using the demo server. You can do anything here, but '
187 . 'please do not change root, debian-sys-maint and pma users. '
188 . 'More information is available at %s.'
190 '<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>'
195 echo '<div class="group">';
196 echo '<h2>' , __('General settings') , '</h2>';
200 * Displays the MySQL servers choice form
202 if ($cfg['ServerDefault'] == 0
203 ||
(! $cfg['NavigationDisplayServers']
204 && (count($cfg['Servers']) > 1
205 ||
($server == 0 && count($cfg['Servers']) == 1)))
207 echo '<li id="li_select_server" class="no_bullets" >';
208 echo Util
::getImage('s_host') , " "
209 , Select
::render(true, true);
214 * Displays the mysql server related links
217 include_once 'libraries/check_user_privileges.inc.php';
219 // Logout for advanced authentication
220 if ($cfg['Server']['auth_type'] != 'config') {
221 if ($cfg['ShowChgPassword']) {
222 $conditional_class = 'ajax';
224 Util
::getImage('s_passwd') . " " . __(
227 'li_change_password',
228 'user_password.php' . $common_url_query,
231 'change_password_anchor',
237 echo ' <li id="li_select_mysql_collation" class="no_bullets" >';
238 echo ' <form method="post" action="index.php">' , "\n"
239 . Url
::getHiddenInputs(null, null, 4, 'collation_connection')
240 . ' <label for="select_collation_connection">' . "\n"
241 . ' ' . Util
::getImage('s_asci')
242 . " " . __('Server connection collation') . "\n"
243 // put the doc link in the form so that it appears on the same line
244 . Util
::showMySQLDocu('Charset-connection')
248 . Charsets
::getCollationDropdownBox(
250 $GLOBALS['cfg']['Server']['DisableIS'],
251 'collation_connection',
252 'select_collation_connection',
253 $collation_connection,
259 } // end of if ($server > 0)
264 echo '<div class="group">';
265 echo '<h2>' , __('Appearance settings') , '</h2>';
268 // Displays language selection combo
269 $language_manager = LanguageManager
::getInstance();
270 if (empty($cfg['Lang']) && $language_manager->hasChoice()) {
271 echo '<li id="li_select_lang" class="no_bullets">';
273 echo Util
::getImage('s_lang') , " "
274 , $language_manager->getSelectorDisplay();
278 // ThemeManager if available
280 if ($GLOBALS['cfg']['ThemeManager']) {
281 echo '<li id="li_select_theme" class="no_bullets">';
282 echo Util
::getImage('s_theme') , " "
283 , ThemeManager
::getInstance()->getHtmlSelectBox();
286 echo '<li id="li_select_fontsize">';
287 echo Config
::getFontsizeForm();
297 Util
::getImage('b_tblops') . " " . __(
300 'li_user_preferences',
301 'prefs_manage.php' . $common_url_query,
314 echo '<div id="main_pane_right">';
317 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
319 echo '<div class="group">';
320 echo '<h2>' , __('Database server') , '</h2>';
323 __('Server:') . ' ' . $server_info,
327 __('Server type:') . ' ' . Util
::getServerType(),
331 __('Server connection:') . ' ' . Util
::getServerSSL(),
335 __('Server version:')
337 . $GLOBALS['dbi']->getVersionString() . ' - ' . $GLOBALS['dbi']->getVersionComment(),
341 __('Protocol version:') . ' ' . $GLOBALS['dbi']->getProtoInfo(),
345 __('User:') . ' ' . htmlspecialchars($mysql_cur_user_and_host),
349 echo ' <li id="li_select_mysql_charset">';
350 echo ' ' , __('Server charset:') , ' '
351 . ' <span lang="en" dir="ltr">';
352 $unicode = Charsets
::$mysql_charset_map['utf-8'];
353 $charsets = Charsets
::getMySQLCharsetsDescriptions(
355 $GLOBALS['cfg']['Server']['DisableIS']
357 echo ' ' , $charsets[$unicode], ' (' . $unicode, ')';
364 if ($GLOBALS['cfg']['ShowServerInfo'] ||
$GLOBALS['cfg']['ShowPhpInfo']) {
365 echo '<div class="group">';
366 echo '<h2>' , __('Web server') , '</h2>';
368 if ($GLOBALS['cfg']['ShowServerInfo']) {
369 Core
::printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
372 $client_version_str = $GLOBALS['dbi']->getClientInfo();
373 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
374 $client_version_str = 'libmysql - ' . $client_version_str;
377 __('Database client version:') . ' ' . $client_version_str,
378 'li_mysql_client_version'
381 $php_ext_string = __('PHP extension:') . ' ';
383 $extensions = Util
::listPHPExtensions();
385 foreach ($extensions as $extension) {
386 $php_ext_string .= ' ' . $extension
387 . Util
::showPHPDocu('book.' . $extension . '.php');
392 'li_used_php_extension'
395 $php_version_string = __('PHP version:') . ' ' . phpversion();
399 'li_used_php_version'
404 if ($cfg['ShowPhpInfo']) {
406 __('Show PHP information'),
408 'phpinfo.php' . $common_url_query,
417 echo '<div class="group pmagroup">';
418 echo '<h2>phpMyAdmin</h2>';
421 if ($GLOBALS['cfg']['VersionCheck']) {
422 $class = 'jsversioncheck';
425 __('Version information:') . ' <span class="version">' . PMA_VERSION
. '</span>',
436 Util
::getDocuLink('index'),
441 // does not work if no target specified, don't know why
443 __('Official Homepage'),
445 Core
::linkURL('https://www.phpmyadmin.net/'),
452 Core
::linkURL('https://www.phpmyadmin.net/contribute/'),
459 Core
::linkURL('https://www.phpmyadmin.net/support/'),
464 __('List of changes'),
466 'changelog.php' . Url
::getCommon(),
473 'license.php' . Url
::getCommon(),
485 * mbstring is used for handling multibytes inside parser, so it is good
486 * to tell user something might be broken without it, see bug #1063149.
488 if (! @extension_loaded
('mbstring')) {
491 'The mbstring PHP extension was not found and you seem to be using'
492 . ' a multibyte charset. Without the mbstring extension phpMyAdmin'
493 . ' is unable to split strings correctly and it may result in'
494 . ' unexpected results.'
501 * Missing functionality
503 if (! extension_loaded('curl') && ! ini_get('allow_url_fopen')) {
506 'The curl extension was not found and allow_url_fopen is '
507 . 'disabled. Due to this some features such as error reporting '
508 . 'or version check are disabled.'
513 if ($cfg['LoginCookieValidityDisableWarning'] == false) {
515 * Check whether session.gc_maxlifetime limits session validity.
517 $gc_time = (int)@ini_get
('session.gc_maxlifetime');
518 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
521 'Your PHP parameter [a@https://secure.php.net/manual/en/session.' .
522 'configuration.php#ini.session.gc-maxlifetime@_blank]session.' .
523 'gc_maxlifetime[/a] is lower than cookie validity configured ' .
524 'in phpMyAdmin, because of this, your login might expire sooner ' .
525 'than configured in phpMyAdmin.'
533 * Check whether LoginCookieValidity is limited by LoginCookieStore.
535 if ($GLOBALS['cfg']['LoginCookieStore'] != 0
536 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']
540 'Login cookie store is lower than cookie validity configured in ' .
541 'phpMyAdmin, because of this, your login will expire sooner than ' .
542 'configured in phpMyAdmin.'
549 * Check if user does not have defined blowfish secret and it is being used.
551 if (! empty($_SESSION['encryption_key'])) {
552 if (empty($GLOBALS['cfg']['blowfish_secret'])) {
555 'The configuration file now needs a secret passphrase (blowfish_secret).'
559 } elseif (strlen($GLOBALS['cfg']['blowfish_secret']) < 32) {
562 'The secret passphrase in configuration (blowfish_secret) is too short.'
570 * Check for existence of config directory which should not exist in
571 * production environment.
573 if (@file_exists
('config')) {
576 'Directory [code]config[/code], which is used by the setup script, ' .
577 'still exists in your phpMyAdmin directory. It is strongly ' .
578 'recommended to remove it once phpMyAdmin has been configured. ' .
579 'Otherwise the security of your server may be compromised by ' .
580 'unauthorized people downloading your configuration.'
587 $cfgRelation = Relation
::getRelationsParam();
588 if (! $cfgRelation['allworks']
589 && $cfg['PmaNoRelation_DisableWarning'] == false
592 'The phpMyAdmin configuration storage is not completely '
593 . 'configured, some extended features have been deactivated. '
594 . '%sFind out why%s. '
596 if ($cfg['ZeroConf'] == true) {
597 $msg_text .= '<br>' .
599 'Or alternately go to \'Operations\' tab of any database '
600 . 'to set it up there.'
603 $msg = Message
::notice($msg_text);
604 $msg->addParamHtml('<a href="./chk_rel.php' . $common_url_query . '">');
605 $msg->addParamHtml('</a>');
606 /* Show error if user has configured something, notice elsewhere */
607 if (!empty($cfg['Servers'][$server]['pmadb'])) {
615 * Warning about Suhosin only if its simulation mode is not enabled
617 if ($cfg['SuhosinDisableWarning'] == false
618 && @ini_get
('suhosin.request.max_value_length')
619 && @ini_get
('suhosin.simulation') == '0'
624 'Server running with Suhosin. Please refer to %sdocumentation%s ' .
625 'for possible issues.'
634 /* Missing template cache */
635 if (is_null($GLOBALS['PMA_Config']->getTempDir('twig'))) {
638 __('The $cfg[\'TempDir\'] (%s) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.'),
639 $GLOBALS['PMA_Config']->get('TempDir')
646 * Warning about incomplete translations.
648 * The data file is created while creating release by ./scripts/remove-incomplete-mo
650 if (@file_exists
('libraries/language_stats.inc.php')) {
651 include 'libraries/language_stats.inc.php';
653 * This message is intentionally not translated, because we're
654 * handling incomplete translations here and focus on english
657 if (isset($GLOBALS['language_stats'][$lang])
658 && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
661 'You are using an incomplete translation, please help to make it '
662 . 'better by [a@https://www.phpmyadmin.net/translate/'
663 . '@_blank]contributing[/a].',