Completed
Pull Request — master (#71)
by Sam
11:59
created

editPlayer.php ➔ getPlayerSkin()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 3
nop 2
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
require_once(realpath($settings['url']) . "config/carNames.php");
3
require_once(realpath($settings['url']) . "config/images.php");
4
require_once(realpath($settings['url']) . "config/license.php");
5
require_once(realpath($settings['url']) . "config/crimes.php");
6
7
$db_link = serverConnect();
8
9
if (isset($_POST["editType"])) {
10
    if (formtoken::validateToken($_POST)) {
11
        switch ($_POST["editType"]) {
12 View Code Duplication
            case "civ_inv":
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
                $civ_gear_value = $_POST["civ_inv_value"];
14
                $update = "UPDATE `players` SET civ_gear = '$civ_gear_value' WHERE `uid` = '$uID';";
15
                $result_of_query = $db_link->query($update);
16
                logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['civ'] . ' ' . $lang['inventory'], 1);
17
                message($lang['edited'] . ' ' . $lang['civ'] . ' ' . $lang['inventory']);
18
                break;
19
20 View Code Duplication
            case "cop_inv":
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
                $cop_gear_value = $_POST["cop_inv_value"];
22
                $update = "UPDATE `players` SET cop_gear = '$cop_gear_value' WHERE `uid` = '$uID';";
23
                $result_of_query = $db_link->query($update);
24
                logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['cop'] . ' ' . $lang['inventory'], 1);
25
                message($lang['edited'] . ' ' . $lang['cop'] . ' ' . $lang['inventory']);
26
                break;
27
28 View Code Duplication
            case "med_inv":
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
                $med_gear_value = $_POST["med_inv_value"];
30
                $update = "UPDATE `players` SET med_gear = '$med_gear_value' WHERE `uid` = '$uID';";
31
                $result_of_query = $db_link->query($update);
32
                logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['medic'] . ' ' . $lang['inventory'], 1);
33
                message($lang['edited'] . ' ' . $lang['medic'] . ' ' . $lang['inventory']);
34
                break;
35
36
            case "player_edit":
37
                if ($_SESSION['user_level'] >= 4) {
38
                    $coplevel = clean(intval($_POST["player_coplvl"]), 'int');
39
                    $mediclevel = clean(intval($_POST["player_medlvl"]), 'int');
40
                    $donorlevel = clean(intval($_POST["player_donlvl"]), 'int');
41
                    $adminlevel = clean(intval($_POST["player_adminlvl"]), 'int');
42
                    $cash = clean(intval($_POST["player_cash"]), 'int');
43
                    $bankacc = clean(intval($_POST["player_bank"]), 'int');
44
                    $sql = "SELECT *, $playerIdColumn as playerid FROM `players` WHERE `uid` = '$uID';";
45
                    $result = $db_link->query($sql);
46
                    if ($result->num_rows > 0) {
47
                        $player = $result->fetch_object();
48
49 View Code Duplication
                        if ($coplevel != $player->coplevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['cop'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->coplevel . ") " . $lang['to'] . " (" . $coplevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50 View Code Duplication
                        if ($mediclevel != $player->mediclevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['medic'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->mediclevel . ") " . $lang['to'] . " (" . $mediclevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51 View Code Duplication
                        if ($donorlevel != $player->$settings['donorFormat']) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['donator'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->$settings['donorFormat'] . ") " . $lang['to'] . " (" . $donorlevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52 View Code Duplication
                        if ($adminlevel != $player->adminlevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['admin'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->adminlevel . ") " . $lang['to'] . " (" . $adminlevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53 View Code Duplication
                        if ($cash != $player->cash) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['cash'] . " " . $lang['from'] . " (" . $player->cash . ") " . $lang['to'] . " (" . $cash . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54 View Code Duplication
                        if ($bankacc != $player->bankacc) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['bank'] . " " . $lang['from'] . " (" . $player->bankacc . ") " . $lang['to'] . " (" . $bankacc . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
56
                        $update = "UPDATE `players` SET coplevel = '$coplevel', mediclevel = '$mediclevel', " . $settings['donorFormat'] . "= '$donorlevel', adminlevel = '$adminlevel', cash = '$cash', bankacc = '$bankacc' WHERE `uid` = '$uID';";
57
                        $result_of_query = $db_link->query($update);
58
                        message($lang['edited'] . ' ' . nameID($player->playerid, $db_link));
59
                    } else {
60
                        message("ERROR");
61
                    }
62
                } elseif ($_SESSION['user_level'] >= 3) {
63
                    $coplevel = intval($_POST["player_coplvl"]);
64
                    $mediclevel = intval($_POST["player_medlvl"]);
65
                    $cash = intval($_POST["player_cash"]);
66
                    $bankacc = intval($_POST["player_bank"]);
67
                    $donorlevel = isset($_POST['player_donlvl']) ? intval($_POST['player_donlvl']) : null;
68
                    $sql = "SELECT *, $playerIdColumn as playerid FROM `players` WHERE `uid` = '$uID';";
69
                    $result = $db_link->query($sql);
70
                    if ($result->num_rows > 0) {
71
                        $player = $result->fetch_object();
72
                        if (is_null($donorlevel)) {
73
                            $donorlevel = $player->$settings['donorFormat'];
74
                        }
75 View Code Duplication
                        if ($coplevel != $player->coplevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['cop'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->coplevel . ") " . $lang['to'] . " (" . $coplevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
76 View Code Duplication
                        if ($mediclevel != $player->mediclevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['medic'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->mediclevel . ") " . $lang['to'] . " (" . $mediclevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77 View Code Duplication
                        if ($donorlevel != $player->$settings['donorFormat']) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['donator'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->$settings['donorFormat'] . ") " . $lang['to'] . " (" . $donorlevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78 View Code Duplication
                        if ($cash != $player->cash) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['cash'] . " " . $lang['from'] . " (" . $player->cash . ") " . $lang['to'] . " (" . $cash . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79 View Code Duplication
                        if ($bankacc != $player->bankacc) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['bank'] . " " . $lang['from'] . " (" . $player->bankacc . ") " . $lang['to'] . " (" . $bankacc . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
81
                        $update = "UPDATE `players` SET coplevel = '$coplevel', mediclevel = '$mediclevel', " . $settings['donorFormat'] . "= '$donorlevel', cash = '$cash', bankacc = '$bankacc' WHERE `uid` = '$uID';";
82
                        $result_of_query = $db_link->query($update);
83
                        logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['levels'], 2);
84
                        message($lang['edited'] . ' ' . nameID($player->playerid, $db_link));
85
                    } else {
86
                        message("ERROR");
87
                    }
88
                } elseif ($_SESSION['user_level'] >= 2) {
89
                    $coplevel = intval($_POST["player_coplvl"]);
90
                    $mediclevel = intval($_POST["player_medlvl"]);
91 View Code Duplication
                    if ($coplevel != $player->coplevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['cop'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->coplevel . ") " . $lang['to'] . " (" . $coplevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
92 View Code Duplication
                    if ($mediclevel != $player->mediclevel) logAction($_SESSION['user_name'], $lang['edited'] . " " . nameID($player->playerid, $db_link) . "(" . $player->playerid . ") " . $lang['medic'] . " " . $lang['level'] . " " . $lang['from'] . " (" . $player->mediclevel . ") " . $lang['to'] . " (" . $mediclevel . ")", 2);
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
93
94
                    $update = "UPDATE `players` SET coplevel = '$coplevel', mediclevel = '$mediclevel' WHERE `uid` = '$uID';";
95
                    $result_of_query = $db_link->query($update);
96
                    logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['levels'], 2);
97
                    message($lang['edited'] . ' ' . nameID($player->playerid, $db_link));
98
                }
99
                break;
100
            case "add_note":
101
                $note_text = $_POST["note_text"];
102
                $update = "INSERT INTO `notes` (`uid`, `staff_name`, `note_text`, `note_updated`) VALUES ('$uID', '" . $_SESSION['user_name'] . "', '$note_text', CURRENT_TIMESTAMP);";
103
                $result_of_query = $db_link->query($update);
104
                logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($player->playerid, $db_link) . '(' . $player->playerid . ') ' . $lang['notes'], 1);
105
                message($lang['edited'] . ' ' . $lang['notes']);
106
                break;
107
        }
108
    } else {
109
        message($lang['expired']);
110
    }
111
}
112
113
$sql = "SELECT *, $playerIdColumn as playerid FROM `players` WHERE `uid` = '$uID'";
114
$result = $db_link->query($sql);
115
if ($result->num_rows > 0) {
116
    $player = $result->fetch_object();
117
118
    $temp = "";
119
    $pGID = $player->playerid;
120 View Code Duplication
    for ($i = 0; $i < 8; $i++) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
121
        $temp .= chr($pGID & 0xFF);
122
        $pGID >>= 8;
123
    }
124
    $pGID = md5('BE' . $temp);
125
    ?>
126
  <div class="col-md-3" style="float:left;  padding-top:20px;">
127
    <div class="panel panel-default">
128
      <div class="panel-heading">
129
        <h2 class="panel-title"><i class="fa fa-child fa-fw"></i><?php echo $player->name; ?></h2>
130
      </div>
131
132
      <div class="panel-body">
133
          <?php
134
          $alias = str_replace('"[`', "", $player->aliases);
135
          $alias = str_replace('`]"', "", $alias);
136
137
          echo '<center><img alt="' . $alias . '" src="' . $settings['url'] . skinImage($player->civ_gear) . '">';
138
          echo "<h5 style='word-wrap: break-word; '> <a href='http://playerindex.de/check.aspx?id=" . $pGID . "' class='btn btn-xs btn-warning' target='_blank' role='button'>Check Playerindex Ban </a></h5>";
139
          if ($_SESSION['permissions']['view']['steam'] && $settings['vacTest']) {
140
              echo '<div id="vacBan"></div>';
141
          }
142
          echo "<h4>" . $lang['aliases'] . ": " . $alias . "</h4>";
143
          echo "<h4>" . $lang['uid'] . ": " . $player->uid . "</h4>";
144
          echo "<h4>" . $lang['playerID'] . ": " . $player->playerid . "</h4>";
145
          echo "<h4 style='word-wrap: break-word;'>" . $lang['GUID'] . ": " . $pGID . "</h4>";
146
          ?>
147
        <i class="fa fa-2x fa-money"></i>
148
        <h4><?php echo $lang['cash'] . ": " . $player->cash; ?> </h4>
149
        <i class="fa fa-2x fa-bank"></i>
150
        <h4> <?php echo $lang['bank'] . ": " . $player->bankacc; ?> </h4>
151
          <?php
152 View Code Duplication
          if ($player->arrested == 0) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
              echo "<h4><button type='button' id='arrested' class='arrest btn btn-xs btn-success'>" . $lang["not"] . " " . $lang["arrested"] . "</button></h4>";
154
          } else {
155
              echo "<h4><button type='button' id='arrested' class='arrest btn btn-xs btn-theme01'>" . $lang["arrested"] . "</button></h4>";
156
          }
157
158 View Code Duplication
          if ($player->blacklist == 0) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
159
              echo "<h4><button type='button' id='blacklist' class='arrest btn btn-xs btn-success'>" . $lang["not"] . " " . $lang["blacklisted"] . "</button></h4>";
160
          } else {
161
              echo "<h4><button type='button' id='blacklist' class='arrest btn btn-xs btn-theme01'>" . $lang["blacklisted"] . "</button></h4>";
162
          }
163
164
          if ($settings['wanted'] && ($_SESSION['permissions']['view']['wanted'] || $player->playerid == $_SESSION['playerid'])) {
165
              $sql = "SELECT `active` FROM `wanted` WHERE `wantedID` = '" . $player->playerid . "'";
166
              $result_of_query = $db_link->query($sql);
167
              if ($result_of_query->num_rows > 0) {
168
                  while ($row = mysqli_fetch_assoc($result_of_query)) {
169
                      if ($row["active"] == 1) {
170
                          echo "<h4><a href='" . $settings['url'] . "editwanted/" . $player->playerid . "' class='label label-danger'>" . $lang["wanted"] . "</span></h4>";
171
                      } else {
172
                          echo "<h4><span class='label label-success'>" . $lang["not"] . " " . $lang["wanted"] . "</span></h4>";
173
                      }
174
                  }
175
              } else {
176
                  echo "<h4><span class='label label-success'>" . $lang["not"] . " " . $lang["wanted"] . "</span></h4>";
177
              }
178
          }
179
180
          if ($_SESSION['permissions']['edit']['player']) {
181
              echo '<a data-toggle="modal" href="#edit_player" class="btn btn-primary btn-xs" style="float: right;">';
182
              echo '<i class="fa fa-pencil"></i>';
183
              echo '</a>';
184
          }
185
          echo "</center>";
186
          ?>
187
      </div>
188
    </div>
189
  </div>
190
191
  <!-- Right Container -->
192
  <div class="col-md-9" style="float:right; padding-top:20px;">
193
    <div class="row mtbox">
194
      <div class="col-md-2 col-sm-2 col-md-offset-1 box0">
195
        <div class="box1">
196
          <span class="fa fa-3x fa-taxi"></span>
197
          <h3> <?php echo $lang['police'] . ": " . $player->coplevel; ?> </h3>
198
        </div>
199
      </div>
200
      <div class="col-md-2 col-sm-2 box0">
201
        <div class="box1">
202
          <span class="fa fa-3x fa-ambulance"></span>
203
          <h3> <?php echo $lang['medic'] . ": " . $player->mediclevel; ?> </h3>
204
        </div>
205
      </div>
206
      <div class="col-md-2 col-sm-2 box0">
207
        <div class="box1">
208
          <span class="fa fa-3x fa-usd"></span>
209
          <h3> <?php echo $lang['donator'] . ": " . $player->$settings['donorFormat']; ?> </h3>
210
        </div>
211
      </div>
212
      <div class="col-md-2 col-sm-2 box0">
213
        <div class="box1">
214
          <span class="fa fa-3x fa-group"></span>
215
          <h3> <?php echo $lang['admin'] . ": " . $player->adminlevel; ?> </h3>
216
        </div>
217
      </div>
218
        <?php
219 View Code Duplication
        if ($_SESSION['permissions']['view']['steam'] || $player->playerid == $_SESSION['playerid']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
220
            echo '<div class="col-md-2 col-sm-2 box0">';
221
            echo '<a href="http://steamcommunity.com/profiles/' . $player->playerid . '"';
222
            echo 'target="_blank">';
223
            echo '<div class="box1">';
224
            echo '<span class="fa fa-3x fa-steam"></span>';
225
            echo '<h3>Steam</h3>';
226
            echo '</div>';
227
            echo '</div></a>';
228
        } ?>
229
    </div>
230
231
    <div class="panel panel-default" style="float:left; width:100%; margin:0 auto;">
232
      <ul id="myTab" class="nav nav-tabs">
233
        <li class="dropdown active">
234
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $lang['licenses']; ?> <b
235
                class="caret"></b></a>
236
          <ul class="dropdown-menu">
237
            <li><a href="#civ_lic" data-toggle="tab"><?php echo $lang['civil']; ?></a></li>
238
            <li><a href="#medic_lic" data-toggle="tab"><?php echo $lang['medic']; ?></a></li>
239
            <li><a href="#police_lic" data-toggle="tab"><?php echo $lang['police']; ?></a></li>
240
          </ul>
241
        </li>
242
        <li class="dropdown">
243
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $lang['inventory']; ?> <b
244
                class="caret"></b></a>
245
          <ul class="dropdown-menu">
246
            <li><a href="#civ_inv" data-toggle="tab"><?php echo $lang['civil']; ?></a></li>
247
            <li><a href="#medic_inv" data-toggle="tab"><?php echo $lang['medic']; ?></a></li>
248
            <li><a href="#police_inv" data-toggle="tab"><?php echo $lang['police']; ?></a></li>
249
          </ul>
250
        </li>
251
          <?php
252
          if ($_SESSION['permissions']['edit']['houses']) {
253
              echo '<li><a href="#house" data-toggle="tab">' . $lang['houses'] . '</a></li>';
254
          }
255 View Code Duplication
          if ($_SESSION['permissions']['edit']['vehicles']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
256
              echo '<li><a href="#veh" data-toggle="tab">' . $lang['vehicles'] . '</a></li>';
257
          }
258
          if ($_SESSION['permissions']['edit']['notes']) {
259
              echo '<li><a href="#notes" data-toggle="tab"> Notes</a></li>';
260
          }
261
          if ($_SESSION['permissions']['view']['wanted'] && $settings['wanted']) {
262
              echo '<li><a href="#wanted" data-toggle="tab">' . $lang['wanted'] . '</a></li>';
263
          }
264
          ?>
265
      </ul>
266
      <div class="panel-body">
267
        <div id="myTabContent" class="tab-content">
268
            <?php if ($_SESSION['permissions']['view']['licences'] || $player->playerid == $_SESSION['playerid']) { ?>
269
              <div class="tab-pane fade in active well" id="civ_lic">
270
                  <?php
271 View Code Duplication
                  if ($player->civ_licenses !== '"[]"' && $player->civ_licenses !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
272
                      echo '<h4 style="centred">' . $lang['civil'] . ' ' . $lang['licenses'] . '</h4>';
273
                      $return = stripArray($player->civ_licenses, 0);
274
                      foreach ($return as $value) {
0 ignored issues
show
Bug introduced by
The expression $return of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
275
                          if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
276
                              $name = before(',', $value);
277
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
278
                          } else {
279
                              $name = before(',', $value);
280
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
281
                          }
282
                      }
283
                  } else {
284
                      echo '<h4>' . errorMessage(371, $lang) . '</h4>';
285
                  } ?>
286
              </div>
287
              <div class="tab-pane well fade" id="medic_lic">
288
                  <?php
289 View Code Duplication
                  if ($player->med_licenses !== '"[]"' && $player->med_licenses !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
290
                      echo '<h4 style="centred">' . $lang['medic'] . ' ' . $lang['licenses'] . '</h4>';
291
                      $return = stripArray($player->med_licenses, 0);
292
                      foreach ($return as $value) {
0 ignored issues
show
Bug introduced by
The expression $return of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
293
                          if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
294
                              $name = before(',', $value);
295
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
296
                          } else {
297
                              $name = before(',', $value);
298
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
299
                          }
300
                      }
301
                  } else {
302
                      echo '<h4>' . errorMessage(372, $lang) . '</h4>';
303
                  } ?>
304
              </div>
305
              <div class="tab-pane well fade" id="police_lic">
306
                  <?php
307 View Code Duplication
                  if ($player->cop_licenses !== '"[]"' && $player->cop_licenses !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
308
                      $return = stripArray($player->cop_licenses, 0);
309
                      echo '<h4 style="centred">' . $lang['cop'] . ' ' . $lang['licenses'] . '</h4>';
310
                      foreach ($return as $value) {
0 ignored issues
show
Bug introduced by
The expression $return of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
311
                          if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
312
                              $name = before(',', $value);
313
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
314
                          } else {
315
                              $name = before(',', $value);
316
                              echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
317
                          }
318
                      }
319
                  } else {
320
                      echo '<h4>' . errorMessage(373, $lang) . '</h4>';
321
                  }
322
                  ?>
323
              </div>
324
            <?php }
325
            if ($_SESSION['permissions']['edit']['inventory']) { ?>
326
              <div class="tab-pane fade well" id="civ_inv">
327
                  <?php
328 View Code Duplication
                  if ($player->civ_gear !== '"[]"' && $player->civ_gear !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
329
                      echo '<h4 style="centred">' . $lang['civil'] . ' ' . $lang['gear'] . '</h4>';
330
                      echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='civ_gear'>" . $player->civ_gear . "</textarea><br>";
331
332
                      if ($_SESSION['permissions']['edit']['inventory']) {
333
                          echo '<a data-toggle="modal" href="#edit_civ_inv" class="btn btn-primary btn-xs" style="float: right;">';
334
                          echo '<i class="fa fa-pencil"></i></a>';
335
                      }
336
                  } else {
337
                      echo '<h4>' . errorMessage(381, $lang) . '</h4>';
338
                  } ?>
339
              </div>
340
              <div class="tab-pane fade well" id="police_inv">
341
                  <?php
342 View Code Duplication
                  if ($player->cop_gear !== '"[]"' && $player->cop_gear !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
343
                      echo '<h4 style="centred">' . $lang['cop'] . ' ' . $lang['gear'] . '</h4>';
344
                      echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='cop_gear' name='cop_gear'>" . $player->cop_gear . "</textarea><br>";
345
                      if ($_SESSION['permissions']['edit']['inventory']) {
346
                          echo '<a data-toggle="modal" href="#edit_cop_inv" class="btn btn-primary btn-xs" style="float: right;">';
347
                          echo '<i class="fa fa-pencil"></i></a>';
348
                      }
349
                  } else {
350
                      echo '<h4>' . errorMessage(383, $lang) . '</h4>';
351
                  } ?>
352
              </div>
353
              <div class="tab-pane fade well" id="medic_inv">
354
                  <?php
355 View Code Duplication
                  if ($player->med_gear !== '"[]"' && $player->med_gear !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
356
                      echo '<h4 style="centred">' . $lang['medic'] . ' ' . $lang['gear'] . '</h4>';
357
                      echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='med_gear' name='med_gear'>" . $player->med_gear . "</textarea><br>";
358
                      if ($_SESSION['permissions']['edit']['inventory']) {
359
                          echo '<a data-toggle="modal" href="#edit_med_inv" class="btn btn-primary btn-xs" style="float: right;">';
360
                          echo '<i class="fa fa-pencil"></i></a>';
361
                      }
362
                  } else {
363
                      echo '<h4>' . errorMessage(382, $lang) . '</h4>';
364
                  } ?>
365
              </div>
366
            <?php }
367
            if ($_SESSION['permissions']['view']['houses'] || $player->playerid == $_SESSION['playerid']) { ?>
368
              <div class="tab-pane fade" id="house">
369
                <div class="table-responsive">
370
                    <?php
371
                    $sql = "SELECT `pos`,`id` FROM `houses` WHERE `pid` = '" . $player->playerid . "' ORDER BY `id` DESC LIMIT 8";
372
                    $result_of_query = $db_link->query($sql);
373
                    if ($result_of_query->num_rows > 0) {
374
                        ?>
375
                      <table class="table table-bordered table-hover table-striped" style="margin-bottom: 0px;">
376
                        <thead>
377
                        <tr>
378
                          <th><?php echo $lang['position']; ?></th>
379
                          <th><?php echo $lang['edit']; ?></th>
380
                        </tr>
381
                        </thead>
382
                        <tbody>
383
                        <?php
384 View Code Duplication
                        while ($row = mysqli_fetch_assoc($result_of_query)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
385
                            echo "<tr>";
386
                            echo "<td>" . substr($row["pos"], 1, -1) . "</td>";
387
                            echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editHouse/" . $row["id"] . "'>";
388
                            echo "<i class='fa fa-pencil'></i></a></td>";
389
                            echo "</tr>";
390
                        } ?>
391
                        </tbody>
392
                      </table>
393
                        <?php echo '<a style="float: right;" href="' . $settings['url'] . 'houses/' . $player->playerid . '"><h4>' . $lang['more'] . ' <i class="fa fa-arrow-circle-right"></i></h4></a>';
394
                    } else echo '<h4>' . errorMessage(31, $lang) . '</h4>'; ?>
395
                </div>
396
              </div>
397
            <?php }
398
            if ($_SESSION['permissions']['view']['vehicles'] || $player->playerid == $_SESSION['playerid']) { ?>
399
              <div class="tab-pane fade" id="veh">
400
                <div class="table-responsive">
401
                    <?php
402
                    $sql = "SELECT `classname`,`type`,`id`,`plate` FROM `vehicles` WHERE `pid` = '" . $player->playerid . "' ORDER BY `id` DESC LIMIT 8";
403
                    $result_of_query = $db_link->query($sql);
404
                    if ($result_of_query->num_rows > 0) {
405
                        $veh = $result_of_query->fetch_object();
406
                        echo '<table class="table table-bordered table-hover table-striped" style="margin-bottom: 0px;">';
407
                        echo '<thead><tr>';
408
                        echo '<th>' . $lang['class'] . '</th>';
409
                        echo '<th class="hidden-xs">' . $lang['type'] . '</th>';
410
                        echo '<th class="hidden-xs">' . $lang['plate'] . '</th>';
411 View Code Duplication
                        if ($_SESSION['permissions']['edit']['vehicles']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
412
                            echo "<th>" . $lang['edit'] . "</th>";
413
                        }
414
                        echo '</tr></thead><tbody';
415
                        echo '<tr>';
416
                        echo '<td>' . carName($veh->classname) . '</td>';
417
                        echo '<td class="hidden-xs">' . carType($veh->type, $lang) . '</td>';
418
                        echo '<td class="hidden-xs">' . $veh->plate . '</td>';
419
420
                        if ($_SESSION['permissions']['edit']['vehicles']) {
421
                            echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editVeh/" . $veh->id . "'>";
422
                            echo "<i class='fa fa-pencil'></i></a></td>";
423
                        }
424
425
                        while ($row = mysqli_fetch_assoc($result_of_query)) {
426
                            echo "<tr>";
427
                            echo "<td>" . carName($row["classname"]) . "</td>";
428
                            echo "<td class='hidden-xs'> " . carType($row["type"], $lang) . "</td>";
429
                            echo "<td class='hidden-xs'> " . $row["plate"] . "</td>";
430
                            if ($_SESSION['permissions']['edit']['vehicles']) {
431
                                echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editVeh/" . $row["id"] . "'>";
432
                                echo "<i class='fa fa-pencil'></i></a></td>";
433
                            }
434
                            echo "</tr>";
435
                        }
436
437
                        echo '</tr></tbody></table>';
438
                        echo '<a style="float: right; padding-right:15px;" href="' . $settings['url'] . 'vehicles/' . $player->playerid . '"><h4>' . $lang['more'] . ' <i class="fa fa-arrow-circle-right"></i></h4></a>';
439
440
                    } else echo '<h4>' . errorMessage(32, $lang) . '</h4>';
441
                    ?>
442
                </div>
443
              </div>
444
            <?php }
445
            if ($_SESSION['permissions']['view']['notes']) { ?>
446
              <div class="tab-pane fade" id="notes">
447
                <div class="table-responsive">
448
                    <?php
449
                    $sql = 'SELECT * FROM `notes` WHERE `uid` = "' . $uID . '" ORDER BY `note_updated` DESC LIMIT 10';
450
                    $result_of_query = $db_link->query($sql);
451
                    if ($result_of_query->num_rows > 0) {
452
                        ?>
453
                      <table class="table table-bordered table-hover table-striped">
454
                        <thead>
455
                        <tr>
456
                          <th><?php echo $lang['owner']; ?></th>
457
                          <th><?php echo $lang['note']; ?></th>
458
                        </tr>
459
                        </thead>
460
                        <tbody>
461
                        <?php
462
                        while ($row = mysqli_fetch_assoc($result_of_query)) {
463
                            echo "<tr>";
464
                            echo "<td>" . $row["staff_name"] . "</td>";
465
                            echo "<td>" . $row["note_text"] . "</td>";
466
                            echo "</tr>";
467
                        };
468
                        ?>
469
                        </tbody>
470
                      </table>
471
                        <?php
472
                        if ($_SESSION['permissions']['edit']['notes']) {
473
                            echo '<a data-toggle="modal" href="#add_note" class="btn btn-primary btn-xs" style="float: right; margin-right:5px; margin-bottom:5px;">
474
                                                    <i class="fa fa-file-o"></i></a>';
475
                        }
476
                    } else {
477
                        echo '<h1>' . $lang['noNotes'] . '</h1>';
478
                        if ($_SESSION['permissions']['edit']['notes']) {
479
                            echo '<a data-toggle="modal" href="#add_note" class="btn btn-primary btn-xs" style="float: right; margin-right:5px; margin-bottom:5px;">
480
                                                    <i class="fa fa-file-o"></i></a>';
481
                        }
482
                    };
483
                    ?>
484
                </div>
485
              </div>
486
            <?php }
487
            if ($_SESSION['permissions']['view']['wanted'] && $settings['wanted']) { ?>
488
              <div class="tab-pane fade well" id="wanted">
489
                <div class="table-responsive">
490
                    <?php
491
                    $sql = "SELECT `wantedCrimes` FROM `wanted` WHERE `wantedID`='" . $player->playerid . "'";
492
                    $result_of_query = $db_link->query($sql);
493
                    if ($result_of_query->num_rows > 0) {
494
                        echo "<h3>" . $lang['crimes'] . "</h3>";
495
                        while ($row = mysqli_fetch_assoc($result_of_query)) {
496
                            if ($row['wantedCrimes'] !== "[]") {
497
                                $return = stripArray($row['wantedCrimes'], 3);
498
                                foreach ($return as $value) {
0 ignored issues
show
Bug introduced by
The expression $return of type array|null is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
499
                                    echo "<button type='button' id=" . $value . " class='wanted btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . crimeName($value) . "</button> ";
500
                                }
501
                            } else {
502
                                echo "<h3>" . errorMessage(34, $lang) . "</h3>";
503
504
                            }
505
                        }
506
                    } else echo "<h3>" . errorMessage(34, $lang) . "</h3>";
507
                    ?>
508
509
                </div>
510
              </div>
511
            <?php } ?>
512
513
        </div>
514
      </div>
515
    </div>
516
  </div>
517
518
  <div class="modal fade" id="edit_civ_inv" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
519
       aria-hidden="true">
520
    <div class="modal-dialog">
521
      <div class="modal-content">
522
        <div class="modal-header">
523
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
524
          <h4 class="modal-title"><i class="fa fa-pencil"></i>
525
              <?php echo $lang['edit'] . " " . $lang['civ'] . " " . $lang['inventory']; ?>
526
          </h4>
527
        </div>
528 View Code Duplication
          <?php if ($_SESSION['permissions']['edit']['inventory']) { ?>
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
529
            <form method="post" action="<?php echo $settings['url'] . 'editPlayer/' . $uID; ?>"
530
                <?php echo formtoken::getField() ?>
531
                  role="form">
532
              <div class="modal-body">
533
                <div class="form-group">
534
                  <input type="hidden" name="editType" value="civ_inv"/>
535
536
                  <div class="row">
537
                                <textarea class="form-control" rows="10"
538
                                          name="civ_inv_value"><?php echo $player->civ_gear; ?></textarea>
539
                  </div>
540
                </div>
541
              </div>
542
              <div class="modal-footer">
543
                <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button>
544
                <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button>
545
              </div>
546
            </form>
547
          <?php } else errorMessage(5, $lang); ?>
0 ignored issues
show
Unused Code introduced by
The call to the function errorMessage() seems unnecessary as the function has no side-effects.
Loading history...
548
      </div>
549
    </div>
550
  </div>
551
552
  <div class="modal fade" id="edit_med_inv" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
553
       aria-hidden="true">
554
    <div class="modal-dialog">
555
      <div class="modal-content">
556
        <div class="modal-header">
557
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
558
          <h4 class="modal-title"><i class="fa fa-pencil"></i>
559
              <?php echo $lang['edit'] . " " . $lang['medic'] . " " . $lang['inventory']; ?>
560
          </h4>
561
        </div>
562 View Code Duplication
          <?php if ($_SESSION['permissions']['edit']['inventory']) { ?>
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
563
            <form method="post" action="<?php echo $settings['url'] . 'editPlayer/' . $uID; ?>"
564
                <?php echo formtoken::getField() ?>
565
                  role="form">
566
              <div class="modal-body">
567
                <div class="form-group">
568
                  <input type="hidden" name="editType" value="med_inv"/>
569
570
                  <div class="row">
571
                                <textarea class="form-control" rows="10"
572
                                          name="med_inv_value"><?php echo $player->med_gear; ?></textarea>
573
                  </div>
574
                </div>
575
              </div>
576
              <div class="modal-footer">
577
                <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button>
578
                <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button>
579
              </div>
580
            </form>
581
          <?php } else errorMessage(5, $lang); ?>
0 ignored issues
show
Unused Code introduced by
The call to the function errorMessage() seems unnecessary as the function has no side-effects.
Loading history...
582
      </div>
583
    </div>
584
  </div>
585
586
  <div class="modal fade" id="edit_cop_inv" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
587
       aria-hidden="true">
588
    <div class="modal-dialog">
589
      <div class="modal-content">
590
        <div class="modal-header">
591
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
592
          <h4 class="modal-title"><i class="fa fa-pencil"></i>
593
              <?php echo $lang['edit'] . " " . $lang['police'] . " " . $lang['inventory']; ?>
594
          </h4>
595
        </div>
596 View Code Duplication
          <?php if ($_SESSION['permissions']['edit']['inventory']) { ?>
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
597
            <form method="post" action="<?php echo $settings['url'] . 'editPlayer/' . $uID; ?>"
598
                  role="form">
599
                <?php echo formtoken::getField() ?>
600
              <div class="modal-body">
601
                <div class="form-group">
602
                  <input type="hidden" name="editType" value="cop_inv"/>
603
604
                  <div class="row">
605
                                <textarea class="form-control" rows="10"
606
                                          name="cop_inv_value"><?php echo $player->cop_gear; ?></textarea>
607
                  </div>
608
                </div>
609
              </div>
610
              <div class="modal-footer">
611
                <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button>
612
                <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button>
613
              </div>
614
            </form>
615
          <?php } else errorMessage(5, $lang); ?>
0 ignored issues
show
Unused Code introduced by
The call to the function errorMessage() seems unnecessary as the function has no side-effects.
Loading history...
616
      </div>
617
    </div>
618
  </div>
619
620
  <div class="modal fade" id="add_note" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
621
    <div class="modal-dialog">
622
      <div class="modal-content">
623
        <div class="modal-header">
624
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
625
          <h4 class="modal-title"><i class="fa fa-pencil"></i>
626
              <?php echo $lang['new'] . " " . $lang['note']; ?>
627
          </h4>
628
        </div>
629 View Code Duplication
          <?php if ($_SESSION['permissions']['edit']['notes']) { ?>
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
630
            <form method="post" action="<?php echo $settings['url'] . 'editPlayer/' . $uID; ?>" role="form">
631
              <div class="modal-body">
632
                  <?php echo formtoken::getField() ?>
633
                <div class="form-group">
634
                  <input type="hidden" name="editType" value="add_note"/>
635
636
                  <div class="row">
637
                    <div class="form-group">
638
                      <textarea class="form-control" rows="8" name="note_text"></textarea>
639
                    </div>
640
                  </div>
641
                </div>
642
              </div>
643
              <div class="modal-footer">
644
                <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button>
645
                <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button>
646
              </div>
647
            </form>
648
          <?php } else errorMessage(5, $lang); ?>
0 ignored issues
show
Unused Code introduced by
The call to the function errorMessage() seems unnecessary as the function has no side-effects.
Loading history...
649
      </div>
650
    </div>
651
  </div>
652
653
  <div class="modal fade" id="edit_player" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
654
       aria-hidden="true">
655
    <div class="modal-dialog">
656
      <div class="modal-content">
657
        <div class="modal-header">
658
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
659
          <h4 class="modal-title"><i class="fa fa-pencil"></i>
660
              <?php echo $lang['edit'] . " " . $lang['player']; ?>
661
          </h4>
662
        </div>
663
          <?php if ($_SESSION['permissions']['edit']['player']) { ?>
664
            <form method="post" action="<?php echo $settings['url'] . 'editPlayer/' . $uID; ?>" role="form">
665
              <div class="modal-body">
666
                  <?php echo formtoken::getField() ?>
667
                <div class="form-group">
668
                  <input type="hidden" name="editType" value="player_edit"/>
669
670
                  <div class="row">
671
                    <center>
672
                        <?php if ($_SESSION['permissions']['edit']['bank']) {
673
                            echo "<h4>" . $lang['cash'] . ":    <input id='player_cash' name='player_cash' type='number' value='" . $player->cash . "'>";
674
                            echo "<h4>" . $lang['bank'] . ":    <input id='player_bank' name='player_bank' type='number' value='" . $player->bankacc . "'>";
675
                        } ?>
676
                        <?php if ($_SESSION['permissions']['edit']['ranks']) {
677
                            echo "<h4>" . $lang['cop'] . ": ";
678
                            echo "<select id='player_coplvl' name='player_coplvl'>";
679 View Code Duplication
                            for ($lvl = 0;
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
680
                                 $lvl <= $settings['maxLevels']['cop'];
681
                                 $lvl++) {
682
                                echo '<option value="' . $lvl . '"' . select($lvl, $player->coplevel) . '>' . $lvl . '</option>';
683
                            }
684
                            echo "</select>";
685
                            echo "<h4>" . $lang['medic'] . ": ";
686
                            echo "<select id='player_medlvl' name='player_medlvl'>";
687 View Code Duplication
                            for ($lvl = 0;
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
688
                                 $lvl <= $settings['maxLevels']['medic'];
689
                                 $lvl++) {
690
                                echo '<option value="' . $lvl . '"' . select($lvl, $player->mediclevel) . '>' . $lvl . '</option>';
691
                            }
692
                            echo "</select>";
693
694
                            if ($_SESSION['permissions']['edit']['ignLVL']) {
695
                                echo "<h4>" . $lang['admin'] . ": ";
696
                                echo "<select id='player_adminlvl' name='player_adminlvl'>";
697 View Code Duplication
                                for ($lvl = 0;
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
698
                                     $lvl <= $settings['maxLevels']['admin'];
699
                                     $lvl++) {
700
                                    echo '<option value="' . $lvl . '"' . select($lvl, $player->adminlevel) . '>' . $lvl . '</option>';
701
                                }
702
                                echo "</select>";
703
                                echo "<h4>" . $lang['donator'] . ": ";
704
                                echo "<select id='player_donlvl' name='player_donlvl'>";
705
                                for ($lvl = 0;
706
                                     $lvl <= $settings['maxLevels']['donator'];
707
                                     $lvl++) {
708
                                    echo '<option value="' . $lvl . '"' . select($lvl, $player->$settings['donorFormat']) . '>' . $lvl . '</option>';
709
                                }
710
                                echo "</select>";
711
                            }
712
                        } ?>
713
                    </center>
714
                  </div>
715
                </div>
716
              </div>
717
              <div class="modal-footer">
718
                <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button>
719
                <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button>
720
              </div>
721
            </form>
722
          <?php } else "<h1>" . errorMessage(5, $lang) . "/<h1>"; ?>
723
      </div>
724
    </div>
725
  </div>
726
727
  <script>
728
    $(document).ready(function () {
729 View Code Duplication
        <?php if ($_SESSION['permissions']['edit']['licences']) { ?>
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
730
      $(".license").click(function () {
731
        $(this).toggleClass('btn-success btn-theme01');
732
        $.post("<?php echo $settings['url'] ?>hooks/license.php", {id: this.id, player: "<?php echo $uID ?>"});
733
      });
734
        <?php } if ($_SESSION['permissions']['edit']['player']) { ?>
735
      $(".arrest").click(function () {
736
        $(this).toggleClass('btn-success btn-theme01');
737
        $.post("<?php echo $settings['url'] ?>hooks/arrest.php", {id: this.id, player: "<?php echo $uID ?>"});
738
      });
739
        <?php } if ($_SESSION['permissions']['edit']['wanted']) { ?>
740
      $(".wanted").click(function () {
741
        $(this).toggleClass('btn-success btn-theme01');
742
        $.post("<?php echo $settings['url'] ?>hooks/wanted.php", {id: this.id, player: "<?php echo $uID ?>"});
743
      });
744
        <?php } if (($_SESSION['permissions']['view']['steam'] || $player->playerid == $_SESSION['playerid']) && $settings['vacTest']) { ?>
745
      $.ajax({
746
        url: "https://steamrep.com/api/beta3/reputation/<?php echo $player->playerid ?>?json=1&extended=1",
747
        dataType: 'json',
748
        success: function (data) {
749
          if (data['steamrep']['vacban'] == "1") {
750
            $('#vacBan').html('<h4><span class="label label-danger" style="margin-left:3px; line-height:2;">VAC BANNED</span></h4>');
751
          }
752
        }
753
      });
754
        <?php } if ($_SESSION['permissions']['view']['steam'] && $settings['vacTest']) { ?>
755
      $.ajax({
756
        url: "http://bans.itsyuka.tk/api/bans/player/id/6e96f18ddaaa2dadcc32482b2d6a0593/format/json/key/<?php echo $settings['communityBansAPI'] ?>",
757
        dataType: 'json',
758
        success: function (data) {
759
          if (data['level'] == '2') {
760
            $('#communityBanned').html('<h4><span class="label label-danger" style="margin-left:3px; line-height:2;">Community Banned</span></h4>');
761
          }
762
        }
763
      });
764
        <?php }?>
765
    });
766
  </script>
767
768
<?php } else echo "<h1>" . errorMessage(36, $lang) . "</h1>";