revised XHTML output

This commit is contained in:
Sebastian Mendel
2005-12-02 13:04:22 +00:00
parent e922ebee97
commit 0237ab7160
3 changed files with 457 additions and 394 deletions

View File

@@ -1,182 +1,182 @@
<?php <?php
/* $Id$ */ /* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
/**
* function library for handling table indexes
*/
/** /**
* Return a list of all index types * Return a list of all index types
* *
* @access public * @access public
* @return array Index types * @return array Index types
* @author Garvin Hicking (pma@supergarv.de) * @author Garvin Hicking (pma@supergarv.de)
*/ */
function PMA_get_indextypes() {
return array(
'PRIMARY',
'INDEX',
'UNIQUE',
'FULLTEXT'
);
}
function PMA_get_indextypes() { /**
return array( * Function to get all index information from a certain table
'PRIMARY', *
'INDEX', * @param string Table name
'UNIQUE', * @param string Error URL
'FULLTEXT' *
); * @access public
* @return array Index keys
*/
function PMA_get_indexes($tbl_name, $err_url_0 = '') {
$tbl_local_query = 'SHOW KEYS FROM ' . PMA_backquote($tbl_name);
$tbl_result = PMA_DBI_query($tbl_local_query) or PMA_mysqlDie('', $tbl_local_query, '', $err_url_0);
$tbl_ret_keys = array();
while ($tbl_row = PMA_DBI_fetch_assoc($tbl_result)) {
$tbl_ret_keys[] = $tbl_row;
} }
PMA_DBI_free_result($tbl_result);
/** return $tbl_ret_keys;
* Function to get all index information from a certain table }
*
* @param string Table name
* @param string Error URL
*
* @access public
* @return array Index keys
*/
function PMA_get_indexes($tbl_name, $err_url_0 = '') {
$tbl_local_query = 'SHOW KEYS FROM ' . PMA_backquote($tbl_name);
$tbl_result = PMA_DBI_query($tbl_local_query) or PMA_mysqlDie('', $tbl_local_query, '', $err_url_0);
$tbl_ret_keys = array();
while ($tbl_row = PMA_DBI_fetch_assoc($tbl_result)) {
$tbl_ret_keys[] = $tbl_row;
}
PMA_DBI_free_result($tbl_result);
return $tbl_ret_keys; /**
} * Function to check over array of indexes and look for common problems
*
/** * @param array Array of indexes
* Function to check over array of indexes and look for common problems * @param boolean Whether to output HTML in table layout
* *
* @param array Array of indexes * @access public
* @param boolean Whether to output HTML in table layout * @return string Output HTML
* * @author Garvin Hicking (pma@supergarv.de)
* @access public */
* @return string Output HTML function PMA_check_indexes($idx_collection, $table = true) {
* @author Garvin Hicking (pma@supergarv.de) $index_types = PMA_get_indextypes();
*/ $output = '';
function PMA_check_indexes($idx_collection, $table = true) {
$index_types = PMA_get_indextypes();
$output = '';
if (is_array($idx_collection) && isset($idx_collection['ALL'])) {
foreach($idx_collection['ALL'] AS $w_keyname => $w_count) {
if (isset($idx_collection['PRIMARY'][$w_keyname]) && (isset($idx_collection['INDEX'][$w_keyname]) || isset($idx_collection['UNIQUE'][$w_keyname]))) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningPrimary'], htmlspecialchars($w_keyname)), $table);
} elseif (isset($idx_collection['UNIQUE'][$w_keyname]) && isset($idx_collection['INDEX'][$w_keyname])) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningUnique'], htmlspecialchars($w_keyname)), $table);
}
foreach($index_types AS $index_type) {
if (isset($idx_collection[$index_type][$w_keyname]) && $idx_collection[$index_type][$w_keyname] > 1) {
$output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningMultiple'], $index_type, htmlspecialchars($w_keyname)), $table);
}
}
}
}
if ( ! is_array($idx_collection) || empty($idx_collection['ALL'])) {
return $output; return $output;
} }
/** foreach($idx_collection['ALL'] AS $w_keyname => $w_count) {
* Loop array of returned index keys and extract key information to if (isset($idx_collection['PRIMARY'][$w_keyname]) && (isset($idx_collection['INDEX'][$w_keyname]) || isset($idx_collection['UNIQUE'][$w_keyname]))) {
* seperate arrays. Those arrays are passed by reference. $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningPrimary'], htmlspecialchars($w_keyname)), $table);
* } elseif (isset($idx_collection['UNIQUE'][$w_keyname]) && isset($idx_collection['INDEX'][$w_keyname])) {
* @param array Referenced Array of indexes $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningUnique'], htmlspecialchars($w_keyname)), $table);
* @param array Referenced return array
* @param array Referenced return array
* @param array Referenced return array
*
* @access public
* @return boolean void
* @author Garvin Hicking (pma@supergarv.de)
*/
function PMA_extract_indexes(&$ret_keys, &$indexes, &$indexes_info, &$indexes_data) {
if (!is_array($ret_keys)) {
return false;
} }
$prev_index = ''; foreach($index_types AS $index_type) {
foreach ($ret_keys as $row) { if (isset($idx_collection[$index_type][$w_keyname]) && $idx_collection[$index_type][$w_keyname] > 1) {
if ($row['Key_name'] != $prev_index ){ $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningMultiple'], $index_type, htmlspecialchars($w_keyname)), $table);
$indexes[] = $row['Key_name'];
$prev_index = $row['Key_name'];
} }
}
$indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
$indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
if (isset($row['Cardinality'])) {
$indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
}
// I don't know what does following column mean....
// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
$indexes_info[$row['Key_name']]['Comment'] = (isset($row['Comment']))
? $row['Comment']
: '';
$indexes_info[$row['Key_name']]['Index_type'] = (isset($row['Index_type']))
? $row['Index_type']
: '';
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
if (isset($row['Sub_part'])) {
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
}
} // end while
return true;
} }
/** return $output;
* Show index data and prepare returned collection array for index }
* key checks.
*
* @param string The tablename
* @param array Referenced Array of indexes
* @param array Referenced info array
* @param array Referenced data array
* @param boolean Output HTML code, or just return collection array?
*
* @access public
* @return array Index collection array
* @author Garvin Hicking (pma@supergarv.de)
*/
function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, $display_html = true, $print_mode = false) {
$idx_collection = array();
foreach ($indexes AS $index_no => $index_name) {
if ($display_html) {
if ($print_mode) {
$index_td = ' <td class="print" rowspan="' . count($indexes_info[$index_name]['Sequences']) . '">' . "\n";
} else {
$cell_bgd = (($index_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']);
$index_td = ' <td bgcolor="' . $cell_bgd . '" rowspan="' . count($indexes_info[$index_name]['Sequences']) . '">' . "\n";
}
echo ' <tr>' . "\n";
echo $index_td
. ' ' . htmlspecialchars($index_name) . "\n"
. ' </td>' . "\n";
}
if ((PMA_MYSQL_INT_VERSION < 40002 && $indexes_info[$index_name]['Comment'] == 'FULLTEXT') /**
|| (PMA_MYSQL_INT_VERSION >= 40002 && $indexes_info[$index_name]['Index_type'] == 'FULLTEXT')) { * Loop array of returned index keys and extract key information to
$index_type = 'FULLTEXT'; * seperate arrays. Those arrays are passed by reference.
} else if ($index_name == 'PRIMARY') { *
$index_type = 'PRIMARY'; * @param array Referenced Array of indexes
} else if ($indexes_info[$index_name]['Non_unique'] == '0') { * @param array Referenced return array
$index_type = 'UNIQUE'; * @param array Referenced return array
} else { * @param array Referenced return array
$index_type = 'INDEX'; *
} * @access public
* @return boolean void
* @author Garvin Hicking (pma@supergarv.de)
*/
function PMA_extract_indexes(&$ret_keys, &$indexes, &$indexes_info, &$indexes_data) {
if (!is_array($ret_keys)) {
return false;
}
if ($display_html) { $prev_index = '';
echo $index_td foreach ($ret_keys as $row) {
. ' ' . $index_type . "\n" if ($row['Key_name'] != $prev_index ){
. ' </td>' . "\n"; $indexes[] = $row['Key_name'];
$prev_index = $row['Key_name'];
}
echo str_replace('">' . "\n", '" align="right">' . "\n", $index_td) $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
. ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $GLOBALS['strNone']) . '&nbsp;' . "\n" $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
. ' </td>' . "\n";
if (!$print_mode) { if (isset($row['Cardinality'])) {
echo $index_td $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
. ' <a href="tbl_indexes.php?' . $GLOBALS['url_query'] . '&amp;index=' . urlencode($index_name) . '">' . $GLOBALS['edit_link_text'] . '</a>' . "\n" }
. ' </td>' . "\n";
} // I don't know what does following column mean....
// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
$indexes_info[$row['Key_name']]['Comment'] = (isset($row['Comment']))
? $row['Comment']
: '';
$indexes_info[$row['Key_name']]['Index_type'] = (isset($row['Index_type']))
? $row['Index_type']
: '';
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
if (isset($row['Sub_part'])) {
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
}
} // end while
return true;
}
/**
* Show index data and prepare returned collection array for index
* key checks.
*
* @param string $table The tablename
* @param array $indexes Referenced Array of indexes
* @param array $indexes_info Referenced info array
* @param array $indexes_data Referenced data array
* @param boolean $display_html Output HTML code, or just return collection array?
* @param boolean $print_mode
* @access public
* @return array Index collection array
* @author Garvin Hicking (pma@supergarv.de)
*/
function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, $display_html = true, $print_mode = false) {
$idx_collection = array();
$odd_row = true;
foreach ($indexes as $index_name) {
if ($display_html) {
$row_span = ' rowspan="' . count($indexes_info[$index_name]['Sequences']) . '" ';
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n";
echo ' <th ' . $row_span . '>' . "\n"
. ' ' . htmlspecialchars($index_name) . "\n"
. ' </th>' . "\n";
}
if ((PMA_MYSQL_INT_VERSION < 40002 && $indexes_info[$index_name]['Comment'] == 'FULLTEXT')
|| (PMA_MYSQL_INT_VERSION >= 40002 && $indexes_info[$index_name]['Index_type'] == 'FULLTEXT')) {
$index_type = 'FULLTEXT';
} elseif ($index_name == 'PRIMARY') {
$index_type = 'PRIMARY';
} elseif ($indexes_info[$index_name]['Non_unique'] == '0') {
$index_type = 'UNIQUE';
} else {
$index_type = 'INDEX';
}
if ($display_html) {
echo ' <td ' . $row_span . '>' . "\n"
. ' ' . $index_type . '</td>' . "\n";
echo ' <td ' . $row_span . ' align="right">' . "\n"
. ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $GLOBALS['strNone']) . '&nbsp;' . "\n"
. ' </td>' . "\n";
if (!$print_mode) {
echo ' <td ' . $row_span . '>' . "\n"
. ' <a href="tbl_indexes.php?' . $GLOBALS['url_query'] . '&amp;index=' . urlencode($index_name) . '">' . $GLOBALS['edit_link_text'] . '</a>' . "\n"
. ' </td>' . "\n";
if ($index_name == 'PRIMARY') { if ($index_name == 'PRIMARY') {
$local_query = urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY'); $local_query = urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY');
@@ -188,90 +188,70 @@
$zero_rows = urlencode(sprintf($GLOBALS['strIndexHasBeenDropped'], htmlspecialchars($index_name))); $zero_rows = urlencode(sprintf($GLOBALS['strIndexHasBeenDropped'], htmlspecialchars($index_name)));
} }
if (!$print_mode) { echo ' <td ' . $row_span . '>' . "\n"
echo $index_td . ' <a href="sql.php?' . $GLOBALS['url_query'] . '&amp;sql_query=' . $local_query . '&amp;zero_rows=' . $zero_rows . '" onclick="return confirmLink(this, \'' . $js_msg . '\')">' . $GLOBALS['drop_link_text'] . '</a>' . "\n"
. ' <a href="sql.php?' . $GLOBALS['url_query'] . '&amp;sql_query=' . $local_query . '&amp;zero_rows=' . $zero_rows . '" onclick="return confirmLink(this, \'' . $js_msg . '\')">' . $GLOBALS['drop_link_text'] . '</a>' . "\n" . ' </td>' . "\n";
. ' </td>' . "\n"; }
}
foreach ($indexes_info[$index_name]['Sequences'] AS $row_no => $seq_index) {
$col_name = $indexes_data[$index_name][$seq_index]['Column_name'];
if ($row_no == 0) {
if (isset($idx_collection[$index_type][$col_name])) {
$idx_collection[$index_type][$col_name]++;
} else {
$idx_collection[$index_type][$col_name] = 1;
}
if (isset($idx_collection['ALL'][$col_name])) {
$idx_collection['ALL'][$col_name]++;
} else {
$idx_collection['ALL'][$col_name] = 1;
} }
} }
foreach ($indexes_info[$index_name]['Sequences'] AS $row_no => $seq_index) { if ($display_html) {
$col_name = $indexes_data[$index_name][$seq_index]['Column_name']; if ($row_no > 0) {
if ($row_no == 0) { echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n";
if (isset($idx_collection[$index_type][$col_name])) {
$idx_collection[$index_type][$col_name]++;
} else {
$idx_collection[$index_type][$col_name] = 1;
}
if (isset($idx_collection['ALL'][$col_name])) {
$idx_collection['ALL'][$col_name]++;
} else {
$idx_collection['ALL'][$col_name] = 1;
}
} }
if ($display_html) { if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) {
if ($row_no > 0) { echo ' <td>' . $col_name . '</td>' . "\n";
echo ' <tr>' . "\n"; echo ' <td align="right">' . "\n"
} . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n"
. ' </td>' . "\n";
if ($print_mode) { echo ' </tr>' . "\n";
$bgcolor = 'class="print"'; } else {
} else { echo ' <td colspan="2">' . "\n"
$bgcolor = 'bgcolor="' . $cell_bgd . '"'; . ' ' . htmlspecialchars($col_name) . "\n"
} . ' </td>' . "\n";
echo ' </tr>' . "\n";
if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) {
echo ' <td ' . $bgcolor . '>' . "\n"
. ' ' . $col_name . "\n"
. ' </td>' . "\n";
echo ' <td align="right" ' . $bgcolor . '>' . "\n"
. ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n"
. ' </td>' . "\n";
echo ' </tr>' . "\n";
} else {
echo ' <td ' . $bgcolor . ' colspan="2">' . "\n"
. ' ' . htmlspecialchars($col_name) . "\n"
. ' </td>' . "\n";
echo ' </tr>' . "\n";
}
} }
} // end while }
} // end while } // end foreach $indexes_info[$index_name]['Sequences']
return $idx_collection; $odd_row = ! $odd_row;
} // end while
return $idx_collection;
}
/**
* Function to emit a index warning
*
* @author Garvin Hicking (pma@supergarv.de)
* @access public
* @param string $string Message string
* @param boolean $table Whether to output HTML in table layout
* @return string Output HTML
*/
function PMA_index_warning($string, $table = true) {
$output = '<div class="warning">' . $string . '</div>';
if ( $table ) {
$output = '<tr><td colspan=7">' . $output . '</td></tr>';
} }
/** return $output . "\n";
* Function to emit a index warning }
*
* @param string Message string
* @param boolean Whether to output HTML in table layout
*
* @access public
* @output string Output HTML
* @author Garvin Hicking (pma@supergarv.de)
*/
function PMA_index_warning($string, $table = true) {
$output = '';
if ($table) {
$output .= "\n" . ' <tr><td colspan=7">' . "\n";
}
if ($GLOBALS['cfg']['ErrorIconic']) {
$output .= '<img src="' . $GLOBALS['pmaThemeImage'] . 's_warn.png" width="16" height="16" border="0" alt="Warning" hspace="2" align="middle" />';
}
$output .= ' <b>' . $string . '</b>';
if ($table) {
$output .= '</td></tr>';
} else {
$output .= '<br />';
}
$output .= "\n\n";
return $output;
}
?> ?>

