format('l, F j \a\t g:ia') . ' ' . STATION_TIMEZONE_LABEL . ' (' . substr($utc, 11, 5) . ' UTC'; if (substr($utc, 0, 10) !== $local->format('Y-m-d')) $text .= ' on ' . (new DateTimeImmutable($utc))->format('l'); return $text . ')'; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { verifyCsrf(); $action = $_POST['action'] ?? ''; if ($action === 'set_show') { $stmt = $db->prepare('SELECT id, name FROM shows WHERE id = ?'); $stmt->execute([(int)($_POST['show_id'] ?? 0)]); $show = $stmt->fetch(); $date = trim((string)($_POST['date'] ?? '')); $time = substr(trim((string)($_POST['time'] ?? '')), 0, 5); $scheduledAt = $date === '' && $time === '' ? null : stationTimeToUtc("$date $time"); if (!$show) { flash('Please choose a show.', 'error'); } elseif (($date !== '' || $time !== '') && $scheduledAt === null) { flash('Please enter both a valid date and time, or leave both blank.', 'error'); } elseif (setBroadcastShow($db, (int)$show['id'], $scheduledAt) === 'live') { flash("The live broadcast is now {$show['name']}."); } else { flash("{$show['name']} is queued" . ($scheduledAt ? ' for ' . describeScheduledAt($scheduledAt) : '') . '. It will go live as soon as the stream starts.'); } } elseif ($action === 'clear_queue') { clearQueuedShow($db); flash('The queued show has been cleared.'); } header('Location: index.php'); exit; } $live = liveBroadcast($db); $current = currentShow($db); $shows = $db->query('SELECT id, name FROM shows ORDER BY name')->fetchAll(); $scheduledLocal = !$live && $current && $current['scheduled_at'] ? utcToStationTime($current['scheduled_at']) : null; adminHeader('Dashboard', $admin); ?>
Live now= $current ? ': ' . e($current['name']) : ' (no show set)' ?>, since = e($live['started_at']) ?> UTC. Offline. = e($current['name']) ?> is queued for the next broadcast= $current['scheduled_at'] ? ', scheduled for ' . e(describeScheduledAt($current['scheduled_at'])) : '' ?>. Offline. No show is queued.
= $live ? 'Switch which show the live page and recently played list belong to.' : 'Choose the show before you start streaming. The broadcast goes live on the site automatically when the stream comes online. The show, and its start time if you enter one, appear on the main page until then.' ?>