Passed
Push — 2.x ( fcd99a...ad8aea )
by Terry
01:51
created
src/Firewall/Driver/FileDriver.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/Log/ActionLogParser.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             default:
209 209
 
210 210
                 // We also accept querying N days data from logs. For example: `past_365_days`.
211
-                if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) {
211
+                if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) {
212 212
 
213 213
                     $dayCount = $matches[1];
214 214
                     $startDate = date('Ymd', strtotime('-' . $dayCount . ' days'));
@@ -331,21 +331,21 @@  discard block
 block discarded – undo
331 331
             return [];
332 332
         }
333 333
 
334
-        $results['captcha_chart_string']  = '';     // string
335
-        $results['pageview_chart_string'] = '';     // string
336
-        $results['captcha_success_count'] = 0;      // integer
337
-        $results['captcha_failure_count'] = 0;      // integer
338
-        $results['captcha_count'] = 0;              // integer
339
-        $results['pageview_count'] = 0;             // integer
340
-        $results['captcha_percentageage'] = 0;      // integer
334
+        $results['captcha_chart_string']  = ''; // string
335
+        $results['pageview_chart_string'] = ''; // string
336
+        $results['captcha_success_count'] = 0; // integer
337
+        $results['captcha_failure_count'] = 0; // integer
338
+        $results['captcha_count'] = 0; // integer
339
+        $results['pageview_count'] = 0; // integer
340
+        $results['captcha_percentageage'] = 0; // integer
341 341
         $results['captcha_failure_percentage'] = 0; // integer
342 342
         $results['captcha_success_percentage'] = 0; // integer
343 343
 
344
-        $results['action_ban_count'] = 0;           // integer
345
-        $results['action_temp_ban_count'] = 0;      // integer
346
-        $results['action_unban_count'] = 0;         // integer
347
-        $results['blacklist_count'] = 0;            // integer
348
-        $results['session_limit_count'] = 0;        // integer
344
+        $results['action_ban_count'] = 0; // integer
345
+        $results['action_temp_ban_count'] = 0; // integer
346
+        $results['action_unban_count'] = 0; // integer
347
+        $results['blacklist_count'] = 0; // integer
348
+        $results['session_limit_count'] = 0; // integer
349 349
 
350 350
         $ipdData = $this->getIpData();
351 351
 
@@ -386,22 +386,22 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $periodData = $this->getPeriodData();
388 388
 
389
-        $results['captcha_chart_string']  = '';     // string
390
-        $results['pageview_chart_string'] = '';     // string
391
-        $results['label_chart_string'] = '';        // string
392
-        $results['captcha_success_count'] = 0;      // integer
393
-        $results['captcha_failure_count'] = 0;      // integer
394
-        $results['captcha_count'] = 0;              // integer
395
-        $results['pageview_count'] = 0;             // integer
396
-        $results['captcha_percentageage'] = 0;      // integer
389
+        $results['captcha_chart_string']  = ''; // string
390
+        $results['pageview_chart_string'] = ''; // string
391
+        $results['label_chart_string'] = ''; // string
392
+        $results['captcha_success_count'] = 0; // integer
393
+        $results['captcha_failure_count'] = 0; // integer
394
+        $results['captcha_count'] = 0; // integer
395
+        $results['pageview_count'] = 0; // integer
396
+        $results['captcha_percentageage'] = 0; // integer
397 397
         $results['captcha_failure_percentage'] = 0; // integer
398 398
         $results['captcha_success_percentage'] = 0; // integer
399 399
 
400
-        $results['action_ban_count'] = 0;           // integer
401
-        $results['action_temp_ban_count'] = 0;      // integer
402
-        $results['action_unban_count'] = 0;         // integer
403
-        $results['blacklist_count'] = 0;            // integer
404
-        $results['session_limit_count'] = 0;        // integer
400
+        $results['action_ban_count'] = 0; // integer
401
+        $results['action_temp_ban_count'] = 0; // integer
402
+        $results['action_unban_count'] = 0; // integer
403
+        $results['blacklist_count'] = 0; // integer
404
+        $results['session_limit_count'] = 0; // integer
405 405
 
406 406
         if (!empty($periodData)) {
407 407
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             }
432 432
 
433 433
             $results['captcha_chart_string'] = implode(',', $chartCaptcha);
434
-            $results['pageview_chart_string']= implode(',', $chartPageview);
434
+            $results['pageview_chart_string'] = implode(',', $chartPageview);
435 435
             $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess);
436 436
             $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure);
437 437
             $results['label_chart_string'] = "'" . implode("','", $labels) . "'";
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         $ip = $log['ip'];
462 462
         $sessionId = $log['session_id'];
463 463
 
464
-        $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1;
464
+        $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1;
465 465
 
