| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'get.php')
| -rw-r--r-- | get.php | 74 |
1 files changed, 74 insertions, 0 deletions
@@ -0,0 +1,74 @@ +<?php + header('Content-Type: text/calendar; charset=UTF-8'); + + $group = $_GET["g"]; + $modules = explode(",", $_GET["m"]); + + if (!preg_match("/^[0-9A-Za-z_-]+$/", $group)) + { + echo "[E] Invalid group ID: " . $group; + + exit -1; + } + + $vcalendar = "BEGIN:VCALENDAR\r\n"; + $vcalendar .= "VERSION:2.0\r\n"; + $vcalendar .= "PRODID:-//MultiAgentSystems.org//University Calendar//EN\r\n"; + $vcalendar .= "CALSCALE:GREGORIAN\r\n"; + $vcalendar .= "METHOD:PUBLISH\r\n"; + $vcalendar .= "X-WR-CALNAME:"; + $vcalendar .= str_replace("_", " ", $group); + $vcalendar .= "\r\n"; + $vcalendar .= "X-WR-TIMEZONE:Europe/Paris\r\n"; + $vcalendar .= "BEGIN:VTIMEZONE\r\n"; + $vcalendar .= "TZID:Europe/Paris\r\n"; + $vcalendar .= "X-LIC-LOCATION:Europe/Paris\r\n"; + $vcalendar .= "BEGIN:DAYLIGHT\r\n"; + $vcalendar .= "TZOFFSETFROM:+0100\r\n"; + + $vcalendar .= "TZOFFSETTO:+0200\r\n"; + $vcalendar .= "TZNAME:CEST\r\n"; + $vcalendar .= "DTSTART:19810329T020000\r\n"; + $vcalendar .= "RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\n"; + $vcalendar .= "END:DAYLIGHT\r\n"; + $vcalendar .= "BEGIN:STANDARD\r\n"; + $vcalendar .= "TZOFFSETFROM:+0200\r\n"; + $vcalendar .= "TZOFFSETTO:+0100\r\n"; + $vcalendar .= "TZNAME:CET\r\n"; + $vcalendar .= "DTSTART:19961027T030000\r\n"; + $vcalendar .= "RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\n"; + $vcalendar .= "END:STANDARD\r\n"; + $vcalendar .= "END:VTIMEZONE\r\n"; + + echo $vcalendar; + + foreach ($modules as $module) + { + $ics_fragment = "output/" . $group . "_" . $module . ".ics"; + if (!preg_match("/^[0-9A-Za-z_-]+$/", $module)) + { + echo "[E] Invalid module ID: " . $module; + + exit -1; + } + + if (file_exists($ics_fragment)) + { + readfile($ics_fragment); + } + } + + $group_ics_file = $group . ".ics"; + + if (file_exists($group_ics_file)) + { + readfile($group_ics_file); + } + + if (file_exists("warnings.ics")) + { + readfile("warnings.ics"); + } + + echo "END:VCALENDAR"; +?> |


