fixed some decoding bugs

This commit is contained in:
Loïc Chapeaux
2001-08-17 11:18:10 +00:00
parent 7c35a94f5d
commit ab073e93e6

View File

@@ -46,12 +46,12 @@ if (isset($submit_type)) {
*/ */
if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
// Restore the "primary key" to a convenient format // Restore the "primary key" to a convenient format
if (get_magic_quotes_gpc()) {
$primary_key = stripslashes($primary_key);
}
if ($is_encoded) { if ($is_encoded) {
$primary_key = urldecode($primary_key); $primary_key = urldecode($primary_key);
} }
else if (get_magic_quotes_gpc()) {
$primary_key = stripslashes($primary_key);
}
// Defines the SET part of the sql query // Defines the SET part of the sql query
$valuelist = ''; $valuelist = '';
@@ -71,11 +71,13 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
$f = 'field_' . $key; $f = 'field_' . $key;
} }
if (!empty($$f)) { if (!empty($$f)) {
$val = implode(',', $$f); $val = implode(',', $$f);
if ($val == 'null') { if ($val == 'null') {
// void // void
} else if ($is_encoded) { } else if ($is_encoded) {
$val = "'" . sql_addslashes(urldecode($val)) . "'"; $val = "'" . sql_addslashes(urldecode($val)) . "'";
} else if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else { } else {
$val = "'" . sql_addslashes($val) . "'"; $val = "'" . sql_addslashes($val) . "'";
} }
@@ -91,10 +93,13 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
$f = 'field_' . $key; $f = 'field_' . $key;
} }
if (!empty($$f)) { if (!empty($$f)) {
$val = implode(',', $$f);
if ($is_encoded) { if ($is_encoded) {
$val = "'" . sql_addslashes(urldecode(implode(',', $$f))) . "'"; $val = "'" . sql_addslashes(urldecode(',', $val)) . "'";
} else if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else { } else {
$val = "'" . sql_addslashes(implode(',', $$f)) . "'"; $val = "'" . sql_addslashes($val) . "'";
} }
} else { } else {
$val = "''"; $val = "''";
@@ -169,9 +174,11 @@ else {
$f = 'field_' . $key; $f = 'field_' . $key;
} }
if (!empty($$f)) { if (!empty($$f)) {
$val = implode(',', $$f); $val = implode(',', $$f);
if ($val == 'null') { if ($val == 'null') {
// void // void
} else if ($is_encoded) {
$val = "'" . sql_addslashes(urldecode($val)) . "'";
} else if (get_magic_quotes_gpc()) { } else if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'"; $val = "'" . str_replace('\\"', '"', $val) . "'";
} else { } else {
@@ -189,10 +196,13 @@ else {
$f = 'field_' . $key; $f = 'field_' . $key;
} }
if (!empty($$f)) { if (!empty($$f)) {
if (get_magic_quotes_gpc()) { $val = implode(',', $$f);
$val = "'" . str_replace('\\"', '"', implode(',', $$f)) . "'"; if ($is_encoded) {
$val = "'" . sql_addslashes(urldecode(',', $val)) . "'";
} else if (get_magic_quotes_gpc()) {
$val = "'" . str_replace('\\"', '"', $val) . "'";
} else { } else {
$val = "'" . sql_addslashes(implode(',', $$f)) . "'"; $val = "'" . sql_addslashes($val) . "'";
} }
} else { } else {
$val = "''"; $val = "''";