fixed bugs in function field name with special characters and no-parameter functions
This commit is contained in:
@@ -140,7 +140,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<select name="funcs[<?php echo $field; ?>]">
|
<select name="funcs[<?php echo urlencode($field); ?>]">
|
||||||
<option></option>
|
<option></option>
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
@@ -57,7 +57,10 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
|||||||
$valuelist = '';
|
$valuelist = '';
|
||||||
while (list($key, $val) = each($fields)) {
|
while (list($key, $val) = each($fields)) {
|
||||||
if ($is_encoded) {
|
if ($is_encoded) {
|
||||||
|
$encoded_key = $key;
|
||||||
$key = urldecode($key);
|
$key = urldecode($key);
|
||||||
|
} else {
|
||||||
|
$encoded_key = urlencode($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (strtolower($val)) {
|
switch (strtolower($val)) {
|
||||||
@@ -114,16 +117,20 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
// No change for this column -> next column
|
// No change for this column and no MySQL function is used -> next column
|
||||||
if (isset($fields_prev) && isset($fields_prev[urlencode($key)]) && empty($funcs[$key])
|
if (empty($funcs[$encoded_key])
|
||||||
&& ("'" . sql_addslashes(urldecode($fields_prev[urlencode($key)])) . "'" == $val)) {
|
&& isset($fields_prev) && isset($fields_prev[$encoded_key])
|
||||||
|
&& ("'" . sql_addslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!empty($val)) {
|
else if (!empty($val)) {
|
||||||
if (empty($funcs[$key])) {
|
if (empty($funcs[$encoded_key])) {
|
||||||
$valuelist .= backquote($key) . ' = ' . $val . ', ';
|
$valuelist .= backquote($key) . ' = ' . $val . ', ';
|
||||||
|
} else if ($val == '\'\''
|
||||||
|
&& (ereg('^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$', $funcs[$encoded_key]))) {
|
||||||
|
$valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . '(), ';
|
||||||
} else {
|
} else {
|
||||||
$valuelist .= backquote($key) . " = $funcs[$key]($val), ";
|
$valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
@@ -155,12 +162,15 @@ else {
|
|||||||
$valuelist = '';
|
$valuelist = '';
|
||||||
while (list($key, $val) = each($fields)) {
|
while (list($key, $val) = each($fields)) {
|
||||||
if ($is_encoded) {
|
if ($is_encoded) {
|
||||||
|
$encoded_key = $key;
|
||||||
$key = urldecode($key);
|
$key = urldecode($key);
|
||||||
}
|
} else {
|
||||||
|
$encoded_key = urlencode($key);
|
||||||
// the 'query' row is urlencoded in sql.php3
|
// the 'query' row is urlencoded in sql.php3
|
||||||
else if ($key == 'query') {
|
if ($key == 'query') {
|
||||||
$val = urldecode($val);
|
$val = urldecode($val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$fieldlist .= backquote($key) . ', ';
|
$fieldlist .= backquote($key) . ', ';
|
||||||
|
|
||||||
switch (strtolower($val)) {
|
switch (strtolower($val)) {
|
||||||
@@ -217,10 +227,13 @@ else {
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
if (empty($funcs[$key])) {
|
if (empty($funcs[$encoded_key])) {
|
||||||
$valuelist .= $val . ', ';
|
$valuelist .= $val . ', ';
|
||||||
|
} else if ($val == '\'\''
|
||||||
|
&& (ereg('^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$', $funcs[$encoded_key]))) {
|
||||||
|
$valuelist .= $funcs[$encoded_key] . '(), ';
|
||||||
} else {
|
} else {
|
||||||
$valuelist .= "$funcs[$key]($val), ";
|
$valuelist .= $funcs[$encoded_key] . "($val), ";
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user