<?php

if (!isset($_GET["serverid"])) {
    die("serverid is not set!");
}
if (!isset($_GET["lang"])) {
    die("lang is not set!");
}
session_start();
try {
    include_once dirname(__FILE__) . "/../scripts-generic/servers.php";
    include_once dirname(__FILE__) . "/../scripts-generic/getPDO.php";
    include_once dirname(__FILE__) . "/../scripts-generic/PDOQuery.php";
    include_once dirname(__FILE__) . "/../scripts-generic/checkAdmin.php";
    include_once dirname(__FILE__) . "/config/translation_report.php";
    $isMainAdmin = checkMainAdmin();
    if ($_GET["serverid"] == "" or $_GET["serverid"] == "-1") {
        $server = NULL;
    } else {
        $server = GetServers()[$_GET["serverid"]];
    }
    $lang = getReportTranslation($_GET["lang"]);
    $pdo = getPDOConnection();
    $conditions = array();
    $parameters = array();
    if (isset($_GET["report_ids"]) and $_GET["report_ids"][0] != "") {
        $by_report_ids = $_GET["report_ids"];
        $id_count = count($by_report_ids);
        if ($id_count > 1) {
            $i = 0;
            foreach ($by_report_ids as $id) {
<?php

if (!isset($_POST["report_id"])) {
    die("report_id is not set!");
}
include_once dirname(__FILE__) . "/../../scripts-generic/getPDO.php";
include_once dirname(__FILE__) . "/../../scripts-generic/PDOQuery.php";
include_once dirname(__FILE__) . "/../../scripts-generic/checkAdmin.php";
session_start();
$report_id = intval($_POST["report_id"]);
if (checkAdminForReportByReportId($report_id) || checkMainAdmin()) {
    $pdo = getPDOConnection();
    $query = "UPDATE `ezpz-report-g`.`report_report` SET status_id = 5, time_finish = TIMESTAMP(NOW()) WHERE id = :id";
    header('Content-Type: application/json');
    if (PDOExecParametrizedQuery($pdo, $query, array("id" => $report_id), __FILE__, __LINE__)) {
        echo json_encode(array('success' => true));
    } else {
        echo json_encode(array('success' => false));
    }
}