From 97789b8e1df7d81e4f5c05fc4b228d68766d4f86 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 21 May 2020 17:06:38 +0200 Subject: Preparing relaxing integer-like parameter format checks --- http/api-inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)); } -- cgit v1.2.3