nextcloud/apps/calendar/export.php

30 lines
1.0 KiB
PHP
Raw Normal View History

<?php
2011-09-24 00:59:24 +04:00
/**
2012-01-15 03:45:27 +04:00
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
2011-09-24 00:59:24 +04:00
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
2012-05-02 00:59:38 +04:00
OCP\User::checkLoggedIn();
2012-05-02 21:08:37 +04:00
OCP\App::checkAppEnabled('calendar');
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
2011-10-02 01:19:06 +04:00
if(isset($cal)){
2012-03-31 20:27:30 +04:00
$calendar = OC_Calendar_App::getCalendar($cal, true);
2012-05-14 17:52:24 +04:00
if(!$calendar){
header('HTTP/1.0 404 Not Found');
exit;
}
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics');
echo OC_Calendar_Export::export($cal, OC_Calendar_Export::CALENDAR);
2011-10-02 01:19:06 +04:00
}elseif(isset($event)){
2012-03-31 20:27:30 +04:00
$data = OC_Calendar_App::getEventObject($_GET['eventid'], true);
2012-05-14 17:52:24 +04:00
if(!$data){
header('HTTP/1.0 404 Not Found');
exit;
}
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
echo OC_Calendar_Export::export($event, OC_Calendar_Export::EVENT);
}