|
@@ -20,7 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if ($success) {
|
|
if ($success) {
|
|
|
- app_redirect('/admin/');
|
|
|
|
|
|
|
+ app_redirect(app_url('/admin/'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$message = 'Login fehlgeschlagen. Bitte Zugangsdaten pruefen.';
|
|
$message = 'Login fehlgeschlagen. Bitte Zugangsdaten pruefen.';
|
|
@@ -35,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
'timezone' => trim((string) ($_POST['timezone'] ?? 'Europe/Berlin')),
|
|
'timezone' => trim((string) ($_POST['timezone'] ?? 'Europe/Berlin')),
|
|
|
'dashboard_refresh_seconds' => max(5, (int) ($_POST['dashboard_refresh_seconds'] ?? 15)),
|
|
'dashboard_refresh_seconds' => max(5, (int) ($_POST['dashboard_refresh_seconds'] ?? 15)),
|
|
|
'default_from_email' => trim((string) ($_POST['default_from_email'] ?? 'monitor@example.local')),
|
|
'default_from_email' => trim((string) ($_POST['default_from_email'] ?? 'monitor@example.local')),
|
|
|
|
|
+ 'base_path' => app_normalize_base_path((string) ($_POST['base_path'] ?? '')),
|
|
|
];
|
|
];
|
|
|
$config['api'] = [
|
|
$config['api'] = [
|
|
|
'bearer_token' => trim((string) ($_POST['bearer_token'] ?? 'change-me-token')),
|
|
'bearer_token' => trim((string) ($_POST['bearer_token'] ?? 'change-me-token')),
|
|
@@ -75,7 +76,7 @@ function renderLogin(?string $message, string $messageType): void
|
|
|
<meta charset="UTF-8">
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Adminpanel Login</title>
|
|
<title>Adminpanel Login</title>
|
|
|
- <link rel="stylesheet" href="/styles.css">
|
|
|
|
|
|
|
+ <link rel="stylesheet" href="<?= htmlspecialchars(app_url('/styles.css'), ENT_QUOTES) ?>">
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
|
<main class="auth-page">
|
|
<main class="auth-page">
|
|
@@ -97,7 +98,7 @@ function renderLogin(?string $message, string $messageType): void
|
|
|
<input type="password" name="password" required>
|
|
<input type="password" name="password" required>
|
|
|
</label>
|
|
</label>
|
|
|
<button class="button button--primary" type="submit">Einloggen</button>
|
|
<button class="button button--primary" type="submit">Einloggen</button>
|
|
|
- <a class="button button--ghost" href="/">Zurueck zum Dashboard</a>
|
|
|
|
|
|
|
+ <a class="button button--ghost" href="<?= htmlspecialchars(app_url('/'), ENT_QUOTES) ?>">Zurueck zum Dashboard</a>
|
|
|
</form>
|
|
</form>
|
|
|
</section>
|
|
</section>
|
|
|
</main>
|
|
</main>
|
|
@@ -115,7 +116,7 @@ function renderAdmin(array $config, ?string $message, string $messageType): void
|
|
|
<meta charset="UTF-8">
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Adminpanel</title>
|
|
<title>Adminpanel</title>
|
|
|
- <link rel="stylesheet" href="/styles.css">
|
|
|
|
|
|
|
+ <link rel="stylesheet" href="<?= htmlspecialchars(app_url('/styles.css'), ENT_QUOTES) ?>">
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
|
<main class="admin-page">
|
|
<main class="admin-page">
|
|
@@ -127,8 +128,8 @@ function renderAdmin(array $config, ?string $message, string $messageType): void
|
|
|
<p>Hier werden API-Token, Zugangsdaten, Faecher und Alarmwege direkt in der JSON-Config gepflegt.</p>
|
|
<p>Hier werden API-Token, Zugangsdaten, Faecher und Alarmwege direkt in der JSON-Config gepflegt.</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="inline-actions">
|
|
<div class="inline-actions">
|
|
|
- <a class="button button--ghost" href="/">Dashboard</a>
|
|
|
|
|
- <a class="button button--secondary" href="/admin/logout.php">Logout</a>
|
|
|
|
|
|
|
+ <a class="button button--ghost" href="<?= htmlspecialchars(app_url('/'), ENT_QUOTES) ?>">Dashboard</a>
|
|
|
|
|
+ <a class="button button--secondary" href="<?= htmlspecialchars(app_url('/admin/logout.php'), ENT_QUOTES) ?>">Logout</a>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -158,7 +159,12 @@ function renderAdmin(array $config, ?string $message, string $messageType): void
|
|
|
Absender fuer Email
|
|
Absender fuer Email
|
|
|
<input type="email" name="default_from_email" value="<?= htmlspecialchars((string) ($config['app']['default_from_email'] ?? ''), ENT_QUOTES) ?>">
|
|
<input type="email" name="default_from_email" value="<?= htmlspecialchars((string) ($config['app']['default_from_email'] ?? ''), ENT_QUOTES) ?>">
|
|
|
</label>
|
|
</label>
|
|
|
|
|
+ <label>
|
|
|
|
|
+ Basis-Pfad
|
|
|
|
|
+ <input type="text" name="base_path" value="<?= htmlspecialchars((string) ($config['app']['base_path'] ?? ''), ENT_QUOTES) ?>" placeholder="/auswertung">
|
|
|
|
|
+ </label>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <p class="field-help">Leer lassen fuer den Domain-Root. Fuer Unterordner z. B. <code>/auswertung</code> eintragen.</p>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
<section class="admin-grid">
|
|
<section class="admin-grid">
|