From 316201fc806236d1ac1115f97caefcd514adc528 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 14 May 2020 01:35:33 +0200 Subject: Do not skip type/board number check for B***eNET even if manual overrides are provided --- http/api-inc.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'http/api-inc.php') diff --git a/http/api-inc.php b/http/api-inc.php index 1364195..7780e64 100644 --- a/http/api-inc.php +++ b/http/api-inc.php @@ -250,18 +250,18 @@ class ApiPklV2 extends ApiPklV1 { class ApiPklV3 extends ApiPklV2 { function check_parameters() { - if (!isset($this->parameters['manual']) || !isset($this->parameters['manual']['min_points']) || !isset($this->parameters['manual']['tournament_weight'])) { - $this->ensure_parameters(array('tournament_rank')); - if ($this->parameters['tournament_rank'] == ApiPkl::RANK_BNET) { - $this->ensure_parameters(array('boards')); - } - if (isset($this->parameters['boards'])) { - $this->check_values($this->parameters, array( - 'boards' => function($r) { return ctype_digit($r); } - )); - $this->parameters['over39_boards'] = strval(intval($this->parameters['boards'] > 39)); + if (isset($this->parameters['tournament_rank']) && $this->parameters['tournament_rank'] == ApiPkl::RANK_BNET) { + $this->ensure_parameters(array('boards', 'type')); + if ($this->parameters['type'] == 4) { + throw new ParametersException('Parameter: type has incorrect value (' . $this->parameters['type'] . ') for BridgeNET tournament'); } } + if (isset($this->parameters['boards'])) { + $this->check_values($this->parameters, array( + 'boards' => function($r) { return ctype_digit($r); } + )); + $this->parameters['over39_boards'] = strval(intval($this->parameters['boards'] > 39)); + } return parent::check_parameters(); } -- cgit v1.2.3