fix bahn3

This commit is contained in:
Thies Mueller
2026-08-30 11:25:19 +02:00
parent 905d5d486a
commit c922045403
+119 -30
View File
@@ -33,8 +33,9 @@ function render_message_box($message) {
'warning' => 'warning', 'warning' => 'warning',
'error' => 'danger' 'error' => 'danger'
]; ];
$type = $typeMap[$message['type']] ?? 'secondary'; $type = $typeMap[$message['type'] ?? ''] ?? 'secondary';
return "<div class='alert alert-{$type} fs-5' role='alert'>{$message['message']}</div>"; $text = htmlspecialchars($message['message'] ?? '', ENT_QUOTES, 'UTF-8');
return "<div class='alert alert-{$type} fs-5' role='alert'>{$text}</div>";
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -67,18 +68,22 @@ function render_message_box($message) {
<img src="/res/img/sat_logo.png" height="70"> <img src="/res/img/sat_logo.png" height="70">
</div> </div>
</div> </div>
<div class="container mt-4"> <div class="container mt-4">
<div id="messages"> <div id="messages">
<?php <?php
if (!empty($messages)) { if (!empty($messages)) {
echo render_message_box($messages); echo render_message_box($messages);
} }
?> ?>
</div> </div>
<div class="row mt-4">
<div class="row mt-4">
<!-- Ergebnisse --> <!-- Ergebnisse -->
<div class="col-lg-7"> <div class="col-lg-7">
<h5 class="fw-bold">Letzte Ergebnisse</h5> <h5 class="fw-bold">Letzte Ergebnisse</h5>
<div id="resultsBox" class="bg-white border rounded p-3"> <div id="resultsBox" class="bg-white border rounded p-3">
<?php <?php
if (empty($results)) { if (empty($results)) {
@@ -86,69 +91,153 @@ function render_message_box($message) {
} else { } else {
$lauf = null; $lauf = null;
$latest = array_reverse(array_slice($results, -10)); $latest = array_reverse(array_slice($results, -10));
foreach ($latest as $res) { foreach ($latest as $res) {
if ($lauf !== $res['lauf']) {
echo "<h3 class='mt-4'>Lauf {$res['lauf']}</h3>"; if ($lauf !== ($res['lauf'] ?? null)) {
$lauf = $res['lauf']; echo "<h3 class='mt-4'>Lauf " .
htmlspecialchars($res['lauf'] ?? '', ENT_QUOTES, 'UTF-8') .
"</h3>";
$lauf = $res['lauf'] ?? null;
} }
echo "<div class='mb-3'><strong>{$res['title']}</strong><br>";
foreach (['bahn1', 'bahn2', 'bahn3'] as $bahn) { echo "<div class='mb-3'>";
$boot = $res[$bahn]['boot'];
$zeit = $res[$bahn]['zeit']; echo "<strong>" .
echo ucfirst($bahn) . ": $boot - $zeit<br>"; htmlspecialchars($res['title'] ?? '', ENT_QUOTES, 'UTF-8') .
"</strong><br>";
if (!empty($res['bahn1'])) {
$boot = $res['bahn1']['boot'] ?? '';
$zeit = $res['bahn1']['zeit'] ?? '';
echo "Bahn 1: " .
htmlspecialchars($boot, ENT_QUOTES, 'UTF-8') .
" - " .
htmlspecialchars($zeit, ENT_QUOTES, 'UTF-8') .
"<br>";
} }
if (!empty($res['bahn2'])) {
$boot = $res['bahn2']['boot'] ?? '';
$zeit = $res['bahn2']['zeit'] ?? '';
echo "Bahn 2: " .
htmlspecialchars($boot, ENT_QUOTES, 'UTF-8') .
" - " .
htmlspecialchars($zeit, ENT_QUOTES, 'UTF-8') .
"<br>";
}
if (!empty($res['bahn3'])) {
$boot = $res['bahn3']['boot'] ?? '';
$zeit = $res['bahn3']['zeit'] ?? '';
echo "Bahn 3: " .
htmlspecialchars($boot, ENT_QUOTES, 'UTF-8') .
" - " .
htmlspecialchars($zeit, ENT_QUOTES, 'UTF-8') .
"<br>";
}
echo "</div>"; echo "</div>";
} }
} }
?> ?>
</div> </div>
</div> </div>
<!-- Nächste Rennen --> <!-- Nächste Rennen -->
<div class="col-lg-5"> <div class="col-lg-5">
<h5 class="fw-bold">Nächste Rennen</h5> <h5 class="fw-bold">Nächste Rennen</h5>
<div class="bg-white border rounded p-3"> <div class="bg-white border rounded p-3">
<?php <?php
foreach ($nextRaces as $rennen) { foreach ($nextRaces as $rennen) {
echo "<div class='mb-4'> echo "<div class='mb-4'>";
<strong>{$rennen['name']} ({$rennen['zeit']})</strong><br>
Bahn 1: {$rennen['bahn1']}<br> echo "<strong>" .
Bahn 2: {$rennen['bahn2']}<br> htmlspecialchars($rennen['name'] ?? '', ENT_QUOTES, 'UTF-8') .
Bahn 3: {$rennen['bahn3']}<br> " (" .
</div>"; htmlspecialchars($rennen['zeit'] ?? '', ENT_QUOTES, 'UTF-8') .
")</strong><br>";
if (isset($rennen['bahn1'])) {
echo "Bahn 1: " .
htmlspecialchars($rennen['bahn1'], ENT_QUOTES, 'UTF-8') .
"<br>";
}
if (isset($rennen['bahn2'])) {
echo "Bahn 2: " .
htmlspecialchars($rennen['bahn2'], ENT_QUOTES, 'UTF-8') .
"<br>";
}
if (isset($rennen['bahn3'])) {
echo "Bahn 3: " .
htmlspecialchars($rennen['bahn3'], ENT_QUOTES, 'UTF-8') .
"<br>";
}
echo "</div>";
} }
?> ?>
</div> </div>
</div> </div>
</div>
<div class="row mt-5 align-items-center"> </div>
<div class="row mt-5 align-items-center">
<div class="col-lg-10"> <div class="col-lg-10">
<div class="p-4 bg-white rounded border fs-5"> <div class="p-4 bg-white rounded border fs-5">
<strong>Alle Ergebnisse & Rennpläne Live und als App unter apps.sport-am-tankumsee.de oder den QR Code Scannen</strong> <strong>
Alle Ergebnisse & Rennpläne Live und als App unter
apps.sport-am-tankumsee.de oder den QR Code Scannen
</strong>
</div> </div>
</div> </div>
<div class="col-lg-2 text-end"> <div class="col-lg-2 text-end">
<img src="/res/img/qrcode.png" class="img-fluid" alt="QR Code"> <img src="/res/img/qrcode.png" class="img-fluid" alt="QR Code">
</div> </div>
</div>
</div> </div>
</div>
<script> <script>
function updateClock() { function updateClock() {
const now = new Date(); const now = new Date();
document.getElementById('clock').innerText = now.toLocaleTimeString('de-DE'); document.getElementById('clock').innerText =
now.toLocaleTimeString('de-DE');
} }
setInterval(updateClock, 1000); setInterval(updateClock, 1000);
updateClock(); updateClock();
setInterval(() => location.reload(), 15000); setInterval(() => location.reload(), 15000);
let scrollDirection = 1;
setInterval(() => { let scrollDirection = 1;
setInterval(() => {
const box = document.getElementById('resultsBox'); const box = document.getElementById('resultsBox');
if (box.scrollHeight > box.clientHeight) { if (box.scrollHeight > box.clientHeight) {
if (box.scrollTop + box.clientHeight >= box.scrollHeight) scrollDirection = -1;
if (box.scrollTop <= 0) scrollDirection = 1; if (box.scrollTop + box.clientHeight >= box.scrollHeight) {
scrollDirection = -1;
}
if (box.scrollTop <= 0) {
scrollDirection = 1;
}
box.scrollTop += scrollDirection * 1; box.scrollTop += scrollDirection * 1;
} }
}, 100); }, 100);
</script> </script>
</body> </body>
</html> </html>