From 6b084b40f93e80a716dbf75d05a75e99748ff0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Sat, 25 Jun 2011 14:15:16 +0000 Subject: [PATCH] * Fix RRULE parser (2nd part) - Bug#2991@egroupware.org --- calendar/inc/class.calendar_ical.inc.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index e337a35143..49a113a7b8 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -2506,14 +2506,11 @@ class calendar_ical extends calendar_boupdate ); } } - elseif (preg_match('/MD(\d+) (.*)/',$recurence, $recurenceMatches)) + elseif (preg_match('/MD(\d+)(?: [^ ]+)? ([0-9T]+)/',$recurence, $recurenceMatches)) { $vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY; - if ($recurenceMatches[1] > 1) - { - $vcardData['recur_interval'] = $recurenceMatches[1]; - } - $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime(trim($recurenceMatches[2])); + $vcardData['recur_interval'] = $recurenceMatches[1]; + $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); } elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches)) { @@ -2555,7 +2552,7 @@ class calendar_ical extends calendar_boupdate break; case 'Y': // 1.0 - if (preg_match('/YM(\d+)[^#]*#(\d+)/', $recurence, $recurenceMatches)) + if (preg_match('/YM(\d+)(?: [^ ]+)? #(\d+)/', $recurence, $recurenceMatches)) { $vcardData['recur_interval'] = $recurenceMatches[1]; if ($recurenceMatches[2] > 0 && $vcardData['end']) @@ -2570,18 +2567,10 @@ class calendar_ical extends calendar_boupdate ); } } - elseif (preg_match('/YM(\d+) (.*)/',$recurence, $recurenceMatches)) + elseif (preg_match('/YM(\d+)(?: [^ ]+)? ([0-9T]+)/',$recurence, $recurenceMatches)) { $vcardData['recur_interval'] = $recurenceMatches[1]; - $enddate = trim($recurenceMatches[2]); - if ($enddate != '#0') - { - if (preg_match('/([\d,]+) (.*)/', $enddate, $fixMatches)) - { - $enddate = trim($fixMatches[2]); - } - $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($enddate); - } + $vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]); } else break; // fall-through