diff --git a/plugins/libkolab/lib/Horde_Date_Recurrence.php b/plugins/libkolab/lib/Horde_Date_Recurrence.php index 2171a474..a1151046 100644 --- a/plugins/libkolab/lib/Horde_Date_Recurrence.php +++ b/plugins/libkolab/lib/Horde_Date_Recurrence.php @@ -1306,7 +1306,10 @@ class Horde_Date_Recurrence '%04d%02d%02d'); $this->setRecurEnd(new Horde_Date(array('year' => $year, 'month' => $month, - 'mday' => $mday))); + 'mday' => $mday, + 'hour' => 23, + 'min' => 59, + 'sec' => 59))); } if (isset($rdata['COUNT'])) { $this->setRecurCount($rdata['COUNT']); diff --git a/plugins/libkolab/lib/kolab_date_recurrence.php b/plugins/libkolab/lib/kolab_date_recurrence.php index 55cc8c35..427f62ac 100644 --- a/plugins/libkolab/lib/kolab_date_recurrence.php +++ b/plugins/libkolab/lib/kolab_date_recurrence.php @@ -55,7 +55,7 @@ class kolab_date_recurrence $this->engine->fromRRule20($this->to_rrule($object['recurrence'])); // TODO: get that string directly from libkolabxml foreach ((array)$object['recurrence']['EXDATE'] as $exdate) - $this->engine->addException(date('Y', $exdate), date('n', $exdate), date('j', $exdate)); + $this->engine->addException($exdate->format('Y'), $exdate->format('n'), $exdate->format('j')); $now = new DateTime('now', kolab_format::$timezone); $this->tz_offset = $object['allday'] ? $now->getOffset() - date('Z') : 0; @@ -124,7 +124,7 @@ class kolab_date_recurrence public function end($limit = 'now +1 year') { if ($this->object['recurrence']['UNTIL']) - return $this->object['recurrence']['UNTIL']; + return $this->object['recurrence']['UNTIL']->format('U'); $limit_time = strtotime($limit); while ($next_start = $this->next_start(true)) { @@ -154,11 +154,11 @@ class kolab_date_recurrence $k = strtoupper($k); switch ($k) { case 'UNTIL': - $val = gmdate('Ymd\THis', $val); + $val = $val->format('Ymd\THis'); break; case 'EXDATE': foreach ((array)$val as $i => $ex) - $val[$i] = gmdate('Ymd\THis', $ex); + $val[$i] = $ex->format('Ymd\THis'); $val = join(',', (array)$val); break; } diff --git a/plugins/libkolab/lib/kolab_format_contact.php b/plugins/libkolab/lib/kolab_format_contact.php index 69b372c0..ffef059d 100644 --- a/plugins/libkolab/lib/kolab_format_contact.php +++ b/plugins/libkolab/lib/kolab_format_contact.php @@ -136,6 +136,7 @@ class kolab_format_contact extends kolab_format $this->obj->setUid($object['uid']); $object['changed'] = new DateTime('now', self::$timezone); + $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); // do the hard work of setting object values $nc = new NameComponents; diff --git a/plugins/libkolab/lib/kolab_format_distributionlist.php b/plugins/libkolab/lib/kolab_format_distributionlist.php index fe998042..04c7fd4d 100644 --- a/plugins/libkolab/lib/kolab_format_distributionlist.php +++ b/plugins/libkolab/lib/kolab_format_distributionlist.php @@ -50,6 +50,7 @@ class kolab_format_distributionlist extends kolab_format $this->obj->setUid($object['uid']); $object['changed'] = new DateTime('now', self::$timezone); + $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); $this->obj->setName($object['name']); diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index 0f792ebf..33ed5af3 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -229,7 +229,7 @@ class kolab_format_event extends kolab_format_xcal if ($recurrence['range-type'] == 'number') $rrule['COUNT'] = intval($recurrence['range']); else if ($recurrence['range-type'] == 'date') - $rrule['UNTIL'] = $recurrence['range']; + $rrule['UNTIL'] = date_create('@'.$recurrence['range']); if ($recurrence['day']) { $byday = array(); @@ -251,7 +251,7 @@ class kolab_format_event extends kolab_format_xcal if ($recurrence['exclusion']) { foreach ((array)$recurrence['exclusion'] as $excl) - $rrule['EXDATE'][] = strtotime($excl . date(' H:i:s', $rec['start-date'])); // use time of event start + $rrule['EXDATE'][] = date_create($excl . date(' H:i:s', $rec['start-date'])); // use time of event start } } diff --git a/plugins/libkolab/lib/kolab_format_journal.php b/plugins/libkolab/lib/kolab_format_journal.php index 219c6f11..3be3813d 100644 --- a/plugins/libkolab/lib/kolab_format_journal.php +++ b/plugins/libkolab/lib/kolab_format_journal.php @@ -50,6 +50,7 @@ class kolab_format_journal extends kolab_format $this->obj->setUid($object['uid']); $object['changed'] = new DateTime('now', self::$timezone); + $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); // TODO: set object propeties diff --git a/plugins/libkolab/lib/kolab_format_note.php b/plugins/libkolab/lib/kolab_format_note.php index a5b2cd4f..9abf5f4d 100644 --- a/plugins/libkolab/lib/kolab_format_note.php +++ b/plugins/libkolab/lib/kolab_format_note.php @@ -50,6 +50,7 @@ class kolab_format_note extends kolab_format $this->obj->setUid($object['uid']); $object['changed'] = new DateTime('now', self::$timezone); + $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); // TODO: set object propeties diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php index 1cd803ee..f8247e0c 100644 --- a/plugins/libkolab/lib/kolab_format_xcal.php +++ b/plugins/libkolab/lib/kolab_format_xcal.php @@ -144,7 +144,7 @@ abstract class kolab_format_xcal extends kolab_format } else if ($until = self::php_datetime($rr->end())) { $until->setTime($object['start']->format('G'), $object['start']->format('i'), 0); - $object['recurrence']['UNTIL'] = $until->format('U'); + $object['recurrence']['UNTIL'] = $until; } if (($byday = $rr->byday()) && $byday->size()) { @@ -169,7 +169,7 @@ abstract class kolab_format_xcal extends kolab_format if ($exceptions = $this->obj->exceptionDates()) { for ($i=0; $i < $exceptions->size(); $i++) { if ($exdate = self::php_datetime($exceptions->get($i))) - $object['recurrence']['EXDATE'][] = $exdate->format('U'); + $object['recurrence']['EXDATE'][] = $exdate; } } } @@ -223,6 +223,7 @@ abstract class kolab_format_xcal extends kolab_format $this->obj->setUid($object['uid']); $object['changed'] = new DateTime('now', self::$timezone); + $this->obj->setLastModified(self::get_datetime($object['changed'], new DateTimeZone('UTC'))); // increment sequence $this->obj->setSequence($this->obj->sequence()+1); diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index 80a9342a..0a50f7fe 100644 --- a/plugins/libkolab/lib/kolab_storage_cache.php +++ b/plugins/libkolab/lib/kolab_storage_cache.php @@ -515,7 +515,7 @@ class kolab_storage_cache // extend date range for recurring events if ($object['recurrence']) { $recurrence = new kolab_date_recurrence($object); - $sql_data['dtend'] = date('Y-m-d H:i:s', $recurrence->end() ?: strtotime('now +1 year')); + $sql_data['dtend'] = date('Y-m-d 23:59:59', $recurrence->end() ?: strtotime('now +1 year')); } } else if ($objtype == 'task') {