The legion is "Lumina Ascendens". The visible texts already had it right; the missing "n" was only left in addresses. - The default operator email (Impressum, privacy policy) is now info@lumina-ascendens.de instead of the forwarding address of Online-Impressum.de. The privacy policy, the hint in Verwaltung -> Impressum & Datenschutz and the README now say that the service only forwards post. - The placeholder in admin/legal.php and the HTTP_HOST fallbacks for map links and Twitch embeds use lumina-ascendens.de. - The link to online-impressum.de/lumina-ascendes stays: the page there still has that name (/lumina-ascendens is a 404). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.8 KiB
PHP
78 lines
2.8 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
/**
|
||
* Links auf Orte der Karte (/map.php?karte=verteron&x=1234&y=2345&zoom=5&ort=Treffpunkt),
|
||
* erzeugt ueber "Ort teilen" bzw. "Ort auswaehlen" (assets/map/js/controllers/LocationController.js).
|
||
* Hier: erkennen, pruefen und als "📍 Verteron – Treffpunkt" anzeigen.
|
||
*/
|
||
|
||
// Anzeigenamen der Karten (wie data/maps.json + CONFIG.MAP_NAMES im Viewer)
|
||
const MAP_LINK_NAMES = [
|
||
'verteron' => 'Verteron',
|
||
'elthen' => 'Eltnen',
|
||
'poeta' => 'Poeta',
|
||
'altgard' => 'Altgard',
|
||
'morheim' => 'Morheim',
|
||
'ishalgen' => 'Ishalgen',
|
||
'abyss-reshanta-a' => 'Abyss Reshanta A',
|
||
'abyss-reshanta-b' => 'Abyss Reshanta B',
|
||
'chaotic-middle-reshanta' => 'Chaotic Middle Reshanta',
|
||
'chaotic-upper-reshanta' => 'Chaotic Upper Reshanta',
|
||
];
|
||
|
||
/** Regex fuer Karten-Links dieser Website (absolut mit unserer Domain oder relativ). */
|
||
function map_link_pattern(): string
|
||
{
|
||
$host = preg_quote((string) ($_SERVER['HTTP_HOST'] ?? 'lumina-ascendens.de'), '~');
|
||
return '~(?:https?://(?:www\.)?' . $host . ')?/map\.php\?[^\s<>"\']+~i';
|
||
}
|
||
|
||
/**
|
||
* Karten-Link zerlegen und pruefen.
|
||
*
|
||
* @return array{slug: string, x: int, y: int, zoom: int, ort: string, path: string}|null
|
||
*/
|
||
function map_link_parse(string $url): ?array
|
||
{
|
||
$url = html_entity_decode(trim($url), ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||
if (!preg_match(map_link_pattern(), $url, $match) || $match[0] !== $url) {
|
||
return null;
|
||
}
|
||
parse_str((string) parse_url($url, PHP_URL_QUERY), $query);
|
||
$slug = (string) ($query['karte'] ?? '');
|
||
if (!isset(MAP_LINK_NAMES[$slug]) || !is_numeric($query['x'] ?? null) || !is_numeric($query['y'] ?? null)) {
|
||
return null;
|
||
}
|
||
$link = [
|
||
'slug' => $slug,
|
||
'x' => max(0, min(4096, (int) $query['x'])),
|
||
'y' => max(0, min(4096, (int) $query['y'])),
|
||
'zoom' => max(2, min(6, (int) ($query['zoom'] ?? 5))),
|
||
'ort' => mb_substr(trim((string) ($query['ort'] ?? '')), 0, 60),
|
||
];
|
||
$params = ['karte' => $link['slug'], 'x' => $link['x'], 'y' => $link['y'], 'zoom' => $link['zoom']];
|
||
if ($link['ort'] !== '') {
|
||
$params['ort'] = $link['ort'];
|
||
}
|
||
$link['path'] = '/map.php?' . http_build_query($params);
|
||
return $link;
|
||
}
|
||
|
||
/** "Verteron – Treffpunkt Brücke" */
|
||
function map_link_label(array $link): string
|
||
{
|
||
return MAP_LINK_NAMES[$link['slug']] . ($link['ort'] !== '' ? ' – ' . $link['ort'] : '');
|
||
}
|
||
|
||
/** Huebscher Link mit Pin fuer Texte (Kommentare, Termine). */
|
||
function map_link_html(array $link): string
|
||
{
|
||
return '<a class="map-link" href="' . e($link['path']) . '" title="Auf der Karte zeigen">📍 ' . e(map_link_label($link)) . '</a>';
|
||
}
|
||
|
||
/** Text ohne eigene Karten-Links - die zaehlen fuer die Moderation nicht als "Link". */
|
||
function map_links_strip(string $text): string
|
||
{
|
||
return (string) preg_replace(map_link_pattern(), ' ', $text);
|
||
}
|