diff options
author | Georg Ehrke <dev@georgswebsite.de> | 2012-06-28 19:12:50 +0200 |
---|---|---|
committer | Georg Ehrke <dev@georgswebsite.de> | 2012-06-28 19:12:50 +0200 |
commit | 4b3af1f73be4d2d6e9a3fed0cbe7a35e774359f7 (patch) | |
tree | db99910de631f583d686d078434d14f145019d0d | |
parent | 930bbeabd4285617c8a360babbffedca3f3d7634 (diff) | |
download | nextcloud-server-4b3af1f73be4d2d6e9a3fed0cbe7a35e774359f7.tar.gz nextcloud-server-4b3af1f73be4d2d6e9a3fed0cbe7a35e774359f7.zip |
use OC_Calendar_Export for publicly shared calendars
-rw-r--r-- | apps/calendar/share.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/apps/calendar/share.php b/apps/calendar/share.php index 68c7d0ffae2..f8f9bb8ea42 100644 --- a/apps/calendar/share.php +++ b/apps/calendar/share.php @@ -1,22 +1,30 @@ <?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. + */ $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; + if(!$calendar){ + header('HTTP/1.0 404 Not Found'); + exit; } + 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); }elseif($shared['type'] == OC_Calendar_Share::EVENT){ - $data = OC_Calendar_App::getEventObject($shared['id'], false); - $calendarid = $data['calendarid']; - $calendar = OC_Calendar_App::getCalendar($calendarid); + if(!$data){ + header('HTTP/1.0 404 Not Found'); + exit; + } header('Content-Type: text/Calendar'); - header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics'); - echo $data['calendardata']; + header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $data['summary']) . '.ics'); + echo OC_Calendar_Export::export($shared['id'], OC_Calendar_Export::EVENT); }else{ - header('Error 404: Not Found'); -}
\ No newline at end of file + header('HTTP/1.0 404 Not Found'); + exit; +} |