change to use foreach($a as $k => $v) { ... }

pull/154/head
David Goodwin 7 years ago
parent 8ac94394cb
commit 45a1073b97

@ -309,12 +309,12 @@ function escape_string($string) {
// Note, the array keys are not cleaned. // Note, the array keys are not cleaned.
if (is_array($string)) { if (is_array($string)) {
$clean = array(); $clean = array();
foreach (array_keys($string) as $row) { foreach($string as $k => $v) {
$clean[$row] = escape_string($string[$row]); $clean[$k] = escape_string($v);
} }
return $clean; return $clean;
} }
if (get_magic_quotes_gpc()) { if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$string = stripslashes($string); $string = stripslashes($string);
} }
if (!is_numeric($string)) { if (!is_numeric($string)) {
@ -1732,8 +1732,8 @@ function db_update($table, $where_col, $where_value, $values, $timestamp = array
function db_update_q($table, $where, $values, $timestamp = array('modified')) { function db_update_q($table, $where, $values, $timestamp = array('modified')) {
$table = table_by_key($table); $table = table_by_key($table);
foreach (array_keys($values) as $key) { foreach ($values as $key => $value) {
$sql_values[$key] = escape_string($key) . "='" . escape_string($values[$key]) . "'"; $sql_values[$key] = $key . "='" . escape_string($values) . "'";
} }
foreach ($timestamp as $key) { foreach ($timestamp as $key) {

Loading…
Cancel
Save