Passed
Push — 2.x ( e0668e...a7b7dd )
by Terry
01:51
created
src/Firewall/Session.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@
 block discarded – undo
175 175
      * @return void
176 176
      */
177 177
     public function init(
178
-             $driver, 
178
+                $driver, 
179 179
         int  $gcExpires     = 300, 
180 180
         int  $gcProbability = 1, 
181 181
         int  $gcDivisor     = 100, 
Please login to merge, or discard this patch.
src/Firewall/Helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $masked = implode('.', $tmp);
240 240
 
241 241
     } else {
242
-        $masked =  str_repeat('*', strlen($str) - 6) . substr($str, -6);
242
+        $masked = str_repeat('*', strlen($str) - 6) . substr($str, -6);
243 243
     }
244 244
 
245 245
     return $masked;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
  */
796 796
 function create_session_id(): string
797 797
 {
798
-    $hash =  rand() . 'ej;1zj47vu;3e;31g642941ek62au/41' . time();
798
+    $hash = rand() . 'ej;1zj47vu;3e;31g642941ek62au/41' . time();
799 799
 
800 800
     return md5($hash);
801 801
 }
802 802
\ No newline at end of file
Please login to merge, or discard this patch.
src/Firewall/Kernel/TemplateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -321,8 +321,8 @@
 block discarded – undo
321 321
         $statStart = Container::get('shieldon_start');
322 322
         $statEnd = Container::get('shieldon_end');
323 323
 
324
-        $startTimeArr = explode(' ',$statStart['time']);
325
-        $endTimeArr = explode(' ',$statStart['time']);
324
+        $startTimeArr = explode(' ', $statStart['time']);
325
+        $endTimeArr = explode(' ', $statStart['time']);
326 326
 
327 327
         $timeDifference = ($endTimeArr[1] - $startTimeArr[1]) + ($endTimeArr[0] - $startTimeArr[0]);
328 328
         $memoryDifference = round(($statEnd['memory'] - $statStart['memory']) / 1024, 2); // KB
Please login to merge, or discard this patch.
src/Firewall/Kernel/DriverTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
             $this->driver->setChannel($channel);
