Passed
Push — 2.x ( ed3db8...f88ed3 )
by Terry
01:57
created
src/Firewall/Security/Xss.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
         $this->deniedRegexList = [
91 91
             'javascript\s*:',
92
-            '\bon\w+=\S+(?=.*>)',       // Inline JavaScript.
92
+            '\bon\w+=\S+(?=.*>)', // Inline JavaScript.
93 93
             '(document|(document\.)?window)\.(location|on\w*)',
94 94
             'expression\s*(\(|&\#40;)', // CSS and IE
95
-            'vbscript\s*:',             // IE, surprise!
96
-            'wscript\s*:',              // IE
97
-            'jscript\s*:',              // IE
98
-            'vbs\s*:',                  // IE
95
+            'vbscript\s*:', // IE, surprise!
96
+            'wscript\s*:', // IE
97
+            'jscript\s*:', // IE
98
+            'vbs\s*:', // IE
99 99
             'Redirect\s+30\d:',
100 100
             "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?",
101 101
         ];
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
          */
223 223
         $words = [
224 224
             'javascript', 'expression', 'vbscript', 'jscript', 'wscript',
225
-            'vbs',        'script',     'base64',   'applet',  'alert', 
226
-            'document',   'write',      'cookie',   'window',  'confirm',
227
-            'prompt',     'eval',
225
+            'vbs', 'script', 'base64', 'applet', 'alert', 
226
+            'document', 'write', 'cookie', 'window', 'confirm',
227
+            'prompt', 'eval',
228 228
         ];
229 229
 
230 230
         foreach ($words as $word) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                 );
280 280
             }
281 281
 
282
-        } while($original !== $str);
282
+        } while ($original !== $str);
283 283
 
284 284
         unset($original);
285 285
 
@@ -581,17 +581,17 @@  discard block
 block discarded – undo
581 581
             "'", '"', '&', '$', '#',
582 582
             '{', '}', '[', ']', '=',
583 583
             ';', '?', '%20', '%22',
584
-            '%3c',		// <
585
-            '%253c',	// <
586
-            '%3e',		// >
587
-            '%0e',		// >
588
-            '%28',		// (
589
-            '%29',		// )
590
-            '%2528',	// (
591
-            '%26',		// &
592
-            '%24',		// $
593
-            '%3f',		// ?
594
-            '%3b',		// ;
584
+            '%3c', // <
585
+            '%253c', // <
586
+            '%3e', // >
587
+            '%0e', // >
588
+            '%28', // (
589
+            '%29', // )
590
+            '%2528', // (
591
+            '%26', // &
592
+            '%24', // $
593
+            '%3f', // ?
594
+            '%3b', // ;
595 595
             '%3d'		// =
596 596
         ];
597 597
 
@@ -637,19 +637,19 @@  discard block
 block discarded – undo
637 637
     protected function sanitizeNaughtyHtml(array $matches): string
638 638
     {
639 639
         static $naughtyTags = [
640
-            'alert',    'prompt', 'confirm',    'applet',  'audio',
641
-            'basefont', 'base',   'behavior',   'bgsound', 'blink', 
642
-            'body',     'embed',  'expression', 'form',    'frameset', 
643
-            'frame',    'head',   'html',       'ilayer',  'iframe', 
644
-            'input',    'button', 'select',     'isindex', 'layer', 
645
-            'link',     'meta',   'keygen',     'object',  'plaintext',
646
-            'style',    'script', 'textarea',   'title',   'math',
647
-            'video',    'svg',    'xml',        'xss',
640
+            'alert', 'prompt', 'confirm', 'applet', 'audio',
641
+            'basefont', 'base', 'behavior', 'bgsound', 'blink', 
642
+            'body', 'embed', 'expression', 'form', 'frameset', 
643
+            'frame', 'head', 'html', 'ilayer', 'iframe', 
644
+            'input', 'button', 'select', 'isindex', 'layer', 
645
+            'link', 'meta', 'keygen', 'object', 'plaintext',
646
+            'style', 'script', 'textarea', 'title', 'math',
647
+            'video', 'svg', 'xml', 'xss',
648 648
         ];
649 649
 
650 650
         static $evilAttributes = [
651
-            'on\w+', 'style',      'xmlns',     'seekSegmentTime', 
652
-            'form',  'xlink:href', 'FSCommand', 'formaction',
651
+            'on\w+', 'style', 'xmlns', 'seekSegmentTime', 
652
+            'form', 'xlink:href', 'FSCommand', 'formaction',
653 653
         ];
654 654
 
655 655
         // First, escape unclosed tags
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 
707 707
             $attributes = empty($attributes)
708 708
                 ? ''
709
-                : ' '.implode(' ', $attributes);
709
+                : ' ' . implode(' ', $attributes);
710 710
             return '<' . $matches['slash'] . $matches['tagName'] . $attributes . '>';
711 711
         }
