add public sharing for calendars and events

master
Georg Ehrke 2012-03-31 17:32:43 +01:00
parent 710d80d77c
commit 1747b992e0
1 changed files with 21 additions and 1 deletions

View File

@ -1 +1,21 @@
<?php
require_once('../../lib/base.php');
$token = strip_tags($_GET['t']);
$shared = OC_Calendar_Share::getElementByToken($token);
$nl = "\n\r";
if($shared['type'] == OC_Calendar_Share::CALENDAR){
$calendar = OC_Calendar_App::getCalendar($cal, false);
$calobjects = OC_Calendar_Object::all($cal);
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics');
foreach($calobjects as $calobject){
echo $calobject['calendardata'] . $nl;
}
}elseif($shared['type'] == OC_Calendar_Share::EVENT){
$data = OC_Calendar_App::getEventObject($shared['id'], false);
$calendarid = $data['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid);
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
echo $data['calendardata'];
}