From 5d4fbea2d5bfd77db4dde59b52318d8faad992b5 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Thu, 9 Mar 2017 22:52:46 +0100 Subject: API: Fixed some php warnings. --- modules-available/locationinfo/api.inc.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'modules-available/locationinfo/api.inc.php') 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) { // ########## ########## -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(); } } -- cgit v1.2.3-55-g7522