Fix empty check

This commit is contained in:
Christoph Haas 2016-12-05 20:42:11 +01:00
parent 668644c5d5
commit 08a181d59d

View File

@ -693,12 +693,16 @@ class CalendarModule extends Module
$properties["comment"] = (string)$vEvent->COMMENT; $properties["comment"] = (string)$vEvent->COMMENT;
$properties["timezone"] = (string)$vEvent->DTSTART["TZID"]; $properties["timezone"] = (string)$vEvent->DTSTART["TZID"];
$properties["organizer"] = (string)$vEvent->ORGANIZER; $properties["organizer"] = (string)$vEvent->ORGANIZER;
if(!empty((string)$vEvent->FBTYPE)) {
$properties["busystatus"] = array_search((string)$vEvent->FBTYPE, $this->freeBusyStates); $fbType = (string)$vEvent->FBTYPE;
} else if(!empty((string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'})) { $msIntendedStatus = (string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'};
$properties["busystatus"] = array_search((string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'}, $this->busyStates); $msBusyStatus = (string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'};
} else if(!empty((string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'})) { if(!empty($fbType)) {
$properties["busystatus"] = array_search((string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'}, $this->busyStates); $properties["busystatus"] = array_search($fbType, $this->freeBusyStates);
} else if(!empty($msIntendedStatus)) {
$properties["busystatus"] = array_search($msIntendedStatus, $this->busyStates);
} else if(!empty($msBusyStatus)) {
$properties["busystatus"] = array_search($msBusyStatus, $this->busyStates);
} else { } else {
$properties["busystatus"] = array_search("BUSY", $this->busyStates); $properties["busystatus"] = array_search("BUSY", $this->busyStates);
} }
@ -710,12 +714,14 @@ class CalendarModule extends Module
if (!empty($zLabel)) { if (!empty($zLabel)) {
$properties["label"] = array_search($zLabel, $this->labels); $properties["label"] = array_search($zLabel, $this->labels);
} }
if (!empty((string)$vEvent->{'LAST-MODIFIED'})) { $lastModified = (string)$vEvent->{'LAST-MODIFIED'};
if (!empty($lastModified)) {
$properties["last_modification_time"] = (string)$vEvent->{'LAST-MODIFIED'}->getDateTime()->getTimestamp(); $properties["last_modification_time"] = (string)$vEvent->{'LAST-MODIFIED'}->getDateTime()->getTimestamp();
} else { } else {
$properties["last_modification_time"] = time(); $properties["last_modification_time"] = time();
} }
if (!empty((string)$vEvent->CREATED)) { $created = (string)$vEvent->CREATED;
if (!empty($created)) {
$properties["creation_time"] = (string)$vEvent->CREATED->getDateTime()->getTimestamp(); $properties["creation_time"] = (string)$vEvent->CREATED->getDateTime()->getTimestamp();
} else { } else {
$properties["creation_time"] = time(); $properties["creation_time"] = time();