From bb7ad55ea45f9028d62bf99f2446baa02635ff5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Wed, 11 Nov 2009 09:16:46 +0000 Subject: [PATCH] Support for Synthesis VTIMEZONE RRULES --- .../inc/horde/Horde/iCalendar/vtimezone.php | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/iCalendar/vtimezone.php b/phpgwapi/inc/horde/Horde/iCalendar/vtimezone.php index d286d944a2..e07bd2db2d 100644 --- a/phpgwapi/inc/horde/Horde/iCalendar/vtimezone.php +++ b/phpgwapi/inc/horde/Horde/iCalendar/vtimezone.php @@ -35,6 +35,7 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar { { // Make sure 'time' key is first for sort(). $result['time'] = 0; + $rrule_interval = 0; // 0 undefined, 1 yearly, 12 monthly $t = $child->getAttribute('TZOFFSETFROM'); if (is_a($t, 'PEAR_Error')) { @@ -76,15 +77,32 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar { $t = explode('=', $rrule); switch ($t[0]) { case 'FREQ': - if ($t[1] != 'YEARLY') { - return false; - } + switch($t[1]) { + case 'YEARLY': + if ($rrule_interval == 12) { + return false; + } + $rrule_interval = 1; + break; + case 'MONTHLY': + if ($rrule_interval == 1) { + return false; + } + $rrule_interval = 12; + break; + default: + return false; + } break; case 'INTERVAL': - if ($t[1] != '1') { + if ($rrule_interval && $t[1] != $rrule_interval) { return false; } + $rrule_interval = intval($t[1]); + if ($rrule_interval != 1 && $rrule_interval != 12) { + return false; + } break; case 'COUNT': @@ -124,6 +142,10 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar { } } + if ($rrule_interval == 12) { + $month = date("n", $switch_time); + } + if (empty($month) || !isset($weekday)) { return false; }