Passed
Pull Request — release-2.1 (#6274)
by Mathias
05:20
created
Sources/random_compat/random_bytes_libsodium_legacy.php 1 patch
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('random_bytes')) {
29
+if (!is_callable('random_bytes'))
30
+{
30 31
     /**
31 32
      * If the libsodium PHP extension is loaded, we'll use it above any other
32 33
      * solution.
@@ -42,16 +43,20 @@  discard block
 block discarded – undo
42 43
      */
43 44
     function random_bytes($bytes)
44 45
     {
45
-        try {
46
+        try
47
+        {
46 48
             /** @var int $bytes */
47 49
             $bytes = RandomCompat_intval($bytes);
48
-        } catch (TypeError $ex) {
50
+        }
51
+        catch (TypeError $ex)
52
+        {
49 53
             throw new TypeError(
50 54
                 'random_bytes(): $bytes must be an integer'
51 55
             );
52 56
         }
53 57
 
54
-        if ($bytes < 1) {
58
+        if ($bytes < 1)
59
+        {
55 60
             throw new Error(
56 61
                 'Length must be greater than 0'
57 62
             );
@@ -66,19 +71,25 @@  discard block
 block discarded – undo
66 71
          * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
67 72
          * generated in one invocation.
68 73
          */
69
-        if ($bytes > 2147483647) {
70
-            for ($i = 0; $i < $bytes; $i += 1073741824) {
74
+        if ($bytes > 2147483647)
75
+        {
76
+            for ($i = 0; $i < $bytes; $i += 1073741824)
77
+            {
71 78
                 $n = ($bytes - $i) > 1073741824
72 79
                     ? 1073741824
73 80
                     : $bytes - $i;
74 81
                 $buf .= Sodium::randombytes_buf((int) $n);
75 82
             }
76
-        } else {
83
+        }
84
+        else
85
+        {
77 86
             $buf .= Sodium::randombytes_buf((int) $bytes);
78 87
         }
79 88
 
80
-        if (is_string($buf)) {
81
-            if (RandomCompat_strlen($buf) === $bytes) {
89
+        if (is_string($buf))
90
+        {
91
+            if (RandomCompat_strlen($buf) === $bytes)
92
+            {
82 93
                 return $buf;
83 94
             }
84 95
         }
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_libsodium.php 1 patch
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('random_bytes')) {
29
+if (!is_callable('random_bytes'))
30
+{
30 31
     /**
31 32
      * If the libsodium PHP extension is loaded, we'll use it above any other
32 33
      * solution.
@@ -42,16 +43,20 @@  discard block
 block discarded – undo
42 43
      */
43 44
     function random_bytes($bytes)
44 45
     {
45
-        try {
46
+        try
47
+        {
46 48
             /** @var int $bytes */
47 49
             $bytes = RandomCompat_intval($bytes);
48
-        } catch (TypeError $ex) {
50
+        }
51
+        catch (TypeError $ex)
52
+        {
49 53
             throw new TypeError(
50 54
                 'random_bytes(): $bytes must be an integer'
51 55
             );
52 56
         }
53 57
 
54
-        if ($bytes < 1) {
58
+        if ($bytes < 1)
59
+        {
55 60
             throw new Error(
56 61
                 'Length must be greater than 0'
57 62
             );
@@ -62,21 +67,27 @@  discard block
 block discarded – undo
62 67
          * generated in one invocation.
63 68
          */
64 69
         /** @var string|bool $buf */
65
-        if ($bytes > 2147483647) {
70
+        if ($bytes > 2147483647)
71
+        {
66 72
             $buf = '';
67
-            for ($i = 0; $i < $bytes; $i += 1073741824) {
73
+            for ($i = 0; $i < $bytes; $i += 1073741824)
74
+            {
68 75
                 $n = ($bytes - $i) > 1073741824
69 76
                     ? 1073741824
70 77
                     : $bytes - $i;
71 78
                 $buf .= \Sodium\randombytes_buf($n);
72 79
             }
73
-        } else {
80
+        }
81
+        else
82
+        {
74 83
             /** @var string|bool $buf */
75 84
             $buf = \Sodium\randombytes_buf($bytes);
76 85
         }
77 86
 
78
-        if (is_string($buf)) {
79
-            if (RandomCompat_strlen($buf) === $bytes) {
87
+        if (is_string($buf))
88
+        {
89
+            if (RandomCompat_strlen($buf) === $bytes)
90
+            {
80 91
                 return $buf;
81 92
             }
82 93
         }
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -742,7 +742,7 @@
 block discarded – undo
742 742
 
743 743
 	// Filter out any redundant separators before we start the loop
744 744
 	$context['config_vars'] = array_filter($context['config_vars'], function ($v) use ($context)
745
-		{
745
+	{
746 746
 			static $config_vars, $prev;
747 747
 
748 748
 			$at_start = is_null($config_vars);
Please login to merge, or discard this patch.
Sources/ManageSmileys.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1965,7 +1965,9 @@
 block discarded – undo
1965 1965
 	// Remove anything that isn't actually new from our list of files
1966 1966
 	foreach ($to_unset as $key => $ids)
1967 1967
 	{
1968
-		if (array_reduce($ids, function ($carry, $item) { return $carry * $item; }, true) == true)
1968
+		if (array_reduce($ids, function ($carry, $item)
1969
+		{
1970
+return $carry * $item; }, true) == true)
1969 1971
 			unset($smiley_files[$key]);
1970 1972
 	}
1971 1973
 
Please login to merge, or discard this patch.
Sources/Subs-Post.php 1 patch
Braces   -1 removed lines patch added patch discarded remove patch
@@ -1254,7 +1254,6 @@
 block discarded – undo
1254 1254
 
1255 1255
 		return array($charset, $string, 'base64');
1256 1256
 	}
1257
-
1258 1257
 	else
1259 1258
 		return array($charset, $string, '7bit');
1260 1259
 }
Please login to merge, or discard this patch.
other/upgrade.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3205,7 +3205,9 @@
 block discarded – undo
3205 3205
 		return $string;
3206 3206
 
3207 3207
 	// This bit fixes incorrect string lengths, which can happen if the character encoding was changed (e.g. conversion to UTF-8)
3208
-	$new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function ($matches) {return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';}, $string);
3208
+	$new_string = preg_replace_callback('~\bs:(\d+):"(.*?)";(?=$|[bidsa]:|[{}]|N;)~s', function ($matches)
3209
+	{
3210
+return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';}, $string);
3209 3211
 
3210 3212
 	// @todo Add more possible fixes here. For example, fix incorrect array lengths, try to handle truncated strings gracefully, etc.
3211 3213
 
Please login to merge, or discard this patch.
Sources/ManagePermissions.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1824,7 +1824,7 @@
 block discarded – undo
1824 1824
 	{
1825 1825
 		// Make sure this is an array of integers
1826 1826
 		$excluded_groups = array_filter((array) $excluded_groups, function ($v)
1827
-			{
1827
+		{
1828 1828
 				return is_int($v) || is_string($v) && (string) intval($v) === $v;
1829 1829
 			});
1830 1830
 
Please login to merge, or discard this patch.
Themes/default/GenericControls.template.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -100,18 +100,22 @@
 block discarded – undo
100 100
 	$tempTab++;
101 101
 	$context['tabindex'] = $tempTab;
102 102
 
103
-	foreach ($context['richedit_buttons'] as $name => $button) {
104
-		if ($name == 'spell_check') {
103
+	foreach ($context['richedit_buttons'] as $name => $button)
104
+	{
105
+		if ($name == 'spell_check')
106
+		{
105 107
 			$button['onclick'] = 'oEditorHandle_' . $editor_id . '.spellCheckStart();';
106 108
 		}
107 109
 
108
-		if ($name == 'preview') {
110
+		if ($name == 'preview')
111
+		{
109 112
 			$button['value'] = isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $button['value'];
110 113
 			$button['onclick'] = $editor_context['preview_type'] == 2 ? '' : 'return submitThisOnce(this);';
111 114
 			$button['show'] = $editor_context['preview_type'];
112 115
 		}
113 116
 
114
-		if ($button['show']) {
117
+		if ($button['show'])
118
+		{
115 119
 			echo '
116 120
 		<input type="', $button['type'], '"', $button['type'] == 'hidden' ? ' id="' . $name . '"' : '', ' name="', $name, '" value="', $button['value'], '"', $button['type'] != 'hidden' ? ' tabindex="' . --$tempTab . '"' : '', !empty($button['onclick']) ? ' onclick="' . $button['onclick'] . '"' : '', !empty($button['accessKey']) ? ' accesskey="' . $button['accessKey'] . '"' : '', $button['type'] != 'hidden' ? ' class="button"' : '', '>';
117 121
 		}
Please login to merge, or discard this patch.
Sources/Security.php 1 patch
Braces   -4 removed lines patch added patch discarded remove patch
@@ -1257,7 +1257,6 @@  discard block
 block discarded – undo
1257 1257
 
1258 1258
 			continue;
1259 1259
 		}
1260
-
1261 1260
 		else
1262 1261
 		{
1263 1262
 			$fh = @fopen($path . '/.htaccess', 'w');
@@ -1269,7 +1268,6 @@  discard block
 block discarded – undo
1269 1268
 	Deny from all' . $close);
1270 1269
 				fclose($fh);
1271 1270
 			}
1272
-
1273 1271
 			else
1274 1272
 				$errors[] = 'htaccess_cannot_create_file';
1275 1273
 		}
@@ -1280,7 +1278,6 @@  discard block
 block discarded – undo
1280 1278
 
1281 1279
 			continue;
1282 1280
 		}
1283
-
1284 1281
 		else
1285 1282
 		{
1286 1283
 			$fh = @fopen($path . '/index.php', 'w');
@@ -1307,7 +1304,6 @@  discard block
 block discarded – undo
1307 1304
 ?' . '>');
1308 1305
 				fclose($fh);
1309 1306
 			}
1310
-
1311 1307
 			else
1312 1308
 				$errors[] = 'index-php_cannot_create_file';
1313 1309
 		}
Please login to merge, or discard this patch.