Translation update done using Pootle.
[phpmyadmin.git] / main.php
blobf81b0e46fc3ccb06f051b154e387379261a4bcf7
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 define('PMA_COLORPICKER', true);
12 require_once './libraries/common.inc.php';
14 $GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
15 $GLOBALS['js_include'][] = 'main_custom_color.js';
17 // Handles some variables that may have been sent by the calling script
18 $GLOBALS['db'] = '';
19 $GLOBALS['table'] = '';
20 $show_query = '1';
21 require_once './libraries/header.inc.php';
23 // Any message to display?
24 if (! empty($message)) {
25 PMA_showMessage($message);
26 unset($message);
29 $common_url_query = PMA_generate_common_url('', '');
31 // when $server > 0, a server has been chosen so we can display
32 // all MySQL-related information
33 if ($server > 0) {
34 require './libraries/server_common.inc.php';
35 require './libraries/StorageEngine.class.php';
36 require './libraries/server_links.inc.php';
38 // Use the verbose name of the server instead of the hostname
39 // if a value is set
40 $server_info = '';
41 if (! empty($cfg['Server']['verbose'])) {
42 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
43 if ($GLOBALS['cfg']['ShowServerInfo']) {
44 $server_info .= ' (';
47 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
48 $server_info .= PMA_DBI_get_host_info();
50 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
51 $server_info .= ')';
53 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
55 // should we add the port info here?
56 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
57 ? $GLOBALS['cfg']['Server']['verbose']
58 : $GLOBALS['cfg']['Server']['host']);
61 echo '<div id="maincontainer">' . "\n";
62 echo '<div id="main_pane_left">';
63 if ($server > 0
64 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)) {
65 echo '<div class="group">';
66 echo '<h2>' . __('General Settings') . '</h2>';
67 echo '<ul>';
69 /**
70 * Displays the MySQL servers choice form
72 if (! $cfg['LeftDisplayServers']
73 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
74 echo '<li id="li_select_server">';
75 require_once './libraries/select_server.lib.php';
76 PMA_select_server(true, true);
77 echo '</li>';
80 /**
81 * Displays the mysql server related links
83 if ($server > 0) {
84 require_once './libraries/check_user_privileges.lib.php';
86 // Logout for advanced authentication
87 if ($cfg['Server']['auth_type'] != 'config') {
88 if ($cfg['ShowChgPassword']) {
89 PMA_printListItem(__('Change password'), 'li_change_password',
90 './user_password.php?' . $common_url_query);
92 } // end if
93 echo ' <li id="li_select_mysql_collation">';
94 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
95 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
96 . ' <label for="select_collation_connection">' . "\n"
97 . ' ' . __('MySQL connection collation') . "\n"
98 // put the doc link in the form so that it appears on the same line
99 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . ': ' . "\n"
100 . ' </label>' . "\n"
102 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
103 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
104 . ' </form>' . "\n"
105 . ' </li>' . "\n";
106 } // end of if ($server > 0)
107 echo '</ul>';
108 echo '</div>';
111 echo '<div class="group">';
112 echo '<h2>' . __('Appearance Settings') . '</h2>';
113 echo ' <ul>';
115 // Displays language selection combo
116 if (empty($cfg['Lang'])) {
117 echo '<li id="li_select_lang">';
118 require_once './libraries/display_select_lang.lib.php';
119 PMA_select_language();
120 echo '</li>';
123 // ThemeManager if available
125 if ($GLOBALS['cfg']['ThemeManager']) {
126 echo '<li id="li_select_theme">';
127 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
128 echo '</li>';
130 // see js/main_custom_color.js
131 echo '<li id="li_custom_color" class="hide">';
132 echo PMA_escapeJsString(__('Background color')) . ': ';
133 echo '<input type="submit" name="custom_color_choose" value="' . __('Choose...') . '" />';
134 echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
135 echo PMA_generate_common_hidden_inputs();
136 echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
137 echo '<input type="submit" name="custom_color_reset" value="' . __('Reset') . '" />';
138 echo '</form>';
139 echo '</li>';
141 echo '<li id="li_select_fontsize">';
142 echo PMA_Config::getFontsizeForm();
143 echo '</li>';
145 echo '</ul>';
146 echo '</div>';
149 echo '</div>';
150 echo '<div id="main_pane_right">';
153 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
154 echo '<div class="group">';
155 echo '<h2>MySQL</h2>';
156 echo '<ul>' . "\n";
157 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
158 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
159 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
160 'li_mysql_proto');
161 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
162 'li_user_info');
164 echo ' <li id="li_select_mysql_charset">';
165 echo ' ' . __('MySQL charset') . ': '
166 . ' <span xml:lang="en" dir="ltr">'
167 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
168 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
169 . ' </span>' . "\n"
170 . ' </li>' . "\n";
171 echo ' </ul>';
172 echo ' </div>';
175 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
176 echo '<div class="group">';
177 echo '<h2>' . __('Web server') . '</h2>';
178 echo '<ul>';
179 if ($GLOBALS['cfg']['ShowServerInfo']) {
180 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
182 if ($server > 0) {
183 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
184 'li_mysql_client_version');
185 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'],
186 'li_used_php_extension');
190 if ($cfg['ShowPhpInfo']) {
191 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
193 echo ' </ul>';
194 echo ' </div>';
197 echo '<div class="group">';
198 echo '<h2>phpMyAdmin</h2>';
199 echo '<ul>';
200 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version');
201 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
202 PMA_printListItem(__('Wiki'), 'li_pma_wiki', 'http://wiki.phpmyadmin.net', null, '_blank');
204 // does not work if no target specified, don't know why
205 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
207 <li><bdo xml:lang="en" dir="ltr">
208 [<a href="changelog.php" target="_blank">ChangeLog</a>]
209 [<a href="http://phpmyadmin.git.sourceforge.net/git/gitweb-index.cgi"
210 target="_blank">Git</a>]
211 [<a href="http://sourceforge.net/mail/?group_id=23067"
212 target="_blank"><?php echo __('Mailing lists'); ?></a>]
213 </bdo>
214 </li>
215 </ul>
216 </div>
218 </div>
220 <?php
222 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
223 * full height of the inner divs
226 <br class="clearfloat" />
227 <br class="clearfloat" />
228 </div>
230 <?php
232 * Warning if using the default MySQL privileged account
233 * modified: 2004-05-05 mkkeck
235 if ($server != 0
236 && $cfg['Server']['user'] == 'root'
237 && $cfg['Server']['password'] == '') {
238 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);
242 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
243 * break it, see bug 1063821.
245 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
246 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);
250 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
251 * to tell user something might be broken without it, see bug #1063149.
253 if (! @extension_loaded('mbstring')) {
254 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);
258 * Check whether session.gc_maxlifetime limits session validity.
260 $gc_time = (int)@ini_get('session.gc_maxlifetime');
261 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
262 trigger_error(PMA_Message::decodeBB(__('Your PHP parameter [a@http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime@]session.gc_maxlifetime[/a] is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.')), E_USER_WARNING);
266 * Check if user does not have defined blowfish secret and it is being used.
268 if (!empty($_SESSION['auto_blowfish_secret']) &&
269 empty($GLOBALS['cfg']['blowfish_secret'])) {
270 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
274 * Check for existence of config directory which should not exist in
275 * production environment.
277 if (file_exists('./config')) {
278 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);
282 * Check whether relations are supported.
284 if ($server > 0) {
285 $cfgRelation = PMA_getRelationsParam();
286 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
287 $message = PMA_Message::notice(__('The additional features for working with linked tables have been deactivated. To find out why click %shere%s.'));
288 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
289 $message->addParam('</a>', false);
290 /* Show error if user has configured something, notice elsewhere */
291 if (!empty($cfg['Servers'][$server]['pmadb'])) {
292 $message->isError(true);
294 $message->display();
295 } // end if
299 * Show warning when javascript support is missing.
301 echo '<noscript>';
302 $message = PMA_Message::notice(__('Javascript support is missing or disabled in your browser, some phpMyAdmin functionality will be missing. For example navigation frame will not refresh automatically.'));
303 $message->isError(true);
304 $message->display();
305 echo '</noscript>';
308 * Warning about different MySQL library and server version
309 * (a difference on the third digit does not count).
310 * If someday there is a constant that we can check about mysqlnd, we can use it instead
311 * of strpos().
312 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
314 if (function_exists('PMA_DBI_get_client_info')) {
315 $_client_info = PMA_DBI_get_client_info();
316 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
317 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
318 $_client_info,
319 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
320 E_USER_NOTICE);
322 unset($_client_info);
326 * Warning about Suhosin
328 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
329 trigger_error(PMA_sanitize(sprintf(__('Server running with Suhosin. Please refer to %sdocumentation%s for possible issues.'), '[a@./Documentation.html#faq1_38@_blank]', '[/a]')), E_USER_WARNING);
333 * prints list item for main page
335 * @param string $name displayed text
336 * @param string $id id, used for css styles
337 * @param string $url make item as link with $url as target
338 * @param string $mysql_help_page display a link to MySQL's manual
339 * @param string $target special target for $url
341 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
343 echo '<li id="' . $id . '">';
344 if (null !== $url) {
345 echo '<a href="' . $url . '"';
346 if (null !== $target) {
347 echo ' target="' . $target . '"';
349 echo '>';
352 echo $name;
354 if (null !== $url) {
355 echo '</a>' . "\n";
357 if (null !== $mysql_help_page) {
358 echo PMA_showMySQLDocu('', $mysql_help_page);
360 echo '</li>';
364 * Displays the footer
366 require './libraries/footer.inc.php';