diff options
author | Jannik Schönartz | 2017-03-09 22:52:46 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-03-09 22:52:46 +0100 |
commit | 5d4fbea2d5bfd77db4dde59b52318d8faad992b5 (patch) | |
tree | e6cd7e88fea7c253f22525a851997d72a8864c8d /modules-available/locationinfo/api.inc.php | |
parent | API: Send an empty array if the overlay is null (diff) | |
download | slx-admin-5d4fbea2d5bfd77db4dde59b52318d8faad992b5.tar.gz slx-admin-5d4fbea2d5bfd77db4dde59b52318d8faad992b5.tar.xz slx-admin-5d4fbea2d5bfd77db4dde59b52318d8faad992b5.zip |
API: Fixed some php warnings.
Diffstat (limited to 'modules-available/locationinfo/api.inc.php')
-rw-r--r-- | modules-available/locationinfo/api.inc.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index 3a6618d8..62943ca7 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -70,7 +70,7 @@ function getCalendar($idList) { $calendarFromBackend = $serverInstance->fetchSchedule($server['idlist']); $formattedArray = array(); - + $resultarray = array(); if ($calendarFromBackend === false || $setCred === false) { $error['timestamp'] = time(); $error['error'] = $serverInstance->getError(); @@ -78,14 +78,14 @@ function getCalendar($idList) { } else { Database::exec("UPDATE `setting_location_info` Set error=NULL WHERE serverid=:id", array('id' => $serverid)); } - - foreach ($calendarFromBackend as $key => $value) { - $y['id'] = $key; - $y['calendar'] = $value; - $formattedArray[] = $y; + if (is_array($calendarFromBackend)) { + foreach ($calendarFromBackend as $key => $value) { + $y['id'] = $key; + $y['calendar'] = $value; + $formattedArray[] = $y; + } + $resultarray = array_merge($resultarray, $formattedArray); } - $resultarray = array_merge($resultarray, $formattedArray); - } return json_encode($resultarray, true); } @@ -293,7 +293,7 @@ function checkIfHidden($locationID) { // ########## <Roominfo> ########## -function getRoomInfo($idList, $coords) { +function getRoomInfo($idList, $coords = false) { $coordinates = (string)$coords; // Build SQL Query for multiple ids. @@ -326,8 +326,11 @@ function getRoomInfo($idList, $coords) { $position = json_decode($dbdata['position'], true); $pc['x'] = $position['gridCol']; $pc['y'] = $position['gridRow']; - $pc['overlay'] = $position['overlays']; - if ($pc['overlay'] == null) { + + if (isset($position['overlays'])) { + $pc['overlay'] = $position['overlays']; + } + else { $pc['overlay'] = array(); } } |