getConfig('disable_ics') === 1) { if($conf['allowdebug']) \dokuwiki\Logger::debug('DAVCAL', 'ICS synchronisation is disabled', __FILE__, __LINE__); die("ICS synchronisation is disabled"); } // Check if this is an aggregated calendar URL if(strpos($icsFile, 'dokuwiki-aggregated-') === 0) { // This is an aggregated calendar - handle it specially $stream = $hlp->getAggregatedCalendarAsICSFeed($icsFile); if($stream === false) { if($conf['allowdebug']) \dokuwiki\Logger::error('DAVCAL', 'No aggregated calendar with this name known: '.$icsFile, __FILE__, __LINE__); die("No aggregated calendar with this name known."); } } else { // Regular single calendar // Retrieve calendar ID based on private URI $calid = $hlp->getCalendarForPrivateURL($icsFile); if($calid === false) { if($conf['allowdebug']) \dokuwiki\Logger::error('DAVCAL', 'No calendar with this name known: '.$icsFile, __FILE__, __LINE__); die("No calendar with this name known."); } // Retrieve calendar contents and serve $stream = $hlp->getCalendarAsICSFeed($calid); } header("Content-Type: text/calendar"); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"calendar.ics\""); echo $stream;