summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-14 01:35:33 +0200
committeremkael <emkael@tlen.pl>2020-05-14 01:35:33 +0200
commit316201fc806236d1ac1115f97caefcd514adc528 (patch)
treedda26f8795c541136de19181e8b7cf5c9a9d077e
parent1e0b0b0e93ad6efe1d9bfef2e52665f73b17df38 (diff)
Do not skip type/board number check for B***eNET even if manual overrides are provided
-rw-r--r--http/api-inc.php20
1 files changed, 10 insertions, 10 deletions
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();
}