requireAdmin(); I18n::init(); $db = Database::getInstance(); $appTitle = $db->getSetting('app_title', 'UniFi Voucher System'); $error = ''; $success = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save'])) { if (!$auth->validateCsrfToken($_POST['csrf_token'] ?? '')) { $error = __('error_csrf'); } else { $db->setSetting('enforce_2fa_admins', isset($_POST['enforce_2fa_admins']) ? '1' : '0'); $cm = in_array($_POST['captcha_mode'] ?? 'off', ['off','math','hcaptcha'], true) ? $_POST['captcha_mode'] : 'off'; $db->setSetting('captcha_mode', $cm); $db->setSetting('captcha_site_key', trim($_POST['captcha_site_key'] ?? '')); if (!empty($_POST['captcha_secret'])) { $db->setSetting('captcha_secret', trim($_POST['captcha_secret'])); } $db->setSetting('sms_enabled', isset($_POST['sms_enabled']) ? '1' : '0'); $db->setSetting('twilio_sid', trim($_POST['twilio_sid'] ?? '')); $db->setSetting('twilio_from', trim($_POST['twilio_from'] ?? '')); if (!empty($_POST['twilio_token'])) { $db->setSetting('twilio_token', trim($_POST['twilio_token'])); } $db->setSetting('oidc_enabled', isset($_POST['oidc_enabled']) ? '1' : '0'); $db->setSetting('oidc_name', trim($_POST['oidc_name'] ?? 'SSO')); $db->setSetting('oidc_client_id', trim($_POST['oidc_client_id'] ?? '')); $db->setSetting('oidc_auth_url', trim($_POST['oidc_auth_url'] ?? '')); $db->setSetting('oidc_token_url', trim($_POST['oidc_token_url'] ?? '')); $db->setSetting('oidc_userinfo_url', trim($_POST['oidc_userinfo_url'] ?? '')); $db->setSetting('oidc_scopes', trim($_POST['oidc_scopes'] ?? 'openid profile email')); if (!empty($_POST['oidc_client_secret'])) { $db->setSetting('oidc_client_secret', trim($_POST['oidc_client_secret'])); } $db->setSetting('user_daily_voucher_limit', max(0, (int)($_POST['user_daily_voucher_limit'] ?? 0))); $db->setSetting('trusted_proxy', trim($_POST['trusted_proxy'] ?? '')); $db->setSetting('webhook_enabled', isset($_POST['webhook_enabled']) ? '1' : '0'); $db->setSetting('webhook_url', trim($_POST['webhook_url'] ?? '')); $db->setSetting('cleanup_expired_days', max(0, (int)($_POST['cleanup_expired_days'] ?? 0))); $db->setSetting('cleanup_audit_days', max(0, (int)($_POST['cleanup_audit_days'] ?? 0))); $db->setSetting('cleanup_login_days', max(0, (int)($_POST['cleanup_login_days'] ?? 30))); $auth->writeAuditLog($_SESSION['user_id'], 'settings_update', 'config', null, 'Integration/Wartung gespeichert'); $success = 'Einstellungen gespeichert.'; } } if (isset($_GET['test_webhook']) && isset($_GET['token']) && $auth->validateCsrfToken($_GET['token'])) { Notifier::send('✅ Test-Benachrichtigung vom UniFi Voucher System.', ['type' => 'test']); $success = 'Test-Benachrichtigung gesendet (sofern Webhook aktiv & URL gültig).'; } $enforce2fa = $db->getSetting('enforce_2fa_admins', '0') === '1'; $captchaMode = $db->getSetting('captcha_mode', 'off'); $captchaSiteKey = $db->getSetting('captcha_site_key', ''); $captchaSecretSet = $db->getSetting('captcha_secret', '') !== ''; $smsEnabled = $db->getSetting('sms_enabled', '0') === '1'; $twilioSid = $db->getSetting('twilio_sid', ''); $twilioFrom = $db->getSetting('twilio_from', ''); $twilioTokenSet = $db->getSetting('twilio_token', '') !== ''; $oidcEnabled = $db->getSetting('oidc_enabled', '0') === '1'; $oidcName = $db->getSetting('oidc_name', 'SSO'); $oidcClientId = $db->getSetting('oidc_client_id', ''); $oidcAuthUrl = $db->getSetting('oidc_auth_url', ''); $oidcTokenUrl = $db->getSetting('oidc_token_url', ''); $oidcUserinfoUrl = $db->getSetting('oidc_userinfo_url', ''); $oidcScopes = $db->getSetting('oidc_scopes', 'openid profile email'); $oidcSecretSet = $db->getSetting('oidc_client_secret', '') !== ''; $dailyLimit = (int)$db->getSetting('user_daily_voucher_limit', 0); $trustedProxy = $db->getSetting('trusted_proxy', ''); $webhookEnabled = $db->getSetting('webhook_enabled', '0') === '1'; $webhookUrl = $db->getSetting('webhook_url', ''); $cleanupExpired = (int)$db->getSetting('cleanup_expired_days', 0); $cleanupAudit = (int)$db->getSetting('cleanup_audit_days', 0); $cleanupLogin = (int)$db->getSetting('cleanup_login_days', 30); $lastCleanup = $db->getSetting('last_cleanup', ''); $csrf = $auth->getCsrfToken(); $currentPage = 'integrations'; $adminBase = ''; ?> Integration & Wartung – <?= htmlspecialchars($appTitle) ?>

🔧 Integration & Wartung

Sicherheitsrichtlinie

Erzwingt Zwei-Faktor-Authentifizierung für alle Administrator-Konten (lokale Accounts). Admins ohne 2FA werden bei der nächsten Aktion zur Einrichtung geleitet.

Reverse-Proxy

IP-Adressen vertrauenswürdiger Proxies (kommasepariert). Nur dann wird die echte Client-IP aus X-Forwarded-For für Rate-Limit & Audit verwendet.

Webhook-Benachrichtigungen

Slack-, Microsoft-Teams- oder generische JSON-Webhook-URL. Wird bei Voucher-Erstellung ausgelöst.

Test senden

SMS-Versand (Twilio)

Voucher-Codes optional per SMS versenden. Erfordert ein Twilio-Konto.

Single Sign-On (OpenID Connect)

Generischer OIDC-Provider (z.B. Keycloak, Authentik, Google, Auth0). Redirect-URI:

Datenhaltung & Cleanup (DSGVO)

Aufbewahrungsfristen in Tagen (0 = deaktiviert). Ausführung per cron_cleanup.php (täglich empfohlen).
Letzter Lauf: