diff options
author | emkael <emkael@tlen.pl> | 2020-05-21 17:06:38 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2020-05-21 17:06:38 +0200 |
commit | 97789b8e1df7d81e4f5c05fc4b228d68766d4f86 (patch) | |
tree | 3843c29039ffa0228c01b6434fe28f19549020dd | |
parent | 0ab9a6db6aa9e2b700a60f45872252ba069f43f0 (diff) |
Preparing relaxing integer-like parameter format checks
-rw-r--r-- | http/api-inc.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/http/api-inc.php b/http/api-inc.php index 720926f..c75ed2e 100644 --- a/http/api-inc.php +++ b/http/api-inc.php @@ -61,6 +61,10 @@ class ApiPkl { $this->parameters = $this->parse_parameters($parameters); } + protected function is_integer($value) { + return ctype_digit($value) || is_int($value); + } + function ensure_parameters($params) { foreach ($params as $param) { if (!isset($this->parameters[$param])) { @@ -261,7 +265,7 @@ class ApiPklV3 extends ApiPklV2 { } if (isset($this->parameters['boards'])) { $this->check_values($this->parameters, array( - 'boards' => function($r) { return ctype_digit($r); } + 'boards' => function($r) { return $this->is_integer($r); } )); $this->parameters['over39_boards'] = strval(intval($this->parameters['boards'] > 39)); } |