SQL injection defense

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10372 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-03-08 00:38:42 +00:00
parent 092d7988ba
commit 064fa452e5
3 changed files with 57 additions and 4 deletions

View file

@ -66,12 +66,14 @@
}
function escapeValue($value){
if($this->getType() == 'column_name'){
$column_type = $this->getType();
if($column_type == 'column_name'){
$dbParser = DB::getParser();
return $dbParser->parseExpression($value);
}
if(!isset($value)) return null;
if(in_array($this->getType(), array('date', 'varchar', 'char','text', 'bigtext'))){
}
if(!isset($value)) return null;
if(in_array($column_type, array('date', 'varchar', 'char','text', 'bigtext'))){
if(!is_array($value))
$value = $this->_escapeStringValue ($value);
else {
@ -81,6 +83,9 @@
//$value[$i] = '\''.$value[$i].'\'';
}
}
if($column_type == 'number')
$value = (int)$value;
return $value;
}