/
TorX
/
rasp
Обзор
Документация
Войти
/
TorX
/
rasp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
admin/index.php
71 строка
2 KB
tormovies
Add a posted flag for upcoming releases in admin and public lists.
07 авг 2026, 15:02
07 авг 2026, 15:02
3708742
Код
Авторство
О чём код?
<?php declare(strict_types=1); require_once __DIR__ . '/../includes/auth.php'; require_once __DIR__ . '/../includes/queries.php'; require_once __DIR__ . '/../includes/layout.php'; require_admin(); $now = new DateTime('today'); $year = isset($_GET['year']) ? (int) $_GET['year'] : (int) $now->format('Y'); $month = isset($_GET['month']) ? (int) $_GET['month'] : (int) $now->format('n'); if ($month < 1) { $month = 12; $year--; } if ($month > 12) { $month = 1; $year++; } $prevMonth = $month === 1 ? 12 : $month - 1; $prevYear = $month === 1 ? $year - 1 : $year; $nextMonth = $month === 12 ? 1 : $month + 1; $nextYear = $month === 12 ? $year + 1 : $year; $adminReturn = '/admin/?year=' . $year . '&month=' . $month; if (request_method() === 'POST' && post_string('action') === 'toggle_posted') { $year = isset($_POST['year']) ? (int) $_POST['year'] : $year; $month = isset($_POST['month']) ? (int) $_POST['month'] : $month; $adminReturn = '/admin/?year=' . $year . '&month=' . $month; try { set_release_posted((int) ($_POST['id'] ?? 0), ($_POST['is_posted'] ?? '') === '1'); } catch (Throwable $e) { flash_set('error', $e->getMessage()); } redirect($adminReturn); } $releases = get_month_releases($year, $month); $upcoming = list_upcoming(); render_header('Обзор', true); ?> <div class="row"> <div> <h1>Обзор</h1> <p class="muted">Календарь и предстоящие релизы</p> </div> <div class="actions"> <a class="btn btn-primary" href="/admin/release-edit.php">Добавить релиз</a> <a class="btn btn-secondary" href="/admin/artists.php">Артисты</a> <a class="btn btn-secondary" href="/admin/export.php">Импорт / экспорт</a> </div> </div> <div class="stack"> <?php render_calendar( $year, $month, $releases, '/admin/?year=' . $prevYear . '&month=' . $prevMonth, '/admin/?year=' . $nextYear . '&month=' . $nextMonth, format_month_title($year, $month), true ); ?> <section> <h2>Предстоящие релизы</h2> <p class="muted" style="margin:.35rem 0 0.85rem">Галочка справа сверху — «выложено»</p> <?php render_release_list($upcoming, true, 'Нет релизов от сегодня и дальше', true, $adminReturn); ?> </section> </div> <?php render_footer();