Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: main.php,v 2.100.2.3 2006/05/29 16:09:30 lem9 Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 /**
6 * Don't display the page heading
7 */
8 if (!defined('PMA_DISPLAY_HEADING')) {
9 define('PMA_DISPLAY_HEADING', 0);
10 }
11  
12 /**
13 * Gets some core libraries and displays a top message if required
14 */
15 require_once('./libraries/common.lib.php');
16  
17 // Handles some variables that may have been sent by the calling script
18 if (isset($db)) {
19 unset($db);
20 }
21 if (isset($table)) {
22 unset($table);
23 }
24 $show_query = '1';
25 require_once('./libraries/header.inc.php');
26  
27 // Any message to display?
28 if ( ! empty( $message ) ) {
29 PMA_showMessage( $message );
30 unset( $message );
31 }
32  
33 $common_url_query = PMA_generate_common_url( '', '' );
34  
35 // this div is required for containing divs can be 50%
36 echo '<div id="maincontainer">' . "\n";
37  
38 /**
39 * Displays the mysql server related links
40 */
41 if ( $server > 0 ) {
42  
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();
48  
49 if ($cfg['Server']['auth_type'] == 'config') {
50 $cfg['ShowChgPassword'] = FALSE;
51 }
52 }
53 ?>
54  
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 .= ' (';
64 }
65 $server_info .= PMA_DBI_get_host_info();
66  
67 if (!empty($cfg['Server']['verbose'])) {
68 $server_info .= ')';
69 }
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();');
76  
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";
82 }
83  
84 /**
85 * Displays the MySQL servers choice form
86 */
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);
90 }
91  
92 if ( $server > 0 ) {
93 echo '<ul>' . "\n";
94  
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' );
100  
101 if ( $cfg['AllowAnywhereRecoding'] && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
102 echo '<li id="li_select_mysql_charset">';
103 ?>
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 = '';
116 }
117 echo ' '
118 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
119 }
120 ?>
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";
146 }
147  
148 echo '<li id="li_create_database">';
149 require('./libraries/display_create_database.lib.php');
150 echo '</li>' . "\n";
151  
152 PMA_printListItem( $strMySQLShowStatus, 'li_mysql_status',
153 './server_status.php?' . $common_url_query );
154 PMA_printListItem( $strMySQLShowVars, 'li_mysql_variables',
155 './server_variables.php?' . $common_url_query, 'show-variables' );
156 PMA_printListItem( $strMySQLShowProcess, 'li_mysql_processes',
157 './server_processlist.php?' . $common_url_query, 'show-processlist' );
158  
159 if (PMA_MYSQL_INT_VERSION >= 40100) {
160 PMA_printListItem( $strCharsetsAndCollations, 'li_mysql_collations',
161 './server_collations.php?' . $common_url_query );
162 }
163  
164 PMA_printListItem( $strStorageEngines, 'li_mysql_engines',
165 './server_engines.php?' . $common_url_query );
166  
167 if ($is_reload_priv) {
168 PMA_printListItem( $strReloadMySQL, 'li_flush_privileges',
169 './server_privileges.php?flush_privileges=1&amp;' . $common_url_query, 'flush' );
170 }
171  
172 if ($is_superuser) {
173 PMA_printListItem( $strPrivileges, 'li_mysql_privilegs',
174 './server_privileges.php?' . $common_url_query );
175 }
176  
177 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', null, PMA_DBI_QUERY_STORE);
178 if ( $binlogs ) {
179 if (PMA_DBI_num_rows($binlogs) > 0) {
180 PMA_printListItem( $strBinaryLog, 'li_mysql_binlogs',
181 './server_binlog.php?' . $common_url_query );
182 }
183 PMA_DBI_free_result($binlogs);
184 }
185 unset( $binlogs );
186  
187 PMA_printListItem( $strDatabases, 'li_mysql_databases',
188 './server_databases.php?' . $common_url_query );
189 PMA_printListItem( $strExport, 'li_export',
190 './server_export.php?' . $common_url_query );
191 PMA_printListItem( $strImport, 'li_import',
192 './server_import.php?' . $common_url_query );
193  
194 // Change password (TODO ? needs another message)
195 if ($cfg['ShowChgPassword']) {
196 PMA_printListItem( $strChangePassword, 'li_change_password',
197 './user_password.php?' . $common_url_query );
198 } // end if
199  
200 // Logout for advanced authentication
201 if ($cfg['Server']['auth_type'] != 'config') {
202 $http_logout = ($cfg['Server']['auth_type'] == 'http')
203 ? '<a href="./Documentation.html#login_bug" target="documentation">'
204 . ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />' : '(*)') . '</a>'
205 : '';
206 PMA_printListItem( '<strong>' . $strLogout . '</strong> ' . $http_logout,
207 'li_log_out',
208 './index.php?' . $common_url_query . '&amp;old_usr=' . urlencode($PHP_AUTH_USER), null, '_parent');
209 } // end if
210  
211 echo '</ul>';
212 } // end of if ($server > 0)
213 ?>
214 </div>
215 <div id="pmamaininformation">
216 <?php
217  
218 echo '<h1 xml:lang="en" dir="ltr">phpMyAdmin - ' . PMA_VERSION . '</h1>'
219 . "\n";
220  
221 echo '<ul>' . "\n";
222  
223 if ( $server > 0 ) {
224 PMA_printListItem( $strMysqlClientVersion . ': ' . PMA_DBI_get_client_info(),
225 'li_mysql_client_version' );
226 PMA_printListItem( $strUsedPhpExtensions . ': ' . $GLOBALS['cfg']['Server']['extension'],
227 'li_used_php_extension' );
228 }
229  
230 // Displays language selection combo
231 if (empty($cfg['Lang'])) {
232 echo '<li id="li_select_lang">';
233 require_once('./libraries/display_select_lang.lib.php');
234 PMA_select_language();
235 echo '</li>';
236 }
237  
238  
239 if ( isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
240 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
241 echo '<li id="li_select_charset">';
242 ?>
243 <form method="post" action="index.php" target="_parent">
244 <input type="hidden" name="server" value="<?php echo $server; ?>" />
245 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
246 <?php echo $strMySQLCharset;?>:
247 <select name="convcharset" xml:lang="en" dir="ltr"
248 onchange="this.form.submit();">
249 <?php
250 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
251 if ($convcharset == $tmpcharset) {
252 $selected = ' selected="selected"';
253 } else {
254 $selected = '';
255 }
256 echo ' '
257 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
258 }
259 ?>
260 </select>
261 <noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
262 </form>
263 </li>
264 <?php
265 }
266  
267 // added by Michael Keck <mail_at_michaelkeck_dot_de>
268 // ThemeManager if available
269  
270 if ( $GLOBALS['cfg']['ThemeManager'] ) {
271 echo '<li id="li_select_theme">';
272 echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
273 echo '</li>';
274 }
275 PMA_printListItem( $strPmaDocumentation, 'li_pma_docs', 'Documentation.html' );
276  
277 if ( $cfg['ShowPhpInfo'] ) {
278 PMA_printListItem( $strShowPHPInfo, 'li_phpinfo', './phpinfo.php?' . $common_url_query );
279 }
280  
281 // does not work if no target specified, don't know why
282 PMA_printListItem( $strHomepageOfficial, 'li_pma_homepage', 'http://www.phpMyAdmin.net/', null, '_blank' );
283 ?>
284 <li><bdo xml:lang="en" dir="ltr">
285 [<a href="changelog.php" target="_blank">ChangeLog</a>]
286 [<a href="http://phpmyadmin.cvs.sourceforge.net/phpmyadmin/"
287 target="_blank">CVS</a>]
288 [<a href="http://sourceforge.net/mail/?group_id=23067"
289 target="_blank">Lists</a>]
290 </bdo>
291 </li>
292 </ul>
293 </div>
294 <?php
295 /**
296 * BUG: MSIE needs two <br /> here, otherwise it will not extend the outer div to the
297 * full height of the inner divs
298 */
299 ?>
300 <br class="clearfloat" />
301 <br class="clearfloat" />
302 </div>
303  
304 <?php
305 if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) {
306 foreach ( $GLOBALS['PMA_errors'] as $error ) {
307 echo '<div class="error">' . $error . '</div>' . "\n";
308 }
309 }
310  
311 /**
312 * Removed the "empty $cfg['PmaAbsoluteUri']" warning on 2005-08-23
313 * See https://sourceforge.net/tracker/index.php?func=detail&aid=1257134&group_id=23067&atid=377411
314 */
315  
316 /**
317 * Warning if using the default MySQL privileged account
318 * modified: 2004-05-05 mkkeck
319 */
320 if ($server != 0
321 && $cfg['Server']['user'] == 'root'
322 && $cfg['Server']['password'] == '') {
323 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
324 }
325  
326 /**
327 * Warning for PHP 4.2.3
328 * modified: 2004-05-05 mkkeck
329 */
330  
331 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
332 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
333 }
334  
335 /**
336 * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
337 * break it, see bug 1063821.
338 */
339  
340 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
341 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
342 }
343  
344 /**
345 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
346 * to tell user something might be broken without it, see bug #1063149.
347 */
348 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
349 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
350 }
351  
352 /**
353 * Warning for old PHP version
354 * modified: 2004-05-05 mkkeck
355 */
356  
357 if (PMA_PHP_INT_VERSION < 40100) {
358 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
359 }
360  
361 /**
362 * Warning for old MySQL version
363 * modified: 2004-05-05 mkkeck
364 */
365 // not yet defined before the server choice
366 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
367 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
368 }
369  
370 /**
371 * prints list item for main page
372 *
373 * @param string $name displayed text
374 * @param string $id id, used for css styles
375 * @param string $url make item as link with $url as target
376 * @param string $mysql_help_page display a link to MySQL's manual
377 * @param string $target special target for $url
378 */
379 function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null)
380 {
381 echo '<li id="' . $id . '">';
382 if (null !== $url) {
383 echo '<a href="' . $url . '"';
384 if (null !== $target) {
385 echo ' target="' . $target . '"';
386 }
387 echo '>';
388 }
389  
390 echo $name;
391  
392 if (null !== $url) {
393 echo '</a>' . "\n";
394 }
395 if (null !== $mysql_help_page) {
396 echo PMA_showMySQLDocu('', $mysql_help_page);
397 }
398 echo '</li>';
399 }
400  
401 /**
402 * Displays the footer
403 */
404 require_once('./libraries/footer.inc.php');
405 ?>