Asked for: "füge ein, dass man sich für premaids auch bewerben kann" - every premade with a free place takes
applications unless its lead switches them off, and the bot sends DMs (a new application to the lead, a decline
to the applicant). Later: "man soll sich auch auf reserveplätze bewerben können".
- includes/premade_applications.php: the applications live on the website (premade_applications: premade ID and
name, lead at that time, applicant, class, wished place group/reserve, message, status open/accepted/declined/
withdrawn/closed, reason, who decided when; premade_options.applications_open). Rules: one open application
per premade, at most 3 open in total, 7 days pause after a decline by the same premade, none while invited,
when full or switched off. premade_applications_sync() matches them with the bot: applications of dissolved
premades are closed, whoever is in the premade by now counts as accepted, name and lead stay current,
decisions expire after 30 days.
- premades.php: "Bewerben" under every other premade with a free place. The popup asks for the place (group or
reserve, taken places greyed out; the group is preselected unless it is full), the class (main preselected)
and an optional message. "Meine Bewerbungen" lists the own ones with the answer for 14 days, withdrawing
works there and on the card. Leads and the leadership (premades.manage) see open applications on the card,
also outside the edit mode, with a "Reserve" tag and a confirmation that names the place; their number shows
at the menu item "Premades" (premades without a lead count for the leadership). The edit mode switches
applications off and on.
- premade_action.php: apply (checks the rules and the chosen place again), withdraw, application_accept (the
bot puts the applicant on the wished place, on the other one if it was taken meanwhile; an open invitation
becomes the membership on its place), application_decline (optional reason), applications_toggle. An
invitation to someone with an open application carries its class, also when accepted in Discord.
Dissolving a premade closes its applications, a new lead takes over the open ones.
- includes/raids_api.php: add_premade_member() passes the wished place and returns the place the bot gave;
premade_free_slots().
- Bot (already deployed, with a backup): POST /api/premades/{id}/applications sends the DMs (to the lead with
place, class, message and a link to the card; to the applicant with the reason), POST /members with source
"application" tells the applicant where they ended up and, when the leadership accepted, the lead;
add_premade_member() takes the wished place. If the bot cannot send a DM, the application is stored anyway.
- Live updates of the page and the menu number, schema version 62 (tables also in sql/schema.sql).
- Privacy: privacy policy (what is stored, who sees it, for how long), data export section premade_bewerbungen,
account deletion, data reset area "Premade-Bewerbungen".
- Patch notes and README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
182 lines
8.2 KiB
PHP
182 lines
8.2 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
/**
|
||
* Impressum und Datenschutz (impressum.php, datenschutz.php).
|
||
*
|
||
* Name, Anschrift und E-Mail des Betreibers sowie den Hoster traegt die Leitung unter
|
||
* admin/legal.php ein (Tabelle settings, Recht site.legal). Die Links dazu stehen unten auf den
|
||
* oeffentlichen Seiten, in der Seitenleiste und auf der Wartungsseite.
|
||
*
|
||
* Inhalte von fremden Servern (Videos von YouTube/Twitch/Vimeo, Bilder und Videodateien anderer
|
||
* Seiten im Wiki) laden erst nach einem Klick: embed_consent_html() setzt einen Platzhalter,
|
||
* assets/js/embed-consent.js laedt den Inhalt. Vorher geht keine Anfrage an den Anbieter.
|
||
*/
|
||
|
||
// Stand der Datenschutzerklaerung - bei inhaltlichen Aenderungen an datenschutz.php mitziehen.
|
||
const LEGAL_PRIVACY_UPDATED = '2026-09-27';
|
||
|
||
// Betreiber: ladungsfaehige Anschrift ueber den Impressum-Service Online-Impressum.de (Clear-Media UG,
|
||
// nimmt Post an und leitet sie weiter; online-impressum.de/lumina-ascendes - die Seite dort heisst
|
||
// ohne das zweite "n"), E-Mail ueber die eigene Domain (Postfach bei Living-Bots). Unter
|
||
// admin/legal.php ueberschreibbar - leere Felder dort bedeuten "diese Angaben".
|
||
const LEGAL_OPERATOR_DEFAULT = [
|
||
'name' => 'Max Olchov',
|
||
'address' => "c/o Online-Impressum 11235\nEuroparing 90\n53757 Sankt Augustin",
|
||
'email' => 'info@lumina-ascendens.de',
|
||
];
|
||
|
||
// Hoster der Website (Webspace plesk2.living-bots.net) laut Impressum von Living-Bots -
|
||
// unter admin/legal.php ueberschreibbar.
|
||
const LEGAL_HOSTER_DEFAULT = "Living-Bots.net, Oliver Horscht\nSYNLINQ c/o Living-Bots.net\nHanauer Landstraße 328–330\n60314 Frankfurt am Main";
|
||
|
||
const LEGAL_NAME_MAX = 120;
|
||
const LEGAL_ADDRESS_MAX = 400;
|
||
const LEGAL_EMAIL_MAX = 190;
|
||
const LEGAL_HOSTER_MAX = 400;
|
||
|
||
// Anbieter eingebetteter Videos: Schluessel => Name, Unternehmen, Datenschutzerklaerung.
|
||
// Bilder und Videodateien anderer Server laufen als "host:<Servername>".
|
||
const EMBED_PROVIDERS = [
|
||
'youtube' => ['label' => 'YouTube', 'company' => 'Google', 'privacy' => 'https://policies.google.com/privacy'],
|
||
'twitch' => ['label' => 'Twitch', 'company' => 'Twitch Interactive', 'privacy' => 'https://www.twitch.tv/p/legal/privacy-notice/'],
|
||
'vimeo' => ['label' => 'Vimeo', 'company' => 'Vimeo', 'privacy' => 'https://vimeo.com/privacy'],
|
||
];
|
||
|
||
/**
|
||
* Angaben des Betreibers: was unter admin/legal.php eingetragen ist, sonst LEGAL_OPERATOR_DEFAULT.
|
||
*
|
||
* @return array{name: string, address: string, email: string}
|
||
*/
|
||
function legal_operator(): array
|
||
{
|
||
$operator = [];
|
||
foreach (LEGAL_OPERATOR_DEFAULT as $field => $default) {
|
||
$value = trim(setting_get('legal_' . $field));
|
||
$operator[$field] = $value !== '' ? $value : $default;
|
||
}
|
||
return $operator;
|
||
}
|
||
|
||
/** Hoster fuer die Datenschutzerklaerung (mehrzeilig). */
|
||
function legal_hoster(): string
|
||
{
|
||
$hoster = trim(setting_get('legal_hoster'));
|
||
return $hoster !== '' ? $hoster : LEGAL_HOSTER_DEFAULT;
|
||
}
|
||
|
||
/** Name und Anschrift sind Pflicht (§ 18 Abs. 1 MStV). */
|
||
function legal_complete(): bool
|
||
{
|
||
$operator = legal_operator();
|
||
return $operator['name'] !== '' && $operator['address'] !== '';
|
||
}
|
||
|
||
/** Mehrzeiliger Text als HTML mit Zeilenumbruechen. */
|
||
function legal_lines_html(string $text): string
|
||
{
|
||
return nl2br(e(trim($text)), false);
|
||
}
|
||
|
||
/**
|
||
* mailto-Link mit maskierten Zeichen - gegen Adress-Sammler, die nur Klartext im Quelltext suchen.
|
||
* Im Browser sieht die Adresse ganz normal aus.
|
||
*/
|
||
function legal_email_html(string $email): string
|
||
{
|
||
$masked = '';
|
||
foreach (mb_str_split($email) as $char) {
|
||
$masked .= '&#' . mb_ord($char) . ';';
|
||
}
|
||
return '<a href="mailto:' . $masked . '">' . $masked . '</a>';
|
||
}
|
||
|
||
/** Links zu Impressum und Datenschutzerklaerung (Footer, Seitenleiste, Wartungsseite). */
|
||
function legal_links_html(string $class = 'legal-links'): string
|
||
{
|
||
return '<nav class="' . e($class) . '" aria-label="Rechtliches">'
|
||
. '<a href="/impressum.php">Impressum</a><span aria-hidden="true">·</span><a href="/datenschutz.php">Datenschutz</a>'
|
||
. '</nav>';
|
||
}
|
||
|
||
/** Gehoert die Adresse zu dieser Website? Relative Adressen (/assets/...) immer. */
|
||
function legal_is_own_url(string $url): bool
|
||
{
|
||
$host = strtolower((string) parse_url($url, PHP_URL_HOST));
|
||
if ($host === '') {
|
||
return true;
|
||
}
|
||
$own = strtolower((string) preg_replace('/:\d+$/', '', (string) ($_SERVER['HTTP_HOST'] ?? '')));
|
||
$strip = static fn (string $h): string => (string) preg_replace('/^www\./', '', $h);
|
||
return $own !== '' && $strip($host) === $strip($own);
|
||
}
|
||
|
||
/** Schluessel fuer Inhalte eines fremden Servers ("host:cdn.example.com"). */
|
||
function embed_host_provider(string $url): string
|
||
{
|
||
$host = strtolower((string) parse_url($url, PHP_URL_HOST));
|
||
return 'host:' . preg_replace('/^www\./', '', $host);
|
||
}
|
||
|
||
/** Anzeigename eines Anbieters: "YouTube" bzw. der Servername. */
|
||
function embed_provider_label(string $provider): string
|
||
{
|
||
if (isset(EMBED_PROVIDERS[$provider])) {
|
||
return EMBED_PROVIDERS[$provider]['label'];
|
||
}
|
||
return str_starts_with($provider, 'host:') ? substr($provider, 5) : $provider;
|
||
}
|
||
|
||
/**
|
||
* Platzhalter fuer einen Inhalt von einem fremden Server. Erst ein Klick auf "laden" setzt den
|
||
* eigentlichen Inhalt ein (assets/js/embed-consent.js).
|
||
*
|
||
* @param string $kind video (Player im iframe), videofile (<video>) oder image (<img>)
|
||
* @param string $provider Schluessel aus EMBED_PROVIDERS oder "host:<Servername>"
|
||
* @param string $src Adresse des Inhalts (unmaskiert)
|
||
* @param array{class?: string, title?: string, alt?: string, autoplay_src?: string} $opts
|
||
*/
|
||
function embed_consent_html(string $kind, string $provider, string $src, array $opts = []): string
|
||
{
|
||
$isImage = $kind === 'image';
|
||
$label = embed_provider_label($provider);
|
||
$known = EMBED_PROVIDERS[$provider] ?? null;
|
||
|
||
$attrs = ' data-embed="' . e($kind) . '" data-embed-provider="' . e($provider) . '" data-embed-src="' . e($src) . '"';
|
||
if (!empty($opts['autoplay_src'])) {
|
||
$attrs .= ' data-embed-autoplay-src="' . e($opts['autoplay_src']) . '"';
|
||
}
|
||
if (isset($opts['title'])) {
|
||
$attrs .= ' data-embed-title="' . e($opts['title']) . '"';
|
||
}
|
||
if (isset($opts['alt'])) {
|
||
$attrs .= ' data-embed-alt="' . e($opts['alt']) . '"';
|
||
}
|
||
$class = trim(($opts['class'] ?? '') . ' embed-consent' . ($isImage ? ' embed-consent-image' : ''));
|
||
|
||
if ($isImage) {
|
||
$alt = trim((string) ($opts['alt'] ?? ''));
|
||
$title = 'Bild' . ($alt !== '' ? ' „' . e($alt) . '“' : '') . ' von ' . e($label);
|
||
$text = 'Liegt auf einem fremden Server. Erst wenn du es lädst, verbindet sich dein Browser damit - dabei wird z. B. deine IP-Adresse übertragen.';
|
||
} else {
|
||
$title = 'Video von ' . e($label);
|
||
$text = $known !== null
|
||
? 'Erst wenn du es lädst, verbindet sich dein Browser mit ' . e($label) . ($known['company'] !== $known['label'] ? ' (' . e($known['company']) . ')' : '')
|
||
. ' - dabei werden z. B. deine IP-Adresse und Angaben zu deinem Gerät übertragen.'
|
||
: 'Liegt auf einem fremden Server. Erst wenn du es lädst, verbindet sich dein Browser damit - dabei wird z. B. deine IP-Adresse übertragen.';
|
||
}
|
||
$remember = $known !== null ? 'Videos von ' . e($label) . ' immer direkt laden' : 'Inhalte von ' . e($label) . ' immer direkt laden';
|
||
|
||
// Bilder stehen mitten im Text (<p>) - dort sind nur Inline-Elemente erlaubt. Sie koennen auch in
|
||
// einem Link stehen ([](...)); ein zweiter Link darin wuerde den Platzhalter zerreissen.
|
||
$tag = $isImage ? 'span' : 'div';
|
||
$more = $isImage ? '' : ' <a href="/datenschutz.php#eingebettete-inhalte">Mehr dazu</a>';
|
||
return '<' . $tag . ' class="' . e($class) . '"' . $attrs . '>'
|
||
. '<span class="embed-consent-inner">'
|
||
. '<span class="embed-consent-title">' . $title . '</span>'
|
||
. '<span class="embed-consent-text">' . $text . $more . '</span>'
|
||
. '<button type="button" class="button button-small" data-embed-load>' . ($isImage ? 'Bild laden' : 'Video laden') . '</button>'
|
||
. '<label class="embed-consent-remember"><input type="checkbox" data-embed-remember> ' . $remember . '</label>'
|
||
. '</span>'
|
||
. '</' . $tag . '>';
|
||
}
|