2011-09-02 10:55:56 +00:00
|
|
|
<?php
|
2011-09-23 20:59:24 +00:00
|
|
|
/**
|
2012-01-14 23:45:27 +00:00
|
|
|
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
2011-09-23 20:59:24 +00:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
2012-05-01 20:59:38 +00:00
|
|
|
OCP\User::checkLoggedIn();
|
2012-05-02 17:08:37 +00:00
|
|
|
OCP\App::checkAppEnabled('calendar');
|
2012-10-12 22:16:39 +00:00
|
|
|
$cal = isset($_GET['calid']) ? $_GET['calid'] : null;
|
|
|
|
$event = isset($_GET['eventid']) ? $_GET['eventid'] : null;
|
2013-01-31 16:52:50 +00:00
|
|
|
if(!is_null($cal)) {
|
2012-03-31 16:27:30 +00:00
|
|
|
$calendar = OC_Calendar_App::getCalendar($cal, true);
|
2012-09-07 13:21:03 +00:00
|
|
|
if(!$calendar) {
|
2013-01-31 16:52:50 +00:00
|
|
|
header('HTTP/1.0 403 Forbidden');
|
2012-05-14 13:52:24 +00:00
|
|
|
exit;
|
|
|
|
}
|
2012-10-06 17:46:04 +00:00
|
|
|
header('Content-Type: text/calendar');
|
2012-09-07 12:32:45 +00:00
|
|
|
header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $calendar['displayname']) . '.ics');
|
2012-06-03 12:54:53 +00:00
|
|
|
echo OC_Calendar_Export::export($cal, OC_Calendar_Export::CALENDAR);
|
2013-01-31 16:52:50 +00:00
|
|
|
}elseif(!is_null($event)) {
|
2012-03-31 16:27:30 +00:00
|
|
|
$data = OC_Calendar_App::getEventObject($_GET['eventid'], true);
|
2012-09-07 13:21:03 +00:00
|
|
|
if(!$data) {
|
2013-01-31 16:52:50 +00:00
|
|
|
header('HTTP/1.0 403 Forbidden');
|
2012-05-14 13:52:24 +00:00
|
|
|
exit;
|
|
|
|
}
|
2012-10-06 17:46:04 +00:00
|
|
|
header('Content-Type: text/calendar');
|
2012-06-28 17:04:14 +00:00
|
|
|
header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $data['summary']) . '.ics');
|
2012-06-03 12:54:53 +00:00
|
|
|
echo OC_Calendar_Export::export($event, OC_Calendar_Export::EVENT);
|
|
|
|
}
|