Lazy commit on yancy.

This commit is contained in:
2025-05-31 12:58:42 +10:00
parent a9a5b88c7a
commit fc05264afb
2 changed files with 68 additions and 0 deletions

53
cal.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
// Set header to tell clients it's a calendar feed
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=calendar.ics');
// Use Brisbane timezone (no DST)
date_default_timezone_set('Australia/Brisbane');
// Read and parse the JSON file
$json = file_get_contents('events.json');
$events = json_decode($json, true);
// Start of the iCalendar content
echo "BEGIN:VCALENDAR\r\n";
echo "VERSION:2.0\r\n";
echo "PRODID:-//YourOrg//Brisbane Calendar//EN\r\n";
echo "CALSCALE:GREGORIAN\r\n";
echo "METHOD:PUBLISH\r\n";
echo "X-WR-TIMEZONE:Australia/Brisbane\r\n";
// Add VTIMEZONE block for Australia/Brisbane
echo "BEGIN:VTIMEZONE\r\n";
echo "TZID:Australia/Brisbane\r\n";
echo "BEGIN:STANDARD\r\n";
echo "DTSTART:19700101T000000\r\n";
echo "TZOFFSETFROM:+1000\r\n";
echo "TZOFFSETTO:+1000\r\n";
echo "TZNAME:AEST\r\n";
echo "END:STANDARD\r\n";
echo "END:VTIMEZONE\r\n";
// Generate VEVENTS
foreach ($events as $event) {
$uid = uniqid() . "@yourdomain.com";
$dtstart = date("Ymd\THis", strtotime($event["start"]));
$dtend = date("Ymd\THis", strtotime($event["end"]));
$summary = htmlspecialchars($event["title"]);
$location = htmlspecialchars($event["location"]);
echo "BEGIN:VEVENT\r\n";
echo "UID:$uid\r\n";
echo "DTSTAMP:" . gmdate("Ymd\THis\Z") . "\r\n";
echo "DTSTART;TZID=Australia/Brisbane:$dtstart\r\n";
echo "DTEND;TZID=Australia/Brisbane:$dtend\r\n";
echo "SUMMARY:$summary\r\n";
echo "LOCATION:$location\r\n";
echo "END:VEVENT\r\n";
}
// End of calendar
echo "END:VCALENDAR\r\n";
?>

15
events.json Normal file
View File

@@ -0,0 +1,15 @@
[
{
"start": "2025-06-10T19:00:00",
"end": "2025-06-10T21:00:00",
"title": "June 2025 Online Catch Up",
"location": "Jitsi"
},
{
"start": "2025-06-19T18:30:00",
"end": "2025-06-19T21:00:00",
"title": "June 2025 In Person Catch Up",
"location": "Chermside Library"
}
]