Merge remote branch 'pootle/master'
[phpmyadmin/nijel.git] / main.php
blob360e9888172b8dbee4b1e81b2607eded258ed834
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
10 * Gets some core libraries and displays a top message if required
12 define('PMA_COLORPICKER', true);
13 require_once './libraries/common.inc.php';
15 $GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
16 $GLOBALS['js_include'][] = 'main_custom_color.js';
18 // Handles some variables that may have been sent by the calling script
19 $GLOBALS['db'] = '';
20 $GLOBALS['table'] = '';
21 $show_query = '1';
22 require_once './libraries/header.inc.php';
24 // Any message to display?
25 if (! empty($message)) {
26 PMA_showMessage($message);
27 unset($message);
30 $common_url_query = PMA_generate_common_url('', '');
32 // when $server > 0, a server has been chosen so we can display
33 // all MySQL-related information
34 if ($server > 0) {
35 require './libraries/server_common.inc.php';
36 require './libraries/StorageEngine.class.php';
37 require './libraries/server_links.inc.php';
39 // Use the verbose name of the server instead of the hostname
40 // if a value is set
41 $server_info = '';
42 if (! empty($cfg['Server']['verbose'])) {
43 $server_info .= htmlspecialchars($cfg['Server']['verbose']);
44 if ($GLOBALS['cfg']['ShowServerInfo']) {
45 $server_info .= ' (';
48 if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
49 $server_info .= PMA_DBI_get_host_info();
51 if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
52 $server_info .= ')';
54 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
56 // should we add the port info here?
57 $short_server_info = (!empty($GLOBALS['cfg']['Server']['verbose'])
58 ? $GLOBALS['cfg']['Server']['verbose']
59 : $GLOBALS['cfg']['Server']['host']);
62 echo '<div id="maincontainer">' . "\n";
63 echo '<div id="main_pane_left">';
65 if ($server > 0
66 || (! $cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1)) {
67 echo '<div class="group">';
68 echo '<h2>' . __('Actions') . '</h2>';
69 echo '<ul>';
71 /**
72 * Displays the MySQL servers choice form
74 if (! $cfg['LeftDisplayServers']
75 && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
76 echo '<li id="li_select_server">';
77 require_once './libraries/select_server.lib.php';
78 PMA_select_server(true, true);
79 echo '</li>';
82 /**
83 * Displays the mysql server related links
85 if ($server > 0) {
86 require_once './libraries/check_user_privileges.lib.php';
88 // Logout for advanced authentication
89 if ($cfg['Server']['auth_type'] != 'config') {
90 if ($cfg['ShowChgPassword']) {
91 PMA_printListItem(__('Change password'), 'li_change_password',
92 './user_password.php?' . $common_url_query);
95 $http_logout = ($cfg['Server']['auth_type'] == 'http')
96 ? '<a href="./Documentation.html#login_bug" target="documentation">'
97 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
98 : '';
99 PMA_printListItem('<strong>' . __('Log out') . '</strong> ' . $http_logout,
100 'li_log_out',
101 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
102 } // end if
103 } // end of if ($server > 0)
105 echo '</ul>';
106 echo '</div>';
110 if ($server > 0) {
111 echo '<div class="group">';
112 echo '<h2>MySQL ' . $short_server_info . '</h2>';
113 echo '<ul>' . "\n";
115 if ($cfg['ShowCreateDb']) {
116 echo '<li id="li_create_database">';
117 require './libraries/display_create_database.lib.php';
118 echo '</li>' . "\n";
121 echo ' <li id="li_select_mysql_collation">';
122 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
123 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
124 . ' <label for="select_collation_connection">' . "\n"
125 . ' ' . __('MySQL connection collation') . ': ' . "\n"
126 . ' </label>' . "\n"
127 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, 4, true)
128 . ' <noscript><input type="submit" value="' . __('Go') . '" /></noscript>' . "\n"
129 // put the doc link in the form so that it appears on the same line
130 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
131 . ' </form>' . "\n"
132 . ' </li>' . "\n";
134 echo ' </ul>';
135 echo ' </div>';
138 echo '<div class="group">';
139 echo '<h2>' . __('Interface') . '</h2>';
140 echo ' <ul>';
142 // Displays language selection combo
143 if (empty($cfg['Lang'])) {
144 echo '<li id="li_select_lang">';
145 require_once './libraries/display_select_lang.lib.php';
146 PMA_select_language();
147 echo '</li>';
150 // ThemeManager if available
152 if ($GLOBALS['cfg']['ThemeManager']) {
153 echo '<li id="li_select_theme">';
154 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
155 echo '</li>';
157 // see js/main_custom_color.js
158 echo '<li id="li_custom_color" class="hide">';
159 echo PMA_escapeJsString(__('Custom color')) . ': ';
160 echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
161 echo PMA_generate_common_hidden_inputs();
162 echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
163 echo '<input type="submit" name="custom_color_reset" value="' . __('Reset') . '" />';
164 echo '</form>';
165 echo '<div id="colorSelector">';
166 echo '</div>';
167 echo '</li>';
169 echo '<li id="li_select_fontsize">';
170 echo PMA_Config::getFontsizeForm();
171 echo '</li>';
173 echo '</ul>';
174 echo '</div>';
177 echo '</div>';
178 echo '<div id="main_pane_right">';
181 if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
182 echo '<div class="group">';
183 echo '<h2>MySQL</h2>';
184 echo '<ul>' . "\n";
185 PMA_printListItem(__('Server') . ': ' . $server_info, 'li_server_info');
186 PMA_printListItem(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION, 'li_server_version');
187 PMA_printListItem(__('Protocol version') . ': ' . PMA_DBI_get_proto_info(),
188 'li_mysql_proto');
189 PMA_printListItem(__('User') . ': ' . htmlspecialchars($mysql_cur_user_and_host),
190 'li_user_info');
192 echo ' <li id="li_select_mysql_charset">';
193 echo ' ' . __('MySQL charset') . ': '
194 . ' <span xml:lang="en" dir="ltr">'
195 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
196 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
197 . ' </span>' . "\n"
198 . ' </li>' . "\n";
199 echo ' </ul>';
200 echo ' </div>';
203 if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
204 echo '<div class="group">';
205 echo '<h2>' . __('Web server') . '</h2>';
206 echo '<ul>';
207 if ($GLOBALS['cfg']['ShowServerInfo']) {
208 PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');
210 if ($server > 0) {
211 PMA_printListItem(__('MySQL client version') . ': ' . PMA_DBI_get_client_info(),
212 'li_mysql_client_version');
213 PMA_printListItem(__('PHP extension') . ': ' . $GLOBALS['cfg']['Server']['extension'],
214 'li_used_php_extension');
218 if ($cfg['ShowPhpInfo']) {
219 PMA_printListItem(__('Show PHP information'), 'li_phpinfo', './phpinfo.php?' . $common_url_query);
221 echo ' </ul>';
222 echo ' </div>';
225 echo '<div class="group">';
226 echo '<h2>phpMyAdmin</h2>';
227 echo '<ul>';
228 PMA_printListItem(__('Version information') . ': ' . PMA_VERSION, 'li_pma_version');
229 PMA_printListItem(__('Documentation'), 'li_pma_docs', 'Documentation.html', null, '_blank');
230 PMA_printListItem(__('Wiki'), 'li_pma_wiki', 'http://wiki.phpmyadmin.net', null, '_blank');
232 // does not work if no target specified, don't know why
233 PMA_printListItem(__('Official Homepage'), 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank');
235 <li><bdo xml:lang="en" dir="ltr">
236 [<a href="changelog.php" target="_blank">ChangeLog</a>]
237 [<a href="http://phpmyadmin.git.sourceforge.net/git/gitweb-index.cgi"
238 target="_blank">Git</a>]
239 [<a href="http://sourceforge.net/mail/?group_id=23067"
240 target="_blank">Lists</a>]
241 </bdo>
242 </li>
243 </ul>
244 </div>
246 </div>
248 <?php
250 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
251 * full height of the inner divs
254 <br class="clearfloat" />
255 <br class="clearfloat" />
256 </div>
258 <?php
260 * Warning if using the default MySQL privileged account
261 * modified: 2004-05-05 mkkeck
263 if ($server != 0
264 && $cfg['Server']['user'] == 'root'
265 && $cfg['Server']['password'] == '') {
266 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);
270 * Nijel: As we try to handle charsets by ourself, mbstring overloads just
271 * break it, see bug 1063821.
273 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
274 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);
278 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
279 * to tell user something might be broken without it, see bug #1063149.
281 if (! @extension_loaded('mbstring')) {
282 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);
286 * Check whether session.gc_maxlifetime limits session validity.
288 $gc_time = (int)@ini_get('session.gc_maxlifetime');
289 if ($gc_time < $GLOBALS['cfg']['LoginCookieValidity'] ) {
290 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);
294 * Check if user does not have defined blowfish secret and it is being used.
296 if (!empty($_SESSION['auto_blowfish_secret']) &&
297 empty($GLOBALS['cfg']['blowfish_secret'])) {
298 trigger_error(__('The configuration file now needs a secret passphrase (blowfish_secret).'), E_USER_WARNING);
302 * Check for existence of config directory which should not exist in
303 * production environment.
305 if (file_exists('./config')) {
306 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);
310 * Check whether relations are supported.
312 if ($server > 0) {
313 require_once './libraries/relation.lib.php';
314 $cfgRelation = PMA_getRelationsParam();
315 if(!$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {
316 $message = PMA_Message::notice(__('The additional features for working with linked tables have been deactivated. To find out why click %shere%s.'));
317 $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">', false);
318 $message->addParam('</a>', false);
319 /* Show error if user has configured something, notice elsewhere */
320 if (!empty($cfg['Servers'][$server]['pmadb'])) {
321 $message->isError(true);
323 $message->display();
324 } // end if
328 * Show warning when javascript support is missing.
330 echo '<noscript>';
331 $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.'));
332 $message->isError(true);
333 $message->display();
334 echo '</noscript>';
337 * Warning about different MySQL library and server version
338 * (a difference on the third digit does not count).
339 * If someday there is a constant that we can check about mysqlnd, we can use it instead
340 * of strpos().
341 * If no default server is set, PMA_DBI_get_client_info() is not defined yet.
343 if (function_exists('PMA_DBI_get_client_info')) {
344 $_client_info = PMA_DBI_get_client_info();
345 if ($server > 0 && strpos($_client_info, 'mysqlnd') === false && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)) {
346 trigger_error(PMA_sanitize(sprintf(__('Your PHP MySQL library version %s differs from your MySQL server version %s. This may cause unpredictable behavior.'),
347 $_client_info,
348 substr(PMA_MYSQL_STR_VERSION, 0, strpos(PMA_MYSQL_STR_VERSION . '-', '-')))),
349 E_USER_NOTICE);
351 unset($_client_info);
355 * Warning about Suhosin
357 if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_value_length')) {
358 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);
362 * prints list item for main page
364 * @param string $name displayed text
365 * @param string $id id, used for css styles
366 * @param string $url make item as link with $url as target
367 * @param string $mysql_help_page display a link to MySQL's manual
368 * @param string $target special target for $url
370 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
372 echo '<li id="' . $id . '">';
373 if (null !== $url) {
374 echo '<a href="' . $url . '"';
375 if (null !== $target) {
376 echo ' target="' . $target . '"';
378 echo '>';
381 echo $name;
383 if (null !== $url) {
384 echo '</a>' . "\n";
386 if (null !== $mysql_help_page) {
387 echo PMA_showMySQLDocu('', $mysql_help_page);
389 echo '</li>';
393 * Displays the footer
395 require_once './libraries/footer.inc.php';