summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-21 17:06:38 +0200
committeremkael <emkael@tlen.pl>2020-05-21 17:06:38 +0200
commit97789b8e1df7d81e4f5c05fc4b228d68766d4f86 (patch)
tree3843c29039ffa0228c01b6434fe28f19549020dd
parent0ab9a6db6aa9e2b700a60f45872252ba069f43f0 (diff)
Preparing relaxing integer-like parameter format checks
-rw-r--r--http/api-inc.php6
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));
}