<?php
$pageTitle='Underground FX Requests'; include 'includes/header.php'; require_once __DIR__ . '/admin/includes/admin_lib.php';
$file = __DIR__ . '/data/requests.txt'; $statusFile = __DIR__ . '/data/request_status.json'; $items = smurf_parse_blocks($file); $statusMap = smurf_read_json($statusFile, []); if (!is_array($statusMap)) $statusMap = []; function req_key(string $block): string { return sha1($block); }
?>
<section class="container-fluid container-xxl fx-page-hero"><div class="fx-section-card"><div class="fx-section-kicker">Requests and dedications</div><h1>Put your song into the station flow.</h1><p>Listener requests, dedications and accepted spins all live in one polished request board.</p></div></section>
<section class="container-fluid container-xxl fx-section-block"><div class="row g-4"><div class="col-lg-5"><div class="fx-section-card h-100"><div class="fx-section-kicker">Request form</div><h3>Send a request</h3><form method="post" action="/send_request.php" class="fx-form-grid"><input class="form-control" type="text" name="name" placeholder="Your name" required><input class="form-control" type="email" name="email" placeholder="Email"><input class="form-control" type="text" name="song" placeholder="Song title" required><input class="form-control" type="text" name="artist" placeholder="Artist"><textarea class="form-control" name="dedication" rows="6" placeholder="Dedication or message"></textarea><button class="btn btn-primary" type="submit">Send request</button></form></div></div><div class="col-lg-7"><div class="fx-section-card h-100"><div class="d-flex justify-content-between align-items-end mb-3"><div><div class="fx-section-kicker">Accepted requests</div><h3>What listeners are getting on air</h3></div><a class="btn btn-outline-light" href="https://discord.gg/hA2uWMpCT8" target="_blank" rel="noopener">Request in Discord</a></div><?php $shown=0; foreach($items as $item){ $k=req_key($item['_raw'] ?? ''); $meta=$statusMap[$k] ?? ['status'=>'Pending']; if(($meta['status'] ?? 'Pending') !== 'Accepted' && ($meta['status'] ?? '') !== 'Played') continue; $shown++; echo '<div class="fx-queue-card"><strong>'.htmlspecialchars((string)($item['Name'] ?? 'Listener'),ENT_QUOTES,'UTF-8').'</strong><span class="fx-chip">'.htmlspecialchars((string)($meta['status'] ?? 'Accepted'),ENT_QUOTES,'UTF-8').'</span>'; if(!empty($item['Song'])) echo '<p><b>Song:</b> '.htmlspecialchars((string)$item['Song'],ENT_QUOTES,'UTF-8').'</p>'; if(!empty($item['Artist'])) echo '<p><b>Artist:</b> '.htmlspecialchars((string)$item['Artist'],ENT_QUOTES,'UTF-8').'</p>'; if(!empty($item['Dedication'])) echo '<p>'.nl2br(htmlspecialchars((string)$item['Dedication'],ENT_QUOTES,'UTF-8')).'</p>'; echo '</div>'; if($shown>=8) break; } if($shown===0) echo '<div class="fx-queue-card">No accepted requests yet.</div>'; ?></div></div></div></section>
<?php include 'includes/footer.php'; ?>