diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index f231aa7a..324f1b2c 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -2331,8 +2331,8 @@ $("#rcmfd_new_category").keypress(function(event) { private function write_preprocess(&$event, $action) { // Remove double timezone specification (T2313) - $event['start'] = preg_replace('/\s*\(.*\)/', '', $event['start']); - $event['end'] = preg_replace('/\s*\(.*\)/', '', $event['end']); + $event['start'] = preg_replace('/\s*\(.*\)/', '', $event['start'] ?? ''); + $event['end'] = preg_replace('/\s*\(.*\)/', '', $event['end'] ?? ''); // convert dates into DateTime objects in user's current timezone $event['start'] = new DateTime($event['start'], $this->timezone); @@ -3386,7 +3386,7 @@ $("#rcmfd_new_category").keypress(function(event) { 'uid' => $event['uid'], '_instance' => isset($event['_instance']) ? $event['_instance'] : null, 'changed' => is_object($event['changed']) ? $event['changed']->format('U') : 0, - 'sequence' => intval($event['sequence']), + 'sequence' => intval($event['sequence'] ?? 0), 'fallback' => strtoupper((string) $status), 'method' => $event['_method'], 'task' => 'calendar', diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php index 075430f7..a286e4b2 100644 --- a/plugins/kolab_delegation/kolab_delegation_engine.php +++ b/plugins/kolab_delegation/kolab_delegation_engine.php @@ -891,7 +891,7 @@ class kolab_delegation_engine } // add Sender: header with current user default identity - if ($context) { + if (!empty($context)) { $identity = $this->rc->user->get_identity(); $sender = format_email_recipient($identity['email'], $identity['name']); diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php index 7f282f93..f7c09c59 100644 --- a/plugins/kolab_notes/kolab_notes.php +++ b/plugins/kolab_notes/kolab_notes.php @@ -1230,7 +1230,7 @@ class kolab_notes extends rcube_plugin */ public function mail_message_load($p) { - if (!$p['object']->headers->others['x-kolab-type']) { + if (empty($p['object']->headers->others['x-kolab-type'])) { $this->message_notes = $this->get_message_notes($p['object']->headers, $p['object']->folder); } } diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index 0e2e18d4..abf244df 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -401,8 +401,8 @@ class libcalendaring_itip $emails = $this->lib->get_user_emails(); foreach ($existing['attendees'] as $attendee) { - if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) { - $status = strtoupper($attendee['status']); + if (!empty($attendee['email']) && in_array(strtolower($attendee['email']), $emails)) { + $status = !empty($attendee['status']) ? strtoupper($attendee['status']) : ''; break; } } @@ -619,12 +619,12 @@ class libcalendaring_itip $rsvp_buttons = ''; // pass some metadata about the event and trigger the asynchronous status check - $changed = is_object($event['changed']) ? $event['changed'] : $message_date; + $changed = !empty($event['changed']) && is_object($event['changed']) ? $event['changed'] : $message_date; $metadata = array( 'uid' => $event['uid'], '_instance' => isset($event['_instance']) ? $event['_instance'] : null, 'changed' => $changed ? $changed->format('U') : 0, - 'sequence' => intval($event['sequence']), + 'sequence' => intval($event['sequence'] ?? 0), 'method' => $method, 'task' => $task, 'mime_id' => $mime_id, @@ -683,7 +683,7 @@ class libcalendaring_itip // when receiving iTip REQUEST messages: else if ($method == 'REQUEST') { $emails = $this->lib->get_user_emails(); - $title = $event['sequence'] > 0 ? $this->gettext('itipupdate') : $this->gettext('itipinvitation'); + $title = !empty($event['sequence']) ? $this->gettext('itipupdate') : $this->gettext('itipinvitation'); $metadata['rsvp'] = true; if (is_object($event['start'])) { @@ -983,17 +983,17 @@ class libcalendaring_itip */ public static function get_custom_property($event, $name) { - $ret = false; + $ret = false; - if (is_array($event['x-custom'])) { - array_walk($event['x-custom'], function($prop, $i) use ($name, &$ret) { - if (strcasecmp($prop[0], $name) === 0) { - $ret = $prop[1]; - } - }); - } + if (is_array($event['x-custom'])) { + array_walk($event['x-custom'], function($prop, $i) use ($name, &$ret) { + if (strcasecmp($prop[0], $name) === 0) { + $ret = $prop[1]; + } + }); + } - return $ret; + return $ret; } /** @@ -1010,7 +1010,8 @@ class libcalendaring_itip /** * Find an attendee that is not the organizer and has an email matching $email_field */ - public function find_attendee_by_email($attendees, $email_field, $email, $email_utf = null) { + public function find_attendee_by_email($attendees, $email_field, $email, $email_utf = null) + { foreach ($attendees as $_attendee) { if (!empty($attendee['role']) && $attendee['role'] == 'ORGANIZER') { continue; @@ -1019,16 +1020,19 @@ class libcalendaring_itip return $attendee; } } + return null; } /** * Find the replying attendee in a REPLY */ - public static function find_reply_attendee($event) { + public static function find_reply_attendee($event) + { // remove the organizer - $itip_attendees = array_filter($event['attendees'], function($item) { return $item['role'] != 'ORGANIZER' && !empty($item['email']); }); - $attendee = null; + $itip_attendees = array_filter($event['attendees'], function($item) { + return (empty($item['role']) || $item['role'] != 'ORGANIZER') && !empty($item['email']); + }); // According to rfc there should only be one attendee for a REPLY if (count($itip_attendees) == 1) { diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php index 8a21ca5c..ee9b7af8 100644 --- a/plugins/libkolab/lib/kolab_format_xcal.php +++ b/plugins/libkolab/lib/kolab_format_xcal.php @@ -552,7 +552,8 @@ abstract class kolab_format_xcal extends kolab_format } else { // action == DISPLAY - $alarm = new Alarm(strval(!empty($valarm['summary']) ? $valarm['summary'] : $object['title'])); + $title = !empty($valarm['summary']) ? $valarm['summary'] : ($object['title'] ?? ''); + $alarm = new Alarm($title); } if ($valarm['trigger'] instanceof DateTimeInterface) { @@ -638,7 +639,7 @@ abstract class kolab_format_xcal extends kolab_format */ public function get_reference_date() { - if ($this->data['start'] && $this->data['start'] instanceof DateTimeInterface) { + if (!empty($this->data['start']) && $this->data['start'] instanceof DateTimeInterface) { return $this->data['start']; }