misleading variable name

This commit is contained in:
Marc Delisle
2010-09-04 07:01:30 -04:00
parent 49ae8993fe
commit 98a5ba7317
9 changed files with 27 additions and 27 deletions

View File

@@ -406,7 +406,7 @@ echo __('Remove database');
'goto' => 'main.php', 'goto' => 'main.php',
'reload' => '1', 'reload' => '1',
'purge' => '1', 'purge' => '1',
'zero_rows' => sprintf(__('Database %s has been dropped.'), htmlspecialchars(PMA_backquote($db))), 'message_to_show' => sprintf(__('Database %s has been dropped.'), htmlspecialchars(PMA_backquote($db))),
'db' => NULL, 'db' => NULL,
); );
?> ?>

View File

@@ -22,7 +22,7 @@ $cfgRelation = PMA_getRelationsParam();
*/ */
if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) { if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) {
$goto = 'db_sql.php'; $goto = 'db_sql.php';
$zero_rows = htmlspecialchars(__('Your SQL query has been executed successfully')); $message_to_show = htmlspecialchars(__('Your SQL query has been executed successfully'));
require './sql.php'; require './sql.php';
exit; exit;
} else { } else {

View File

@@ -298,7 +298,7 @@ foreach ($tables as $keyname => $each_table) {
$empty_table = '<a class="truncate_table_anchor" href="sql.php?' . $tbl_url_query $empty_table = '<a class="truncate_table_anchor" href="sql.php?' . $tbl_url_query
. '&amp;sql_query='; . '&amp;sql_query=';
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;zero_rows=' . '&amp;message_to_show='
. urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME'])))
.'">' . $titles['Empty'] . '</a>'; .'">' . $titles['Empty'] . '</a>';
} else { } else {
@@ -386,7 +386,7 @@ foreach ($tables as $keyname => $each_table) {
<td align="center"> <td align="center">
<a class="drop_table_anchor" href="sql.php?<?php echo $tbl_url_query; <a class="drop_table_anchor" href="sql.php?<?php echo $tbl_url_query;
?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php ?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php
echo urlencode($drop_query); ?>&amp;zero_rows=<?php echo urlencode($drop_query); ?>&amp;message_to_show=<?php
echo urlencode($drop_message); ?>" > echo urlencode($drop_message); ?>" >
<?php echo $titles['Drop']; ?></a></td> <?php echo $titles['Drop']; ?></a></td>
<?php } // end if (! $db_is_information_schema) <?php } // end if (! $db_is_information_schema)

View File

@@ -468,11 +468,11 @@ class PMA_Index
$this_params = $GLOBALS['url_params']; $this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') { if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY'; $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
$this_params['zero_rows'] = __('The primary key has been dropped'); $this_params['message_to_show'] = __('The primary key has been dropped');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY'); $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
} else { } else {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName()); $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
$this_params['zero_rows'] = sprintf(__('Index %s has been dropped'), $index->getName()); $this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName()); $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
} }

View File

@@ -1143,7 +1143,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
'db' => $db, 'db' => $db,
'table' => $table, 'table' => $table,
'sql_query' => $url_sql_query, 'sql_query' => $url_sql_query,
'zero_rows' => __('The row has been deleted'), 'message_to_show' => __('The row has been deleted'),
'goto' => (empty($goto) ? 'tbl_sql.php' : $goto), 'goto' => (empty($goto) ? 'tbl_sql.php' : $goto),
); );
$lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text'); $lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
@@ -1155,7 +1155,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
'db' => $db, 'db' => $db,
'table' => $table, 'table' => $table,
'sql_query' => $del_query, 'sql_query' => $del_query,
'zero_rows' => __('The row has been deleted'), 'message_to_show' => __('The row has been deleted'),
'goto' => $lnk_goto, 'goto' => $lnk_goto,
); );
$del_url = 'sql.php' . PMA_generate_common_url($_url_params); $del_url = 'sql.php' . PMA_generate_common_url($_url_params);

View File

