diff --git a/ChangeLog b/ChangeLog index da17def5f..8fcf1ae7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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, diff --git a/libraries/common.lib.php b/libraries/common.lib.php index f0879c4c8..0ae915887 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -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 /** diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 634129410..136e2cc9c 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -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 diff --git a/tbl_change.php b/tbl_change.php index ee36f113d..907ae0963 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -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); diff --git a/tbl_replace.php b/tbl_replace.php index 4448d3db7..32e859b93 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -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'; } } diff --git a/tbl_row_action.php b/tbl_row_action.php index 912898b1b..c2204a509 100644 --- a/tbl_row_action.php +++ b/tbl_row_action.php @@ -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';