Fix possible "Call to a member function format() on a non-object" when
invitation event does not define 'changed' datetime object (Bug #2633)
This commit is contained in:
parent
f1dce1f5b9
commit
bcd865a8e5
1 changed files with 33 additions and 16 deletions
|
@ -1926,6 +1926,7 @@ class calendar extends rcube_plugin
|
|||
$charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET;
|
||||
$events = $this->ical->import($this->message->get_part_content($mime_id), $charset);
|
||||
$title = $this->gettext('title');
|
||||
$date = rcube_utils::anytodatetime($this->message->headers->date);
|
||||
|
||||
// successfully parsed events?
|
||||
if (empty($events))
|
||||
|
@ -1976,8 +1977,16 @@ class calendar extends rcube_plugin
|
|||
$buttons = html::div(array('id' => 'rsvp-'.$dom_id, 'style' => 'display:none'), $rsvp_buttons);
|
||||
$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'));
|
||||
$changed = is_object($event['changed']) ? $event['changed'] : $date;
|
||||
|
||||
$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');
|
||||
$script = json_serialize(array(
|
||||
'uid' => $event['uid'],
|
||||
'changed' => $changed ? $changed->format('U') : 0,
|
||||
'sequence' => intval($event['sequence']),
|
||||
'fallback' => $status,
|
||||
));
|
||||
|
||||
$this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status($script)", 'docready');
|
||||
}
|
||||
else if ($this->ical->method == 'CANCEL') {
|
||||
$title = $this->gettext('itipcancellation');
|
||||
|
@ -2000,8 +2009,16 @@ class calendar extends rcube_plugin
|
|||
$buttons = html::div(array('id' => 'rsvp-'.$dom_id, 'style' => 'display:none'), $button_remove);
|
||||
$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'));
|
||||
$changed = is_object($event['changed']) ? $event['changed'] : $date;
|
||||
|
||||
$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');
|
||||
$script = json_serialize(array(
|
||||
'uid' => $event['uid'],
|
||||
'changed' => $changed ? $changed->format('U') : 0,
|
||||
'sequence' => intval($event['sequence']),
|
||||
'fallback' => 'CANCELLED',
|
||||
));
|
||||
|
||||
$this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status($script)", 'docready');
|
||||
}
|
||||
else {
|
||||
$buttons = html::tag('input', array(
|
||||
|
|
Loading…
Add table
Reference in a new issue