Examine integers separately. Also, don't break search. >_<
This commit is contained in:
parent
caec1ac824
commit
1615f79be4
@ -34,6 +34,14 @@ function int_escape($input) {
|
|||||||
* @retval string
|
* @retval string
|
||||||
*/
|
*/
|
||||||
function url_escape($input) {
|
function url_escape($input) {
|
||||||
|
/*
|
||||||
|
Shish: I have a feeling that these three lines are important, possibly for searching for tags with slashes in them like fate/stay_night
|
||||||
|
green-ponies: indeed~
|
||||||
|
*/
|
||||||
|
$input = str_replace('^', '^^', $input);
|
||||||
|
$input = str_replace('/', '^s', $input);
|
||||||
|
$input = str_replace('\\', '^b', $input);
|
||||||
|
|
||||||
/* The function idn_to_ascii is used to support Unicode domains / URLs as well.
|
/* The function idn_to_ascii is used to support Unicode domains / URLs as well.
|
||||||
See here for more: http://php.net/manual/en/function.filter-var.php
|
See here for more: http://php.net/manual/en/function.filter-var.php
|
||||||
However, it is only supported by PHP version 5.3 and up
|
However, it is only supported by PHP version 5.3 and up
|
||||||
@ -79,20 +87,21 @@ function bool_escape($input) {
|
|||||||
*/
|
*/
|
||||||
if (is_bool($input)) {
|
if (is_bool($input)) {
|
||||||
return $input;
|
return $input;
|
||||||
|
} else if (is_numeric($input)) {
|
||||||
|
return ($input === 1);
|
||||||
} else {
|
} else {
|
||||||
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||||
if (!is_null($value)) {
|
if (!is_null($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
} else {
|
} else {
|
||||||
$input = strtolower($input);
|
$input = strtolower( trim($input) );
|
||||||
return (
|
return (
|
||||||
$input === "y" ||
|
$input === "y" ||
|
||||||
$input === "yes" ||
|
$input === "yes" ||
|
||||||
$input === "t" ||
|
$input === "t" ||
|
||||||
$input === "true" ||
|
$input === "true" ||
|
||||||
$input === "on" ||
|
$input === "on" ||
|
||||||
$input === 1 ||
|
$input === "1" ||
|
||||||
$input === true
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user