complete revise (xhtml output, fieldsets, forms merged)

This commit is contained in:
Sebastian Mendel
2005-12-08 12:23:04 +00:00
parent f802429004
commit 42c1128c84

View File

@@ -10,7 +10,8 @@ require_once('./libraries/common.lib.php');
require('./tbl_properties_common.php'); require('./tbl_properties_common.php');
//$err_url = 'tbl_properties_operations.php' . $err_url; //$err_url = 'tbl_properties_operations.php' . $err_url;
$url_query .= '&goto=tbl_properties_operations.php&back=tbl_properties_operations.php'; $url_query .= '&goto=tbl_properties_operations.php&back=tbl_properties_operations.php';
$url_params['goto'] = 'tbl_properties_operations.php';
$url_params['back'] = 'tbl_properties_operations.php';
/** /**
* Gets relation settings * Gets relation settings
@@ -26,80 +27,112 @@ require_once('./libraries/storage_engines.lib.php');
// reselect current db (needed in some cases probably due to // reselect current db (needed in some cases probably due to
// the calling of relation.lib.php) // the calling of relation.lib.php)
PMA_DBI_select_db($db); PMA_DBI_select_db($GLOBALS['db']);
$reread_info = FALSE;
/**
* Updates table comment, type and options if required
*/
if (isset($submitcomment)) {
if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
$reread_info = TRUE;
}
}
if (isset($submittype)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $new_tbl_type;
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
$reread_info = TRUE;
}
if (isset($submitcollation)) {
// since something modifies $tbl_collation between the moment it is
// set from $_POST and this point, need to restore it
// (bug seen in MySQL 5.0.4)
$tbl_collation = $_POST['tbl_collation'];
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' DEFAULT' . PMA_generateCharsetQueryPart($tbl_collation);
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
unset($tbl_collation);
$reread_info = TRUE;
}
if (isset($submitoptions)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table);
if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') {
$sql_query .= isset($new_pack_keys) ? ' pack_keys=1': ' pack_keys=0';
}
if ($tbl_type == 'MYISAM') {
$sql_query .= (isset($new_checksum) ? ' checksum=1': ' checksum=0')
. (isset($new_delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0');
}
// nijel: Here should be version check for InnoDB, however it is supported
// in 5.0.x x>4, 4.1.y y>12 and also works in 4.0.11, so I decided not to
// check for version
if ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB') {
$sql_query .= !empty($new_auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($new_auto_increment) : '';
}
$result = PMA_DBI_query($sql_query);
$message = $strSuccess;
$reread_info = TRUE;
}
if ($reread_info) {
require('./libraries/tbl_properties_table_info.inc.php');
}
unset($reread_info);
/**
* Reordering the table has been requested by the user
*/
if (isset($submitorderby) && !empty($order_field)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table)
. ' ORDER BY ' . PMA_backquote(urldecode($order_field));
if (isset($order_order) && $order_order == 'desc') {
$sql_query .= ' DESC';
}
$result = PMA_DBI_query($sql_query);
$message = $result ? $strSuccess : $strError;
} // end if
/** /**
* Gets tables informations * Gets tables informations
*/ */
require_once('./libraries/tbl_properties_table_info.inc.php');
require_once('./libraries/tbl_move_copy.php');
require('./libraries/tbl_properties_table_info.inc.php');
$reread_info = false;
$errors = array();
$table_alters = array();
/**
* Updates table comment, type and options if required
*/
if ( isset( $_REQUEST['submitoptions'] ) ) {
if ( isset( $_REQUEST['new_name'] ) && $_REQUEST['new_name'] !== $GLOBALS['table'] ) {
if ( trim($_REQUEST['new_name']) === '' ) {
$errors[] = $strTableEmpty;
} elseif ( strpos($_REQUEST['new_name'], '.') !== false ) {
$errors[] = $strError . ': ' . $_REQUEST['new_name'];
} else {
if ( PMA_table_rename( $GLOBALS['table'], $_REQUEST['new_name'] ) ) {
$message = sprintf($GLOBALS['strRenameTableOK'],
htmlspecialchars($GLOBALS['table']), htmlspecialchars($_REQUEST['new_name']));
$GLOBALS['table'] = $_REQUEST['new_name'];
$reread_info = true;
$reload = true;
} else {
$errors[] = $strError . ': ' . $_REQUEST['new_name'];
}
}
}
if ( isset( $_REQUEST['comment'] )
&& urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment'] ) {
$table_alters[] = 'COMMENT = \'' . PMA_sqlAddslashes($_REQUEST['comment']) . '\'';
}
if ( ! empty( $_REQUEST['new_tbl_type'] )
&& strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type) ) {
$table_alters[] = 'TYPE = ' . $_REQUEST['new_tbl_type'];
$tbl_type = $_REQUEST['new_tbl_type'];
}
if ( ! empty( $_REQUEST['tbl_collation'] )
&& $_REQUEST['tbl_collation'] !== $tbl_collation ) {
$table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);
}
$l_tbl_type = strtolower( $tbl_type );
$pack_keys = empty( $pack_keys ) ? '0' : '1';
$_REQUEST['new_pack_keys'] = empty( $_REQUEST['new_pack_keys'] ) ? '0' : '1';
if ( ( $l_tbl_type === 'myisam' || $l_tbl_type === 'isam' )
&& $_REQUEST['new_pack_keys'] !== $pack_keys ) {
$table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
}
$checksum = empty( $checksum ) ? '0' : '1';
$_REQUEST['new_checksum'] = empty( $_REQUEST['new_checksum'] ) ? '0' : '1';
if ( ( $l_tbl_type === 'myisam' )
&& $_REQUEST['new_checksum'] !== $checksum ) {
$table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
}
$delay_key_write = empty( $delay_key_write ) ? '0' : '1';
$_REQUEST['new_delay_key_write'] = empty( $_REQUEST['new_delay_key_write'] ) ? '0' : '1';
if ( ( $l_tbl_type === 'myisam' )
&& $_REQUEST['new_delay_key_write'] !== $delay_key_write ) {
$table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
}
if ( ( $l_tbl_type === 'myisam' || $l_tbl_type === 'innodb' )
&& ! empty( $_REQUEST['new_auto_increment'] )
&& ( ! isset( $auto_increment ) || $_REQUEST['new_auto_increment'] !== $auto_increment ) ) {
$table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
}
if ( count($table_alters) > 0 ) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
$sql_query .= "\r\n" . implode("\r\n", $table_alters);
$message = PMA_DBI_query($sql_query) ? $strSuccess : $strError;
$reread_info = true;
unset( $table_alters );
}
}
/**
* Reordering the table has been requested by the user
*/
if ( isset( $_REQUEST['submitorderby'] ) && ! empty( $_REQUEST['order_field'] ) ) {
$sql_query = '
ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
if ( isset( $_REQUEST['order_order'] ) && $_REQUEST['order_order'] === 'desc' ) {
$sql_query .= ' DESC';
}
$message = PMA_DBI_query($sql_query) ? $strSuccess : $strError;
} // end if
if ( $reread_info ) {
$pack_keys = $checksum = $delay_key_write = 0;
require('./libraries/tbl_properties_table_info.inc.php');
}
unset( $reread_info );
/** /**
* Displays top menu links * Displays top menu links
@@ -109,178 +142,129 @@ require_once('./libraries/tbl_properties_links.inc.php');
/** /**
* Get columns names * Get columns names
*/ */
$local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db); $local_query = '
$result = PMA_DBI_query($local_query); SHOW COLUMNS
for ($i = 0; $row = PMA_DBI_fetch_assoc($result); $i++) { FROM ' . PMA_backquote($GLOBALS['table']) . '
$columns[$i] = $row['Field']; FROM ' . PMA_backquote($GLOBALS['db']);
} $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
PMA_DBI_free_result($result); unset( $local_query );
unset($result);
?>
<table border="0" align="left" cellpadding="3" cellspacing="0">
<?php
/** /**
* Displays the page * Displays the page
*/ */
if (PMA_MYSQL_INT_VERSION >= 32334) {
?> ?>
<!-- Order the table --> <!-- Order the table -->
<form method="post" action="tbl_properties_operations.php"> <form method="post" action="tbl_properties_operations.php">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<tr> <fieldset>
<th class="tblHeaders" colspan="2" align="left"><?php echo $strAlterOrderBy; ?>:&nbsp;</th></tr> <legend><?php echo $strAlterOrderBy; ?></legend>
<tr> <select name="order_field">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<select name="order_field" style="vertical-align: middle">
<?php <?php
echo "\n"; foreach ( $columns as $fieldname ) {
foreach ($columns AS $junk => $fieldname) { echo ' <option value="' . htmlspecialchars($fieldname) . '">'
echo ' <option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n"; . htmlspecialchars($fieldname) . '</option>' . "\n";
} }
unset($columns); unset($columns);
?> ?>
</select>&nbsp;<?php echo $strSingly . "\n"; ?> </select> <?php echo $strSingly; ?>
<select name="order_order" style="vertical-align: middle"> <select name="order_order">
<option value="asc"><?php echo $strAscending; ?></option> <option value="asc"><?php echo $strAscending; ?></option>
<option value="desc"><?php echo $strDescending; ?></option> <option value="desc"><?php echo $strDescending; ?></option>
</select> </select>
</td> <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" />
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right"> </fieldset>
<input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
</td>
</tr>
</form> </form>
<tr><td colspan="2" height="5"></td></tr>
<?php
}
echo "\n";
?>
<!-- Change table name -->
<form method="post" action="tbl_rename.php" onsubmit="return emptyFormElements(this, 'new_name')">
<tr>
<th class="tblHeaders" colspan="2" align="left">
<?php echo $strRenameTable; ?>:&nbsp;
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="reload" value="1" />
</th>
</tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />&nbsp;
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
<input type="submit" value="<?php echo $strGo; ?>" />
</td>
</tr>
</form>
<tr><td colspan="2" height="5"></td></tr>
<!-- Move table --> <!-- Move table -->
<form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')"> <form method="post" action="tbl_move_copy.php"
<tr> onsubmit="return emptyFormElements(this, 'new_name')">
<th class="tblHeaders" colspan="2" align="left"> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<?php echo $strMoveTable . "\n"; ?>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />
<input type="hidden" name="what" value="data" /> <input type="hidden" name="what" value="data" />
</th> <fieldset>
</tr> <legend><?php echo $strMoveTable; ?></legend>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" nowrap="nowrap">
<select name="target_db"> <select name="target_db">
<?php <?php
// The function used below is defined in "common.lib.php" // The function used below is defined in "common.lib.php"
PMA_availableDatabases('main.php?' . PMA_generate_common_url()); PMA_availableDatabases('main.php?' . PMA_generate_common_url());
for ($i = 0; $i < $num_dbs; $i++) { foreach ( $dblist as $each_db ) {
echo ' '; echo ' ';
echo '<option value="' . htmlspecialchars($dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>'; echo '<option value="' . htmlspecialchars($each_db) . '">'
. htmlspecialchars($each_db) . '</option>';
echo "\n"; echo "\n";
} // end for } // end foreach $dblist
?> ?>
</select> </select>
&nbsp;<b>.</b>&nbsp; &nbsp;<b>.</b>&nbsp;
<input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" /> <input type="text" size="20" name="new_name" onfocus="this.select()"
</td> value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
<td align="<?php echo $cell_align_right; ?>" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<input type="submit" name="submit_move" value="<?php echo $strGo; ?>" /> <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" />
</td> </fieldset>
</tr>
</form> </form>
<tr><td colspan="2" height="5"></td></tr>
<!-- Copy table --> <!-- Copy table -->
<form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')"> <form method="post" action="tbl_move_copy.php"
<tr> onsubmit="return emptyFormElements(this, 'new_name')">
<th class="tblHeaders" colspan="2" align="left"> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<?php echo $strCopyTable . "\n"; ?>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />
</th> <fieldset>
</tr> <legend><?php echo $strCopyTable; ?></legend>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2" nowrap="nowrap">
<select name="target_db"> <select name="target_db">
<?php <?php
for ($i = 0; $i < $num_dbs; $i++) { foreach ( $dblist as $each_db ) {
echo ' '; echo ' ';
echo '<option value="' . htmlspecialchars($dblist[$i]) . '"'; echo '<option value="' . htmlspecialchars($each_db) . '"';
if ($dblist[$i] == $db) { if ( $each_db === $GLOBALS['db'] ) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>' . htmlspecialchars($dblist[$i]) . '</option>'; echo '>' . htmlspecialchars($each_db) . '</option>';
echo "\n"; echo "\n";
} // end for } // end foreach $dblist
?> ?>
</select> </select>
&nbsp;<b>.</b>&nbsp; &nbsp;<b>.</b>&nbsp;
<input type="text" size="20" name="new_name" class="textfield" onfocus="this.select()" /> <input type="text" size="20" name="new_name" onfocus="this.select()" /><br />
</td>
</tr>
<tr>
<td nowrap="nowrap" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<input type="radio" name="what" value="structure" id="radio_copy_structure" style="vertical-align: middle" /><label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label>&nbsp;&nbsp;<br />
<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>&nbsp;&nbsp;<br />
<input type="radio" name="what" value="dataonly" id="radio_copy_dataonly" style="vertical-align: middle" /><label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label>&nbsp;&nbsp;<br />
<input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" style="vertical-align: middle" /><label for="checkbox_drop"><?php echo $strStrucDrop; ?></label>&nbsp;&nbsp;<br /> <input type="radio" name="what" value="structure" id="radio_copy_structure" />
<input type="checkbox" name="sql_auto_increment" value="1" id="checkbox_auto_increment" style="vertical-align: middle" /><label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br /> <label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label><br />
<input type="radio" name="what" value="data" id="radio_copy_data" checked="checked" />
<label for="radio_copy_data"><?php echo $strStrucData; ?></label><br />
<input type="radio" name="what" value="dataonly" id="radio_copy_dataonly" />
<label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label><br />
<input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" />
<label for="checkbox_drop"><?php echo $strStrucDrop; ?></label><br />
<input type="checkbox" name="sql_auto_increment" value="1" id="checkbox_auto_increment" />
<label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br />
<?php <?php
// display "Add constraints" choice only if there are // display "Add constraints" choice only if there are
// foreign keys // foreign keys
if (PMA_getForeigners($db, $table, '', 'innodb')) { if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'innodb')) {
?> ?>
<input type="checkbox" name="constraints" value="1" id="checkbox_constraints" style="vertical-align: middle" /><label for="checkbox_constraints"><?php echo $strAddConstraints; ?></label><br /> <input type="checkbox" name="constraints" value="1" id="checkbox_constraints" />
<label for="checkbox_constraints"><?php echo $strAddConstraints; ?></label><br />
<?php <?php
} // endif } // endif
if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') { if ( isset( $_COOKIE['pma_switch_to_new'] )
&& $_COOKIE['pma_switch_to_new'] == 'true' ) {
$pma_switch_to_new = 'true'; $pma_switch_to_new = 'true';
} }
?> ?>
<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>&nbsp;&nbsp; <input type="checkbox" name="switch_to_new" value="true"
</td> id="checkbox_switch"<?php echo
<td align="<?php echo $cell_align_right; ?>" valign="bottom" bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> isset( $pma_switch_to_new ) && $pma_switch_to_new == 'true'
? ' checked="checked"'
: ''; ?> />
<label for="checkbox_switch"><?php echo $strSwitchToTable; ?></label>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" /> <input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
</td> </fieldset>
</tr>
</form> </form>
<tr><td colspan="2" height="5"></td></tr>
<?php
/**
* Displays form controls
*/
?>
<!-- Table comments -->
<form method="post" action="tbl_properties_operations.php">
<tr>
<th colspan="2" class="tblHeaders" align="left">
<?php <?php
echo PMA_generate_common_hidden_inputs($db, $table); if (strstr($show_comment, '; InnoDB free') === false) {
echo $strTableComments . '&nbsp;'; if (strstr($show_comment, 'InnoDB free') === false) {
if (strstr($show_comment, '; InnoDB free') === FALSE) {
if (strstr($show_comment, 'InnoDB free') === FALSE) {
// only user entered comment // only user entered comment
$comment = $show_comment; $comment = $show_comment;
} else { } else {
@@ -291,245 +275,181 @@ for ($i = 0; $i < $num_dbs; $i++) {
// remove InnoDB comment from end, just the minimal part (*? is non greedy) // remove InnoDB comment from end, just the minimal part (*? is non greedy)
$comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment); $comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
} }
?>
<input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" />&nbsp;
</th>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<input type="text" name="comment" maxlength="60" size="30" value="<?php echo htmlspecialchars($comment); ?>" class="textfield" style="vertical-align: middle" onfocus="this.select()" />&nbsp;
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
<input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
</td>
</tr>
</form>
<tr><td colspan="2" height="5"></td></tr>
<!-- Table type -->
<?php
// modify robbat2 code - staybyte - 11. June 2001
$result = PMA_DBI_query('SHOW VARIABLES LIKE \'have_%\';');
if ($result) {
while ($tmp = PMA_DBI_fetch_assoc($result)) {
if (isset($tmp['Variable_name'])) {
switch ($tmp['Variable_name']) {
case 'have_bdb':
if ($tmp['Value'] == 'YES') {
$tbl_bdb = TRUE;
}
break;
case 'have_gemini':
if ($tmp['Value'] == 'YES') {
$tbl_gemini = TRUE;
}
break;
case 'have_innodb':
if ($tmp['Value'] == 'YES') {
$tbl_innodb = TRUE;
}
break;
case 'have_isam':
if ($tmp['Value'] == 'YES') {
$tbl_isam = TRUE;
}
break;
} // end switch
} // end if isset($tmp['Variable_name'])
} // end while
} // end if $result
PMA_DBI_free_result($result);
echo "\n";
?>
<form method="post" action="tbl_properties_operations.php">
<tr>
<th colspan="2" class="tblHeaders" align="left">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<?php echo $strTableType; ?>:&nbsp;
<?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
</th>
</tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_generateEnginesDropdown('new_tbl_type', NULL, FALSE, $tbl_type, 4); ?>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
<input type="submit" name="submittype" value="<?php echo $strGo; ?>" />
</td>
</tr>
</form>
<tr><td colspan="2" height="5"></td></tr>
<?php
if (PMA_MYSQL_INT_VERSION >= 40100) {
echo "\n"
. '<!-- Table character set -->' . "\n"
. ' <form method="post" action="tbl_properties_operations.php">' . "\n"
. ' <tr>' . "\n"
. ' <th colspan="2" class="tblHeaders" align="left">' . "\n"
. PMA_generate_common_hidden_inputs($db, $table, 3)
. ' ' . $strCollation . ':&nbsp;' . "\n"
. ' </th>' . "\n"
. ' </tr>' . "\n"
. ' <tr>' . "\n"
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, $tbl_collation, FALSE, 3)
. ' </td>' . "\n"
. ' <td bgcolor="' . $cfg['BgcolorOne'] . '" align="right">' . "\n"
. ' <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
. ' </td>' . "\n"
. ' </tr>' . "\n"
. ' </form>' . "\n"
. ' <tr><td colspan="2" height="5"></td></tr>' . "\n";
}
// PACK_KEYS: MyISAM or ISAM // PACK_KEYS: MyISAM or ISAM
// DELAY_KEY_WRITE, CHECKSUM, : MyISAM only // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
// AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3
// nijel: Here should be version check for InnoDB, however it is supported // nijel: Here should be version check for InnoDB, however it is supported
// in 5.0.x x>4, 4.1.y y>12 and also works in 4.0.11, so I decided not to // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
// check for version // check for version
if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM' || $tbl_type == 'INNODB') {
?> ?>
<!-- Table options --> <!-- Table options -->
<form method="post" action="tbl_properties_operations.php"> <form method="post" action="tbl_properties_operations.php">
<tr> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<th colspan="2" class="tblHeaders" align="left"> <input type="hidden" name="reload" value="1" />
<?php echo $strTableOptions; ?>:&nbsp; <fieldset>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <legend><?php echo $strTableOptions; ?></legend>
</th>
<table>
<!-- Change table name -->
<tr><td><?php echo $strRenameTable; ?></td>
<td><input type="text" size="20" name="new_name" onfocus="this.select()"
value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
</td>
</tr> </tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <!-- Table comments -->
<input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" />
<tr><td><?php echo $strTableComments; ?></td>
<td><input type="text" name="comment" maxlength="60" size="30"
value="<?php echo htmlspecialchars($comment); ?>" onfocus="this.select()" />
</td>
</tr>
<!-- Table type -->
<tr><td><?php echo $strTableType; ?>
<?php echo PMA_showMySQLDocu('Table_types', 'Table_types'); ?>
</td>
<td><?php echo PMA_generateEnginesDropdown('new_tbl_type', null, false, $tbl_type, 4); ?>
</td>
</tr>
<?php <?php
if (PMA_MYSQL_INT_VERSION >= 40100) {
?>
<!-- Table character set -->
<tr><td><?php echo $strCollation; ?></td>
<td><?php echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION,
'tbl_collation', null, $tbl_collation, false, 3); ?>
</td>
</tr>
<?php
}
if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') { if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') {
?> ?>
<input type="checkbox" name="new_pack_keys" id="pack_keys_opt" <tr>
<?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="pack_keys_opt">pack_keys</label><br /> <td><label for="new_pack_keys">pack_keys</label></td>
<td><input type="checkbox" name="new_pack_keys" id="new_pack_keys"
value="1"
<?php echo (isset($pack_keys) && $pack_keys == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<?php <?php
} // end if (MYISAM|ISAM) } // end if (MYISAM|ISAM)
if ($tbl_type == 'MYISAM') { if ($tbl_type == 'MYISAM') {
?> ?>
<input type="checkbox" name="new_checksum" id="checksum_opt" <tr><td><label for="new_checksum">checksum</label></td>
<?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="checksum_opt">checksum</label><br /> <td><input type="checkbox" name="new_checksum" id="new_checksum"
value="1"
<?php echo (isset($checksum) && $checksum == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<input type="checkbox" name="new_delay_key_write" id="delay_key_write_opt" <tr><td><label for="new_delay_key_write">delay_key_write</label></td>
<?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 /> <td><input type="checkbox" name="new_delay_key_write" id="new_delay_key_write"
value="1"
<?php echo (isset($delay_key_write) && $delay_key_write == 1)
? ' checked="checked"'
: ''; ?> />
</td>
</tr>
<?php <?php
} // end if (MYISAM) } // end if (MYISAM)
if ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB') {
if ( isset( $auto_increment ) && strlen($auto_increment) > 0
&& ( $tbl_type == 'MYISAM' || $tbl_type == 'INNODB' ) ) {
?> ?>
<input type="text" name="new_auto_increment" id="auto_increment_opt" class="textfield" <tr><td><label for="auto_increment_opt">auto_increment</label></td>
<?php echo (isset($auto_increment) && !empty($auto_increment) ? ' value="' . $auto_increment . '"' : ''); ?> style="width: 30px; vertical-align: middle" />&nbsp;<label for="auto_increment_opt">auto_increment</label> <td><input type="text" name="new_auto_increment" id="auto_increment_opt"
</td> value="<?php echo $auto_increment; ?>" /></td>
</tr>
<?php <?php
} // end if (MYISAM|INNODB) } // end if (MYISAM|INNODB)
?>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" valign="bottom">
<input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
</td>
</tr>
</form>
<?php
} // end if (MYISAM or ISAM)
?> ?>
</table> </table>
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="25" height="1" border="0" align="left" /> </fieldset>
<!-----> <fieldset class="tblFooters">
<table border="0" cellpadding="3" cellspacing="0"> <input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
<tr> </fieldset>
<th class="tblHeaders" colspan="2" align="left"> </form>
<?php echo $strTableMaintenance; ?>
</th> <h1><?php echo $strTableMaintenance; ?></h1>
</tr>
<ul>
<?php <?php
if ( $tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB' || $tbl_type == 'INNODB' ) { if ( $tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB' || $tbl_type == 'INNODB' ) {
echo "\n";
if ( $tbl_type == 'MYISAM' || $tbl_type == 'INNODB' ) { if ( $tbl_type == 'MYISAM' || $tbl_type == 'INNODB' ) {
$this_url_params = array_merge($url_params,
array( 'sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table']) ));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strCheckTable; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>"> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?>
<?php echo $strCheckTable; ?></a>&nbsp; </li>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE') . "\n"; ?>
</td>
</tr>
<?php <?php
} }
echo "\n";
if ($tbl_type == 'INNODB') { if ($tbl_type == 'INNODB') {
$this_url_params = array_merge($url_params,
array( 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' TYPE=InnoDB' ));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strDefragment; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' TYPE=InnoDB'); ?>"> <?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?>
<?php echo $strDefragment; ?></a>&nbsp; </li>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting') . "\n"; ?>
</td>
</tr>
<?php <?php
} }
echo "\n";
if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') { if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
$this_url_params = array_merge($url_params,
array( 'sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table']) ));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strAnalyzeTable; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>"> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?>
<?php echo $strAnalyzeTable; ?></a>&nbsp; </li>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE') . "\n";?>
</td>
</tr>
<?php <?php
} }
echo "\n";
if ($tbl_type == 'MYISAM') { if ($tbl_type == 'MYISAM') {
$this_url_params = array_merge($url_params,
array( 'sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table']) ));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strRepairTable; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>"> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?>
<?php echo $strRepairTable; ?></a>&nbsp; </li>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE') . "\n"; ?>
</td>
</tr>
<?php <?php
} }
echo "\n";
if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') { if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
$this_url_params = array_merge($url_params,
array( 'sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table']) ));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strOptimizeTable; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?>
<?php echo $strOptimizeTable; ?></a>&nbsp; </li>
</td>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
</td>
</tr>
<?php <?php
} }
echo "\n";
?>
<?php
} // end MYISAM or BERKELEYDB case } // end MYISAM or BERKELEYDB case
echo "\n"; $this_url_params = array_merge($url_params,
array(
'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
'zero_rows' => sprintf($strTableHasBeenFlushed,
htmlspecialchars($GLOBALS['table'])),
'reload' => 1,
));
?> ?>
<tr> <li><a href="sql.php<?php echo PMA_generate_common_url( $this_url_params ); ?>">
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <?php echo $strFlushTable; ?></a>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfg['ShowTooltip']) echo '&amp;reload=1'; ?>"> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?>
<?php echo $strFlushTable; ?></a>&nbsp; </li>
</td> </ul>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
</td>
</tr>
<?php <?php
// Referential integrity check // Referential integrity check
// The Referential integrity check was intended for the non-InnoDB // The Referential integrity check was intended for the non-InnoDB
@@ -540,61 +460,55 @@ echo "\n";
if ( $cfgRelation['relwork'] && $tbl_type != "INNODB" ) { if ( $cfgRelation['relwork'] && $tbl_type != "INNODB" ) {
// we need this PMA_DBI_select_db if the user has access to more than one db // we need this PMA_DBI_select_db if the user has access to more than one db
// and $db is not the last of the list, because PMA_availableDatabases() // and $GLOBALS['db'] is not the last of the list, because PMA_availableDatabases()
// has made a PMA_DBI_select_db() on the last one // has made a PMA_DBI_select_db() on the last one
PMA_DBI_select_db($db); PMA_DBI_select_db($GLOBALS['db']);
$foreign = PMA_getForeigners($db, $table); $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
if ($foreign) { if ($foreign) {
?> ?>
<!-- Referential integrity check --> <!-- Referential integrity check -->
<tr> <ul>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2">
<?php echo $strReferentialIntegrity; ?><br /> <?php echo $strReferentialIntegrity; ?><br />
<?php <?php
echo "\n"; echo "\n";
foreach ($foreign AS $master => $arr) { foreach ($foreign AS $master => $arr) {
$join_query = 'SELECT ' . PMA_backquote($table) . '.* FROM ' $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
. PMA_backquote($table) . ' LEFT JOIN ' . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
. PMA_backquote($arr['foreign_table']); . PMA_backquote($arr['foreign_table']);
if ($arr['foreign_table'] == $table) { if ($arr['foreign_table'] == $GLOBALS['table']) {
$foreign_table = $table . '1'; $foreign_table = $GLOBALS['table'] . '1';
$join_query .= ' AS ' . PMA_backquote($foreign_table); $join_query .= ' AS ' . PMA_backquote($foreign_table);
} else { } else {
$foreign_table = $arr['foreign_table']; $foreign_table = $arr['foreign_table'];
} }
$join_query .= ' ON ' $join_query .= ' ON '
. PMA_backquote($table) . '.' . PMA_backquote($master) . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
. ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field']) . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
. ' WHERE ' . ' WHERE '
. PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field']) . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
. ' IS NULL AND ' . ' IS NULL AND '
. PMA_backquote($table) . '.' . PMA_backquote($master) . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
. ' IS NOT NULL'; . ' IS NOT NULL';
echo ' ' $this_url_params = array_merge($url_params,
. '<a href="sql.php?' . $url_query array( 'sql_query' => $join_query ));
. '&amp;sql_query=' echo ' <li>'
. urlencode($join_query) . '<a href="sql.php'
. PMA_generate_common_url( $this_url_params )
. '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field'] . '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field']
. '</a><br />' . "\n"; . '</a></li>' . "\n";
unset($foreign_table); } // foreach $foreign
unset($join_query); unset($foreign_table, $join_query);
} // end while
?> ?>
</td> </ul>
</tr>
<?php <?php
} // end if ($result) } // end if ($result)
echo "\n";
} // end if (!empty($cfg['Server']['relation'])) } // end if (!empty($cfg['Server']['relation']))
?>
</table>
<?php
/** /**
* Displays the footer * Displays the footer
*/ */
echo "\n";
require_once('./libraries/footer.inc.php'); require_once('./libraries/footer.inc.php');
?> ?>