115 lines
5.1 KiB
PHP
115 lines
5.1 KiB
PHP
<?php
|
|
/** @var \App\App $app */
|
|
$app = app();
|
|
|
|
// globale Assets (Brand-Styles & JS)
|
|
$app->assets()->addStyle('/assets/css/styles.css', 'early');
|
|
$app->assets()->addStyle('/assets/css/app.css', 'normal');
|
|
$app->assets()->addScript('/assets/js/app.js', 'footer', true, false);
|
|
|
|
$childGender = $_SESSION['child_gender_summary'] ?? ''; // 'male' | 'female' | 'mixed' | ''
|
|
if (!in_array($childGender, ['male', 'female', 'mixed'], true)) {
|
|
$childGender = '';
|
|
}
|
|
|
|
$debugEnabled = defined('APP_DEBUG') && APP_DEBUG === true;
|
|
$debugFiles = [];
|
|
if ($debugEnabled) {
|
|
$debugDir = __DIR__ . '/../../debug';
|
|
if (is_dir($debugDir)) {
|
|
foreach (scandir($debugDir) as $f) {
|
|
if ($f === '.' || $f === '..') continue;
|
|
$path = $debugDir . '/' . $f;
|
|
if (is_file($path)) {
|
|
$debugFiles[] = $f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= htmlspecialchars(t('common.title'), ENT_QUOTES) ?></title>
|
|
<meta name="description" content="Papa-Kind-Treff: Väter vernetzen sich für Treffen mit und ohne Kinder, Events in der Nähe entdecken und sicher Kontakte knüpfen.">
|
|
<?php asset_styles(); ?>
|
|
<?php asset_scripts('header'); ?>
|
|
</head>
|
|
<body data-auth="<?= isset($_SESSION['user_id']) ? '1' : '0' ?>" data-child-gender="<?= htmlspecialchars($childGender, ENT_QUOTES) ?>">
|
|
<?php tpl('matomo', 'structure'); ?>
|
|
<?php tpl('nav', 'structure'); ?>
|
|
|
|
<?php if ($debugEnabled): ?>
|
|
<style>
|
|
.debug-fab { position: fixed; right: 18px; bottom: 18px; z-index: 200; background:#111827; color:#fff; border:none; border-radius: 999px; width: 52px; height:52px; display:flex; align-items:center; justify-content:center; font-size:24px; box-shadow:0 10px 30px rgba(0,0,0,0.2); cursor:pointer; }
|
|
.debug-modal { position:fixed; inset:0; background: rgba(0,0,0,0.4); display:none; align-items:center; justify-content:center; z-index: 210; padding:16px; }
|
|
.debug-modal.open { display:flex; }
|
|
.debug-panel { background:#fff; border-radius: 12px; padding:16px; width: min(90vw, 640px); max-height: 80vh; overflow:auto; box-shadow:0 10px 30px rgba(0,0,0,0.25); }
|
|
.debug-modal pre { background:#f8fafc; border:1px solid #e5e7eb; padding:10px; border-radius:8px; max-height: 50vh; overflow:auto; white-space: pre-wrap; }
|
|
</style>
|
|
<button class="debug-fab" aria-label="Debug öffnen" data-debug-open>🐞</button>
|
|
<div class="debug-modal" id="debugModal">
|
|
<div class="debug-panel">
|
|
<div style="display:flex;justify-content:space-between;align-items:center;gap:8px;">
|
|
<h3 style="margin:0;">Debug-Logs</h3>
|
|
<button class="btn ghost" type="button" data-debug-close>✕</button>
|
|
</div>
|
|
<?php if (!$debugFiles): ?>
|
|
<p class="muted">Keine Logs in /debug/ gefunden.</p>
|
|
<?php else: ?>
|
|
<form method="get" id="debugForm" style="margin:12px 0;">
|
|
<label class="label" for="debugSelect">Log auswählen</label>
|
|
<select class="select" id="debugSelect" name="file">
|
|
<option value="">-- auswählen --</option>
|
|
<?php foreach ($debugFiles as $f): ?>
|
|
<option value="<?= htmlspecialchars($f, ENT_QUOTES) ?>"><?= htmlspecialchars($f, ENT_QUOTES) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</form>
|
|
<div id="debugContent"><p class="muted">Log auswählen, um Inhalt zu sehen.</p></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function(){
|
|
const openBtn = document.querySelector('[data-debug-open]');
|
|
const modal = document.getElementById('debugModal');
|
|
const closeBtn = modal?.querySelector('[data-debug-close]');
|
|
const select = document.getElementById('debugSelect');
|
|
const content = document.getElementById('debugContent');
|
|
if (openBtn && modal) {
|
|
openBtn.addEventListener('click', ()=> modal.classList.add('open'));
|
|
}
|
|
closeBtn?.addEventListener('click', ()=> modal.classList.remove('open'));
|
|
modal?.addEventListener('click', (e)=>{ if(e.target === modal) modal.classList.remove('open'); });
|
|
if (select && content) {
|
|
select.addEventListener('change', ()=>{
|
|
const file = select.value;
|
|
if (!file) { content.innerHTML = '<p class="muted">Log auswählen, um Inhalt zu sehen.</p>'; return; }
|
|
fetch('/debug?file=' + encodeURIComponent(file) + '&raw=1')
|
|
.then(r => {
|
|
if (!r.ok) throw new Error('Request failed');
|
|
return r.text();
|
|
})
|
|
.then(text => {
|
|
if (!text.trim()) {
|
|
content.innerHTML = '<p class="muted">Log ist leer.</p>';
|
|
return;
|
|
}
|
|
const escape = (s) => s
|
|
.replace(/&/g, '&')
|
|
.replace(/</g, '<')
|
|
.replace(/>/g, '>')
|
|
.replace(/"/g, '"')
|
|
.replace(/'/g, ''');
|
|
content.innerHTML = '<pre>'+escape(text)+'</pre>';
|
|
})
|
|
.catch(()=> content.innerHTML = '<p class="muted">Konnte Log nicht laden.</p>');
|
|
});
|
|
}
|
|
})();
|
|
</script>
|
|
<?php endif; ?>
|