plugins/calendar plugins/libcalendaring
Thomas Brüderli
bruederli at kolabsys.com
Thu Jul 18 14:07:01 CEST 2013
plugins/calendar/calendar.php | 7 +++++--
plugins/calendar/drivers/database/database_driver.php | 2 +-
plugins/calendar/lib/calendar_itip.php | 2 +-
plugins/libcalendaring/libvcalendar.php | 2 +-
4 files changed, 8 insertions(+), 5 deletions(-)
New commits:
commit c2d97dfe363166841cc5d75e02bdbfa04615576c
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Jul 18 14:06:45 2013 +0200
Always handle 'changed' properties of events as DateTime objects
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 03cdb8b..f3316dc 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -809,6 +809,8 @@ class calendar extends rcube_plugin
$action = 'import';
}
else if (in_array($status, array('ACCEPTED','TENTATIVE','DECLINED'))) {
+ if (is_numeric($event['changed']))
+ $event['changed'] = new DateTime('@'.$event['changed']);
$html = html::div('rsvp-status ' . strtolower($status), $this->gettext('youhave'.strtolower($status)));
if ($existing['sequence'] >= $event['sequence'] || (!$event['sequence'] && $existing['changed'] && $existing['changed'] >= $event['changed'])) {
$action = ''; // nothing to do here
@@ -1199,6 +1201,7 @@ class calendar extends rcube_plugin
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
'start' => $this->lib->adjust_timezone($event['start'])->format('c'),
'end' => $this->lib->adjust_timezone($event['end'])->format('c'),
+ 'changed' => $this->lib->adjust_timezone($event['changed'])->format('c'),
'title' => strval($event['title']),
'description' => strval($event['description']),
'location' => strval($event['location']),
@@ -1854,7 +1857,7 @@ class calendar extends rcube_plugin
$buttons .= html::div(array('id' => 'import-'.$dom_id, 'style' => 'display:none'), $import_button);
$buttons_pre = html::div(array('id' => 'loading-'.$dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading'));
- $this->rc->output->add_script('rcube_calendar.fetch_event_rsvp_status(' . json_serialize(array('uid' => $event['uid'], 'changed' => $event['changed'], 'sequence' => intval($event['sequence']), 'fallback' => $status)) . ')', 'docready');
+ $this->rc->output->add_script('rcube_calendar.fetch_event_rsvp_status(' . json_serialize(array('uid' => $event['uid'], 'changed' => $event['changed']->format('U'), 'sequence' => intval($event['sequence']), 'fallback' => $status)) . ')', 'docready');
}
else if ($this->ical->method == 'CANCEL') {
$title = $this->gettext('itipcancellation');
@@ -1878,7 +1881,7 @@ class calendar extends rcube_plugin
$buttons .= html::div(array('id' => 'import-'.$dom_id, 'style' => 'display:none'), $button_import);
$buttons_pre = html::div(array('id' => 'loading-'.$dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading'));
- $this->rc->output->add_script('rcube_calendar.fetch_event_rsvp_status(' . json_serialize(array('uid' => $event['uid'], 'changed' => $event['changed'], 'sequence' => intval($event['sequence']), 'fallback' => 'CANCELLED')) . ')', 'docready');
+ $this->rc->output->add_script('rcube_calendar.fetch_event_rsvp_status(' . json_serialize(array('uid' => $event['uid'], 'changed' => $event['changed']->format('U'), 'sequence' => intval($event['sequence']), 'fallback' => 'CANCELLED')) . ')', 'docready');
}
else {
$buttons = html::tag('input', array(
diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
index c8c54b6..9388be3 100644
--- a/plugins/calendar/drivers/database/database_driver.php
+++ b/plugins/calendar/drivers/database/database_driver.php
@@ -774,7 +774,7 @@ class database_driver extends calendar_driver
$event['start'] = new DateTime($event['start']);
$event['end'] = new DateTime($event['end']);
$event['allday'] = intval($event['all_day']);
- $event['changed'] = strtotime($event['changed']);
+ $event['changed'] = new DateTime($event['changed']);
$event['free_busy'] = $free_busy_map[$event['free_busy']];
$event['calendar'] = $event['calendar_id'];
$event['recurrence_id'] = intval($event['recurrence_id']);
diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
index 51a1c92..dc9a692 100644
--- a/plugins/calendar/lib/calendar_itip.php
+++ b/plugins/calendar/lib/calendar_itip.php
@@ -238,7 +238,7 @@ class calendar_itip
$this->sender = $attendee;
}
}
- $invitation['event']['changed'] = time();
+ $invitation['event']['changed'] = new DateTime();
// send iTIP REPLY message to organizer
if ($organizer) {
diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index be6f93d..a9ba04c 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -141,7 +141,7 @@ class libvcalendar
{
$event = array(
'uid' => $ve->getAttributeDefault('UID'),
- 'changed' => $ve->getAttributeDefault('DTSTAMP', 0),
+ 'changed' => $this->_date2time($ve->getAttributeDefault('DTSTAMP', 0)),
'title' => $ve->getAttributeDefault('SUMMARY'),
'start' => $this->_date2time($ve->getAttribute('DTSTART')),
'end' => $this->_date2time($ve->getAttribute('DTEND')),
More information about the commits
mailing list