bug #1504662, server message for http auth_type
[phpmyadmin/crack.git] / main.php
blobbd390cccd63b48d69856023e5b4b0f65a2a3774c
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Don't display the page heading
7 */
8 if (!defined('PMA_DISPLAY_HEADING')) {
9 define('PMA_DISPLAY_HEADING', 0);
12 /**
13 * Gets some core libraries and displays a top message if required
15 require_once('./libraries/common.lib.php');
17 // Handles some variables that may have been sent by the calling script
18 if (isset($db)) {
19 unset($db);
21 if (isset($table)) {
22 unset($table);
24 $show_query = '1';
25 require_once('./libraries/header.inc.php');
27 // Any message to display?
28 if ( ! empty( $message ) ) {
29 PMA_showMessage( $message );
30 unset( $message );
33 $common_url_query = PMA_generate_common_url( '', '' );
35 // this div is required for containing divs can be 50%
36 echo '<div id="maincontainer">' . "\n";
38 /**
39 * Displays the mysql server related links
41 if ( $server > 0 ) {
43 require_once('./libraries/check_user_privileges.lib.php');
44 // why this? a non-priv user should be able to change his
45 // password if the configuration permits
46 //$cfg['ShowChgPassword'] = $is_superuser = PMA_isSuperuser();
47 $is_superuser = PMA_isSuperuser();
49 if ($cfg['Server']['auth_type'] == 'config') {
50 $cfg['ShowChgPassword'] = FALSE;
55 <div id="mysqlmaininformation">
56 <?php
57 if ( $server > 0 ) {
58 // robbat2: Use the verbose name of the server instead of the hostname
59 // if a value is set
60 $server_info = '';
61 if (!empty($cfg['Server']['verbose'])) {
62 $server_info .= $cfg['Server']['verbose'];
63 $server_info .= ' (';
65 $server_info .= PMA_DBI_get_host_info();
67 if (!empty($cfg['Server']['verbose'])) {
68 $server_info .= ')';
70 // loic1: skip this because it's not a so good idea to display sockets
71 // used to everybody
72 // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
73 // $server_info .= ':' . $cfg['Server']['socket'];
74 // }
75 $mysql_cur_user_and_host = PMA_DBI_fetch_value('SELECT USER();');
77 echo '<h1 xml:lang="en" dir="ltr">MySQL - ' . PMA_MYSQL_STR_VERSION
78 .'</h1>' . "\n";
79 } else {
80 // Case when no server selected
81 echo '<h1 xml:lang="en" dir="ltr">MySQL</h1>' . "\n";
84 /**
85 * Displays the MySQL servers choice form
87 if (!$cfg['LeftDisplayServers'] && (count($cfg['Servers']) > 1 || $server == 0 && count($cfg['Servers']) == 1)) {
88 include('./libraries/select_server.lib.php');
89 PMA_select_server(TRUE, FALSE);
92 if ( $server > 0 ) {
93 echo '<ul>' . "\n";
95 PMA_printListItem( $strProtocolVersion . ': ' . PMA_DBI_get_proto_info(),
96 'li_mysql_proto' );
97 PMA_printListItem( $strServer . ': ' . $server_info, 'li_server_info' );
98 PMA_printListItem( $strUser . ': ' . htmlspecialchars( $mysql_cur_user_and_host ),
99 'li_user_info' );
101 if ( $cfg['AllowAnywhereRecoding'] && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
102 echo '<li id="li_select_mysql_charset">';
104 <form method="post" action="index.php" target="_parent">
105 <input type="hidden" name="server" value="<?php echo $server; ?>" />
106 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
107 <?php echo $strMySQLCharset;?>:
108 <select name="convcharset" xml:lang="en" dir="ltr"
109 onchange="this.form.submit();">
110 <?php
111 foreach ($cfg['AvailableCharsets'] as $tmpcharset) {
112 if ($convcharset == $tmpcharset) {
113 $selected = ' selected="selected"';
114 } else {
115 $selected = '';
117 echo ' '
118 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
121 </select>
122 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
123 </form>
124 </li>
125 <?php
126 } elseif ( PMA_MYSQL_INT_VERSION >= 40100 ) {
127 echo ' <li id="li_select_mysql_charset">';
128 echo ' ' . $strMySQLCharset . ': '
129 . ' <strong xml:lang="en" dir="ltr">'
130 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
131 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
132 . ' </strong>' . "\n"
133 . ' </li>' . "\n"
134 . ' <li id="li_select_mysql_collation">';
135 echo ' <form method="post" action="index.php" target="_parent">' . "\n"
136 . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
137 . ' <label for="select_collation_connection">' . "\n"
138 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
139 . ' </label>' . "\n"
140 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, TRUE, 4, TRUE)
141 . ' <noscript><input type="submit" value="' . $strGo . '" /></noscript>' . "\n"
142 // put the doc link in the form so that it appears on the same line
143 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
144 . ' </form>' . "\n"
145 . ' </li>' . "\n";
148 if ($cfg['ShowCreateDb']) {
149 echo '<li id="li_create_database">';
150 require('./libraries/display_create_database.lib.php');
151 echo '</li>' . "\n";
154 PMA_printListItem( $strMySQLShowStatus, 'li_mysql_status',
155 './server_status.php?' . $common_url_query );
156 PMA_printListItem( $strMySQLShowVars, 'li_mysql_variables',
157 './server_variables.php?' . $common_url_query, 'show-variables' );
158 PMA_printListItem( $strProcesses, 'li_mysql_processes',
159 './server_processlist.php?' . $common_url_query, 'show-processlist' );
161 if (PMA_MYSQL_INT_VERSION >= 40100) {
162 PMA_printListItem( $strCharsetsAndCollations, 'li_mysql_collations',
163 './server_collations.php?' . $common_url_query );
166 PMA_printListItem( $strStorageEngines, 'li_mysql_engines',
167 './server_engines.php?' . $common_url_query );
169 if ($is_reload_priv) {
170 PMA_printListItem( $strReloadPrivileges, 'li_flush_privileges',
171 './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush' );
174 if ($is_superuser) {
175 PMA_printListItem( $strPrivileges, 'li_mysql_privilegs',
176 './server_privileges.php?' . $common_url_query );
179 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
180 if ( $binlogs ) {
181 if (PMA_DBI_num_rows($binlogs) > 0) {
182 PMA_printListItem( $strBinaryLog, 'li_mysql_binlogs',
183 './server_binlog.php?' . $common_url_query );
185 PMA_DBI_free_result($binlogs);
187 unset( $binlogs );
189 PMA_printListItem( $strDatabases, 'li_mysql_databases',
190 './server_databases.php?' . $common_url_query );
191 PMA_printListItem( $strExport, 'li_export',
192 './server_export.php?' . $common_url_query );
193 PMA_printListItem( $strImport, 'li_import',
194 './server_import.php?' . $common_url_query );
196 // Change password (TODO ? needs another message)
197 if ($cfg['ShowChgPassword']) {
198 PMA_printListItem( $strChangePassword, 'li_change_password',
199 './user_password.php?' . $common_url_query );
200 } // end if
202 // Logout for advanced authentication
203 if ($cfg['Server']['auth_type'] != 'config') {
204 $http_logout = ($cfg['Server']['auth_type'] == 'http')
205 ? '<a href="./Documentation.html#login_bug" target="documentation">'
206 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
207 : '';
208 PMA_printListItem( '<strong>' . $strLogout . '</strong> ' . $http_logout,
209 'li_log_out',
210 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
211 } // end if
213 echo '</ul>';
214 } // end of if ($server > 0)
216 </div>
217 <div id="pmamaininformation">
218 <?php
220 echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
221 . "\n";
223 echo '<ul>' . "\n";
225 if ( $server > 0 ) {
226 PMA_printListItem( $strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
227 'li_mysql_client_version' );
228 PMA_printListItem( $strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
229 'li_used_php_extension' );
232 // Displays language selection combo
233 if (empty($cfg['Lang'])) {
234 echo '<li id="li_select_lang">';
235 require_once('./libraries/display_select_lang.lib.php');
236 PMA_select_language();
237 echo '</li>';
241 if ( isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
242 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
243 echo '<li id="li_select_charset">';
245 <form method="post" action="index.php" target="_parent">
246 <input type="hidden" name="server" value="<?php echo $server; ?>" />
247 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
248 <?php echo $strMySQLCharset;?>:
249 <select name="convcharset" xml:lang="en" dir="ltr"
250 onchange="this.form.submit();">
251 <?php
252 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
253 if ($convcharset == $tmpcharset) {
254 $selected = ' selected="selected"';
255 } else {
256 $selected = '';
258 echo ' '
259 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
262 </select>
263 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
264 </form>
265 </li>
266 <?php
269 // added by Michael Keck <mail_at_michaelkeck_dot_de>
270 // ThemeManager if available
272 if ( $GLOBALS['cfg']['ThemeManager'] ) {
273 echo '<li id="li_select_theme">';
274 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
275 echo '</li>';
277 PMA_printListItem( $strPmaDocumentation, 'li_pma_docs', 'Documentation.html' );
279 if ( $cfg['ShowPhpInfo'] ) {
280 PMA_printListItem( $strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query );
283 // does not work if no target specified, don't know why
284 PMA_printListItem( $strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank' );
286 <li><bdo xml:lang="en" dir="ltr">
287 [<a href="changelog.php" target="_blank">ChangeLog</a>]
288 [<a href="http://phpmyadmin.cvs.sourceforge.net/phpmyadmin/"
289 target="_blank">CVS</a>]
290 [<a href="http://sourceforge.net/mail/?group_id=23067"
291 target="_blank">Lists</a>]
292 </bdo>
293 </li>
294 </ul>
295 </div>
296 <?php
298 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
299 * full height of the inner divs
302 <br class="clearfloat" />
303 <br class="clearfloat" />
304 </div>
306 <?php
307 if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {
308 foreach ( $GLOBALS['PMA_errors'] as $error ) {
309 echo '<div class="error">' . $error . '</div>' . "\n";
314 * Removed the "empty $cfg['PmaAbsoluteUri']" warning on 2005-08-23
315 * See https://sourceforge.net/tracker/index.php?func=detail&aid=1257134&group_id=23067&atid=377411
319 * Warning if using the default MySQL privileged account
320 * modified: 2004-05-05 mkkeck
322 if ($server != 0
323 && $cfg['Server']['user'] == 'root'
324 && $cfg['Server']['password'] == '') {
325 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
329 * Warning for PHP 4.2.3
330 * modified: 2004-05-05 mkkeck
333 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
334 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
338 * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
339 * break it, see bug 1063821.
342 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
343 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
347 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
348 * to tell user something might be broken without it, see bug #1063149.
350 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
351 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
355 * Warning for old PHP version
356 * modified: 2004-05-05 mkkeck
359 if (PMA_PHP_INT_VERSION < 40100) {
360 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
364 * Warning for old MySQL version
365 * modified: 2004-05-05 mkkeck
367 // not yet defined before the server choice
368 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
369 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
373 * prints list item for main page
375 * @param string $name displayed text
376 * @param string $id id, used for css styles
377 * @param string $url make item as link with $url as target
378 * @param string $mysql_help_page display a link to MySQL's manual
379 * @param string $target special target for $url
381 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
383 echo '<li id="' . $id . '">';
384 if (null !== $url) {
385 echo '<a href="' . $url . '"';
386 if (null !== $target) {
387 echo ' target="' . $target . '"';
389 echo '>';
392 echo $name;
394 if (null !== $url) {
395 echo '</a>' . "\n";
397 if (null !== $mysql_help_page) {
398 echo PMA_showMySQLDocu('', $mysql_help_page);
400 echo '</li>';
404 * Displays the footer
406 require_once('./libraries/footer.inc.php');