Correctly handle iTip replies without valid DTSTSART/DTEND attributes (#1178)
This commit is contained in:
parent
ace437f1da
commit
db7d414324
5 changed files with 39 additions and 2 deletions
|
@ -248,6 +248,25 @@ abstract class calendar_driver
|
|||
*/
|
||||
abstract function dismiss_alarm($event_id, $snooze = 0);
|
||||
|
||||
/**
|
||||
* Check the given event object for validity
|
||||
*
|
||||
* @param array Event object as hash array
|
||||
* @return boolean True if valid, false if not
|
||||
*/
|
||||
public function validate($event)
|
||||
{
|
||||
$valid = true;
|
||||
|
||||
if (!is_object($event['start']) || !is_a($event['start'], 'DateTime'))
|
||||
$valid = false;
|
||||
if (!is_object($event['end']) || !is_a($event['end'], 'DateTime'))
|
||||
$valid = false;
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get list of event's attachments.
|
||||
* Drivers can return list of attachments as event property.
|
||||
|
|
|
@ -210,6 +210,9 @@ class database_driver extends calendar_driver
|
|||
*/
|
||||
public function new_event($event)
|
||||
{
|
||||
if (!$this->validate($event))
|
||||
return false;
|
||||
|
||||
if (!empty($this->calendars)) {
|
||||
if ($event['calendar'] && !$this->calendars[$event['calendar']])
|
||||
return false;
|
||||
|
|
|
@ -286,6 +286,9 @@ class kolab_driver extends calendar_driver
|
|||
*/
|
||||
public function new_event($event)
|
||||
{
|
||||
if (!$this->validate($event))
|
||||
return false;
|
||||
|
||||
$cid = $event['calendar'] ? $event['calendar'] : reset(array_keys($this->calendars));
|
||||
if ($storage = $this->calendars[$cid]) {
|
||||
// handle attachments to add
|
||||
|
|
|
@ -160,8 +160,15 @@ class calendar_ical
|
|||
$event['end']->sub(new DateInterval('PT23H'));
|
||||
|
||||
// assign current timezone to event start/end
|
||||
$event['start']->setTimezone($this->cal->timezone);
|
||||
$event['end']->setTimezone($this->cal->timezone);
|
||||
if (is_a($event['start'], 'DateTime'))
|
||||
$event['start']->setTimezone($this->cal->timezone);
|
||||
else
|
||||
unset($event['start']);
|
||||
|
||||
if (is_a($event['end'], 'DateTime'))
|
||||
$event['end']->setTimezone($this->cal->timezone);
|
||||
else
|
||||
unset($event['end']);
|
||||
|
||||
// map other attributes to internal fields
|
||||
$_attendees = array();
|
||||
|
|
|
@ -206,6 +206,11 @@ class libcalendaring extends rcube_plugin
|
|||
public function event_date_text($event, $tzinfo = false)
|
||||
{
|
||||
$fromto = '';
|
||||
|
||||
// abort if no valid event dates are given
|
||||
if (!is_object($event['start']) || !is_a($event['start'], 'DateTime') || !is_object($event['end']) || !is_a($event['end'], 'DateTime'))
|
||||
return $fromto;
|
||||
|
||||
$duration = $event['start']->diff($event['end'])->format('s');
|
||||
|
||||
$this->date_format_defaults();
|
||||
|
|
Loading…
Add table
Reference in a new issue