Code Duplication    Length = 77-77 lines in 3 locations

views/life/medics.php 1 location

@@ 22-98 (lines=77) @@
19
}
20
21
$result_of_query = $db_link->query($sql);
22
if ($result_of_query->num_rows > 0) {
23
    while ($row = mysqli_fetch_assoc($result_of_query)) {
24
        $pids[] = $row['playerid'];
25
    }
26
    $pids = implode(',', $pids);
27
    if ($settings['steamAPI'] && $_SESSION['permissions']['view']['steam'] && !$settings['performance'] && $settings['vacTest']) {
28
        $api = "http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=" . $settings['steamAPI'] . "&steamids=" . $pids;
29
        $bans = get_object_vars(json_decode(file_get_contents($api)));
30
        $bans = $bans['players'];
31
        $steamPlayers = count($bans);
32
    } else {
33
        $steamPlayers = 0;
34
    }
35
36
    $result_of_query = $db_link->query($sql);
37
    ?>
38
    <h1 class="page-header">
39
        <?php echo $lang['medic']; ?>
40
        <small><?php echo $lang['overview']; ?></small>
41
    </h1>
42
    <div class="content-panel">
43
        <table class="table table-striped table-advance table-hover">
44
            <h4>
45
                <i class="fa fa-user"></i>
46
                <?php echo $lang['medic'];
47
                include("views/templates/search.php"); ?>
48
            </h4>
49
            <hr class="hidden-xs">
50
            <thead>
51
            <tr>
52
                <th><i class="fa fa-user"></i><?php echo $lang['name']; ?></th>
53
                <th><i class="fa fa-eye"></i><?php echo $lang['playerID']; ?></th>
54
                <th><i class="fa fa-user"></i><?php echo $lang['rank']; ?></th>
55
                <?php if ($_SESSION['permissions']['edit']['player']) {
56
                    echo '<th><i class="fa fa-pencil"></i> ' . $lang['edit'] . '</th>';
57
                }
58
                ?>
59
            </tr>
60
            </thead>
61
            <tbody>
62
            <?php
63
            while ($row = mysqli_fetch_assoc($result_of_query)) {
64
                $playersID = $row["playerid"];
65
                echo "<tr>";
66
                echo "<td>" . $row["name"] . "</td>";
67
                echo "<td>" . $row["playerid"] . "</td>";
68
                echo "<td class='hidden-xs'>" . $row["mediclevel"] . "</td>";
69
                if ($_SESSION['permissions']['edit']['player']) {
70
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
71
                    echo "<i class='fa fa-pencil'></i></a></td>";
72
                } else {
73
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
74
                    echo "<i class='fa fa-eye'></i></a></td>";
75
                }
76
                if ($_SESSION['permissions']['view']['steam'] && $steamPlayers > 0) {
77
                    echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
78
                    for ($player = 0; $player <= $steamPlayers; $player++) {
79
                        if ($bans[$player]->SteamId == $row['playerid']) {
80
                            if ($bans[$player]->VACBanned == true) {
81
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
82
                                echo "class='btn btn-danger btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>";
83
84
                            } else {
85
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
86
                                echo "class='btn btn-primary btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>"; }
87
                        }
88
                    }
89
                    echo '</td>';
90
                }
91
                echo "</tr>";
92
            }
93
            echo "</tbody></table>";
94
            include("views/templates/page.php");
95
            ?>
96
    </div>
97
    <?php
98
} else echo '<h3>' . errorMessage(36, $lang) . '</h3>';
99

views/life/police.php 1 location

@@ 22-98 (lines=77) @@
19
}
20
21
$result_of_query = $db_link->query($sql);
22
if ($result_of_query->num_rows > 0) {
23
    while ($row = mysqli_fetch_assoc($result_of_query)) {
24
        $pids[] = $row['playerid'];
25
    }
26
    $pids = implode(',', $pids);
27
    if ($settings['steamAPI'] && $_SESSION['permissions']['view']['steam'] && !$settings['performance'] && $settings['vacTest']) {
28
        $api = "http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=" . $settings['steamAPI'] . "&steamids=" . $pids;
29
        $bans = get_object_vars(json_decode(file_get_contents($api)));
30
        $bans = $bans['players'];
31
        $steamPlayers = count($bans);
32
    } else {
33
        $steamPlayers = 0;
34
    }
35
36
    $result_of_query = $db_link->query($sql);
37
    ?>
38
    <h1 class="page-header">
39
        <?php echo $lang['police']; ?>
40
        <small><?php echo $lang['overview']; ?></small>
41
    </h1>
42
    <div class="content-panel">
43
        <table class="table table-striped table-advance table-hover">
44
            <h4>
45
                <i class="fa fa-user"></i>
46
                <?php echo $lang['police'];
47
                include("views/templates/search.php"); ?>
48
            </h4>
49
            <hr class="hidden-xs">
50
            <thead>
51
            <tr>
52
                <th><i class="fa fa-user"></i><?php echo $lang['name']; ?></th>
53
                <th><i class="fa fa-eye"></i><?php echo $lang['playerID']; ?></th>
54
                <th><i class="fa fa-user"></i><?php echo $lang['rank']; ?></th>
55
                <?php if ($_SESSION['permissions']['edit']['player']) {
56
                    echo '<th><i class="fa fa-pencil"></i> ' . $lang['edit'] . '</th>';
57
                }
58
                ?>
59
            </tr>
60
            </thead>
61
            <tbody>
62
            <?php
63
            while ($row = mysqli_fetch_assoc($result_of_query)) {
64
                $playersID = $row["playerid"];
65
                echo "<tr>";
66
                echo "<td>" . $row["name"] . "</td>";
67
                echo "<td>" . $row["playerid"] . "</td>";
68
                echo "<td class='hidden-xs'>" . $row["coplevel"] . "</td>";
69
                if ($_SESSION['permissions']['edit']['player']) {
70
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
71
                    echo "<i class='fa fa-pencil'></i></a></td>";
72
                } else {
73
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
74
                    echo "<i class='fa fa-eye'></i></a></td>";
75
                }
76
                if ($_SESSION['permissions']['view']['steam'] && $steamPlayers > 0) {
77
                    echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
78
                    for ($player = 0; $player <= $steamPlayers; $player++) {
79
                        if ($bans[$player]->SteamId == $row['playerid']) {
80
                            if ($bans[$player]->VACBanned == true) {
81
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
82
                                echo "class='btn btn-danger btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>";
83
84
                            } else {
85
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
86
                                echo "class='btn btn-primary btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>"; }
87
                        }
88
                    }
89
                    echo '</td>';
90
                }
91
                echo "</tr>";
92
            }
93
            echo "</tbody></table>";
94
            include("views/templates/page.php");
95
            ?>
96
    </div>
97
    <?php
98
} else echo '<h3>' . errorMessage(36, $lang) . '</h3>';
99

