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

share.php « calendar « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1cc8a2ef15edd9708cc73f9ba3edc5fff45e3dd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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($shared['id'], false);
	$calobjects = OC_Calendar_Object::all($shared['id']);
	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'];
}else{
	header('Error 404: Not Found');
}