From a064f05bcdcd3c75dd1ca2cd2eedb8b9db709dc3 Mon Sep 17 00:00:00 2001 From: Tobias Feigel Date: Sat, 6 Sep 2025 17:12:09 +0200 Subject: [PATCH] Make backward compatible to PHP 8.3 --- site/snippets/home-termine.php | 38 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/site/snippets/home-termine.php b/site/snippets/home-termine.php index e734ec6..016710c 100644 --- a/site/snippets/home-termine.php +++ b/site/snippets/home-termine.php @@ -1,8 +1,8 @@ format('Ymd'); +// Aktuelles Datum - PHP 8.3 kompatibel +$today = (new DateTime('now'))->format('Ymd'); // Nur zukünftige Termine anzeigen $future_events = array_filter($events, function ($event) use ($today) { @@ -49,12 +49,24 @@ $de_months = [ $location = $event['LOCATION'] ?? ''; $desc = $event['DESCRIPTION'] ?? ''; $timezone = $event['DTSTART_TZID'] ?? null; - $date_info = format_ics_date_with_timezone($start, $timezone); - $date = $date_info['display']; - $time = $date_info['has_time'] ? substr($date, 11) : 'ganztägig'; + + // Sichere Funktionsaufrufe mit Null-Checks + $date_info = function_exists('format_ics_date_with_timezone') + ? format_ics_date_with_timezone($start, $timezone) + : ['display' => '', 'has_time' => false, 'iso' => '']; + + $date = $date_info['display'] ?? ''; + $time = ($date_info['has_time'] ?? false) ? substr($date, 11) : 'ganztägig'; $day = substr($date, 0, 2); $month = substr($date, 3, 2); - $iso_date = $date_info['iso']; + $iso_date = $date_info['iso'] ?? ''; + + // Sichere Array-Zugriffe + $month_name = $de_months[$month] ?? 'Unbek'; + $event_summary = htmlspecialchars($summary, ENT_QUOTES, 'UTF-8'); + $safe_day = htmlspecialchars($day, ENT_QUOTES, 'UTF-8'); + $safe_iso_date = htmlspecialchars($iso_date, ENT_QUOTES, 'UTF-8'); + $safe_time = htmlspecialchars($time, ENT_QUOTES, 'UTF-8'); ?>
@@ -64,14 +76,12 @@ $de_months = [
- +
-
+
@@ -86,12 +96,10 @@ $de_months = [
-

+

- - ab Uhr + + ab Uhr ganztägig