3 // vim: expandtab sw=4 ts=4 sts=4:
6 * Don't display the page heading
8 define('PMA_DISPLAY_HEADING', 0);
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);
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\" />"
34 $str_iconic_colspan .= ' colspan="2"';
36 $str_iconic_list = '';
37 $str_iconic_colspan = ' colspan="2"';
40 // Handles some variables that may have been sent by the calling script
48 require_once('./header.inc.php');
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%">
64 echo sprintf($strWelcome, ' phpMyAdmin ' . PMA_VERSION
. '');
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
73 // robbat2: Use the verbose name of the server instead of the hostname
75 if (!empty($cfg['Server']['verbose'])) {
76 $server_info = $cfg['Server']['verbose'];
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
83 // if (!empty($cfg['Server']['socket']) && PMA_PHP_INT_VERSION >= 30010) {
84 // $server_info .= ':' . $cfg['Server']['socket'];
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);
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";
101 // Any message to display?
103 if (isset($message)) {
104 PMA_showMessage($message);
109 * Reload mysql (flush privileges)
111 if (($server > 0) && isset($mode) && ($mode == 'reload')) {
112 $result = PMA_DBI_query('FLUSH PRIVILEGES');
115 echo $strMySQLReloaded;
117 echo $strReloadFailed;
120 echo '</b></p>' . "\n\n";
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';
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";
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">
154 <!-- MySQL
and phpMyAdmin related links
-->
157 * Displays the mysql server related links
159 $is_superuser = FALSE;
163 require_once('./libraries/check_user_privileges.lib.php');
165 $common_url_query = PMA_generate_common_url();
168 $cfg['ShowMysqlInfo'] = TRUE;
169 $cfg['ShowMysqlVars'] = TRUE;
170 $cfg['ShowChgPassword'] = TRUE;
172 if ($cfg['Server']['auth_type'] == 'config') {
173 $cfg['ShowChgPassword'] = FALSE;
176 // loic1: Displays the MySQL column only if at least one feature has to be
178 if ($is_superuser ||
$is_create_priv ||
$is_process_priv ||
$is_reload_priv
179 ||
$cfg['ShowMysqlInfo'] ||
$cfg['ShowMysqlVars'] ||
$cfg['ShowChgPassword']
180 ||
$cfg['Server']['auth_type'] != 'config') {
182 <!-- MySQL server related links
-->
183 <table cellpadding
="3" cellspacing
="0">
185 <th
class="tblHeaders"<?php
echo $str_iconic_colspan; ?
>> 
; 
;MySQL
</th
>
188 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'','b_newdb.png',$strCreateNewDatabase,'') : $str_normal_list);
190 <!-- db creation form
-->
191 <td valign
="top" align
="<?php echo $cell_align_left; ?>" nowrap
="nowrap">
192 <?php
require('./libraries/display_create_database.lib.php'); ?
>
198 // Server related links
200 <!-- server
-related links
-->
202 if ($cfg['ShowMysqlInfo']) {
205 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="./server_status.php?'.$common_url_query.'">','s_status.png',$strMySQLShowStatus,'</a>') : $str_normal_list);
208 <a href
="./server_status.php?<?php echo $common_url_query; ?>">
209 <?php
echo $strMySQLShowStatus . "\n"; ?
>
215 if ($cfg['ShowMysqlVars']) {
218 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="./server_variables.php?'.$common_url_query.'">','s_vars.png',$strMySQLShowVars,'</a>') : $str_normal_list);
221 <a href
="./server_variables.php?<?php echo $common_url_query; ?>"><?php
echo $strMySQLShowVars;?
></a
> 
;<?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_VARIABLES') . "\n"; ?
>
228 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="./server_processlist.php?'.$common_url_query.'">','s_process.png',$strMySQLShowProcess,'</a>') : $str_normal_list);
231 <a href
="./server_processlist.php?<?php echo $common_url_query; ?>">
232 <?php
echo $strMySQLShowProcess; ?
></a
> 
;
233 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_PROCESSLIST') . "\n"; ?
>
238 if (PMA_MYSQL_INT_VERSION
>= 40100) {
242 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="./server_collations.php?'.$common_url_query.'">','s_asci.png',$strCharsetsAndCollations,'</a>') : $str_normal_list);
245 <a href
="./server_collations.php?<?php echo $common_url_query; ?>">
246 <?php
echo $strCharsetsAndCollations; ?
></a
> 
;
253 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="./server_engines.php?'.$common_url_query.'">','b_engine.png',$strStorageEngines,'</a>') : $str_normal_list);
256 <a href
="./server_engines.php?<?php echo $common_url_query; ?>">
257 <?php
echo $strStorageEngines; ?
></a
> 
;
261 if ($is_reload_priv) {
265 echo ' ' . ($str_iconic_list!='' ?
sprintf($str_iconic_list,'<a href="main.php?'.$common_url_query.'&mode=reload">','s_reload.png',$strReloadMySQL,'</a>') : $str_normal_list);
268 <a href
="main.php?<?php echo $common_url_query; ?>&mode=reload">
269 <?php
echo $strReloadMySQL; ?
></a
> 
;
270 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?
>
280 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="server_privileges.php?'.$common_url_query.'">','s_rights.png',$strPrivileges,'</a>') : $str_normal_list);
283 <a href
="server_privileges.php?<?php echo $common_url_query; ?>">
284 <?php
echo $strPrivileges; ?
></a
> 
;
290 $binlogs = PMA_DBI_try_query('SHOW MASTER LOGS', NULL, PMA_DBI_QUERY_STORE
);
292 if (PMA_DBI_num_rows($binlogs) > 0) {
295 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="server_binlog.php?'.$common_url_query.'">','s_tbl.png',$strBinaryLog,'</a>') : $str_normal_list);
298 <a href
="server_binlog.php?<?php echo $common_url_query; ?>">
299 <?php
echo $strBinaryLog; ?
></a
> 
;
304 PMA_DBI_free_result($binlogs);
309 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="server_databases.php?'.$common_url_query.'">','s_db.png',$strDatabases,'</a>') : $str_normal_list);
312 <a href
="./server_databases.php?<?php echo $common_url_query; ?>">
313 <?php
echo $strDatabases; ?
></a
>
318 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="server_export.php?'.$common_url_query.'">','b_export.png',$strExport,'</a>') : $str_normal_list);
321 <a href
="./server_export.php?<?php echo $common_url_query; ?>">
322 <?php
echo $strExport; ?
></a
>
327 // Change password (needs another message)
328 if ($cfg['ShowChgPassword']) {
333 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="user_password.php?'.$common_url_query.'">','s_passwd.png',$strChangePassword,'</a>') : $str_normal_list);
336 <a href
="user_password.php?<?php echo $common_url_query; ?>">
337 <?php
echo ($strChangePassword); ?
></a
>
343 // Logout for advanced authentication
344 if ($cfg['Server']['auth_type'] != 'config') {
345 $http_logout = ($cfg['Server']['auth_type'] == 'http')
347 . ' <a href="./Documentation.html#login_bug" target="documentation">'
348 . ($cfg['ReplaceHelpImg'] ?
'<img src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" border="0" alt="Info" align="middle" />' : '(*)') . '</a>'
354 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="index.php?'.$common_url_query.'&old_usr='.urlencode($PHP_AUTH_USER).'">','s_loggoff.png',$strLogout,'</a>') : $str_normal_list);
358 <a href
="index.php?<?php echo $common_url_query; ?>&old_usr=<?php echo urlencode($PHP_AUTH_USER); ?>" target
="_parent">
359 <b
><?php
echo $strLogout; ?
></b
></a
> 
;<?php
echo $http_logout . "\n"; ?
>
368 } // end of if ($server > 0)
373 <td width
="20"> 
;</td
>
375 <table border
="0" cellpadding
="3" cellspacing
="0">
377 <th
class="tblHeaders"<?php
echo $str_iconic_colspan; ?
>> 
; 
;phpMyAdmin
</th
>
380 // Displays language selection combo
381 if (empty($cfg['Lang'])) {
383 <!-- Language Selection
-->
385 echo ' ' . ($str_iconic_list !='' ?
sprintf($str_iconic_list,'<a href="./translators.html" target="documentation">','s_lang.png','Language','</a>') : $str_normal_list);
388 <form method
="post" action
="index.php" target
="_parent">
389 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
390 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
391 Language
<a href
="./translators.html" target
="documentation"><?php
392 if ($cfg['ReplaceHelpImg']){
393 echo '<img src="' . $pmaThemeImage . 'b_info.png" border="0" width="11" height="11" alt="Info" hspace="1" vspace="1" />';
395 ?
></a
>: <select name
="lang" dir
="ltr" onchange
="this.form.submit();" style
="vertical-align: middle">
400 * Sorts available languages by their true names
402 * @param array the array to be sorted
403 * @param mixed a required parameter
405 * @return the sorted array
409 function PMA_cmp(&$a, $b)
411 return (strcmp($a[1], $b[1]));
412 } // end of the 'PMA_cmp()' function
414 uasort($available_languages, 'PMA_cmp');
415 foreach ($available_languages AS $id => $tmplang) {
416 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
418 $selected = ' selected="selected"';
423 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
427 <noscript
><input type
="submit" value
="Go" style
="vertical-align: middle" /></noscript
>
435 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
436 && $server != 0 && $allow_recoding && PMA_MYSQL_INT_VERSION
< 40100) {
439 <!-- Charset Selection
-->
441 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'','s_asci.png',$strMySQLCharset,'') : $str_normal_list);
444 <form method
="post" action
="index.php" target
="_parent">
445 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
446 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
447 <?php
echo $strMySQLCharset;?
>:
448 <select name
="convcharset" dir
="ltr" onchange
="this.form.submit();" style
="vertical-align: middle">
451 foreach ($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
452 if ($convcharset == $tmpcharset) {
453 $selected = ' selected="selected"';
458 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
462 <noscript
><input type
="submit" value
="Go" style
="vertical-align: middle" /></noscript
>
467 } elseif ($server != 0 && PMA_MYSQL_INT_VERSION
>= 40100) {
468 echo ' <!-- Charset Info -->' . "\n"
470 .' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'','s_asci.png',$strMySQLCharset,'') : $str_normal_list) . "\n"
472 . ' ' . $strMySQLCharset . ': '
474 . ' ' . $mysql_charsets_descriptions[$mysql_charset_map[strtolower($charset)]] . "\n"
475 . ' (' . $mysql_charset_map[strtolower($charset)] . ')' . "\n"
479 . ' <!-- MySQL Connection Collation -->' . "\n"
481 .' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'','s_asci.png',$strMySQLConnectionCollation,'') : $str_normal_list) . "\n"
483 . ' <form method="post" action="index.php" target="_parent">' . "\n"
484 . PMA_generate_common_hidden_inputs(NULL, NULL, 4, 'collation_connection')
485 . ' <label for="select_collation_connection">' . "\n"
486 . ' ' . $strMySQLConnectionCollation . ': ' . "\n"
488 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
, 'collation_connection', 'select_collation_connection', $collation_connection, TRUE, 4, TRUE)
489 . ' <noscript><input type="submit" value="' . $strGo . '" style="vertical-align: middle" /></noscript>' . "\n"
490 // put the doc link in the form so that it appears on the same line
491 . PMA_showMySQLDocu('MySQL_Database_Administration', 'Charset-connection') . "\n"
498 // added by Michael Keck <mail_at_michaelkeck_dot_de>
499 // ThemeManager if available
501 if (isset($available_themes_choices) && $available_themes_choices > 1) {
502 $theme_selected = FALSE;
503 $theme_preview_path= './themes.php';
504 $theme_preview_href = '<a href="' . $theme_preview_path . '" target="themes" onclick="'
505 . "window.open('" . $theme_preview_path . "','themes','left=10,top=20,width=510,height=350,scrollbars=yes,status=yes,resizable=yes');"
508 <!-- Theme Manager
-->
511 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,$theme_preview_href,'s_theme.png',(isset($strTheme) ?
$strTheme : 'Theme (Style)'),'</a>') : $str_normal_list) . "\n";
514 <form name
="setTheme" method
="post" action
="index.php" target
="_parent">
516 echo PMA_generate_common_hidden_inputs('', '', 5);
517 echo $theme_preview_href
518 . (isset($strTheme) ?
$strTheme : 'Theme (Style)')
521 <select name
="set_theme" dir
="ltr" onchange
="this.form.submit();" style
="vertical-align: middle">
523 foreach ($available_themes_choices AS $cur_theme) {
524 echo '<option value="' . $cur_theme . '"';
525 if ($cur_theme == $theme) {
526 echo ' selected="selected"';
528 echo '>' . htmlspecialchars($available_themes_choices_names[$cur_theme]) . '</option>';
532 <noscript
><input type
="submit" value
="Go" style
="vertical-align: middle" /></noscript
>
539 <!-- Documentation
-->
541 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="Documentation.html" target="documentation">','b_docs.png',$strPmaDocumentation,'</a>') : $str_normal_list);
544 <a href
="Documentation.html" target
="documentation"><b
><?php
echo $strPmaDocumentation; ?
></b
></a
>
549 if ($is_superuser ||
$cfg['ShowPhpInfo']) {
551 <!-- PHP Information
-->
553 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);
556 <a href
="phpinfo.php?<?php echo PMA_generate_common_url(); ?>" target
="_blank"><?php
echo $strShowPHPInfo; ?
></a
>
564 <!-- phpMyAdmin related urls
-->
566 echo ' ' . ($str_iconic_list != '' ?
sprintf($str_iconic_list,'<a href="http://www.phpMyAdmin.net/" target="_blank">','b_home.png',$strHomepageOfficial,'</a>') : $str_normal_list);
569 <a href
="http://www.phpMyAdmin.net/" target
="_blank"><?php
echo $strHomepageOfficial; ?
></a
>
574 echo '<td><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" /></td>';
577 [<a href
="changelog.php" target
="_blank">ChangeLog
</a
>]
578  
; 
; 
;[<a href
="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmyadmin/phpMyAdmin/" target
="_blank">CVS
</a
>]
579  
; 
; 
;[<a href
="http://sourceforge.net/mail/?group_id=23067" target
="_blank">Lists
</a
>]
593 * Displays the "empty $cfg['PmaAbsoluteUri'] warning"
594 * modified: 2004-05-05 mkkeck
596 if ($display_pmaAbsoluteUri_warning) {
597 echo '<div class="warning">' . $strPmaUriError . '</div>' . "\n";
601 * Warning if using the default MySQL privileged account
602 * modified: 2004-05-05 mkkeck
605 && $cfg['Server']['user'] == 'root'
606 && $cfg['Server']['password'] == '') {
607 echo '<div class="warning">' . $strInsecureMySQL . '</div>' . "\n";
611 * Warning for PHP 4.2.3
612 * modified: 2004-05-05 mkkeck
615 if (PMA_PHP_INT_VERSION
== 40203 && @extension_loaded
('mbstring')) {
616 echo '<div class="warning">' . $strPHP40203 . '</div>' . "\n";
620 * Nijel: As we try to hadle charsets by ourself, mbstring overloads just
621 * break it, see bug 1063821.
624 if (@extension_loaded
('mbstring') && @ini_get
('mbstring.func_overload') > 1) {
625 echo '<div class="warning">' . $strMbOverloadWarning . '</div>' . "\n";
629 * Nijel: mbstring is used for handling multibyte inside parser, so it is good
630 * to tell user something might be broken without it, see bug #1063149.
632 if ($GLOBALS['using_mb_charset'] && !@extension_loaded
('mbstring')) {
633 echo '<div class="warning">' . $strMbExtensionMissing . '</div>' . "\n";
637 * Warning for old PHP version
638 * modified: 2004-05-05 mkkeck
641 if (PMA_PHP_INT_VERSION
< 40100) {
642 echo '<div class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</div>' . "\n";
646 * Warning for old MySQL version
647 * modified: 2004-05-05 mkkeck
649 // not yet defined before the server choice
650 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION
< 32332) {
651 echo '<div class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</div>' . "\n";
654 * Displays the footer
657 require_once('./footer.inc.php');