diff options
Diffstat (limited to 'modules-available/locationinfo/inc/icalcoursebackend.inc.php')
-rw-r--r-- | modules-available/locationinfo/inc/icalcoursebackend.inc.php | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/modules-available/locationinfo/inc/icalcoursebackend.inc.php b/modules-available/locationinfo/inc/icalcoursebackend.inc.php index 44691bb4..838d18b7 100644 --- a/modules-available/locationinfo/inc/icalcoursebackend.inc.php +++ b/modules-available/locationinfo/inc/icalcoursebackend.inc.php @@ -18,16 +18,6 @@ abstract class ICalCourseBackend extends CourseBackend /** @var bool|resource */ private $curlHandle = false; - /** - * Initialize values - * - * @param string $location - * @param bool $verifyCert - * @param bool $verifyHostname - * @param string $authMethod - * @param string $user - * @param string $pass - */ protected function init( string $location, bool $verifyCert, bool $verifyHostname, string $authMethod = 'NONE', string $user = '', string $pass = '') @@ -52,11 +42,18 @@ abstract class ICalCourseBackend extends CourseBackend { if (!$this->isOK()) return null; + + try { + $ical = new ICalParser(['filterDaysBefore' => 7, 'filterDaysAfter' => 7]); + } catch (Exception $e) { + $this->addError('Error instantiating ICalParser: ' . $e->getMessage(), true); + return null; + } + if ($this->curlHandle === false) { $this->curlHandle = curl_init(); } - $ical = new ICalParser(['filterDaysBefore' => 7, 'filterDaysAfter' => 7]); $options = [ CURLOPT_WRITEFUNCTION => function ($ch, $data) use ($ical) { $ical->feedData($data); @@ -119,8 +116,6 @@ abstract class ICalCourseBackend extends CourseBackend /** * Get a usable title from either SUMMARY or DESCRIPTION - * - * @param ICalEvent $event */ protected function toTitle(ICalEvent $event): string { |