Completed
Pull Request — master (#82)
by
unknown
02:28
created
classes/rcon.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @throws \Exception if the connection is closed
198 198
      * @throws \Exception if sending the command failed
199 199
      *
200
-     * @return bool Whether sending the command was successful or not
200
+     * @return boolean|null Whether sending the command was successful or not
201 201
      */
202 202
     protected function send($command)
203 203
     {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     /**
227 227
      * Generates the password's CRC32 data
228 228
      *
229
-     * @return string
229
+     * @return string[]
230 230
      */
231 231
     private function getAuthCRC()
232 232
     {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      *
240 240
      * @param string $command The message which will be prepared for being sent to the server
241 241
      *
242
-     * @return string Message which can be sent to the server
242
+     * @return string[] Message which can be sent to the server
243 243
      */
244 244
     private function getMsgCRC($command)
245 245
     {
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      * @author nerdalertdk (https://github.com/nerdalertdk)
614 614
      * @link https://github.com/Nizarii/arma-rcon-class-php/issues/4 The related GitHub issue
615 615
      *
616
-     * @param $str string
616
+     * @param string $str string
617 617
      *
618 618
      * @return string
619 619
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             throw new \Exception('Failed to send login!');
165 165
         }
166 166
         $result = fread($this->socket, 16);
167
-        if (@ord($result[strlen($result)-1]) == 0) {
167
+        if (@ord($result[strlen($result) - 1]) == 0) {
168 168
             throw new \Exception('Login failed, wrong password or wrong port!');
169 169
         }
170 170
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     private function getAuthCRC()
232 232
     {
233 233
         $authCRC = sprintf('%x', crc32(chr(255).chr(00).trim($this->rconPassword)));
234
-        $authCRC = array(substr($authCRC,-2,2), substr($authCRC,-4,2), substr($authCRC,-6,2), substr($authCRC,0,2));
234
+        $authCRC = array(substr($authCRC, -2, 2), substr($authCRC, -4, 2), substr($authCRC, -6, 2), substr($authCRC, 0, 2));
235 235
         return $authCRC;
236 236
     }
237 237
     /**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     private function getMsgCRC($command)
245 245
     {
246 246
         $msgCRC = sprintf('%x', crc32(chr(255).chr(01).chr(hexdec(sprintf('%01b', 0))).$command));
247
-        $msgCRC = array(substr($msgCRC,-2,2),substr($msgCRC,-4,2),substr($msgCRC,-6,2),substr($msgCRC,0,2));
247
+        $msgCRC = array(substr($msgCRC, -2, 2), substr($msgCRC, -4, 2), substr($msgCRC, -6, 2), substr($msgCRC, 0, 2));
248 248
         return $msgCRC;
249 249
     }
250 250
     /**
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
         // Create return array
600 600
         $result = array();
601 601
         // Loop true the main arrays, each holding a value
602
-        foreach($str as $key => $value) {
602
+        foreach ($str as $key => $value) {
603 603
             // Combines each main value into new array
604
-            foreach($value as $keyLine => $line) {
604
+            foreach ($value as $keyLine => $line) {
605 605
                 $result[$keyLine][$key] = trim($line);
606 606
             }
607 607
         }
Please login to merge, or discard this patch.
hooks/rcon_ban.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
     $reason = clean((isset($_POST['REASON'])) ? $_POST['REASON'] : 0, "int");
12 12
 
13 13
 
14
-    $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
14
+    $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = ".$sid.";";
15 15
     $result_of_query = $db_connection->query($sql);
16 16
     if ($result_of_query->num_rows == 1) {
17 17
         $server = $result_of_query->fetch_object();
18 18
         try
19 19
         {
20
-            $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
20
+            $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int) decrypt($server->sq_port));
21 21
             $answer = $rcon->banPlayer($rid, $reason, $time);
22 22
         }
23 23
         catch (Exception $e)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
         {
20 20
             $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
21 21
             $answer = $rcon->banPlayer($rid, $reason, $time);
22
-        }
23
-        catch (Exception $e)
22
+        } catch (Exception $e)
24 23
         {
25 24
             echo $e->getMessage( );
26 25
         }
Please login to merge, or discard this patch.
hooks/rcon_command.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
         $rid = clean((isset($_POST['id'])) ? $_POST['id'] : 0, "int");
13 13
         $cmd = clean((isset($_POST['command'])) ? $_POST['command'] : 0, "string");
14 14
 
15
-        $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
15
+        $sql = "SELECT * FROM `servers` WHERE `use_sq` = 1 AND `sid` = ".$sid.";";
16 16
         $result_of_query = $db_connection->query($sql);
17 17
         if ($result_of_query->num_rows == 1) {
18 18
             $server = $result_of_query->fetch_object();
19 19
             try
20 20
             {
21
-                $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
21
+                $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int) decrypt($server->sq_port));
22 22
                 $answer = $rcon->command($cmd);
23 23
             }
24 24
             catch (Exception $e)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@
 block discarded – undo
20 20
             {
21 21
                 $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
22 22
                 $answer = $rcon->command($cmd);
23
-            }
24
-            catch (Exception $e)
23
+            } catch (Exception $e)
25 24
             {
26 25
                 echo $e->getMessage( );
27 26
             }
Please login to merge, or discard this patch.
hooks/rcon_players.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 if (isset($_GET['sid'])) {
6 6
     $sid = clean((isset($_GET['sid'])) ? $_GET['sid'] : 0, "int");
7 7
     $db_connection = masterConnect();
8
-    $sql = "SELECT `sq_ip`,`sq_port`,`rcon_pass` FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
8
+    $sql = "SELECT `sq_ip`,`sq_port`,`rcon_pass` FROM `servers` WHERE `use_sq` = 1 AND `sid` = ".$sid.";";
9 9
     $result_of_query = $db_connection->query($sql);
10 10
     if ($result_of_query->num_rows == 1) {
11 11
         $server = $result_of_query->fetch_object();
12 12
         try
13 13
         {
14
-            $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int)decrypt($server->sq_port));
14
+            $rcon = new \Nizarii\ARC(decrypt($server->sq_ip), decrypt($server->rcon_pass), (int) decrypt($server->sq_port));
15 15
             $answer = $rcon->getPlayersArray();
16 16
 
17 17
             echo json_encode($answer);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@
 block discarded – undo
16 16
 
17 17
             echo json_encode($answer);
18 18
 
19
-        }
20
-        catch (Exception $e)
19
+        } catch (Exception $e)
21 20
         {
22 21
             echo $e->getMessage( );
23 22
             var_dump($e);
Please login to merge, or discard this patch.
views/life/editPlayer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
       <div class="col-md-2 col-sm-2 box0">
230 230
         <div class="box1">
231 231
           <span class="fa fa-3x fa-usd"></span>
232
-          <h3> <?php $playerDonorLevel = $settings['donorFormat'];echo $lang['donator'].': '.$player->$playerDonorLevel; ?> </h3>
232
+          <h3> <?php $playerDonorLevel = $settings['donorFormat']; echo $lang['donator'].': '.$player->$playerDonorLevel; ?> </h3>
233 233
         </div>
234 234
       </div>
235 235
       <div class="col-md-2 col-sm-2 box0">
Please login to merge, or discard this patch.
views/core/curPlayers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$sql = "SELECT `sid` FROM `servers` WHERE `use_sq` = 1 AND `sid` = " . $sid . ";";
2
+$sql = "SELECT `sid` FROM `servers` WHERE `use_sq` = 1 AND `sid` = ".$sid.";";
3 3
 $result_of_query = $db_connection->query($sql);
4 4
 if ($result_of_query->num_rows == 1) { ?>
5 5
 <div class="row">
6 6
     <div class="col-lg-12">
7 7
         <h1 class="page-header">
8 8
             <?php echo $lang['players']; ?>
9
-            <small><?php echo " " . $lang['overview']; ?></small>
9
+            <small><?php echo " ".$lang['overview']; ?></small>
10 10
         </h1>
11 11
     </div>
12 12
 </div>
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 }
29 29
 function getPlayers() {
30 30
     $.ajax({
31
-        url: "<?php echo $settings['url'] . 'hooks/rcon_players.php?sid=' . $sid ?>",
31
+        url: "<?php echo $settings['url'].'hooks/rcon_players.php?sid='.$sid ?>",
32 32
         dataType: 'json',
33 33
         complete: function(data) {
34 34
             var txt = '';
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	<div class="content-panel">
54 54
 		<table class="table table-striped table-advance table-hover">
55 55
 			<h4>
56
-				<i class="fa fa-child fa-fw"></i><?php echo " " . $lang['players']; ?>
56
+				<i class="fa fa-child fa-fw"></i><?php echo " ".$lang['players']; ?>
57 57
 				<div style="float:right; padding-right: 20px;" id="count"></div>
58 58
 			</h4>
59 59
 			<hr>
Please login to merge, or discard this patch.
views/core/newServer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
         if ($dbid == 'none') {
6 6
             $server_type = 'life';
7 7
 
8
-            $sql = "INSERT INTO `db` (`type`, `sql_host`, `sql_user`, `sql_pass`, `sql_name`) VALUES ('" . $server_type . "', '" . $settings['db']['host'] . "', '" . $settings['db']['user'] . "', '" . $settings['db']['pass'] . "', '" . $settings['db']['name'] . "');";
8
+            $sql = "INSERT INTO `db` (`type`, `sql_host`, `sql_user`, `sql_pass`, `sql_name`) VALUES ('".$server_type."', '".$settings['db']['host']."', '".$settings['db']['user']."', '".$settings['db']['pass']."', '".$settings['db']['name']."');";
9 9
             $result_of_query = $db_connection->query($sql);
10 10
 
11
-            $sql = "SELECT `dbid` FROM `db` WHERE `sql_name` = '" . $SQL_name . "';";
11
+            $sql = "SELECT `dbid` FROM `db` WHERE `sql_name` = '".$SQL_name."';";
12 12
             $result_of_query = $db_connection->query($sql);
13 13
             while ($row = mysqli_fetch_assoc($result_of_query)) {
14 14
                 $dbid = $row['dbid'];
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
                 $server_RCON_pass = encrypt($_POST['server_RCON_pass']);
28 28
 
29 29
                 $sql = "INSERT INTO `servers` (`name`, `dbid`, `type`, `use_sq`, `sq_port`,`sq_ip`, `rcon_pass`) VALUES
30
-                ('" . $server_name . "', '" . $dbid . "', '" . $server_type . "', '" . $server_SQ . "', '" . $server_SQ_port . "', '" . $server_SQ_host . "', '" . $server_RCON_pass . "');";
30
+                ('" . $server_name."', '".$dbid."', '".$server_type."', '".$server_SQ."', '".$server_SQ_port."', '".$server_SQ_host."', '".$server_RCON_pass."');";
31 31
             }
32 32
         } else {
33 33
             $sql = "INSERT INTO `servers` (`name`, `dbid`, `type`, `use_sq`) VALUES
34
-                ('" . $server_name . "', '" . $dbid . "', '" . $server_type . "', '" . $server_SQ . "');";
34
+                ('" . $server_name."', '".$dbid."', '".$server_type."', '".$server_SQ."');";
35 35
         }
36 36
 
37 37
         $result_of_query = $db_connection->query($sql);
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
         <form method="post" action="newServer" name="newServer" id="newServer">
47 47
             <?php echo formtoken::getField() ?>
48 48
             <h2 class="form-login-heading">
49
-                <?php echo $lang['new'] . ' ' . $lang['gameServers'] ?>
49
+                <?php echo $lang['new'].' '.$lang['gameServers'] ?>
50 50
             </h2>
51 51
             <div class="form-group">
52 52
                 <label for="server_name">Server Name: </label>
53 53
                 <input placeholder="Server Name" id="server_name" class=" form-control login_input" type="text" name="server_name"
54 54
                     <?php if (isset($_POST['server_name'])) {
55
-    echo 'value="' . $_POST['server_name'] . '"' ?>
55
+    echo 'value="'.$_POST['server_name'].'"' ?>
56 56
                        autocorrect="off" required>
57 57
                 </div>
58 58
                 <div class="form-group">
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
                     <input placeholder="SQ IP" id="server_SQ_host"
76 76
                        class=" form-control login_input" type="text"
77 77
                        name="server_SQ_host"
78
-                        <?php if (isset($_POST['server_SQ_host'])) echo 'value="' . $_POST['server_SQ_host'] . '"' ?> autocorrect="off" autocapitalize="off">
78
+                        <?php if (isset($_POST['server_SQ_host'])) echo 'value="'.$_POST['server_SQ_host'].'"' ?> autocorrect="off" autocapitalize="off">
79 79
                     </div>
80 80
                     <div class="form-group">
81 81
                         <label for="server_SQ_port">SQ port: </label>
82 82
                         <input placeholder="SQ Port" id="server_SQ_port"
83 83
                        class=" form-control login_input" type="text"
84 84
                        name="server_SQ_port"
85
-                            <?php if (isset($_POST['server_SQ_port'])) echo 'value="' . $_POST['server_SQ_port'] . '"' ?> autocorrect="off" autocapitalize="off" autocomplete="off">
85
+                            <?php if (isset($_POST['server_SQ_port'])) echo 'value="'.$_POST['server_SQ_port'].'"' ?> autocorrect="off" autocapitalize="off" autocomplete="off">
86 86
                         </div>
87 87
                         <div class="form-group">
88 88
                             <label for="server_RCON_pass">RCON Password: </label>
89 89
                             <input placeholder="RCON Password" id="server_RCON_pass" class=" form-control login_input" type="password" name="server_RCON_pass"
90
-                                <?php if (isset($_POST['server_RCON_pass'])) echo 'value="' . $_POST['server_RCON_pass'] . '"' ?> autocorrect="off" autocapitalize="off" autocomplete="off">
90
+                                <?php if (isset($_POST['server_RCON_pass'])) echo 'value="'.$_POST['server_RCON_pass'].'"' ?> autocorrect="off" autocapitalize="off" autocomplete="off">
91 91
                             </div>
92 92
                             </div>
93 93
                             <?php
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     echo '<div class="form-group"><label for="server_dbid">Database: </label>';
99 99
                     echo '<select id="server_dbid" name="server_dbid" class="form-control login_input">';
100 100
                     while ($row = mysqli_fetch_assoc($result_of_query)) {
101
-                        echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
101
+                        echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';
102 102
                     }
103 103
                     echo '</select></div>';
104 104
                 } else {
Please login to merge, or discard this patch.