z-push (2.3 at least) requires a timezone for recurring events

This commit is contained in:
Ralf Becker 2016-06-25 10:55:28 +02:00
parent fe1b9d729c
commit 1a27a7b840

View File

@ -1045,7 +1045,8 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
}
catch(Exception $e) {
unset($e);
// ignore exception, simply set no timezone, as it is optional
// z-push (2.3 at least) requires a timezone for recurring events
if ($event['recur_type']) $message->timezone = self::UTC_BLOB;
}
// copying timestamps (they are already read in servertime, so non tz conversation)
@ -1328,6 +1329,11 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', ...) type='$type', owner=$owner --> syncstate='$syncstate'");
}
/**
* AS Timezone blob for UTC
*/
const UTC_BLOB = 'AAAAAAAoAEcATQBUACkAIABHAHIAZQBlAG4AdwBpAGMAaAAgAE0AZQBhAG4AIABUAGkAbQBlADoAIABEAHUAYgBsAGkAAAoAAAAFAAIAAAAAAAAAAAAAAAAoAEcATQBUACkAIABHAHIAZQBlAG4AdwBpAGMAaAAgAE0AZQBhAG4AIABUAGkAbQBlADoAIABEAHUAYgBsAGkAAAMAAAAFAAEAAAAAAAAAxP///w==';
/**
* Return AS timezone data from given timezone and time
*
@ -1394,6 +1400,8 @@ END:VTIMEZONE
'dstendhour' => 0, 'dstendminute' => 0, 'dstendsecond' => 0, 'dstendmillis' => 0,
);
if ($tz === 'UTC') return $data;
$name = $component = is_a($tz,'DateTimeZone') ? $tz->getName() : $tz;
if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name,'component');
// parse ical timezone defintion
@ -1690,12 +1698,14 @@ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE_
'Pacific/Auckland' => 'MP3//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAFAAMAAAAAAAAAxP///w==',
'Australia/Sydney' => 'qP3//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAIAAAAAAAAAxP///w==',
'Etc/GMT+3' => 'TP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==',
'UTC' => calendar_zpush::UTC_BLOB,
) as $tz => $sync_blob)
{
// get as timezone data for a given timezone
$ical = calendar_timezones::tz2id($tz,'component');
//echo "<pre>".print_r($ical,true)."</pre>\n";
$ical_arr = calendar_zpush::ical2array($ical_tz=$ical);
$ical_tz = $ical;
$ical_arr = calendar_zpush::ical2array($ical_tz);
//echo "<pre>".print_r($ical_arr,true)."</pre>\n";
$as_tz = calendar_zpush::tz2as($tz);
//echo "$tz=<pre>".print_r($as_tz,true)."</pre>\n";