From 6cc882673214ea9b293940d140042ccd978e43ef Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 22 Jun 2015 09:16:20 +0000 Subject: [PATCH] iCal export should contain only event series and not recurrences, also fixes wrong timezone, if different between user and server --- calendar/inc/class.calendar_export_ical.inc.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/calendar/inc/class.calendar_export_ical.inc.php b/calendar/inc/class.calendar_export_ical.inc.php index d7556a9022..6147e43648 100644 --- a/calendar/inc/class.calendar_export_ical.inc.php +++ b/calendar/inc/class.calendar_export_ical.inc.php @@ -1,6 +1,6 @@ get_rows($query, $events, $unused); } else @@ -75,7 +76,6 @@ class calendar_export_ical extends calendar_export_csv { $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 } - $events = array(); switch($states['view']) { case 'month': @@ -109,8 +109,16 @@ class calendar_export_ical extends calendar_export_csv { )); } } + // compile list of unique cal_id's, as iCal should contain whole series, not recurrences + // calendar_ical->exportVCal needs to read events again, to get them in server-time + $ids = array(); + foreach($events as $event) + { + $id = is_array($event) ? $event['id'] : $event; + if (($id = (int)$id)) $ids[$id] = $id; + } - $ical =& $boical->exportVCal($events,'2.0','PUBLISH',false); + $ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false); fwrite($_stream, $ical); }