Asked for: when the share for the Consilium ends, everyone from the Consilium is sent back to the live overview (so far only the live view ended and the map stayed open); during the session they may not switch maps or see the categories - really only the tactic. - map_frame.php: Consilium guests get the map viewer only for a running shared session (?karte=...&taktik=...), otherwise the whole page goes back to the session list; the viewer gets LUMINA_GUEST. - Viewer guest mode (body.guest-mode): no map picker, no markers or categories (not even loaded), no location sharing, no tactic list - only the tactic of the session (tactics_api.php ?taktik=). - When the share ends (relay event, tactic gone, no ticket), TacticController.endGuestSession() sends the top page to map.php?beendet=stopped|ended with a note why; the page around the map also checks every 15 s. - Calendar: no location picker for guests, meeting points are plain text for them (map_link_html()). - README, patch note text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
3.3 KiB
PHP
72 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* Liefert den Karten-Viewer (assets/map/index.html) mit Versionskennung an Skripten und Stylesheet
|
|
* aus. Sonst behalten Browser nach einem Update die alten Dateien im Zwischenspeicher, und neue
|
|
* Funktionen (z.B. Orte teilen/auswaehlen) fehlen, bis jemand den Cache leert.
|
|
* Der Ordner assets/map/ darf selbst kein PHP ausfuehren (siehe .htaccess dort) - deshalb hier.
|
|
* Die Parameter (?karte=...&x=...&pick=1) liest der Viewer selbst aus der Adresse.
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
// Nur fuer freigeschaltete Mitglieder - Kacheln und Marker stammen von interactivemap.app und sind
|
|
// nicht fuer die Oeffentlichkeit gedacht (Karte auf map.php, Ortsauswahl im Kalender).
|
|
$frameUser = current_user();
|
|
if (!$frameUser || $frameUser['status'] !== 'active') {
|
|
show_not_found();
|
|
}
|
|
|
|
// Mitglieder verbuendeter Legionen (Consilium Elyseum) bekommen die Karte nur fuer eine laufende, fuer sie
|
|
// freigegebene Live-Sitzung (?karte=...&taktik=..., map.php) - und dort nur diese Taktik: keine Kartenwahl, keine
|
|
// Marker und Kategorien, keine Orte (LUMINA_GUEST, assets/map/js/controllers/MapController.js). Sonst - Sitzung
|
|
// vorbei, Ortsauswahl, direkt aufgerufen - geht die ganze Seite zurueck zur Liste der Live-Sitzungen.
|
|
require_once __DIR__ . '/includes/consilium.php';
|
|
$frameGuest = null;
|
|
if (consilium_only()) {
|
|
require_once __DIR__ . '/includes/tactics.php';
|
|
$karte = (string) ($_GET['karte'] ?? '');
|
|
$taktik = (int) ($_GET['taktik'] ?? 0);
|
|
try {
|
|
$sessions = tactics_missing_tables() ? [] : tactics_consilium_sessions();
|
|
} catch (Throwable $e) {
|
|
$sessions = [];
|
|
}
|
|
foreach ($sessions as $session) {
|
|
if ($session['tactic_id'] === $taktik && $session['map_slug'] === $karte) {
|
|
$frameGuest = ['karte' => $karte, 'taktik' => $taktik];
|
|
}
|
|
}
|
|
if ($frameGuest === null) {
|
|
header('Content-Type: text/html; charset=UTF-8');
|
|
header('Cache-Control: no-store');
|
|
echo '<!DOCTYPE html><html lang="de"><head><meta charset="UTF-8"><title>Live-Sitzung beendet</title></head><body>'
|
|
. '<script>window.top.location.replace("/map.php?beendet=1");</script>'
|
|
. '<p><a href="/map.php" target="_top">Zu den Live-Sitzungen</a></p></body></html>';
|
|
exit;
|
|
}
|
|
}
|
|
|
|
$dir = __DIR__ . '/assets/map/';
|
|
$html = (string) file_get_contents($dir . 'index.html');
|
|
|
|
// Relative Pfade (styles.css, js/..., data/...) weiter auf assets/map/ beziehen
|
|
$html = str_replace('<head>', "<head>\n <base href=\"/assets/map/\">", $html);
|
|
if ($frameGuest !== null) {
|
|
$html = str_replace('</head>', ' <script>window.LUMINA_GUEST = '
|
|
. json_encode($frameGuest, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) . ";</script>\n</head>", $html);
|
|
}
|
|
|
|
// Versionskennung = Aenderungsdatum der Datei
|
|
$html = (string) preg_replace_callback(
|
|
'~(<script src="|<link rel="stylesheet" href=")([^"?]+\.(?:js|css))"~',
|
|
static function (array $m) use ($dir): string {
|
|
$file = $dir . $m[2];
|
|
return $m[1] . $m[2] . (is_file($file) ? '?v=' . filemtime($file) : '') . '"';
|
|
},
|
|
$html
|
|
);
|
|
|
|
header('Content-Type: text/html; charset=UTF-8');
|
|
// Die Seite selbst nicht zwischenspeichern - sie ist klein und traegt die Versionen
|
|
header('Cache-Control: no-cache');
|
|
echo $html;
|