eventmanager/calendar.php

41 lines
1.3 KiB
PHP

<?PHP
$filename='event_cal.ics';
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=' . $filename);
$arg1 = $_GET['arg1']; //TITLE
$arg2 = $_GET['arg2']; //DESCRIPTION
$arg3 = $_GET['arg3']; //DATE_START
$arg4 = $_GET['arg4']; //DATE_STOP
$arg5 = $_GET['arg5']; //TIME_START
$arg6 = $_GET['arg6']; //TIME_STOP
$arg7 = $_GET['arg7']; //LOCATION
function escape_String($string) {
return $string;
}
function date_convert($string1,$string2) {
$date_conv = str_replace("-", "", $string1);
$time_conv = str_replace(":", "", $string2);
return $date_conv."T".$time_conv."00";
}
?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTEND;TZID="Central European Standard Time":<?= date_convert($arg3,$arg5) ?><?php echo PHP_EOL;?>
UID:<?= uniqid() ?><?php echo PHP_EOL;?>
DTSTAMP:20181031T105919Z
LOCATION:<?= escape_String($arg7) ?><?php echo PHP_EOL;?>
DESCRIPTION:<?= escape_String($arg2) ?><?php echo PHP_EOL;?>
URL;VALUE=URI:http://127.0.0.1/event/events.php
SUMMARY:<?= escape_String($arg1) ?><?php echo PHP_EOL;?>
DTSTART;TZID="Central European Standard Time":<?= date_convert($arg4,$arg6) ?><?php echo PHP_EOL;?>
END:VEVENT
END:VCALENDAR