Merged commits from Jörg:

- r28939:  Fix empty EXDATE issue
- r28934-7:  Fix vCal 1.0 RRULE issue
This commit is contained in:
Ralf Becker 2010-01-13 06:39:44 +00:00
parent f668ff2ec9
commit 18574aaede
2 changed files with 43 additions and 22 deletions

View File

@ -390,7 +390,14 @@ class calendar_ical extends calendar_boupdate
break;
case 'CLASS':
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'CONFIDENTIAL';
if ($this->productManufacturer == 'funambol')
{
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE';
}
else
{
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'CONFIDENTIAL';
}
break;
case 'ORGANIZER':
@ -1202,6 +1209,7 @@ class calendar_ical extends calendar_boupdate
if ($this->log)
{
$event_info['stored_event'] = $this->read($event_info['stored_event']['id']);
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n" .
array2string($event_info['stored_event'])."\n",3,$this->logfile);
}
@ -1740,12 +1748,16 @@ class calendar_ical extends calendar_boupdate
case 'W':
case 'WEEKLY':
$days = array();
if (preg_match('/W(\d+) ([^ ]*)( ([^ ]*))?$/',$recurence, $recurenceMatches)) // 1.0
if (preg_match('/W(\d+)((?i: [AEFHMORSTUW]*)+)?( +([^ ]*))$/',$recurence, $recurenceMatches)) // 1.0
{
$vcardData['recur_interval'] = $recurenceMatches[1];
if (empty($recurenceMatches[4]))
if (empty($recurenceMatches[2]))
{
if ($recurenceMatches[2] != '#0')
if (preg_match('/#(\d+)/',$recurenceMatches[4],$recurenceMatches))
{
if ($recurenceMatches[1]) $vcardData['recur_count'] = $recurenceMatches[1];
}
else
{
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
}
@ -1755,7 +1767,11 @@ class calendar_ical extends calendar_boupdate
{
$days = explode(' ',trim($recurenceMatches[2]));
if ($recurenceMatches[4] != '#0')
if (preg_match('/#(\d+)/',$recurenceMatches[4],$recurenceMatches))
{
if ($recurenceMatches[1]) $vcardData['recur_count'] = $recurenceMatches[1];
}
else
{
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[4]);
}
@ -1797,7 +1813,7 @@ class calendar_ical extends calendar_boupdate
break;
case 'D': // 1.0
if (preg_match('/D(\d+) #(.\d)/', $recurence, $recurenceMatches))
if (preg_match('/D(\d+) #(\d+)/', $recurence, $recurenceMatches))
{
$vcardData['recur_interval'] = $recurenceMatches[1];
if ($recurenceMatches[2] > 0 && $vcardData['end'])
@ -1807,7 +1823,7 @@ class calendar_ical extends calendar_boupdate
date('i', $vcardData['end']),
date('s', $vcardData['end']),
date('m', $vcardData['end']),
date('d', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
date('d', $vcardData['end']) + ($vcardData['recur_interval']*($recurenceMatches[2]-1)),
date('Y', $vcardData['end'])
);
}
@ -1815,10 +1831,7 @@ class calendar_ical extends calendar_boupdate
elseif (preg_match('/D(\d+) (.*)/', $recurence, $recurenceMatches))
{
$vcardData['recur_interval'] = $recurenceMatches[1];
if ($recurenceMatches[2] != '#0')
{
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
}
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
}
else break;
@ -1839,7 +1852,7 @@ class calendar_ical extends calendar_boupdate
break;
case 'M':
if (preg_match('/MD(\d+) #(.\d)/', $recurence, $recurenceMatches))
if (preg_match('/MD(\d+)(?: [^ ])? #(\d+)/', $recurence, $recurenceMatches))
{
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
$vcardData['recur_interval'] = $recurenceMatches[1];
@ -1849,7 +1862,7 @@ class calendar_ical extends calendar_boupdate
date('H', $vcardData['end']),
date('i', $vcardData['end']),
date('s', $vcardData['end']),
date('m', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
date('m', $vcardData['end']) + ($vcardData['recur_interval']*($recurenceMatches[2]-1)),
date('d', $vcardData['end']),
date('Y', $vcardData['end'])
);
@ -1862,19 +1875,26 @@ class calendar_ical extends calendar_boupdate
{
$vcardData['recur_interval'] = $recurenceMatches[1];
}
if ($recurenceMatches[2] != '#0')
{
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
}
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[2]);
}
elseif (preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches))
{
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY;
if ($recurenceMatches[1] > 1)
$vcardData['recur_interval'] = $recurenceMatches[1];
if (preg_match('/#(\d+)/',$recurenceMatches[4],$recurenceMatches))
{
$vcardData['recur_interval'] = $recurenceMatches[1];
if ($recurenceMatches[1])
{
$vcardData['recur_enddate'] = mktime(
date('H', $vcardData['end']),
date('i', $vcardData['end']),
date('s', $vcardData['end']),
date('m', $vcardData['start']) + ($vcardData['recur_interval']*($recurenceMatches[1]-1)),
date('d', $vcardData['start']),
date('Y', $vcardData['start']));
}
}
if ($recurenceMatches[4] != '#0')
else
{
$vcardData['recur_enddate'] = $this->vCalendar->_parseDateTime($recurenceMatches[4]);
}
@ -1939,6 +1959,7 @@ class calendar_ical extends calendar_boupdate
}
break;
case 'EXDATE':
if (!$attributes['value']) break;
if ((isset($attributes['params']['VALUE'])
&& $attributes['params']['VALUE'] == 'DATE') ||
(!isset($attributes['params']['VALUE']) && $isDate))

View File

@ -551,8 +551,8 @@ class calendar_rrule implements Iterator
case self::MONTHLY_MDAY: // date of the month: BYMONTDAY={1..31}
break;
case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO}
$rrule['BYDAY'] = $this->monthly_byday_num .
case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}+ {MO..SO}
$rrule['BYDAY'] = $this->monthly_byday_num . '+ ' .
strtoupper(substr($this->time->format('l'),0,2));
$rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY'];
break;