diff --git a/Readme.md b/Readme.md index 3602191..293e5f3 100644 --- a/Readme.md +++ b/Readme.md @@ -10,7 +10,7 @@ Entwickelt von **[Loheide.eu](https://loheide.eu)** ![MySQL](https://img.shields.io/badge/MySQL-5.7%2B%20%2F%20MariaDB-4479A1?logo=mysql&logoColor=white) ![UniFi OS](https://img.shields.io/badge/UniFi%20OS-7.0%2B-0559C9?logo=ubiquiti&logoColor=white) ![License](https://img.shields.io/badge/Lizenz-MIT-green) -![Version](https://img.shields.io/badge/Version-2.8.0-blueviolet) +![Version](https://img.shields.io/badge/Version-2.9.0-blueviolet) ![Tests](https://img.shields.io/badge/Tests-PHPUnit%20%2B%20PHPStan-brightgreen) [![Repository](https://img.shields.io/badge/Code-git.loheide.cloud-4b3ec4)](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool) @@ -248,6 +248,10 @@ Personal am Tresen. | Überschrift / Text | was auf dem Bildschirm steht | | Codes pro Tag | Obergrenze je Kalendertag (0 = unbegrenzt) | | Wartezeit | Abstand zwischen zwei Codes an diesem Display | +| Wartezeit je Gerät | zusätzliche Sperre pro Browser (Cookie) – gegen das Leerziehen durch eine Person | +| Servicezeiten | z. B. 06:00–23:00; außerhalb erscheint ein Hinweis statt des Knopfes. Fenster über Mitternacht möglich | +| PIN | optionale Eingabe, sinnvoll bei frei zugänglichen Bildschirmen | +| Sprache | feste Sprache des Displays oder automatisch nach Browsersprache | | Anzeigedauer | danach springt der Bildschirm automatisch zurück | Jede Seite hat einen **eigenen, geheimen Link** (`kiosk.php?k=…`). Er lässt sich @@ -276,9 +280,14 @@ Logo und Hintergrund lassen sich direkt hochladen (PNG, JPG, WEBP, GIF, SVG bis 3 MB) oder als URL hinterlegen; beim Löschen einer Display-Seite verschwinden die hochgeladenen Dateien mit. -Die ausgegebenen Codes erscheinen normal in *Live Vouchers*, im *Reporting* und -im *Audit-Log* (Aktion „Voucher am Display geholt"), sodass jederzeit -nachvollziehbar bleibt, woher ein Zugang stammt. +Die ausgegebenen Codes erscheinen normal in *Live Vouchers*, im *Reporting* – +dort gibt es eine eigene Auswertung **„Pro Display-Seite"** – und im *Audit-Log* +(Aktion „Voucher am Display geholt"), sodass jederzeit nachvollziehbar bleibt, +woher ein Zugang stammt. + +In der Verwaltung zeigt **„Vorschau"** die Seite direkt im Admin-Bereich, ohne +den Tab zu wechseln. Gäste können die Sprache unten auf dem Display selbst +umschalten. > Display-Seiten funktionieren unabhängig vom globalen öffentlichen Modus – der > geheime Link ist der Zugang. Webhook-Benachrichtigungen werden für diese Codes @@ -702,7 +711,7 @@ dem Git-Hoster.
-**Version 2.8.0** · Autor: **Friederich Loheide** · Lizenz: **MIT** +**Version 2.9.0** · Autor: **Friederich Loheide** · Lizenz: **MIT** Entwickelt von **[Loheide.eu](https://loheide.eu)** diff --git a/VERSION b/VERSION index 834f262..c8e38b6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.8.0 +2.9.0 diff --git a/admin/backup.php b/admin/backup.php index e2bf628..5908cf4 100644 --- a/admin/backup.php +++ b/admin/backup.php @@ -37,7 +37,8 @@ if (isset($_GET['export']) && isset($_GET['token']) && $auth->validateCsrfToken( 'kiosks' => $db->fetchAll( "SELECT k.name, k.token, k.headline, k.subline, k.logo_url, k.background_url, k.bg_overlay, k.accent_color, k.card_style, k.daily_limit, - k.cooldown_seconds, k.display_seconds, k.is_active, + k.cooldown_seconds, k.display_seconds, k.active_from, k.active_to, + k.device_cooldown_seconds, k.pin, k.language, k.is_active, s.name AS site_name, t.name AS template_name FROM kiosks k INNER JOIN sites s ON s.id = k.site_id @@ -126,22 +127,28 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['import'])) { $k['logo_url'] ?? null, $k['background_url'] ?? null, (int)($k['bg_overlay'] ?? 45), $k['accent_color'] ?? null, ($k['card_style'] ?? 'light') === 'dark' ? 'dark' : 'light', (int)($k['daily_limit'] ?? 100), (int)($k['cooldown_seconds'] ?? 20), - (int)($k['display_seconds'] ?? 90), (int)($k['is_active'] ?? 1), + (int)($k['display_seconds'] ?? 90), + $k['active_from'] ?? null, $k['active_to'] ?? null, + (int)($k['device_cooldown_seconds'] ?? 0), + $k['pin'] ?? null, $k['language'] ?? null, + (int)($k['is_active'] ?? 1), ]; if ($exists) { $db->query( "UPDATE kiosks SET site_id=?, template_id=?, name=?, headline=?, subline=?, logo_url=?, background_url=?, bg_overlay=?, accent_color=?, card_style=?, daily_limit=?, - cooldown_seconds=?, display_seconds=?, is_active=? WHERE id=?", + cooldown_seconds=?, display_seconds=?, active_from=?, active_to=?, + device_cooldown_seconds=?, pin=?, language=?, is_active=? WHERE id=?", array_merge($values, [(int)$exists['id']]) ); } else { $db->query( "INSERT INTO kiosks (site_id, template_id, name, headline, subline, logo_url, background_url, bg_overlay, accent_color, card_style, daily_limit, cooldown_seconds, display_seconds, + active_from, active_to, device_cooldown_seconds, pin, language, is_active, token, created_by) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array_merge($values, [$k['token'] ?? Kiosk::newToken(), $_SESSION['user_id'] ?? null]) ); } diff --git a/admin/kiosks.php b/admin/kiosks.php index 769ba4c..c300451 100644 --- a/admin/kiosks.php +++ b/admin/kiosks.php @@ -44,9 +44,22 @@ function kioskInput(): array 'bg_overlay' => max(0, min(90, (int)($_POST['bg_overlay'] ?? 45))), 'accent_color' => self_accent($_POST['accent_color'] ?? ''), 'card_style' => ($_POST['card_style'] ?? 'light') === 'dark' ? 'dark' : 'light', + 'active_from' => self_time($_POST['active_from'] ?? ''), + 'active_to' => self_time($_POST['active_to'] ?? ''), + 'device_cooldown_seconds' => max(0, min(86400, (int)($_POST['device_cooldown_seconds'] ?? 0))), + 'pin' => preg_replace('/[^0-9A-Za-z]/', '', (string)($_POST['pin'] ?? '')) ?: null, + 'language' => in_array($_POST['language'] ?? '', ['de', 'en'], true) ? $_POST['language'] : null, ]; } +/** Uhrzeit im Format HH:MM oder nichts. */ +function self_time($value): ?string +{ + $value = trim((string)$value); + + return preg_match('/^([01]\d|2[0-3]):[0-5]\d$/', $value) ? $value : null; +} + /** Nur echte Hex-Farben durchlassen – der Wert landet in einem style-Attribut. */ function self_accent($value): ?string { @@ -70,12 +83,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_kiosk'])) { $db->execute( "INSERT INTO kiosks (site_id, template_id, name, token, headline, subline, logo_url, background_url, bg_overlay, accent_color, card_style, - daily_limit, cooldown_seconds, display_seconds, is_active, created_by) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)", + daily_limit, cooldown_seconds, display_seconds, + active_from, active_to, device_cooldown_seconds, pin, language, + is_active, created_by) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)", [$in['site_id'], $in['template_id'], $in['name'], Kiosk::newToken(), $in['headline'], $in['subline'], $logo, $bg, $in['bg_overlay'], $in['accent_color'], $in['card_style'], $in['daily_limit'], - $in['cooldown_seconds'], $in['display_seconds'], $_SESSION['user_id']] + $in['cooldown_seconds'], $in['display_seconds'], + $in['active_from'], $in['active_to'], $in['device_cooldown_seconds'], + $in['pin'], $in['language'], $_SESSION['user_id']] ); $auth->writeAuditLog($_SESSION['user_id'], 'kiosk_created', 'kiosk', null, $in['name']); $success = __('kiosks_added'); @@ -102,11 +119,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['edit_kiosk'])) { $db->execute( "UPDATE kiosks SET site_id=?, template_id=?, name=?, headline=?, subline=?, logo_url=?, background_url=?, bg_overlay=?, accent_color=?, card_style=?, - daily_limit=?, cooldown_seconds=?, display_seconds=?, is_active=? + daily_limit=?, cooldown_seconds=?, display_seconds=?, + active_from=?, active_to=?, device_cooldown_seconds=?, pin=?, language=?, + is_active=? WHERE id=?", [$in['site_id'], $in['template_id'], $in['name'], $in['headline'], $in['subline'], $logo, $bg, $in['bg_overlay'], $in['accent_color'], $in['card_style'], - $in['daily_limit'], $in['cooldown_seconds'], $in['display_seconds'], $in['is_active'], $id] + $in['daily_limit'], $in['cooldown_seconds'], $in['display_seconds'], + $in['active_from'], $in['active_to'], $in['device_cooldown_seconds'], + $in['pin'], $in['language'], $in['is_active'], $id] ); $auth->writeAuditLog($_SESSION['user_id'], 'kiosk_updated', 'kiosk', $id, $in['name']); $success = __('kiosks_updated'); @@ -227,6 +248,18 @@ $adminBase = '';
+ +
+ + – +
+ + +
+ + : +
+ @@ -248,6 +281,10 @@ $adminBase = ''; onclick="showQr('', '')"> + + + + + +