
<?php
session_start(); require __DIR__ . '/includes/header.php';
$settings = oldies_read_settings();
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $CAN_EDIT) { $settings['player_show_in_nav'] = !empty($_POST['player_show_in_nav']); $settings['listen_url'] = trim($_POST['listen_url'] ?? $settings['listen_url']); $settings['stream_name'] = trim($_POST['stream_name'] ?? $settings['stream_name']); $settings['popout_intro'] = trim($_POST['popout_intro'] ?? $settings['popout_intro']); oldies_save_settings($settings); admin_redirect_self(['saved'=>1]); }
?>
<section class="content-card"><h1 class="admin-title">🪟 Popout Player</h1><?php if (!empty($_GET['saved'])): ?><div class="msg success">Player settings saved.</div><?php endif; ?><div class="page-builder-grid"><section class="content-card" style="text-align:left;"><form method="post" class="form"><label style="display:flex;gap:10px;align-items:center;margin:10px 0;"><input type="checkbox" name="player_show_in_nav" <?= !empty($settings['player_show_in_nav'])?'checked':'' ?>> Show Popout Player in navigation</label><label>Stream name</label><input class="input-field" name="stream_name" value="<?= admin_h($settings['stream_name'] ?? '') ?>"><label>Listen URL</label><input class="input-field" name="listen_url" value="<?= admin_h($settings['listen_url'] ?? '') ?>"><label>Intro copy</label><textarea class="input-field" rows="5" name="popout_intro"><?= admin_h($settings['popout_intro'] ?? '') ?></textarea><button class="admin-btn primary" type="submit" <?= !$CAN_EDIT ? 'disabled' : '' ?>>Save player settings</button></form></section><section class="content-card" style="text-align:left;"><h3 style="margin-top:0;">Preview</h3><p><strong>Stream:</strong> <?= admin_h($settings['stream_name'] ?? '') ?></p><p><?= nl2br(admin_h($settings['popout_intro'] ?? '')) ?></p><p><code><?= admin_h($settings['listen_url'] ?? '') ?></code></p><a class="admin-btn" target="_blank" rel="noopener" href="/popout-player.php">Open popout page</a></section></div></section>
<?php include __DIR__ . '/includes/footer.php'; ?>
