From c781a551ae84127ef05eaa36909dca44e49e1200 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 19 Apr 2017 23:43:24 +0200 Subject: [locationinfo] Better backend-specific property handling, get rid of URL - The backend URL still had special treatment for legacy reasons, when it would be perfectly fine to make it just another generic property the backend has to define. - Allow for the backend to declare a default value for properties. - Base class will now check and sanitize the setCredentials() input. --- modules-available/locationinfo/api.inc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 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 a6e2fda3..412b20bf 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -238,7 +238,7 @@ function formatOpeningtime($openingtime) */ function getConfig($locationID) { - $dbresult = Database::queryFirst("SELECT l.locationname, li.config, li.serverroomid, s.servertype, s.serverurl FROM `location_info` AS li + $dbresult = Database::queryFirst("SELECT l.locationname, li.config, li.serverroomid, s.servertype FROM `location_info` AS li RIGHT JOIN `location` AS l ON l.locationid=li.locationid LEFT JOIN `setting_location_info` AS s ON s.serverid=li.serverid WHERE l.locationid=:locationID", array('locationID' => $locationID)); @@ -364,7 +364,7 @@ function getCalendar($idList) if (!empty($idList)) { // Build SQL query for multiple ids. $qs = '?' . str_repeat(',?', count($idList) - 1); - $query = "SELECT l.locationid, l.serverid, l.serverroomid, s.serverurl, s.servertype, s.credentials + $query = "SELECT l.locationid, l.serverid, l.serverroomid, s.servertype, s.credentials FROM `location_info` AS l INNER JOIN setting_location_info AS s ON (s.serverid = l.serverid) WHERE l.hidden = 0 AND l.locationid IN ($qs) @@ -376,7 +376,6 @@ function getCalendar($idList) if (!isset($serverList[$dbresult['serverid']])) { $serverList[$dbresult['serverid']] = array( 'credentials' => json_decode($dbresult['credentials'], true), - 'url' => $dbresult['serverurl'], 'type' => $dbresult['servertype'], 'idlist' => array() ); @@ -395,7 +394,7 @@ function getCalendar($idList) array('lid' => $server['locationid'])); continue; } - $credentialsOk = $serverInstance->setCredentials($server['credentials'], $server['url'], $serverid); + $credentialsOk = $serverInstance->setCredentials($serverid, $server['credentials']); if ($credentialsOk) { $calendarFromBackend = $serverInstance->fetchSchedule($server['idlist']); -- cgit v1.2.3-55-g7522