feat: Website und Hub zweisprachig (Deutsch/Englisch)
Website (rinkplanner.programmschmiede.de) liegt jetzt im Repo unter web/: Sprachweiche nach Accept-Language (der User-Agent enthält keine Sprache), /de/ und /en/ als eigene URLs mit hreflang, Cookie für die manuelle Wahl, Texte in web/i18n.php, Markup in web/template.php. Deployment über tools/deploy_web.sh (--sync, --check, --all); /index.html leitet weiter. Hub: optionale englische Oberfläche über den DE/EN-Umschalter, Cookie RHUB_LANG, Route /language. Alle Texte (Views, Meldungen, Validierung, API-messages) stehen in hub/app/i18n_strings.php und laufen über t(); Datum und Zahlen folgen der Sprache. Die API behält ihre code-Felder und antwortet ohne Cookie weiter deutsch. deploy_hub.sh --check prüft jetzt Schlüsselparität und fehlende t()-Schlüssel. Doku: docs/website.md neu, docs/hub.md und AGENTS.md ergänzt.
This commit is contained in:
parent
6c8dc942e8
commit
9819311403
41 changed files with 2801 additions and 326 deletions
|
|
@ -90,7 +90,7 @@ function api_handle(string $method, string $path): void
|
|||
|
||||
if ($path === '/api/v1/tokens') {
|
||||
if ($method !== 'POST') {
|
||||
abort_api(405, 'method_not_allowed', 'Nur POST ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.post_only'));
|
||||
}
|
||||
api_create_token();
|
||||
return;
|
||||
|
|
@ -100,7 +100,7 @@ function api_handle(string $method, string $path): void
|
|||
|
||||
if ($path === '/api/v1/me') {
|
||||
if ($method !== 'GET') {
|
||||
abort_api(405, 'method_not_allowed', 'Nur GET ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.get_only'));
|
||||
}
|
||||
json_response([
|
||||
'id' => (int) $user['id'],
|
||||
|
|
@ -128,7 +128,7 @@ function api_handle(string $method, string $path): void
|
|||
if ($method === 'POST') {
|
||||
api_upload($user, null);
|
||||
}
|
||||
abort_api(405, 'method_not_allowed', 'Nur GET oder POST ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.get_or_post'));
|
||||
}
|
||||
|
||||
if (preg_match('#^/api/v1/routines/(\d+)$#', $path, $matches) === 1) {
|
||||
|
|
@ -137,20 +137,20 @@ function api_handle(string $method, string $path): void
|
|||
}
|
||||
if (preg_match('#^/api/v1/routines/(\d+)/(download|audio)$#', $path, $matches) === 1) {
|
||||
if ($method !== 'GET') {
|
||||
abort_api(405, 'method_not_allowed', 'Nur GET ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.get_only'));
|
||||
}
|
||||
$routine = api_fetch_visible((int) $matches[1], $user);
|
||||
routine_send_file($routine, (string) $matches[2], $user, true);
|
||||
}
|
||||
if (preg_match('#^/api/v1/routines/(\d+)/revisions$#', $path, $matches) === 1) {
|
||||
if ($method !== 'POST') {
|
||||
abort_api(405, 'method_not_allowed', 'Nur POST ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.post_only'));
|
||||
}
|
||||
api_upload($user, (int) $matches[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
abort_api(404, 'not_found', 'Unbekannter API-Pfad.');
|
||||
abort_api(404, 'not_found', t('api.unknown_path'));
|
||||
}
|
||||
|
||||
function api_create_token(): void
|
||||
|
|
@ -160,7 +160,7 @@ function api_create_token(): void
|
|||
$password = (string) ($input['password'] ?? '');
|
||||
$name = trim((string) ($input['name'] ?? 'App'));
|
||||
if ($login === '' || $password === '') {
|
||||
abort_api(422, 'invalid_credentials', 'Benutzername und Passwort sind erforderlich.');
|
||||
abort_api(422, 'invalid_credentials', t('api.credentials_required'));
|
||||
}
|
||||
$result = auth_attempt($login, $password);
|
||||
if (!$result['ok']) {
|
||||
|
|
@ -172,7 +172,7 @@ function api_create_token(): void
|
|||
}
|
||||
$user = $result['user'];
|
||||
if ((int) ($user['must_change_password'] ?? 0) === 1) {
|
||||
abort_api(403, 'password_change_required', 'Bitte zuerst im Web das Passwort ändern.');
|
||||
abort_api(403, 'password_change_required', t('api.change_password_web'));
|
||||
}
|
||||
$created = token_create((int) $user['id'], $name);
|
||||
json_response([
|
||||
|
|
@ -191,10 +191,10 @@ function api_fetch_visible(int $id, array $user): array
|
|||
{
|
||||
$routine = routine_fetch($id);
|
||||
if ($routine === null) {
|
||||
abort_api(404, 'not_found', 'Kür nicht gefunden.');
|
||||
abort_api(404, 'not_found', t('routine.not_found_short'));
|
||||
}
|
||||
if (!routine_can_view($routine, $user)) {
|
||||
abort_api(403, 'forbidden', 'Diese Kür ist nicht freigegeben.');
|
||||
abort_api(403, 'forbidden', t('routine.forbidden'));
|
||||
}
|
||||
return $routine;
|
||||
}
|
||||
|
|
@ -207,26 +207,26 @@ function api_routine(int $id, string $method, array $user): void
|
|||
}
|
||||
if ($method === 'DELETE') {
|
||||
if (!routine_can_edit($routine, $user)) {
|
||||
abort_api(403, 'forbidden', 'Nur der Eigentümer oder ein Admin darf die Kür ändern.');
|
||||
abort_api(403, 'forbidden', t('api.edit_forbidden'));
|
||||
}
|
||||
routine_set_status($id, 'hidden');
|
||||
json_response(['id' => $id, 'status' => 'hidden']);
|
||||
}
|
||||
abort_api(405, 'method_not_allowed', 'Nur GET oder DELETE ist erlaubt.');
|
||||
abort_api(405, 'method_not_allowed', t('api.get_or_delete'));
|
||||
}
|
||||
|
||||
function api_upload(array $user, ?int $routineId): void
|
||||
{
|
||||
if (!api_truthy($_POST['rights'] ?? null)) {
|
||||
abort_api(422, 'rights_required', 'Bitte bestätigen, dass Kür und Musik geteilt werden dürfen.');
|
||||
abort_api(422, 'rights_required', t('api.rights_required'));
|
||||
}
|
||||
if (!routine_upload_quota_ok((int) $user['id'])) {
|
||||
abort_api(429, 'upload_limit', 'Stündliches Upload-Limit erreicht.');
|
||||
abort_api(429, 'upload_limit', t('api.upload_limit'));
|
||||
}
|
||||
$package = routine_validate_package($_POST);
|
||||
if (!$package['ok']) {
|
||||
json_response([
|
||||
'error' => ['code' => 'validation_failed', 'message' => 'Die Dateien sind nicht gültig.'],
|
||||
'error' => ['code' => 'validation_failed', 'message' => t('api.invalid_files')],
|
||||
'errors' => $package['errors'],
|
||||
], 422);
|
||||
}
|
||||
|
|
@ -234,22 +234,22 @@ function api_upload(array $user, ?int $routineId): void
|
|||
if ($routineId === null) {
|
||||
$duplicate = routine_duplicate_exists((int) $user['id'], $package);
|
||||
if ($duplicate !== null) {
|
||||
abort_api(409, 'duplicate', 'Diese Kür ist bereits im Hub (ID ' . $duplicate . ').');
|
||||
abort_api(409, 'duplicate', t('api.duplicate', ['id' => $duplicate]));
|
||||
}
|
||||
$routineId = routine_create((int) $user['id'], $package);
|
||||
} else {
|
||||
$routine = routine_fetch($routineId);
|
||||
if ($routine === null) {
|
||||
abort_api(404, 'not_found', 'Kür nicht gefunden.');
|
||||
abort_api(404, 'not_found', t('routine.not_found_short'));
|
||||
}
|
||||
if (!routine_can_edit($routine, $user)) {
|
||||
abort_api(403, 'forbidden', 'Nur der Eigentümer oder ein Admin darf die Kür ändern.');
|
||||
abort_api(403, 'forbidden', t('api.edit_forbidden'));
|
||||
}
|
||||
routine_add_revision($routineId, (int) $user['id'], $package);
|
||||
}
|
||||
$created = routine_fetch($routineId);
|
||||
if ($created === null) {
|
||||
abort_api(500, 'server_error', 'Kür konnte nicht geladen werden.');
|
||||
abort_api(500, 'server_error', t('api.routine_load_failed'));
|
||||
}
|
||||
json_response(api_routine_payload($created), 201);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ function auth_require_admin(): array
|
|||
{
|
||||
$user = auth_require_login();
|
||||
if ($user['role'] !== 'admin') {
|
||||
abort_page(403, 'Dieser Bereich ist nur für Administratoren.');
|
||||
abort_page(403, t('auth.admin_only'));
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ function auth_attempt(string $login, string $password): array
|
|||
$retry = max(60, (int) $first + $window - time());
|
||||
return [
|
||||
'ok' => false,
|
||||
'error' => 'Zu viele Fehlversuche. Bitte in ' . max(1, (int) ceil($retry / 60)) . ' Minuten erneut versuchen.',
|
||||
'error' => t('login.error.rate_limited', ['minutes' => max(1, (int) ceil($retry / 60))]),
|
||||
'retry' => $retry,
|
||||
];
|
||||
}
|
||||
|
|
@ -213,10 +213,10 @@ function auth_attempt(string $login, string $password): array
|
|||
}
|
||||
|
||||
if (!$user || !$valid) {
|
||||
return ['ok' => false, 'error' => 'Benutzername oder Passwort ist falsch.', 'retry' => 0];
|
||||
return ['ok' => false, 'error' => t('login.error.credentials'), 'retry' => 0];
|
||||
}
|
||||
if ($user['status'] !== 'active') {
|
||||
return ['ok' => false, 'error' => 'Dieses Konto ist deaktiviert.', 'retry' => 0];
|
||||
return ['ok' => false, 'error' => t('login.error.disabled'), 'retry' => 0];
|
||||
}
|
||||
if (password_needs_upgrade((string) $user['password_hash'])) {
|
||||
db()->prepare('UPDATE users SET password_hash = ? WHERE id = ?')
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ date_default_timezone_set('UTC');
|
|||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
require HUB_APP . '/i18n.php';
|
||||
require HUB_APP . '/util.php';
|
||||
require HUB_APP . '/db.php';
|
||||
require HUB_APP . '/auth.php';
|
||||
|
|
@ -42,14 +43,16 @@ if (is_dir($storage) && is_writable($storage)) {
|
|||
set_exception_handler(static function (Throwable $error): void {
|
||||
error_log('Hub: ' . $error::class . ': ' . $error->getMessage() . ' in ' . $error->getFile() . ':' . $error->getLine());
|
||||
if (function_exists('wants_json') && wants_json()) {
|
||||
json_response(['error' => ['code' => 'server_error', 'message' => 'Interner Fehler.']], 500);
|
||||
json_response(['error' => ['code' => 'server_error', 'message' => t('api.server_error')]], 500);
|
||||
return;
|
||||
}
|
||||
http_response_code(500);
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
echo '<!doctype html><meta charset="utf-8"><title>Fehler</title>'
|
||||
$title = function_exists('t') ? t('page.title_error', ['status' => 500]) : 'Fehler 500';
|
||||
$hint = function_exists('t') ? t('api.server_error') : 'Interner Fehler.';
|
||||
echo '<!doctype html><meta charset="utf-8"><title>' . e($title) . '</title>'
|
||||
. '<body style="font-family:system-ui;background:#050d19;color:#eefaff;padding:2rem">'
|
||||
. '<h1>Interner Fehler</h1><p>Bitte später erneut versuchen.</p></body>';
|
||||
. '<h1>' . e($hint) . '</h1></body>';
|
||||
});
|
||||
|
||||
security_headers();
|
||||
|
|
|
|||
71
hub/app/i18n.php
Normal file
71
hub/app/i18n.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Texte der Hub-Oberfläche (Deutsch und Englisch).
|
||||
*
|
||||
* Die Sprache kommt aus dem Cookie RHUB_LANG und wird ausschließlich über den
|
||||
* DE/EN-Umschalter gesetzt (Route /language). Standard ist Deutsch; der Hub
|
||||
* ist eine geschlossene Beta und schaltet nicht automatisch um.
|
||||
*
|
||||
* t() liefert Text mit eingesetzten Platzhaltern ({name}); die Ausgabe wird
|
||||
* an der Aufrufstelle mit e() maskiert. In den Texten steht kein HTML.
|
||||
*/
|
||||
|
||||
const HUB_LOCALES = ['de', 'en'];
|
||||
const HUB_DEFAULT_LOCALE = 'de';
|
||||
const HUB_LOCALE_COOKIE = 'RHUB_LANG';
|
||||
|
||||
function hub_locale(): string
|
||||
{
|
||||
static $locale = null;
|
||||
if ($locale !== null) {
|
||||
return $locale;
|
||||
}
|
||||
$raw = strtolower(substr((string) ($_COOKIE[HUB_LOCALE_COOKIE] ?? ''), 0, 2));
|
||||
$locale = in_array($raw, HUB_LOCALES, true) ? $raw : HUB_DEFAULT_LOCALE;
|
||||
return $locale;
|
||||
}
|
||||
|
||||
function hub_locale_set(string $locale): void
|
||||
{
|
||||
$locale = strtolower(substr($locale, 0, 2));
|
||||
if (!in_array($locale, HUB_LOCALES, true)) {
|
||||
return;
|
||||
}
|
||||
if (!headers_sent()) {
|
||||
setcookie(HUB_LOCALE_COOKIE, $locale, [
|
||||
'expires' => time() + 365 * 86400,
|
||||
'path' => '/',
|
||||
'secure' => is_https(),
|
||||
'httponly' => false,
|
||||
'samesite' => 'Lax',
|
||||
]);
|
||||
}
|
||||
$_COOKIE[HUB_LOCALE_COOKIE] = $locale;
|
||||
}
|
||||
|
||||
function hub_strings(): array
|
||||
{
|
||||
static $strings = null;
|
||||
if ($strings === null) {
|
||||
$strings = require HUB_APP . '/i18n_strings.php';
|
||||
}
|
||||
return $strings;
|
||||
}
|
||||
|
||||
/** Text in der aktuellen Sprache; unbekannte Schlüssel geben den Schlüssel zurück. */
|
||||
function t(string $key, array $args = []): string
|
||||
{
|
||||
$strings = hub_strings();
|
||||
$locale = hub_locale();
|
||||
$text = $strings[$locale][$key] ?? $strings[HUB_DEFAULT_LOCALE][$key] ?? $key;
|
||||
if ($args !== []) {
|
||||
$replace = [];
|
||||
foreach ($args as $name => $value) {
|
||||
$replace['{' . $name . '}'] = (string) $value;
|
||||
}
|
||||
$text = strtr($text, $replace);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
664
hub/app/i18n_strings.php
Normal file
664
hub/app/i18n_strings.php
Normal file
|
|
@ -0,0 +1,664 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** Textkatalog des Hubs. Beide Sprachen müssen dieselben Schlüssel haben. */
|
||||
|
||||
return [
|
||||
'de' => [
|
||||
// Rahmen
|
||||
'app.name' => 'Rinkplanner-Hub',
|
||||
'nav.routines' => 'Küren',
|
||||
'nav.upload' => 'Hochladen',
|
||||
'nav.admin' => 'Verwaltung',
|
||||
'nav.logout' => 'Abmelden',
|
||||
'nav.login' => 'Anmelden',
|
||||
'nav.language' => 'Sprache',
|
||||
'footer.beta' => 'Geschlossene Beta · Rinkplanner-Hub',
|
||||
'footer.website' => 'Zur Rinkplanner-Seite',
|
||||
'flash.secret' => 'Geheimnis',
|
||||
'page.title_default' => 'Kür-Hub',
|
||||
'page.title_error' => 'Fehler {status}',
|
||||
|
||||
// Seitentitel
|
||||
'page.login' => 'Anmelden',
|
||||
'page.register' => 'Registrieren',
|
||||
'page.dashboard' => 'Küren',
|
||||
'page.upload' => 'Kür hochladen',
|
||||
'page.revision' => 'Neue Revision',
|
||||
'page.account' => 'Konto',
|
||||
'page.admin_invites' => 'Einladungen',
|
||||
'page.admin_users' => 'Benutzer',
|
||||
'page.admin_routines' => 'Alle Küren',
|
||||
'page.admin_audit' => 'Audit-Log',
|
||||
|
||||
// Anmeldung
|
||||
'login.title' => 'Anmelden',
|
||||
'login.lede' => 'Der Kür-Hub ist in einer geschlossenen Beta. Zugang gibt es per Einladungscode.',
|
||||
'login.login_label' => 'Benutzername oder E-Mail',
|
||||
'login.password' => 'Passwort',
|
||||
'login.remember' => 'Angemeldet bleiben (30 Tage)',
|
||||
'login.submit' => 'Anmelden',
|
||||
'login.no_access' => 'Noch keinen Zugang? Ein Beta-Code kommt von der Hub-Administration.',
|
||||
|
||||
// Registrierung
|
||||
'register.title' => 'Beta-Zugang einlösen',
|
||||
'register.lede' => 'Ein Einladungscode legt genau ein Konto an. Der Code verliert danach seine Gültigkeit.',
|
||||
'register.code' => 'Einladungscode',
|
||||
'register.username' => 'Benutzername',
|
||||
'register.username_hint' => '3–32 Zeichen, nur Kleinbuchstaben, Ziffern, Punkt, Bindestrich, Unterstrich.',
|
||||
'register.display_name' => 'Anzeigename',
|
||||
'register.email' => 'E-Mail (optional)',
|
||||
'register.email_bound' => 'Diese Einladung ist an {email} gebunden.',
|
||||
'register.password' => 'Passwort',
|
||||
'register.password_repeat' => 'Passwort wiederholen',
|
||||
'register.password_hint' => 'Mindestens 10 Zeichen.',
|
||||
'register.rights' => 'Ich akzeptiere die Beta-Regeln und teile keine Inhalte, an denen ich keine Rechte habe.',
|
||||
'register.submit' => 'Konto anlegen',
|
||||
'register.have_account' => 'Schon ein Konto?',
|
||||
'register.login_link' => 'Anmelden',
|
||||
|
||||
// Übersicht
|
||||
'dashboard.eyebrow' => 'Viele Schlittschuhe, ein Netz',
|
||||
'dashboard.hero_title' => 'Küren teilen, Fassungen vergleichen, gemeinsam weiterentwickeln.',
|
||||
'dashboard.hero_sub' => 'Der Hub sammelt Küren, Musik und Revisionen deines Teams an einem Ort.',
|
||||
'dashboard.title' => 'Küren',
|
||||
'dashboard.count' => '{count} {label} im Hub',
|
||||
'dashboard.one_routine' => 'Kür',
|
||||
'dashboard.many_routines' => 'Küren',
|
||||
'dashboard.mine_suffix' => ' (nur deine)',
|
||||
'dashboard.upload' => 'Kür hochladen',
|
||||
'dashboard.search_placeholder' => 'Titel, Skater, Musik, Benutzer …',
|
||||
'dashboard.search' => 'Suchen',
|
||||
'dashboard.all' => 'Alle',
|
||||
'dashboard.mine' => 'Meine Küren',
|
||||
'dashboard.empty' => 'Keine Küren gefunden.',
|
||||
'dashboard.empty_hint' => 'Suche zurücksetzen oder',
|
||||
'dashboard.empty_upload' => 'selbst eine Kür hochladen',
|
||||
'dashboard.empty_first' => 'Der Hub ist noch leer.',
|
||||
'dashboard.empty_first_action' => 'Erste Kür hochladen',
|
||||
'badge.hidden' => 'versteckt',
|
||||
|
||||
// Tabellen
|
||||
'table.title' => 'Titel',
|
||||
'table.skater' => 'Skater',
|
||||
'table.music' => 'Musik',
|
||||
'table.revision' => 'Rev.',
|
||||
'table.size' => 'Größe',
|
||||
'table.updated' => 'Aktualisiert',
|
||||
'table.by' => 'Von',
|
||||
'table.name' => 'Name',
|
||||
'table.prefix' => 'Prefix',
|
||||
'table.created' => 'Erstellt',
|
||||
'table.last_used' => 'Zuletzt',
|
||||
'table.status' => 'Status',
|
||||
'table.role' => 'Rolle',
|
||||
'table.routines' => 'Küren',
|
||||
'table.registered' => 'Registriert',
|
||||
'table.last_login' => 'Letzte Anmeldung',
|
||||
'table.actions' => 'Aktionen',
|
||||
'table.downloads' => 'Downloads',
|
||||
'table.email' => 'E-Mail',
|
||||
'table.note' => 'Notiz',
|
||||
'table.valid_until' => 'Gültig bis',
|
||||
'table.from_to' => 'Von / an',
|
||||
'table.time' => 'Zeit',
|
||||
'table.actor' => 'Akteur',
|
||||
'table.action' => 'Aktion',
|
||||
'table.subject' => 'Objekt',
|
||||
'table.detail' => 'Detail',
|
||||
'table.ip' => 'IP',
|
||||
'pagination.back' => '← Zurück',
|
||||
'pagination.next' => 'Weiter →',
|
||||
'pagination.page' => 'Seite {page} von {pages}',
|
||||
|
||||
// Kür-Detail
|
||||
'routine.breadcrumb' => 'Küren',
|
||||
'routine.breadcrumb_current' => 'Kür',
|
||||
'routine.revision' => 'Revision {revision}',
|
||||
'routine.download' => 'Kür herunterladen',
|
||||
'routine.download_audio' => 'Musik herunterladen',
|
||||
'routine.owner_bar' => 'Du kannst diese Kür verwalten.',
|
||||
'routine.new_revision' => 'Neue Revision hochladen',
|
||||
'routine.hide' => 'Aus dem Hub nehmen',
|
||||
'routine.publish' => 'Wieder veröffentlichen',
|
||||
'routine.open_admin' => 'In der Verwaltung öffnen',
|
||||
'routine.description' => 'Beschreibung',
|
||||
'routine.music' => 'Musik',
|
||||
'routine.details' => 'Details',
|
||||
'routine.category' => 'Kategorie',
|
||||
'routine.music_title' => 'Musiktitel',
|
||||
'routine.music_artist' => 'Musik',
|
||||
'routine.routine_file' => 'Kür-Datei',
|
||||
'routine.audio_file' => 'Audio-Datei',
|
||||
'routine.checksums' => 'Prüfsummen',
|
||||
'routine.checksum_hint' => 'Beim Download prüfen, ob die SHA-256-Summe zur Kür passt.',
|
||||
|
||||
// Upload
|
||||
'upload.title_new' => 'Kür hochladen',
|
||||
'upload.title_revision' => 'Neue Revision',
|
||||
'upload.revision_lede' => 'Neue Fassung von „{title}“. Die bisherige Revision bleibt erhalten.',
|
||||
'upload.lede' => 'Lade die Kür-JSON und – falls die Kür Musik nutzt – die zugehörige Audiodatei hoch. Beide gehören als Paket zusammen.',
|
||||
'upload.routine_file' => 'Kür-Datei (.json)',
|
||||
'upload.routine_hint' => 'Aus Rinkplanner gespeicherte Kür, max. {max}.',
|
||||
'upload.audio_file' => 'Musikdatei (MP3/OGG/WAV/M4A/AAC)',
|
||||
'upload.audio_hint' => 'Dateiname muss exakt dem Feld „music_file“ der Kür entsprechen.',
|
||||
'upload.description' => 'Beschreibung (optional)',
|
||||
'upload.music_title' => 'Musiktitel (optional)',
|
||||
'upload.artist' => 'Interpret (optional)',
|
||||
'upload.rights' => 'Ich habe die Rechte an Kür und Musik und darf sie im geschlossenen Beta-Hub teilen.',
|
||||
'upload.submit_new' => 'Kür veröffentlichen',
|
||||
'upload.submit_revision' => 'Revision veröffentlichen',
|
||||
'upload.cancel' => 'Abbrechen',
|
||||
|
||||
// Konto
|
||||
'account.title' => 'Konto',
|
||||
'account.role_admin' => 'Administrator',
|
||||
'account.role_user' => 'Beta-Nutzer',
|
||||
'account.must_change' => 'Bitte ein neues Passwort setzen, bevor du den Hub weiter nutzt.',
|
||||
'account.change_password' => 'Passwort ändern',
|
||||
'account.current_password' => 'Aktuelles Passwort',
|
||||
'account.new_password' => 'Neues Passwort',
|
||||
'account.repeat_password' => 'Neues Passwort wiederholen',
|
||||
'account.password_hint' => 'Mindestens 10 Zeichen.',
|
||||
'account.save_password' => 'Passwort speichern',
|
||||
'account.tokens' => 'API-Tokens',
|
||||
'account.tokens_lede' => 'Für die Godot-App. Ein Token ersetzt Benutzername und Passwort im Client und lässt sich jederzeit widerrufen.',
|
||||
'account.token_placeholder' => 'Name, z. B. Büro-PC',
|
||||
'account.token_create' => 'Token erzeugen',
|
||||
'account.token_active' => 'aktiv',
|
||||
'account.token_revoked' => 'widerrufen',
|
||||
'account.token_revoke' => 'widerrufen',
|
||||
'account.no_tokens' => 'Noch kein Token erzeugt.',
|
||||
|
||||
// Verwaltung
|
||||
'admin.title' => 'Verwaltung',
|
||||
'admin.tab_invites' => 'Einladungen',
|
||||
'admin.tab_users' => 'Benutzer',
|
||||
'admin.tab_routines' => 'Küren',
|
||||
'admin.tab_audit' => 'Audit-Log',
|
||||
'admin.audit_lede' => 'Die letzten {count} Ereignisse.',
|
||||
'admin.audit_empty' => 'Noch keine Einträge.',
|
||||
'admin_invites.lede' => 'Einladungen für die geschlossene Beta.',
|
||||
'admin_invites.new' => 'Neue Einladung',
|
||||
'admin_invites.new_lede' => 'Der Code wird nach dem Anlegen genau einmal angezeigt. Er gilt für ein Konto.',
|
||||
'admin_invites.note' => 'Notiz (intern)',
|
||||
'admin_invites.note_placeholder' => 'z. B. Verein Nord',
|
||||
'admin_invites.email' => 'E-Mail binden (optional)',
|
||||
'admin_invites.email_hint' => 'Nur diese Adresse kann den Code nutzen.',
|
||||
'admin_invites.days' => 'Gültig (Tage)',
|
||||
'admin_invites.days_hint' => '0 = unbegrenzt.',
|
||||
'admin_invites.create' => 'Einladung erzeugen',
|
||||
'admin_invites.list' => 'Einladungen',
|
||||
'admin_invites.empty' => 'Noch keine Einladungen.',
|
||||
'admin_invites.revoke' => 'widerrufen',
|
||||
'admin_users.lede' => 'Beta-Konten verwalten.',
|
||||
'admin_users.self' => 'eigenes Konto',
|
||||
'admin_users.block' => 'sperren',
|
||||
'admin_users.unblock' => 'entsperren',
|
||||
'admin_users.reset' => 'Passwort zurücksetzen',
|
||||
'admin_users.delete' => 'löschen',
|
||||
'admin_users.delete_confirm' => 'mit allen Küren löschen',
|
||||
'admin_users.delete_submit' => 'Löschen bestätigen',
|
||||
'admin_users.role_admin' => 'Admin',
|
||||
'admin_users.role_user' => 'Nutzer',
|
||||
'status.active' => 'aktiv',
|
||||
'status.blocked' => 'gesperrt',
|
||||
'admin_routines.lede' => '{total} Küren insgesamt, auch versteckte.',
|
||||
'admin_routines.search_placeholder' => 'Titel, Skater, Benutzer …',
|
||||
'admin_routines.empty' => 'Keine Küren gefunden.',
|
||||
'admin_routines.hide' => 'verstecken',
|
||||
'admin_routines.publish' => 'veröffentlichen',
|
||||
'admin_routines.delete' => 'löschen',
|
||||
'admin_routines.delete_confirm' => 'endgültig löschen',
|
||||
'admin_routines.delete_submit' => 'Löschen bestätigen',
|
||||
|
||||
// Status einer Einladung
|
||||
'invite.status.open' => 'offen',
|
||||
'invite.status.used' => 'eingelöst',
|
||||
'invite.status.expired' => 'abgelaufen',
|
||||
'invite.status.revoked' => 'widerrufen',
|
||||
|
||||
// Fehlerseite
|
||||
'error.label' => 'Fehler {status}',
|
||||
'error.back' => 'Zurück zur',
|
||||
'error.back_link' => 'Küren-Übersicht',
|
||||
|
||||
// Meldungen
|
||||
'auth.admin_only' => 'Dieser Bereich ist nur für Administratoren.',
|
||||
'auth.change_password_first' => 'Bitte zuerst das Passwort ändern.',
|
||||
'auth.logged_out' => 'Abgemeldet.',
|
||||
'auth.welcome' => 'Willkommen im Kür-Hub!',
|
||||
'auth.session_expired' => 'Die Sitzung ist abgelaufen. Bitte die Seite neu laden.',
|
||||
'page.method_not_allowed' => 'Diese Methode ist nicht erlaubt.',
|
||||
'page.not_found' => 'Diese Seite gibt es nicht.',
|
||||
'username.length' => 'Der Benutzername muss 3 bis 32 Zeichen lang sein.',
|
||||
'username.charset' => 'Nur Kleinbuchstaben, Ziffern, Punkt, Bindestrich und Unterstrich; Anfang und Ende alphanumerisch.',
|
||||
'username.reserved' => 'Dieser Benutzername ist reserviert.',
|
||||
'register.invalid_invite' => 'Dieser Einladungscode ist ungültig, abgelaufen oder bereits eingelöst.',
|
||||
'register.display_name_long' => 'Der Anzeigename darf höchstens 64 Zeichen lang sein.',
|
||||
'register.email_invalid' => 'Die E-Mail-Adresse ist nicht gültig.',
|
||||
'register.email_mismatch' => 'Diese Einladung ist an eine andere E-Mail-Adresse gebunden.',
|
||||
'register.password_mismatch' => 'Die Passwortwiederholung passt nicht.',
|
||||
'register.rights_required' => 'Bitte die Beta-Regeln akzeptieren.',
|
||||
'register.invite_taken' => 'Der Einladungscode wurde gerade eingelöst. Bitte einen neuen Code anfordern.',
|
||||
'register.username_taken' => 'Dieser Benutzername ist schon vergeben.',
|
||||
'register.email_taken' => 'Diese E-Mail-Adresse ist schon registriert.',
|
||||
'routine.not_found' => 'Diese Kür gibt es nicht.',
|
||||
'routine.forbidden' => 'Diese Kür ist nicht freigegeben.',
|
||||
'routine.edit_forbidden' => 'Nur der Eigentümer oder ein Admin kann diese Kür ändern.',
|
||||
'upload.quota' => 'Stündliches Upload-Limit erreicht. Bitte später erneut versuchen.',
|
||||
'upload.rights_confirm' => 'Bitte bestätigen, dass du Kür und Musik teilen darfst.',
|
||||
'upload.duplicate' => 'Diese Kür ist bereits im Hub.',
|
||||
'upload.published' => 'Kür veröffentlicht.',
|
||||
'upload.save_failed' => 'Die Kür konnte nicht gespeichert werden.',
|
||||
'revision.saved' => 'Neue Revision {revision} gespeichert.',
|
||||
'revision.save_failed' => 'Die Revision konnte nicht gespeichert werden.',
|
||||
'routine.published_again' => 'Kür ist wieder sichtbar.',
|
||||
'routine.hidden_now' => 'Kür wurde aus dem Hub genommen.',
|
||||
'account.current_wrong' => 'Das aktuelle Passwort ist falsch.',
|
||||
'account.password_changed' => 'Passwort geändert. Andere Sitzungen wurden abgemeldet.',
|
||||
'token.created' => 'Neuer API-Token – jetzt kopieren, er wird nicht erneut angezeigt',
|
||||
'token.revoked' => 'Token widerrufen.',
|
||||
'token.not_found' => 'Token nicht gefunden.',
|
||||
'invite.created' => 'Einladung erstellt.',
|
||||
'invite.created_label' => 'Einladungscode',
|
||||
'invite.revoked' => 'Einladung widerrufen.',
|
||||
'invite.revoke_failed' => 'Einladung konnte nicht widerrufen werden.',
|
||||
'user.not_found' => 'Benutzer nicht gefunden.',
|
||||
'user.self_change' => 'Das eigene Konto lässt sich hier nicht ändern.',
|
||||
'user.disabled' => 'Benutzer deaktiviert.',
|
||||
'user.enabled' => 'Benutzer aktiviert.',
|
||||
'user.temp_password' => 'Temporäres Passwort für {user}',
|
||||
'user.must_change' => 'Der Benutzer muss das Passwort bei der nächsten Anmeldung ändern.',
|
||||
'user.delete_confirm_required' => 'Löschen muss bestätigt werden.',
|
||||
'user.deleted' => 'Benutzer und zugehörige Küren gelöscht.',
|
||||
'action.unknown' => 'Unbekannte Aktion.',
|
||||
'routine.not_found_short' => 'Kür nicht gefunden.',
|
||||
'admin.status_changed' => 'Status geändert.',
|
||||
'routine.deleted' => 'Kür endgültig gelöscht.',
|
||||
|
||||
// Anmeldung und Passwortregeln
|
||||
'login.error.rate_limited' => 'Zu viele Fehlversuche. Bitte in {minutes} Minuten erneut versuchen.',
|
||||
'login.error.credentials' => 'Benutzername oder Passwort ist falsch.',
|
||||
'login.error.disabled' => 'Dieses Konto ist deaktiviert.',
|
||||
'password.min' => 'Das Passwort muss mindestens 10 Zeichen lang sein.',
|
||||
'password.max' => 'Das Passwort darf höchstens 200 Zeichen lang sein.',
|
||||
'password.same_as_username' => 'Das Passwort darf nicht dem Benutzernamen entsprechen.',
|
||||
|
||||
// Upload-Prüfung
|
||||
'upload.select_routine' => 'Bitte eine Kür-Datei (.json) auswählen.',
|
||||
'upload.invalid' => 'Ungültiger Upload.',
|
||||
'upload.routine_too_large' => 'Die Kür-Datei ist zu groß (max. {max}).',
|
||||
'upload.routine_not_json' => 'Kürdateien müssen im JSON-Format vorliegen (.json).',
|
||||
'upload.read_failed' => 'Die Kür-Datei konnte nicht gelesen werden.',
|
||||
'upload.invalid_json' => 'Die Kür-Datei ist kein gültiges JSON.',
|
||||
'upload.no_json_object' => 'Die Kür-Datei enthält kein JSON-Objekt.',
|
||||
'upload.not_rinkplanner' => 'Das ist keine Rinkplanner-Kür (format fehlt oder ist falsch).',
|
||||
'upload.unsupported_version' => 'Diese Kür-Formatversion wird nicht unterstützt.',
|
||||
'upload.no_sections' => 'Die Kür enthält keine Abschnittsliste.',
|
||||
'upload.too_many_sections' => 'Die Kür hat zu viele Abschnitte (max. 500).',
|
||||
'upload.title_required' => 'Die Kür braucht einen Titel.',
|
||||
'upload.bad_music_name' => 'Die Kür verweist auf einen ungültigen Musikdateinamen.',
|
||||
'upload.music_missing' => 'Die Kür verweist auf „{name}“. Bitte die passende Audiodatei mit hochladen.',
|
||||
'upload.music_unexpected' => 'Die Kür verweist auf keine Musikdatei; die Audiodatei passt nicht dazu.',
|
||||
'upload.audio_invalid' => 'Ungültiger Audio-Upload.',
|
||||
'upload.audio_too_large' => 'Die Audiodatei ist zu groß (max. {max}).',
|
||||
'upload.audio_name_mismatch' => 'Die Audiodatei heißt „{actual}“, die Kür verweist aber auf „{expected}“.',
|
||||
'upload.audio_format' => 'Die Audiodatei ist kein unterstütztes Format (MP3, OGG, WAV, M4A, AAC).',
|
||||
'upload.file_too_large' => 'Die Datei ist zu groß.',
|
||||
'upload.interrupted' => 'Der Upload wurde unterbrochen.',
|
||||
'upload.no_file_chosen' => 'Es wurde keine Datei ausgewählt.',
|
||||
'upload.store_failed' => 'Die Datei konnte nicht gespeichert werden.',
|
||||
'upload.unknown_error' => 'Unbekannter Upload-Fehler.',
|
||||
'routine.no_file_yet' => 'Diese Kür hat noch keine Datei.',
|
||||
'routine.file_missing' => 'Die Datei fehlt im Speicher.',
|
||||
'routine.file_unreadable' => 'Die Datei konnte nicht geöffnet werden.',
|
||||
|
||||
// API
|
||||
'api.post_only' => 'Nur POST ist erlaubt.',
|
||||
'api.get_only' => 'Nur GET ist erlaubt.',
|
||||
'api.get_or_post' => 'Nur GET oder POST ist erlaubt.',
|
||||
'api.get_or_delete' => 'Nur GET oder DELETE ist erlaubt.',
|
||||
'api.unknown_path' => 'Unbekannter API-Pfad.',
|
||||
'api.bearer_missing' => 'Bearer-Token fehlt.',
|
||||
'api.token_invalid' => 'Token ist ungültig, abgelaufen oder widerrufen.',
|
||||
'api.credentials_required' => 'Benutzername und Passwort sind erforderlich.',
|
||||
'api.change_password_web' => 'Bitte zuerst im Web das Passwort ändern.',
|
||||
'api.edit_forbidden' => 'Nur der Eigentümer oder ein Admin darf die Kür ändern.',
|
||||
'api.rights_required' => 'Bitte bestätigen, dass Kür und Musik geteilt werden dürfen.',
|
||||
'api.upload_limit' => 'Stündliches Upload-Limit erreicht.',
|
||||
'api.invalid_files' => 'Die Dateien sind nicht gültig.',
|
||||
'api.duplicate' => 'Diese Kür ist bereits im Hub (ID {id}).',
|
||||
'api.server_error' => 'Interner Fehler.',
|
||||
'api.routine_load_failed' => 'Kür konnte nicht geladen werden.',
|
||||
],
|
||||
|
||||
'en' => [
|
||||
// Frame
|
||||
'app.name' => 'Rinkplanner Hub',
|
||||
'nav.routines' => 'Programmes',
|
||||
'nav.upload' => 'Upload',
|
||||
'nav.admin' => 'Administration',
|
||||
'nav.logout' => 'Sign out',
|
||||
'nav.login' => 'Sign in',
|
||||
'nav.language' => 'Language',
|
||||
'footer.beta' => 'Closed beta · Rinkplanner Hub',
|
||||
'footer.website' => 'To the Rinkplanner website',
|
||||
'flash.secret' => 'Secret',
|
||||
'page.title_default' => 'Programme hub',
|
||||
'page.title_error' => 'Error {status}',
|
||||
|
||||
// Page titles
|
||||
'page.login' => 'Sign in',
|
||||
'page.register' => 'Register',
|
||||
'page.dashboard' => 'Programmes',
|
||||
'page.upload' => 'Upload programme',
|
||||
'page.revision' => 'New revision',
|
||||
'page.account' => 'Account',
|
||||
'page.admin_invites' => 'Invitations',
|
||||
'page.admin_users' => 'Users',
|
||||
'page.admin_routines' => 'All programmes',
|
||||
'page.admin_audit' => 'Audit log',
|
||||
|
||||
// Sign in
|
||||
'login.title' => 'Sign in',
|
||||
'login.lede' => 'The programme hub is in a closed beta. Access is granted by invitation code.',
|
||||
'login.login_label' => 'Username or email',
|
||||
'login.password' => 'Password',
|
||||
'login.remember' => 'Stay signed in (30 days)',
|
||||
'login.submit' => 'Sign in',
|
||||
'login.no_access' => 'No access yet? A beta code comes from the hub administration.',
|
||||
|
||||
// Registration
|
||||
'register.title' => 'Redeem beta access',
|
||||
'register.lede' => 'An invitation code creates exactly one account. The code expires once it has been used.',
|
||||
'register.code' => 'Invitation code',
|
||||
'register.username' => 'Username',
|
||||
'register.username_hint' => '3–32 characters, lowercase letters, digits, dot, hyphen and underscore only.',
|
||||
'register.display_name' => 'Display name',
|
||||
'register.email' => 'Email (optional)',
|
||||
'register.email_bound' => 'This invitation is bound to {email}.',
|
||||
'register.password' => 'Password',
|
||||
'register.password_repeat' => 'Repeat password',
|
||||
'register.password_hint' => 'At least 10 characters.',
|
||||
'register.rights' => 'I accept the beta rules and will not share content I have no rights to.',
|
||||
'register.submit' => 'Create account',
|
||||
'register.have_account' => 'Already have an account?',
|
||||
'register.login_link' => 'Sign in',
|
||||
|
||||
// Overview
|
||||
'dashboard.eyebrow' => 'Many skates, one net',
|
||||
'dashboard.hero_title' => 'Share programmes, compare versions, develop them together.',
|
||||
'dashboard.hero_sub' => 'The hub collects your team’s programmes, music and revisions in one place.',
|
||||
'dashboard.title' => 'Programmes',
|
||||
'dashboard.count' => '{count} {label} in the hub',
|
||||
'dashboard.one_routine' => 'programme',
|
||||
'dashboard.many_routines' => 'programmes',
|
||||
'dashboard.mine_suffix' => ' (yours only)',
|
||||
'dashboard.upload' => 'Upload programme',
|
||||
'dashboard.search_placeholder' => 'Title, skater, music, user …',
|
||||
'dashboard.search' => 'Search',
|
||||
'dashboard.all' => 'All',
|
||||
'dashboard.mine' => 'My programmes',
|
||||
'dashboard.empty' => 'No programmes found.',
|
||||
'dashboard.empty_hint' => 'Clear the search or',
|
||||
'dashboard.empty_upload' => 'upload a programme yourself',
|
||||
'dashboard.empty_first' => 'The hub is still empty.',
|
||||
'dashboard.empty_first_action' => 'Upload the first programme',
|
||||
'badge.hidden' => 'hidden',
|
||||
|
||||
// Tables
|
||||
'table.title' => 'Title',
|
||||
'table.skater' => 'Skater',
|
||||
'table.music' => 'Music',
|
||||
'table.revision' => 'Rev.',
|
||||
'table.size' => 'Size',
|
||||
'table.updated' => 'Updated',
|
||||
'table.by' => 'By',
|
||||
'table.name' => 'Name',
|
||||
'table.prefix' => 'Prefix',
|
||||
'table.created' => 'Created',
|
||||
'table.last_used' => 'Last used',
|
||||
'table.status' => 'Status',
|
||||
'table.role' => 'Role',
|
||||
'table.routines' => 'Programmes',
|
||||
'table.registered' => 'Registered',
|
||||
'table.last_login' => 'Last sign-in',
|
||||
'table.actions' => 'Actions',
|
||||
'table.downloads' => 'Downloads',
|
||||
'table.email' => 'Email',
|
||||
'table.note' => 'Note',
|
||||
'table.valid_until' => 'Valid until',
|
||||
'table.from_to' => 'From / to',
|
||||
'table.time' => 'Time',
|
||||
'table.actor' => 'Actor',
|
||||
'table.action' => 'Action',
|
||||
'table.subject' => 'Subject',
|
||||
'table.detail' => 'Detail',
|
||||
'table.ip' => 'IP',
|
||||
'pagination.back' => '← Back',
|
||||
'pagination.next' => 'Next →',
|
||||
'pagination.page' => 'Page {page} of {pages}',
|
||||
|
||||
// Programme detail
|
||||
'routine.breadcrumb' => 'Programmes',
|
||||
'routine.breadcrumb_current' => 'Programme',
|
||||
'routine.revision' => 'Revision {revision}',
|
||||
'routine.download' => 'Download programme',
|
||||
'routine.download_audio' => 'Download music',
|
||||
'routine.owner_bar' => 'You can manage this programme.',
|
||||
'routine.new_revision' => 'Upload new revision',
|
||||
'routine.hide' => 'Remove from the hub',
|
||||
'routine.publish' => 'Publish again',
|
||||
'routine.open_admin' => 'Open in administration',
|
||||
'routine.description' => 'Description',
|
||||
'routine.music' => 'Music',
|
||||
'routine.details' => 'Details',
|
||||
'routine.category' => 'Category',
|
||||
'routine.music_title' => 'Music title',
|
||||
'routine.music_artist' => 'Artist',
|
||||
'routine.routine_file' => 'Programme file',
|
||||
'routine.audio_file' => 'Audio file',
|
||||
'routine.checksums' => 'Checksums',
|
||||
'routine.checksum_hint' => 'When downloading, check that the SHA-256 checksum matches the programme.',
|
||||
|
||||
// Upload
|
||||
'upload.title_new' => 'Upload programme',
|
||||
'upload.title_revision' => 'New revision',
|
||||
'upload.revision_lede' => 'New version of “{title}”. The previous revision is kept.',
|
||||
'upload.lede' => 'Upload the programme JSON and, if the programme uses music, the matching audio file. They belong together as a package.',
|
||||
'upload.routine_file' => 'Programme file (.json)',
|
||||
'upload.routine_hint' => 'A programme saved from Rinkplanner, max. {max}.',
|
||||
'upload.audio_file' => 'Music file (MP3/OGG/WAV/M4A/AAC)',
|
||||
'upload.audio_hint' => 'The filename must match the “music_file” field of the programme exactly.',
|
||||
'upload.description' => 'Description (optional)',
|
||||
'upload.music_title' => 'Music title (optional)',
|
||||
'upload.artist' => 'Artist (optional)',
|
||||
'upload.rights' => 'I hold the rights to the programme and the music and may share them in the closed beta hub.',
|
||||
'upload.submit_new' => 'Publish programme',
|
||||
'upload.submit_revision' => 'Publish revision',
|
||||
'upload.cancel' => 'Cancel',
|
||||
|
||||
// Account
|
||||
'account.title' => 'Account',
|
||||
'account.role_admin' => 'Administrator',
|
||||
'account.role_user' => 'Beta user',
|
||||
'account.must_change' => 'Please set a new password before using the hub further.',
|
||||
'account.change_password' => 'Change password',
|
||||
'account.current_password' => 'Current password',
|
||||
'account.new_password' => 'New password',
|
||||
'account.repeat_password' => 'Repeat new password',
|
||||
'account.password_hint' => 'At least 10 characters.',
|
||||
'account.save_password' => 'Save password',
|
||||
'account.tokens' => 'API tokens',
|
||||
'account.tokens_lede' => 'For the Godot app. A token replaces username and password in the client and can be revoked at any time.',
|
||||
'account.token_placeholder' => 'Name, e.g. office PC',
|
||||
'account.token_create' => 'Create token',
|
||||
'account.token_active' => 'active',
|
||||
'account.token_revoked' => 'revoked',
|
||||
'account.token_revoke' => 'revoke',
|
||||
'account.no_tokens' => 'No token created yet.',
|
||||
|
||||
// Administration
|
||||
'admin.title' => 'Administration',
|
||||
'admin.tab_invites' => 'Invitations',
|
||||
'admin.tab_users' => 'Users',
|
||||
'admin.tab_routines' => 'Programmes',
|
||||
'admin.tab_audit' => 'Audit log',
|
||||
'admin.audit_lede' => 'The last {count} events.',
|
||||
'admin.audit_empty' => 'No entries yet.',
|
||||
'admin_invites.lede' => 'Invitations for the closed beta.',
|
||||
'admin_invites.new' => 'New invitation',
|
||||
'admin_invites.new_lede' => 'The code is shown exactly once after it is created. It is valid for one account.',
|
||||
'admin_invites.note' => 'Note (internal)',
|
||||
'admin_invites.note_placeholder' => 'e.g. Club North',
|
||||
'admin_invites.email' => 'Bind email (optional)',
|
||||
'admin_invites.email_hint' => 'Only this address can use the code.',
|
||||
'admin_invites.days' => 'Valid (days)',
|
||||
'admin_invites.days_hint' => '0 = unlimited.',
|
||||
'admin_invites.create' => 'Create invitation',
|
||||
'admin_invites.list' => 'Invitations',
|
||||
'admin_invites.empty' => 'No invitations yet.',
|
||||
'admin_invites.revoke' => 'revoke',
|
||||
'admin_users.lede' => 'Manage beta accounts.',
|
||||
'admin_users.self' => 'own account',
|
||||
'admin_users.block' => 'block',
|
||||
'admin_users.unblock' => 'unblock',
|
||||
'admin_users.reset' => 'Reset password',
|
||||
'admin_users.delete' => 'delete',
|
||||
'admin_users.delete_confirm' => 'delete including all programmes',
|
||||
'admin_users.delete_submit' => 'Confirm deletion',
|
||||
'admin_users.role_admin' => 'Admin',
|
||||
'admin_users.role_user' => 'User',
|
||||
'status.active' => 'active',
|
||||
'status.blocked' => 'blocked',
|
||||
'admin_routines.lede' => '{total} programmes in total, including hidden ones.',
|
||||
'admin_routines.search_placeholder' => 'Title, skater, user …',
|
||||
'admin_routines.empty' => 'No programmes found.',
|
||||
'admin_routines.hide' => 'hide',
|
||||
'admin_routines.publish' => 'publish',
|
||||
'admin_routines.delete' => 'delete',
|
||||
'admin_routines.delete_confirm' => 'delete permanently',
|
||||
'admin_routines.delete_submit' => 'Confirm deletion',
|
||||
|
||||
// Invitation status
|
||||
'invite.status.open' => 'open',
|
||||
'invite.status.used' => 'redeemed',
|
||||
'invite.status.expired' => 'expired',
|
||||
'invite.status.revoked' => 'revoked',
|
||||
|
||||
// Error page
|
||||
'error.label' => 'Error {status}',
|
||||
'error.back' => 'Back to the',
|
||||
'error.back_link' => 'programme overview',
|
||||
|
||||
// Messages
|
||||
'auth.admin_only' => 'This area is for administrators only.',
|
||||
'auth.change_password_first' => 'Please change your password first.',
|
||||
'auth.logged_out' => 'Signed out.',
|
||||
'auth.welcome' => 'Welcome to the programme hub!',
|
||||
'auth.session_expired' => 'The session has expired. Please reload the page.',
|
||||
'page.method_not_allowed' => 'This method is not allowed.',
|
||||
'page.not_found' => 'This page does not exist.',
|
||||
'username.length' => 'The username must be 3 to 32 characters long.',
|
||||
'username.charset' => 'Lowercase letters, digits, dot, hyphen and underscore only; begin and end with a letter or digit.',
|
||||
'username.reserved' => 'This username is reserved.',
|
||||
'register.invalid_invite' => 'This invitation code is invalid, expired or already redeemed.',
|
||||
'register.display_name_long' => 'The display name may be at most 64 characters long.',
|
||||
'register.email_invalid' => 'The email address is not valid.',
|
||||
'register.email_mismatch' => 'This invitation is bound to a different email address.',
|
||||
'register.password_mismatch' => 'The passwords do not match.',
|
||||
'register.rights_required' => 'Please accept the beta rules.',
|
||||
'register.invite_taken' => 'The invitation code was just redeemed. Please request a new one.',
|
||||
'register.username_taken' => 'This username is already taken.',
|
||||
'register.email_taken' => 'This email address is already registered.',
|
||||
'routine.not_found' => 'This programme does not exist.',
|
||||
'routine.forbidden' => 'This programme is not shared with you.',
|
||||
'routine.edit_forbidden' => 'Only the owner or an admin can change this programme.',
|
||||
'upload.quota' => 'Hourly upload limit reached. Please try again later.',
|
||||
'upload.rights_confirm' => 'Please confirm that you may share the programme and its music.',
|
||||
'upload.duplicate' => 'This programme is already in the hub.',
|
||||
'upload.published' => 'Programme published.',
|
||||
'upload.save_failed' => 'The programme could not be saved.',
|
||||
'revision.saved' => 'New revision {revision} saved.',
|
||||
'revision.save_failed' => 'The revision could not be saved.',
|
||||
'routine.published_again' => 'The programme is visible again.',
|
||||
'routine.hidden_now' => 'The programme was removed from the hub.',
|
||||
'account.current_wrong' => 'The current password is wrong.',
|
||||
'account.password_changed' => 'Password changed. Other sessions were signed out.',
|
||||
'token.created' => 'New API token – copy it now, it will not be shown again',
|
||||
'token.revoked' => 'Token revoked.',
|
||||
'token.not_found' => 'Token not found.',
|
||||
'invite.created' => 'Invitation created.',
|
||||
'invite.created_label' => 'Invitation code',
|
||||
'invite.revoked' => 'Invitation revoked.',
|
||||
'invite.revoke_failed' => 'The invitation could not be revoked.',
|
||||
'user.not_found' => 'User not found.',
|
||||
'user.self_change' => 'Your own account cannot be changed here.',
|
||||
'user.disabled' => 'User disabled.',
|
||||
'user.enabled' => 'User enabled.',
|
||||
'user.temp_password' => 'Temporary password for {user}',
|
||||
'user.must_change' => 'The user must change the password at the next sign-in.',
|
||||
'user.delete_confirm_required' => 'Deletion must be confirmed.',
|
||||
'user.deleted' => 'User and their programmes deleted.',
|
||||
'action.unknown' => 'Unknown action.',
|
||||
'routine.not_found_short' => 'Programme not found.',
|
||||
'admin.status_changed' => 'Status changed.',
|
||||
'routine.deleted' => 'Programme permanently deleted.',
|
||||
|
||||
// Sign-in and password rules
|
||||
'login.error.rate_limited' => 'Too many failed attempts. Please try again in {minutes} minutes.',
|
||||
'login.error.credentials' => 'Username or password is incorrect.',
|
||||
'login.error.disabled' => 'This account is disabled.',
|
||||
'password.min' => 'The password must be at least 10 characters long.',
|
||||
'password.max' => 'The password may be at most 200 characters long.',
|
||||
'password.same_as_username' => 'The password must not be the same as the username.',
|
||||
|
||||
// Upload validation
|
||||
'upload.select_routine' => 'Please choose a programme file (.json).',
|
||||
'upload.invalid' => 'Invalid upload.',
|
||||
'upload.routine_too_large' => 'The programme file is too large (max. {max}).',
|
||||
'upload.routine_not_json' => 'Programme files must be in JSON format (.json).',
|
||||
'upload.read_failed' => 'The programme file could not be read.',
|
||||
'upload.invalid_json' => 'The programme file is not valid JSON.',
|
||||
'upload.no_json_object' => 'The programme file does not contain a JSON object.',
|
||||
'upload.not_rinkplanner' => 'This is not a Rinkplanner programme (missing or wrong format).',
|
||||
'upload.unsupported_version' => 'This programme format version is not supported.',
|
||||
'upload.no_sections' => 'The programme has no section list.',
|
||||
'upload.too_many_sections' => 'The programme has too many sections (max. 500).',
|
||||
'upload.title_required' => 'The programme needs a title.',
|
||||
'upload.bad_music_name' => 'The programme refers to an invalid music filename.',
|
||||
'upload.music_missing' => 'The programme refers to “{name}”. Please upload the matching audio file as well.',
|
||||
'upload.music_unexpected' => 'The programme refers to no music file; the audio file does not match.',
|
||||
'upload.audio_invalid' => 'Invalid audio upload.',
|
||||
'upload.audio_too_large' => 'The audio file is too large (max. {max}).',
|
||||
'upload.audio_name_mismatch' => 'The audio file is named “{actual}”, but the programme refers to “{expected}”.',
|
||||
'upload.audio_format' => 'The audio file is not a supported format (MP3, OGG, WAV, M4A, AAC).',
|
||||
'upload.file_too_large' => 'The file is too large.',
|
||||
'upload.interrupted' => 'The upload was interrupted.',
|
||||
'upload.no_file_chosen' => 'No file was selected.',
|
||||
'upload.store_failed' => 'The file could not be stored.',
|
||||
'upload.unknown_error' => 'Unknown upload error.',
|
||||
'routine.no_file_yet' => 'This programme has no file yet.',
|
||||
'routine.file_missing' => 'The file is missing from storage.',
|
||||
'routine.file_unreadable' => 'The file could not be opened.',
|
||||
|
||||
// API
|
||||
'api.post_only' => 'Only POST is allowed.',
|
||||
'api.get_only' => 'Only GET is allowed.',
|
||||
'api.get_or_post' => 'Only GET or POST is allowed.',
|
||||
'api.get_or_delete' => 'Only GET or DELETE is allowed.',
|
||||
'api.unknown_path' => 'Unknown API path.',
|
||||
'api.bearer_missing' => 'Bearer token missing.',
|
||||
'api.token_invalid' => 'Token is invalid, expired or revoked.',
|
||||
'api.credentials_required' => 'Username and password are required.',
|
||||
'api.change_password_web' => 'Please change your password in the web interface first.',
|
||||
'api.edit_forbidden' => 'Only the owner or an admin may change the programme.',
|
||||
'api.rights_required' => 'Please confirm that the programme and its music may be shared.',
|
||||
'api.upload_limit' => 'Hourly upload limit reached.',
|
||||
'api.invalid_files' => 'The files are not valid.',
|
||||
'api.duplicate' => 'This programme is already in the hub (ID {id}).',
|
||||
'api.server_error' => 'Internal error.',
|
||||
'api.routine_load_failed' => 'The programme could not be loaded.',
|
||||
],
|
||||
];
|
||||
|
|
@ -106,13 +106,13 @@ function invites_list(): array
|
|||
function invite_status(array $invite): string
|
||||
{
|
||||
if ($invite['revoked_at'] !== null) {
|
||||
return 'widerrufen';
|
||||
return 'revoked';
|
||||
}
|
||||
if ($invite['used_at'] !== null) {
|
||||
return 'eingelöst';
|
||||
return 'used';
|
||||
}
|
||||
if ($invite['expires_at'] !== null && $invite['expires_at'] <= utc_now()) {
|
||||
return 'abgelaufen';
|
||||
return 'expired';
|
||||
}
|
||||
return 'offen';
|
||||
return 'open';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ function page_handle(string $method, string $path): void
|
|||
{
|
||||
$path = '/' . trim($path, '/');
|
||||
if (!in_array($method, ['GET', 'POST'], true)) {
|
||||
abort_page(405, 'Diese Methode ist nicht erlaubt.');
|
||||
abort_page(405, t('page.method_not_allowed'));
|
||||
}
|
||||
|
||||
if ($path === '/health') {
|
||||
|
|
@ -20,11 +20,20 @@ function page_handle(string $method, string $path): void
|
|||
return;
|
||||
}
|
||||
|
||||
// Sprachwahl über den DE/EN-Umschalter; muss auch ohne Anmeldung gehen.
|
||||
if ($path === '/language') {
|
||||
$lang = strtolower(substr(query_string('lang'), 0, 2));
|
||||
if (in_array($lang, HUB_LOCALES, true)) {
|
||||
hub_locale_set($lang);
|
||||
}
|
||||
redirect(auth_next_url('/'));
|
||||
}
|
||||
|
||||
$user = auth_user();
|
||||
if ($user !== null && $user['must_change_password'] === 1
|
||||
&& !in_array($path, ['/account', '/account/password', '/logout'], true)
|
||||
&& !in_array($path, ['/account', '/account/password', '/logout', '/language'], true)
|
||||
) {
|
||||
flash('info', 'Bitte zuerst das Passwort ändern.');
|
||||
flash('info', t('auth.change_password_first'));
|
||||
redirect('/account');
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +50,7 @@ function page_handle(string $method, string $path): void
|
|||
redirect('/');
|
||||
}
|
||||
auth_logout();
|
||||
flash('success', 'Abgemeldet.');
|
||||
flash('success', t('auth.logged_out'));
|
||||
redirect('/login');
|
||||
}
|
||||
if ($path === '/') {
|
||||
|
|
@ -94,7 +103,7 @@ function page_handle(string $method, string $path): void
|
|||
}
|
||||
if ($path === '/admin/audit') {
|
||||
require_admin_page();
|
||||
render_page('admin_audit', ['entries' => audit_list(200)], 'Audit-Log');
|
||||
render_page('admin_audit', ['entries' => audit_list(200)], t('page.admin_audit'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +124,7 @@ function page_handle(string $method, string $path): void
|
|||
return;
|
||||
}
|
||||
|
||||
abort_page(404, 'Diese Seite gibt es nicht.');
|
||||
abort_page(404, t('page.not_found'));
|
||||
}
|
||||
|
||||
function health_check(): void
|
||||
|
|
@ -163,19 +172,19 @@ function page_login(string $method): void
|
|||
'error' => $error,
|
||||
'login' => $login,
|
||||
'next' => $next,
|
||||
], 'Anmelden');
|
||||
], t('page.login'));
|
||||
}
|
||||
|
||||
function username_error(string $username): ?string
|
||||
{
|
||||
if (mb_strlen($username, 'UTF-8') < 3 || mb_strlen($username, 'UTF-8') > 32) {
|
||||
return 'Der Benutzername muss 3 bis 32 Zeichen lang sein.';
|
||||
return t('username.length');
|
||||
}
|
||||
if (preg_match('/^[a-z0-9](?:[a-z0-9._-]{1,30}[a-z0-9])$/u', $username) !== 1) {
|
||||
return 'Nur Kleinbuchstaben, Ziffern, Punkt, Bindestrich und Unterstrich; Anfang und Ende alphanumerisch.';
|
||||
return t('username.charset');
|
||||
}
|
||||
if (in_array($username, HUB_RESERVED_USERNAMES, true)) {
|
||||
return 'Dieser Benutzername ist reserviert.';
|
||||
return t('username.reserved');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -209,7 +218,7 @@ function page_register(string $method): void
|
|||
$input['email'] = post_string('email');
|
||||
|
||||
if ($invite === null) {
|
||||
$errors[] = 'Dieser Einladungscode ist ungültig, abgelaufen oder bereits eingelöst.';
|
||||
$errors[] = t('register.invalid_invite');
|
||||
} elseif (!empty($invite['email']) && $input['email'] === '') {
|
||||
$input['email'] = (string) $invite['email'];
|
||||
}
|
||||
|
|
@ -221,15 +230,15 @@ function page_register(string $method): void
|
|||
$input['display_name'] = $input['username'];
|
||||
}
|
||||
if (mb_strlen($input['display_name'], 'UTF-8') > 64) {
|
||||
$errors[] = 'Der Anzeigename darf höchstens 64 Zeichen lang sein.';
|
||||
$errors[] = t('register.display_name_long');
|
||||
}
|
||||
if ($input['email'] !== '' && filter_var($input['email'], FILTER_VALIDATE_EMAIL) === false) {
|
||||
$errors[] = 'Die E-Mail-Adresse ist nicht gültig.';
|
||||
$errors[] = t('register.email_invalid');
|
||||
}
|
||||
if ($invite !== null && !empty($invite['email'])
|
||||
&& strcasecmp((string) $invite['email'], $input['email']) !== 0
|
||||
) {
|
||||
$errors[] = 'Diese Einladung ist an eine andere E-Mail-Adresse gebunden.';
|
||||
$errors[] = t('register.email_mismatch');
|
||||
}
|
||||
$password = (string) ($_POST['password'] ?? '');
|
||||
$repeat = (string) ($_POST['password_repeat'] ?? '');
|
||||
|
|
@ -238,10 +247,10 @@ function page_register(string $method): void
|
|||
$errors[] = $policy;
|
||||
}
|
||||
if ($password !== $repeat) {
|
||||
$errors[] = 'Die Passwortwiederholung passt nicht.';
|
||||
$errors[] = t('register.password_mismatch');
|
||||
}
|
||||
if (($_POST['rights'] ?? '') !== '1') {
|
||||
$errors[] = 'Bitte die Beta-Regeln akzeptieren.';
|
||||
$errors[] = t('register.rights_required');
|
||||
}
|
||||
|
||||
if (!$errors && $invite !== null) {
|
||||
|
|
@ -268,7 +277,7 @@ function page_register(string $method): void
|
|||
$newId = (int) $pdo->lastInsertId();
|
||||
if (!invite_consume((int) $invite['id'], $newId)) {
|
||||
$pdo->rollBack();
|
||||
$errors[] = 'Der Einladungscode wurde gerade eingelöst. Bitte einen neuen Code anfordern.';
|
||||
$errors[] = t('register.invite_taken');
|
||||
} else {
|
||||
audit('invite.use', 'invite', (int) $invite['id'], $input['username'], $newId);
|
||||
audit('user.register', 'user', $newId, $input['username'], $newId);
|
||||
|
|
@ -279,9 +288,9 @@ function page_register(string $method): void
|
|||
$pdo->rollBack();
|
||||
}
|
||||
if (str_contains($exception->getMessage(), 'uq_users_username')) {
|
||||
$errors[] = 'Dieser Benutzername ist schon vergeben.';
|
||||
$errors[] = t('register.username_taken');
|
||||
} elseif (str_contains($exception->getMessage(), 'uq_users_email')) {
|
||||
$errors[] = 'Diese E-Mail-Adresse ist schon registriert.';
|
||||
$errors[] = t('register.email_taken');
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
|
|
@ -291,7 +300,7 @@ function page_register(string $method): void
|
|||
$user = auth_user_by_id($newId);
|
||||
if ($user !== null) {
|
||||
auth_login($user);
|
||||
flash('success', 'Willkommen im Kür-Hub!');
|
||||
flash('success', t('auth.welcome'));
|
||||
redirect('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -303,7 +312,7 @@ function page_register(string $method): void
|
|||
'code' => $code,
|
||||
'errors' => $errors,
|
||||
'input' => $input,
|
||||
], 'Registrieren');
|
||||
], t('page.register'));
|
||||
}
|
||||
|
||||
function page_dashboard(string $method): void
|
||||
|
|
@ -320,7 +329,7 @@ function page_dashboard(string $method): void
|
|||
'pages' => $result['pages'],
|
||||
'query' => $query,
|
||||
'mine' => $mine,
|
||||
], 'Küren');
|
||||
], t('page.dashboard'));
|
||||
}
|
||||
|
||||
function page_routine_detail(int $id, string $method): void
|
||||
|
|
@ -328,10 +337,10 @@ function page_routine_detail(int $id, string $method): void
|
|||
$user = auth_require_login();
|
||||
$routine = routine_fetch($id);
|
||||
if ($routine === null) {
|
||||
abort_page(404, 'Diese Kür gibt es nicht.');
|
||||
abort_page(404, t('routine.not_found'));
|
||||
}
|
||||
if (!routine_can_view($routine, $user)) {
|
||||
abort_page(403, 'Diese Kür ist nicht freigegeben.');
|
||||
abort_page(403, t('routine.forbidden'));
|
||||
}
|
||||
render_page('routine', [
|
||||
'routine' => $routine,
|
||||
|
|
@ -345,10 +354,10 @@ function page_routine_file(int $id, string $kind): void
|
|||
$user = auth_require_login();
|
||||
$routine = routine_fetch($id);
|
||||
if ($routine === null) {
|
||||
abort_page(404, 'Diese Kür gibt es nicht.');
|
||||
abort_page(404, t('routine.not_found'));
|
||||
}
|
||||
if (!routine_can_view($routine, $user)) {
|
||||
abort_page(403, 'Diese Kür ist nicht freigegeben.');
|
||||
abort_page(403, t('routine.forbidden'));
|
||||
}
|
||||
routine_send_file($routine, $kind);
|
||||
}
|
||||
|
|
@ -366,10 +375,10 @@ function page_upload(string $method): void
|
|||
if ($method === 'POST') {
|
||||
csrf_require();
|
||||
if (!routine_upload_quota_ok((int) $user['id'])) {
|
||||
$errors[] = 'Stündliches Upload-Limit erreicht. Bitte später erneut versuchen.';
|
||||
$errors[] = t('upload.quota');
|
||||
}
|
||||
if (($_POST['rights'] ?? '') !== '1') {
|
||||
$errors[] = 'Bitte bestätigen, dass du Kür und Musik teilen darfst.';
|
||||
$errors[] = t('upload.rights_confirm');
|
||||
}
|
||||
if (!$errors) {
|
||||
$package = routine_validate_package($_POST);
|
||||
|
|
@ -378,16 +387,16 @@ function page_upload(string $method): void
|
|||
} else {
|
||||
$duplicate = routine_duplicate_exists((int) $user['id'], $package);
|
||||
if ($duplicate !== null) {
|
||||
flash('info', 'Diese Kür ist bereits im Hub.');
|
||||
flash('info', t('upload.duplicate'));
|
||||
redirect('/routines/' . $duplicate);
|
||||
}
|
||||
try {
|
||||
$routineId = routine_create((int) $user['id'], $package);
|
||||
flash('success', 'Kür veröffentlicht.');
|
||||
flash('success', t('upload.published'));
|
||||
redirect('/routines/' . $routineId);
|
||||
} catch (Throwable $error) {
|
||||
hub_log('Upload fehlgeschlagen: ' . $error->getMessage());
|
||||
$errors[] = 'Die Kür konnte nicht gespeichert werden.';
|
||||
$errors[] = t('upload.save_failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -400,7 +409,7 @@ function page_upload(string $method): void
|
|||
'errors' => $errors,
|
||||
'input' => $input,
|
||||
'routine' => null,
|
||||
], 'Kür hochladen');
|
||||
], t('page.upload'));
|
||||
}
|
||||
|
||||
function page_routine_revise(int $id, string $method): void
|
||||
|
|
@ -408,10 +417,10 @@ function page_routine_revise(int $id, string $method): void
|
|||
$user = auth_require_login();
|
||||
$routine = routine_fetch($id);
|
||||
if ($routine === null) {
|
||||
abort_page(404, 'Diese Kür gibt es nicht.');
|
||||
abort_page(404, t('routine.not_found'));
|
||||
}
|
||||
if (!routine_can_edit($routine, $user)) {
|
||||
abort_page(403, 'Nur der Eigentümer oder ein Admin kann diese Kür ändern.');
|
||||
abort_page(403, t('routine.edit_forbidden'));
|
||||
}
|
||||
$errors = [];
|
||||
$input = [
|
||||
|
|
@ -423,10 +432,10 @@ function page_routine_revise(int $id, string $method): void
|
|||
if ($method === 'POST') {
|
||||
csrf_require();
|
||||
if (!routine_upload_quota_ok((int) $user['id'])) {
|
||||
$errors[] = 'Stündliches Upload-Limit erreicht. Bitte später erneut versuchen.';
|
||||
$errors[] = t('upload.quota');
|
||||
}
|
||||
if (($_POST['rights'] ?? '') !== '1') {
|
||||
$errors[] = 'Bitte bestätigen, dass du Kür und Musik teilen darfst.';
|
||||
$errors[] = t('upload.rights_confirm');
|
||||
}
|
||||
if (!$errors) {
|
||||
$package = routine_validate_package($_POST);
|
||||
|
|
@ -435,11 +444,11 @@ function page_routine_revise(int $id, string $method): void
|
|||
} else {
|
||||
try {
|
||||
$revision = routine_add_revision($id, (int) $user['id'], $package);
|
||||
flash('success', 'Neue Revision ' . $revision . ' gespeichert.');
|
||||
flash('success', t('revision.saved', ['revision' => $revision]));
|
||||
redirect('/routines/' . $id);
|
||||
} catch (Throwable $error) {
|
||||
hub_log('Revision fehlgeschlagen: ' . $error->getMessage());
|
||||
$errors[] = 'Die Revision konnte nicht gespeichert werden.';
|
||||
$errors[] = t('revision.save_failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -452,7 +461,7 @@ function page_routine_revise(int $id, string $method): void
|
|||
'errors' => $errors,
|
||||
'input' => $input,
|
||||
'routine' => $routine,
|
||||
], 'Neue Revision');
|
||||
], t('page.revision'));
|
||||
}
|
||||
|
||||
function page_routine_status(int $id, string $action, string $method): void
|
||||
|
|
@ -464,14 +473,14 @@ function page_routine_status(int $id, string $action, string $method): void
|
|||
csrf_require();
|
||||
$routine = routine_fetch($id);
|
||||
if ($routine === null) {
|
||||
abort_page(404, 'Diese Kür gibt es nicht.');
|
||||
abort_page(404, t('routine.not_found'));
|
||||
}
|
||||
if (!routine_can_edit($routine, $user)) {
|
||||
abort_page(403, 'Nur der Eigentümer oder ein Admin kann diese Kür ändern.');
|
||||
abort_page(403, t('routine.edit_forbidden'));
|
||||
}
|
||||
$status = $action === 'publish' ? 'published' : 'hidden';
|
||||
routine_set_status($id, $status);
|
||||
flash('success', $status === 'published' ? 'Kür ist wieder sichtbar.' : 'Kür wurde aus dem Hub genommen.');
|
||||
flash('success', $status === 'published' ? t('routine.published_again') : t('routine.hidden_now'));
|
||||
redirect('/routines/' . $id);
|
||||
}
|
||||
|
||||
|
|
@ -480,7 +489,7 @@ function page_account(string $method): void
|
|||
$user = auth_require_login();
|
||||
render_page('account', [
|
||||
'tokens' => tokens_list((int) $user['id']),
|
||||
], 'Konto');
|
||||
], t('page.account'));
|
||||
}
|
||||
|
||||
function page_account_password(string $method): void
|
||||
|
|
@ -496,14 +505,14 @@ function page_account_password(string $method): void
|
|||
$errors = [];
|
||||
|
||||
if (!password_verify($current, (string) $user['password_hash'])) {
|
||||
$errors[] = 'Das aktuelle Passwort ist falsch.';
|
||||
$errors[] = t('account.current_wrong');
|
||||
}
|
||||
$policy = password_policy_error($password, (string) $user['username']);
|
||||
if ($policy !== null) {
|
||||
$errors[] = $policy;
|
||||
}
|
||||
if ($password !== $repeat) {
|
||||
$errors[] = 'Die Passwortwiederholung passt nicht.';
|
||||
$errors[] = t('register.password_mismatch');
|
||||
}
|
||||
if ($errors) {
|
||||
foreach ($errors as $error) {
|
||||
|
|
@ -517,7 +526,7 @@ function page_account_password(string $method): void
|
|||
)->execute([hash_password($password), utc_now(), (int) $user['id']]);
|
||||
auth_revoke_sessions((int) $user['id']);
|
||||
audit('user.password_change', 'user', (int) $user['id']);
|
||||
flash('success', 'Passwort geändert. Andere Sitzungen wurden abgemeldet.');
|
||||
flash('success', t('account.password_changed'));
|
||||
redirect('/account');
|
||||
}
|
||||
|
||||
|
|
@ -533,7 +542,7 @@ function page_account_token_create(string $method): void
|
|||
$name = 'App';
|
||||
}
|
||||
$created = token_create((int) $user['id'], $name);
|
||||
flash_secret('Neuer API-Token – jetzt kopieren, er wird nicht erneut angezeigt', $created['token']);
|
||||
flash_secret(t('token.created'), $created['token']);
|
||||
redirect('/account');
|
||||
}
|
||||
|
||||
|
|
@ -547,9 +556,9 @@ function page_account_token_revoke(string $method): void
|
|||
$tokenId = (int) post_string('token_id');
|
||||
if (token_revoke($tokenId, (int) $user['id'])) {
|
||||
audit('token.revoke', 'token', $tokenId);
|
||||
flash('success', 'Token widerrufen.');
|
||||
flash('success', t('token.revoked'));
|
||||
} else {
|
||||
flash('error', 'Token nicht gefunden.');
|
||||
flash('error', t('token.not_found'));
|
||||
}
|
||||
redirect('/account');
|
||||
}
|
||||
|
|
@ -564,7 +573,7 @@ function page_admin_invites(string $method): void
|
|||
$days = (int) post_string('expires_days', '30');
|
||||
$errors = [];
|
||||
if ($email !== '' && filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
|
||||
$errors[] = 'Die E-Mail-Adresse ist nicht gültig.';
|
||||
$errors[] = t('register.email_invalid');
|
||||
}
|
||||
if ($errors) {
|
||||
foreach ($errors as $error) {
|
||||
|
|
@ -574,14 +583,14 @@ function page_admin_invites(string $method): void
|
|||
$code = invite_create($note, $email, $days, (int) $admin['id']);
|
||||
$publicUrl = rtrim((string) config('app.public_url', ''), '/');
|
||||
$link = $publicUrl . '/register?code=' . rawurlencode($code);
|
||||
flash_secret('Einladungscode', $code . ' – Link: ' . $link);
|
||||
flash('success', 'Einladung erstellt.');
|
||||
flash_secret(t('invite.created_label'), $code . ' – Link: ' . $link);
|
||||
flash('success', t('invite.created'));
|
||||
}
|
||||
redirect('/admin/invites');
|
||||
}
|
||||
render_page('admin_invites', [
|
||||
'invites' => invites_list(),
|
||||
], 'Einladungen');
|
||||
], t('page.admin_invites'));
|
||||
}
|
||||
|
||||
function page_admin_invite_revoke(string $method): void
|
||||
|
|
@ -594,9 +603,9 @@ function page_admin_invite_revoke(string $method): void
|
|||
$inviteId = (int) post_string('invite_id');
|
||||
if (invite_revoke($inviteId)) {
|
||||
audit('invite.revoke', 'invite', $inviteId);
|
||||
flash('success', 'Einladung widerrufen.');
|
||||
flash('success', t('invite.revoked'));
|
||||
} else {
|
||||
flash('error', 'Einladung konnte nicht widerrufen werden.');
|
||||
flash('error', t('invite.revoke_failed'));
|
||||
}
|
||||
redirect('/admin/invites');
|
||||
}
|
||||
|
|
@ -608,7 +617,7 @@ function page_admin_users(string $method): void
|
|||
'SELECT u.*, (SELECT COUNT(*) FROM routines r WHERE r.owner_id = u.id) AS routine_count
|
||||
FROM users u ORDER BY u.created_at DESC, u.id DESC'
|
||||
)->fetchAll();
|
||||
render_page('admin_users', ['users' => $users], 'Benutzer');
|
||||
render_page('admin_users', ['users' => $users], t('page.admin_users'));
|
||||
}
|
||||
|
||||
function page_admin_user_action(string $method): void
|
||||
|
|
@ -622,11 +631,11 @@ function page_admin_user_action(string $method): void
|
|||
$action = post_string('action');
|
||||
$target = auth_user_by_id($targetId);
|
||||
if ($target === null) {
|
||||
flash('error', 'Benutzer nicht gefunden.');
|
||||
flash('error', t('user.not_found'));
|
||||
redirect('/admin/users');
|
||||
}
|
||||
if ($targetId === (int) $admin['id']) {
|
||||
flash('error', 'Das eigene Konto lässt sich hier nicht ändern.');
|
||||
flash('error', t('user.self_change'));
|
||||
redirect('/admin/users');
|
||||
}
|
||||
|
||||
|
|
@ -634,11 +643,11 @@ function page_admin_user_action(string $method): void
|
|||
db()->prepare("UPDATE users SET status = 'disabled' WHERE id = ?")->execute([$targetId]);
|
||||
auth_revoke_sessions($targetId);
|
||||
audit('user.disable', 'user', $targetId, (string) $target['username']);
|
||||
flash('success', 'Benutzer deaktiviert.');
|
||||
flash('success', t('user.disabled'));
|
||||
} elseif ($action === 'enable') {
|
||||
db()->prepare("UPDATE users SET status = 'active' WHERE id = ?")->execute([$targetId]);
|
||||
audit('user.enable', 'user', $targetId, (string) $target['username']);
|
||||
flash('success', 'Benutzer aktiviert.');
|
||||
flash('success', t('user.enabled'));
|
||||
} elseif ($action === 'reset') {
|
||||
$alphabet = HUB_INVITE_ALPHABET;
|
||||
$temp = '';
|
||||
|
|
@ -650,11 +659,11 @@ function page_admin_user_action(string $method): void
|
|||
)->execute([hash_password($temp), utc_now(), $targetId]);
|
||||
auth_revoke_sessions($targetId);
|
||||
audit('user.password_reset', 'user', $targetId, (string) $target['username']);
|
||||
flash_secret('Temporäres Passwort für ' . $target['username'], $temp);
|
||||
flash('info', 'Der Benutzer muss das Passwort bei der nächsten Anmeldung ändern.');
|
||||
flash_secret(t('user.temp_password', ['user' => $target['username']]), $temp);
|
||||
flash('info', t('user.must_change'));
|
||||
} elseif ($action === 'delete') {
|
||||
if (($_POST['confirm'] ?? '') !== '1') {
|
||||
flash('error', 'Löschen muss bestätigt werden.');
|
||||
flash('error', t('user.delete_confirm_required'));
|
||||
redirect('/admin/users');
|
||||
}
|
||||
$stmt = db()->prepare('SELECT id FROM routines WHERE owner_id = ?');
|
||||
|
|
@ -666,9 +675,9 @@ function page_admin_user_action(string $method): void
|
|||
->execute([utc_now(), $targetId]);
|
||||
audit('user.delete', 'user', $targetId, (string) $target['username']);
|
||||
db()->prepare('DELETE FROM users WHERE id = ?')->execute([$targetId]);
|
||||
flash('success', 'Benutzer und zugehörige Küren gelöscht.');
|
||||
flash('success', t('user.deleted'));
|
||||
} else {
|
||||
flash('error', 'Unbekannte Aktion.');
|
||||
flash('error', t('action.unknown'));
|
||||
}
|
||||
redirect('/admin/users');
|
||||
}
|
||||
|
|
@ -685,7 +694,7 @@ function page_admin_routines(string $method): void
|
|||
'page' => $result['page'],
|
||||
'pages' => $result['pages'],
|
||||
'query' => $query,
|
||||
], 'Alle Küren');
|
||||
], t('page.admin_routines'));
|
||||
}
|
||||
|
||||
function page_admin_routine_action(string $method): void
|
||||
|
|
@ -699,21 +708,21 @@ function page_admin_routine_action(string $method): void
|
|||
$action = post_string('action');
|
||||
$routine = routine_fetch($routineId);
|
||||
if ($routine === null) {
|
||||
flash('error', 'Kür nicht gefunden.');
|
||||
flash('error', t('routine.not_found_short'));
|
||||
redirect('/admin/routines');
|
||||
}
|
||||
if ($action === 'hide' || $action === 'publish') {
|
||||
routine_set_status($routineId, $action === 'publish' ? 'published' : 'hidden');
|
||||
flash('success', 'Status geändert.');
|
||||
flash('success', t('admin.status_changed'));
|
||||
} elseif ($action === 'delete') {
|
||||
if (($_POST['confirm'] ?? '') !== '1') {
|
||||
flash('error', 'Löschen muss bestätigt werden.');
|
||||
flash('error', t('user.delete_confirm_required'));
|
||||
redirect('/admin/routines');
|
||||
}
|
||||
routine_delete($routineId);
|
||||
flash('success', 'Kür endgültig gelöscht.');
|
||||
flash('success', t('routine.deleted'));
|
||||
} else {
|
||||
flash('error', 'Unbekannte Aktion.');
|
||||
flash('error', t('action.unknown'));
|
||||
}
|
||||
redirect('/admin/routines');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ function routine_music_name_valid(string $name): bool
|
|||
function upload_error_message(int $code): string
|
||||
{
|
||||
return match ($code) {
|
||||
UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE => 'Die Datei ist zu groß.',
|
||||
UPLOAD_ERR_PARTIAL => 'Der Upload wurde unterbrochen.',
|
||||
UPLOAD_ERR_NO_FILE => 'Es wurde keine Datei ausgewählt.',
|
||||
UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION => 'Die Datei konnte nicht gespeichert werden.',
|
||||
default => 'Unbekannter Upload-Fehler.',
|
||||
UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE => t('upload.file_too_large'),
|
||||
UPLOAD_ERR_PARTIAL => t('upload.interrupted'),
|
||||
UPLOAD_ERR_NO_FILE => t('upload.no_file_chosen'),
|
||||
UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION => t('upload.store_failed'),
|
||||
default => t('upload.unknown_error'),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -112,20 +112,20 @@ function routine_validate_package(array $post): array
|
|||
|
||||
$routineFile = $_FILES['routine'] ?? null;
|
||||
if (!is_array($routineFile) || ($routineFile['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) {
|
||||
$errors[] = 'Bitte eine Kür-Datei (.json) auswählen.';
|
||||
$errors[] = t('upload.select_routine');
|
||||
return ['ok' => false, 'errors' => $errors];
|
||||
}
|
||||
$routineTmp = (string) $routineFile['tmp_name'];
|
||||
$routineBytes = (int) $routineFile['size'];
|
||||
if (!is_uploaded_file($routineTmp)) {
|
||||
return ['ok' => false, 'errors' => ['Ungültiger Upload.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.invalid')]];
|
||||
}
|
||||
if ($routineBytes <= 0 || $routineBytes > $maxRoutine) {
|
||||
$errors[] = 'Die Kür-Datei ist zu groß (max. ' . human_bytes($maxRoutine) . ').';
|
||||
$errors[] = t('upload.routine_too_large', ['max' => human_bytes($maxRoutine)]);
|
||||
}
|
||||
$routineName = clean_filename((string) ($routineFile['name'] ?? 'kuer.json'));
|
||||
if (!str_ends_with(strtolower($routineName), '.json')) {
|
||||
$errors[] = 'Kürdateien müssen im JSON-Format vorliegen (.json).';
|
||||
$errors[] = t('upload.routine_not_json');
|
||||
}
|
||||
if ($errors) {
|
||||
return ['ok' => false, 'errors' => $errors];
|
||||
|
|
@ -133,28 +133,28 @@ function routine_validate_package(array $post): array
|
|||
|
||||
$contents = file_get_contents($routineTmp);
|
||||
if (!is_string($contents)) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür-Datei konnte nicht gelesen werden.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.read_failed')]];
|
||||
}
|
||||
try {
|
||||
$json = json_decode($contents, true, 64, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür-Datei ist kein gültiges JSON.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.invalid_json')]];
|
||||
}
|
||||
if (!is_array($json)) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür-Datei enthält kein JSON-Objekt.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.no_json_object')]];
|
||||
}
|
||||
if (($json['format'] ?? '') !== 'rinkplanner.routine') {
|
||||
return ['ok' => false, 'errors' => ['Das ist keine Rinkplanner-Kür (format fehlt oder ist falsch).']];
|
||||
return ['ok' => false, 'errors' => [t('upload.not_rinkplanner')]];
|
||||
}
|
||||
$formatVersion = (int) ($json['format_version'] ?? 0);
|
||||
if ($formatVersion !== 1) {
|
||||
return ['ok' => false, 'errors' => ['Diese Kür-Formatversion wird nicht unterstützt.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.unsupported_version')]];
|
||||
}
|
||||
if (!is_array($json['sections'] ?? null)) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür enthält keine Abschnittsliste.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.no_sections')]];
|
||||
}
|
||||
if (count($json['sections']) > 500) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür hat zu viele Abschnitte (max. 500).']];
|
||||
return ['ok' => false, 'errors' => [t('upload.too_many_sections')]];
|
||||
}
|
||||
|
||||
$title = trim((string) ($json['title'] ?? ''));
|
||||
|
|
@ -162,14 +162,14 @@ function routine_validate_package(array $post): array
|
|||
$title = (string) pathinfo($routineName, PATHINFO_FILENAME);
|
||||
}
|
||||
if ($title === '') {
|
||||
return ['ok' => false, 'errors' => ['Die Kür braucht einen Titel.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.title_required')]];
|
||||
}
|
||||
$title = truncate_text($title, 190);
|
||||
$skater = truncate_text(trim((string) ($json['skater_name'] ?? '')), 190);
|
||||
$category = truncate_text(trim((string) ($json['adult_category'] ?? '')), 40);
|
||||
$musicFile = trim((string) ($json['music_file'] ?? ''));
|
||||
if ($musicFile !== '' && !routine_music_name_valid($musicFile)) {
|
||||
return ['ok' => false, 'errors' => ['Die Kür verweist auf einen ungültigen Musikdateinamen.']];
|
||||
return ['ok' => false, 'errors' => [t('upload.bad_music_name')]];
|
||||
}
|
||||
$fileRoutineId = trim((string) ($json['routine_id'] ?? ''));
|
||||
|
||||
|
|
@ -177,10 +177,10 @@ function routine_validate_package(array $post): array
|
|||
$audioFile = $_FILES['audio'] ?? null;
|
||||
$hasAudioUpload = is_array($audioFile) && ($audioFile['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_NO_FILE;
|
||||
if ($musicFile !== '' && !$hasAudioUpload) {
|
||||
$errors[] = 'Die Kür verweist auf „' . $musicFile . '“. Bitte die passende Audiodatei mit hochladen.';
|
||||
$errors[] = t('upload.music_missing', ['name' => $musicFile]);
|
||||
}
|
||||
if ($musicFile === '' && $hasAudioUpload) {
|
||||
$errors[] = 'Die Kür verweist auf keine Musikdatei; die Audiodatei passt nicht dazu.';
|
||||
$errors[] = t('upload.music_unexpected');
|
||||
}
|
||||
if ($hasAudioUpload) {
|
||||
if (($audioFile['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) {
|
||||
|
|
@ -190,15 +190,15 @@ function routine_validate_package(array $post): array
|
|||
$audioBytes = (int) $audioFile['size'];
|
||||
$audioName = clean_filename((string) ($audioFile['name'] ?? ''));
|
||||
if (!is_uploaded_file($audioTmp)) {
|
||||
$errors[] = 'Ungültiger Audio-Upload.';
|
||||
$errors[] = t('upload.audio_invalid');
|
||||
} elseif ($audioBytes <= 0 || $audioBytes > $maxAudio) {
|
||||
$errors[] = 'Die Audiodatei ist zu groß (max. ' . human_bytes($maxAudio) . ').';
|
||||
$errors[] = t('upload.audio_too_large', ['max' => human_bytes($maxAudio)]);
|
||||
} elseif ($audioName !== $musicFile) {
|
||||
$errors[] = 'Die Audiodatei heißt „' . $audioName . '“, die Kür verweist aber auf „' . $musicFile . '“.';
|
||||
$errors[] = t('upload.audio_name_mismatch', ['actual' => $audioName, 'expected' => $musicFile]);
|
||||
} else {
|
||||
$sniffed = audio_sniff($audioTmp);
|
||||
if ($sniffed === null) {
|
||||
$errors[] = 'Die Audiodatei ist kein unterstütztes Format (MP3, OGG, WAV, M4A, AAC).';
|
||||
$errors[] = t('upload.audio_format');
|
||||
} else {
|
||||
$audio = [
|
||||
'tmp' => $audioTmp,
|
||||
|
|
@ -542,9 +542,9 @@ function routine_send_file(array $routine, string $kind, ?array $user = null, bo
|
|||
$revision = routine_fetch((int) $routine['id']);
|
||||
if ($revision === null || $revision['revision_id'] === null) {
|
||||
if ($api) {
|
||||
abort_api(404, 'no_file', 'Diese Kür hat noch keine Datei.');
|
||||
abort_api(404, 'no_file', t('routine.no_file_yet'));
|
||||
}
|
||||
abort_page(404, 'Diese Kür hat noch keine Datei.');
|
||||
abort_page(404, t('routine.no_file_yet'));
|
||||
}
|
||||
if ($kind === 'audio') {
|
||||
$path = (string) ($revision['audio_path'] ?? '');
|
||||
|
|
@ -558,16 +558,16 @@ function routine_send_file(array $routine, string $kind, ?array $user = null, bo
|
|||
$absolute = storage_path($path);
|
||||
if ($path === '' || !is_file($absolute)) {
|
||||
if ($api) {
|
||||
abort_api(404, 'file_missing', 'Die Datei fehlt im Speicher.');
|
||||
abort_api(404, 'file_missing', t('routine.file_missing'));
|
||||
}
|
||||
abort_page(404, 'Die Datei fehlt im Speicher.');
|
||||
abort_page(404, t('routine.file_missing'));
|
||||
}
|
||||
$handle = fopen($absolute, 'rb');
|
||||
if ($handle === false) {
|
||||
if ($api) {
|
||||
abort_api(500, 'file_unreadable', 'Die Datei konnte nicht geöffnet werden.');
|
||||
abort_api(500, 'file_unreadable', t('routine.file_unreadable'));
|
||||
}
|
||||
abort_page(500, 'Die Datei konnte nicht geöffnet werden.');
|
||||
abort_page(500, t('routine.file_unreadable'));
|
||||
}
|
||||
|
||||
$user ??= auth_user();
|
||||
|
|
|
|||
|
|
@ -99,14 +99,14 @@ function api_require_user(): array
|
|||
{
|
||||
$token = bearer_token();
|
||||
if ($token === '') {
|
||||
abort_api(401, 'unauthorized', 'Bearer-Token fehlt.');
|
||||
abort_api(401, 'unauthorized', t('api.bearer_missing'));
|
||||
}
|
||||
$user = token_user($token);
|
||||
if ($user === null) {
|
||||
abort_api(401, 'invalid_token', 'Token ist ungültig, abgelaufen oder widerrufen.');
|
||||
abort_api(401, 'invalid_token', t('api.token_invalid'));
|
||||
}
|
||||
if ($user['must_change_password'] === 1) {
|
||||
abort_api(403, 'password_change_required', 'Bitte zuerst im Web das Passwort ändern.');
|
||||
abort_api(403, 'password_change_required', t('api.change_password_web'));
|
||||
}
|
||||
return $user;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ function url(string $path = '/'): string
|
|||
return $base . $path;
|
||||
}
|
||||
|
||||
/** Cache-Buster für /assets/: bei Änderungen an hub.css erhöhen. */
|
||||
const HUB_ASSET_VERSION = '3';
|
||||
|
||||
function redirect(string $path, int $status = 303): never
|
||||
{
|
||||
header('Location: ' . url($path), true, $status);
|
||||
|
|
@ -141,17 +144,27 @@ function fmt_dt(?string $utc): string
|
|||
}
|
||||
try {
|
||||
$date = new DateTimeImmutable($utc, new DateTimeZone('UTC'));
|
||||
return $date->setTimezone(new DateTimeZone('Europe/Berlin'))->format('d.m.Y H:i');
|
||||
$format = hub_locale() === 'en' ? 'Y-m-d H:i' : 'd.m.Y H:i';
|
||||
return $date->setTimezone(new DateTimeZone('Europe/Berlin'))->format($format);
|
||||
} catch (Throwable) {
|
||||
return '–';
|
||||
}
|
||||
}
|
||||
|
||||
/** Zahl mit den Trennzeichen der aktuellen Sprache. */
|
||||
function fmt_number(float $value, int $decimals = 1): string
|
||||
{
|
||||
if (hub_locale() === 'en') {
|
||||
return number_format($value, $decimals, '.', ',');
|
||||
}
|
||||
return number_format($value, $decimals, ',', '.');
|
||||
}
|
||||
|
||||
function human_bytes(int|float|null $bytes): string
|
||||
{
|
||||
$bytes = (float) ($bytes ?? 0);
|
||||
if ($bytes < 1024) {
|
||||
return number_format($bytes, 0, ',', '.') . ' B';
|
||||
return fmt_number($bytes, 0) . ' B';
|
||||
}
|
||||
$units = ['KB', 'MB', 'GB'];
|
||||
$index = -1;
|
||||
|
|
@ -159,7 +172,7 @@ function human_bytes(int|float|null $bytes): string
|
|||
$bytes /= 1024;
|
||||
$index++;
|
||||
} while ($bytes >= 1024 && $index < count($units) - 1);
|
||||
return number_format($bytes, 1, ',', '.') . ' ' . $units[$index];
|
||||
return fmt_number($bytes, 1) . ' ' . $units[$index];
|
||||
}
|
||||
|
||||
function truncate_text(string $value, int $length): string
|
||||
|
|
@ -229,7 +242,7 @@ function csrf_valid(): bool
|
|||
function csrf_require(): void
|
||||
{
|
||||
if (!csrf_valid()) {
|
||||
abort_page(419, 'Die Sitzung ist abgelaufen. Bitte die Seite neu laden.');
|
||||
abort_page(419, t('auth.session_expired'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -272,11 +285,11 @@ function render(string $view, array $data = []): string
|
|||
return (string) ob_get_clean();
|
||||
}
|
||||
|
||||
function render_page(string $view, array $data = [], string $title = 'Kür-Hub'): void
|
||||
function render_page(string $view, array $data = [], ?string $title = null): void
|
||||
{
|
||||
$content = render($view, $data);
|
||||
echo render('layout', [
|
||||
'title' => $title,
|
||||
'title' => $title ?? t('page.title_default'),
|
||||
'content' => $content,
|
||||
'user' => auth_user(),
|
||||
]);
|
||||
|
|
@ -287,7 +300,7 @@ function abort_page(int $status, string $message): never
|
|||
http_response_code($status);
|
||||
$content = render('error', ['status' => $status, 'message' => $message]);
|
||||
echo render('layout', [
|
||||
'title' => 'Fehler ' . $status,
|
||||
'title' => t('page.title_error', ['status' => $status]),
|
||||
'content' => $content,
|
||||
'user' => auth_user(),
|
||||
]);
|
||||
|
|
@ -303,13 +316,13 @@ function password_policy_error(string $password, string $username = ''): ?string
|
|||
{
|
||||
$length = mb_strlen($password, 'UTF-8');
|
||||
if ($length < 10) {
|
||||
return 'Das Passwort muss mindestens 10 Zeichen lang sein.';
|
||||
return t('password.min');
|
||||
}
|
||||
if ($length > 200) {
|
||||
return 'Das Passwort darf höchstens 200 Zeichen lang sein.';
|
||||
return t('password.max');
|
||||
}
|
||||
if ($username !== '' && mb_strtolower($password) === mb_strtolower($username)) {
|
||||
return 'Das Passwort darf nicht dem Benutzernamen entsprechen.';
|
||||
return t('password.same_as_username');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php /** @var string $active */ ?>
|
||||
<nav class="admin-tabs">
|
||||
<a class="<?= $active === 'invites' ? 'active' : '' ?>" href="<?= e(url('/admin/invites')) ?>">Einladungen</a>
|
||||
<a class="<?= $active === 'users' ? 'active' : '' ?>" href="<?= e(url('/admin/users')) ?>">Benutzer</a>
|
||||
<a class="<?= $active === 'routines' ? 'active' : '' ?>" href="<?= e(url('/admin/routines')) ?>">Küren</a>
|
||||
<a class="<?= $active === 'audit' ? 'active' : '' ?>" href="<?= e(url('/admin/audit')) ?>">Audit-Log</a>
|
||||
<a class="<?= $active === 'invites' ? 'active' : '' ?>" href="<?= e(url('/admin/invites')) ?>"><?= e(t('admin.tab_invites')) ?></a>
|
||||
<a class="<?= $active === 'users' ? 'active' : '' ?>" href="<?= e(url('/admin/users')) ?>"><?= e(t('admin.tab_users')) ?></a>
|
||||
<a class="<?= $active === 'routines' ? 'active' : '' ?>" href="<?= e(url('/admin/routines')) ?>"><?= e(t('admin.tab_routines')) ?></a>
|
||||
<a class="<?= $active === 'audit' ? 'active' : '' ?>" href="<?= e(url('/admin/audit')) ?>"><?= e(t('admin.tab_audit')) ?></a>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -2,51 +2,58 @@
|
|||
<?php $user = auth_user(); ?>
|
||||
<section class="page-head">
|
||||
<div>
|
||||
<h1>Konto</h1>
|
||||
<p class="muted"><?= e($user['username']) ?> · <?= e($user['role'] === 'admin' ? 'Administrator' : 'Beta-Nutzer') ?></p>
|
||||
<h1><?= e(t('account.title')) ?></h1>
|
||||
<p class="muted"><?= e($user['username']) ?> · <?= e($user['role'] === 'admin' ? t('account.role_admin') : t('account.role_user')) ?></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($user['must_change_password'] === 1): ?>
|
||||
<div class="flash flash-info">Bitte ein neues Passwort setzen, bevor du den Hub weiter nutzt.</div>
|
||||
<div class="flash flash-info"><?= e(t('account.must_change')) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="columns">
|
||||
<section class="panel">
|
||||
<h2>Passwort ändern</h2>
|
||||
<h2><?= e(t('account.change_password')) ?></h2>
|
||||
<form method="post" action="<?= e(url('/account/password')) ?>" class="stack">
|
||||
<?= csrf_field() ?>
|
||||
<label>
|
||||
Aktuelles Passwort
|
||||
<?= e(t('account.current_password')) ?>
|
||||
<input type="password" name="current_password" autocomplete="current-password" required>
|
||||
</label>
|
||||
<label>
|
||||
Neues Passwort
|
||||
<?= e(t('account.new_password')) ?>
|
||||
<input type="password" name="password" autocomplete="new-password" required>
|
||||
<span class="hint">Mindestens 10 Zeichen.</span>
|
||||
<span class="hint"><?= e(t('account.password_hint')) ?></span>
|
||||
</label>
|
||||
<label>
|
||||
Neues Passwort wiederholen
|
||||
<?= e(t('account.repeat_password')) ?>
|
||||
<input type="password" name="password_repeat" autocomplete="new-password" required>
|
||||
</label>
|
||||
<button class="primary" type="submit">Passwort speichern</button>
|
||||
<button class="primary" type="submit"><?= e(t('account.save_password')) ?></button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>API-Tokens</h2>
|
||||
<p class="muted">Für die Godot-App. Ein Token ersetzt Benutzername und Passwort im Client und lässt sich jederzeit widerrufen.</p>
|
||||
<h2><?= e(t('account.tokens')) ?></h2>
|
||||
<p class="muted"><?= e(t('account.tokens_lede')) ?></p>
|
||||
<form method="post" action="<?= e(url('/account/tokens')) ?>" class="inline-form">
|
||||
<?= csrf_field() ?>
|
||||
<input type="text" name="name" maxlength="64" placeholder="Name, z. B. Büro-PC" required>
|
||||
<button type="submit">Token erzeugen</button>
|
||||
<input type="text" name="name" maxlength="64" placeholder="<?= e_attr(t('account.token_placeholder')) ?>" required>
|
||||
<button type="submit"><?= e(t('account.token_create')) ?></button>
|
||||
</form>
|
||||
|
||||
<?php if ($tokens): ?>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Prefix</th><th>Erstellt</th><th>Zuletzt</th><th>Status</th><th></th></tr>
|
||||
<tr>
|
||||
<th><?= e(t('table.name')) ?></th>
|
||||
<th><?= e(t('table.prefix')) ?></th>
|
||||
<th><?= e(t('table.created')) ?></th>
|
||||
<th><?= e(t('table.last_used')) ?></th>
|
||||
<th><?= e(t('table.status')) ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($tokens as $token): ?>
|
||||
|
|
@ -55,13 +62,13 @@
|
|||
<td><code><?= e($token['prefix']) ?>…</code></td>
|
||||
<td><?= e(fmt_dt($token['created_at'])) ?></td>
|
||||
<td><?= e(fmt_dt($token['last_used_at'])) ?></td>
|
||||
<td><?= $token['revoked_at'] !== null ? 'widerrufen' : 'aktiv' ?></td>
|
||||
<td><?= e($token['revoked_at'] !== null ? t('account.token_revoked') : t('account.token_active')) ?></td>
|
||||
<td>
|
||||
<?php if ($token['revoked_at'] === null): ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/account/tokens/revoke')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="token_id" value="<?= (int) $token['id'] ?>">
|
||||
<button class="link-button danger" type="submit">widerrufen</button>
|
||||
<button class="link-button danger" type="submit"><?= e(t('account.token_revoke')) ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
@ -71,7 +78,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="muted small">Noch kein Token erzeugt.</p>
|
||||
<p class="muted small"><?= e(t('account.no_tokens')) ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,27 @@
|
|||
<?php /** @var array $entries */ ?>
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Verwaltung</h1>
|
||||
<p class="muted">Die letzten <?= count($entries) ?> Ereignisse.</p>
|
||||
<h1><?= e(t('admin.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('admin.audit_lede', ['count' => count($entries)])) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php $active = 'audit'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
|
||||
|
||||
<section class="panel">
|
||||
<?php if (!$entries): ?>
|
||||
<p class="muted">Noch keine Einträge.</p>
|
||||
<p class="muted"><?= e(t('admin.audit_empty')) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Zeit</th><th>Akteur</th><th>Aktion</th><th>Objekt</th><th>Detail</th><th>IP</th></tr>
|
||||
<tr>
|
||||
<th><?= e(t('table.time')) ?></th>
|
||||
<th><?= e(t('table.actor')) ?></th>
|
||||
<th><?= e(t('table.action')) ?></th>
|
||||
<th><?= e(t('table.subject')) ?></th>
|
||||
<th><?= e(t('table.detail')) ?></th>
|
||||
<th><?= e(t('table.ip')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($entries as $entry): ?>
|
||||
|
|
|
|||
|
|
@ -1,63 +1,71 @@
|
|||
<?php /** @var array $invites */ ?>
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Verwaltung</h1>
|
||||
<p class="muted">Einladungen für die geschlossene Beta.</p>
|
||||
<h1><?= e(t('admin.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('admin_invites.lede')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php $active = 'invites'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Neue Einladung</h2>
|
||||
<p class="muted">Der Code wird nach dem Anlegen genau einmal angezeigt. Er gilt für ein Konto.</p>
|
||||
<h2><?= e(t('admin_invites.new')) ?></h2>
|
||||
<p class="muted"><?= e(t('admin_invites.new_lede')) ?></p>
|
||||
<form method="post" action="<?= e(url('/admin/invites')) ?>" class="stack">
|
||||
<?= csrf_field() ?>
|
||||
<div class="grid-3">
|
||||
<label>
|
||||
Notiz (intern)
|
||||
<input type="text" name="note" maxlength="190" placeholder="z. B. Verein Nord">
|
||||
<?= e(t('admin_invites.note')) ?>
|
||||
<input type="text" name="note" maxlength="190" placeholder="<?= e_attr(t('admin_invites.note_placeholder')) ?>">
|
||||
</label>
|
||||
<label>
|
||||
E-Mail binden (optional)
|
||||
<?= e(t('admin_invites.email')) ?>
|
||||
<input type="email" name="email" maxlength="190">
|
||||
<span class="hint">Nur diese Adresse kann den Code nutzen.</span>
|
||||
<span class="hint"><?= e(t('admin_invites.email_hint')) ?></span>
|
||||
</label>
|
||||
<label>
|
||||
Gültig (Tage)
|
||||
<?= e(t('admin_invites.days')) ?>
|
||||
<input type="number" name="expires_days" min="0" max="365" value="30">
|
||||
<span class="hint">0 = unbegrenzt.</span>
|
||||
<span class="hint"><?= e(t('admin_invites.days_hint')) ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<button class="primary" type="submit">Einladung erzeugen</button>
|
||||
<button class="primary" type="submit"><?= e(t('admin_invites.create')) ?></button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Einladungen</h2>
|
||||
<h2><?= e(t('admin_invites.list')) ?></h2>
|
||||
<?php if (!$invites): ?>
|
||||
<p class="muted">Noch keine Einladungen.</p>
|
||||
<p class="muted"><?= e(t('admin_invites.empty')) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Erstellt</th><th>Notiz</th><th>E-Mail</th><th>Status</th><th>Von / an</th><th>Gültig bis</th><th></th></tr>
|
||||
<tr>
|
||||
<th><?= e(t('table.created')) ?></th>
|
||||
<th><?= e(t('table.note')) ?></th>
|
||||
<th><?= e(t('table.email')) ?></th>
|
||||
<th><?= e(t('table.status')) ?></th>
|
||||
<th><?= e(t('table.from_to')) ?></th>
|
||||
<th><?= e(t('table.valid_until')) ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invites as $invite): ?>
|
||||
<?php
|
||||
$status = invite_status($invite);
|
||||
$statusClass = [
|
||||
'offen' => 'open',
|
||||
'eingelöst' => 'used',
|
||||
'abgelaufen' => 'expired',
|
||||
'widerrufen' => 'revoked',
|
||||
'open' => 'open',
|
||||
'used' => 'used',
|
||||
'expired' => 'expired',
|
||||
'revoked' => 'revoked',
|
||||
][$status] ?? 'expired';
|
||||
?>
|
||||
<tr>
|
||||
<td><?= e(fmt_dt($invite['created_at'])) ?></td>
|
||||
<td><?= e($invite['note'] ?: '–') ?></td>
|
||||
<td><?= e($invite['email'] ?: '–') ?></td>
|
||||
<td><span class="status status-<?= e($statusClass) ?>"><?= e($status) ?></span></td>
|
||||
<td><span class="status status-<?= e($statusClass) ?>"><?= e(t('invite.status.' . $status)) ?></span></td>
|
||||
<td>
|
||||
<?= e($invite['creator_name'] ?: '–') ?>
|
||||
<?php if (!empty($invite['used_name'])): ?>
|
||||
|
|
@ -66,11 +74,11 @@
|
|||
</td>
|
||||
<td><?= e(fmt_dt($invite['expires_at'])) ?></td>
|
||||
<td>
|
||||
<?php if ($status === 'offen'): ?>
|
||||
<?php if ($status === 'open'): ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/admin/invites/revoke')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="invite_id" value="<?= (int) $invite['id'] ?>">
|
||||
<button class="link-button danger" type="submit">widerrufen</button>
|
||||
<button class="link-button danger" type="submit"><?= e(t('admin_invites.revoke')) ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -17,26 +17,34 @@ $linkFor = static function (int $targetPage) use ($query): string {
|
|||
?>
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Verwaltung</h1>
|
||||
<p class="muted"><?= (int) $total ?> Küren insgesamt, auch versteckte.</p>
|
||||
<h1><?= e(t('admin.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('admin_routines.lede', ['total' => (int) $total])) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php $active = 'routines'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
|
||||
|
||||
<div class="toolbar">
|
||||
<form method="get" action="<?= e(url('/admin/routines')) ?>" class="search">
|
||||
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="Titel, Skater, Benutzer …">
|
||||
<button type="submit">Suchen</button>
|
||||
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="<?= e_attr(t('admin_routines.search_placeholder')) ?>">
|
||||
<button type="submit"><?= e(t('dashboard.search')) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if (!$items): ?>
|
||||
<div class="empty"><p>Keine Küren gefunden.</p></div>
|
||||
<div class="empty"><p><?= e(t('admin_routines.empty')) ?></p></div>
|
||||
<?php else: ?>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Titel</th><th>Von</th><th>Status</th><th>Rev.</th><th>Aktualisiert</th><th>Downloads</th><th>Aktionen</th></tr>
|
||||
<tr>
|
||||
<th><?= e(t('table.title')) ?></th>
|
||||
<th><?= e(t('table.by')) ?></th>
|
||||
<th><?= e(t('table.status')) ?></th>
|
||||
<th><?= e(t('table.revision')) ?></th>
|
||||
<th><?= e(t('table.updated')) ?></th>
|
||||
<th><?= e(t('table.downloads')) ?></th>
|
||||
<th><?= e(t('table.actions')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($items as $item): ?>
|
||||
|
|
@ -53,19 +61,19 @@ $linkFor = static function (int $targetPage) use ($query): string {
|
|||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="routine_id" value="<?= (int) $item['id'] ?>">
|
||||
<input type="hidden" name="action" value="<?= $item['status'] === 'published' ? 'hide' : 'publish' ?>">
|
||||
<button class="link-button" type="submit"><?= $item['status'] === 'published' ? 'verstecken' : 'veröffentlichen' ?></button>
|
||||
<button class="link-button" type="submit"><?= e($item['status'] === 'published' ? t('admin_routines.hide') : t('admin_routines.publish')) ?></button>
|
||||
</form>
|
||||
<details class="danger-zone">
|
||||
<summary>löschen</summary>
|
||||
<summary><?= e(t('admin_routines.delete')) ?></summary>
|
||||
<form method="post" action="<?= e(url('/admin/routines/action')) ?>" class="stack-tight">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="routine_id" value="<?= (int) $item['id'] ?>">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<label class="check small">
|
||||
<input type="checkbox" name="confirm" value="1" required>
|
||||
endgültig löschen
|
||||
<?= e(t('admin_routines.delete_confirm')) ?>
|
||||
</label>
|
||||
<button class="link-button danger" type="submit">Löschen bestätigen</button>
|
||||
<button class="link-button danger" type="submit"><?= e(t('admin_routines.delete_submit')) ?></button>
|
||||
</form>
|
||||
</details>
|
||||
</div>
|
||||
|
|
@ -78,9 +86,9 @@ $linkFor = static function (int $targetPage) use ($query): string {
|
|||
|
||||
<?php if ($pages > 1): ?>
|
||||
<nav class="pagination">
|
||||
<?php if ($page > 1): ?><a href="<?= e($linkFor($page - 1)) ?>">← Zurück</a><?php endif; ?>
|
||||
<span>Seite <?= (int) $page ?> von <?= (int) $pages ?></span>
|
||||
<?php if ($page < $pages): ?><a href="<?= e($linkFor($page + 1)) ?>">Weiter →</a><?php endif; ?>
|
||||
<?php if ($page > 1): ?><a href="<?= e($linkFor($page - 1)) ?>"><?= e(t('pagination.back')) ?></a><?php endif; ?>
|
||||
<span><?= e(t('pagination.page', ['page' => (int) $page, 'pages' => (int) $pages])) ?></span>
|
||||
<?php if ($page < $pages): ?><a href="<?= e($linkFor($page + 1)) ?>"><?= e(t('pagination.next')) ?></a><?php endif; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -2,18 +2,26 @@
|
|||
<?php $me = auth_user(); ?>
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Verwaltung</h1>
|
||||
<p class="muted">Beta-Konten verwalten.</p>
|
||||
<h1><?= e(t('admin.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('admin_users.lede')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php $active = 'users'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Benutzer</h2>
|
||||
<h2><?= e(t('admin.tab_users')) ?></h2>
|
||||
<div class="table-wrap">
|
||||
<table class="list compact">
|
||||
<thead>
|
||||
<tr><th>Benutzer</th><th>Rolle</th><th>Status</th><th>Küren</th><th>Registriert</th><th>Letzte Anmeldung</th><th>Aktionen</th></tr>
|
||||
<tr>
|
||||
<th><?= e(t('admin.tab_users')) ?></th>
|
||||
<th><?= e(t('table.role')) ?></th>
|
||||
<th><?= e(t('table.status')) ?></th>
|
||||
<th><?= e(t('table.routines')) ?></th>
|
||||
<th><?= e(t('table.registered')) ?></th>
|
||||
<th><?= e(t('table.last_login')) ?></th>
|
||||
<th><?= e(t('table.actions')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
|
|
@ -25,10 +33,10 @@
|
|||
<div class="muted small"><?= e($user['email']) ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= $user['role'] === 'admin' ? 'Admin' : 'Nutzer' ?></td>
|
||||
<td><?= e($user['role'] === 'admin' ? t('admin_users.role_admin') : t('admin_users.role_user')) ?></td>
|
||||
<td>
|
||||
<span class="status status-<?= $user['status'] === 'active' ? 'open' : 'expired' ?>">
|
||||
<?= $user['status'] === 'active' ? 'aktiv' : 'gesperrt' ?>
|
||||
<?= e($user['status'] === 'active' ? t('status.active') : t('status.blocked')) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= (int) $user['routine_count'] ?></td>
|
||||
|
|
@ -36,7 +44,7 @@
|
|||
<td><?= e(fmt_dt($user['last_login_at'])) ?></td>
|
||||
<td>
|
||||
<?php if ((int) $user['id'] === (int) $me['id']): ?>
|
||||
<span class="muted small">eigenes Konto</span>
|
||||
<span class="muted small"><?= e(t('admin_users.self')) ?></span>
|
||||
<?php else: ?>
|
||||
<div class="row-actions">
|
||||
<?php if ($user['status'] === 'active'): ?>
|
||||
|
|
@ -44,33 +52,33 @@
|
|||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
|
||||
<input type="hidden" name="action" value="disable">
|
||||
<button class="link-button danger" type="submit">sperren</button>
|
||||
<button class="link-button danger" type="submit"><?= e(t('admin_users.block')) ?></button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/admin/users/action')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
|
||||
<input type="hidden" name="action" value="enable">
|
||||
<button class="link-button" type="submit">entsperren</button>
|
||||
<button class="link-button" type="submit"><?= e(t('admin_users.unblock')) ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/admin/users/action')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
|
||||
<input type="hidden" name="action" value="reset">
|
||||
<button class="link-button" type="submit">Passwort zurücksetzen</button>
|
||||
<button class="link-button" type="submit"><?= e(t('admin_users.reset')) ?></button>
|
||||
</form>
|
||||
<details class="danger-zone">
|
||||
<summary>löschen</summary>
|
||||
<summary><?= e(t('admin_users.delete')) ?></summary>
|
||||
<form method="post" action="<?= e(url('/admin/users/action')) ?>" class="stack-tight">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<label class="check small">
|
||||
<input type="checkbox" name="confirm" value="1" required>
|
||||
mit allen Küren löschen
|
||||
<?= e(t('admin_users.delete_confirm')) ?>
|
||||
</label>
|
||||
<button class="link-button danger" type="submit">Löschen bestätigen</button>
|
||||
<button class="link-button danger" type="submit"><?= e(t('admin_users.delete_submit')) ?></button>
|
||||
</form>
|
||||
</details>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,39 +24,42 @@ $linkFor = static function (int $targetPage) use ($query, $mine): string {
|
|||
alt="Rinkplanner-Hub-Logo: drei Schlittschuhe, durch ein Netz verbunden"
|
||||
width="132" height="132">
|
||||
<div class="hub-hero-text">
|
||||
<p class="eyebrow">Viele Schlittschuhe, ein Netz</p>
|
||||
<p class="hub-hero-title">Küren teilen, Fassungen vergleichen, gemeinsam weiterentwickeln.</p>
|
||||
<p class="hub-hero-sub">Der Hub sammelt Küren, Musik und Revisionen deines Teams an einem Ort.</p>
|
||||
<p class="eyebrow"><?= e(t('dashboard.eyebrow')) ?></p>
|
||||
<p class="hub-hero-title"><?= e(t('dashboard.hero_title')) ?></p>
|
||||
<p class="hub-hero-sub"><?= e(t('dashboard.hero_sub')) ?></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h1>Küren</h1>
|
||||
<p class="muted"><?= (int) $total ?> <?= $total === 1 ? 'Kür' : 'Küren' ?> im Hub<?= $mine ? ' (nur deine)' : '' ?>.</p>
|
||||
<h1><?= e(t('dashboard.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('dashboard.count', [
|
||||
'count' => (int) $total,
|
||||
'label' => t($total === 1 ? 'dashboard.one_routine' : 'dashboard.many_routines'),
|
||||
])) ?><?= $mine ? e(t('dashboard.mine_suffix')) : '' ?>.</p>
|
||||
</div>
|
||||
<a class="button primary" href="<?= e(url('/upload')) ?>">Kür hochladen</a>
|
||||
<a class="button primary" href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.upload')) ?></a>
|
||||
</div>
|
||||
|
||||
<div class="toolbar">
|
||||
<form method="get" action="<?= e(url('/')) ?>" class="search">
|
||||
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="Titel, Skater, Musik, Benutzer …">
|
||||
<input type="search" name="q" value="<?= e_attr($query) ?>" placeholder="<?= e_attr(t('dashboard.search_placeholder')) ?>">
|
||||
<?php if ($mine): ?><input type="hidden" name="mine" value="1"><?php endif; ?>
|
||||
<button type="submit">Suchen</button>
|
||||
<button type="submit"><?= e(t('dashboard.search')) ?></button>
|
||||
</form>
|
||||
<div class="tabs">
|
||||
<a class="<?= $mine ? '' : 'active' ?>" href="<?= e(url('/')) ?>">Alle</a>
|
||||
<a class="<?= $mine ? 'active' : '' ?>" href="<?= e(url('/?mine=1')) ?>">Meine Küren</a>
|
||||
<a class="<?= $mine ? '' : 'active' ?>" href="<?= e(url('/')) ?>"><?= e(t('dashboard.all')) ?></a>
|
||||
<a class="<?= $mine ? 'active' : '' ?>" href="<?= e(url('/?mine=1')) ?>"><?= e(t('dashboard.mine')) ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$items): ?>
|
||||
<div class="empty">
|
||||
<p>Keine Küren gefunden.</p>
|
||||
<p><?= e(t('dashboard.empty')) ?></p>
|
||||
<?php if ($query !== ''): ?>
|
||||
<p class="muted">Suche zurücksetzen oder <a href="<?= e(url('/upload')) ?>">selbst eine Kür hochladen</a>.</p>
|
||||
<p class="muted"><?= e(t('dashboard.empty_hint')) ?> <a href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.empty_upload')) ?></a>.</p>
|
||||
<?php else: ?>
|
||||
<p class="muted">Der Hub ist noch leer. <a href="<?= e(url('/upload')) ?>">Erste Kür hochladen</a>.</p>
|
||||
<p class="muted"><?= e(t('dashboard.empty_first')) ?> <a href="<?= e(url('/upload')) ?>"><?= e(t('dashboard.empty_first_action')) ?></a>.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
|
@ -64,13 +67,13 @@ $linkFor = static function (int $targetPage) use ($query, $mine): string {
|
|||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Titel</th>
|
||||
<th>Skater</th>
|
||||
<th>Musik</th>
|
||||
<th>Rev.</th>
|
||||
<th>Größe</th>
|
||||
<th>Aktualisiert</th>
|
||||
<th>Von</th>
|
||||
<th><?= e(t('table.title')) ?></th>
|
||||
<th><?= e(t('table.skater')) ?></th>
|
||||
<th><?= e(t('table.music')) ?></th>
|
||||
<th><?= e(t('table.revision')) ?></th>
|
||||
<th><?= e(t('table.size')) ?></th>
|
||||
<th><?= e(t('table.updated')) ?></th>
|
||||
<th><?= e(t('table.by')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -79,7 +82,7 @@ $linkFor = static function (int $targetPage) use ($query, $mine): string {
|
|||
<td>
|
||||
<a class="title-link" href="<?= e(url('/routines/' . (int) $item['id'])) ?>"><?= e($item['title']) ?></a>
|
||||
<?php if ($item['status'] !== 'published'): ?>
|
||||
<span class="badge">versteckt</span>
|
||||
<span class="badge"><?= e(t('badge.hidden')) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($item['category'])): ?>
|
||||
<span class="badge badge-soft"><?= e($item['category']) ?></span>
|
||||
|
|
@ -110,11 +113,11 @@ $linkFor = static function (int $targetPage) use ($query, $mine): string {
|
|||
<?php if ($pages > 1): ?>
|
||||
<nav class="pagination">
|
||||
<?php if ($page > 1): ?>
|
||||
<a href="<?= e($linkFor($page - 1)) ?>">← Zurück</a>
|
||||
<a href="<?= e($linkFor($page - 1)) ?>"><?= e(t('pagination.back')) ?></a>
|
||||
<?php endif; ?>
|
||||
<span>Seite <?= (int) $page ?> von <?= (int) $pages ?></span>
|
||||
<span><?= e(t('pagination.page', ['page' => (int) $page, 'pages' => (int) $pages])) ?></span>
|
||||
<?php if ($page < $pages): ?>
|
||||
<a href="<?= e($linkFor($page + 1)) ?>">Weiter →</a>
|
||||
<a href="<?= e($linkFor($page + 1)) ?>"><?= e(t('pagination.next')) ?></a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php /** @var int $status */ ?>
|
||||
<?php /** @var string $message */ ?>
|
||||
<section class="auth-card">
|
||||
<p class="eyebrow">Fehler <?= (int) $status ?></p>
|
||||
<p class="eyebrow"><?= e(t('error.label', ['status' => (int) $status])) ?></p>
|
||||
<h1><?= e($message) ?></h1>
|
||||
<p class="muted">Zurück zur <a href="<?= e(url('/')) ?>">Küren-Übersicht</a>.</p>
|
||||
<p class="muted"><?= e(t('error.back')) ?> <a href="<?= e(url('/')) ?>"><?= e(t('error.back_link')) ?></a>.</p>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -3,16 +3,18 @@
|
|||
/** @var string $content */
|
||||
/** @var array|null $user */
|
||||
$flashes = flash_pull();
|
||||
$locale = hub_locale();
|
||||
$next = (string) ($_SERVER['REQUEST_URI'] ?? '/');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<html lang="<?= e($locale) ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= e($title) ?> · Rinkplanner-Hub</title>
|
||||
<title><?= e($title) ?> · <?= e(t('app.name')) ?></title>
|
||||
<link rel="icon" type="image/png" href="<?= e(url('/assets/logo-icon.png')) ?>">
|
||||
<link rel="apple-touch-icon" href="<?= e(url('/assets/logo-icon.png')) ?>">
|
||||
<link rel="stylesheet" href="<?= e(url('/assets/hub.css')) ?>">
|
||||
<link rel="stylesheet" href="<?= e(url('/assets/hub.css') . '?v=' . HUB_ASSET_VERSION) ?>">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
|
|
@ -22,19 +24,25 @@ $flashes = flash_pull();
|
|||
</a>
|
||||
<nav class="nav">
|
||||
<?php if ($user !== null): ?>
|
||||
<a href="<?= e(url('/')) ?>">Küren</a>
|
||||
<a href="<?= e(url('/upload')) ?>">Hochladen</a>
|
||||
<a href="<?= e(url('/')) ?>"><?= e(t('nav.routines')) ?></a>
|
||||
<a href="<?= e(url('/upload')) ?>"><?= e(t('nav.upload')) ?></a>
|
||||
<a href="<?= e(url('/account')) ?>"><?= e($user['display_name']) ?></a>
|
||||
<?php if (($user['role'] ?? '') === 'admin'): ?>
|
||||
<a class="nav-admin" href="<?= e(url('/admin/invites')) ?>">Verwaltung</a>
|
||||
<a class="nav-admin" href="<?= e(url('/admin/invites')) ?>"><?= e(t('nav.admin')) ?></a>
|
||||
<?php endif; ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/logout')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<button class="link-button" type="submit">Abmelden</button>
|
||||
<button class="link-button" type="submit"><?= e(t('nav.logout')) ?></button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<a href="<?= e(url('/login')) ?>">Anmelden</a>
|
||||
<a href="<?= e(url('/login')) ?>"><?= e(t('nav.login')) ?></a>
|
||||
<?php endif; ?>
|
||||
<div class="lang-switch" role="group" aria-label="<?= e(t('nav.language')) ?>">
|
||||
<?php foreach (['de' => 'DE', 'en' => 'EN'] as $code => $label): ?>
|
||||
<a href="<?= e(url('/language') . '?lang=' . $code . '&next=' . rawurlencode($next)) ?>"
|
||||
lang="<?= e($code) ?>" hreflang="<?= e($code) ?>"<?= $locale === $code ? ' aria-current="true"' : '' ?>><?= $label ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
|
@ -44,7 +52,7 @@ $flashes = flash_pull();
|
|||
<?php foreach ($flashes as $flash): ?>
|
||||
<?php if (($flash['type'] ?? '') === 'secret'): ?>
|
||||
<div class="flash flash-secret">
|
||||
<strong><?= e($flash['label'] ?? 'Geheimnis') ?></strong>
|
||||
<strong><?= e($flash['label'] ?? t('flash.secret')) ?></strong>
|
||||
<code><?= e($flash['value'] ?? '') ?></code>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
|
@ -60,8 +68,8 @@ $flashes = flash_pull();
|
|||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<span>Geschlossene Beta · Rinkplanner-Hub</span>
|
||||
<a href="https://rinkplanner.programmschmiede.de/">Zur Rinkplanner-Seite</a>
|
||||
<span><?= e(t('footer.beta')) ?></span>
|
||||
<a href="https://rinkplanner.programmschmiede.de/"><?= e(t('footer.website')) ?></a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<?php /** @var string $login */ ?>
|
||||
<?php /** @var string $next */ ?>
|
||||
<section class="auth-card">
|
||||
<h1>Anmelden</h1>
|
||||
<p class="muted">Der Kür-Hub ist in einer geschlossenen Beta. Zugang gibt es per Einladungscode.</p>
|
||||
<h1><?= e(t('login.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('login.lede')) ?></p>
|
||||
|
||||
<?php if ($error !== ''): ?>
|
||||
<div class="flash flash-error"><?= e($error) ?></div>
|
||||
|
|
@ -13,19 +13,19 @@
|
|||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="next" value="<?= e_attr($next) ?>">
|
||||
<label>
|
||||
Benutzername oder E-Mail
|
||||
<?= e(t('login.login_label')) ?>
|
||||
<input type="text" name="login" value="<?= e_attr($login) ?>" autocomplete="username" required autofocus>
|
||||
</label>
|
||||
<label>
|
||||
Passwort
|
||||
<?= e(t('login.password')) ?>
|
||||
<input type="password" name="password" autocomplete="current-password" required>
|
||||
</label>
|
||||
<label class="check">
|
||||
<input type="checkbox" name="remember" value="1">
|
||||
Angemeldet bleiben (30 Tage)
|
||||
<?= e(t('login.remember')) ?>
|
||||
</label>
|
||||
<button class="primary" type="submit">Anmelden</button>
|
||||
<button class="primary" type="submit"><?= e(t('login.submit')) ?></button>
|
||||
</form>
|
||||
|
||||
<p class="muted small">Noch keinen Zugang? Ein Beta-Code kommt von der Hub-Administration.</p>
|
||||
<p class="muted small"><?= e(t('login.no_access')) ?></p>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<?php /** @var array $errors */ ?>
|
||||
<?php /** @var array $input */ ?>
|
||||
<section class="auth-card wide">
|
||||
<h1>Beta-Zugang einlösen</h1>
|
||||
<p class="muted">Ein Einladungscode legt genau ein Konto an. Der Code verliert danach seine Gültigkeit.</p>
|
||||
<h1><?= e(t('register.title')) ?></h1>
|
||||
<p class="muted"><?= e(t('register.lede')) ?></p>
|
||||
|
||||
<?php if ($errors): ?>
|
||||
<div class="flash flash-error">
|
||||
|
|
@ -19,44 +19,44 @@
|
|||
<form method="post" action="<?= e(url('/register')) ?>" class="stack">
|
||||
<?= csrf_field() ?>
|
||||
<label>
|
||||
Einladungscode
|
||||
<?= e(t('register.code')) ?>
|
||||
<input type="text" name="code" value="<?= e_attr($code) ?>" placeholder="RHUB-XXXX-XXXX-XXXX-XXXX" required>
|
||||
</label>
|
||||
<div class="grid-2">
|
||||
<label>
|
||||
Benutzername
|
||||
<?= e(t('register.username')) ?>
|
||||
<input type="text" name="username" value="<?= e_attr($input['username']) ?>" autocomplete="username" required>
|
||||
<span class="hint">3–32 Zeichen, nur Kleinbuchstaben, Ziffern, Punkt, Bindestrich, Unterstrich.</span>
|
||||
<span class="hint"><?= e(t('register.username_hint')) ?></span>
|
||||
</label>
|
||||
<label>
|
||||
Anzeigename
|
||||
<?= e(t('register.display_name')) ?>
|
||||
<input type="text" name="display_name" value="<?= e_attr($input['display_name']) ?>" maxlength="64">
|
||||
</label>
|
||||
</div>
|
||||
<label>
|
||||
E-Mail (optional)
|
||||
<?= e(t('register.email')) ?>
|
||||
<input type="email" name="email" value="<?= e_attr($input['email']) ?>" autocomplete="email"<?= $invite !== null && !empty($invite['email']) ? ' readonly' : '' ?>>
|
||||
<?php if ($invite !== null && !empty($invite['email'])): ?>
|
||||
<span class="hint">Diese Einladung ist an <?= e($invite['email']) ?> gebunden.</span>
|
||||
<span class="hint"><?= e(t('register.email_bound', ['email' => $invite['email']])) ?></span>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
<div class="grid-2">
|
||||
<label>
|
||||
Passwort
|
||||
<?= e(t('register.password')) ?>
|
||||
<input type="password" name="password" autocomplete="new-password" required>
|
||||
<span class="hint">Mindestens 10 Zeichen.</span>
|
||||
<span class="hint"><?= e(t('register.password_hint')) ?></span>
|
||||
</label>
|
||||
<label>
|
||||
Passwort wiederholen
|
||||
<?= e(t('register.password_repeat')) ?>
|
||||
<input type="password" name="password_repeat" autocomplete="new-password" required>
|
||||
</label>
|
||||
</div>
|
||||
<label class="check">
|
||||
<input type="checkbox" name="rights" value="1" required>
|
||||
Ich akzeptiere die Beta-Regeln und teile keine Inhalte, an denen ich keine Rechte habe.
|
||||
<?= e(t('register.rights')) ?>
|
||||
</label>
|
||||
<button class="primary" type="submit">Konto anlegen</button>
|
||||
<button class="primary" type="submit"><?= e(t('register.submit')) ?></button>
|
||||
</form>
|
||||
|
||||
<p class="muted small">Schon ein Konto? <a href="<?= e(url('/login')) ?>">Anmelden</a></p>
|
||||
<p class="muted small"><?= e(t('register.have_account')) ?> <a href="<?= e(url('/login')) ?>"><?= e(t('register.login_link')) ?></a></p>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,93 +1,93 @@
|
|||
<?php /** @var array $routine */ ?>
|
||||
<?php /** @var array|null $routine */ ?>
|
||||
<?php /** @var bool $can_edit */ ?>
|
||||
<?php /** @var bool $is_admin */ ?>
|
||||
<?php $audioName = $routine['audio_original_name'] ?? ''; ?>
|
||||
<article class="detail">
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<p class="eyebrow"><a href="<?= e(url('/')) ?>">Küren</a> / Kür</p>
|
||||
<p class="eyebrow"><a href="<?= e(url('/')) ?>"><?= e(t('routine.breadcrumb')) ?></a> / <?= e(t('routine.breadcrumb_current')) ?></p>
|
||||
<h1><?= e($routine['title']) ?></h1>
|
||||
<p class="muted">
|
||||
<?= e($routine['owner_display_name'] ?: $routine['owner_username']) ?>
|
||||
· Revision <?= (int) ($routine['revision'] ?? 0) ?>
|
||||
· <?= e(t('routine.revision', ['revision' => (int) ($routine['revision'] ?? 0)])) ?>
|
||||
· <?= e(fmt_dt($routine['updated_at'])) ?>
|
||||
<?php if ($routine['status'] !== 'published'): ?>
|
||||
· <span class="badge">versteckt</span>
|
||||
· <span class="badge"><?= e(t('badge.hidden')) ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<?php if (!empty($routine['routine_path'])): ?>
|
||||
<a class="button primary" href="<?= e(url('/routines/' . (int) $routine['id'] . '/download')) ?>">Kür herunterladen</a>
|
||||
<a class="button primary" href="<?= e(url('/routines/' . (int) $routine['id'] . '/download')) ?>"><?= e(t('routine.download')) ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($audioName !== ''): ?>
|
||||
<a class="button" href="<?= e(url('/routines/' . (int) $routine['id'] . '/audio')) ?>">Musik herunterladen</a>
|
||||
<a class="button" href="<?= e(url('/routines/' . (int) $routine['id'] . '/audio')) ?>"><?= e(t('routine.download_audio')) ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($can_edit): ?>
|
||||
<div class="owner-bar">
|
||||
<span class="muted">Du kannst diese Kür verwalten.</span>
|
||||
<a class="button small" href="<?= e(url('/routines/' . (int) $routine['id'] . '/revise')) ?>">Neue Revision hochladen</a>
|
||||
<span class="muted"><?= e(t('routine.owner_bar')) ?></span>
|
||||
<a class="button small" href="<?= e(url('/routines/' . (int) $routine['id'] . '/revise')) ?>"><?= e(t('routine.new_revision')) ?></a>
|
||||
<?php if ($routine['status'] === 'published'): ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/routines/' . (int) $routine['id'] . '/hide')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<button class="button small danger-ghost" type="submit">Aus dem Hub nehmen</button>
|
||||
<button class="button small danger-ghost" type="submit"><?= e(t('routine.hide')) ?></button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<form class="inline" method="post" action="<?= e(url('/routines/' . (int) $routine['id'] . '/publish')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<button class="button small" type="submit">Wieder veröffentlichen</button>
|
||||
<button class="button small" type="submit"><?= e(t('routine.publish')) ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php if ($is_admin): ?>
|
||||
<a class="button small danger-ghost" href="<?= e(url('/admin/routines?q=' . rawurlencode($routine['title']))) ?>">In der Verwaltung öffnen</a>
|
||||
<a class="button small danger-ghost" href="<?= e(url('/admin/routines?q=' . rawurlencode($routine['title']))) ?>"><?= e(t('routine.open_admin')) ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($routine['description'])): ?>
|
||||
<section class="panel">
|
||||
<h2>Beschreibung</h2>
|
||||
<h2><?= e(t('routine.description')) ?></h2>
|
||||
<p class="preline"><?= e($routine['description']) ?></p>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($audioName !== ''): ?>
|
||||
<section class="panel">
|
||||
<h2>Musik</h2>
|
||||
<h2><?= e(t('routine.music')) ?></h2>
|
||||
<audio controls preload="none" src="<?= e(url('/routines/' . (int) $routine['id'] . '/audio')) ?>"></audio>
|
||||
<p class="muted small"><?= e($audioName) ?> · <?= e(human_bytes((int) ($routine['audio_bytes'] ?? 0))) ?></p>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Details</h2>
|
||||
<h2><?= e(t('routine.details')) ?></h2>
|
||||
<dl class="facts">
|
||||
<div><dt>Skater</dt><dd><?= e($routine['skater_name'] ?: '–') ?></dd></div>
|
||||
<div><dt>Kategorie</dt><dd><?= e($routine['category'] ?: '–') ?></dd></div>
|
||||
<div><dt>Musiktitel</dt><dd><?= e($routine['music_title'] ?: '–') ?></dd></div>
|
||||
<div><dt>Musik</dt><dd><?= e($routine['music_artist'] ?: '–') ?></dd></div>
|
||||
<div><dt>Kür-Datei</dt><dd><?= e($routine['routine_original_name'] ?? '–') ?> · <?= e(human_bytes((int) ($routine['routine_bytes'] ?? 0))) ?></dd></div>
|
||||
<div><dt>Audio-Datei</dt><dd><?= e($audioName !== '' ? $audioName . ' · ' . human_bytes((int) ($routine['audio_bytes'] ?? 0)) : '–') ?></dd></div>
|
||||
<div><dt>Downloads</dt><dd><?= (int) $routine['download_count'] ?></dd></div>
|
||||
<div><dt>Eingestellt</dt><dd><?= e(fmt_dt($routine['created_at'])) ?></dd></div>
|
||||
<div><dt><?= e(t('table.skater')) ?></dt><dd><?= e($routine['skater_name'] ?: '–') ?></dd></div>
|
||||
<div><dt><?= e(t('routine.category')) ?></dt><dd><?= e($routine['category'] ?: '–') ?></dd></div>
|
||||
<div><dt><?= e(t('routine.music_title')) ?></dt><dd><?= e($routine['music_title'] ?: '–') ?></dd></div>
|
||||
<div><dt><?= e(t('routine.music_artist')) ?></dt><dd><?= e($routine['music_artist'] ?: '–') ?></dd></div>
|
||||
<div><dt><?= e(t('routine.routine_file')) ?></dt><dd><?= e($routine['routine_original_name'] ?? '–') ?> · <?= e(human_bytes((int) ($routine['routine_bytes'] ?? 0))) ?></dd></div>
|
||||
<div><dt><?= e(t('routine.audio_file')) ?></dt><dd><?= e($audioName !== '' ? $audioName . ' · ' . human_bytes((int) ($routine['audio_bytes'] ?? 0)) : '–') ?></dd></div>
|
||||
<div><dt><?= e(t('table.downloads')) ?></dt><dd><?= (int) $routine['download_count'] ?></dd></div>
|
||||
<div><dt><?= e(t('table.created')) ?></dt><dd><?= e(fmt_dt($routine['created_at'])) ?></dd></div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Prüfsummen</h2>
|
||||
<h2><?= e(t('routine.checksums')) ?></h2>
|
||||
<div class="hash">
|
||||
<span>Kür</span>
|
||||
<span><?= e(t('routine.breadcrumb_current')) ?></span>
|
||||
<code><?= e($routine['routine_sha256'] ?? '–') ?></code>
|
||||
</div>
|
||||
<?php if ($audioName !== ''): ?>
|
||||
<div class="hash">
|
||||
<span>Musik</span>
|
||||
<span><?= e(t('routine.music')) ?></span>
|
||||
<code><?= e($routine['audio_sha256'] ?? '–') ?></code>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<p class="muted small">Beim Download prüfen, ob die SHA-256-Summe zur Kür passt.</p>
|
||||
<p class="muted small"><?= e(t('routine.checksum_hint')) ?></p>
|
||||
</section>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<?php /** @var array|null $routine */ ?>
|
||||
<?php $isRevision = $routine !== null; ?>
|
||||
<section class="auth-card wide">
|
||||
<h1><?= $isRevision ? 'Neue Revision' : 'Kür hochladen' ?></h1>
|
||||
<h1><?= e($isRevision ? t('upload.title_revision') : t('upload.title_new')) ?></h1>
|
||||
<?php if ($isRevision): ?>
|
||||
<p class="muted">Neue Fassung von „<?= e($routine['title']) ?>“. Die bisherige Revision bleibt erhalten.</p>
|
||||
<p class="muted"><?= e(t('upload.revision_lede', ['title' => $routine['title']])) ?></p>
|
||||
<?php else: ?>
|
||||
<p class="muted">Lade die Kür-JSON und – falls die Kür Musik nutzt – die zugehörige Audiodatei hoch. Beide gehören als Paket zusammen.</p>
|
||||
<p class="muted"><?= e(t('upload.lede')) ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($errors): ?>
|
||||
|
|
@ -26,41 +26,41 @@
|
|||
<?= csrf_field() ?>
|
||||
<div class="grid-2">
|
||||
<label>
|
||||
Kür-Datei (.json)
|
||||
<?= e(t('upload.routine_file')) ?>
|
||||
<input type="file" name="routine" accept=".json,application/json" required>
|
||||
<span class="hint">Aus Rinkplanner gespeicherte Kür, max. <?= e(human_bytes((int) config('app.max_routine_bytes', 8 * 1024 * 1024))) ?>.</span>
|
||||
<span class="hint"><?= e(t('upload.routine_hint', ['max' => human_bytes((int) config('app.max_routine_bytes', 8 * 1024 * 1024))])) ?></span>
|
||||
</label>
|
||||
<label>
|
||||
Musikdatei (MP3/OGG/WAV/M4A/AAC)
|
||||
<?= e(t('upload.audio_file')) ?>
|
||||
<input type="file" name="audio" accept=".mp3,.ogg,.wav,.m4a,.aac,audio/*">
|
||||
<span class="hint">Dateiname muss exakt dem Feld „music_file“ der Kür entsprechen.</span>
|
||||
<span class="hint"><?= e(t('upload.audio_hint')) ?></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
Beschreibung (optional)
|
||||
<?= e(t('upload.description')) ?>
|
||||
<textarea name="description" rows="4" maxlength="2000"><?= e($input['description']) ?></textarea>
|
||||
</label>
|
||||
|
||||
<div class="grid-2">
|
||||
<label>
|
||||
Musiktitel (optional)
|
||||
<?= e(t('upload.music_title')) ?>
|
||||
<input type="text" name="music_title" maxlength="190" value="<?= e_attr($input['music_title']) ?>">
|
||||
</label>
|
||||
<label>
|
||||
Interpret (optional)
|
||||
<?= e(t('upload.artist')) ?>
|
||||
<input type="text" name="music_artist" maxlength="190" value="<?= e_attr($input['music_artist']) ?>">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label class="check">
|
||||
<input type="checkbox" name="rights" value="1" required>
|
||||
Ich habe die Rechte an Kür und Musik und darf sie im geschlossenen Beta-Hub teilen.
|
||||
<?= e(t('upload.rights')) ?>
|
||||
</label>
|
||||
|
||||
<div class="actions">
|
||||
<button class="primary" type="submit"><?= $isRevision ? 'Revision veröffentlichen' : 'Kür veröffentlichen' ?></button>
|
||||
<a class="button" href="<?= e(url($isRevision ? '/routines/' . (int) $routine['id'] : '/')) ?>">Abbrechen</a>
|
||||
<button class="primary" type="submit"><?= e($isRevision ? t('upload.submit_revision') : t('upload.submit_new')) ?></button>
|
||||
<a class="button" href="<?= e(url($isRevision ? '/routines/' . (int) $routine['id'] : '/')) ?>"><?= e(t('upload.cancel')) ?></a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -141,6 +141,30 @@ code {
|
|||
color: var(--gold) !important;
|
||||
}
|
||||
|
||||
.lang-switch {
|
||||
align-items: center;
|
||||
background: rgba(11, 32, 54, 0.7);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
display: inline-flex;
|
||||
gap: 2px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.lang-switch a {
|
||||
border-radius: 999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.06em;
|
||||
padding: 0.15rem 0.55rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.lang-switch a[aria-current="true"] {
|
||||
background: linear-gradient(135deg, var(--blue), var(--deep-blue));
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.page {
|
||||
margin: 0 auto;
|
||||
max-width: 1180px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue