From 1b212f3ee28a681ec726cbd2d41a1f6af9d3e208 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 1 Aug 2023 10:47:02 +0200 Subject: [PATCH] Fix PHP8 warnings --- plugins/calendar/calendar.php | 2 +- plugins/libkolab/lib/kolab_format_event.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 324f1b2c..6e26097c 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -2994,7 +2994,7 @@ $("#rcmfd_new_category").keypress(function(event) { // TODO: skip events with free_busy == 'free' ? if ($event['uid'] == $data['uid'] || $event['end'] < $day_start || $event['start'] > $day_end - || $event['status'] == 'CANCELLED' + || (!empty($event['status']) && $event['status'] == 'CANCELLED') || (!empty($event['className']) && strpos($event['className'], 'declined') !== false) ) { continue; diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index 496a877b..ca15b502 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -62,15 +62,18 @@ class kolab_format_event extends kolab_format_xcal // do the hard work of setting object values $this->obj->setStart(self::get_datetime($object['start'], null, !empty($object['allday']))); $this->obj->setEnd(self::get_datetime($object['end'], null, !empty($object['allday']))); - $this->obj->setTransparency($object['free_busy'] == 'free'); + $this->obj->setTransparency(!empty($object['free_busy']) && $object['free_busy'] == 'free'); $status = kolabformat::StatusUndefined; - if ($object['free_busy'] == 'tentative') + if (!empty($object['free_busy']) && $object['free_busy'] == 'tentative') { $status = kolabformat::StatusTentative; - if (!empty($object['cancelled'])) + } + if (!empty($object['cancelled'])) { $status = kolabformat::StatusCancelled; - else if (!empty($object['status']) && array_key_exists($object['status'], $this->status_map)) + } + else if (!empty($object['status']) && array_key_exists($object['status'], $this->status_map)) { $status = $this->status_map[$object['status']]; + } $this->obj->setStatus($status); // save (recurrence) exceptions