home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / db_details_structure.php < prev    next >
Encoding:
PHP Script  |  2004-01-01  |  30.9 KB  |  724 lines

  1. <?php
  2. /* $Id: db_details_structure.php,v 2.6 2004/01/02 12:01:04 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. require_once('./libraries/grab_globals.lib.php');
  7. require_once('./libraries/common.lib.php');
  8. require_once('./libraries/mysql_charsets.lib.php');
  9.  
  10. /**
  11.  * Prepares the tables list if the user where not redirected to this script
  12.  * because there is no table in the database ($is_info is TRUE)
  13.  */
  14. if (empty($is_info)) {
  15.     // Drops/deletes/etc. multiple tables if required
  16.     if ((!empty($submit_mult) && isset($selected_tbl))
  17.        || isset($mult_btn)) {
  18.         $action = 'db_details_structure.php';
  19.         $err_url = 'db_details_structure.php?'. PMA_generate_common_url($db);
  20.         require('./mult_submits.inc.php');
  21.     }
  22.     require('./db_details_common.php');
  23.     $url_query .= '&goto=db_details_structure.php';
  24.  
  25.     // Gets the database structure
  26.     $sub_part = '_structure';
  27.     require('./db_details_db_info.php');
  28.     echo "\n";
  29.  
  30.     /**
  31.      * Show result of multi submit operation
  32.      */
  33.     if ((!empty($submit_mult) && isset($selected_tbl))
  34.        || isset($mult_btn)) {
  35.         PMA_showMessage($strSuccess);
  36.     }
  37. }
  38.  
  39. if (PMA_MYSQL_INT_VERSION >= 40100) {
  40.     $db_collation = PMA_getDbCollation($db);
  41. }
  42.  
  43.  
  44. // Display function
  45. function pma_TableHeader($alternate = FALSE) {
  46.     echo '            <table border="' . $GLOBALS['cfg']['Border'] . '">' . "\n"
  47.        . '            <tr>' . "\n"
  48.        . '                <td></td>' . "\n"
  49.        . '                <th>' . "\n"
  50.        . '                     ' . $GLOBALS['strTable'] . ' ' . "\n"
  51.        . '                </th>' . "\n"
  52.        . '                <th colspan="6">' . "\n"
  53.        . '                     ' . $GLOBALS['strAction'] . ' ' . "\n"
  54.        . '                </th>' . "\n"
  55.        . '                <th>' . "\n"
  56.        . '                     ' .  $GLOBALS['strRecords'] . ' ' . "\n"
  57.        . '                </th>' . "\n";
  58.     if (!$alternate) {
  59.         if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
  60.             echo '                <th>' . "\n"
  61.                . '                     ' . $GLOBALS['strType'] . ' ' . "\n"
  62.                . '                </th>' . "\n";
  63.             if (PMA_MYSQL_INT_VERSION >= 40100) {
  64.                 echo '                <th>' . "\n"
  65.                    . '                     ' . $GLOBALS['strCollation'] . ' ' . "\n"
  66.                    . '                </th>' . "\n";
  67.             }
  68.         }
  69.         if ($GLOBALS['cfg']['ShowStats']) {
  70.             echo '                <th>' . "\n"
  71.                . '                     ' . $GLOBALS['strSize'] . ' ' . "\n"
  72.                . '                </th>' . "\n"
  73.                . '                <th>' . "\n"
  74.                . '                     ' . $GLOBALS['strOverhead'] . ' ' . "\n"
  75.                . '                </th>' . "\n";
  76.         }
  77.         echo "\n";
  78.     }
  79.     echo '            </tr>' . "\n";
  80. }
  81.  
  82.  
  83. /**
  84.  * Settings for relations stuff
  85.  */
  86. require_once('./libraries/relation.lib.php');
  87. $cfgRelation = PMA_getRelationsParam();
  88.  
  89. /**
  90.  * Check if comments were updated
  91.  */
  92. if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') {
  93.     PMA_SetComment($db, '', '(db_comment)', $comment);
  94. }
  95.  
  96. /**
  97.  * Displays the tables list
  98.  */
  99. ?>
  100.  
  101. <!-- TABLE LIST -->
  102.  
  103. <?php
  104. $titles = array();
  105. if ($cfg['PropertiesIconic'] == true) {
  106.     // We need to copy the value or else the == 'both' check will always return true
  107.     $propicon = (string)$cfg['PropertiesIconic'];
  108.  
  109.     if ($propicon == 'both') {
  110.         $iconic_spacer = '<nobr>';
  111.     } else {
  112.         $iconic_spacer = '';
  113.     }
  114.  
  115.     $titles['Browse']     = $iconic_spacer . '<img hspace="7" width="12" height="13" src="images/button_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" border="0" />';
  116.     $titles['Search']     = $iconic_spacer . '<img hspace="7" width="14" height="13" src="images/button_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" border="0" />';
  117.     $titles['NoBrowse']   = $iconic_spacer . '<img hspace="7" width="12" height="13" src="images/button_nobrowse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" border="0" />';
  118.     $titles['NoSearch']   = $iconic_spacer . '<img hspace="7" width="14" height="13" src="images/button_noselect.png" alt="' . $strSearch . '" title="' . $strSearch . '" border="0" />';
  119.     $titles['Insert']     = $iconic_spacer . '<img hspace="7" width="13" height="13" src="images/button_insert.png" alt="' . $strInsert . '" title="' . $strInsert . '" border="0" />';
  120.     $titles['Properties'] = $iconic_spacer . '<img hspace="7" width="18" height="13" src="images/button_properties.png" alt="' . $strProperties . '" title="' . $strProperties . '" border="0" />';
  121.     $titles['Drop']       = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
  122.     $titles['Empty']      = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" border="0" />';
  123.     $titles['NoEmpty']    = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noempty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" border="0" />';
  124.  
  125.     if ($propicon == 'both') {
  126.         $titles['Browse']     .= ' ' . $strBrowse . '</nobr>';
  127.         $titles['Search']     .= ' ' . $strSearch . '</nobr>';
  128.         $titles['NoBrowse']   .= ' ' . $strBrowse . '</nobr>';
  129.         $titles['NoSearch']   .= ' ' . $strSearch . '</nobr>';
  130.         $titles['Insert']     .= ' ' . $strInsert . '</nobr>';
  131.         $titles['Properties'] .= ' ' . $strProperties . '</nobr>';
  132.         $titles['Drop']       .= ' ' . $strDrop . '</nobr>';
  133.         $titles['Empty']      .= ' ' . $strEmpty . '</nobr>';
  134.         $titles['NoEmpty']    .= ' ' . $strEmpty . '</nobr>';
  135.     }
  136. } else {
  137.     $titles['Browse']     = $strBrowse;
  138.     $titles['Search']     = $strSearch;
  139.     $titles['NoBrowse']   = $strBrowse;
  140.     $titles['NoSearch']   = $strSearch;
  141.     $titles['Insert']     = $strInsert;
  142.     $titles['Properties'] = $strProperties;
  143.     $titles['Drop']       = $strDrop;
  144.     $titles['Empty']      = $strEmpty;
  145.     $titles['NoEmpty']    = $strEmpty;
  146. }
  147.  
  148. // 1. No tables
  149. if ($num_tables == 0) {
  150.     echo $strNoTablesFound . "\n";
  151. }
  152. // 2. Shows table informations - staybyte - 11 June 2001
  153. else {
  154.     // Get additional information about tables for tooltip
  155.     if ($cfg['ShowTooltip']) {
  156.         $tooltip_truename = array();
  157.         $tooltip_aliasname = array();
  158.  
  159.         $result  = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
  160.         while ($tmp = PMA_mysql_fetch_array($result)) {
  161.             $tooltip_truename[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
  162.             $tooltip_aliasname[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''));
  163.             if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
  164.                 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCreateTime . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
  165.             }
  166.  
  167.             if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
  168.                 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatUpdateTime . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
  169.             }
  170.  
  171.             if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
  172.                 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCheckTime . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
  173.             }
  174.  
  175.         } // end while
  176.     } // end if
  177.  
  178.     if ($cfgRelation['commwork']) {
  179.         $comment = PMA_getComments($db);
  180.  
  181.         /**
  182.          * Displays table comment
  183.          */
  184.         if (is_array($comment)) {
  185.             ?>
  186.         <!-- DB comment -->
  187.         <p><i>
  188.             <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?>
  189.         </i></p>
  190.             <?php
  191.         } // end if
  192.     }
  193.     ?>
  194. <form method="post" action="db_details_structure.php" name="tablesForm">
  195.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  196.  
  197. <?php
  198.     if ($cfg['PropertiesNumColumns'] > 1) {
  199. ?>
  200. <table cellspacing="0" cellpadding="0" border="0">
  201.     <tr>
  202.         <td valign="top">
  203. <?php
  204.     }
  205.  
  206.     pma_TableHeader();
  207.  
  208.     $i = $sum_entries = 0;
  209.     (double) $sum_size = 0;
  210.     (double) $overhead_size = 0;
  211.     $overhead_check = '';
  212.     $checked   = (!empty($checkall) ? ' checked="checked"' : '');
  213.     $num_columns = ($cfg['PropertiesNumColumns'] > 1 ? (ceil($num_tables / $cfg['PropertiesNumColumns']) + 1) : 0);
  214.     $row_count = 0;
  215.     foreach($tables AS $keyname => $sts_data) {
  216.         $table         = $sts_data['Name'];
  217.         $table_encoded = urlencode($table);
  218.         $table_name    = htmlspecialchars($table);
  219.  
  220.         $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$table]))
  221.                    ? htmlspecialchars($tooltip_aliasname[$table])
  222.                    : htmlspecialchars($sts_data['Name']);
  223.         $truename = (!empty($tooltip_truename) && isset($tooltip_truename[$table]))
  224.                    ? htmlspecialchars($tooltip_truename[$table])
  225.                    : htmlspecialchars($sts_data['Name']);
  226.  
  227.         // Sets parameters for links
  228.         $tbl_url_query = $url_query . '&table=' . $table_encoded;
  229.         $bgcolor       = ($i++ % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  230.         echo "\n";
  231.  
  232.         $row_count++;
  233.         if($num_columns > 0 && $num_tables > $num_columns && (($row_count % ($num_columns)) == 0)) {
  234.             $bgcolor       = $cfg['BgcolorTwo'];
  235.             $row_count = 1;
  236.         ?>
  237.             </tr>
  238.         </table>
  239.     </td>
  240.     <td><img src="./images/spacer.gif" border="0" width="10" height="1" alt="" /></td>
  241.     <td valign="top">
  242.         <?php
  243.             pma_TableHeader();
  244.         }
  245.         ?>
  246.             <tr>
  247.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  248.                     <input type="checkbox" name="selected_tbl[]" value="<?php echo $table_encoded; ?>" id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> />
  249.                 </td>
  250.                 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
  251.                      <b><label for="checkbox_tbl_<?php echo $i; ?>" title="<?php echo $alias; ?>"><?php echo $truename; ?></label> </b> 
  252.                 </td>
  253.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  254.         <?php
  255.         require_once('./libraries/bookmark.lib.php');
  256.         $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
  257.  
  258.         if (!empty($sts_data['Rows'])) {
  259.             echo '<a href="sql.php?' . $tbl_url_query . '&sql_query='
  260.                  . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table)))
  261.                  . '&pos=0">' . $titles['Browse'] . '</a>';
  262.         } else {
  263.             echo $titles['NoBrowse'];
  264.         }
  265.         ?>
  266.                 </td>
  267.                 <td bgcolor="<?php echo $bgcolor; ?>">
  268.         <?php
  269.         if (!empty($sts_data['Rows'])) {
  270.             echo '<a href="tbl_select.php?' . $tbl_url_query . '">'
  271.                  . $titles['Search'] . '</a>';
  272.         } else {
  273.             echo $titles['NoSearch'];
  274.         }
  275.         ?>
  276.                 </td>
  277.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  278.         <a href="tbl_change.php?<?php echo $tbl_url_query; ?>">
  279.             <?php echo $titles['Insert']; ?></a>
  280.                 </td>
  281.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  282.         <a href="tbl_properties_structure.php?<?php echo $tbl_url_query; ?>">
  283.             <?php echo $titles['Properties']; ?></a>
  284.                 </td>
  285.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  286.         <a href="sql.php?<?php echo $tbl_url_query; ?>&reload=1&purge=1&sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
  287.             onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
  288.             <?php echo $titles['Drop']; ?></a>
  289.                 </td>
  290.                 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
  291.         <?php
  292.         if (!empty($sts_data['Rows'])) {
  293.             echo '<a href="sql.php?' . $tbl_url_query
  294.                  . '&sql_query=';
  295.             if (PMA_MYSQL_INT_VERSION >= 40000) {
  296.                 echo urlencode('TRUNCATE ' . PMA_backquote($table))
  297.                      . '&zero_rows='
  298.                      . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
  299.                      . '" onclick="return confirmLink(this, \'TRUNCATE ';
  300.             } else {
  301.                 echo urlencode('DELETE FROM ' . PMA_backquote($table))
  302.                      . '&zero_rows='
  303.                      . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
  304.                      . '" onclick="return confirmLink(this, \'DELETE FROM ';
  305.             }
  306.             echo PMA_jsFormat($table) . '\')">' . $titles['Empty'] . '</a>';
  307.         } else {
  308.              echo $titles['NoEmpty'];
  309.         }
  310.         ?>
  311.                 </td>
  312.         <?php
  313.         echo "\n";
  314.  
  315.         // loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to get valid
  316.         //        statistics whatever is the table type
  317.         if (isset($sts_data['Rows'])) {
  318.             // MyISAM, ISAM or Heap table: Row count, data size and index size
  319.             // is accurate.
  320.             if (isset($sts_data['Type']) && preg_match('@^(MyISAM|ISAM|HEAP)$@', $sts_data['Type'])) {
  321.                 if ($cfg['ShowStats']) {
  322.                     $tblsize                    =  doubleval($sts_data['Data_length']) + doubleval($sts_data['Index_length']);
  323.                     $sum_size                   += $tblsize;
  324.                     list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
  325.                     if (isset($sts_data['Data_free']) && $sts_data['Data_free'] > 0) {
  326.                         list($formated_overhead, $overhead_unit)     = PMA_formatByteDown($sts_data['Data_free']);
  327.                         $overhead_size           += $sts_data['Data_free'];
  328.                     }
  329.                 }
  330.                 $sum_entries                    += $sts_data['Rows'];
  331.                 $display_rows                   =  number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator);
  332.             }
  333.  
  334.             // InnoDB table: Row count is not accurate but data and index
  335.             // sizes are.
  336.             else if (isset($sts_data['Type']) && $sts_data['Type'] == 'InnoDB') {
  337.                 if ($cfg['ShowStats']) {
  338.                     $tblsize                    =  $sts_data['Data_length'] + $sts_data['Index_length'];
  339.                     $sum_size                   += $tblsize;
  340.                     list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
  341.                 }
  342.                 //$display_rows                   =  ' - ';
  343.                 // get row count with another method
  344.                 if ($sts_data['Rows'] < $cfg['MaxExactCount']) {
  345.                     $local_query         = 'SELECT COUNT(*) AS count FROM '
  346.                                          . PMA_backquote($db) . '.'
  347.                                          . PMA_backquote($table);
  348.                     $table_info_result   = PMA_mysql_query($local_query)
  349.                                          or PMA_mysqlDie('', $local_query, '', $err_url_0);
  350.                     $row_count           = PMA_mysql_result($table_info_result, 0, 'count');
  351.                     $sum_entries         += $row_count;
  352.                 } else {
  353.                     $row_count           = $sts_data['Rows'];
  354.                     $sum_entries         += $sts_data['Rows'];
  355.                 }
  356.                 $display_rows        = number_format($row_count, 0, $number_decimal_separator, $number_thousands_separator);
  357.             }
  358.  
  359.             // Merge or BerkleyDB table: Only row count is accurate.
  360.             else if (isset($sts_data['Type']) && preg_match('@^(MRG_MyISAM|BerkeleyDB)$@', $sts_data['Type'])) {
  361.                 if ($cfg['ShowStats']) {
  362.                     $formated_size              =  ' - ';
  363.                     $unit                       =  '';
  364.                 }
  365.                 $sum_entries                    += $sts_data['Rows'];
  366.                 $display_rows                   =  number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator);
  367.             }
  368.  
  369.             // Unknown table type.
  370.             else {
  371.                 if ($cfg['ShowStats']) {
  372.                     $formated_size              =  'unknown';
  373.                     $unit                       =  '';
  374.                 }
  375.                 $display_rows                   =  'unknown';
  376.             }
  377.             ?>
  378.                 <td align="right" bgcolor="<?php echo $bgcolor; ?>">
  379.             <?php
  380.             echo "\n" . '        ' . $display_rows . "\n";
  381.             ?>
  382.                 </td>
  383.             <?php
  384.             if (!($cfg['PropertiesNumColumns'] > 1)) {
  385.                 echo '                <td bgcolor="' . $bgcolor . '" nowrap="nowrap">' . "\n"
  386.                    . '                     ' . (isset($sts_data['Type']) ? $sts_data['Type'] : ' ') . ' ' . "\n"
  387.                    . '                </td>' . "\n";
  388.                 if (PMA_MYSQL_INT_VERSION >= 40100) {
  389.                     echo '                <td bgcolor="' . $bgcolor . '" nowrap="nowrap">' . "\n"
  390.                        . '                     ' . (isset($sts_data['Collation']) ? '<dfn title="' . PMA_getCollationDescr($sts_data['Collation']) . '">' . $sts_data['Collation'] . '</dfn>' : '---') . ' ' . "\n"
  391.                        . '                </td>' . "\n";
  392.                 }
  393.             }
  394.  
  395.             if ($cfg['ShowStats']) {
  396.                 echo "\n";
  397.                 ?>
  398.                 <td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
  399.                       
  400.                     <a href="tbl_properties_structure.php?<?php echo $tbl_url_query; ?>#showusage"><?php echo $formated_size . ' ' . $unit; ?></a>
  401.                 </td>
  402.                 <td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
  403.                       
  404.                     <?php
  405.                     if (isset($formated_overhead)) {
  406.                         echo '<a href="tbl_properties_structure.php?' . $tbl_url_query . '#showusage">' . $formated_overhead . ' ' . $overhead_unit . '</a>' . "\n";
  407.                         unset($formated_overhead);
  408.                         $overhead_check .= "document.getElementById('checkbox_tbl_$i').checked = true;";
  409.                     } else {
  410.                         echo " - \n";
  411.                     }
  412.                     ?>
  413.                 </td>
  414.                 <?php
  415.                 echo "\n";
  416.             } // end if
  417.         } else {
  418.             ?>
  419.                 <td colspan="3" align="center" bgcolor="<?php echo $bgcolor; ?>">
  420.                     <?php echo $strInUse . "\n"; ?>
  421.                 </td>
  422.             <?php
  423.         }
  424.         echo "\n";
  425.         ?>
  426.             </tr>
  427.         <?php
  428.     }
  429.     // Show Summary
  430.     if ($cfg['ShowStats']) {
  431.         list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
  432.         list($overhead_formated, $overhead_unit) = PMA_formatByteDown($overhead_size, 3, 1);
  433.     }
  434.     echo "\n";
  435.     ?>
  436.             <tr>
  437.                 <td></td>
  438.                 <th align="center" nowrap="nowrap">
  439.                      <b><?php echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?></b> 
  440.                 </th>
  441.                 <th colspan="6" align="center">
  442.                     <b><?php echo $strSum; ?></b>
  443.                 </th>
  444.                 <th align="right" nowrap="nowrap">
  445.                     <b><?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?></b>
  446.                 </th>
  447.     <?php
  448.     if (!($cfg['PropertiesNumColumns'] > 1)) {
  449.         echo '                <th align="center">' . "\n"
  450.            . '                    <b>--</b>' . "\n"
  451.            . '                </th>' . "\n";
  452.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  453.             echo '                <th align="center">' . "\n"
  454.                . '                     <b><dfn title="' . PMA_getCollationDescr($db_collation) . '">' . $db_collation . '</dfn></b> ' . "\n"
  455.                . '                </th>' . "\n";
  456.         }
  457.     }
  458.  
  459.     if ($cfg['ShowStats']) {
  460.         echo "\n";
  461.         ?>
  462.                 <th align="right" nowrap="nowrap">
  463.                      
  464.                     <b><?php echo $sum_formated . ' ' . $unit; ?></b>
  465.                 </th>
  466.                 <th align="right" nowrap="nowrap">
  467.                      
  468.                     <b><?php echo $overhead_formated . ' ' . $overhead_unit; ?></b>
  469.                 </th>
  470.         <?php
  471.     }
  472.     echo "\n";
  473.     ?>
  474.             </tr>
  475.  
  476.     <?php
  477.     // Check all tables url
  478.     $checkall_url = 'db_details_structure.php?' . PMA_generate_common_url($db);
  479.     echo "\n";
  480.     ?>
  481.             <tr>
  482.                 <td colspan="<?php echo (($cfg['ShowStats']) ? '11' : '10'); ?>" valign="bottom">
  483.                     <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
  484.                     <a href="<?php echo $checkall_url; ?>&checkall=1" onclick="setCheckboxes('tablesForm', true); return false;">
  485.                         <?php echo $strCheckAll; ?></a>
  486.                      / 
  487.                     <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('tablesForm', false); return false;">
  488.                         <?php echo $strUncheckAll; ?></a>
  489.                     <?php if ($overhead_check != '') { ?>
  490.                      / 
  491.                     <a href="#" onclick="setCheckboxes('tablesForm', false); <?php echo $overhead_check; ?> return false;">
  492.                         <?php echo $strCheckOverhead; ?></a>
  493.                     <?php } ?>
  494.                        
  495.                     <img src="./images/spacer.gif" border="0" width="38" height="1" alt="" />
  496.                     <select name="submit_mult" dir="ltr" onchange="this.form.submit();">
  497.     <?php
  498.     echo "\n";
  499.     echo '            <option value="' . $strWithChecked . '" selected="selected">'
  500.          . $strWithChecked . '</option>' . "\n";
  501.     echo '            <option value="' . $strDrop . '" >'
  502.          . $strDrop . '</option>' . "\n";
  503.     echo '            <option value="' . $strEmpty . '" >'
  504.          . $strEmpty . '</option>' . "\n";
  505.     echo '            <option value="' . $strPrintView . '" >'
  506.          . $strPrintView . '</option>' . "\n";
  507.     echo '            <option value="' . $strCheckTable . '" >'
  508.          . $strCheckTable . '</option>' . "\n";
  509.     echo '            <option value="' . $strOptimizeTable . '" >'
  510.          . $strOptimizeTable . '</option>' . "\n";
  511.     echo '            <option value="' . $strRepairTable . '" >'
  512.          . $strRepairTable . '</option>' . "\n";
  513.     echo '            <option value="' . $strAnalyzeTable . '" >'
  514.          . $strAnalyzeTable . '</option>' . "\n";
  515.     ?>
  516.                     </select>
  517.                     <script type="text/javascript" language="javascript">
  518.                     <!--
  519.                     // Fake js to allow the use of the <noscript> tag
  520.                     //-->
  521.                     </script>
  522.                     <noscript>
  523.                         <input type="submit" value="<?php echo $strGo; ?>" />
  524.                     </noscript>
  525.                 </td>
  526.             </tr>
  527.             </table>
  528. <?php
  529. if ($cfg['PropertiesNumColumns'] > 1) {
  530. ?>
  531.         </td>
  532.     </tr>
  533. </table>
  534. <?php
  535. }
  536. ?>
  537. </form>
  538.     <?php
  539. } // end if more than one table
  540.  
  541. echo "\n";
  542. ?>
  543. <hr />
  544.  
  545. <?php
  546. /**
  547.  * Work on the database
  548.  */
  549. ?>
  550. <!-- DATABASE WORK -->
  551. <ul>
  552.  
  553. <?php
  554. if ($num_tables > 0) {
  555.     ?>
  556.     <!-- Printable view of a table -->
  557.     <li>
  558.         <div style="margin-bottom: 10px"><a href="db_printview.php?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
  559.     </li>
  560.     <li>
  561.          <div style="margin-bottom: 10px"><a href="./db_datadict.php?<?php echo $url_query; ?>"><?php echo $strDataDict; ?></a></div>
  562.     </li>
  563.     <?php
  564. } // end if
  565. ?>
  566.  
  567. <?php
  568. if ($cfgRelation['commwork']) {
  569. ?>
  570.     <!-- Alter/Enter db-comment -->
  571.     <li>
  572.         <form method="post" action="db_details_structure.php">
  573.             <?php echo $strDBComment; ?>
  574.             <input type="hidden" name="db_comment" value="true" />
  575.             <?php echo PMA_generate_common_hidden_inputs($db); ?>
  576.             <input type="text" name="comment" class="textfield" value="<?php echo (isset($comment) && is_array($comment) ? htmlspecialchars(implode(' ', $comment)) : ''); ?>" />
  577.             <input type="submit" value="<?php echo $strGo; ?>" />
  578.         </form>
  579.     </li>
  580. <?php
  581. }
  582. ?>
  583.  
  584.     <!-- Create a new table -->
  585.     <li>
  586.         <form method="post" action="tbl_create.php"
  587.             onsubmit="return (emptyFormElements(this, 'table') && checkFormElementInRange(this, 'num_fields', 1))">
  588.         <?php echo PMA_generate_common_hidden_inputs($db); ?>
  589. <?php
  590. echo '        ' . sprintf($strCreateNewTable, htmlspecialchars($db)) . ' :<br />' . "\n";
  591. echo '        ' . $strName . ' : ' . "\n";
  592. echo '        ' . '<input type="text" name="table" maxlength="64" class="textfield" />' . "\n";
  593. echo '        ' . '<br />' . "\n";
  594. echo '        ' . $strFields . ' : ' . "\n";
  595. echo '        ' . '<input type="text" name="num_fields" size="2" class="textfield" />' . "\n";
  596. echo '        ' . ' <input type="submit" value="' . $strGo . '" />' . "\n";
  597. ?>
  598.         </form>
  599.     </li>
  600.  
  601. <?php
  602.  
  603. if (PMA_MYSQL_INT_VERSION >= 40101) {
  604.     // MySQL supports setting default charsets / collations for databases since
  605.     // version 4.1.1.
  606.     echo '    <!-- Change database charset -->' . "\n"
  607.        . '    <li>' . "\n"
  608.        . '        <form method="post" action="./db_details_structure.php">' . "\n"
  609.        . PMA_generate_common_hidden_inputs($db, $table, 3)
  610.        . '            ' . $strCharset . ' : ' . "\n"
  611.        . '            <select name="db_charset" style="vertical-align: middle">' . "\n";
  612.        $real_charset = strpos($db_collation, '_') ? substr($db_collation, 0, strpos($db_collation, '_')) : $db_collation;
  613.     for ($i = 1; isset($mysql_charsets[$i]); $i++) {
  614.         echo '                <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
  615.     }
  616.     unset($i, $real_charset);
  617.     echo '            </select> ' . "\n"
  618.        . '            <input type="submit" name="submitcharset" value="' . $strGo . '" style="vertical-align: middle" /> ' . "\n"
  619.        . '        </form>' . "\n"
  620.        . '    </li>' . "\n\n";
  621. }
  622.  
  623. if ($num_tables > 0
  624.     && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) {
  625.     echo '    <li>' . "\n";
  626.     echo '        <div style="margin-bottom: 10px">' . "\n";
  627.     echo '        <font color="red">' . $strError . '</font><br />' . "\n";
  628.     $url_to_goto = '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">';
  629.     echo '        ' . sprintf($strRelationNotWorking, $url_to_goto, '</a>') . "\n";
  630.     echo '        </div>' . "\n";
  631.     echo '    </li>' . "\n";
  632. } // end if
  633.  
  634. // is this OK to check for 'class' support?
  635. if ($num_tables > 0) {
  636.     $takeaway = $url_query . '&table=' . urlencode($table);
  637. }
  638.  
  639. if ($cfgRelation['pdfwork'] && $num_tables > 0) {
  640.     ?>
  641.     <!-- Work on PDF Pages -->
  642.     <li>
  643.         <div style="margin-bottom: 10px"><a href="pdf_pages.php?<?php echo $takeaway; ?>"><?php echo $strEditPDFPages; ?></a></div>
  644.     </li>
  645.  
  646.     <!-- PDF schema -->
  647.     <?php
  648.     // We only show this if we find something in the new pdf_pages table
  649.  
  650.     $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
  651.                 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
  652.     $test_rs    = PMA_query_as_cu($test_query);
  653.     if ($test_rs && mysql_num_rows($test_rs) > 0) {
  654.         echo "\n";
  655.         ?>
  656.     <li>
  657.         <form method="post" action="pdf_schema.php">
  658.             <?php echo PMA_generate_common_hidden_inputs($db); ?>
  659.             <?php echo $strDisplayPDF; ?> :<br />
  660.             <?php echo $strPageNumber; ?> 
  661.             <select name="pdf_page_number">
  662.         <?php
  663.         while ($pages = @PMA_mysql_fetch_array($test_rs)) {
  664.             echo "\n" . '                '
  665.                  . '<option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>';
  666.         } // end while
  667.         echo "\n";
  668.         ?>
  669.             </select><br />
  670.             <input type="checkbox" name="show_grid" id="show_grid_opt" />
  671.             <label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
  672.             <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
  673.             <label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
  674.             <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
  675.             <label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
  676.             <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" />
  677.             <label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label> <br />
  678.             <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
  679.             <label for="with_doc"><?php echo $strDataDict; ?></label> <br />
  680.             <?php echo $strShowDatadictAs; ?>
  681.             <select name="orientation">
  682.                 <option value="L"><?php echo $strLandscape;?></option>
  683.                 <option value="P"><?php echo $strPortrait;?></option>
  684.             </select><br />
  685.             <?php echo $strPaperSize; ?>
  686.             <select name="paper">
  687.             <?php
  688.                 foreach($cfg['PDFPageSizes'] AS $key => $val) {
  689.                     echo '<option value="' . $val . '"';
  690.                     if ($val == $cfg['PDFDefaultPageSize']) {
  691.                         echo ' selected="selected"';
  692.                     }
  693.                     echo ' >' . $val . '</option>' . "\n";
  694.                 }
  695.             ?>
  696.                 </select><br />
  697.                   <input type="submit" value="<?php echo $strGo; ?>" />
  698.             </form>
  699.     </li>
  700.         <?php
  701.     }   // end if
  702. } // end if
  703.  
  704. if ($num_tables > 0
  705.     && $cfgRelation['relwork'] && $cfgRelation['commwork']
  706.     && isset($cfg['docSQLDir']) && !empty($cfg['docSQLDir'])
  707.     ) {
  708.     ?>
  709.     <!-- import docSQL files -->
  710.     <li>
  711.         <div style="margin-bottom: 10px"><a href="db_details_importdocsql.php?<?php echo $takeaway . '">' . $strImportDocSQL; ?></a></div>
  712.     </li>
  713.     <?php
  714. }
  715. echo "\n" . '</ul>';
  716.  
  717.  
  718. /**
  719.  * Displays the footer
  720.  */
  721. echo "\n";
  722. require_once('./footer.inc.php');
  723. ?>
  724.