Passed
Push — 2.x ( b17bf1...77d60a )
by Terry
01:46
created
src/Firewall/Driver/SqliteDriver.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
         parent::__construct($pdo, $debug);
28 28
     }
29 29
 
30
-      /**
31
-     * Create SQL tables that Shieldon needs.
32
-     *
33
-     * @return bool
34
-     */
30
+        /**
31
+         * Create SQL tables that Shieldon needs.
32
+         *
33
+         * @return bool
34
+         */
35 35
     protected function installSql(): bool
36 36
     {
37 37
         try {
Please login to merge, or discard this patch.
src/Firewall/Component/Ip.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $ip = $ipData[0];
258 258
         $cidr = (int) $ipData[1] ?? 32;
259 259
 
260
-		$result[0] = long2ip((ip2long($ip)) & ((-1 << (32 - $cidr))));
260
+        $result[0] = long2ip((ip2long($ip)) & ((-1 << (32 - $cidr))));
261 261
         $result[1] = long2ip((ip2long($ip)) + pow(2, (32 - $cidr)) - 1);
262 262
 
263 263
         if ($isDecimal) {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             $result[1] = ip2long($result[1]);
266 266
         }
267 267
 
268
-		return $result;
268
+        return $result;
269 269
     }
270 270
 
271 271
     /**
Please login to merge, or discard this patch.
src/Firewall/Security/Xss.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 use function time;
36 36
 use function version_compare;
37 37
 
38
- /**
39
-  * Cross-Site Scripting protection.
40
-  */
38
+    /**
39
+     * Cross-Site Scripting protection.
40
+     */
41 41
 class Xss
42 42
 {
43 43
     /**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         unset($original);
285 285
 
286 286
         // Remove evil attributes such as style, onclick and xmlns
287
-		$str = $this->removeEvilAttributes($str, $isImage);
287
+        $str = $this->removeEvilAttributes($str, $isImage);
288 288
 
289 289
         /*
290 290
          * Sanitize naughty HTML elements
@@ -448,62 +448,62 @@  discard block
 block discarded – undo
448 448
 	 * @param boolean $is_image TRUE if this is an image
449 449
 	 * @return string The string with the evil attributes removed
450 450
 	 */
451
-	protected function removeEvilAttributes($str, $is_image)
452
-	{
453
-		// All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns
454
-		$evilAttributes = array('on\w*', 'style', 'xmlns', 'formaction', 'form', 'xlink:href');
451
+    protected function removeEvilAttributes($str, $is_image)
452
+    {
453
+        // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns
454
+        $evilAttributes = array('on\w*', 'style', 'xmlns', 'formaction', 'form', 'xlink:href');
455 455
 
456
-		if ($is_image) {
457
-			/*
456
+        if ($is_image) {
457
+            /*
458 458
 			 * Adobe Photoshop puts XML metadata into JFIF images,
459 459
 			 * including namespacing, so we have to allow this for images.
460 460
 			 */
461
-			unset($evilAttributes[array_search('xmlns', $evilAttributes)]);
462
-		}
461
+            unset($evilAttributes[array_search('xmlns', $evilAttributes)]);
462
+        }
463 463
 
464
-		do {
465
-			$count = 0;
466
-			$attribs = array();
464
+        do {
465
+            $count = 0;
466
+            $attribs = array();
467 467
 
468
-			// find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
469
-			preg_match_all(
468
+            // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
469
+            preg_match_all(
470 470
                 '/(?<!\w)(' . implode('|', $evilAttributes) . ')\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is',
471 471
                 $str,
472 472
                 $matches,
473 473
                 PREG_SET_ORDER
474 474
             );
475 475
 
476
-			foreach ($matches as $attr) {
477
-				$attribs[] = preg_quote($attr[0], '/');
478
-			}
476
+            foreach ($matches as $attr) {
477
+                $attribs[] = preg_quote($attr[0], '/');
478
+            }
479 479
 
480
-			// find occurrences of illegal attribute strings without quotes
481
-			preg_match_all(
480
+            // find occurrences of illegal attribute strings without quotes
481
+            preg_match_all(
482 482
                 '/(?<!\w)(' . implode('|', $evilAttributes) . ')\s*=\s*([^\s>]*)/is',
483 483
                 $str,
484 484
                 $matches,
485 485
                 PREG_SET_ORDER
486 486
             );
487 487
 
488
-			foreach ($matches as $attr) {
489
-				$attribs[] = preg_quote($attr[0], '/');
490
-			}
488
+            foreach ($matches as $attr) {
489
+                $attribs[] = preg_quote($attr[0], '/');
490
+            }
491 491
 
492
-			// replace illegal attribute strings that are inside an html tag
493
-			if (count($attribs) > 0) {
494
-				$str = preg_replace(
492
+            // replace illegal attribute strings that are inside an html tag
493
+            if (count($attribs) > 0) {
494
+                $str = preg_replace(
495 495
                     '/(<?)(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(' . implode('|', $attribs) . ')(.*?)([\s><]?)([><]*)/i',
496 496
                     '$1$2 $4$6$7$8',
497 497
                     $str,
498 498
                     -1,
499 499
                     $count
500 500
                 );
501
-			}
501
+            }
502 502
 
503
-		} while ($count);
503
+        } while ($count);
504 504
 
505
-		return $str;
506
-	}
505
+        return $str;
506
+    }
507 507
 
508 508
     /**
509 509
      * Random Hash for protecting URLs
@@ -856,16 +856,16 @@  discard block
 block discarded – undo
856 856
      * @return bool
857 857
      */
858 858
     protected function isPHP($version): bool
859
-	{
859
+    {
860 860
         static $_isPHP;
861 861
 
862
-		$version = (string) $version;
862
+        $version = (string) $version;
863 863
 
864
-		if (!isset($_isPHP[$version])) {
865
-			$_isPHP[$version] = version_compare(PHP_VERSION, $version, '>=');
866
-		}
864
+        if (!isset($_isPHP[$version])) {
865
+            $_isPHP[$version] = version_compare(PHP_VERSION, $version, '>=');
866
+        }
867 867
 
868
-		return $_isPHP[$version];
869
-	}
868
+        return $_isPHP[$version];
869
+    }
870 870
 }
871 871
 
Please login to merge, or discard this patch.
src/Firewall/Driver/SqlDriverProvider.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
         return $results;
150 150
     }
151 151
 
152
-   /**
152
+    /**
153 153
      * {@inheritDoc}
154 154
      */
155 155
     protected function doFetchAll(string $type = 'filter'): array
Please login to merge, or discard this patch.