mirror of
https://github.com/jimeh/zynapse.git
synced 2026-02-18 23:06:38 +00:00
fixed the sql-inject issue properly :P
This commit is contained in:
6
vendor/zynapse/active_record.php
vendored
6
vendor/zynapse/active_record.php
vendored
@@ -613,13 +613,11 @@ class ActiveRecord {
|
||||
$cond = array();
|
||||
foreach( $conditions as $key => $value ) {
|
||||
if ( !preg_match('/^[0-9]+$/', $key) && !is_array($value) ) {
|
||||
$cond[] = '`'.$key."` = '".$value."'";
|
||||
$cond[] = '`'.$key."` = ".$this->sql_quote($value);
|
||||
} elseif ( !is_array($value) && preg_match('/^[0-9]+$/', $value) ) {
|
||||
$cond[] = '`'.$this->_primary_key."` = '".$value."'";
|
||||
} elseif(is_array($value)) {
|
||||
$cond[] = '`'.$key."` IN (".implode(",",$this->sql_quote($value)).")";
|
||||
} else {
|
||||
$cond[] = $this->sql_quote($value);
|
||||
}
|
||||
}
|
||||
$operator = ( !empty($options['operator']) ) ? $options['operator'] : 'AND' ;
|
||||
@@ -871,7 +869,7 @@ class ActiveRecord {
|
||||
if ( ($field == 'integer' || $field == 'decimal') && preg_match('/^[0-9\-\.]+$/', $input) ) {
|
||||
return $input;
|
||||
} else {
|
||||
return "'".addslashes(urldecode($input))."'";
|
||||
return "'".addslashes($input)."'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user