From 8cadeb6492a6f0d68a3b565d9c3ec934c2b36c7d Mon Sep 17 00:00:00 2001 From: "leonard.leo" Date: Tue, 4 Feb 2025 18:33:47 +0100 Subject: [PATCH] =?UTF-8?q?Dateien=20nach=20=E2=80=9E/=E2=80=9C=20hochlade?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ncagenda-code.php | 169 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 ncagenda-code.php diff --git a/ncagenda-code.php b/ncagenda-code.php new file mode 100644 index 0000000..3ad2735 --- /dev/null +++ b/ncagenda-code.php @@ -0,0 +1,169 @@ +", $cleanedDescription); // \n in
umwandeln + } else { + $cleanedDescription = ''; + } + + // ATTACH erfassen (richtige Datei-URL extrahieren) + preg_match('/ATTACH;.*?:([^\n]+)/', $event, $attach); + $attachmentUrl = isset($attach[1]) ? trim($attach[1]) : ''; + + $data['DTSTART'] = $start[1] ?? ''; + $data['DTEND'] = $end[1] ?? ''; + $data['SUMMARY'] = $summary[1] ?? ''; + $data['LOCATION'] = $location[1] ?? ''; + $data['DESCRIPTION'] = $cleanedDescription; + $data['ATTACH'] = $attachmentUrl; + + $events[] = $data; + } + return $events; +} + + +// Datenbankverbindung +include "includes/conn.php"; + +$conn = new mysqli($servername, $username, $password, $dbname); + +// Verbindung prüfen +if ($conn->connect_error) { + die("Verbindung fehlgeschlagen: " . $conn->connect_error); +} + +$sql = "SELECT calendardata FROM `oc_calendarobjects` where calendardata LIKE '%$search%' and calendarid LIKE '90'"; +$result = $conn->query($sql); + +$icsData = ""; +if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + $icsData .= $row["calendardata"] . "\n"; + } +} +$conn->close(); + +$parsedEvents = parseICS($icsData); + + +// Events nach Startdatum sortieren +usort($parsedEvents, function ($a, $b) { + return strcmp($a['DTSTART'], $b['DTSTART']); +}); +?> + + + + + + + + Kalender Events + + + + + +
+ +
+ +
+ + format("d.m.Y - H:i"); + echo $formattedDate; + } + else { + $dateUnformatted = $startDate; + $dateUnformatted = substr($dateUnformatted, 0, -1); + $date = DateTime::createFromFormat("Ymd", $dateUnformatted); + $formattedDate = $date->format("d.m.Y"); + echo $formattedDate; + } + ?> + + + + + +
+

Start: + +

End: format("d.m.Y - H:i"); + echo $formattedDate; + } + else { + $dateUnformatted = $endDate; + $dateUnformatted = substr($dateUnformatted, 0, -1); + $date = DateTime::createFromFormat("Ymd", $dateUnformatted); + $formattedDate = $date->format("d.m.Y"); + echo $formattedDate; + } + ?>

+ +

Place:

+

Info: ", htmlspecialchars($event['DESCRIPTION'])); ?>

+ +

Attach:

+ + +
+ +
+ + + + + + +
+ \ No newline at end of file