@@ -132,7 +132,7 @@ function PMA_sqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
.'<input type="hidden" name="pos" value="0" />' . "\n" .'<input type="hidden" name="pos" value="0" />' . "\n"
.'<input type="hidden" name="goto" value="' .'<input type="hidden" name="goto" value="'
.htmlspecialchars($goto) . '" />' . "\n" .htmlspecialchars($goto) . '" />' . "\n"
.'<input type="hidden" name="zero_rows" value="' .'<input type="hidden" name="message_to_show" value="'
. htmlspecialchars(__('Your SQL query has been executed successfully')) . '" />' . "\n" . htmlspecialchars(__('Your SQL query has been executed successfully')) . '" />' . "\n"
.'<input type="hidden" name="prev_sql_query" value="' .'<input type="hidden" name="prev_sql_query" value="'
. htmlspecialchars($query) . '" />' . "\n"; . htmlspecialchars($query) . '" />' . "\n";

10
sql.php
View File

@@ -242,7 +242,7 @@ if ($do_confirm) {
.PMA_generate_common_hidden_inputs($db, $table); .PMA_generate_common_hidden_inputs($db, $table);
?> ?>
<input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" /> <input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
<input type="hidden" name="zero_rows" value="<?php echo isset($zero_rows) ? PMA_sanitize($zero_rows, true) : ''; ?>" /> <input type="hidden" name="message_to_show" value="<?php echo isset($message_to_show) ? PMA_sanitize($message_to_show, true) : ''; ?>" />
<input type="hidden" name="goto" value="<?php echo $goto; ?>" /> <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="back" value="<?php echo isset($back) ? PMA_sanitize($back, true) : ''; ?>" /> <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="reload" value="<?php echo isset($reload) ? PMA_sanitize($reload, true) : 0; ?>" />
@@ -577,11 +577,11 @@ if (0 == $num_rows || $is_affected) {
// The form generated by sql_query_form.lib.php // The form generated by sql_query_form.lib.php
// and db_sql.php has many submit buttons // and db_sql.php has many submit buttons
// on the same form, and some confusion arises from the // on the same form, and some confusion arises from the
// fact that $zero_rows is sent for every case. // fact that $message_to_show is sent for every case.
// The $zero_rows containing a success message and sent with // The $message_to_show containing a success message and sent with
// the form should not have priority over errors // the form should not have priority over errors
} elseif (!empty($zero_rows) && !$is_select) { } elseif (!empty($message_to_show) && !$is_select) {
$message = PMA_Message::rawSuccess(htmlspecialchars($zero_rows)); $message = PMA_Message::rawSuccess(htmlspecialchars($message_to_show));
} elseif (!empty($GLOBALS['show_as_php'])) { } elseif (!empty($GLOBALS['show_as_php'])) {
$message = PMA_Message::success(__('Showing as PHP code')); $message = PMA_Message::success(__('Showing as PHP code'));
} elseif (isset($GLOBALS['show_as_php'])) { } elseif (isset($GLOBALS['show_as_php'])) {

View File

@@ -202,7 +202,7 @@ unset($reread_info);
*/ */
require_once './libraries/tbl_links.inc.php'; require_once './libraries/tbl_links.inc.php';
if (isset($result) && empty($zero_rows)) { if (isset($result) && empty($message_to_show)) {
// set to success by default, because result set could be empty // set to success by default, because result set could be empty
// (for example, a table rename) // (for example, a table rename)
$_type = 'success'; $_type = 'success';
@@ -624,7 +624,7 @@ if ($is_myisam_or_maria || $is_innodb || $is_berkeleydb) {
$this_url_params = array_merge($url_params, $this_url_params = array_merge($url_params,
array( array(
'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']), 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
'zero_rows' => sprintf(__('Table %s has been flushed'), 'message_to_show' => sprintf(__('Table %s has been flushed'),
htmlspecialchars($GLOBALS['table'])), htmlspecialchars($GLOBALS['table'])),
'reload' => 1, 'reload' => 1,
)); ));
@@ -650,7 +650,7 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
'sql_query' => $this_sql_query, 'sql_query' => $this_sql_query,
'goto' => 'tbl_structure.php', 'goto' => 'tbl_structure.php',
'reload' => '1', 'reload' => '1',
'zero_rows' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)), 'message_to_show' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)),
)); ));
?> ?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLink(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')"> <li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLink(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')">
@@ -667,7 +667,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
'goto' => 'db_operations.php', 'goto' => 'db_operations.php',
'reload' => '1', 'reload' => '1',
'purge' => '1', 'purge' => '1',
'zero_rows' => sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)), 'message_to_show' => sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)),
// table name is needed to avoid running // table name is needed to avoid running
// PMA_relationsCleanupDatabase() on the whole db later // PMA_relationsCleanupDatabase() on the whole db later
'table' => $GLOBALS['table'], 'table' => $GLOBALS['table'],

