More concise descriptions for MySQL column types
[phpmyadmin.git] / main.php
blob6a0e2489ba9f6a8817df8edbd367231b10bcefe3
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /**
9 * Gets some core libraries and displays a top message if required
11 require_once 'libraries/common.inc.php';
13 /**
14 * display Git revision if requested
16 require_once 'libraries/display_git_revision.lib.php';
18 if ($GLOBALS['PMA_Config']->isGitRevision()) {
19 if (isset($_REQUEST['git_revision']) && $GLOBALS['is_ajax_request'] == true) {
20 PMA_printGitRevision();
22 PMA_AddJSVar('is_git_revision', true);
25 // Handles some variables that may have been sent by the calling script
26 $GLOBALS['db'] = '';
27 $GLOBALS['table'] = '';
28 $show_query = '1';
29 require_once 'libraries/header.inc.php';
31 // Any message to display?
32 if (! empty($message)) {
33 PMA_showMessage($message);
34 unset($message);
37 $common_url_query = PMA_generate_common_url('', '');
39 // when $server > 0, a server has been chosen so we can display
40 // all MySQL-related information
41 if ($server > 0) {
42 include 'libraries/server_common.inc.php';
43 include 'libraries/StorageEngine.class.php';
44 include 'libraries/server_links.inc.php';
46 // Use the verbose name of the server instead of the hostname
47 // if a value is set
48 $server_info = '';
49 if (! empty($cfg['Server']['verbose'])) {
50 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
51 if ($GLOBALS['cfg']['ShowServerInfo']) {
52 $server_info .= ' (';
55 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
56 $server_info .= PMA_DBI_get_host_info();
58 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
59 $server_info .= ')';
61 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
63 // should we add the port info here?
64 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
65 ? $GLOBALS['cfg']['Server']['verbose']
66 : $GLOBALS['cfg']['Server']['host']);
69 echo '<div id="maincontainer">' . "\n";
70 echo '<div id="main_pane_left">';
71 if ($server > 0
72 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)
73 ) {
74 echo '<div class="group">';
75 echo '<h2>' . __('General Settings') . '</h2>';
76 echo '<ul>';
78 /**
79 * Displays the MySQL servers choice form
81 if (! $cfg['LeftDisplayServers']
82 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)
83 ) {
84 echo '<li id="li_select_server">';
85 include_once 'libraries/select_server.lib.php';
86 PMA_select_server(true, true);
87 echo '</li>';
90 /**
91 * Displays the mysql server related links
93 if ($server > 0 && !PMA_DRIZZLE) {
94 include_once 'libraries/check_user_privileges.lib.php';
96 // Logout for advanced authentication
97 if ($cfg['Server']['auth_type'] != 'config') {
98 if ($cfg['ShowChgPassword']) {
99 if ($GLOBALS['cfg']['AjaxEnable']) {
100 $conditional_class = 'ajax';
101 } else {
102 $conditional_class = null;
104 PMA_printListItem(
105 __('Change password'),
106 'li_change_password',
107 'user_password.php?' . $common_url_query,
108 null,
109 null,
110 'change_password_anchor',
111 null,
112 $conditional_class
115 } // end if
116 echo ' <li id="li_select_mysql_collation">';
117 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
118 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
119 . ' <label for="select_collation_connection">' . "\n"
120 . ' ' . __('Server connection collation') . "\n"
121 // put the doc link in the form so that it appears on the same line
122 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
123 . ' </label>' . "\n"
125 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
126 . ' </form>' . "\n"
127 . ' </li>' . "\n";
128 } // end of if ($server > 0 && !PMA_DRIZZLE)
129 echo '</ul>';
130 echo '</div>';
133 echo '<div class="group">';
134 echo '<h2>' . __('Appearance Settings') . '</h2>';
135 echo ' <ul>';
137 // Displays language selection combo
138 if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
139 echo '<li id="li_select_lang">';
140 include_once 'libraries/display_select_lang.lib.php';
141 PMA_select_language();
142 echo '</li>';
145 // ThemeManager if available
147 if ($GLOBALS['cfg']['ThemeManager']) {
148 echo '<li id="li_select_theme">';
149 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
150 echo '</li>';
152 echo '<li id="li_select_fontsize">';
153 echo PMA_Config::getFontsizeForm();
154 echo '</li>';
156 echo '</ul>';
158 // User preferences
160 if ($server > 0) {
161 echo '<ul>';
162 echo PMA_printListItem(
163 __('More settings'),
164 'li_user_preferences',
165 'prefs_manage.php?' . $common_url_query
167 echo '</ul>';
170 echo '</div>';
173 echo '</div>';
174 echo '<div id="main_pane_right">';
177 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
178 echo '<div class="group">';
179 echo '<h2>' . __('Database server') . '</h2>';
180 echo '<ul>' . "\n";
181 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
182 PMA_printListItem(__('Software') . ': ' . PMA_getServerType(), 'li_server_type');
183 PMA_printListItem(__('Software version') . ': ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT, 'li_server_version');
184 PMA_printListItem(
185 __('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
186 'li_mysql_proto'
188 PMA_printListItem(
189 __('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
190 'li_user_info'
193 echo ' <li id="li_select_mysql_charset">';
194 echo ' ' . __('Server charset') . ': '
195 . ' <span lang="en" dir="ltr">'
196 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']] . "\n"
197 . ' (' . $mysql_charset_map['utf-8'] . ')' . "\n"
198 . ' </span>' . "\n"
199 . ' </li>' . "\n";
200 echo ' </ul>';
201 echo ' </div>';
204 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
205 echo '<div class="group">';
206 echo '<h2>' . __('Web server') . '</h2>';
207 echo '<ul>';
208 if ($GLOBALS['cfg']['ShowServerInfo']) {
209 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
211 if ($server > 0) {
212 $client_version_str = PMA_DBI_get_client_info();
213 if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
214 && in_array($GLOBALS['cfg']['Server']['extension'], array('mysql', 'mysqli'))
216 $client_version_str = 'libmysql - ' . $client_version_str;
218 PMA_printListItem(
219 __('Database client version') . ': ' . $client_version_str,
220 'li_mysql_client_version'
222 PMA_printListItem(
223 __('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension']. ' '
224 . PMA_showPHPDocu('book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'),
225 'li_used_php_extension'
230 if ($cfg['ShowPhpInfo']) {
231 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', 'phpinfo.php?' . $common_url_query);
233 echo ' </ul>';
234 echo ' </div>';
237 echo '<div class="group pmagroup">';
238 echo '<h2>phpMyAdmin</h2>';
239 echo '<ul>';
240 $class = null;
241 // We rely on CSP to allow access to http://www.phpmyadmin.net, but IE lacks
242 // support here and does not allow request to http once using https.
243 if ($GLOBALS['cfg']['VersionCheck'] && (! $GLOBALS['PMA_Config']->get('is_https') || PMA_USR_BROWSER_AGENT != 'IE')) {
244 $class = 'jsversioncheck';
246 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version', null, null, null, null, $class);
247 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
248 PMA_printListItem(__('Wiki'), 'li_pma_wiki', PMA_linkURL('http://wiki.phpmyadmin.net/'), null, '_blank');
250 // does not work if no target specified, don't know why
251 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', PMA_linkURL('http://www.phpMyAdmin.net/'), null, '_blank');
252 PMA_printListItem(__('Contribute'), 'li_pma_contribute', PMA_linkURL('http://www.phpmyadmin.net/home_page/improve.php'), null, '_blank');
253 PMA_printListItem(__('Get support'), 'li_pma_support', PMA_linkURL('http://www.phpmyadmin.net/home_page/support.php'), null, '_blank');
254 PMA_printListItem(__('List of changes'), 'li_pma_changes', PMA_linkURL('changelog.php'), null, '_blank');
256 </ul>
257 </div>
259 </div>
261 <?php
263 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
264 * full height of the inner divs
267 <br class="clearfloat" />
268 <br class="clearfloat" />
269 </div>
271 <?php
273 * Warning if using the default MySQL privileged account
275 if ($server != 0
276 && $cfg['Server']['user'] == 'root'
277 && $cfg['Server']['password'] == ''
279 trigger_error(__('Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user \'root\'.'), E_USER_WARNING);
283 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
284 * break it, see bug 1063821.
286 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
287 trigger_error(__('You have enabled mbstring.func_overload in your PHP configuration. This option is incompatible with phpMyAdmin and might cause some data to be corrupted!'), E_USER_WARNING);
291 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
292 * to tell user something might be broken without it, see bug #1063149.
294 if (! @extension_loaded('mbstring')) {
295 trigger_error(__('The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.'), E_USER_WARNING);
299 * Check whether session.gc_maxlifetime limits session validity.
301 $gc_time = (int)@ini_get('session.gc_maxlifetime');
302 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
303 trigger_error(__('Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@]session.gc_maxlifetime[/a] is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'), E_USER_WARNING);
307 * Check whether LoginCookieValidity is limited by LoginCookieStore.
309 if ($GLOBALS['cfg']['LoginCookieStore'] != 0 && $GLOBALS['cfg']['LoginCookieStore'] < $GLOBALS['cfg']['LoginCookieValidity']) {
310 trigger_error(__('Login cookie store is lower than cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.'), E_USER_WARNING);
314 * Check if user does not have defined blowfish secret and it is being used.
316 if (! empty($_SESSION['auto_blowfish_secret'])
317 && empty($GLOBALS['cfg']['blowfish_secret'])
319 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
323 * Check for existence of config directory which should not exist in
324 * production environment.
326 if (file_exists('config')) {
327 trigger_error(__('Directory [code]config[/code], which is used by the setup script, still exists in your phpMyAdmin directory. You should remove it once phpMyAdmin has been configured.'), E_USER_WARNING);
330 if ($server > 0) {
331 $cfgRelation = PMA_getRelationsParam();
332 if (! $cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
333 $message = PMA_Message::notice(__('The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click %shere%s.'));
334 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
335 $message->addParam('</a>', false);
336 /* Show error if user has configured something, notice elsewhere */
337 if (!empty($cfg['Servers'][$server]['pmadb'])) {
338 $message->isError(true);
340 $message->display();
341 } // end if
345 * Warning about different MySQL library and server version
346 * (a difference on the third digit does not count).
347 * If someday there is a constant that we can check about mysqlnd, we can use it instead
348 * of strpos().
349 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
350 * Drizzle can speak MySQL protocol, so don't warn about version mismatch for Drizzle servers.
352 if (function_exists('PMA_DBI_get_client_info') && !PMA_DRIZZLE) {
353 $_client_info = PMA_DBI_get_client_info();
354 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
355 trigger_error(
356 PMA_sanitize(
357 sprintf(
358 __('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
359 $_client_info,
360 substr(
361 PMA_MYSQL_STR_VERSION,
363 strpos(PMA_MYSQL_STR_VERSION . '-', '-')
367 E_USER_NOTICE
370 unset($_client_info);
374 * Warning about Suhosin
376 if ($cfg['SuhosinDisableWarning'] == false
377 && @ini_get('suhosin.request.max_value_length')
379 trigger_error(
380 sprintf(
381 __('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'),
382 '[a@./Documentation.html#faq1_38@_blank]',
383 '[/a]'
385 E_USER_WARNING
390 * Warning about mcrypt.
392 if (!function_exists('mcrypt_encrypt') && !$GLOBALS['cfg']['McryptDisableWarning']) {
393 PMA_warnMissingExtension('mcrypt');
397 * Warning about incomplete translations.
399 * The data file is created while creating release by ./scripts/remove-incomplete-mo
401 if (file_exists('libraries/language_stats.inc.php')) {
402 include 'libraries/language_stats.inc.php';
404 * This message is intentionally not translated, because we're
405 * handling incomplete translations here and focus on english
406 * speaking users.
408 if (isset($GLOBALS['language_stats'][$lang]) && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']) {
409 trigger_error('You are using an incomplete translation, please help to make it better by <a href="http://www.phpmyadmin.net/home_page/improve.php#translate" target="_blank">contributing</a>.', E_USER_NOTICE);
414 * prints list item for main page
416 * @param string $name displayed text
417 * @param string $id id, used for css styles
418 * @param string $url make item as link with $url as target
419 * @param string $mysql_help_page display a link to MySQL's manual
420 * @param string $target special target for $url
421 * @param string $a_id id for the anchor, used for jQuery to hook in functions
422 * @param string $class class for the li element
423 * @param string $a_class class for the anchor element
425 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null)
427 echo '<li id="' . $id . '"';
428 if (null !== $class) {
429 echo ' class="' . $class . '"';
431 echo '>';
432 if (null !== $url) {
433 echo '<a href="' . $url . '"';
434 if (null !== $target) {
435 echo ' target="' . $target . '"';
437 if (null != $a_id) {
438 echo ' id="' . $a_id .'"';
440 if (null != $a_class) {
441 echo ' class="' . $a_class .'"';
443 echo '>';
446 echo $name;
448 if (null !== $url) {
449 echo '</a>' . "\n";
451 if (null !== $mysql_help_page) {
452 echo PMA_showMySQLDocu('', $mysql_help_page);
454 echo '</li>';
458 * Displays the footer
460 require 'libraries/footer.inc.php';