Passed
Push — 2.x ( 4a9b6a...b78933 )
by Terry
02:02
created
src/Firewall/Log/ActionLogParser.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         ];
208 208
 
209 209
         if (empty($dataRange[$this->type])) {
210
-            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) {
210
+            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) {
211 211
                 $dayCount = $matches[1];
212 212
                 $startDate = date('Ymd', strtotime('-' . $dayCount . ' days'));
213 213
                 $endDate = date('Ymd');
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 
351 351
         $results['captcha_chart_string']       = ''; // string
352 352
         $results['pageview_chart_string']      = ''; // string
353
-        $results['captcha_success_count']      = 0;  // integer
354
-        $results['captcha_failure_count']      = 0;  // integer
355
-        $results['captcha_count']              = 0;  // integer
356
-        $results['pageview_count']             = 0;  // integer
357
-        $results['captcha_percentageage']      = 0;  // integer
358
-        $results['captcha_failure_percentage'] = 0;  // integer
359
-        $results['captcha_success_percentage'] = 0;  // integer
360
-        $results['action_ban_count']           = 0;  // integer
361
-        $results['action_temp_ban_count']      = 0;  // integer
362
-        $results['action_unban_count']         = 0;  // integer
363
-        $results['blacklist_count']            = 0;  // integer
364
-        $results['session_limit_count']        = 0;  // integer
353
+        $results['captcha_success_count']      = 0; // integer
354
+        $results['captcha_failure_count']      = 0; // integer
355
+        $results['captcha_count']              = 0; // integer
356
+        $results['pageview_count']             = 0; // integer
357
+        $results['captcha_percentageage']      = 0; // integer
358
+        $results['captcha_failure_percentage'] = 0; // integer
359
+        $results['captcha_success_percentage'] = 0; // integer
360
+        $results['action_ban_count']           = 0; // integer
361
+        $results['action_temp_ban_count']      = 0; // integer
362
+        $results['action_unban_count']         = 0; // integer
363
+        $results['blacklist_count']            = 0; // integer
364
+        $results['session_limit_count']        = 0; // integer
365 365
 
366 366
         $ipdData = $this->getIpData();
367 367
 
@@ -406,18 +406,18 @@  discard block
 block discarded – undo
406 406
         $results['label_chart_string']         = ''; // string
407 407
         $results['captcha_chart_string']       = ''; // string
408 408
         $results['pageview_chart_string']      = ''; // string
409
-        $results['captcha_success_count']      = 0;  // integer
410
-        $results['captcha_failure_count']      = 0;  // integer
411
-        $results['captcha_count']              = 0;  // integer
412
-        $results['pageview_count']             = 0;  // integer
413
-        $results['captcha_percentageage']      = 0;  // integer
414
-        $results['captcha_failure_percentage'] = 0;  // integer
415
-        $results['captcha_success_percentage'] = 0;  // integer
416
-        $results['action_ban_count']           = 0;  // integer
417
-        $results['action_temp_ban_count']      = 0;  // integer
418
-        $results['action_unban_count']         = 0;  // integer
419
-        $results['blacklist_count']            = 0;  // integer
420
-        $results['session_limit_count']        = 0;  // integer
409
+        $results['captcha_success_count']      = 0; // integer
410
+        $results['captcha_failure_count']      = 0; // integer
411
+        $results['captcha_count']              = 0; // integer
412
+        $results['pageview_count']             = 0; // integer
413
+        $results['captcha_percentageage']      = 0; // integer
414
+        $results['captcha_failure_percentage'] = 0; // integer
415
+        $results['captcha_success_percentage'] = 0; // integer
416
+        $results['action_ban_count']           = 0; // integer
417
+        $results['action_temp_ban_count']      = 0; // integer
418
+        $results['action_unban_count']         = 0; // integer
419
+        $results['blacklist_count']            = 0; // integer
420
+        $results['session_limit_count']        = 0; // integer
421 421
 
422 422
         if (!empty($periodData)) {
423 423
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         $ip = $log['ip'];
478 478
         $sessionId = $log['session_id'];
479 479
 
480
-        $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1;
480
+        $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1;
481 481
 
482 482
         if ($logActionCode === self::LOG_TEMPORARILY_BAN) {
483 483
             $this->periodDetail[$t][$k]['action_temp_ban_count']++;
Please login to merge, or discard this patch.
src/Firewall/Panel/Report.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $data = array_merge($data, $result);
138 138
         }
139 139
 
140
-        $data['page_availability'] = $this->pageAvailability['logs'];;
140
+        $data['page_availability'] = $this->pageAvailability['logs']; ;
141 141
 
142 142
         $data['page_url'] = $this->url('report/actionLog');
143 143
 
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
     private function operationTemplateVarsOfComponents(array $data = []): array
210 210
     {
211 211
         $data['components'] = [
212
-            'Ip'         => (!empty($this->kernel->component['Ip']))         ? true : false,
212
+            'Ip'         => (!empty($this->kernel->component['Ip'])) ? true : false,
213 213
             'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false,
214
-            'Header'     => (!empty($this->kernel->component['Header']))     ? true : false,
215
-            'Rdns'       => (!empty($this->kernel->component['Rdns']))       ? true : false,
216
-            'UserAgent'  => (!empty($this->kernel->component['UserAgent']))  ? true : false,
214
+            'Header'     => (!empty($this->kernel->component['Header'])) ? true : false,
215
+            'Rdns'       => (!empty($this->kernel->component['Rdns'])) ? true : false,
216
+            'UserAgent'  => (!empty($this->kernel->component['UserAgent'])) ? true : false,
217 217
         ];
218 218
 
219 219
         return $data;
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/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.