49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta http-equiv="refresh" content="5; URL=index.php?time=<?php echo time() ?>">
|
|
|
|
|
|
<title>Events</title>
|
|
</head>
|
|
<body>
|
|
|
|
<?php
|
|
$ical = file_get_contents("https://www.un-hack-bar.de/events.ics");
|
|
$icalLines = explode("\n", $ical);
|
|
$events = array();
|
|
$eventData = array();
|
|
|
|
foreach ($icalLines as $line)
|
|
{
|
|
$data = explode(":", trim($line), 2);
|
|
|
|
if($data[0] == "SUMMARY")
|
|
$eventData['SUMMARY'] = str_replace("[UNHB] ", "", $data[1]);
|
|
|
|
if($data[0] == "DTSTAMP")
|
|
$eventData['DTSTAMP'] = date('d M Y', strtotime(substr($data[1], 0, 8)));
|
|
|
|
if($data[0] == "END" and $data[1] == "VEVENT")
|
|
{
|
|
array_unshift($events, $eventData);
|
|
$eventData = array();
|
|
}
|
|
|
|
if(count($events) == 3)
|
|
break;
|
|
}
|
|
|
|
|
|
foreach ($events as $thisEvent)
|
|
{
|
|
echo "<h1>".$thisEvent['DTSTAMP']." => ".$thisEvent['SUMMARY']."</h1>";
|
|
}
|
|
|
|
?>
|
|
</body>
|
|
</html>
|
|
|
|
|