712 712
 
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/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.
src/Firewall/Panel/Home.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -236,11 +236,11 @@
 block discarded – undo
236 236
     private function overviewTemplateVarsOfComponents(array $data = []): array
237 237
     {
238 238
         $data['components'] = [
239
-            'Ip'         => (!empty($this->kernel->component['Ip']))         ? true : false,
239
+            'Ip'         => (!empty($this->kernel->component['Ip'])) ? true : false,
240 240
             'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false,
241
-            'Header'     => (!empty($this->kernel->component['Header']))     ? true : false,
242
-            'Rdns'       => (!empty($this->kernel->component['Rdns']))       ? true : false,
243
-            'UserAgent'  => (!empty($this->kernel->component['UserAgent']))  ? true : false,
241
+            'Header'     => (!empty($this->kernel->component['Header'])) ? true : false,
242
+            'Rdns'       => (!empty($this->kernel->component['Rdns'])) ? true : false,
243
+            'UserAgent'  => (!empty($this->kernel->component['UserAgent'])) ? true : false,
244 244
         ];
245 245
 
246 246
         return $data;
Please login to merge, or discard this patch.
src/Firewall/Panel/Report.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 $data['period_data'] = $ipDetailsCachedData['period_data'];
128 128
                 $lastCachedTime = date('Y-m-d H:i:s', $ipDetailsCachedData['time']);
129 129
     
130
-                if ('today' === $type ) {
130
+                if ('today' === $type) {
131 131
                     $ipDetailsCachedData = $logCacheHandler->get('past_seven_hours');
132 132
                     $data['past_seven_hours'] = $ipDetailsCachedData['period_data'];
133 133
                 }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 $logCacheHandler->save($type, $data);
143 143
     
144
-                if ('today' === $type ) {
144
+                if ('today' === $type) {
145 145
                     $this->parser->prepare('past_seven_hours');
146 146
                     $data['past_seven_hours'] = $this->parser->getParsedPeriodData();
147 147
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
     private function operationTemplateVarsOfComponents(array $data = []): array
173 173
     {
174 174
         $data['components'] = [
175
-            'Ip'         => (!empty($this->kernel->component['Ip']))         ? true : false,
175
+            'Ip'         => (!empty($this->kernel->component['Ip'])) ? true : false,
176 176
             'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false,
177
-            'Header'     => (!empty($this->kernel->component['Header']))     ? true : false,
178
-            'Rdns'       => (!empty($this->kernel->component['Rdns']))       ? true : false,
179
-            'UserAgent'  => (!empty($this->kernel->component['UserAgent']))  ? true : false,
177
+            'Header'     => (!empty($this->kernel->component['Header'])) ? true : false,
178
+            'Rdns'       => (!empty($this->kernel->component['Rdns'])) ? true : false,
179
+            'UserAgent'  => (!empty($this->kernel->component['UserAgent'])) ? true : false,
180 180
         ];
181 181
 
182 182
         return $data;
Please login to merge, or discard this patch.
templates/panel/template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 if (
98 98
     isset($_SERVER['HTTP_HOST']) && 
99 99
     strpos($_SERVER['HTTP_HOST'], 'project.lo') !== false
100
-)  {
100
+) {
101 101
     // `shieldon-doc.lo` is the virtual domain that Terry is using to design CSS for Firewall Panel UI.
102 102
     $staticSrc = 'http://shieldon-doc.lo/static';
103 103
 }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 </div>
331 331
             </div>
332 332
         </div>
333
-        <?php if (! empty($this->messages)) : ?>
333
+        <?php if (!empty($this->messages)) : ?>
334 334
         <div id="message-modal" class="modal fade" tabindex="-1" role="dialog">
335 335
             <div class="modal-dialog modal-dialog-centered modal-lightbox" role="document">
336 336
                 <div class="modal-content">
Please login to merge, or discard this patch.