Skip to content

Commit

Permalink
Added get_magic_quotes_gpc on db connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
wakdev committed May 13, 2013
1 parent 986f4fb commit c556291
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion core/common/class/db/mysql/connector.php
Expand Up @@ -228,7 +228,11 @@ public function quote($value,$real_escape=false){
* @return string the escaped string
*/
public function escape($value,$real_escape=false){
return $real_escape?mysql_real_escape_string($value,getHandle()):mysql_escape_string($value);
if (!get_magic_quotes_gpc()) {
return $real_escape?mysql_real_escape_string($value,getHandle()):mysql_escape_string($value);
}else{
return $value;
}
}

/**
Expand Down
6 changes: 5 additions & 1 deletion core/common/class/db/mysqli/connector.php
Expand Up @@ -219,7 +219,11 @@ public function quote($value,$real_escape=false){
* @return string the escaped string
*/
public function escape($value,$real_escape=false){
return $this->mysqli->real_escape_string($value);
if (!get_magic_quotes_gpc()) {
return $this->mysqli->real_escape_string($value);
}else{
return $value;
}
}

/**
Expand Down
6 changes: 5 additions & 1 deletion core/common/class/db/pdo/connector.php
Expand Up @@ -220,7 +220,11 @@ public function quote($value,$real_escape=false){
public function escape($value,$real_escape=false){
//quote the value with PDO::quote() function then
//remove enclosing quotes to conform "escape" protocol
return substr($this->_db_handle->quote($value),1,-1);
if (!get_magic_quotes_gpc()) {
return substr($this->_db_handle->quote($value),1,-1);
}else{
return $value;
}
}

/**
Expand Down

0 comments on commit c556291

Please sign in to comment.