patch #2745215 [edit] Multi-row change with "]" improved

This commit is contained in:
Marc Delisle
2009-05-04 16:05:24 +00:00
parent 0214a6fe9d
commit 55a516e39c
6 changed files with 8 additions and 14 deletions

View File

@@ -57,6 +57,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
thanks to Yannick Betemps - arkhee
+ patch #2735162 [status] Server status - replication,
thanks to Tomas Srnka - tomassrnka
+ patch #2745215 [edit] Multi-row change with "]" improved,
thanks to Virsacer - virsacer
3.1.5.0 (not yet released)
- patch #2739001 [export] XML does not allow spaces in element names,

View File

@@ -2014,7 +2014,7 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
$preferred_condition = $nonprimary_condition;
}
return preg_replace('|\s?AND$|', '', $preferred_condition);
return trim(preg_replace('|\s?AND$|', '', $preferred_condition));
} // end function
/**

View File

@@ -1051,7 +1051,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
* avoid to display the delete and edit links
*/
$unique_condition = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row);
$unique_condition_html = htmlspecialchars(str_replace(']', ']', $unique_condition));
$unique_condition_html = urlencode($unique_condition);
// 1.2 Defines the URLs for the modify/delete link(s)
@@ -1109,7 +1109,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$lnk_goto = 'sql.php' . PMA_generate_common_url($_url_params, 'text');
$del_query = 'DELETE FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)
. ' WHERE' . $unique_condition . ' LIMIT 1';
. ' WHERE ' . $unique_condition . ' LIMIT 1';
$_url_params = array(
'db' => $db,
@@ -1121,7 +1121,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
$del_url = 'sql.php' . PMA_generate_common_url($_url_params);
$js_conf = 'DELETE FROM ' . PMA_jsFormat($db) . '.' . PMA_jsFormat($table)
. ' WHERE ' . trim(PMA_jsFormat($unique_condition, false))
. ' WHERE ' . PMA_jsFormat($unique_condition, false)
. ' LIMIT 1';
$del_str = PMA_getIcon('b_drop.png', $GLOBALS['strDelete'], true);
} elseif ($is_display['del_lnk'] == 'kp') { // kill process case

View File

@@ -166,7 +166,7 @@ if (isset($primary_key)) {
$result = array();
$found_unique_key = false;
foreach ($primary_key_array as $key_id => $primary_key) {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . str_replace(']', ']', $primary_key) . ';';
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';
$result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
$rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
$primary_keys[$key_id] = str_replace('\\', '\\\\', $primary_key);

View File

@@ -303,7 +303,7 @@ foreach ($loop_array as $rowcount => $primary_key) {
} else {
// build update query
$query[] = 'UPDATE ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table'])
. ' SET ' . implode(', ', $query_values) . ' WHERE ' . str_replace(']', ']', $primary_key) . ' LIMIT 1';
. ' SET ' . implode(', ', $query_values) . ' WHERE ' . $primary_key . ' LIMIT 1';
}
}

View File

@@ -83,14 +83,10 @@ if (!empty($submit_mult)) {
// checkbox, we use the index of it as the
// indicating primary key. Then we built the array which is used for
// the tbl_change.php script.
/**
* urldecode should not be needed here
$primary_key = array();
foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
$primary_key[] = urldecode($i_primary_key);
}
*/
$primary_key = array_keys($_REQUEST['rows_to_delete']);
$active_page = 'tbl_change.php';
include './tbl_change.php';
@@ -105,14 +101,10 @@ if (!empty($submit_mult)) {
// checkbox, we use the index of it as the
// indicating primary key. Then we built the array which is used for
// the tbl_change.php script.
/**
* urldecode should not be needed here
$primary_key = array();
foreach ($_REQUEST['rows_to_delete'] as $i_primary_key => $del_query) {
$primary_key[] = urldecode($i_primary_key);
}
*/
$primary_key = array_keys($_REQUEST['rows_to_delete']);
$active_page = 'tbl_export.php';
include './tbl_export.php';