Passed
Push — 2.x ( 0013c1...df2ab7 )
by Terry
02:33 queued 16s
created
src/Firewall/Firewall/Messenger/ItemRocketChat.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
      */
30 30
     public static function get(array $setting): MessengerInterface
31 31
     {
32
-        $serverUrl   = $setting['config']['server_url']   ?? '';
33
-        $userId      = $setting['config']['user_id']      ?? '';
32
+        $serverUrl   = $setting['config']['server_url'] ?? '';
33
+        $userId      = $setting['config']['user_id'] ?? '';
34 34
         $accessToken = $setting['config']['access_token'] ?? '';
35
-        $channel     = $setting['config']['channel']      ?? '';
35
+        $channel     = $setting['config']['channel'] ?? '';
36 36
 
37 37
         return new RocketChat($accessToken, $userId, $serverUrl, $channel);
38 38
     }
Please login to merge, or discard this patch.
src/Firewall/Firewall/Driver/ItemMysqlDriver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             // Create a PDO instance.
38 38
             $pdoInstance = new PDO(
39 39
                 'mysql:host=' 
40
-                    . $setting['host']   . ';dbname=' 
40
+                    . $setting['host'] . ';dbname=' 
41 41
                     . $setting['dbname'] . ';charset=' 
42 42
                     . $setting['charset']
43 43
                 , (string) $setting['user']
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         // @codeCoverageIgnoreStart
51 51
 
52
-        } catch(PDOException $e) {
52
+        } catch (PDOException $e) {
53 53
             echo $e->getMessage();
54 54
         }
55 55
 
Please login to merge, or discard this patch.
templates/frontend/login.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				<div class="card-body">
120 120
                     <form action="<?php echo $form ?>" method="post" autocomplete="off">
121 121
                         <div class="main-content">
122
-                            <?php if (! empty($error)) : ?>
122
+                            <?php if (!empty($error)) : ?>
123 123
                             <div class="error-notice">
124 124
                                 <?php echo $error; ?>
125 125
                             </div>
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                             <div class="input-box">
131 131
                                 <input type="password" name="s_pass" placeholder="Password" class="form-input" />
132 132
                             </div>
133
-                            <?php if (! empty($captchas)) : ?>
133
+                            <?php if (!empty($captchas)) : ?>
134 134
                             <div class="input-box">
135 135
                                 <?php foreach ($captchas as $captcha) : ?>
136 136
                                     <?php echo $captcha->form(); ?>
Please login to merge, or discard this patch.
src/Firewall/Captcha/ImageCaptcha.php 1 patch
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             'colors'       => [
101 101
                 'background' => [255, 255, 255],
102 102
                 'border'     => [153, 200, 255],
103
-                'text'       => [51,  153, 255],
103
+                'text'       => [51, 153, 255],
104 104
                 'grid'       => [153, 200, 255]
105 105
             ]
106 106
         ];
@@ -319,14 +319,12 @@  discard block
 block discarded – undo
