<?php $pageTitle='Page — Almost Heaven Radio'; include __DIR__ . '/header.php'; include __DIR__ . '/menu.php'; require_once __DIR__ . '/includes/media_helpers.php'; $slug=trim($_GET['slug'] ?? ''); $slug=preg_replace('/[^a-zA-Z0-9\-]/','',$slug); $dataFile=__DIR__.'/data/pages.json'; $pages=file_exists($dataFile)?json_decode((string)file_get_contents($dataFile),true):[]; if(!is_array($pages)) $pages=[]; $page=$slug!=='' && isset($pages[$slug]) ? $pages[$slug] : null; ?>
<main class="content-area"><div class="content-wrapper page-shell"><section class="content-card"><?php if(!$page): ?><h1>Page Not Found</h1><p>This page does not exist.</p><?php elseif(empty($page['published'])): ?><h1><?= htmlspecialchars($page['title'] ?? 'Page') ?></h1><p>This page is not published.</p><?php else: ?><?php if(!empty($page['image'])): ?><div class="hero-image" style="margin-bottom:18px;"><img src="<?= htmlspecialchars(ah_media_src((string)$page['image'], 'img/content')) ?>" alt=""></div><?php endif; ?><h1><?= htmlspecialchars($page['title'] ?? 'Page') ?></h1><?php if(!empty($page['summary'])): ?><p class="text-muted"><?= nl2br(htmlspecialchars($page['summary'])) ?></p><?php endif; ?><div class="rich-content"><?= $page['content'] ?? '' ?></div><?php endif; ?></section></div></main>
<?php include __DIR__ . '/footer.php'; ?>