mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Filters/Misc
* be a bit more lenient on level inputs * fix displaying array of requirements on error
This commit is contained in:
@@ -452,20 +452,18 @@ abstract class Filter
|
||||
if (!Util::checkNumeric($val, NUM_CAST_INT))
|
||||
return false;
|
||||
|
||||
foreach ($valid as $k => $v)
|
||||
if (in_array($val, $valid))
|
||||
return true;
|
||||
|
||||
foreach ($valid as $v)
|
||||
{
|
||||
if (gettype($v) != 'array')
|
||||
continue;
|
||||
|
||||
if ($this->checkInput(self::V_RANGE, $v, $val, true))
|
||||
return true;
|
||||
|
||||
unset($valid[$k]);
|
||||
}
|
||||
|
||||
if (in_array($val, $valid))
|
||||
return true;
|
||||
|
||||
break;
|
||||
case self::V_RANGE:
|
||||
if (Util::checkNumeric($val, NUM_CAST_INT) && $val >= $valid[0] && $val <= $valid[1])
|
||||
@@ -486,7 +484,7 @@ abstract class Filter
|
||||
|
||||
if (!$recursive)
|
||||
{
|
||||
trigger_error('Filter::checkInput - check failed [type: '.$type.' valid: '.((string)$valid).' val: '.((string)$val).']', E_USER_NOTICE);
|
||||
trigger_error('Filter::checkInput - check failed [type: '.$type.' valid: '.Util::toString($valid).' val: '.((string)$val).']', E_USER_NOTICE);
|
||||
$this->error = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user