Update DBA::escape to match dbesc()
This commit is contained in:
parent
cfa68c52b9
commit
d3a598f589
1 changed files with 9 additions and 5 deletions
|
@ -251,11 +251,15 @@ class DBA
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function escape($str) {
|
public static function escape($str) {
|
||||||
switch (self::$driver) {
|
if (self::$connected) {
|
||||||
case 'pdo':
|
switch (self::$driver) {
|
||||||
return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1);
|
case 'pdo':
|
||||||
case 'mysqli':
|
return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1);
|
||||||
return @self::$connection->real_escape_string($str);
|
case 'mysqli':
|
||||||
|
return @self::$connection->real_escape_string($str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return str_replace("'", "\\'", $str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue