2011-09-02 06:55:56 -04:00
|
|
|
<?php
|
2011-09-23 16:59:24 -04:00
|
|
|
/**
|
2012-01-14 18:45:27 -05:00
|
|
|
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
2011-09-23 16:59:24 -04:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
|
* later.
|
|
|
|
|
* See the COPYING-README file.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-04-17 13:31:29 -04:00
|
|
|
|
2012-05-01 16:59:38 -04:00
|
|
|
OCP\User::checkLoggedIn();
|
2012-05-02 13:08:37 -04:00
|
|
|
OCP\App::checkAppEnabled('calendar');
|
2011-12-01 10:06:27 -05:00
|
|
|
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
|
|
|
|
|
$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
|
2012-03-31 23:16:42 -04:00
|
|
|
$nl = "\r\n";
|
2011-10-01 17:19:06 -04:00
|
|
|
if(isset($cal)){
|
2012-03-31 12:27:30 -04:00
|
|
|
$calendar = OC_Calendar_App::getCalendar($cal, true);
|
2012-05-14 09:52:24 -04:00
|
|
|
if(!$calendar){
|
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2011-10-01 17:19:06 -04:00
|
|
|
$calobjects = OC_Calendar_Object::all($cal);
|
2011-12-01 10:06:27 -05:00
|
|
|
header('Content-Type: text/Calendar');
|
|
|
|
|
header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics');
|
2011-12-18 17:01:45 -05:00
|
|
|
foreach($calobjects as $calobject){
|
2012-01-14 18:45:27 -05:00
|
|
|
echo $calobject['calendardata'] . $nl;
|
2011-10-01 17:19:06 -04:00
|
|
|
}
|
|
|
|
|
}elseif(isset($event)){
|
2012-03-31 12:27:30 -04:00
|
|
|
$data = OC_Calendar_App::getEventObject($_GET['eventid'], true);
|
2012-05-14 09:52:24 -04:00
|
|
|
if(!$data){
|
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2011-12-01 10:06:27 -05:00
|
|
|
$calendarid = $data['calendarid'];
|
2011-12-18 16:58:20 -05:00
|
|
|
$calendar = OC_Calendar_App::getCalendar($calendarid);
|
2011-12-01 10:06:27 -05:00
|
|
|
header('Content-Type: text/Calendar');
|
|
|
|
|
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
|
|
|
|
|
echo $data['calendardata'];
|
2011-09-02 06:55:56 -04:00
|
|
|
}
|
2011-09-15 04:14:47 -04:00
|
|
|
?>
|