xref: /plugin/davcal/ics.php (revision f69bb4491e1a8930c2218737f8703c41c7507247)
1<?php
2
3if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/../../../');
4if (!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT', 1);
5require_once(DOKU_INC.'inc/init.php');
6session_write_close(); //close session
7
8$path = explode('/', $_SERVER['REQUEST_URI']);
9$icsFile = end($path);
10
11$hlp = plugin_load('helper', 'davcal');
12
13$calid = $hlp->getCalendarForPrivateURL($icsFile);
14
15if($calid === false)
16    die("No calendar with this name known.");
17
18$stream = $hlp->getCalendarAsICSFeed($calid);
19header("Content-Type: text/calendar");
20header("Content-Transfer-Encoding: Binary");
21header("Content-disposition: attachment; filename=\"calendar.ics\"");
22echo $stream;