summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-21 17:05:39 +0200
committeremkael <emkael@tlen.pl>2020-05-21 17:05:39 +0200
commit0ab9a6db6aa9e2b700a60f45872252ba069f43f0 (patch)
tree78d94af08a70737d00e85c5a10d0205abbd48bee
parente34beab42e1c64965e7567e9e37fc3390fe79710 (diff)
Ensuring that tournament_rank parameter is provided when checking for its value
-rw-r--r--http/api-inc.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/http/api-inc.php b/http/api-inc.php
index 2606df7..720926f 100644
--- a/http/api-inc.php
+++ b/http/api-inc.php
@@ -38,9 +38,9 @@ function run($parameters) {
$version = isset($parameters['version']) ? $parameters['version'] : '_default';
$apiClass = isset($versionClasses[$version]) ? $versionClasses[$version] : $versionClasses['_default'];
$api = new $apiClass($parameters);
- if ($parameters['tournament_rank'] == ApiPkl::RANK_KMP) {
+ if (isset($parameters['tournament_rank']) && $parameters['tournament_rank'] == ApiPkl::RANK_KMP) {
$result = $api->calculate_kmp_points();
- } else if ($parameters['tournament_rank'] == ApiPkl::RANK_BNET) {
+ } else if (isset($parameters['tournament_rank']) && $parameters['tournament_rank'] == ApiPkl::RANK_BNET) {
$result = $api->calculate_bridgenet_points();
} else {
$result = $api->calculate_points();
@@ -117,7 +117,7 @@ class ApiPkl {
if ($return['type'] == 3 || $return['type'] > 4) {
throw new ParametersException('Parameter: type has incorrect value (' . $return['type'] . ')');
}
- if ($return['type'] != 2 && $this->parameters['tournament_rank'] == ApiPkl::RANK_KMP) {
+ if ($return['type'] != 2 && isset($this->parameters['tournament_rank']) && $this->parameters['tournament_rank'] == ApiPkl::RANK_KMP) {
throw new ParametersException('Parameter: type has incorrect value (' . $return['type'] . ') for KMP tournament');
}
if (isset($this->parameters['boards'])) {