home *** CD-ROM | disk | FTP | other *** search
/ Freelog 70 / Freelog070.iso / Internet / EasyPHP / easyphp1-8_setup.exe / {app} / phpmyadmin / tbl_properties_operations.php < prev    next >
Encoding:
PHP Script  |  2005-01-05  |  25.0 KB  |  592 lines

  1. <?php
  2. /* $Id: tbl_properties_operations.php,v 2.26 2005/01/05 13:01:23 nijel Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * Runs common work
  8.  */
  9. require('./tbl_properties_common.php');
  10. //$err_url   = 'tbl_properties_operations.php' . $err_url;
  11. $url_query .= '&goto=tbl_properties_operations.php&back=tbl_properties_operations.php';
  12.  
  13.  
  14. /**
  15.  * Gets relation settings
  16.  */
  17. require_once('./libraries/relation.lib.php');
  18. $cfgRelation = PMA_getRelationsParam();
  19.  
  20. /**
  21.  * Gets available MySQL charsets
  22.  */
  23. require_once('./libraries/mysql_charsets.lib.php');
  24.  
  25. // reselect current db (needed in some cases probably due to
  26. // the calling of relation.lib.php)
  27. PMA_DBI_select_db($db);
  28.  
  29. /**
  30.  * Updates table comment, type and options if required
  31.  */
  32. if (isset($submitcomment)) {
  33.     if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
  34.         $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
  35.         $result    = PMA_DBI_query($sql_query);
  36.         $message   = $strSuccess;
  37.     }
  38. }
  39. if (isset($submittype)) {
  40.     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
  41.     $result        = PMA_DBI_query($sql_query);
  42.     $message       = $strSuccess;
  43. }
  44. if (isset($submitcollation)) {
  45.     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table) . ' DEFAULT' . PMA_generateCharsetQueryPart($tbl_collation);
  46.     $result        = PMA_DBI_query($sql_query);
  47.     $message       = $strSuccess;
  48.     unset($tbl_collation);
  49. }
  50. if (isset($submitoptions)) {
  51.     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table)
  52.                    . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
  53.                    . (isset($checksum) ? ' checksum=1': ' checksum=0')
  54.                    . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0')
  55.                    . (!empty($auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($auto_increment) : '');
  56.     $result        = PMA_DBI_query($sql_query);
  57.     $message       = $strSuccess;
  58. }
  59.  
  60. /**
  61.  * Reordering the table has been requested by the user
  62.  */
  63. if (isset($submitorderby) && !empty($order_field)) {
  64.     $sql_query   = 'ALTER TABLE ' . PMA_backquote($table)
  65.                  . ' ORDER BY ' . PMA_backquote(urldecode($order_field));
  66.     if (isset($order_order) && $order_order == 'desc') {
  67.         $sql_query .= ' DESC';
  68.     }
  69.     $result      = PMA_DBI_query($sql_query);
  70.     $message     = $result ? $strSuccess : $strFailed;
  71. } // end if
  72.  
  73. /**
  74.  * Gets tables informations
  75.  */
  76. require('./tbl_properties_table_info.php');
  77.  
  78. /**
  79.  * Displays top menu links
  80.  */
  81. require('./tbl_properties_links.php');
  82.  
  83. /**
  84.  * Get columns names
  85.  */
  86. $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
  87. $result      = PMA_DBI_query($local_query);
  88. for ($i = 0; $row = PMA_DBI_fetch_assoc($result); $i++) {
  89.         $columns[$i] = $row['Field'];
  90. }
  91. PMA_DBI_free_result($result);
  92. unset($result);
  93. ?>
  94.  
  95. <table border="0" align="left" cellpadding="3" cellspacing="0">
  96. <?php
  97.  
  98. /**
  99.  * Displays the page
  100.  */
  101.  
  102. if (PMA_MYSQL_INT_VERSION >= 32334) {
  103.     ?>
  104.     <!-- Order the table -->
  105.  
  106.     <form method="post" action="tbl_properties_operations.php">
  107.         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  108.         <tr>
  109.             <th class="tblHeaders" colspan="2" align="left"><?php echo $strAlterOrderBy; ?>: </th></tr>
  110.         <tr>
  111.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  112.                 <select name="order_field" style="vertical-align: middle">
  113.     <?php
  114.     echo "\n";
  115.     foreach ($columns AS $junk => $fieldname) {
  116.         echo '                <option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
  117.     }
  118.     unset($columns);
  119.     ?>
  120.                 </select> <?php echo $strSingly . "\n"; ?>
  121.                 <select name="order_order" style="vertical-align: middle">
  122.                     <option value="asc"><?php echo $strAscending; ?></option>
  123.                     <option value="desc"><?php echo $strDescending; ?></option>
  124.                 </select>
  125.             </td>
  126.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
  127.                 <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
  128.             </td>
  129.         </tr>
  130.     </form>
  131.         <tr><td colspan="2" height="5"></td></tr>
  132.     <?php
  133. }
  134. echo "\n";
  135. ?>
  136.     <!-- Change table name -->
  137.     <form method="post" action="tbl_rename.php" onsubmit="return emptyFormElements(this, 'new_name')">
  138.         <tr>
  139.             <th class="tblHeaders" colspan="2" align="left">
  140.                 <?php echo $strRenameTable; ?>: 
  141.                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  142.                 <input type="hidden" name="reload" value="1" />
  143.             </th>
  144.         </tr>
  145.         <tr>
  146.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  147.                 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" /> 
  148.             </td>
  149.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
  150.                 <input type="submit" value="<?php echo $strGo; ?>" />
  151.             </td>
  152.         </tr>
  153.     </form>
  154.         <tr><td colspan="2" height="5"></td></tr>
  155.     <!-- Move table -->
  156.     <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
  157.         <tr>
  158.             <th class="tblHeaders" colspan="2" align="left">
  159.                 <?php echo $strMoveTable . "\n"; ?>
  160.                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  161.                 <input type="hidden" name="reload" value="1" />
  162.                 <input type="hidden" name="what" value="data" />
  163.             </th>
  164.         </tr>
  165.         <tr>
  166.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" nowrap="nowrap">
  167.                 <select name="target_db">
  168. <?php
  169. // The function used below is defined in "common.lib.php"
  170. PMA_availableDatabases('main.php?' . PMA_generate_common_url());
  171. for ($i = 0; $i < $num_dbs; $i++) {
  172.     echo '                            ';
  173.     echo '<option value="' . htmlspecialchars($dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
  174.     echo "\n";
  175. } // end for
  176. ?>
  177.                 </select>
  178.                  <b>.</b> 
  179.                 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />
  180.             </td>
  181.             <td align="<?php echo $cell_align_right; ?>" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  182.                 <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" />
  183.             </td>
  184.         </tr>
  185.     </form>
  186.         <tr><td colspan="2" height="5"></td></tr>
  187.     <!-- Copy table -->
  188.     <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
  189.         <tr>
  190.             <th class="tblHeaders" colspan="2" align="left">
  191.                 <?php echo $strCopyTable . "\n"; ?>
  192.                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  193.                 <input type="hidden" name="reload" value="1" />
  194.             </th>
  195.         </tr>
  196.         <tr>
  197.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2" nowrap="nowrap">
  198.                 <select name="target_db">
  199. <?php
  200. for ($i = 0; $i < $num_dbs; $i++) {
  201.     echo '                    ';
  202.     echo '<option value="' . htmlspecialchars($dblist[$i]) . '"';
  203.     if ($dblist[$i] == $db) {
  204.         echo ' selected="selected"';
  205.     }
  206.     echo '>' . htmlspecialchars($dblist[$i]) . '</option>';
  207.     echo "\n";
  208. } // end for
  209. ?>
  210.                 </select>
  211.                  <b>.</b> 
  212.                 <input type="text" size="20" name="new_name" class="textfield" onfocus="this.select()" />
  213.             </td>
  214.         </tr>
  215.         <tr>
  216.             <td nowrap="nowrap" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  217.                 <input type="radio" name="what" value="structure" id="radio_copy_structure" style="vertical-align: middle" /><label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label>  <br />
  218.                 <input type="radio" name="what" value="data" id="radio_copy_data" checked="checked" style="vertical-align: middle" /><label for="radio_copy_data"><?php echo $strStrucData; ?></label>  <br />
  219.                 <input type="radio" name="what" value="dataonly" id="radio_copy_dataonly" style="vertical-align: middle" /><label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label>  <br />
  220.  
  221.                 <input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" style="vertical-align: middle" /><label for="checkbox_drop"><?php echo $strStrucDrop; ?></label>  <br />
  222.                 <input type="checkbox" name="auto_increment" value="1" id="checkbox_auto_increment" style="vertical-align: middle" /><label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br />
  223.                 <?php
  224.                     // display "Add constraints" choice only if there are
  225.                     // foreign keys
  226.                     if (PMA_getForeigners($db, $table, '', 'innodb')) {
  227.                 ?>
  228.                 <input type="checkbox" name="constraints" value="1" id="checkbox_constraints" style="vertical-align: middle" /><label for="checkbox_constraints"><?php echo $strAddConstraints; ?></label><br />
  229.                 <?php
  230.                     } // endif
  231.                     if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') {
  232.                         $pma_switch_to_new = 'true';
  233.                     }
  234.                 ?>
  235.                 <input type="checkbox" name="switch_to_new" value="true" id="checkbox_switch"<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?> style="vertical-align: middle" /><label for="checkbox_switch"><?php echo $strSwitchToTable; ?></label>  
  236.             </td>
  237.             <td align="<?php echo $cell_align_right; ?>" valign="bottom" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  238.                 <input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
  239.             </td>
  240.         </tr>
  241.     </form>
  242.         <tr><td colspan="2" height="5"></td></tr>
  243. <?php
  244.  
  245. /**
  246.  * Displays form controls
  247.  */
  248. ?>
  249.     <!-- Table comments -->
  250.     <form method="post" action="tbl_properties_operations.php">
  251.         <tr>
  252.             <th colspan="2" class="tblHeaders" align="left">
  253.                 <?php
  254.                 echo PMA_generate_common_hidden_inputs($db, $table);
  255.                 echo $strTableComments . ' ';
  256.                 if (strstr($show_comment, '; InnoDB free') === FALSE) {
  257.                     if (strstr($show_comment, 'InnoDB free') === FALSE) {
  258.                         // only user entered comment
  259.                         $comment = $show_comment;
  260.                     } else {
  261.                         // here we have just InnoDB generated part
  262.                         $comment = '';
  263.                     }
  264.                 } else {
  265.                     // remove InnoDB comment from end, just the minimal part (*? is non greedy)
  266.                     $comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
  267.                 }
  268.                 ?>
  269.                 <input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" /> 
  270.             </th>
  271.         <tr>
  272.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  273.                 <input type="text" name="comment" maxlength="60" size="30" value="<?php echo htmlspecialchars($comment); ?>" class="textfield" style="vertical-align: middle" onfocus="this.select()" /> 
  274.             </td>
  275.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
  276.                 <input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
  277.             </td>
  278.         </tr>
  279.     </form>
  280.         <tr><td colspan="2" height="5"></td></tr>
  281.     <!-- Table type -->
  282.     <?php
  283.     // modify robbat2 code - staybyte - 11. June 2001
  284.     $result = PMA_DBI_query('SHOW VARIABLES LIKE \'have_%\';');
  285.     if ($result) {
  286.         while ($tmp = PMA_DBI_fetch_assoc($result)) {
  287.             if (isset($tmp['Variable_name'])) {
  288.                 switch ($tmp['Variable_name']) {
  289.                     case 'have_bdb':
  290.                         if ($tmp['Value'] == 'YES') {
  291.                             $tbl_bdb    = TRUE;
  292.                         }
  293.                         break;
  294.                     case 'have_gemini':
  295.                         if ($tmp['Value'] == 'YES') {
  296.                             $tbl_gemini = TRUE;
  297.                         }
  298.                         break;
  299.                     case 'have_innodb':
  300.                         if ($tmp['Value'] == 'YES') {
  301.                             $tbl_innodb = TRUE;
  302.                         }
  303.                         break;
  304.                     case 'have_isam':
  305.                         if ($tmp['Value'] == 'YES') {
  306.                             $tbl_isam   = TRUE;
  307.                         }
  308.                         break;
  309.                 } // end switch
  310.             } // end if isset($tmp['Variable_name'])
  311.         } // end while
  312.     } // end if $result
  313.  
  314.     PMA_DBI_free_result($result);
  315.     echo "\n";
  316.     ?>
  317.     <form method="post" action="tbl_properties_operations.php">
  318.         <tr>
  319.             <th colspan="2" class="tblHeaders" align="left">
  320.                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  321.                 <?php echo $strTableType; ?>: 
  322.                 <?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
  323.             </th>
  324.         </tr>
  325.         <tr>
  326.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  327.                 <select name="tbl_type" style="vertical-align: middle">
  328.                     <option value="MYISAM"<?php if ($tbl_type == 'MYISAM') echo ' selected="selected"'; ?>>MyISAM</option>
  329.                     <option value="HEAP"<?php if ($tbl_type == 'HEAP') echo ' selected="selected"'; ?>>Heap</option>
  330.     <?php
  331.     $tbl_types     = "\n";
  332.     if (isset($tbl_bdb)) {
  333.         $tbl_types .= '                <option value="BERKELEYDB"'
  334.                    .  (($tbl_type == 'BERKELEYDB') ? ' selected="selected"' : '')
  335.                    .  '>Berkeley DB</option>' . "\n";
  336.     }
  337.     if (isset($tbl_gemini)) {
  338.         $tbl_types .= '                <option value="GEMINI"'
  339.                    .  (($tbl_type == 'GEMINI') ? ' selected="selected"' : '')
  340.                    .  '>Gemini</option>' . "\n";
  341.     }
  342.     if (isset($tbl_innodb)) {
  343.         $tbl_types .= '                <option value="INNODB"'
  344.                    .  (($tbl_type == 'INNODB') ? ' selected="selected"' : '')
  345.                    .  '>INNO DB</option>' . "\n";
  346.     }
  347.     if (isset($tbl_isam)) {
  348.         $tbl_types .= '                <option value="ISAM"'
  349.                    .  (($tbl_type == 'ISAM') ? ' selected="selected"' : '')
  350.                    .  '>ISAM</option>' . "\n";
  351.     }
  352.  
  353.     echo $tbl_types;
  354.     ?>
  355.                     <option value="MERGE"<?php if ($tbl_type == 'MRG_MYISAM') echo ' selected="selected"'; ?>>Merge</option>
  356.                     </select>
  357.             </td>
  358.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
  359.                 <input type="submit" name="submittype" value="<?php echo $strGo; ?>" />
  360.             </td>
  361.         </tr>
  362.     </form>
  363.         <tr><td colspan="2" height="5"></td></tr>
  364.     <?php
  365.  
  366.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  367.         echo "\n"
  368.            . '<!-- Table character set -->' . "\n"
  369.            . '    <form method="post" action="tbl_properties_operations.php">' . "\n"
  370.            . '        <tr>' . "\n"
  371.            . '            <th colspan="2" class="tblHeaders" align="left">' . "\n"
  372.            . PMA_generate_common_hidden_inputs($db, $table, 3)
  373.            . '            ' . $strCollation . ': ' . "\n"
  374.            . '            </th>' . "\n"
  375.            . '        </tr>' . "\n"
  376.            . '        <tr>' . "\n"
  377.            . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  378.            . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, $tbl_collation, FALSE, 3)
  379.            . '            </td>' . "\n"
  380.            . '            <td bgcolor="' . $cfg['BgcolorOne'] . '" align="right">' . "\n"
  381.            . '                <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
  382.            . '        </td>' . "\n"
  383.            . '        </tr>' . "\n"
  384.            . '    </form>' . "\n"
  385.            . '        <tr><td colspan="2" height="5"></td></tr>' . "\n";
  386.     }
  387.     // PACK_KEYS: MyISAM or ISAM
  388.     // DELAY_KEY_WRITE, CHECKSUM, AUTO_INCREMENT: MyISAM only
  389.  
  390.     if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') {
  391.     ?>
  392.     <!-- Table options -->
  393.     <form method="post" action="tbl_properties_operations.php">
  394.         <tr>
  395.             <th colspan="2" class="tblHeaders" align="left">
  396.                 <?php echo $strTableOptions; ?>: 
  397.                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  398.             </th>
  399.         </tr>
  400.         <tr>
  401.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  402.                 <input type="checkbox" name="pack_keys" id="pack_keys_opt"
  403.                 <?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="pack_keys_opt">pack_keys</label><br />
  404.         <?php
  405.         if ($tbl_type == 'MYISAM') {
  406.         ?>
  407.                 <input type="checkbox" name="checksum" id="checksum_opt"
  408.                 <?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="checksum_opt">checksum</label><br />
  409.  
  410.                 <input type="checkbox" name="delay_key_write" id="delay_key_write_opt"
  411.                 <?php echo (isset($delay_key_write) && $delay_key_write == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="delay_key_write_opt">delay_key_write</label><br />
  412.  
  413.                 <input type="text" name="auto_increment" id="auto_increment_opt" class="textfield"
  414.                 <?php echo (isset($auto_increment) && !empty($auto_increment) ? ' value="' . $auto_increment . '"' : ''); ?> style="width: 30px; vertical-align: middle" /> <label for="auto_increment_opt">auto_increment</label>
  415.             </td>
  416.         <?php
  417.         } // end if (MYISAM)
  418.         ?>
  419.             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" valign="bottom">
  420.                 <input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
  421.             </td>
  422.         </tr>
  423.     </form>
  424. <?php
  425.     } // end if (MYISAM or ISAM)
  426. ?>
  427. </table>
  428. <img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="25" height="1" border="0" align="left" />
  429. <!----->
  430. <table border="0" cellpadding="3" cellspacing="0">
  431.     <tr>
  432.         <th class="tblHeaders" colspan="2" align="left">
  433.             <?php echo $strTableMaintenance; ?>
  434.         </th>
  435.     </tr>
  436. <?php
  437. if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB' || $tbl_type == 'INNODB') {
  438.     echo "\n";
  439.     if ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB') {
  440.         ?>
  441.     <tr>
  442.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  443.             <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>">
  444.                 <?php echo $strCheckTable; ?></a> 
  445.         </td>
  446.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  447.             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE') . "\n"; ?>
  448.         </td>
  449.     </tr>
  450.         <?php
  451.     }
  452.     echo "\n";
  453.     if ($tbl_type == 'INNODB') {
  454.         ?>
  455.     <tr>
  456.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  457.             <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' TYPE=InnoDB'); ?>">
  458.                 <?php echo $strDefragment; ?></a> 
  459.         </td>
  460.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  461.             <?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting') . "\n"; ?>
  462.         </td>
  463.     </tr>
  464.         <?php
  465.     }
  466.     echo "\n";
  467.     if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
  468.         ?>
  469.     <tr>
  470.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  471.             <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>">
  472.                 <?php echo $strAnalyzeTable; ?></a> 
  473.         </td>
  474.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  475.             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE') . "\n";?>
  476.         </td>
  477.     </tr>
  478.         <?php
  479.     }
  480.     echo "\n";
  481.     if ($tbl_type == 'MYISAM') {
  482.         ?>
  483.     <tr>
  484.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  485.             <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>">
  486.                 <?php echo $strRepairTable; ?></a> 
  487.         </td>
  488.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  489.             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE') . "\n"; ?>
  490.         </td>
  491.     </tr>
  492.         <?php
  493.     }
  494.     echo "\n";
  495.     if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
  496.         ?>
  497.     <tr>
  498.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  499.             <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
  500.                 <?php echo $strOptimizeTable; ?></a> 
  501.         </td>
  502.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  503.             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
  504.         </td>
  505.     </tr>
  506.         <?php
  507.     }
  508.     echo "\n";
  509.     ?>
  510.     <?php
  511. } // end MYISAM or BERKELEYDB case
  512. echo "\n";
  513. ?>
  514.     <tr>
  515.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  516.                 <a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfg['ShowTooltip']) echo '&reload=1'; ?>">
  517.                     <?php echo $strFlushTable; ?></a> 
  518.         </td>
  519.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
  520.                     <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
  521.         </td>
  522.     </tr>
  523.  
  524. <?php
  525. // Referential integrity check
  526. // The Referential integrity check was intended for the non-InnoDB
  527. // tables for which the relations are defined in pmadb
  528. // so I assume that if the current table is InnoDB, I don't display
  529. // this choice (InnoDB maintains integrity by itself)
  530.  
  531. if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
  532.  
  533.     // we need this PMA_DBI_select_db if the user has access to more than one db
  534.     // and $db is not the last of the list, because PMA_availableDatabases()
  535.     // has made a PMA_DBI_select_db() on the last one
  536.     PMA_DBI_select_db($db);
  537.     $foreign = PMA_getForeigners($db, $table);
  538.  
  539.     if ($foreign) {
  540.         ?>
  541.     <!-- Referential integrity check -->
  542.     <tr>
  543.         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2">
  544.                 <?php echo $strReferentialIntegrity; ?><br />
  545.                 <?php
  546.                 echo "\n";
  547.                 foreach ($foreign AS $master => $arr) {
  548.                     $join_query  = 'SELECT ' . PMA_backquote($table) . '.* FROM '
  549.                                  . PMA_backquote($table) . ' LEFT JOIN '
  550.                                  . PMA_backquote($arr['foreign_table']);
  551.                     if ($arr['foreign_table'] == $table) {
  552.                         $foreign_table = $table . '1';
  553.                         $join_query .= ' AS ' . PMA_backquote($foreign_table);
  554.                     } else {
  555.                         $foreign_table = $arr['foreign_table'];
  556.                     }
  557.                     $join_query .= ' ON '
  558.                                  . PMA_backquote($table) . '.' . PMA_backquote($master)
  559.                                  . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
  560.                                  . ' WHERE '
  561.                                  . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
  562.                                  . ' IS NULL AND '
  563.                                  . PMA_backquote($table) . '.' . PMA_backquote($master)
  564.                                  . ' IS NOT NULL';
  565.                     echo '        '
  566.                          . '<a href="sql.php?' . $url_query
  567.                          . '&sql_query='
  568.                          . urlencode($join_query)
  569.                          . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
  570.                          . '</a><br />' . "\n";
  571.                     unset($foreign_table);
  572.                     unset($join_query);
  573.                 } //  end while
  574.                 ?>
  575.         </td>
  576.     </tr>
  577.         <?php
  578.     } // end if ($result)
  579.     echo "\n";
  580.  
  581. } // end  if (!empty($cfg['Server']['relation']))
  582. ?>
  583. </table>
  584. <?php
  585.  
  586. /**
  587.  * Displays the footer
  588.  */
  589. echo "\n";
  590. require_once('./footer.inc.php');
  591. ?>
  592.