simplify logic and rename parameter

This commit is contained in:
Marc Delisle
2010-08-22 08:52:15 -04:00
parent 4a1b6af944
commit e6c7aaad34
2 changed files with 5 additions and 7 deletions

10
sql.php
View File

@@ -178,8 +178,7 @@ if ($do_confirm) {
<input type="hidden" name="back" value="<?php echo isset($back) ? PMA_sanitize($back, true) : ''; ?>" />
<input type="hidden" name="reload" value="<?php echo isset($reload) ? PMA_sanitize($reload, true) : 0; ?>" />
<input type="hidden" name="purge" value="<?php echo isset($purge) ? PMA_sanitize($purge, true) : ''; ?>" />
<input type="hidden" name="cpurge" value="<?php echo isset($cpurge) ? PMA_sanitize($cpurge, true) : ''; ?>" />
<input type="hidden" name="purgekey" value="<?php echo isset($purgekey) ? PMA_sanitize($purgekey, true) : ''; ?>" />
<input type="hidden" name="dropped_column" value="<?php echo isset($dropped_column) ? PMA_sanitize($dropped_column, true) : ''; ?>" />
<input type="hidden" name="show_query" value="<?php echo isset($show_query) ? PMA_sanitize($show_query, true) : ''; ?>" />
<?php
echo '<fieldset class="confirmation">' . "\n"
@@ -465,12 +464,11 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
} // end if ($purge)
// If a column gets dropped, do relation magic.
if (isset($cpurge) && $cpurge == '1' && isset($purgekey)
&& strlen($db) && strlen($table) && !empty($purgekey)) {
if (isset($dropped_column) && strlen($db) && strlen($table) && !empty($dropped_column)) {
require_once './libraries/relation_cleanup.lib.php';
PMA_relationsCleanupColumn($db, $table, $purgekey);
PMA_relationsCleanupColumn($db, $table, $dropped_column);
} // end if column PMA_* purge
} // end if column was dropped
} // end else "didn't ask to see php code"
// No rows returned -> move back to the calling page

View File

@@ -392,7 +392,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php echo $titles['Change']; ?></a>
</td>
<td align="center" class="drop">
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&amp;cpurge=1&amp;purgekey=<?php echo urlencode($row['Field']); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>"
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&amp;dropped_column=<?php echo urlencode($row['Field']); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>"
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
<?php echo $titles['Drop']; ?></a>
</td>