Passed
Push — 2.x ( da3964...4ff14b )
by Terry
01:53
created
src/Firewall/Log/ActionLogParser.php 1 patch
Spacing   +29 added lines, -29 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'));
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         // Fetch data from log files.
234 234
         $logs = $this->logger->get($startDate, $endDate);
235 235
 
236
-        foreach($logs as $log) {
236
+        foreach ($logs as $log) {
237 237
 
238 238
             $logTimesamp = (int) $log['timesamp'];
239 239
             $logIp = $log['ip'];
@@ -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/Helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
         $masked = implode('.', $tmp);
168 168
 
169 169
     } else {
170
-        $masked =  str_repeat('*', strlen($str) - 6) . substr(str, -6);
170
+        $masked = str_repeat('*', strlen($str) - 6) . substr(str, -6);
171 171
     }
172 172
 
173 173
     return $masked;
Please login to merge, or discard this patch.
src/Firewall/Panel/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
             if (
58 58
                 // Default password, unencrypted.
59
-                $admin['user']  === $postParams['s_user'] && 
59
+                $admin['user'] === $postParams['s_user'] && 
60 60
                 'shieldon_pass' === $postParams['s_pass'] &&
61 61
                 'shieldon_pass' === $admin['pass']
62 62
             ) {
Please login to merge, or discard this patch.
templates/panel/action_log_last_month.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 ?>
15 15
 
16 16
 <div class="so-dashboard">
17
-    <?php if (! empty($period_data)) : ?>
17
+    <?php if (!empty($period_data)) : ?>
18 18
     <div class="so-flex">
19 19
         <div class="so-board">
20 20
             <div class="board-field left">
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
                 </tr>
86 86
             </thead>
87 87
             <tbody>
88
-                <?php if (! empty($ip_details)) : ?>
89
-                <?php foreach($ip_details as $ip => $ipInfo) : ?>
88
+                <?php if (!empty($ip_details)) : ?>
89
+                <?php foreach ($ip_details as $ip => $ipInfo) : ?>
90 90
                 <tr>
91 91
                     <td>
92 92
                         <?php if ($this->mode === 'demo') : ?>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         </table>
109 109
     </div>
110 110
     <div class="so-timezone">
111
-        <?php if (! empty($last_cached_time)) : ?>
111
+        <?php if (!empty($last_cached_time)) : ?>
112 112
             <?php _e('panel', 'log_label_cache_time', 'Report generated time'); ?>: <strong class="text-info"><?php echo $last_cached_time; ?></strong>
113 113
             &nbsp;&nbsp;&nbsp;&nbsp; 
114 114
         <?php endif; ?>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 <?php
120 120
 
121
-    if (! empty($period_data)) {
121
+    if (!empty($period_data)) {
122 122
         $data['period_data'] = $period_data;
123 123
         $this->_include('panel/js/chart', $data);
124 124
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,12 @@
 block discarded – undo
60 60
                 </div>
61 61
             </div>
62 62
         </div>
63
-    <?php else : ?>
63
+    <?php else {
64
+    : ?>
64 65
         <div class="alert alert-danger">
65
-            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.'); ?>
66
+            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.');
67
+}
68
+?>
66 69
             
67 70
         </div>
68 71
     <?php endif; ?>
Please login to merge, or discard this patch.
templates/panel/action_log_this_month.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 ?>
15 15
 
16 16
 <div class="so-dashboard">
17
-    <?php if (! empty($period_data)) : ?>
17
+    <?php if (!empty($period_data)) : ?>
18 18
     <div class="so-flex">
19 19
         <div class="so-board">
20 20
             <div class="board-field left">
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
                 </tr>
86 86
             </thead>
87 87
             <tbody>
88
-                <?php if (! empty($ip_details)) : ?>
89
-                <?php foreach($ip_details as $ip => $ipInfo) : ?>
88
+                <?php if (!empty($ip_details)) : ?>
89
+                <?php foreach ($ip_details as $ip => $ipInfo) : ?>
90 90
                 <tr>
91 91
                     <td>
92 92
                         <?php if ($this->mode === 'demo') : ?>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         </table>
109 109
     </div>
110 110
     <div class="so-timezone">
111
-        <?php if (! empty($last_cached_time)) : ?>
111
+        <?php if (!empty($last_cached_time)) : ?>
112 112
             <?php _e('panel', 'log_label_cache_time', 'Report generated time'); ?>: <strong class="text-info"><?php echo $last_cached_time; ?></strong>
113 113
             &nbsp;&nbsp;&nbsp;&nbsp; 
114 114
         <?php endif; ?>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 <?php
120 120
 
121
-    if (! empty($period_data)) {
121
+    if (!empty($period_data)) {
122 122
         $data['period_data'] = $period_data;
123 123
         $this->_include('panel/js/chart', $data);
124 124
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,12 @@
 block discarded – undo
60 60
                 </div>
61 61
             </div>
62 62
         </div>
63
-    <?php else : ?>
63
+    <?php else {
64
+    : ?>
64 65
         <div class="alert alert-danger">
65
-            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.'); ?>
66
+            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.');
67
+}
68
+?>
66 69
             
67 70
         </div>
68 71
     <?php endif; ?>
Please login to merge, or discard this patch.
templates/panel/action_log_yesterday.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 ?>
15 15
 
16 16
 <div class="so-dashboard">
17
-    <?php if (! empty($period_data)) : ?>
17
+    <?php if (!empty($period_data)) : ?>
18 18
     <div class="so-flex">
19 19
         <div class="so-board">
20 20
             <div class="board-field left">
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
                 </tr>
86 86
             </thead>
87 87
             <tbody>
88
-                <?php if (! empty($ip_details)) : ?>
89
-                <?php foreach($ip_details as $ip => $ipInfo) : ?>
88
+                <?php if (!empty($ip_details)) : ?>
89
+                <?php foreach ($ip_details as $ip => $ipInfo) : ?>
90 90
                 <tr>
91 91
                     <td>
92 92
                         <?php if ($this->mode === 'demo') : ?>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         </table>
109 109
     </div>
110 110
     <div class="so-timezone">
111
-        <?php if (! empty($last_cached_time)) : ?>
111
+        <?php if (!empty($last_cached_time)) : ?>
112 112
             <?php _e('panel', 'log_label_cache_time', 'Report generated time'); ?>: <strong class="text-info"><?php echo $last_cached_time; ?></strong>
113 113
             &nbsp;&nbsp;&nbsp;&nbsp; 
114 114
         <?php endif; ?>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 <?php
120 120
 
121
-    if (! empty($period_data)) {
121
+    if (!empty($period_data)) {
122 122
         $data['period_data'] = $period_data;
123 123
         $this->_include('panel/js/chart', $data);
124 124
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,9 +60,12 @@
 block discarded – undo
60 60
                 </div>
61 61
             </div>
62 62
         </div>
63
-    <?php else : ?>
63
+    <?php else {
64
+    : ?>
64 65
         <div class="alert alert-danger">
65
-            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.'); ?>
66
+            <?php _e('panel', 'log_msg_no_logger', 'Sorry, you have to implement ActionLogger to use this function.');
67
+}
68
+?>
66 69
             
67 70
         </div>
68 71
     <?php endif; ?>
Please login to merge, or discard this patch.
templates/panel/overview.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 <div class="filter-status">
204 204
                     <div class="heading"><?php _e('panel', 'overview_label_action_logger', 'Action Logger'); ?></div>
205 205
                     <div class="nums">
206
-                        <?php echo $data['action_logger']  ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
206
+                        <?php echo $data['action_logger'] ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
207 207
                     </div>
208 208
                     <div class="note"><?php _e('panel', 'overview_note_action_logger', 'Record every visitor’s behavior.'); ?></div>
209 209
                 </div>
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                 <div class="filter-status">
223 223
                     <div class="heading"><?php _e('panel', 'overview_label_recaptcha', 'reCAPTCHA'); ?></div>
224 224
                     <div class="nums">
225
-                        <?php echo $captcha['recaptcha']  ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
225
+                        <?php echo $captcha['recaptcha'] ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
226 226
                     </div>
227 227
                     <div class="note"><?php _e('panel', 'overview_note_recaptcha', 'Provided by Google.'); ?></div>
228 228
                 </div>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                 <div class="filter-status">
232 232
                     <div class="heading"><?php _e('panel', 'overview_label_image_captcha', 'Image Captcha'); ?></div>
233 233
                     <div class="nums">
234
-                        <?php echo $captcha['imagecaptcha']  ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
234
+                        <?php echo $captcha['imagecaptcha'] ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
235 235
                     </div>
236 236
                     <div class="note"><?php _e('panel', 'overview_note_image_captcha', 'A simple text-in-image Captcha.'); ?></div>
237 237
                 </div>
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 <div class="filter-status">
252 252
                     <div class="heading"><?php _e('panel', 'overview_label_' . $k, ''); ?></div>
253 253
                     <div class="nums">
254
-                        <?php echo $messengers[$k]  ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
254
+                        <?php echo $messengers[$k] ? '<i class="far fa-play-circle"></i>' : '<i class="far fa-stop-circle"></i>'; ?>
255 255
                     </div>
256 256
                     <div class="note"><?php _e('panel', 'overview_note_' . $k, ''); ?></div>
257 257
                 </div>
Please login to merge, or discard this patch.
src/Firewall/Kernel.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      * 
341 341
      * @return void
342 342
      */
343
-    public function __construct(?ServerRequestInterface $request  = null, ?ResponseInterface $response = null)
343
+    public function __construct(?ServerRequestInterface $request = null, ?ResponseInterface $response = null)
344 344
     {
345 345
         // Load helper functions. This is the must.
346 346
         new Helpers();
@@ -1648,10 +1648,10 @@  discard block
 block discarded – undo
1648 1648
 
1649 1649
         $ui = [
1650 1650
             'background_image' => $this->dialogUI['background_image'] ?? '',
1651
-            'bg_color'         => $this->dialogUI['bg_color']         ?? '#ffffff',
1652
-            'header_bg_color'  => $this->dialogUI['header_bg_color']  ?? '#212531',
1653
-            'header_color'     => $this->dialogUI['header_color']     ?? '#ffffff',
1654
-            'shadow_opacity'   => $this->dialogUI['shadow_opacity']   ?? '0.2',
1651
+            'bg_color'         => $this->dialogUI['bg_color'] ?? '#ffffff',
1652
+            'header_bg_color'  => $this->dialogUI['header_bg_color'] ?? '#212531',
1653
+            'header_color'     => $this->dialogUI['header_color'] ?? '#ffffff',
1654
+            'shadow_opacity'   => $this->dialogUI['shadow_opacity'] ?? '0.2',
1655 1655
         ];
1656 1656
 
1657 1657
         if (!defined('SHIELDON_VIEW')) {
Please login to merge, or discard this patch.
src/Firewall/Panel/Ajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
      *
49 49
      * @return bool
50 50
      */
51
-    public function  __call($function , $args)
51
+    public function  __call($function, $args)
52 52
     {
53 53
         $className = 'Shieldon\Firewall\Panel\Sandbox\\' . $function;
54 54
 
Please login to merge, or discard this patch.