]> source.dussan.org Git - nextcloud-server.git/commitdiff
add public sharing for calendars and events
authorGeorg Ehrke <dev@georgswebsite.de>
Sat, 31 Mar 2012 16:32:43 +0000 (17:32 +0100)
committerGeorg Ehrke <dev@georgswebsite.de>
Sat, 31 Mar 2012 16:32:43 +0000 (17:32 +0100)
apps/calendar/share.php

index 8d1c8b69c3fce7bea45c73efd06983e3c419a92f..3e45fdeee152c833e6ffb23df818aa87e06968c4 100644 (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'];
+}
\ No newline at end of file