View File

@@ -21,27 +21,41 @@ $index_types_cnt = count($index_types);
*/ */
if (!defined('PMA_IDX_INCLUDED')) { if (!defined('PMA_IDX_INCLUDED')) {
// Not a valid db name -> back to the welcome page // Not a valid db name -> back to the welcome page
if (!empty($db)) { if ( !empty($db) ) {
$is_db = PMA_DBI_select_db($db); $is_db = PMA_DBI_select_db($db);
} }
if (empty($db) || !$is_db) { if ( empty($db) || !$is_db ) {
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); $uri_params = array( 'reload' => '1' );
if ( isset($message) ) {
$uri_params['message'] = $message;
}
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php'
. PMA_generate_common_url($uri_params, '&'));
exit; exit;
} }
// Not a valid table name -> back to the default db_details sub-page // Not a valid table name -> back to the default db_details sub-page
if (!empty($table)) { if ( !empty($table) ) {
$is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE); $is_table = PMA_DBI_query('SHOW TABLES LIKE \''
. PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
} }
if (empty($table) if ( empty($table)
|| !($is_table && PMA_DBI_num_rows($is_table))) { || !( $is_table && PMA_DBI_num_rows($is_table) ) ) {
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); $uri_params = array( 'reload' => '1', 'db' => $db );
if ( isset($message) ) {
$uri_params['message'] = $message;
}
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri']
. $cfg['DefaultTabDatabase']
. PMA_generate_common_url($uri_params, '&'));
exit; exit;
} else if (isset($is_table)) { } elseif ( isset($is_table) ) {
PMA_DBI_free_result($is_table); PMA_DBI_free_result($is_table);
} }
// Displays headers (if needed) // Displays headers (if needed)
$js_to_run = ((isset($index) && isset($do_save_data)) ? 'functions.js' : 'indexes.js'); $js_to_run = isset($index) && isset($do_save_data)
? 'functions.js'
: 'indexes.js';
require_once('./libraries/header.inc.php'); require_once('./libraries/header.inc.php');
} // end if } // end if
@@ -67,7 +81,8 @@ PMA_extract_indexes($ret_keys, $indexes, $indexes_info, $indexes_data);
// Get fields and stores their name/type // Get fields and stores their name/type
// fields had already been grabbed in "tbl_properties.php" // fields had already been grabbed in "tbl_properties.php"
if (!defined('PMA_IDX_INCLUDED')) { if (!defined('PMA_IDX_INCLUDED')) {
$fields_rs = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';'); $fields_rs = PMA_DBI_query('SHOW FIELDS FROM '
. PMA_backquote($table) . ';');
$save_row = array(); $save_row = array();
while ($row = PMA_DBI_fetch_assoc($fields_rs)) { while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$save_row[] = $row; $save_row[] = $row;
@@ -80,7 +95,8 @@ foreach ($save_row AS $saved_row_key => $row) {
$fields_names[] = $row['Field']; $fields_names[] = $row['Field'];
// loic1: set or enum types: slashes single quotes inside options // loic1: set or enum types: slashes single quotes inside options
if (preg_match('@^(set|enum)\((.+)\)$@i', $row['Type'], $tmp)) { if (preg_match('@^(set|enum)\((.+)\)$@i', $row['Type'], $tmp)) {
$tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); $tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'',
',' . $tmp[2]), 1);
$fields_types[] = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; $fields_types[] = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
} else { } else {
$fields_types[] = $row['Type']; $fields_types[] = $row['Type'];
@@ -135,13 +151,16 @@ if (!defined('PMA_IDX_INCLUDED')
$sql_query .= ' ADD PRIMARY KEY ('; $sql_query .= ' ADD PRIMARY KEY (';
break; break;
case 'FULLTEXT': case 'FULLTEXT':
$sql_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : PMA_backquote($index)) . ' ('; $sql_query .= ' ADD FULLTEXT '
. (empty($index) ? '' : PMA_backquote($index)) . ' (';
break; break;
case 'UNIQUE': case 'UNIQUE':
$sql_query .= ' ADD UNIQUE ' . (empty($index) ? '' : PMA_backquote($index)) . ' ('; $sql_query .= ' ADD UNIQUE '
. (empty($index) ? '' : PMA_backquote($index)) . ' (';
break; break;
case 'INDEX': case 'INDEX':
$sql_query .= ' ADD INDEX ' . (empty($index) ? '' : PMA_backquote($index)) . ' ('; $sql_query .= ' ADD INDEX '
. (empty($index) ? '' : PMA_backquote($index)) . ' (';
break; break;
} // end switch } // end switch
$index_fields = ''; $index_fields = '';
@@ -149,7 +168,9 @@ if (!defined('PMA_IDX_INCLUDED')
if ($name != '--ignore--') { if ($name != '--ignore--') {
$index_fields .= (empty($index_fields) ? '' : ',') $index_fields .= (empty($index_fields) ? '' : ',')
. PMA_backquote($name) . PMA_backquote($name)
. (empty($sub_part[$i]) ? '' : '(' . $sub_part[$i] . ')'); . (empty($sub_part[$i])
? ''
: '(' . $sub_part[$i] . ')');
} }
} // end while } // end while
if (empty($index_fields)){ if (empty($index_fields)){
@@ -159,7 +180,8 @@ if (!defined('PMA_IDX_INCLUDED')
} }
$result = PMA_DBI_query($sql_query); $result = PMA_DBI_query($sql_query);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered; $message = $strTable . ' ' . htmlspecialchars($table) . ' '
. $strHasBeenAltered;
$active_page = 'tbl_properties_structure.php'; $active_page = 'tbl_properties_structure.php';
require('./tbl_properties_structure.php'); require('./tbl_properties_structure.php');
@@ -187,7 +209,8 @@ else if (!defined('PMA_IDX_INCLUDED')
$edited_index_data = array(); $edited_index_data = array();
for ($i = 1; $i <= $idx_num_fields; $i++) { for ($i = 1; $i <= $idx_num_fields; $i++) {
$edited_index_info['Sequences'][] = $i; $edited_index_info['Sequences'][] = $i;
$edited_index_data[$i] = array('Column_name' => '', 'Sub_part' => ''); $edited_index_data[$i] = array('Column_name' => '',
'Sub_part' => '');
} // end for } // end for
if ($old_index == '' if ($old_index == ''
&& !isset($indexes_info['PRIMARY']) && !isset($indexes_info['PRIMARY'])
@@ -199,8 +222,10 @@ else if (!defined('PMA_IDX_INCLUDED')
$edited_index_data = $indexes_data[$old_index]; $edited_index_data = $indexes_data[$old_index];
if ((PMA_MYSQL_INT_VERSION < 40002 && $edited_index_info['Comment'] == 'FULLTEXT') if ((PMA_MYSQL_INT_VERSION < 40002
|| (PMA_MYSQL_INT_VERSION >= 40002 && $edited_index_info['Index_type'] == 'FULLTEXT')) { && $edited_index_info['Comment'] == 'FULLTEXT')
|| (PMA_MYSQL_INT_VERSION >= 40002
&& $edited_index_info['Index_type'] == 'FULLTEXT')) {
$index_type = 'FULLTEXT'; $index_type = 'FULLTEXT';
} else if ($index == 'PRIMARY') { } else if ($index == 'PRIMARY') {
$index_type = 'PRIMARY'; $index_type = 'PRIMARY';
@@ -218,7 +243,8 @@ else if (!defined('PMA_IDX_INCLUDED')
$field_cnt = count($edited_index_info['Sequences']) + 1; $field_cnt = count($edited_index_info['Sequences']) + 1;
for ($i = $field_cnt; $i < ($added_fields + $field_cnt); $i++) { for ($i = $field_cnt; $i < ($added_fields + $field_cnt); $i++) {
$edited_index_info['Sequences'][] = $i; $edited_index_info['Sequences'][] = $i;
$edited_index_data[$i] = array('Column_name' => '', 'Sub_part' => ''); $edited_index_data[$i] = array('Column_name' => '',
'Sub_part' => '');
} // end for } // end for
// Restore entered values // Restore entered values
@@ -232,67 +258,79 @@ else if (!defined('PMA_IDX_INCLUDED')
// end preparing form values // end preparing form values
?> ?>
<!-- Build index form --> <div style="float: left;">
<form action="./tbl_indexes.php" method="post" name="index_frm" <form action="./tbl_indexes.php" method="post" name="index_frm"
onsubmit="if (typeof(this.elements['index'].disabled) != 'undefined') {this.elements['index'].disabled = false}"> onsubmit="if (typeof(this.elements['index'].disabled) != 'undefined') {
<table border="0" cellpadding="2" cellspacing="1"> this.elements['index'].disabled = false}">
<tr><td class="tblHeaders" colspan="2">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<?php <?php
if (isset($create_index)) { if (isset($create_index)) {
echo '<input type="hidden" name="create_index" value="1" />'; echo '<input type="hidden" name="create_index" value="1" />' . "\n";
}
if (isset($added_fields)) {
echo ' <input type="hidden" name="prev_add_fields" value="'
. $added_fields . '" />' . "\n";
}
if (isset($idx_num_fields)) {
echo ' <input type="hidden" name="idx_num_fields" value="'
. $idx_num_fields . '" />' . "\n";
} }
echo "\n";
?> ?>
<input type="hidden" name="old_index" value="<?php echo (isset($create_index) ? '' : htmlspecialchars($old_index)); ?>" /> <input type="hidden" name="old_index" value="<?php
<?php echo ' ' . (isset($create_index) ? $strCreateIndexTopic : $strModifyIndexTopic) . ' '; ?> echo (isset($create_index) ? '' : htmlspecialchars($old_index)); ?>" />
</th></tr>
<fieldset>
<tr> <legend>
<td align="right"><b><?php echo $strIndexName; ?></b>&nbsp;</th> <?php
<td> echo (isset($create_index) ? $strCreateIndexTopic : $strModifyIndexTopic);
<input type="text" name="index" value="<?php echo htmlspecialchars($index); ?>" size="25" onfocus="this.select()" /> ?>
</td> </legend>
</tr>
<tr><td align="right"><?php <div class="formelement">
if ($cfg['ErrorIconic']) { <label for="input_index_name"><?php echo $strIndexName; ?></label>
echo '<img src="' . $pmaThemeImage . 's_warn.png" width="16" height="16" border="0" alt="Attention" />'; <input type="text" name="index" id="input_index_name" size="25"
} value="<?php echo htmlspecialchars($index); ?>" onfocus="this.select()" />
?></td><td><?php echo $strPrimaryKeyWarning . "\n"; ?></td></tr> </div>
<tr>
<td align="right"><b><?php echo $strIndexType; ?></b>&nbsp;</td> <div class="formelement">
<td> <label for="select_index_type"><?php echo $strIndexType; ?></label>
<select name="index_type" onchange="return checkIndexName()"> <select name="index_type" id="select_index_type" onchange="return checkIndexName()">
<?php <?php
echo "\n";
for ($i = 0; $i < $index_types_cnt; $i++) { for ($i = 0; $i < $index_types_cnt; $i++) {
if ($index_types[$i] == 'PRIMARY') { if ($index_types[$i] == 'PRIMARY') {
if ($index == 'PRIMARY' || !isset($indexes_info['PRIMARY'])) { if ($index == 'PRIMARY' || !isset($indexes_info['PRIMARY'])) {
echo ' ' echo ' '
. '<option value="PRIMARY"' . (($index_type == 'PRIMARY') ? ' selected="selected"' : '') . '>PRIMARY</option>' . '<option value="PRIMARY"'
. "\n"; . (($index_type == 'PRIMARY') ? ' selected="selected"' : '')
. '>PRIMARY</option>' . "\n";
} }
} else { } else {
echo ' ' echo ' '
. '<option value="' . $index_types[$i] . '"' . (($index_type == $index_types[$i]) ? ' selected="selected"' : '') . '>'. $index_types[$i] . '</option>' . '<option value="' . $index_types[$i] . '"'
. "\n"; . (($index_type == $index_types[$i]) ? ' selected="selected"' : '')
. '>'. $index_types[$i] . '</option>' . "\n";
} // end if... else... } // end if... else...
} // end for } // end for
?> ?>
</select> </select>
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE') . "\n"; ?> <?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
</td> </div>
</tr>
<tr><td valign="top" align="right"><b><?php echo $strFields; ?> :</b>&nbsp;</td><td><table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
<tr> <br class="clearfloat" />
<th><?php echo $strField; ?></th> <div class="warning"><?php echo $strPrimaryKeyWarning; ?></div>
<th><?php echo $strSize; ?></th>
</tr> <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
<thead>
<tr><th><?php echo $strField; ?></th>
<th><?php echo $strSize; ?></th>
</tr>
</thead>
<tbody>
<?php <?php
foreach ($edited_index_info['Sequences'] AS $row_no => $seq_index) { $odd_row = true;
foreach ($edited_index_info['Sequences'] as $seq_index) {
$add_type = (is_array($fields_types) && count($fields_types) == count($fields_names)); $add_type = (is_array($fields_types) && count($fields_types) == count($fields_names));
$selected = $edited_index_data[$seq_index]['Column_name']; $selected = $edited_index_data[$seq_index]['Column_name'];
if (!empty($edited_index_data[$seq_index]['Sub_part'])) { if (!empty($edited_index_data[$seq_index]['Sub_part'])) {
@@ -300,119 +338,139 @@ else if (!defined('PMA_IDX_INCLUDED')
} else { } else {
$sub_part = ''; $sub_part = '';
} }
$bgcolor = (($row_no % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']);
echo "\n";
?> ?>
<tr>
<td bgcolor="<?php echo $bgcolor; ?>"> <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<select name="column[]"> <td><select name="column[]">
<option value="--ignore--"<?php if ('--ignore--' == $selected) echo ' selected="selected"'; ?>> <option value="--ignore--"
-- <?php echo $strIgnore; ?> --</option> <?php if ('--ignore--' == $selected) echo ' selected="selected"'; ?>>
-- <?php echo $strIgnore; ?> --</option>
<?php <?php
foreach ($fields_names AS $key => $val) { foreach ($fields_names AS $key => $val) {
if ($index_type != 'FULLTEXT' if ($index_type != 'FULLTEXT'
|| preg_match('@^(varchar|text|tinytext|mediumtext|longtext)@i', $fields_types[$key])) { || preg_match('@^(varchar|text|tinytext|mediumtext|longtext)@i', $fields_types[$key])) {
echo "\n" . ' ' echo "\n" . ' '
. '<option value="' . htmlspecialchars($val) . '"' . (($val == $selected) ? ' selected="selected"' : '') . '>' . '<option value="' . htmlspecialchars($val) . '"'
. htmlspecialchars($val) . (($add_type) ? ' [' . $fields_types[$key] . ']' : '' ) . '</option>' . "\n"; . (($val == $selected) ? ' selected="selected"' : '') . '>'
. htmlspecialchars($val) . (($add_type) ? ' ['
. $fields_types[$key] . ']' : '' ) . '</option>' . "\n";
} }
} // end while } // end foreach $fields_names
echo "\n";
?> ?>
</select>
</td>
<td bgcolor="<?php echo $bgcolor; ?>">
<input type="text" size="5" name="sub_part[]"<?php echo $sub_part; ?> onfocus="this.select()" />
</td>
</tr>
<?php
} // end while
echo "\n"; </select>
?> </td>
<tr><td colspan="2"><?php <td><input type="text" size="5" onfocus="this.select()"
echo "\n"; name="sub_part[]"<?php echo $sub_part; ?> />
if (isset($added_fields)) { </td>
echo ' <input type="hidden" name="prev_add_fields" value="' . $added_fields . '" />';
}
if (isset($idx_num_fields)) {
echo ' <input type="hidden" name="idx_num_fields" value="' . $idx_num_fields . '" />' . "\n";
}
echo ' ' . "\n";
echo ' ' . sprintf($strAddToIndex, '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n";
echo ' &nbsp;<input type="submit" name="add_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', \'' . str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']) . '\', 1)" style="vertical-align: middle;" />' . "\n";
?></td>
</tr> </tr>
</table></td></tr> <?php
<tr><td colspan="2" class="tblFooters" align="center"> $odd_row = !$odd_row;
<input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" /></td></tr> } // end foreach $edited_index_info['Sequences']
?>
</tbody>
</table> </table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" />
<?php
echo $strOr;
echo ' ' . sprintf($strAddToIndex,
'<input type="text" name="added_fields" size="2" value="1"'
.' onfocus="this.select()" />') . "\n";
echo ' <input type="submit" name="add_fields" value="' . $strGo . '"'
.' onclick="return checkFormElementInRange(this.form,'
.' \'added_fields\', \''
. str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount'])
. '\', 1)" />' . "\n";
?>
</fieldset>
</form> </form>
</div>
<?php <?php
} else { } else {
/** /**
* Display indexes * Display indexes
*/ */
?> ?>
<!-- Indexes form --> <form action="./tbl_indexes.php" method="post"
<form action="./tbl_indexes.php" method="post" onsubmit="return checkFormElementInRange(this, 'idx_num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>', 1)"> onsubmit="return checkFormElementInRange(this, 'idx_num_fields',
<table border="0" cellpadding="2" cellspacing="1"> '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>',
<tr><td class="tblHeaders" colspan="7"> 1)">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <table id="table_indexes" class="data">
<?php <caption class="tblHeaders">
echo "\n"; <?php
echo ' ' . $strIndexes . ':' . "\n"; echo $strIndexes . ':' . "\n";
echo ' ' . PMA_showMySQLDocu('optimization', 'optimizing-database-structure') . "\n"; echo ' ' . PMA_showMySQLDocu('optimization',
?></td></tr><?php 'optimizing-database-structure');
$edit_link_text = '';
$drop_link_text = '';
// We need to copy the value or else the == 'both' check will always return true
$propicon = (string)$cfg['PropertiesIconic'];
if ($cfg['PropertiesIconic'] === true || $propicon == 'both') {
$edit_link_text = '<img src="' . $pmaThemeImage . 'b_edit.png" width="16" height="16" hspace="2" border="0" title="' . $strEdit . '" alt="' . $strEdit . '" />';
$drop_link_text = '<img src="' . $pmaThemeImage . 'b_drop.png" width="16" height="16" hspace="2" border="0" title="' . $strDrop . '" alt="' . $strDrop . '" />';
}
if ($cfg['PropertiesIconic'] === false || $propicon == 'both') {
$edit_link_text .= $strEdit;
$drop_link_text .= $strDrop;
}
if ($propicon == 'both') {
$edit_link_text = '<nobr>' . $edit_link_text . '</nobr>';
$drop_link_text = '<nobr>' . $drop_link_text . '</nobr>';
}
if (count($ret_keys) > 0) {
?> ?>
<!--table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1"-->
<tr> </caption>
<th><?php echo $strKeyname; ?></th> <?php
echo PMA_generate_common_hidden_inputs( $db, $table );
if ( count($ret_keys) > 0) {
$edit_link_text = '';
$drop_link_text = '';
// We need to copy the value or else the == 'both' check will always
// return true
$propicon = (string) $cfg['PropertiesIconic'];
if ($cfg['PropertiesIconic'] === true || $propicon == 'both') {
$edit_link_text = '<img class="icon" src="' . $pmaThemeImage
. 'b_edit.png" width="16" height="16" title="' . $strEdit
. '" alt="' . $strEdit . '" />';
$drop_link_text = '<img class="icon" src="' . $pmaThemeImage
. 'b_drop.png" width="16" height="16" title="' . $strDrop
. '" alt="' . $strDrop . '" />';
}
if ($cfg['PropertiesIconic'] === false || $propicon == 'both') {
$edit_link_text .= $strEdit;
$drop_link_text .= $strDrop;
}
if ($propicon == 'both') {
$edit_link_text = '<nobr>' . $edit_link_text . '</nobr>';
$drop_link_text = '<nobr>' . $drop_link_text . '</nobr>';
}
?>
<thead>
<tr><th><?php echo $strKeyname; ?></th>
<th><?php echo $strType; ?></th> <th><?php echo $strType; ?></th>
<th><?php echo $strCardinality; ?></th> <th><?php echo $strCardinality; ?></th>
<th colspan="2"><?php echo $strAction; ?></th> <th colspan="2"><?php echo $strAction; ?></th>
<th colspan="2"><?php echo $strField; ?></th> <th colspan="2"><?php echo $strField; ?></th>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$idx_collection = PMA_show_indexes($table, $indexes, $indexes_info, $indexes_data, true); $idx_collection = PMA_show_indexes($table, $indexes, $indexes_info,
$indexes_data, true);
echo PMA_check_indexes($idx_collection); echo PMA_check_indexes($idx_collection);
} // end display indexes } // end display indexes
else { else {
// none indexes // none indexes
echo "\n" . ' <tr><td colspan=7" align="center">' . "\n"; echo '<tbody>'
if ($cfg['ErrorIconic']) { .'<tr><td colspan="7"><div class="warning">' . $strNoIndex
echo '<img src="' . $pmaThemeImage . 's_warn.png" width="16" height="16" border="0" alt="Warning" hspace="2" align="middle" />'; .'</div></td></tr>' . "\n";
}
echo ' <b>' . $strNoIndex . '</b></td></tr>' . "\n\n";
} }
?>
echo '<tr><td colspan="7" class="tblFooters" nowrap="nowrap" align="center"> ' <tr class="tblFooters"><td colspan="7">
. sprintf($strCreateIndex, '<input type="text" size="2" name="idx_num_fields" value="1" style="vertical-align: middle;" />') . "\n"; <?php echo sprintf($strCreateIndex,
echo ' &nbsp;<input type="submit" name="create_index" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'idx_num_fields\', \'' . str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']) . '\', 1)" style="vertical-align: middle;" />' . "\n"; '<input type="text" size="2" name="idx_num_fields" value="1" />'); ?>
echo '</td></tr> '; <input type="submit" name="create_index" value="<?php echo $strGo; ?>"
?> onclick="return checkFormElementInRange(this.form,
</table></form> 'idx_num_fields',
<?php '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>',
1)" />
</td></tr>
</tbody>
</table>
</form>
<?php
} // end display indexes } // end display indexes

View File

@@ -106,18 +106,42 @@ if ( $cfg['PropertiesIconic'] == true ) {
} }
// images replaced 2004-05-08 by mkkeck // images replaced 2004-05-08 by mkkeck
$titles['Change'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" />'; $titles['Change'] = $iconic_spacer
$titles['Drop'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />'; . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
$titles['NoDrop'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />'; . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" />';
$titles['Primary'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />'; $titles['Drop'] = $iconic_spacer
$titles['Index'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />'; . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
$titles['Unique'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />'; . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
$titles['IdxFulltext'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />'; $titles['NoDrop'] = $iconic_spacer
$titles['NoPrimary'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />'; . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
$titles['NoIndex'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />'; . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
$titles['NoUnique'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />'; $titles['Primary'] = $iconic_spacer
$titles['NoIdxFulltext'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />'; . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
$titles['Browse'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />'; . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';
$titles['Index'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';
$titles['Unique'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';
$titles['IdxFulltext'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';
$titles['NoPrimary'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';
$titles['NoIndex'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';
$titles['NoUnique'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';
$titles['NoIdxFulltext'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';
$titles['Browse'] = $iconic_spacer
. '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
. 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
if ( $cfg['PropertiesIconic'] === 'both' ) { if ( $cfg['PropertiesIconic'] === 'both' ) {
$titles['Change'] .= $strChange . '</div>'; $titles['Change'] .= $strChange . '</div>';
@@ -169,9 +193,9 @@ $i = 0;
<th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th> <th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th>
<th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th> <th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th>
<?php if ( $db_is_information_schema || $tbl_is_view ) { ?> <?php if ( $db_is_information_schema || $tbl_is_view ) { ?>
<th id="<?php echo ++$i; ?>"><?php echo $strView; ?></th> <th id="th<?php echo ++$i; ?>"><?php echo $strView; ?></th>
<?php } else { ?> <?php } else { ?>
<th colspan="7" id="<?php echo ++$i; ?>"><?php echo $strAction; ?></th> <th colspan="7" id="th<?php echo ++$i; ?>"><?php echo $strAction; ?></th>
<?php } ?> <?php } ?>
</tr> </tr>
</thead> </thead>
@@ -572,6 +596,7 @@ if ( ! $tbl_is_view && ! $db_is_information_schema ) {
define('PMA_IDX_INCLUDED', 1); define('PMA_IDX_INCLUDED', 1);
require ('./tbl_indexes.php'); require ('./tbl_indexes.php');
} }
/** /**
* Displays Space usage and row statistics * Displays Space usage and row statistics
*/ */
@@ -638,7 +663,7 @@ if ( $cfg['ShowStats'] ) {
} }
if ( isset( $free_size ) ) { if ( isset( $free_size ) ) {
?> ?>
<tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>"> <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?> warning">
<th class="name"><?php echo $strOverhead; ?></th> <th class="name"><?php echo $strOverhead; ?></th>
<td class="value"><?php echo $free_size; ?></td> <td class="value"><?php echo $free_size; ?></td>
<td class="unit"><?php echo $free_unit; ?></td> <td class="unit"><?php echo $free_unit; ?></td>
@@ -662,7 +687,7 @@ if ( $cfg['ShowStats'] ) {
// Optimize link if overhead // Optimize link if overhead
if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) { if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
?> ?>
<tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>"> <tr class="tblFooters">
<td colspan="3" align="center"> <td colspan="3" align="center">
<a href="sql.php?<?php echo $url_query; ?>&pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php <a href="sql.php?<?php echo $url_query; ?>&pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php
if ($cfg['PropertiesIconic']) { if ($cfg['PropertiesIconic']) {