319 319
     {
320 320
         // Determine angle and position.
321 321
         $angle = ($this->length >= 6) ?
322
-            mt_rand(-($this->length - 6), ($this->length - 6)) :
323
-            0;
322
+            mt_rand(-($this->length - 6), ($this->length - 6)) : 0;
324 323
 
325 324
         $xAxis = mt_rand(6, (360 / $this->length) - 16);
326 325
 
327 326
         $yAxis = ($angle >= 0) ?
328
-            mt_rand($imgHeight, $imgWidth) :
329
-            mt_rand(6, $imgHeight);
327
+            mt_rand($imgHeight, $imgWidth) : mt_rand(6, $imgHeight);
330 328
 
331 329
         // Create the spiral pattern.
332 330
         $theta = 1;
@@ -369,7 +367,7 @@  discard block
 block discarded – undo
369 367
         $y = 0;
370 368
 
371 369
         for ($i = 0; $i < $this->length; $i++) {
372
-            $y = mt_rand(0 , $imgHeight / 2);
370
+            $y = mt_rand(0, $imgHeight / 2);
373 371
             imagestring($this->im, 5, $x, $y, $this->word[$i], $textColor);
374 372
             $x += ($this->properties['font_spacing'] * 2);
375 373
         }
@@ -398,7 +396,7 @@  discard block
 block discarded – undo
398 396
     private function getImageBase64Content(): string
399 397
     {
400 398
         // Generate image in base64 string.
401
-        ob_start ();
399
+        ob_start();
402 400
 
403 401
         if (function_exists('imagejpeg')) {
404 402
             $this->imageType = 'jpeg';
Please login to merge, or discard this patch.
src/Firewall/Log/ActionLogParser.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         ];
198 198
 
199 199
         if (empty($dataRange[$this->type])) {
200
-            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) {
200
+            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) {
201 201
                 $dayCount = $matches[1];
202 202
                 $startDate = date('Ymd', strtotime('-' . $dayCount . ' days'));
203 203
                 $endDate = date('Ymd');
@@ -336,21 +336,21 @@  discard block
 block discarded – undo
336 336
             return [];
337 337
         }
338 338
 
339
-        $results['captcha_chart_string']  = '';     // string
340
-        $results['pageview_chart_string'] = '';     // string
341
-        $results['captcha_success_count'] = 0;      // integer
342
-        $results['captcha_failure_count'] = 0;      // integer
343
-        $results['captcha_count'] = 0;              // integer
344
-        $results['pageview_count'] = 0;             // integer
345
-        $results['captcha_percentageage'] = 0;      // integer
339
+        $results['captcha_chart_string']  = ''; // string
340
+        $results['pageview_chart_string'] = ''; // string
341
+        $results['captcha_success_count'] = 0; // integer
342
+        $results['captcha_failure_count'] = 0; // integer
343
+        $results['captcha_count'] = 0; // integer
344
+        $results['pageview_count'] = 0; // integer
345
+        $results['captcha_percentageage'] = 0; // integer
346 346
         $results['captcha_failure_percentage'] = 0; // integer
347 347
         $results['captcha_success_percentage'] = 0; // integer
348 348
 
349
-        $results['action_ban_count'] = 0;           // integer
350
-        $results['action_temp_ban_count'] = 0;      // integer
351
-        $results['action_unban_count'] = 0;         // integer
352
-        $results['blacklist_count'] = 0;            // integer
353
-        $results['session_limit_count'] = 0;        // integer
349
+        $results['action_ban_count'] = 0; // integer
350
+        $results['action_temp_ban_count'] = 0; // integer
351
+        $results['action_unban_count'] = 0; // integer
352
+        $results['blacklist_count'] = 0; // integer
353
+        $results['session_limit_count'] = 0; // integer
354 354
 
355 355
         $ipdData = $this->getIpData();
356 356
 
@@ -391,22 +391,22 @@  discard block
 block discarded – undo
391 391
     {
392 392
         $periodData = $this->getPeriodData();
393 393
 
394
-        $results['captcha_chart_string']  = '';     // string
395
-        $results['pageview_chart_string'] = '';     // string
396
-        $results['label_chart_string'] = '';        // string
397
-        $results['captcha_success_count'] = 0;      // integer
398
-        $results['captcha_failure_count'] = 0;      // integer
399
-        $results['captcha_count'] = 0;              // integer
400
-        $results['pageview_count'] = 0;             // integer
401
-        $results['captcha_percentageage'] = 0;      // integer
394
+        $results['captcha_chart_string']  = ''; // string
395
+        $results['pageview_chart_string'] = ''; // string
396
+        $results['label_chart_string'] = ''; // string
397
+        $results['captcha_success_count'] = 0; // integer
398
+        $results['captcha_failure_count'] = 0; // integer
399
+        $results['captcha_count'] = 0; // integer
400
+        $results['pageview_count'] = 0; // integer
401
+        $results['captcha_percentageage'] = 0; // integer
402 402
         $results['captcha_failure_percentage'] = 0; // integer
403 403
         $results['captcha_success_percentage'] = 0; // integer
404 404
 
405
-        $results['action_ban_count'] = 0;           // integer
406
-        $results['action_temp_ban_count'] = 0;      // integer
407
-        $results['action_unban_count'] = 0;         // integer
408
-        $results['blacklist_count'] = 0;            // integer
409
-        $results['session_limit_count'] = 0;        // integer
405
+        $results['action_ban_count'] = 0; // integer
406
+        $results['action_temp_ban_count'] = 0; // integer
407
+        $results['action_unban_count'] = 0; // integer
408
+        $results['blacklist_count'] = 0; // integer
409
+        $results['session_limit_count'] = 0; // integer
410 410
 
411 411
         if (!empty($periodData)) {
412 412
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             }
437 437
 
438 438
             $results['captcha_chart_string'] = implode(',', $chartCaptcha);
439
-            $results['pageview_chart_string']= implode(',', $chartPageview);
439
+            $results['pageview_chart_string'] = implode(',', $chartPageview);
440 440
             $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess);
441 441
             $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure);
442 442
             $results['label_chart_string'] = "'" . implode("','", $labels) . "'";
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
         $ip = $log['ip'];
467 467
         $sessionId = $log['session_id'];
468 468
 
469
-        $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1;
469
+        $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1;
470 470
 
471 471
         if ($logActionCode === self::LOG_TEMPORARILY_BAN) {
472 472
             $this->periodDetail[$t][$k]['action_temp_ban_count']++;
Please login to merge, or discard this patch.
src/Firewall/Firewall/MainTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
         $this->kernel->setProperty('time_unit_quota', $frequencyQuota);
104 104
 
105
-        $this->kernel->setProperty('cookie_name', $settings['cookie']['config']['cookie_name']);      // ssjd
106
-        $this->kernel->setProperty('cookie_domain', $settings['cookie']['config']['cookie_domain']);  // ''
107
-        $this->kernel->setProperty('cookie_value', $settings['cookie']['config']['cookie_value']);    // 1
105
+        $this->kernel->setProperty('cookie_name', $settings['cookie']['config']['cookie_name']); // ssjd
106
+        $this->kernel->setProperty('cookie_domain', $settings['cookie']['config']['cookie_domain']); // ''
107
+        $this->kernel->setProperty('cookie_value', $settings['cookie']['config']['cookie_value']); // 1
108 108
 
109 109
         $this->kernel->setProperty('interval_check_referer', $settings['referer']['config']['time_buffer']);
110 110
         $this->kernel->setProperty('interval_check_session', $settings['referer']['config']['time_buffer']);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
         foreach ($ipList as $ip) {
213 213
 
214
-            if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url']) ) {
214
+            if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url'])) {
215 215
 
216 216
                 if ('allow' === $ip['rule']) {
217 217
                     $allowedList[] = $ip['ip'];
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
         $setting = $this->getOption('failed_attempts_in_a_row', 'events');
281 281
 
282 282
         $this->kernel->setProperty('deny_attempt_enable', [
283
-            'data_circle' => $setting['data_circle']['enable'],         // false   
283
+            'data_circle' => $setting['data_circle']['enable'], // false   
284 284
             'system_firewall' => $setting['system_firewall']['enable'], // false   
285 285
         ]);
286 286
 
287 287
         $this->kernel->setProperty('deny_attempt_buffer', [
288
-            'data_circle' => $setting['data_circle']['buffer'],         // 10
288
+            'data_circle' => $setting['data_circle']['buffer'], // 10
289 289
             'system_firewall' => $setting['system_firewall']['buffer'], // 10
290 290
         ]);
291 291
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         $recordAttempt = $this->getOption('record_attempt');
294 294
 
295 295
         $this->kernel->setProperty('record_attempt_detection_period', $recordAttempt['detection_period']); // 5
296
-        $this->kernel->setProperty('reset_attempt_counter', $recordAttempt['time_to_reset']);              // 1800
296
+        $this->kernel->setProperty('reset_attempt_counter', $recordAttempt['time_to_reset']); // 1800
297 297
     }
298 298
 
299 299
     /**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     protected function setIptablesBridgeDirectory(): void
305 305
     {
306 306
         $iptablesSetting = $this->getOption('config', 'iptables');
307
-        $this->kernel->setProperty('iptables_watching_folder',  $iptablesSetting['watching_folder']);
307
+        $this->kernel->setProperty('iptables_watching_folder', $iptablesSetting['watching_folder']);
308 308
     }
309 309
 
310 310
     /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
         if ($sessionLimitSetting['enable']) {
320 320
 
321
-            $onlineUsers = $sessionLimitSetting['config']['count']  ?? 100;
321
+            $onlineUsers = $sessionLimitSetting['config']['count'] ?? 100;
322 322
             $alivePeriod = $sessionLimitSetting['config']['period'] ?? 300;
323 323
 
324 324
             $this->kernel->limitSession($onlineUsers, $alivePeriod);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
             $lastResetTime = $cronjobSetting['config']['last_update'];
343 343
 
344
-            if (!empty($lastResetTime) ) {
344
+            if (!empty($lastResetTime)) {
345 345
                 $lastResetTime = strtotime($lastResetTime);
346 346
             } else {
347 347
                 // @codeCoverageIgnoreStart
Please login to merge, or discard this patch.
src/Firewall/Driver/FileDriverTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -356,8 +356,8 @@
 block discarded – undo
356 356
         $path = [];
357 357
 
358 358
         $path['filter'] = $this->directory . '/' . $this->tableFilterLogs . '/' . $ip . '.' . $this->extension;
359
-        $path['session'] = $this->directory . '/' . $this->tableSessions   . '/' . $ip . '.' . $this->extension;
360
-        $path['rule'] = $this->directory . '/' . $this->tableRuleList   . '/' . $ip . '.' . $this->extension;
359
+        $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension;
360
+        $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension;
361 361
 
362 362
         return $path[$type] ?? '';
363 363
     }
Please login to merge, or discard this patch.
src/Firewall/Kernel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -614,9 +614,9 @@
 block discarded – undo
614 614
         $this->initComponents();
615 615
 
616 616
         $processMethods = [
617
-            'isRuleExist',   // Stage 1 - Looking for rule table.
618
-            'isTrustedBot',  // Stage 2 - Detect popular search engine.
619
-            'isFakeRobot',   // Stage 3 - Reject fake search engine crawlers.
617
+            'isRuleExist', // Stage 1 - Looking for rule table.
618
+            'isTrustedBot', // Stage 2 - Detect popular search engine.
619
+            'isFakeRobot', // Stage 3 - Reject fake search engine crawlers.
620 620
             'isIpComponent', // Stage 4 - IP manager.
621 621
             'isComponents'   // Stage 5 - Check other components.
622 622
         ];
Please login to merge, or discard this patch.
templates/panel/action_log_past_seven_days.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 
20 20
 <div class="so-dashboard">
21
-    <?php if (! empty($period_data)) : ?>
21
+    <?php if (!empty($period_data)) : ?>
22 22
     <div class="so-flex">
23 23
         <div class="so-board">
24 24
             <div class="board-field left">
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 </tr>
90 90
             </thead>
91 91
             <tbody>
92
-                <?php if (! empty($ip_details)) : ?>
92
+                <?php if (!empty($ip_details)) : ?>
93 93
                 <?php foreach ($ip_details as $ip => $ipInfo) : ?>
94 94
                 <tr>
95 95
                     <td>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         </table>
113 113
     </div>
114 114
     <div class="so-timezone">
115
-        <?php if (! empty($last_cached_time)) : ?>
115
+        <?php if (!empty($last_cached_time)) : ?>
116 116
             <?php _e('panel', 'log_label_cache_time', 'Report generated time'); ?>: <strong class="text-info"><?php echo $last_cached_time; ?></strong>
117 117
             &nbsp;&nbsp;&nbsp;&nbsp; 
118 118
         <?php endif; ?>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 <?php
124 124
 
125
-    if (! empty($period_data)) {
125
+    if (!empty($period_data)) {
126 126
         $data['period_data'] = $period_data;
127 127
         $this->loadViewPart('panel/js/chart', $data);
128 128
     }
Please login to merge, or discard this patch.