106 106
         } else {
107 107
             Event::AddListener('set_driver',
108
-                function ($args) use ($channel) {
108
+                function($args) use ($channel) {
109 109
                     $args['driver']->setChannel($channel);
110 110
                 }
111 111
             );
Please login to merge, or discard this patch.
src/Firewall/Firewall/SetupTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
         foreach ($ipList as $ip) {
316 316
 
317
-            if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url']) ) {
317
+            if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url'])) {
318 318
 
319 319
                 if ('allow' === $ip['rule']) {
320 320
                     $allowedList[] = $ip['ip'];
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         $this->kernel->setProperty(
377 377
             'deny_attempt_enable',
378 378
             [
379
-                'data_circle'     => $setting['data_circle']['enable'],     // false   
379
+                'data_circle'     => $setting['data_circle']['enable'], // false   
380 380
                 'system_firewall' => $setting['system_firewall']['enable'], // false   
381 381
             ]
382 382
         );
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         $this->kernel->setProperty(
385 385
             'deny_attempt_buffer',
386 386
             [
387
-                'data_circle'     => $setting['data_circle']['buffer'],     // 10
387
+                'data_circle'     => $setting['data_circle']['buffer'], // 10
388 388
                 'system_firewall' => $setting['system_firewall']['buffer'], // 10
389 389
             ]
390 390
         );
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 
430 430
         if ($sessionLimitSetting['enable']) {
431 431
 
432
-            $onlineUsers = $sessionLimitSetting['config']['count'];       // default: 100
433
-            $alivePeriod = $sessionLimitSetting['config']['period'];      // default: 300
432
+            $onlineUsers = $sessionLimitSetting['config']['count']; // default: 100
433
+            $alivePeriod = $sessionLimitSetting['config']['period']; // default: 300
434 434
             $isUniqueIp  = $sessionLimitSetting['config']['unique_only']; // false
435 435
 
436 436
             $this->kernel->limitSession($onlineUsers, $alivePeriod, $isUniqueIp);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
             $lastResetTime = $cronjobSetting['config']['last_update'];
455 455
 
456
-            if (!empty($lastResetTime) ) {
456
+            if (!empty($lastResetTime)) {
457 457
                 $lastResetTime = strtotime($lastResetTime);
458 458
             } else {
459 459
                 // @codeCoverageIgnoreStart
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
         $dialogInfo = $this->getOption('dialog_info_disclosure');
536 536
 
537 537
         $this->kernel->setProperty('display_online_info', $dialogInfo['online_user_amount']);
538
-        $this->kernel->setProperty('display_user_info',   $dialogInfo['user_inforamtion']);
539
-        $this->kernel->setProperty('display_http_code',   $dialogInfo['http_status_code']);
538
+        $this->kernel->setProperty('display_user_info', $dialogInfo['user_inforamtion']);
539
+        $this->kernel->setProperty('display_http_code', $dialogInfo['http_status_code']);
540 540
         $this->kernel->setProperty('display_reason_code', $dialogInfo['reason_code']);
541 541
         $this->kernel->setProperty('display_reason_text', $dialogInfo['reason_text']);
542 542
     }
Please login to merge, or discard this patch.
templates/panel/operation_status.php 1 patch
Braces   +45 added lines, -18 removed lines patch added patch discarded remove patch
@@ -42,8 +42,11 @@  discard block
 block discarded – undo
42 42
                     <div class="nums">
43 43
                         <?php if (!empty($filter_cookie)) : ?>
44 44
                             <a href="#" onclick="displayLogs('frequency');"><?php echo $filter_cookie; ?></a>
45
-                        <?php else : ?>
46
-                            <?php echo $filter_cookie; ?>
45
+                        <?php else {
46
+    : ?>
47
+                            <?php echo $filter_cookie;
48
+}
49
+?>
47 50
                         <?php endif; ?>
48 51
                     </div>
49 52
                     <div class="note"><?php _e('panel', 'overview_note_cookie', 'Check whether visitors can create cookies with JavaScript'); ?></div>
@@ -58,8 +61,11 @@  discard block
 block discarded – undo
58 61
                     <div class="nums">
59 62
                         <?php if (!empty($filter_session)) : ?>
60 63
                             <a href="#" onclick="displayLogs('session');"><?php echo $filter_session; ?></a>
61
-                        <?php else : ?>
62
-                            <?php echo $filter_session; ?>
64
+                        <?php else {
65
+    : ?>
66
+                            <?php echo $filter_session;
67
+}
68
+?>
63 69
                         <?php endif; ?>
64 70
                     </div>
65 71
                     <div class="note"><?php _e('panel', 'overview_note_session', 'Detect whether multiple sessions were created by the same visitor.'); ?></div>
@@ -74,8 +80,11 @@  discard block
 block discarded – undo
74 80
                     <div class="nums">
75 81
                         <?php if (!empty($filter_frequency)) : ?>
76 82
                             <a href="#" onclick="displayLogs('frequency');"><?php echo $filter_frequency; ?></a>
77
-                        <?php else : ?>
78
-                            <?php echo $filter_frequency; ?>
83
+                        <?php else {
84
+    : ?>
85
+                            <?php echo $filter_frequency;
86
+}
87
+?>
79 88
                         <?php endif; ?>
80 89
                     </div>
81 90
                     <div class="note"><?php _e('panel', 'overview_note_frequency', 'Check how often a visitor views pages.'); ?></div>
@@ -90,8 +99,11 @@  discard block
 block discarded – undo
90 99
                     <div class="nums">
91 100
                         <?php if (!empty($filter_referer)) : ?>
92 101
                             <a href="#" onclick="displayLogs('referer');"><?php echo $filter_referer; ?></a>
93
-                        <?php else : ?>
94
-                            <?php echo $filter_referer; ?>
102
+                        <?php else {
103
+    : ?>
104
+                            <?php echo $filter_referer;
105
+}
106
+?>
95 107
                         <?php endif; ?>
96 108
                     </div>
97 109
                     <div class="note"><?php _e('panel', 'overview_note_referer', 'Check HTTP referrer information.'); ?></div>
@@ -116,8 +128,11 @@  discard block
 block discarded – undo
116 128
                     <div class="nums">
117 129
                         <?php if (!empty($component_ip)) : ?>
118 130
                             <a href="#" onclick="displayLogs('ip');"><?php echo $component_ip; ?></a>
119
-                        <?php else : ?>
120
-                            <?php echo $component_ip; ?>
131
+                        <?php else {
132
+    : ?>
133
+                            <?php echo $component_ip;
134
+}
135
+?>
121 136
                         <?php endif; ?>
122 137
                     </div>
123 138
                     <div class="note"><?php _e('panel', 'operation_note_ip', 'Advanced IP address mangement.'); ?></div>
@@ -132,8 +147,11 @@  discard block
 block discarded – undo
132 147
                     <div class="nums">
133 148
                         <?php if (!empty($component_trustedbot)) : ?>
134 149
                             <a href="#" onclick="displayLogs('trustedbot');"><?php echo $component_trustedbot; ?></a>
135
-                        <?php else : ?>
136
-                            <?php echo $component_trustedbot; ?>
150
+                        <?php else {
151
+    : ?>
152
+                            <?php echo $component_trustedbot;
153
+}
154
+?>
137 155
                         <?php endif; ?>
138 156
                     </div>
139 157
                     <div class="note"><?php _e('panel', 'operation_note_trustedbot', 'Allow popular search engines to crawl your website.'); ?></div>
@@ -148,8 +166,11 @@  discard block
 block discarded – undo
148 166
                     <div class="nums">
149 167
                         <?php if (!empty($component_header)) : ?>
150 168
                             <a href="#" onclick="displayLogs('header');"><?php echo $component_header; ?></a>
151
-                        <?php else : ?>
152
-                            <?php echo $component_header; ?>
169
+                        <?php else {
170
+    : ?>
171
+                            <?php echo $component_header;
172
+}
173
+?>
153 174
                         <?php endif; ?>
154 175
                     </div>
155 176
                     <div class="note"><?php _e('panel', 'operation_note_header', 'Analyze visitors header information.'); ?></div>
@@ -164,8 +185,11 @@  discard block
 block discarded – undo
164 185
                     <div class="nums">
165 186
                         <?php if (!empty($component_rdns)) : ?>
166 187
                             <a href="#" onclick="displayLogs('rdns');"><?php echo $component_rdns; ?></a>
167
-                        <?php else : ?>
168
-                            <?php echo $component_rdns; ?>
188
+                        <?php else {
189
+    : ?>
190
+                            <?php echo $component_rdns;
191
+}
192
+?>
169 193
                         <?php endif; ?>
170 194
                     </div>
171 195
                     <div class="note"><?php _e('panel', 'operation_note_rdns', 'Identify visitor IP resolved hostname (RDNS).'); ?></div>
@@ -180,8 +204,11 @@  discard block
 block discarded – undo
180 204
                     <div class="nums">
181 205
                         <?php if (!empty($component_useragent)) : ?>
182 206
                             <a href="#" onclick="displayLogs('useragent');"><?php echo $component_useragent; ?></a>
183
-                        <?php else : ?>
184
-                            <?php echo $component_useragent; ?>
207
+                        <?php else {
208
+    : ?>
209
+                            <?php echo $component_useragent;
210
+}
211
+?>
185 212
                         <?php endif; ?>
186 213
                     </div>
187 214
                     <div class="note"><?php _e('panel', 'operation_note_useragent', 'Analysis user-agent information from visitors.'); ?></div>
Please login to merge, or discard this patch.
templates/panel/table_sessions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             </div>
50 50
             <div class="board-field right">
51 51
                 <div class="heading"><?php _e('panel', 'table_heading_period', 'Period'); ?></div>
52
-                <div class="nums"><?php echo number_format($session_limit_period ); ?></div>
52
+                <div class="nums"><?php echo number_format($session_limit_period); ?></div>
53 53
                 <div class="note"><?php _e('panel', 'table_note_period', 'Keep-alive period (in minutes)'); ?></div>
54 54
             </div>
55 55
         </div>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             </div>
60 60
             <div class="board-field right">
61 61
                 <div class="heading"><?php _e('panel', 'table_heading_online', 'Online'); ?></div>
62
-                <div class="nums"><?php echo number_format($online_count ); ?></div>
62
+                <div class="nums"><?php echo number_format($online_count); ?></div>
63 63
                 <div class="note"><?php _e('panel', 'table_note_online', 'Online user count.'); ?></div>
64 64
             </div>
65 65
         </div>
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 
100 100
                         $remainsTime = $expires - (time() - $sessionInfo['time']);
101 101
 
102
-                        if ($remainsTime < 1 ) {
102
+                        if ($remainsTime < 1) {
103 103
                             $remainsTime = 0;
104 104
                         }
105 105
 
106
-                        if ($i < $session_limit_count ) {
106
+                        if ($i < $session_limit_count) {
107 107
                             $satusName = __('panel', 'table_text_allowable', 'Allowable');
108 108
 
109
-                            if ($remainsTime < 1 ) {
109
+                            if ($remainsTime < 1) {
110 110
                                 $satusName = __('panel', 'table_text_expired', 'Expired');
111 111
                             }
112 112
                         } else {
Please login to merge, or discard this patch.
src/Firewall/Log/ActionLogger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,10 +111,10 @@
 block discarded – undo
111 111
 
112 112
         $data = [];
113 113
 
114
-        $data[0] = $record['ip']          ?? 'null';
115
-        $data[1] = $record['session_id']  ?? 'null';
114
+        $data[0] = $record['ip'] ?? 'null';
115
+        $data[1] = $record['session_id'] ?? 'null';
116 116
         $data[2] = $record['action_code'] ?? 'null';
117
-        $data[3] = $record['timestamp']    ?? 'null';
117
+        $data[3] = $record['timestamp'] ?? 'null';
118 118
 
119 119
         file_put_contents($this->filePath, implode(',', $data) . "\n", FILE_APPEND | LOCK_EX);
120 120
     }
Please login to merge, or discard this patch.
src/Firewall/FirewallTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@
 block discarded – undo
272 272
             $channel = '_' . $this->channel;
273 273
         }
274 274
 
275
-        return $this->directory . '/' . $this->version . $channel .  '_' . $driverType . '_' . $this->checkpoint;
275
+        return $this->directory . '/' . $this->version . $channel . '_' . $driverType . '_' . $this->checkpoint;
276 276
     }
277 277
 
278 278
     /**
Please login to merge, or discard this patch.