When a timezone is supplied, but not used in the event, pretend it was.

This gets around some buggy software which expects this kind of
thing to work.
This commit is contained in:
Andrew McMillan 2010-04-28 14:08:14 +12:00
parent 27da222920
commit a359553eee

View File

@ -846,7 +846,6 @@ function write_resource( $user_no, $path, $caldav_data, $collection_id, $author,
$last_tz_locn = 'Turkmenikikamukau'; // I really hope this location doesn't exist! $last_tz_locn = 'Turkmenikikamukau'; // I really hope this location doesn't exist!
$tzid = $first->GetPParamValue('DTSTART','TZID'); $tzid = $first->GetPParamValue('DTSTART','TZID');
if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID'); if ( !isset($tzid) || $tzid == '' ) $tzid = $first->GetPParamValue('DUE','TZID');
if ( isset($tzid) && $tzid != '' ) {
$timezones = $ic->GetComponents('VTIMEZONE'); $timezones = $ic->GetComponents('VTIMEZONE');
foreach( $timezones AS $k => $tz ) { foreach( $timezones AS $k => $tz ) {
if ( $tz->GetPValue('TZID') != $tzid ) { if ( $tz->GetPValue('TZID') != $tzid ) {
@ -862,7 +861,7 @@ function write_resource( $user_no, $path, $caldav_data, $collection_id, $author,
if ( ! isset($tz_locn) ) { if ( ! isset($tz_locn) ) {
if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) ) if ( preg_match( '#([^/]+/[^/]+)$#', $tzid, $matches ) )
$tz_locn = $matches[1]; $tz_locn = $matches[1];
else { else if ( isset($tzid) && $tzid != '' ) {
dbg_error_log( 'ERROR', ' Couldn\'t guess Olsen TZ from TZID[%s]. This may end in tears...', $tzid ); dbg_error_log( 'ERROR', ' Couldn\'t guess Olsen TZ from TZID[%s]. This may end in tears...', $tzid );
} }
} }
@ -890,7 +889,6 @@ function write_resource( $user_no, $path, $caldav_data, $collection_id, $author,
if ( !isset($tz_locn) || $tz_locn == '' ) $tz_locn = $tzid; if ( !isset($tz_locn) || $tz_locn == '' ) $tz_locn = $tzid;
} }
}
$created = $first->GetPValue('CREATED'); $created = $first->GetPValue('CREATED');
if ( $created == '00001231T000000Z' ) $created = '20001231T000000Z'; if ( $created == '00001231T000000Z' ) $created = '20001231T000000Z';