From ae0880886d0cc67bac01952d6f0f9dbc516a56e8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 18 Apr 2017 13:03:38 +0200 Subject: [locationinfo] Davinci: Fix requested timespan, use single quotes for regex with backslashes to prevent evaluation by php --- .../locationinfo/inc/coursebackend/coursebackend_davinci.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules-available/locationinfo/inc') diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php index 2d53e762..11882a1e 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php @@ -56,7 +56,7 @@ class Coursebackend_Davinci extends CourseBackend private function toArray($response) { try { - $cleanresponse = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $response); + $cleanresponse = preg_replace('/(<\/?)(\w+):([^>]*>)/', "$1$2$3", $response); $xml = new SimpleXMLElement($cleanresponse); $array = json_decode(json_encode((array)$xml), true); } catch (Exception $exception) { @@ -73,8 +73,8 @@ class Coursebackend_Davinci extends CourseBackend */ private function fetchArray($roomId) { - $startDate = new DateTime('monday this week'); - $endDate = new DateTime('sunday'); + $startDate = new DateTime('today 0:00'); + $endDate = new DateTime('+7 days 0:00'); $url = $this->location . "content=xml&type=room&name=" . $roomId . "&startdate=" . $startDate->format('d.m.Y') . "&enddate=" . $endDate->format('d.m.Y'); $ch = curl_init(); $options = array( @@ -97,6 +97,7 @@ class Coursebackend_Davinci extends CourseBackend ///Operation completed successfully } curl_close($ch); + error_log($output); return $this->toArray($output); } -- cgit v1.2.3-55-g7522