1<?php 2 3/** 4 * DoukWiki DAVCal PlugIn - ICS support server 5 */ 6 7if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/../../../'); 8if (!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT', 1); 9require_once(DOKU_INC.'inc/init.php'); 10session_write_close(); //close session 11 12$path = explode('/', $_SERVER['REQUEST_URI']); 13$icsFile = end($path); 14 15// Load the helper plugin 16$hlp = plugin_load('helper', 'davcal'); 17 18// Retrieve calendar ID based on private URI 19$calid = $hlp->getCalendarForPrivateURL($icsFile); 20 21if($calid === false) 22 die("No calendar with this name known."); 23 24// Retrieve calendar contents and serve 25$stream = $hlp->getCalendarAsICSFeed($calid); 26header("Content-Type: text/calendar"); 27header("Content-Transfer-Encoding: Binary"); 28header("Content-disposition: attachment; filename=\"calendar.ics\""); 29echo $stream;