Skip to content

Commit

Permalink
Catch exception when vevent has no recurrence.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jan 18, 2014
1 parent 30201e8 commit c9db6cb
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions imp/lib/Mime/Viewer/Itip.php
Expand Up @@ -398,30 +398,32 @@ protected function _vEvent($vevent, $id, $method = 'PUBLISH')
$view->loc = $vevent->getAttribute('LOCATION');
} catch (Horde_Icalendar_Exception $e) {}

$rrule = $vevent->getAttribute('RRULE');
if (!is_array($rrule)) {
$recurrence = new Horde_Date_Recurrence(new Horde_Date($view->start));
if (strpos($rrule, '=') !== false) {
$recurrence->fromRRule20($rrule);
} else {
$recurrence->fromRRule10($rrule);
}
try {
$rrule = $vevent->getAttribute('RRULE');
if (!is_array($rrule)) {
$recurrence = new Horde_Date_Recurrence(new Horde_Date($view->start));
if (strpos($rrule, '=') !== false) {
$recurrence->fromRRule20($rrule);
} else {
$recurrence->fromRRule10($rrule);
}

// Add exceptions
$exdates = $vevent->getAttributeValues('EXDATE');
if (is_array($exdates)) {
foreach ($exdates as $exdate) {
if (is_array($exdate)) {
$recurrence->addException(
(int)$exdate['year'],
(int)$exdate['month'],
(int)$exdate['mday']);
// Add exceptions
$exdates = $vevent->getAttributeValues('EXDATE');
if (is_array($exdates)) {
foreach ($exdates as $exdate) {
if (is_array($exdate)) {
$recurrence->addException(
(int)$exdate['year'],
(int)$exdate['month'],
(int)$exdate['mday']);
}
}
}
}

$view->recurrence = $recurrence->toString($prefs->getValue('date_format'));
}
$view->recurrence = $recurrence->toString($prefs->getValue('date_format'));
}
} catch (Horde_ICalendar_Exception $e) {}

if (!empty($attendees)) {
$view->attendees = $this->_parseAttendees($vevent, $attendees);
Expand Down

0 comments on commit c9db6cb

Please sign in to comment.