bug #1231917, commands out of sync
[phpmyadmin/crack.git] / main.php
blob54d18efe7b80b615c7cee54b970a7ef6603674e2
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Don't display the page heading
7 */
8 define('PMA_DISPLAY_HEADING', 0);
10 /**
11 * Gets some core libraries and displays a top message if required
13 require_once('./libraries/grab_globals.lib.php');
14 require_once('./libraries/common.lib.php');
15 setcookie('pma_lang', $lang, time() + 60*60*24*30, $cookie_path, '', $is_https);
16 if (isset($convcharset)) {
17 setcookie('pma_charset', $convcharset, time() + 60*60*24*30, $cookie_path, '', $is_https);
20 /**
21 * Includes the ThemeManager
23 require_once('./libraries/select_theme.lib.php');
24 // Defines the "item" image depending on text direction
25 $item_img = $GLOBALS['pmaThemeImage'] . 'item_ltr.png';
26 // Defines for MainPageIconic
27 $str_iconic_list = '';
28 $str_iconic_colspan = '';
29 $str_normal_list = '<td valign="top" align="right" width="16"><img src="'.$item_img.'" border="0" hspace="2" vspace="5" /></td>';
30 if ($cfg['MainPageIconic']) {
31 $str_iconic_list .= "<td width=\"16\" valign=\"top\" align=\"center\" nowrap=\"nowrap\">%1\$s"
32 . "<img src=\"" . $pmaThemeImage . "%2\$s\" border=\"0\" width=\"16\" height=\"16\" hspace=\"2\" alt=\"%3\$s\" />"
33 . "%4\$s</td>";
34 $str_iconic_colspan .= ' colspan="2"';
35 } else {
36 $str_iconic_list = '';
37 $str_iconic_colspan = ' colspan="2"';
40 // Handles some variables that may have been sent by the calling script
41 if (isset($db)) {
42 unset($db);
44 if (isset($table)) {
45 unset($table);
47 $show_query = '1';
48 require_once('./header.inc.php');
49 echo "\n";
52 /**
53 * Displays the welcome message and the server informations
56 // note: for proper display of RTL languages, I removed the
57 // align="left" in the next <td> tag
59 <table border="0" cellpadding="0" cellspacing="0" width="100%">
60 <tr>
61 <td valign="top">
62 <h1>
63 <?php
64 echo sprintf($strWelcome, ' phpMyAdmin ' . PMA_VERSION . '');
66 </h1>
67 <?php
69 // Don't display server info if $server == 0 (no server selected)
70 // loic1: modified in order to have a valid words order whatever is the
71 // language used
72 if ($server > 0) {
73 // robbat2: Use the verbose name of the server instead of the hostname
74 // if a value is set
75 if (!empty($cfg['Server']['verbose'])) {
76 $server_info = $cfg['Server']['verbose'];
77 } else {
78 $server_info = $cfg['Server']['host'];
79 $server_info .= (empty($cfg['Server']['port']) ? '' : ':' . $cfg['Server']['port']);
81 // loic1: skip this because it's not a so good idea to display sockets
82 // used to everybody
83 // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
84 // $server_info .= ':' . $cfg['Server']['socket'];
85 // }
86 $res = PMA_DBI_query('SELECT USER();');
87 list($mysql_cur_user_and_host) = PMA_DBI_fetch_row($res);
88 $mysql_cur_user = substr($mysql_cur_user_and_host, 0, strrpos($mysql_cur_user_and_host, '@'));
90 PMA_DBI_free_result($res);
91 unset($res, $row);
93 $full_string = str_replace('%pma_s1%', PMA_MYSQL_STR_VERSION, $strMySQLServerProcess);
94 $full_string = str_replace('%pma_s2%', $server_info, $full_string);
95 $full_string = str_replace('%pma_s3%', $mysql_cur_user_and_host, $full_string);
97 echo '<p><b>' . $full_string . '</b></p>' . "\n";
98 } // end if
101 // Any message to display?
103 if (isset($message)) {
104 PMA_showMessage($message);
105 unset($message);
109 * Reload mysql (flush privileges)
111 if (($server > 0) && isset($mode) && ($mode == 'reload')) {
112 $result = PMA_DBI_query('FLUSH PRIVILEGES');
113 echo '<p><b>';
114 if ($result != 0) {
115 echo $strMySQLReloaded;
116 } else {
117 echo $strReloadFailed;
119 unset($result);
120 echo '</b></p>' . "\n\n";
123 </td>
124 <?php
125 if (@file_exists($pmaThemeImage . 'logo_right.png')) {
126 // td and img seems not to obey the general dir= of the html tag
127 if ($GLOBALS['text_dir'] == 'ltr') {
128 $tmp_align = 'right';
129 } else {
130 $tmp_align = 'left';
132 echo ' <td align="' . $tmp_align . '" valign="top">' . "\n";
133 echo ' <img src="' . $pmaThemeImage . 'logo_right.png" alt="phpMyAdmin - Logo" border="0" hspace="5" vspace="5" align="' . $tmp_align . '" />' . "\n";
134 echo ' </td>';
137 </tr></table>
138 <hr />
139 <?php
142 * Displays the MySQL servers choice form
144 if (!$cfg['LeftDisplayServers']) {
145 $show_server_left = FALSE;
146 include('./libraries/select_server.lib.php');
149 // nested table needed
151 <table border="0" cellpadding="0" cellspacing="0">
152 <tr>
153 <td valign="top">
154 <!-- MySQL and phpMyAdmin related links -->
155 <?php
157 * Displays the mysql server related links
159 $is_superuser = FALSE;
161 if ($server > 0) {
162 // Get user's global privileges ($dbh and $userlink are links to MySQL
163 // defined in the "common.lib.php" library)
164 // Note: if no controluser is defined, $dbh contains $userlink
166 $is_create_priv = FALSE;
167 $is_process_priv = TRUE;
168 $is_reload_priv = FALSE;
169 $db_to_create = '';
171 // We were trying to find if user if superuser with 'USE mysql'
172 // but users with the global priv CREATE TEMPORARY TABLES or LOCK TABLES
173 // can do a 'USE mysql' (even if they cannot see the tables)
174 $is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', $userlink, PMA_DBI_QUERY_STORE);
176 function PMA_analyseShowGrant($rs_usr, &$is_create_priv, &$db_to_create, &$is_reload_priv) {
178 $re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards
179 $re1 = '(^|[^\])(\\\)+'; // escaped wildcards
180 while ($row = PMA_DBI_fetch_row($rs_usr)) {
181 $show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4,(strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4));
182 $show_grants_dbname = ereg_replace('^`(.*)`','\\1', $show_grants_dbname);
183 $show_grants_str = substr($row[0],6,(strpos($row[0],' ON ')-6));
184 if (($show_grants_str == 'ALL') || ($show_grants_str == 'ALL PRIVILEGES') || ($show_grants_str == 'CREATE') || strpos($show_grants_str, 'CREATE')) {
185 if ($show_grants_dbname == '*') {
186 $is_create_priv = TRUE;
187 $is_reload_priv = TRUE;
188 $db_to_create = '';
189 break;
190 } // end if
191 else if ( (ereg($re0 . '%|_', $show_grants_dbname)
192 && !ereg('\\\\%|\\\\_', $show_grants_dbname))
193 || (!PMA_DBI_try_query('USE ' . ereg_replace($re1 .'(%|_)', '\\1\\3', $show_grants_dbname)) && substr(PMA_DBI_getError(), 1, 4) != 1044)
195 $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $show_grants_dbname));
196 $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
197 $is_create_priv = TRUE;
198 break;
199 } // end elseif
200 } // end if
201 } // end while
202 } // end function
204 // Detection for some CREATE privilege.
206 // Since MySQL 4.1.2, we can easily detect current user's grants
207 // using $userlink (no control user needed)
208 // and we don't have to try any other method for detection
210 if (PMA_MYSQL_INT_VERSION >= 40102) {
211 $rs_usr = PMA_DBI_try_query('SHOW GRANTS', $userlink, PMA_DBI_QUERY_STORE);
212 if ($rs_usr) {
213 PMA_analyseShowGrant($rs_usr,$is_create_priv, $db_to_create, $is_reload_priv);
214 PMA_DBI_free_result($rs_usr);
215 unset($rs_usr);
217 } else {
219 // Before MySQL 4.1.2, we first try to find a priv in mysql.user. Hopefuly
220 // the controluser is correctly defined; but here, $dbh could contain
221 // $userlink so maybe the SELECT will fail
223 if (!$is_create_priv) {
224 $local_query = 'SELECT Create_priv, Reload_priv FROM mysql.user WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($mysql_cur_user), 'quoted') . ' OR ' . PMA_convert_using('User') . ' = ' . PMA_convert_using('', 'quoted') . ';';
225 $rs_usr = PMA_DBI_try_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
226 if ($rs_usr) {
227 while ($result_usr = PMA_DBI_fetch_assoc($rs_usr)) {
228 if (!$is_create_priv) {
229 $is_create_priv = ($result_usr['Create_priv'] == 'Y');
231 if (!$is_reload_priv) {
232 $is_reload_priv = ($result_usr['Reload_priv'] == 'Y');
234 } // end while
235 PMA_DBI_free_result($rs_usr);
236 unset($rs_usr, $result_usr);
237 } // end if
238 } // end if
240 // If the user has Create priv on a inexistant db, show him in the dialog
241 // the first inexistant db name that we find, in most cases it's probably
242 // the one he just dropped :)
243 if (!$is_create_priv) {
244 $local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE ' . PMA_convert_using('Create_priv') . ' = ' . PMA_convert_using('Y', 'quoted') . ' AND (' . PMA_convert_using('User') . ' = ' .PMA_convert_using(PMA_sqlAddslashes($mysql_cur_user), 'quoted') . ' OR ' . PMA_convert_using('User') . ' = ' . PMA_convert_using('', 'quoted') . ');';
245 $rs_usr = PMA_DBI_try_query($local_query, $dbh, PMA_DBI_QUERY_STORE);
246 if ($rs_usr) {
247 $re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards
248 $re1 = '(^|[^\])(\\\)+'; // escaped wildcards
249 while ($row = PMA_DBI_fetch_assoc($rs_usr)) {
250 if (ereg($re0 . '(%|_)', $row['Db'])
251 || (!PMA_DBI_try_query('USE ' . ereg_replace($re1 . '(%|_)', '\\1\\3', $row['Db'])) && substr(PMA_DBI_getError(), 1, 4) != 1044)) {
252 $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $row['Db']));
253 $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
254 $is_create_priv = TRUE;
255 break;
256 } // end if
257 } // end while
258 PMA_DBI_free_result($rs_usr);
259 unset($rs_usr, $row, $re0, $re1);
260 } // end if
261 else {
262 // Finally, let's try to get the user's privileges by using SHOW
263 // GRANTS...
264 // Maybe we'll find a little CREATE priv there :)
265 $rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user_and_host . ';', $dbh, PMA_DBI_QUERY_STORE);
266 if (!$rs_usr) {
267 // OK, now we'd have to guess the user's hostname, but we
268 // only try out the 'username'@'%' case.
269 $rs_usr = PMA_DBI_try_query('SHOW GRANTS FOR ' . $mysql_cur_user . ';', $dbh, PMA_DBI_QUERY_STORE);
271 unset($local_query);
272 if ($rs_usr) {
273 PMA_analyseShowGrant($rs_usr,$is_create_priv, $db_to_create, $is_reload_priv);
274 PMA_DBI_free_result($rs_usr);
275 unset($rs_usr);
276 } // end if
277 } // end elseif
278 } // end if
279 } // end else (MySQL < 4.1.2)
281 if (!$cfg['SuggestDBName']) {
282 $db_to_create = '';
285 $common_url_query = PMA_generate_common_url();
287 if ($is_superuser) {
288 $cfg['ShowMysqlInfo'] = TRUE;
289 $cfg['ShowMysqlVars'] = TRUE;
290 $cfg['ShowChgPassword'] = TRUE;
292 if ($cfg['Server']['auth_type'] == 'config') {
293 $cfg['ShowChgPassword'] = FALSE;
296 // loic1: Displays the MySQL column only if at least one feature has to be
297 // displayed
298 if ($is_superuser || $is_create_priv || $is_process_priv || $is_reload_priv
299 || $cfg['ShowMysqlInfo'] || $cfg['ShowMysqlVars'] || $cfg['ShowChgPassword']
300 || $cfg['Server']['auth_type'] != 'config') {
302 <!-- MySQL server related links -->
303 <table cellpadding="3" cellspacing="0">
304 <tr>
305 <th class="tblHeaders"<?php echo $str_iconic_colspan; ?>>&nbsp;&nbsp;MySQL</th>
306 </tr>
307 <tr><?php
308 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'','b_newdb.png',$strCreateNewDatabase,'') : $str_normal_list);
310 <!-- db creation form -->
311 <td valign="top" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
312 <?php
313 if ($is_create_priv) {
314 // The user is allowed to create a db
316 <form method="post" action="db_create.php"><b>
317 <?php echo $strCreateNewDatabase . '&nbsp;' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE'); ?></b><br />
318 <?php echo PMA_generate_common_hidden_inputs('', '', 5); ?>
319 <input type="hidden" name="reload" value="1" />
320 <input type="text" name="db" value="<?php echo $db_to_create; ?>" maxlength="64" class="textfield" />
321 <?php
322 if (PMA_MYSQL_INT_VERSION >= 40101) {
323 require_once('./libraries/mysql_charsets.lib.php');
324 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', NULL, NULL, TRUE, 5);
327 <input type="submit" value="<?php echo $strCreate; ?>" id="buttonGo" />
328 </form>
329 <?php
330 } else {
332 <!-- db creation no privileges message -->
333 <b><?php echo $strCreateNewDatabase . ':&nbsp;' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE'); ?></b><br />
334 <?php
335 echo '<span class="noPrivileges">'
336 . ($cfg['ErrorIconic'] ? '<img src="' . $pmaThemeImage . 's_error2.png" width="11" height="11" hspace="2" border="0" align="middle" />' : '')
337 . '' . $strNoPrivileges .'</span>';
338 } // end create db form or message
340 </td>
341 </tr>
342 <?php
343 echo "\n";
345 // Server related links
347 <!-- server-related links -->
348 <?php
349 if ($cfg['ShowMysqlInfo']) {
351 <tr><?php
352 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="./server_status.php?'.$common_url_query.'">','s_status.png',$strMySQLShowStatus,'</a>') : $str_normal_list);
354 <td>
355 <a href="./server_status.php?<?php echo $common_url_query; ?>">
356 <?php echo $strMySQLShowStatus . "\n"; ?>
357 </a>
358 </td>
359 </tr>
360 <?php
361 } // end if
362 if ($cfg['ShowMysqlVars']) {
364 <tr><?php
365 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="./server_variables.php?'.$common_url_query.'">','s_vars.png',$strMySQLShowVars,'</a>') : $str_normal_list);
367 <td>
368 <a href="./server_variables.php?<?php echo $common_url_query; ?>"><?php echo $strMySQLShowVars;?></a>&nbsp;<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_VARIABLES') . "\n"; ?>
369 </td>
370 </tr>
371 <?php
374 <tr><?php
375 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="./server_processlist.php?'.$common_url_query.'">','s_process.png',$strMySQLShowProcess,'</a>') : $str_normal_list);
377 <td>
378 <a href="./server_processlist.php?<?php echo $common_url_query; ?>">
379 <?php echo $strMySQLShowProcess; ?></a>&nbsp;
380 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_PROCESSLIST') . "\n"; ?>
381 </td>
382 </tr>
383 <?php
385 if (PMA_MYSQL_INT_VERSION >= 40100) {
386 echo "\n";
388 <tr><?php
389 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="./server_collations.php?'.$common_url_query.'">','s_asci.png',$strCharsetsAndCollations,'</a>') : $str_normal_list);
391 <td>
392 <a href="./server_collations.php?<?php echo $common_url_query; ?>">
393 <?php echo $strCharsetsAndCollations; ?></a>&nbsp;
394 </td>
395 </tr>
396 <?php
399 <tr><?php
400 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="./server_engines.php?'.$common_url_query.'">','b_engine.png',$strStorageEngines,'</a>') : $str_normal_list);
402 <td>
403 <a href="./server_engines.php?<?php echo $common_url_query; ?>">
404 <?php echo $strStorageEngines; ?></a>&nbsp;
405 </td>
406 </tr>
407 <?php
408 if ($is_reload_priv) {
409 echo "\n";
411 <tr><?php
412 echo ' ' . ($str_iconic_list!='' ? sprintf($str_iconic_list,'<a href="main.php?'.$common_url_query.'&amp;mode=reload">','s_reload.png',$strReloadMySQL,'</a>') : $str_normal_list);
414 <td>
415 <a href="main.php?<?php echo $common_url_query; ?>&amp;mode=reload">
416 <?php echo $strReloadMySQL; ?></a>&nbsp;
417 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
418 </td>
419 </tr>
420 <?php
423 if ($is_superuser) {
424 echo "\n";
426 <tr><?php
427 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="server_privileges.php?'.$common_url_query.'">','s_rights.png',$strPrivileges,'</a>') : $str_normal_list);
429 <td>
430 <a href="server_privileges.php?<?php echo $common_url_query; ?>">
431 <?php echo $strPrivileges; ?></a>&nbsp;
432 </td>
433 </tr>
434 <?php
437 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', NULL, PMA_DBI_QUERY_STORE);
438 if ($binlogs) {
439 if (PMA_DBI_num_rows($binlogs) > 0) {
441 <tr><?php
442 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="server_binlog.php?'.$common_url_query.'">','s_tbl.png',$strBinaryLog,'</a>') : $str_normal_list);
444 <td>
445 <a href="server_binlog.php?<?php echo $common_url_query; ?>">
446 <?php echo $strBinaryLog; ?></a>&nbsp;
447 </td>
448 </tr>
449 <?php
451 PMA_DBI_free_result($binlogs);
453 unset($binlogs);
455 <tr><?php
456 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="server_databases.php?'.$common_url_query.'">','s_db.png',$strDatabases,'</a>') : $str_normal_list);
458 <td>
459 <a href="./server_databases.php?<?php echo $common_url_query; ?>">
460 <?php echo $strDatabases; ?></a>
461 </td>
462 </tr>
463 <tr>
464 <?php
465 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="server_export.php?'.$common_url_query.'">','b_export.png',$strExport,'</a>') : $str_normal_list);
467 <td>
468 <a href="./server_export.php?<?php echo $common_url_query; ?>">
469 <?php echo $strExport; ?></a>
470 </td>
471 </tr>
472 <?php
474 // Change password (needs another message)
475 if ($cfg['ShowChgPassword']) {
476 echo "\n";
478 <tr>
479 <?php
480 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="user_password.php?'.$common_url_query.'">','s_passwd.png',$strChangePassword,'</a>') : $str_normal_list);
482 <td>
483 <a href="user_password.php?<?php echo $common_url_query; ?>">
484 <?php echo ($strChangePassword); ?></a>
485 </td>
486 </tr>
487 <?php
488 } // end if
490 // Logout for advanced authentication
491 if ($cfg['Server']['auth_type'] != 'config') {
492 $http_logout = ($cfg['Server']['auth_type'] == 'http')
493 ? "\n"
494 . ' <a href="./Documentation.html#login_bug" target="documentation">'
495 . ($cfg['ReplaceHelpImg'] ? '<img src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" border="0" alt="Info" align="middle" />' : '(*)') . '</a>'
496 : '';
497 echo "\n";
499 <tr>
500 <?php
501 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="index.php?'.$common_url_query.'&amp;old_usr='.urlencode($PHP_AUTH_USER).'">','s_loggoff.png',$strLogout,'</a>') : $str_normal_list);
503 <td>
505 <a href="index.php?<?php echo $common_url_query; ?>&amp;old_usr=<?php echo urlencode($PHP_AUTH_USER); ?>" target="_parent">
506 <b><?php echo $strLogout; ?></b></a>&nbsp;<?php echo $http_logout . "\n"; ?>
507 </td>
508 </tr>
509 <?php
510 } // end if
512 </table>
513 <?php
514 } // end if
515 } // end of if ($server > 0)
516 echo "\n";
519 </td>
520 <td width="20">&nbsp;</td>
521 <td valign="top">
522 <table border="0" cellpadding="3" cellspacing="0">
523 <tr>
524 <th class="tblHeaders"<?php echo $str_iconic_colspan; ?>>&nbsp;&nbsp;phpMyAdmin</th>
525 </tr>
526 <?php
527 // Displays language selection combo
528 if (empty($cfg['Lang'])) {
530 <!-- Language Selection -->
531 <tr><?php
532 echo ' ' . ($str_iconic_list !='' ? sprintf($str_iconic_list,'<a href="./translators.html" target="documentation">','s_lang.png','Language','</a>') : $str_normal_list);
534 <td nowrap="nowrap">
535 <form method="post" action="index.php" target="_parent">
536 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
537 <input type="hidden" name="server" value="<?php echo $server; ?>" />
538 Language <a href="./translators.html" target="documentation"><?php
539 if ($cfg['ReplaceHelpImg']){
540 echo '<img src="' . $pmaThemeImage . 'b_info.png" border="0" width="11" height="11" alt="Info" hspace="1" vspace="1" />';
541 }else{ echo '(*)'; }
542 ?></a>: <select name="lang" dir="ltr" onchange="this.form.submit();" style="vertical-align: middle">
543 <?php
544 echo "\n";
547 * Sorts available languages by their true names
549 * @param array the array to be sorted
550 * @param mixed a required parameter
552 * @return the sorted array
554 * @access private
556 function PMA_cmp(&$a, $b)
558 return (strcmp($a[1], $b[1]));
559 } // end of the 'PMA_cmp()' function
561 uasort($available_languages, 'PMA_cmp');
562 foreach ($available_languages AS $id => $tmplang) {
563 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
564 if ($lang == $id) {
565 $selected = ' selected="selected"';
566 } else {
567 $selected = '';
569 echo ' ';
570 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
573 </select>
574 <noscript><input type="submit" value="Go" style="vertical-align: middle" /></noscript>
575 </form>
576 </td>
577 </tr>
579 <?php
582 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
583 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION < 40100) {
584 echo "\n";
586 <!-- Charset Selection -->
587 <tr><?php
588 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'','s_asci.png',$strMySQLCharset,'') : $str_normal_list);
590 <td>
591 <form method="post" action="index.php" target="_parent">
592 <input type="hidden" name="server" value="<?php echo $server; ?>" />
593 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
594 <?php echo $strMySQLCharset;?>:
595 <select name="convcharset" dir="ltr" onchange="this.form.submit();" style="vertical-align: middle">
596 <?php
597 echo "\n";
598 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
599 if ($convcharset == $tmpcharset) {
600 $selected = ' selected="selected"';
601 } else {
602 $selected = '';
604 echo ' '
605 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
608 </select>
609 <noscript><input type="submit" value="Go" style="vertical-align: middle" /></noscript>
610 </form>
611 </td>
612 </tr>
613 <?php
614 } elseif ($server != 0 && PMA_MYSQL_INT_VERSION >= 40100) {
615 echo ' <!-- Charset Info -->' . "\n"
616 . ' <tr>' . "\n"
617 .' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'','s_asci.png',$strMySQLCharset,'') : $str_normal_list) . "\n"
618 . ' <td>' . "\n"
619 . ' ' . $strMySQLCharset . ': '
620 . ' <b>'
621 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
622 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
623 . ' </b>' . "\n"
624 . ' </td>' . "\n"
625 . ' </tr>' . "\n"
626 . ' <!-- MySQL Connection Collation -->' . "\n"
627 . ' <tr>' . "\n"
628 .' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'','s_asci.png',$strMySQLCharset,'') : $str_normal_list) . "\n"
629 . ' <td>' . "\n"
630 . ' <form method="post" action="index.php" target="_parent">' . "\n"
631 . PMA_generate_common_hidden_inputs(NULL, NULL, 4, 'collation_connection')
632 . ' <label for="select_collation_connection">' . "\n"
633 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
634 . ' </label>' . "\n"
635 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, TRUE, 4, TRUE)
636 . ' <noscript><input type="submit" value="' . $strGo . '" style="vertical-align: middle" /></noscript>' . "\n"
637 // put the doc link in the form so that it appears on the same line
638 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
639 . ' </form>' . "\n"
640 . ' </td>' . "\n"
641 . ' </tr>' . "\n";
643 echo "\n";
645 // added by Michael Keck <mail_at_michaelkeck_dot_de>
646 // ThemeManager if available
648 if (isset($available_themes_choices) && $available_themes_choices > 1) {
649 $theme_selected = FALSE;
650 $theme_preview_path= './themes.php';
651 $theme_preview_href = '<a href="' . $theme_preview_path . '" target="themes" onclick="'
652 . "window.open('" . $theme_preview_path . "','themes','left=10,top=20,width=510,height=350,scrollbars=yes,status=yes,resizable=yes');"
653 . '">';
655 <!-- Theme Manager -->
656 <tr>
657 <?php
658 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,$theme_preview_href,'s_theme.png',(isset($strTheme) ? $strTheme : 'Theme (Style)'),'</a>') : $str_normal_list) . "\n";
660 <td>
661 <form name="setTheme" method="post" action="index.php" target="_parent">
662 <?php
663 echo PMA_generate_common_hidden_inputs('', '', 5);
664 echo $theme_preview_href
665 . (isset($strTheme) ? $strTheme : 'Theme (Style)')
666 . '</a>:' . "\n";
668 <select name="set_theme" dir="ltr" onchange="this.form.submit();" style="vertical-align: middle">
669 <?php
670 foreach ($available_themes_choices AS $cur_theme) {
671 echo '<option value="' . $cur_theme . '"';
672 if ($cur_theme == $theme) {
673 echo ' selected="selected"';
675 echo '>' . htmlspecialchars($available_themes_choices_names[$cur_theme]) . '</option>';
678 </select>
679 <noscript><input type="submit" value="Go" style="vertical-align: middle" /></noscript>
680 </form>
681 </td>
682 </tr>
683 <?php
686 <!-- Documentation -->
687 <tr><?php
688 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="Documentation.html" target="documentation">','b_docs.png',$strPmaDocumentation,'</a>') : $str_normal_list);
690 <td nowrap="nowrap">
691 <a href="Documentation.html" target="documentation"><b><?php echo $strPmaDocumentation; ?></b></a>
692 </td>
693 </tr>
695 <?php
696 if ($is_superuser || $cfg['ShowPhpInfo']) {
698 <!-- PHP Information -->
699 <tr><?php
700 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="phpinfo.php?' . PMA_generate_common_url() . '" target="_blank">','php_sym.png',$strShowPHPInfo,'</a>') : $str_normal_list);
702 <td nowrap="nowrap">
703 <a href="phpinfo.php?<?php echo PMA_generate_common_url(); ?>" target="_blank"><?php echo $strShowPHPInfo; ?></a>
704 </td>
705 </tr>
706 <?php
708 echo "\n";
711 <!-- phpMyAdmin related urls -->
712 <tr><?php
713 echo ' ' . ($str_iconic_list != '' ? sprintf($str_iconic_list,'<a href="http://www.phpMyAdmin.net/" target="_blank">','b_home.png',$strHomepageOfficial,'</a>') : $str_normal_list);
715 <td nowrap="nowrap">
716 <a href="http://www.phpMyAdmin.net/" target="_blank"><?php echo $strHomepageOfficial; ?></a>
717 </td>
718 </tr>
719 <tr>
720 <?php
721 echo '<td><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" /></td>';
723 <td nowrap="nowrap">
724 [<a href="changelog.php" target="_blank">ChangeLog</a>]
725 &nbsp;&nbsp;&nbsp;[<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmyadmin/phpMyAdmin/" target="_blank">CVS</a>]
726 &nbsp;&nbsp;&nbsp;[<a href="http://sourceforge.net/mail/?group_id=23067" target="_blank">Lists</a>]
727 </td>
728 </tr>
729 </table>
731 </td>
732 </tr>
733 </table>
735 <hr />
738 <?php
740 * Displays the "empty $cfg['PmaAbsoluteUri'] warning"
741 * modified: 2004-05-05 mkkeck
743 if ($display_pmaAbsoluteUri_warning) {
744 echo '<div class="warning">' . $strPmaUriError . '</div>' . "\n";
748 * Warning if using the default MySQL privileged account
749 * modified: 2004-05-05 mkkeck
751 if ($server != 0
752 && $cfg['Server']['user'] == 'root'
753 && $cfg['Server']['password'] == '') {
754 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
758 * Warning for PHP 4.2.3
759 * modified: 2004-05-05 mkkeck
762 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
763 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
767 * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
768 * break it, see bug 1063821.
771 if (@extension_loaded('mbstring') && @ini_get('mbstring.func_overload') > 1) {
772 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
776 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
777 * to tell user something might be broken without it, see bug #1063149.
779 if ($GLOBALS['using_mb_charset'] && !@extension_loaded('mbstring')) {
780 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
784 * Warning for old PHP version
785 * modified: 2004-05-05 mkkeck
788 if (PMA_PHP_INT_VERSION < 40100) {
789 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
793 * Warning for old MySQL version
794 * modified: 2004-05-05 mkkeck
796 // not yet defined before the server choice
797 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
798 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
801 * Displays the footer
803 echo "\n";
804 require_once('./footer.inc.php');