web_interface/astpp/system/database/drivers/mssql/mssql_driver.php 1 location
|
@@ 254-280 (lines=27) @@
|
| 251 |
|
* @param bool whether or not the string will be used in a LIKE condition |
| 252 |
|
* @return string |
| 253 |
|
*/ |
| 254 |
|
function escape_str($str, $like = FALSE) |
| 255 |
|
{ |
| 256 |
|
if (is_array($str)) |
| 257 |
|
{ |
| 258 |
|
foreach ($str as $key => $val) |
| 259 |
|
{ |
| 260 |
|
$str[$key] = $this->escape_str($val, $like); |
| 261 |
|
} |
| 262 |
|
|
| 263 |
|
return $str; |
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
// Escape single quotes |
| 267 |
|
$str = str_replace("'", "''", remove_invisible_characters($str)); |
| 268 |
|
|
| 269 |
|
// escape LIKE condition wildcards |
| 270 |
|
if ($like === TRUE) |
| 271 |
|
{ |
| 272 |
|
$str = str_replace( |
| 273 |
|
array($this->_like_escape_chr, '%', '_'), |
| 274 |
|
array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), |
| 275 |
|
$str |
| 276 |
|
); |
| 277 |
|
} |
| 278 |
|
|
| 279 |
|
return $str; |
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
// -------------------------------------------------------------------- |
| 283 |
|
|
web_interface/astpp/system/database/drivers/oci8/oci8_driver.php 1 location
|
@@ 396-419 (lines=24) @@
|
| 393 |
|
* @param bool whether or not the string will be used in a LIKE condition |
| 394 |
|
* @return string |
| 395 |
|
*/ |
| 396 |
|
public function escape_str($str, $like = FALSE) |
| 397 |
|
{ |
| 398 |
|
if (is_array($str)) |
| 399 |
|
{ |
| 400 |
|
foreach ($str as $key => $val) |
| 401 |
|
{ |
| 402 |
|
$str[$key] = $this->escape_str($val, $like); |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
return $str; |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
$str = remove_invisible_characters($str); |
| 409 |
|
|
| 410 |
|
// escape LIKE condition wildcards |
| 411 |
|
if ($like === TRUE) |
| 412 |
|
{ |
| 413 |
|
$str = str_replace(array('%', '_', $this->_like_escape_chr), |
| 414 |
|
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
| 415 |
|
$str); |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
return $str; |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
// -------------------------------------------------------------------- |
| 422 |
|
|
web_interface/astpp/system/database/drivers/odbc/odbc_driver.php 1 location
|
@@ 265-289 (lines=25) @@
|
| 262 |
|
* @param bool whether or not the string will be used in a LIKE condition |
| 263 |
|
* @return string |
| 264 |
|
*/ |
| 265 |
|
function escape_str($str, $like = FALSE) |
| 266 |
|
{ |
| 267 |
|
if (is_array($str)) |
| 268 |
|
{ |
| 269 |
|
foreach ($str as $key => $val) |
| 270 |
|
{ |
| 271 |
|
$str[$key] = $this->escape_str($val, $like); |
| 272 |
|
} |
| 273 |
|
|
| 274 |
|
return $str; |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
// ODBC doesn't require escaping |
| 278 |
|
$str = remove_invisible_characters($str); |
| 279 |
|
|
| 280 |
|
// escape LIKE condition wildcards |
| 281 |
|
if ($like === TRUE) |
| 282 |
|
{ |
| 283 |
|
$str = str_replace(array('%', '_', $this->_like_escape_chr), |
| 284 |
|
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
| 285 |
|
$str); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
return $str; |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
// -------------------------------------------------------------------- |
| 292 |
|
|
web_interface/astpp/system/database/drivers/postgre/postgre_driver.php 1 location
|
@@ 284-307 (lines=24) @@
|
| 281 |
|
* @param bool whether or not the string will be used in a LIKE condition |
| 282 |
|
* @return string |
| 283 |
|
*/ |
| 284 |
|
function escape_str($str, $like = FALSE) |
| 285 |
|
{ |
| 286 |
|
if (is_array($str)) |
| 287 |
|
{ |
| 288 |
|
foreach ($str as $key => $val) |
| 289 |
|
{ |
| 290 |
|
$str[$key] = $this->escape_str($val, $like); |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
return $str; |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
$str = pg_escape_string($str); |
| 297 |
|
|
| 298 |
|
// escape LIKE condition wildcards |
| 299 |
|
if ($like === TRUE) |
| 300 |
|
{ |
| 301 |
|
$str = str_replace(array('%', '_', $this->_like_escape_chr), |
| 302 |
|
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
| 303 |
|
$str); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
return $str; |
| 307 |
|
} |
| 308 |
|
|
| 309 |
|
// -------------------------------------------------------------------- |
| 310 |
|
|
web_interface/astpp/system/database/drivers/sqlite/sqlite_driver.php 1 location
|
@@ 281-304 (lines=24) @@
|
| 278 |
|
* @param bool whether or not the string will be used in a LIKE condition |
| 279 |
|
* @return string |
| 280 |
|
*/ |
| 281 |
|
function escape_str($str, $like = FALSE) |
| 282 |
|
{ |
| 283 |
|
if (is_array($str)) |
| 284 |
|
{ |
| 285 |
|
foreach ($str as $key => $val) |
| 286 |
|
{ |
| 287 |
|
$str[$key] = $this->escape_str($val, $like); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
return $str; |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
$str = sqlite_escape_string($str); |
| 294 |
|
|
| 295 |
|
// escape LIKE condition wildcards |
| 296 |
|
if ($like === TRUE) |
| 297 |
|
{ |
| 298 |
|
$str = str_replace(array('%', '_', $this->_like_escape_chr), |
| 299 |
|
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), |
| 300 |
|
$str); |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
return $str; |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
// -------------------------------------------------------------------- |
| 307 |
|
|