466 466
         if ($logActionCode === self::LOG_TEMPORARILY_BAN) {
467 467
             $this->periodDetail[$t][$k]['action_temp_ban_count']++;
Please login to merge, or discard this patch.
src/Firewall/Log/ActionLogger.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -100,10 +100,10 @@
 block discarded – undo
100 100
             $record['session_id'] = substr($record['session_id'], 0, 4);
101 101
         }
102 102
 
103
-        $data[0] = $record['ip']          ?? 'null';
104
-        $data[1] = $record['session_id']  ?? 'null';
103
+        $data[0] = $record['ip'] ?? 'null';
104
+        $data[1] = $record['session_id'] ?? 'null';
105 105
         $data[2] = $record['action_code'] ?? 'null';
106
-        $data[3] = $record['timesamp']    ?? 'null';
106
+        $data[3] = $record['timesamp'] ?? 'null';
107 107
 
108 108
         file_put_contents($this->filePath, implode(',', $data) . "\n", FILE_APPEND | LOCK_EX);
109 109
     }
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -224,13 +224,13 @@
 block discarded – undo
224 224
     }
225 225
 
226 226
 /**
227
-     * Get data from log file.
228
-     *
229
-     * @param string $fromYmd The string in Ymd Date format.
230
-     * @param string $toYmd   The end date.
231
-     *
232
-     * @return array
233
-     */
227
+ * Get data from log file.
228
+ *
229
+ * @param string $fromYmd The string in Ymd Date format.
230
+ * @param string $toYmd   The end date.
231
+ *
232
+ * @return array
233
+ */
234 234
     private function getDataFromSingleDate(string $fromYmd = '', string $toYmd = ''): array
