aboutsummaryrefslogtreecommitdiffstats
path: root/apps/calendar/export.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/calendar/export.php')
-rw-r--r--apps/calendar/export.php18
1 files changed, 5 insertions, 13 deletions
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index 1647bf14a99..ce1a4aa046f 100644
--- a/apps/calendar/export.php
+++ b/apps/calendar/export.php
@@ -12,25 +12,17 @@ OC_Util::checkAppEnabled('calendar');
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
if(isset($cal)){
- $calendar = OC_Calendar_Calendar::findCalendar($cal);
- if($calendar['userid'] != OC_User::getUser()){
- OC_JSON::error();
- exit;
- }
+ $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');
- for($i = 0;$i <= count($calobjects); $i++){
- echo $calobjects[$i]['calendardata'] . '\n';
+ foreach($calobjects as $calobject){
+ echo $calobject['calendardata'] . '\n';
}
}elseif(isset($event)){
- $data = OC_Calendar_Object::find($_GET['eventid']);
+ $data = OC_Calendar_App::getEventObject($_GET['eventid']);
$calendarid = $data['calendarid'];
- $calendar = OC_Calendar_Calendar::findCalendar($calendarid);
- if($calendar['userid'] != OC_User::getUser()){
- OC_JSON::error();
- exit;
- }
+ $calendar = OC_Calendar_App::getCalendar($calendarid);
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
echo $data['calendardata'];