2012-03-31 20:32:43 +04:00
|
|
|
<?php
|
2012-06-28 21:12:50 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-03-31 20:32:43 +04:00
|
|
|
$token = strip_tags($_GET['t']);
|
|
|
|
$shared = OC_Calendar_Share::getElementByToken($token);
|
|
|
|
if($shared['type'] == OC_Calendar_Share::CALENDAR){
|
2012-04-14 01:36:47 +04:00
|
|
|
$calendar = OC_Calendar_App::getCalendar($shared['id'], false);
|
2012-06-28 21:12:50 +04:00
|
|
|
if(!$calendar){
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
exit;
|
2012-03-31 20:32:43 +04:00
|
|
|
}
|
2012-06-28 21:12:50 +04:00
|
|
|
header('Content-Type: text/Calendar');
|
|
|
|
header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $calendar['displayname']) . '.ics');
|
|
|
|
echo OC_Calendar_Export::export($shared['id'], OC_Calendar_Export::CALENDAR);
|
2012-03-31 20:32:43 +04:00
|
|
|
}elseif($shared['type'] == OC_Calendar_Share::EVENT){
|
2012-06-28 21:13:43 +04:00
|
|
|
$data = OC_Calendar_App::getEventObject($shared['id'], false);
|
2012-06-28 21:12:50 +04:00
|
|
|
if(!$data){
|
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
exit;
|
|
|
|
}
|
2012-03-31 20:32:43 +04:00
|
|
|
header('Content-Type: text/Calendar');
|
2012-06-28 21:12:50 +04:00
|
|
|
header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $data['summary']) . '.ics');
|
|
|
|
echo OC_Calendar_Export::export($shared['id'], OC_Calendar_Export::EVENT);
|
2012-04-13 06:11:48 +04:00
|
|
|
}else{
|
2012-06-28 21:12:50 +04:00
|
|
|
header('HTTP/1.0 404 Not Found');
|
|
|
|
exit;
|
|
|
|
}
|