Welcome to mirror list, hosted at ThFree Co, Russian Federation.

export.php « calendar « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf0503defbc9314a429e0da3d68c1f429595ddad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
 * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

 
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
$nl = "\r\n";
if(isset($cal)){
	$calendar = OC_Calendar_App::getCalendar($cal);
	$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(isset($event)){
	$data = OC_Calendar_App::getEventObject($_GET['eventid']);
	$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'];
}
?>