View File

@@ -393,7 +393,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php echo $titles['Change']; ?></a> <?php echo $titles['Change']; ?></a>
</td> </td>
<td align="center" class="drop"> <td align="center" class="drop">
<a class="drop_column_anchor" 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']))); ?>" > <a class="drop_column_anchor" 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;message_to_show=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>" >
<?php echo $titles['Drop']; ?></a> <?php echo $titles['Drop']; ?></a>
</td> </td>
<td align="center" class="primary"> <td align="center" class="primary">
@@ -404,7 +404,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
} else { } else {
echo "\n"; echo "\n";
?> ?>
<a class="add_primary_key_anchor" href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>" > <a class="add_primary_key_anchor" href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>" >
<?php echo $titles['Primary']; ?></a> <?php echo $titles['Primary']; ?></a>
<?php $primary_enabled = true; <?php $primary_enabled = true;
} }
@@ -419,7 +419,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
} else { } else {
echo "\n"; echo "\n";
?> ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $titles['Unique']; ?></a> <?php echo $titles['Unique']; ?></a>
<?php $unique_enabled = true; <?php $unique_enabled = true;
} }
@@ -434,7 +434,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
} else { } else {
echo "\n"; echo "\n";
?> ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $titles['Index']; ?></a> <?php echo $titles['Index']; ?></a>
<?php <?php
$index_enabled = true; $index_enabled = true;
@@ -449,7 +449,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
echo "\n"; echo "\n";
?> ?>
<td align="center" nowrap="nowrap" class="fulltext"> <td align="center" nowrap="nowrap" class="fulltext">
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $titles['IdxFulltext']; ?></a> <?php echo $titles['IdxFulltext']; ?></a>
<?php $fulltext_enabled = true; ?> <?php $fulltext_enabled = true; ?>
</td> </td>
@@ -479,7 +479,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php <?php
if(isset($primary_enabled)) { if(isset($primary_enabled)) {
if($primary_enabled) { ?> if($primary_enabled) { ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $hidden_titles['Primary']; ?> <?php echo $hidden_titles['Primary']; ?>
</a> </a>
<?php <?php
@@ -492,7 +492,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php <?php
if(isset($unique_enabled)) { if(isset($unique_enabled)) {
if($unique_enabled) { ?> if($unique_enabled) { ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $hidden_titles['Unique']; ?> <?php echo $hidden_titles['Unique']; ?>
</a> </a>
<?php <?php
@@ -505,7 +505,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php <?php
if(isset($index_enabled)) { if(isset($index_enabled)) {
if($index_enabled) { ?> if($index_enabled) { ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $hidden_titles['Index']; ?> <?php echo $hidden_titles['Index']; ?>
</a> </a>
<?php <?php
@@ -518,7 +518,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<?php <?php
if(isset($fulltext_enabled)) { if(isset($fulltext_enabled)) {
if($fulltext_enabled) { ?> if($fulltext_enabled) { ?>
<a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"> <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
<?php echo $hidden_titles['IdxFulltext']; ?> <?php echo $hidden_titles['IdxFulltext']; ?>
</a> </a>
<?php <?php