From e0b45f38e89088f1151c236340e2b841b673c299 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 27 Sep 2007 07:37:42 +0000 Subject: [PATCH] do not urlencode form data (browser is responsible for doing required stuff) --- libraries/display_tbl.lib.php | 25 ++++++++++++++----------- libraries/display_tbl_links.lib.php | 8 ++++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 22b0a89e6..d731b5c54 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -277,7 +277,7 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query)
@@ -1058,7 +1058,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { * with only one field and it's a BLOB; in this case, * avoid to display the delete and edit links */ - $unique_condition = urlencode(PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row)); + //$unique_condition = urlencode(PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row)); + $unique_condition = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row); + $unique_condition_url = urlencode($unique_condition); + $unique_condition_html = htmlspecialchars($unique_condition); // 1.2 Defines the URLs for the modify/delete link(s) $url_query = PMA_generate_common_url($db, $table); @@ -1078,7 +1081,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $edit_url = 'tbl_change.php' . '?' . $url_query - . '&primary_key=' . $unique_condition + . '&primary_key=' . $unique_condition_url . '&sql_query=' . urlencode($url_sql_query) . '&goto=' . urlencode($lnk_goto); if ($GLOBALS['cfg']['PropertiesIconic'] === false) { @@ -1121,14 +1124,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { . '&sql_query=' . urlencode($url_sql_query) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . (empty($goto) ? 'tbl_sql.php' : $goto); - $del_query = urlencode('DELETE FROM ' . PMA_backquote($table) . ' WHERE') . $unique_condition . '+LIMIT+1'; + $del_query = 'DELETE FROM ' . PMA_backquote($table) . ' WHERE' . $unique_condition . ' LIMIT 1'; $del_url = 'sql.php' . '?' . $url_query - . '&sql_query=' . $del_query + . '&sql_query=' . urlencode($del_query) . '&zero_rows=' . urlencode(htmlspecialchars($GLOBALS['strDeleted'])) . '&goto=' . urlencode($lnk_goto); $js_conf = 'DELETE FROM ' . PMA_jsFormat($table) - . ' WHERE ' . trim(PMA_jsFormat(urldecode($unique_condition), false)) + . ' WHERE ' . trim(PMA_jsFormat($unique_condition, false)) . ' LIMIT 1'; if ($GLOBALS['cfg']['PropertiesIconic'] === false) { $del_str = $GLOBALS['strDelete']; @@ -1147,7 +1150,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { . PMA_generate_common_url('mysql') . '&sql_query=' . urlencode('KILL ' . $row[0]) . '&goto=' . urlencode($lnk_goto); - $del_query = urlencode('KILL ' . $row[0]); + $del_query = 'KILL ' . $row[0]; $js_conf = 'KILL ' . $row[0]; if ($GLOBALS['cfg']['PropertiesIconic'] === false) { $del_str = $GLOBALS['strKill']; @@ -1222,7 +1225,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { $transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') - . '&primary_key=' . (isset($unique_condition) ? $unique_condition : '') + . '&primary_key=' . (isset($unique_condition_url) ? $unique_condition_url : '') . '&sql_query=' . (empty($sql_query) ? '' : urlencode($url_sql_query)) . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&transform_key=' . urlencode($meta->name); @@ -1481,9 +1484,9 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { $vertical_display['row_delete'][$row_no] .= ' ' . "\n" - . ' ' . "\n" + . ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n" . ' ' . "\n"; } else { unset($vertical_display['row_delete'][$row_no]); @@ -2006,7 +2009,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) } elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { echo "\n" . '

' . "\n"; } - + // 6. ----- Displays "Query results operations" if (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { PMA_displayResultsOperations($the_disp_mode, $analyzed_sql); diff --git a/libraries/display_tbl_links.lib.php b/libraries/display_tbl_links.lib.php index f9a42ec2f..85264e309 100644 --- a/libraries/display_tbl_links.lib.php +++ b/libraries/display_tbl_links.lib.php @@ -17,9 +17,9 @@ if ($doWriteModifyAt == 'left') { if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { echo ' ' . "\n" - . ' ' . "\n" + . ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n" . ' ' . "\n"; } if (!empty($edit_url)) { @@ -47,9 +47,9 @@ if ($doWriteModifyAt == 'left') { } if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { echo ' ' . "\n" - . ' ' . "\n" + . ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n" . ' ' . "\n"; } }