This commit is contained in:
26
public/page/calendar/export.php
Normal file
26
public/page/calendar/export.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\App;
|
||||
use App\CalendarSync;
|
||||
|
||||
$app = App::get();
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
http_response_code(403);
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo 'Login erforderlich.';
|
||||
return;
|
||||
}
|
||||
|
||||
$calendarSync = new CalendarSync($app);
|
||||
$calendarSync->ensureSchema();
|
||||
|
||||
$userId = (int)$_SESSION['user_id'];
|
||||
$ics = $calendarSync->renderUserCalendarIcs($userId, 'Papa-Kind-Treff Events');
|
||||
|
||||
header('Content-Type: text/calendar; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="papa-kind-treff-events.ics"');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
|
||||
echo $ics;
|
||||
Reference in New Issue
Block a user