<?php

\session_start();
\ob_start();
require __DIR__ . '/common.php';
use Ministra\Lib\Admin;
use Ministra\Lib\AdminAccess;
use Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\B4291b8d8fa2d898727b1f446db1e661e;
use Ministra\Lib\Video;
$error = '';
\Ministra\Lib\Admin::checkAuth();
\Ministra\Lib\Admin::checkAccess(\Ministra\Lib\AdminAccess::ACCESS_VIEW);
if (@$_GET['id']) {
    \Ministra\Lib\Admin::checkAccess(\Ministra\Lib\AdminAccess::ACCESS_EDIT);
    $task_id = (int) $_GET['id'];
    $task = \Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\B4291b8d8fa2d898727b1f446db1e661e::getInstance()->from('moderator_tasks')->where(['id' => $task_id])->get()->first();
    if (!empty($task) && $task['ended'] == 0) {
        \Ministra\Lib\bd5c9022e9a9029209e5fd05775ea272\B4291b8d8fa2d898727b1f446db1e661e::getInstance()->update('moderator_tasks', ['ended' => 1, 'rejected' => 1, 'end_time' => 'NOW()'], ['id' => $task_id]);
        \Ministra\Lib\Video::log($task['media_id'], '<a href="msgs.php?task=' . $task_id . '">' . \_('task rejected') . '</a>');
    }
    if (@$_GET['send_to']) {
        \header('Location: send_to.php?id=' . $_GET['send_to']);
    } else {
        \header('Location: tasks.php');
    }
    exit;
}
