removed the $is_encoded variable that is unnecessary and which use caused some bugs
This commit is contained in:
@@ -19,6 +19,8 @@ $Source$
|
||||
* lang/norwegian.inc.php3: fixed some typos and re-sorted a bit.
|
||||
* ldi_table.php3: removed some unnecessary lines of code.
|
||||
* sql.php3, lines 51-66: fixed bug #456254 - Crash select on a table.
|
||||
* tbl_replace.php3: removed the $is_encoded variable that is unnecessary
|
||||
and which use caused some bugs.
|
||||
|
||||
2001-08-29 Olivier M<>ller <om@omnis.ch>
|
||||
* left.php3: on login with std_auth, only the databases on which
|
||||
|
@@ -29,15 +29,8 @@ if ($goto == 'sql.php3') {
|
||||
reset($fields);
|
||||
reset($funcs);
|
||||
// Misc
|
||||
$is_encoded = FALSE;
|
||||
if (isset($submit_type)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$submit_type = stripslashes($submit_type);
|
||||
}
|
||||
// values have been urlencoded in tbl_change.php3
|
||||
if ($submit_type == $strSave || $submit_type == $strInsertAsNewRow) {
|
||||
$is_encoded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,43 +39,26 @@ if (isset($submit_type)) {
|
||||
*/
|
||||
if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||
// Restore the "primary key" to a convenient format
|
||||
if ($is_encoded) {
|
||||
$primary_key = urldecode($primary_key);
|
||||
}
|
||||
else if (get_magic_quotes_gpc()) {
|
||||
$primary_key = stripslashes($primary_key);
|
||||
}
|
||||
|
||||
// Defines the SET part of the sql query
|
||||
$valuelist = '';
|
||||
while (list($key, $val) = each($fields)) {
|
||||
if ($is_encoded) {
|
||||
$encoded_key = $key;
|
||||
$key = urldecode($key);
|
||||
} else {
|
||||
$encoded_key = urlencode($key);
|
||||
}
|
||||
|
||||
switch (strtolower($val)) {
|
||||
case 'null':
|
||||
break;
|
||||
case '$enum$':
|
||||
// if we have an enum, then construct the value
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
$f = 'field_' . $key;
|
||||
}
|
||||
if (!empty($$f)) {
|
||||
$val = implode(',', $$f);
|
||||
if ($val == 'null') {
|
||||
// void
|
||||
} else if ($is_encoded) {
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
} else if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . str_replace('\\"', '"', $val) . "'";
|
||||
} else {
|
||||
$val = "'" . sql_addslashes($val) . "'";
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
}
|
||||
} else {
|
||||
$val = "''";
|
||||
@@ -90,20 +66,10 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||
break;
|
||||
case '$set$':
|
||||
// if we have a set, then construct the value
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
$f = 'field_' . $key;
|
||||
}
|
||||
if (!empty($$f)) {
|
||||
$val = implode(',', $$f);
|
||||
if ($is_encoded) {
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
} else if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . str_replace('\\"', '"', $val) . "'";
|
||||
} else {
|
||||
$val = "'" . sql_addslashes($val) . "'";
|
||||
}
|
||||
} else {
|
||||
$val = "''";
|
||||
}
|
||||
@@ -162,16 +128,8 @@ else {
|
||||
$fieldlist = '';
|
||||
$valuelist = '';
|
||||
while (list($key, $val) = each($fields)) {
|
||||
if ($is_encoded) {
|
||||
$encoded_key = $key;
|
||||
$key = urldecode($key);
|
||||
} else {
|
||||
$encoded_key = urlencode($key);
|
||||
// the 'query' row is urlencoded in sql.php3
|
||||
if ($key == 'query') {
|
||||
$val = urldecode($val);
|
||||
}
|
||||
}
|
||||
$fieldlist .= backquote($key) . ', ';
|
||||
|
||||
switch (strtolower($val)) {
|
||||
@@ -179,21 +137,13 @@ else {
|
||||
break;
|
||||
case '$enum$':
|
||||
// if we have a set, then construct the value
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
$f = 'field_' . $key;
|
||||
}
|
||||
if (!empty($$f)) {
|
||||
$val = implode(',', $$f);
|
||||
if ($val == 'null') {
|
||||
// void
|
||||
} else if ($is_encoded) {
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
} else if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . str_replace('\\"', '"', $val) . "'";
|
||||
} else {
|
||||
$val = "'" . sql_addslashes($val) . "'";
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
}
|
||||
} else {
|
||||
$val = "''";
|
||||
@@ -201,20 +151,10 @@ else {
|
||||
break;
|
||||
case '$set$':
|
||||
// if we have a set, then construct the value
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
$f = 'field_' . $key;
|
||||
}
|
||||
if (!empty($$f)) {
|
||||
$val = implode(',', $$f);
|
||||
if ($is_encoded) {
|
||||
$val = "'" . sql_addslashes(urldecode($val)) . "'";
|
||||
} else if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . str_replace('\\"', '"', $val) . "'";
|
||||
} else {
|
||||
$val = "'" . sql_addslashes($val) . "'";
|
||||
}
|
||||
} else {
|
||||
$val = "''";
|
||||
}
|
||||
|
Reference in New Issue
Block a user