235 235
     {
236 236
         $results = [];
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
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             </div>
40 40
             <div class="board-field right">
41 41
                 <div class="heading"><?php _e('panel', 'table_heading_period', 'Period'); ?></div>
42
-                <div class="nums"><?php echo number_format($session_limit_period ); ?></div>
42
+                <div class="nums"><?php echo number_format($session_limit_period); ?></div>
43 43
                 <div class="note"><?php _e('panel', 'table_note_period', 'Keep-alive period. (minutes)'); ?></div>
44 44
             </div>
45 45
         </div>
@@ -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_online', 'Online'); ?></div>
52
-                <div class="nums"><?php echo number_format($online_count ); ?></div>
52
+                <div class="nums"><?php echo number_format($online_count); ?></div>
53 53
                 <div class="note"><?php _e('panel', 'table_note_online', 'Online session amount.'); ?></div>
54 54
             </div>
55 55
         </div>
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 
90 90
                         $remainsTime = $expires - (time() - $sessionInfo['time']);
91 91
 
92
-                        if ($remainsTime < 1 ) {
92
+                        if ($remainsTime < 1) {
93 93
                             $remainsTime = 0;
94 94
                         }
95 95
 
96
-                        if ($i < $session_limit_count ) {
96
+                        if ($i < $session_limit_count) {
97 97
                             $satusName = __('panel', 'table_text_allowable', 'Allowable');
98 98
 
99
-                            if ($remainsTime < 1 ) {
99
+                            if ($remainsTime < 1) {
100 100
                                 $satusName = __('panel', 'table_text_expired', 'Expired');
101 101
                             }
102 102
                         } else {
Please login to merge, or discard this patch.
templates/panel/table_filter_logs.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,20 +58,20 @@
 block discarded – undo
58 58
             </thead>
59 59
             <tbody>
60 60
                 <?php foreach ($ip_log_list as $ipInfo) : ?>
61
-                    <?php $logData = is_array($ipInfo['log_data']) ? $ipInfo['log_data'] : json_decode($ipInfo['log_data'], true ); ?>
61
+                    <?php $logData = is_array($ipInfo['log_data']) ? $ipInfo['log_data'] : json_decode($ipInfo['log_data'], true); ?>
62 62
                     <?php
63 63
 
64 64
                         $text_warning = '';
65 65
 
66
-                        if ($logData['pageviews_m'] > 6 || $logData['pageviews_h'] > 50 || $logData['pageviews_d'] > 100 ) {
66
+                        if ($logData['pageviews_m'] > 6 || $logData['pageviews_h'] > 50 || $logData['pageviews_d'] > 100) {
67 67
                             $text_warning = '<span class="so-text-warning"><i class="fas fa-exclamation-triangle"></i></span>';
68 68
                         }
69 69
 
70
-                        if ($logData['flag_js_cookie'] > 2 || $logData['flag_multi_session'] > 2 || $logData['flag_empty_referer'] > 2 ) {
70
+                        if ($logData['flag_js_cookie'] > 2 || $logData['flag_multi_session'] > 2 || $logData['flag_empty_referer'] > 2) {
71 71
                             $text_warning = '<span class="so-text-warning"><i class="fas fa-exclamation-triangle"></i></span>';
72 72
                         }
73 73
 
74
-                        if ($logData['flag_js_cookie'] > 3 || $logData['flag_multi_session'] > 3 || $logData['flag_empty_referer'] > 3 ) {
74
+                        if ($logData['flag_js_cookie'] > 3 || $logData['flag_multi_session'] > 3 || $logData['flag_empty_referer'] > 3) {
75 75
                             $text_warning = '<span class="so-text-danger"><i class="fas fa-exclamation-triangle"></i></span>';
76 76
                         }
77 77
                     ?>
Please login to merge, or discard this patch.
templates/frontend/captcha.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 							<p><input type="submit" value="<?php _e('core', 'stop_submit', 'Submit') ?>" /></p>
51 51
 						</form>
52 52
 					</div>
53
-					<?php if (! empty($dialoguserinfo)) : ?>
53
+					<?php if (!empty($dialoguserinfo)) : ?>
54 54
 						<div class="status-user-info">
55 55
 							<?php foreach ($dialoguserinfo as $key => $userinfo) : ?>
56 56
 								<div class="row">
Please login to merge, or discard this patch.
src/Firewall/Panel/BaseController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
             define('SHIELDON_VIEW', true);
166 166
         }
167 167
 
168
-        $viewFilePath =  __DIR__ . '/../../../templates/' . $page . '.php';
168
+        $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php';
169 169
     
170 170
         if (!empty($data)) {
171 171
             extract($data);
Please login to merge, or discard this patch.
src/Firewall/Panel/ConfigMethodsTrait.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
  */
36 36
 trait ConfigMethodsTrait
37 37
 {
38
-     /**
39
-     * Parse the POST fields and set them into configuration data structure.
40
-     * Used for saveConfig method only.
41
-     *
42
-     * @param array $postParams
43
-     *
44
-     * @return void
45
-     */
38
+        /**
39
+         * Parse the POST fields and set them into configuration data structure.
40
+         * Used for saveConfig method only.
41
+         *
42
+         * @param array $postParams
43
+         *
44
+         * @return void
45
+         */
46 46
     protected function saveConfigPrepareSettings(array $postParams): void
47 47
     {
48 48
         foreach ($postParams as $postKey => $postData) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                     } else {
78 78
                         if (is_numeric($postData)) {
79 79
                             $this->setConfig(str_replace('__', '.', $postKey), (int) $postData);
80
-                        } else  {
80
+                        } else {
81 81
                             $this->setConfig(str_replace('__', '.', $postKey), $postData);
82 82
                         }
83 83
                     }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
                 // Create default log files.
166 166
                 if (is_writable($iptablesWatchingFolder)) {
167 167
                     fopen($iptablesWatchingFolder . '/iptables_queue.log', 'w+');
168
-                    fopen($iptablesWatchingFolder . '/ipv4_status.log',    'w+');
169
-                    fopen($iptablesWatchingFolder . '/ipv6_status.log',    'w+');
170
-                    fopen($iptablesWatchingFolder . '/ipv4_command.log',   'w+');
171
-                    fopen($iptablesWatchingFolder . '/ipv6_command.log',   'w+');
168
+                    fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+');
169
+                    fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+');
170
+                    fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+');
171
+                    fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+');
172 172
                 }
173 173
             }
174 174
     
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     (string) $db['user'],
247 247
                     (string) $db['pass']
248 248
                 );
249
-            } catch(PDOException $e) {
249
+            } catch (PDOException $e) {
250 250
                 $result = false;
251 251
                 $this->pushMessage('error', 
252 252
                     __(
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         if (class_exists('PDO')) {
300 300
             try {
301 301
                 new PDO('sqlite:' . $sqliteFilePath);
302
-            } catch(PDOException $e) { 
302
+            } catch (PDOException $e) { 
303 303
                 $this->pushMessage('error', $e->getMessage());
304 304
                 $result = false;
305 305
             }
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
                 $redis = new Redis();
342 342
                 $redis->connect(
343 343
                     (string) $this->getConfig('drivers.redis.host'), 
344
-                    (int)    $this->getConfig('drivers.redis.port')
344
+                    (int) $this->getConfig('drivers.redis.port')
345 345
                 );
346 346
                 unset($redis);
347
-            } catch(RedisException $e) {
347
+            } catch (RedisException $e) {
348 348
                 $this->pushMessage('error', $e->getMessage());
349 349
                 $result = false;
350 350
             }
Please login to merge, or discard this patch.
src/Firewall/Firewall/Driver/ItemSqliteDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
         // @codeCoverageIgnoreStart
46 46
 
47
-        } catch(PDOException $e) {
47
+        } catch (PDOException $e) {
48 48
             echo $e->getMessage();
49 49
         }
50 50
 
Please login to merge, or discard this patch.