views/life/admins.php 1 location

@@ 22-98 (lines=77) @@
19
}
20
21
$result_of_query = $db_link->query($sql);
22
if ($result_of_query->num_rows > 0) {
23
    while ($row = mysqli_fetch_assoc($result_of_query)) {
24
        $pids[] = $row['playerid'];
25
    }
26
    $pids = implode(',', $pids);
27
    if ($settings['steamAPI'] && $_SESSION['permissions']['view']['steam'] && !$settings['performance'] && $settings['vacTest']) {
28
        $api = "http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=" . $settings['steamAPI'] . "&steamids=" . $pids;
29
        $bans = get_object_vars(json_decode(file_get_contents($api)));
30
        $bans = $bans['players'];
31
        $steamPlayers = count($bans);
32
    } else {
33
        $steamPlayers = 0;
34
    }
35
36
    $result_of_query = $db_link->query($sql);
37
    ?>
38
    <h1 class="page-header">
39
        <?php echo $lang['admin']; ?>
40
        <small><?php echo $lang['overview']; ?></small>
41
    </h1>
42
    <div class="content-panel">
43
        <table class="table table-striped table-advance table-hover">
44
            <h4>
45
                <i class="fa fa-user"></i>
46
                <?php echo $lang['admin'];
47
                include("views/templates/search.php"); ?>
48
            </h4>
49
            <hr class="hidden-xs">
50
            <thead>
51
            <tr>
52
                <th><i class="fa fa-user"></i><?php echo $lang['name']; ?></th>
53
                <th><i class="fa fa-eye"></i><?php echo $lang['playerID']; ?></th>
54
                <th><i class="fa fa-user"></i><?php echo $lang['rank']; ?></th>
55
                <?php if ($_SESSION['permissions']['edit']['player']) {
56
                    echo '<th><i class="fa fa-pencil"></i> ' . $lang['edit'] . '</th>';
57
                }
58
                ?>
59
            </tr>
60
            </thead>
61
            <tbody>
62
            <?php
63
            while ($row = mysqli_fetch_assoc($result_of_query)) {
64
                $playersID = $row["playerid"];
65
                echo "<tr>";
66
                echo "<td>" . $row["name"] . "</td>";
67
                echo "<td>" . $row["playerid"] . "</td>";
68
                echo "<td class='hidden-xs'>" . $row["adminlevel"] . "</td>";
69
                if ($_SESSION['permissions']['edit']['player']) {
70
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
71
                    echo "<i class='fa fa-pencil'></i></a></td>";
72
                } else {
73
                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editPlayer/" . $row["uid"] . "'>";
74
                    echo "<i class='fa fa-eye'></i></a></td>";
75
                }
76
                if ($_SESSION['permissions']['view']['steam'] && $steamPlayers > 0) {
77
                    echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
78
                    for ($player = 0; $player <= $steamPlayers; $player++) {
79
                        if ($bans[$player]->SteamId == $row['playerid']) {
80
                            if ($bans[$player]->VACBanned == true) {
81
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
82
                                echo "class='btn btn-danger btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>";
83
84
                            } else {
85
                                echo "<td><a href='http://steamcommunity.com/profiles/" . $row["playerid"] . "' ";
86
                                echo "class='btn btn-primary btn-xs hidden-xs' target='_blank'><i class='fa fa-steam'></i></a>"; }
87
                        }
88
                    }
89
                    echo '</td>';
90
                }
91
                echo "</tr>";
92
            }
93
            echo "</tbody></table>";
94
            include("views/templates/page.php");
95
            ?>
96
    </div>
97
    <?php
98
} else echo '<h3>' . errorMessage(36, $lang) . '</h3>';
99