Skip to content

Commit

Permalink
Maps: 39144, check for input (#6783)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex40724 committed Dec 13, 2023
1 parent e764621 commit a9b1ef0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Services/Form/classes/class.ilLocationInputGUI.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* This class represents a location property in a property form.
*
Expand Down Expand Up @@ -101,8 +101,10 @@ public function checkInput(): bool
$lng = $this->lng;

$val = $this->strArray($this->getPostVar());
if ($this->getRequired() &&
(trim($val["latitude"]) == "" || trim($val["longitude"]) == "")) {
if ($this->getRequired() && (
!isset($val["latitude"]) || trim($val["latitude"]) == "" ||
!isset($val["longitude"]) || trim($val["longitude"]) == ""
)) {
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
Expand All @@ -113,8 +115,8 @@ public function getInput(): array
{
$val = $this->strArray($this->getPostVar());
return [
"latitude" => (float) $val["latitude"],
"longitude" => (float) $val["longitude"],
"latitude" => (float) ($val["latitude"] ?? 0),
"longitude" => (float) ($val["longitude"] ?? 0),
"zoom" => (int) ($val["zoom"] ?? 0),
"address" => ($val["address"] ?? "")
];
Expand Down

0 comments on commit a9b1ef0

Please sign in to comment.