Experimenting with other fields and handling exceptions if not set.

This commit is contained in:
2025-06-06 10:22:11 +10:00
parent 6cf89b75a0
commit 1477607c65

View File

@@ -13,7 +13,7 @@ $events = json_decode($json, true);
// Start of the iCalendar content
echo "BEGIN:VCALENDAR\r\n";
echo "VERSION:2.0\r\n";
echo "PRODID:-//HLB//Brisbane Calendar//EN\r\n";
echo "PRODID:-//Homelab Brisbane//Event Calendar//EN\r\n";
echo "CALSCALE:GREGORIAN\r\n";
echo "METHOD:PUBLISH\r\n";
echo "X-WR-TIMEZONE:Australia/Brisbane\r\n";
@@ -31,12 +31,14 @@ echo "END:VTIMEZONE\r\n";
// Generate VEVENTS
foreach ($events as $event) {
$uid = uniqid() . "@yourdomain.com";
$uid = uniqid() . "@homelabbrisbane.com.au";
$dtstart = date("Ymd\THis", strtotime($event["start"]));
$dtend = date("Ymd\THis", strtotime($event["end"]));
$summary = htmlspecialchars($event["title"]);
$location = htmlspecialchars($event["location"]);
$description = isset($event["description"]) ? htmlspecialchars($event["description"]) : '';
echo "BEGIN:VEVENT\r\n";
echo "UID:$uid\r\n";
@@ -45,6 +47,7 @@ foreach ($events as $event) {
echo "DTEND;TZID=Australia/Brisbane:$dtend\r\n";
echo "SUMMARY:$summary\r\n";
echo "LOCATION:$location\r\n";
echo "DESCRIPTION:$description\r\n";
echo "END:VEVENT\r\n";
}