Upload via GUI (335 Dateien)
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* status.php – öffentliche Statusseite: Zustand der Dienste und aktuelle Meldungen.
|
||||
* Wird im Mitarbeiterbereich unter „Statusseite“ gepflegt und nur gezeigt, wenn sie dort eingeschaltet ist.
|
||||
*/
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
|
||||
$pdo = get_db();
|
||||
$activePage = 'status';
|
||||
$pageTitle = (string) get_setting('status_page_title', 'Systemstatus');
|
||||
if (!status_page_enabled()) {
|
||||
http_response_code(404);
|
||||
require __DIR__ . '/includes/header_customer.php';
|
||||
echo '<h1>Seite nicht gefunden</h1><p class="muted">Die angeforderte Seite existiert nicht.</p><p><a href="/">Zurück zur Startseite</a></p>';
|
||||
require __DIR__ . '/includes/footer_customer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$states = status_component_states();
|
||||
$overall = status_overall($pdo);
|
||||
$components = status_components($pdo);
|
||||
$incidents = status_incidents($pdo, 14);
|
||||
$open = array_values(array_filter($incidents, fn($i) => $i['status'] !== 'resolved'));
|
||||
$past = array_values(array_filter($incidents, fn($i) => $i['status'] === 'resolved'));
|
||||
$incStates = status_incident_states();
|
||||
|
||||
// Aktualisiert sich selbst, damit eine offene Seite nicht veraltet
|
||||
header('Cache-Control: no-cache');
|
||||
header('Refresh: 120');
|
||||
require __DIR__ . '/includes/header_customer.php';
|
||||
?>
|
||||
<div style="max-width:820px;margin:0 auto">
|
||||
<h1><?= e($pageTitle) ?></h1>
|
||||
<div class="card" style="padding:18px 22px;margin:16px 0;border-left:6px solid <?= e($overall['color']) ?>">
|
||||
<strong style="font-size:1.2rem;color:<?= e($overall['color']) ?>"><?= e($overall['label']) ?></strong>
|
||||
<div class="muted" style="font-size:.82rem;margin-top:2px">Stand: <?= e(date('d.m.Y H:i')) ?> Uhr</div>
|
||||
</div>
|
||||
|
||||
<?php foreach ($open as $i): ?>
|
||||
<div class="card" style="padding:16px 20px;margin-bottom:14px;border-left:6px solid #dc2626">
|
||||
<strong><?= e($i['title']) ?></strong>
|
||||
<span style="background:#fef3c7;color:#92400e;border-radius:20px;padding:2px 10px;font-size:.72rem;font-weight:700;margin-left:6px"><?= e($incStates[$i['status']] ?? $i['status']) ?></span>
|
||||
<?php if ($i['component_name']): ?><div class="muted" style="font-size:.82rem">Betrifft: <?= e($i['component_name']) ?></div><?php endif; ?>
|
||||
<?php foreach ($i['updates'] as $u): ?>
|
||||
<div style="margin-top:10px;font-size:.9rem"><strong><?= e($incStates[$u['status']] ?? $u['status']) ?></strong> <span class="muted" style="font-size:.78rem">· <?= e(format_dt((string) $u['created_at'])) ?></span>
|
||||
<?php if (trim((string) $u['body']) !== ''): ?><div><?= nl2br(e((string) $u['body'])) ?></div><?php endif; ?></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<div class="card" style="padding:6px 20px;margin:16px 0">
|
||||
<?php if (!$components): ?><p class="muted" style="padding:12px 0">Es sind noch keine Dienste eingetragen.</p><?php endif; ?>
|
||||
<?php foreach ($components as $k => $c): $st = $states[$c['status']] ?? $states['operational']; ?>
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0;<?= $k ? 'border-top:1px solid var(--border,#e3e9ee)' : '' ?>">
|
||||
<div><strong><?= e($c['name']) ?></strong><?php if (!empty($c['description'])): ?><div class="muted" style="font-size:.82rem"><?= e($c['description']) ?></div><?php endif; ?></div>
|
||||
<span style="color:<?= e($st[1]) ?>;font-weight:700;white-space:nowrap"><span style="display:inline-block;width:9px;height:9px;border-radius:50%;background:<?= e($st[1]) ?>;margin-right:6px"></span><?= e($st[0]) ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h2 style="margin-top:28px">Vergangene Meldungen (letzte 14 Tage)</h2>
|
||||
<?php if (!$past): ?><p class="muted">Keine Störungen in den letzten 14 Tagen.</p><?php endif; ?>
|
||||
<?php foreach ($past as $i): ?>
|
||||
<div style="padding:12px 0;border-top:1px solid var(--border,#e3e9ee)">
|
||||
<strong><?= e($i['title']) ?></strong> <span class="muted" style="font-size:.8rem">· <?= e(format_dt((string) $i['created_at'])) ?> · behoben</span>
|
||||
<?php foreach ($i['updates'] as $u): if (trim((string) $u['body']) === '') continue; ?>
|
||||
<div style="font-size:.88rem;margin-top:4px"><?= nl2br(e((string) $u['body'])) ?></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php require __DIR__ . '/includes/footer_customer.php'; ?>
|
||||
Reference in New Issue
Block a user