Example #1
0
function GetServers()
{
    include_once dirname(__FILE__) . "/getPDO.php";
    include_once dirname(__FILE__) . "/PDOQuery.php";
    $pdo = getPDOConnection();
    $query = "SELECT * FROM `soe-csgo`.`utils_servers` ORDER BY order_priority;";
    $result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
    $res = array();
    foreach ($result as $row) {
        $res[$row["server_id"]] = $row;
    }
    return $res;
}
Example #2
0
function getAdminsReports()
{
    try {
        include_once "/data/web/virtuals/93680/virtual/www/domains/ezpz.cz/ext/phpbb/pages/styles/pbtech/template/scripts-generic/getPDO.php";
        include_once "/data/web/virtuals/93680/virtual/www/domains/ezpz.cz/ext/phpbb/pages/styles/pbtech/template/scripts-generic/PDOQuery.php";
        // get admin ids and names
        $pdo = getPDOConnection();
        $result = getPDOQueryResult($pdo, "SELECT id, name FROM `soe-csgo`.sb_admins WHERE active = 1", __FILE__, __LINE__);
        $admins = array();
        foreach ($result as $row) {
            $admins[$row["id"]] = array("name" => $row["name"]);
        }
        // get new and finished report counts
        $query = "SELECT a.active, a.id, a.name, COUNT(*) as count_report_new\n                    FROM `soe-csgo`.sb_admins AS a\n                    JOIN `ezpz-report-g`.report_report AS r ON r.admin_id = a.id\n                    WHERE (r.status_id = 1 OR r.status_id = 2) AND a.active = 1\n                    GROUP BY a.id";
        $result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
        foreach ($result as $row) {
            $admins[$row["id"]]["count_report_new"] = !is_null($row["count_report_new"]) ? $row["count_report_new"] : 0;
        }
        $query = "SELECT a.active, a.id, COUNT(*) as count_report_finished\n                        FROM `soe-csgo`.sb_admins AS a\n                        JOIN `ezpz-report-g`.report_report AS r ON r.admin_id = a.id\n                        WHERE (r.status_id = 3 OR r.status_id = 4 OR r.status_id = 5) AND a.active = 1\n                        GROUP BY a.id";
        $result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
        foreach ($result as $row) {
            $admins[$row["id"]]["count_report_finished"] = !is_null($row["count_report_finished"]) ? $row["count_report_finished"] : 0;
        }
        $admins_new = array();
        foreach ($admins as $key => $value) {
            if (!array_key_exists("count_report_new", $value)) {
                $admins[$key]["count_report_new"] = 0;
            }
            if (!array_key_exists("count_report_finished", $value)) {
                $admins[$key]["count_report_finished"] = 0;
            }
            $admins_new[] = array("admin_id" => $key, "count_report_new" => $admins[$key]["count_report_new"], "count_report_finished" => $admins[$key]["count_report_finished"], "name" => $admins[$key]["name"]);
        }
        return $admins_new;
    } catch (Exception $ex) {
        echo $ex->getMessage();
    }
}
Example #3
0
 // INSERT map to report_map if map doesn't exist there
 if (PDOcheckEmptyQuery($pdo, "SELECT id FROM `ezpz-report-g`.report_map WHERE map = :map", __FILE__, __LINE__, array(":map" => $_GET["map"]))) {
     PDOExecParametrizedQuery($pdo, "INSERT INTO `ezpz-report-g`.report_map(map) VALUES (:map)", array(":map" => $_GET["map"]), __FILE__, __LINE__);
     $map_id = $pdo->lastInsertId();
 } else {
     $map_id = getPDOParametrizedQueryScalarValue($pdo, "SELECT id FROM `ezpz-report-g`.report_map WHERE map = :map", array(":map" => $_GET["map"]), __FILE__, __LINE__);
 }
 // check if target was reported today
 // if true, use the same admin id for this report
 // if false, assign new admin id
 $query = "SELECT admin_id FROM `ezpz-report-g`.report_report AS r JOIN `ezpz-report-g`.report_players AS p ON p.id = r.target_id\n              WHERE DATE(r.time_create) = :time_create AND p.sid LIKE :sid";
 $parameters = array(":time_create" => date("Y-m-d"), ":sid" => "%" . $_GET["trg_sid"]);
 $result = getPDOParametrizedQueryResult($pdo, $query, $parameters, __FILE__, __LINE__);
 // find suitable admin for this report (his id)
 if (count($result) == 0) {
     $result = getPDOQueryResult($pdo, "SELECT id, name FROM `soe-csgo`.sb_admins WHERE active = 1", __FILE__, __LINE__);
     $admin_id = $result[array_rand($result)]["id"];
     /*
     // first find admins with lowest number of finished reports
     $admins = getAdminsReports();
     
     $min = $admins[0]["count_report_finished"];
     $admins_finished = array($admins[0]);
     
     for ($i = 1; $i < count($admins); $i++)
     {
         if ($admins[$i]["count_report_finished"] < $min)
         {
             $min = $admins[$i]["count_report_finished"];
             $admins_finished = array($admins[$i]);
         }
Example #4
0
                <tr style="display: none;">
                    <td><label for="input-lang">Language: </label></td>
                    <td colspan="2">
                        <input type="text" id="input-lang" name="lang" size="50" readonly="readonly" />
                    </td>
                </tr>
            </table>

            <fieldset style="margin-top: 1em">
                <legend style="font-size: 1.5em;"><?php 
echo $translation["controls"]["reason"];
?>
</legend>
                    <?php 
$query = "SELECT id, reason_" . $translation["db"]["suffix"] . " FROM `ezpz-report-g`.report_reason";
$result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
foreach ($result as $row) {
    $row_id = $row["id"];
    echo "<div class='div-check'>";
    echo "<label for='check-reason-{$row_id}' class='check-label'>" . $row["reason_" . $translation["db"]["suffix"]] . "</label>";
    echo "<input type='checkbox' class='check-reason' size='30' id='check-reason-{$row_id}' reason_id='{$row_id}' />";
    echo "</div>";
}
?>

                    <div style="margin-top: 5px;">
                        <label for="input-reason_custom" style="margin-right: 10px; font-size: 15px;"><?php 
echo $translation["controls"]["reason_custom"];
?>
:</label>
                        <textarea id="input-reason_custom" cols="50" name="other" ></textarea>
Example #5
0
/**
 *
 * @return True when SQL query returns empty result set. False otherwise.
 */
function PDOcheckEmptyQuery($pdo, $query, $file, $line_number, $parameters = NULL)
{
    try {
        if (empty($parameters) || $parameters === NULL) {
            $result = getPDOQueryResult($pdo, $query, $file, $line_number);
        } else {
            $result = getPDOParametrizedQueryResult($pdo, $query, $parameters, $file, $line_number);
        }
        if (count($result) == 0) {
            return True;
        } else {
            return False;
        }
    } catch (Exception $ex) {
        echo getErrorDescription($ex->getMessage(), $query, $file, $line_number);
        return False;
    }
}