From 1b345bbf364cd066ae690adda2ace4657c6f1f2e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 8 Mar 2012 16:23:43 +0000 Subject: [PATCH] * InfoLog/CalDAV: fixed wrong timezone used for iCal generation times where read in server-time, but infolog_ical was told it is user-time, now set to server-time in infolog_groupdav::get_handler() --- infolog/inc/class.infolog_groupdav.inc.php | 1 + infolog/inc/class.infolog_ical.inc.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/infolog/inc/class.infolog_groupdav.inc.php b/infolog/inc/class.infolog_groupdav.inc.php index c8a1b0d6a6..cf36f10e61 100644 --- a/infolog/inc/class.infolog_groupdav.inc.php +++ b/infolog/inc/class.infolog_groupdav.inc.php @@ -605,6 +605,7 @@ class infolog_groupdav extends groupdav_handler private function _get_handler() { $handler = new infolog_ical(); + $handler->tzid = false; // as we read server-time timestamps (!= null=user-time), exports UTC times $handler->setSupportedFields('GroupDAV',$this->agent); return $handler; diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index be4e7ddf86..4ba7e0b611 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -173,7 +173,6 @@ class infolog_ical extends infolog_bo if ($_method) $vcal->setAttribute('METHOD',$_method); $tzid = $this->tzid; - if ($tzid && $tzid != 'UTC') { // check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz) @@ -298,7 +297,7 @@ class infolog_ical extends infolog_bo } if ($taskData['info_enddate']) { - self::setDateOrTime($vevent, 'DUE', $taskData['info_enddate'], false); // export always as date + self::setDateOrTime($vevent, 'DUE', $taskData['info_enddate'], $tzid); } if ($taskData['info_datecompleted']) { @@ -380,6 +379,7 @@ class infolog_ical extends infolog_bo static function setDateOrTime(&$vevent, $attr, $time, $tzid) { $params = array(); + $time_in = $time; if ($tzid) { @@ -410,7 +410,8 @@ class infolog_ical extends infolog_bo $value = array( 'year' => $arr['year'], 'month' => $arr['month'], - 'mday' => $arr['day']); + 'mday' => $arr['day'], + ); $params['VALUE'] = 'DATE'; } else @@ -429,6 +430,7 @@ class infolog_ical extends infolog_bo $value = egw_time::to($time, 'ts'); } } + //error_log(__METHOD__."(, '$attr', ".array2string($time_in).', '.array2string($tzid).') tz='.$tz->getName().', value='.array2string($value).(is_int($value)?date('Y-m-d H:i:s',$value):'')); $vevent->setAttribute($attr, $value, $params); }