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); }