home *** CD-ROM | disk | FTP | other *** search
/ Freelog 70 / Freelog070.iso / Internet / EasyPHP / easyphp1-8_setup.exe / {app} / phpmyadmin / main.php < prev    next >
Encoding:
PHP Script  |  2005-02-09  |  31.5 KB  |  806 lines

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