Add support for regex matching on API vars
This commit is contained in:
parent
f1c36fdeb1
commit
6ceeeaa087
@ -109,11 +109,13 @@ function checkVars($vars, $or = false) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$checkmethod = "is_$val";
|
|
||||||
if ($checkmethod($VARS[$key]) !== true) {
|
if (strpos($val, "/") === 0) {
|
||||||
$ok[$key] = false;
|
// regex
|
||||||
|
$ok[$key] = preg_match($val, $VARS[$key]) === 1;
|
||||||
} else {
|
} else {
|
||||||
$ok[$key] = true;
|
$checkmethod = "is_$val";
|
||||||
|
$ok[$key] = !($checkmethod($VARS[$key]) !== true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($or) {
|
if ($or) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user