Passed
Pull Request — release-2.1 (#6274)
by Mathias
05:20
created
Themes/default/Calendar.template.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,7 +425,8 @@  discard block
 block discarded – undo
425 425
 					if (!empty($day['events']))
426 426
 					{
427 427
 						// Sort events by start time (all day events will be listed first)
428
-						uasort($day['events'], function($a, $b) {
428
+						uasort($day['events'], function($a, $b)
429
+						{
429 430
 							if ($a['start_timestamp'] == $b['start_timestamp'])
430 431
 								return 0;
431 432
 
@@ -619,7 +620,8 @@  discard block
 block discarded – undo
619 620
 			if (!empty($day['events']))
620 621
 			{
621 622
 				// Sort events by start time (all day events will be listed first)
622
-				uasort($day['events'], function($a, $b) {
623
+				uasort($day['events'], function($a, $b)
624
+				{
623 625
 					if ($a['start_timestamp'] == $b['start_timestamp'])
624 626
 						return 0;
625 627
 					return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1;
Please login to merge, or discard this patch.
Sources/Subs-Editor.php 1 patch
Braces   -3 removed lines patch added patch discarded remove patch
@@ -332,7 +332,6 @@  discard block
 block discarded – undo
332 332
 					$replacement .= $precedingStyle . $extra_attr . $afterStyle;
333 333
 			}
334 334
 		}
335
-
336 335
 		elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1)
337 336
 		{
338 337
 			// Is this the element that we've been waiting for to be closed?
@@ -592,7 +591,6 @@  discard block
 block discarded – undo
592 591
 							$parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]';
593 592
 							$parts[$i + 3] = '';
594 593
 						}
595
-
596 594
 						else
597 595
 						{
598 596
 							// We're in a list item.
@@ -631,7 +629,6 @@  discard block
 block discarded – undo
631 629
 							$parts[$i + 2] = '';
632 630
 							$parts[$i + 3] = '';
633 631
 						}
634
-
635 632
 						else
636 633
 						{
637 634
 							// Remove the trailing breaks from the list item.
Please login to merge, or discard this patch.
Sources/Class-Punycode.php 1 patch
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,7 +94,8 @@  discard block
 block discarded – undo
94 94
 	{
95 95
 		$input = mb_strtolower($input, $this->encoding);
96 96
 		$parts = explode('.', $input);
97
-		foreach ($parts as &$part) {
97
+		foreach ($parts as &$part)
98
+		{
98 99
 			$part = $this->encodePart($part);
99 100
 		}
100 101
 		$output = implode('.', $parts);
@@ -119,13 +120,16 @@  discard block
 block discarded – undo
119 120
 		$h = $b = count($codePoints['basic']);
120 121
 
121 122
 		$output = '';
122
-		foreach ($codePoints['basic'] as $code) {
123
+		foreach ($codePoints['basic'] as $code)
124
+		{
123 125
 			$output .= $this->codePointToChar($code);
124 126
 		}
125
-		if ($input === $output) {
127
+		if ($input === $output)
128
+		{
126 129
 			return $output;
127 130
 		}
128
-		if ($b > 0) {
131
+		if ($b > 0)
132
+		{
129 133
 			$output .= static::DELIMITER;
130 134
 		}
131 135
 
@@ -134,20 +138,26 @@  discard block
 block discarded – undo
134 138
 
135 139
 		$i = 0;
136 140
 		$length = mb_strlen($input, $this->encoding);
137
-		while ($h < $length) {
141
+		while ($h < $length)
142
+		{
138 143
 			$m = $codePoints['nonBasic'][$i++];
139 144
 			$delta = $delta + ($m - $n) * ($h + 1);
140 145
 			$n = $m;
141 146
 
142
-			foreach ($codePoints['all'] as $c) {
143
-				if ($c < $n || $c < static::INITIAL_N) {
147
+			foreach ($codePoints['all'] as $c)
148
+			{
149
+				if ($c < $n || $c < static::INITIAL_N)
150
+				{
144 151
 					$delta++;
145 152
 				}
146
-				if ($c === $n) {
153
+				if ($c === $n)
154
+				{
147 155
 					$q = $delta;
148
-					for ($k = static::BASE;; $k += static::BASE) {
156
+					for ($k = static::BASE;; $k += static::BASE)
157
+					{
149 158
 						$t = $this->calculateThreshold($k, $bias);
150
-						if ($q < $t) {
159
+						if ($q < $t)
160
+						{
151 161
 							break;
152 162
 						}
153 163
 
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_mcrypt.php 1 patch
Braces   +9 added lines, -4 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
      * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32 33
      *
@@ -41,16 +42,20 @@  discard block
 block discarded – undo
41 42
      */
42 43
     function random_bytes($bytes)
43 44
     {
44
-        try {
45
+        try
46
+        {
45 47
             /** @var int $bytes */
46 48
             $bytes = RandomCompat_intval($bytes);
47
-        } catch (TypeError $ex) {
49
+        }
50
+        catch (TypeError $ex)
51
+        {
48 52
             throw new TypeError(
49 53
                 'random_bytes(): $bytes must be an integer'
50 54
             );
51 55
         }
52 56
 
53
-        if ($bytes < 1) {
57
+        if ($bytes < 1)
58
+        {
54 59
             throw new Error(
55 60
                 'Length must be greater than 0'
56 61
             );
Please login to merge, or discard this patch.
Sources/random_compat/byte_safe_strings.php 1 patch
Braces   +35 added lines, -16 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('RandomCompat_strlen')) {
29
+if (!is_callable('RandomCompat_strlen'))
30
+{
30 31
     if (
31 32
         defined('MB_OVERLOAD_STRING')
32 33
             &&
@@ -46,7 +47,8 @@  discard block
 block discarded – undo
46 47
          */
47 48
         function RandomCompat_strlen($binary_string)
48 49
         {
49
-            if (!is_string($binary_string)) {
50
+            if (!is_string($binary_string))
51
+            {
50 52
                 throw new TypeError(
51 53
                     'RandomCompat_strlen() expects a string'
52 54
                 );
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
             return (int) mb_strlen($binary_string, '8bit');
56 58
         }
57 59
 
58
-    } else {
60
+    }
61
+    else
62
+    {
59 63
         /**
60 64
          * strlen() implementation that isn't brittle to mbstring.func_overload
61 65
          *
@@ -69,7 +73,8 @@  discard block
 block discarded – undo
69 73
          */
70 74
         function RandomCompat_strlen($binary_string)
71 75
         {
72
-            if (!is_string($binary_string)) {
76
+            if (!is_string($binary_string))
77
+            {
73 78
                 throw new TypeError(
74 79
                     'RandomCompat_strlen() expects a string'
75 80
                 );
@@ -79,7 +84,8 @@  discard block
 block discarded – undo
79 84
     }
80 85
 }
81 86
 
82
-if (!is_callable('RandomCompat_substr')) {
87
+if (!is_callable('RandomCompat_substr'))
88
+{
83 89
 
84 90
     if (
85 91
         defined('MB_OVERLOAD_STRING')
@@ -102,36 +108,43 @@  discard block
 block discarded – undo
102 108
          */
103 109
         function RandomCompat_substr($binary_string, $start, $length = null)
104 110
         {
105
-            if (!is_string($binary_string)) {
111
+            if (!is_string($binary_string))
112
+            {
106 113
                 throw new TypeError(
107 114
                     'RandomCompat_substr(): First argument should be a string'
108 115
                 );
109 116
             }
110 117
 
111
-            if (!is_int($start)) {
118
+            if (!is_int($start))
119
+            {
112 120
                 throw new TypeError(
113 121
                     'RandomCompat_substr(): Second argument should be an integer'
114 122
                 );
115 123
             }
116 124
 
117
-            if ($length === null) {
125
+            if ($length === null)
126
+            {
118 127
                 /**
119 128
                  * mb_substr($str, 0, NULL, '8bit') returns an empty string on
120 129
                  * PHP 5.3, so we have to find the length ourselves.
121 130
                  */
122 131
                 /** @var int $length */
123 132
                 $length = RandomCompat_strlen($binary_string) - $start;
124
-            } elseif (!is_int($length)) {
133
+            }
134
+            elseif (!is_int($length))
135
+            {
125 136
                 throw new TypeError(
126 137
                     'RandomCompat_substr(): Third argument should be an integer, or omitted'
127 138
                 );
128 139
             }
129 140
 
130 141
             // Consistency with PHP's behavior
131
-            if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
142
+            if ($start === RandomCompat_strlen($binary_string) && $length === 0)
143
+            {
132 144
                 return '';
133 145
             }
134
-            if ($start > RandomCompat_strlen($binary_string)) {
146
+            if ($start > RandomCompat_strlen($binary_string))
147
+            {
135 148
                 return '';
136 149
             }
137 150
 
@@ -143,7 +156,9 @@  discard block
 block discarded – undo
143 156
             );
144 157
         }
145 158
 
146
-    } else {
159
+    }
160
+    else
161
+    {
147 162
 
148 163
         /**
149 164
          * substr() implementation that isn't brittle to mbstring.func_overload
@@ -160,20 +175,24 @@  discard block
 block discarded – undo
160 175
          */
161 176
         function RandomCompat_substr($binary_string, $start, $length = null)
162 177
         {
163
-            if (!is_string($binary_string)) {
178
+            if (!is_string($binary_string))
179
+            {
164 180
                 throw new TypeError(
165 181
                     'RandomCompat_substr(): First argument should be a string'
166 182
                 );
167 183
             }
168 184
 
169
-            if (!is_int($start)) {
185
+            if (!is_int($start))
186
+            {
170 187
                 throw new TypeError(
171 188
                     'RandomCompat_substr(): Second argument should be an integer'
172 189
                 );
173 190
             }
174 191
 
175
-            if ($length !== null) {
176
-                if (!is_int($length)) {
192
+            if ($length !== null)
193
+            {
194
+                if (!is_int($length))
195
+                {
177 196
                     throw new TypeError(
178 197
                         'RandomCompat_substr(): Third argument should be an integer, or omitted'
179 198
                     );
Please login to merge, or discard this patch.
Sources/random_compat/random_int.php 1 patch
Braces   +29 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!is_callable('random_int')) {
3
+if (!is_callable('random_int'))
4
+{
4 5
     /**
5 6
      * Random_* Compatibility Library
6 7
      * for using the new PHP 7 random_* API in PHP 5 projects
@@ -50,19 +51,25 @@  discard block
 block discarded – undo
50 51
          * through.
51 52
          */
52 53
 
53
-        try {
54
+        try
55
+        {
54 56
             /** @var int $min */
55 57
             $min = RandomCompat_intval($min);
56
-        } catch (TypeError $ex) {
58
+        }
59
+        catch (TypeError $ex)
60
+        {
57 61
             throw new TypeError(
58 62
                 'random_int(): $min must be an integer'
59 63
             );
60 64
         }
61 65
 
62
-        try {
66
+        try
67
+        {
63 68
             /** @var int $max */
64 69
             $max = RandomCompat_intval($max);
65
-        } catch (TypeError $ex) {
70
+        }
71
+        catch (TypeError $ex)
72
+        {
66 73
             throw new TypeError(
67 74
                 'random_int(): $max must be an integer'
68 75
             );
@@ -73,13 +80,15 @@  discard block
 block discarded – undo
73 80
          * let's validate the logic then we can move forward with generating random
74 81
          * integers along a given range.
75 82
          */
76
-        if ($min > $max) {
83
+        if ($min > $max)
84
+        {
77 85
             throw new Error(
78 86
                 'Minimum value must be less than or equal to the maximum value'
79 87
             );
80 88
         }
81 89
 
82
-        if ($max === $min) {
90
+        if ($max === $min)
91
+        {
83 92
             return (int) $min;
84 93
         }
85 94
 
@@ -110,7 +119,8 @@  discard block
 block discarded – undo
110 119
         /**
111 120
          * Test for integer overflow:
112 121
          */
113
-        if (!is_int($range)) {
122
+        if (!is_int($range))
123
+        {
114 124
 
115 125
             /**
116 126
              * Still safely calculate wider ranges.
@@ -127,14 +137,18 @@  discard block
 block discarded – undo
127 137
             /** @var int $mask */
128 138
             $mask = ~0;
129 139
 
130
-        } else {
140
+        }
141
+        else
142
+        {
131 143
 
132 144
             /**
133 145
              * $bits is effectively ceil(log($range, 2)) without dealing with
134 146
              * type juggling
135 147
              */
136
-            while ($range > 0) {
137
-                if ($bits % 8 === 0) {
148
+            while ($range > 0)
149
+            {
150
+                if ($bits % 8 === 0)
151
+                {
138 152
                     ++$bytes;
139 153
                 }
140 154
                 ++$bits;
@@ -157,7 +171,8 @@  discard block
 block discarded – undo
157 171
              * The rejection probability is at most 0.5, so this corresponds
158 172
              * to a failure probability of 2^-128 for a working RNG
159 173
              */
160
-            if ($attempts > 128) {
174
+            if ($attempts > 128)
175
+            {
161 176
                 throw new Exception(
162 177
                     'random_int: RNG is broken - too many rejections'
163 178
                 );
@@ -179,7 +194,8 @@  discard block
 block discarded – undo
179 194
              *   204631455
180 195
              */
181 196
             $val &= 0;
182
-            for ($i = 0; $i < $bytes; ++$i) {
197
+            for ($i = 0; $i < $bytes; ++$i)
198
+            {
183 199
                 $val |= ord($randomByteString[$i]) << ($i * 8);
184 200
             }
185 201
             /** @var int $val */
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_com_dotnet.php 1 patch
Braces   +13 added lines, -6 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
      * Windows with PHP < 5.3.0 will not have the function
32 33
      * openssl_random_pseudo_bytes() available, so let's use
@@ -40,16 +41,20 @@  discard block
 block discarded – undo
40 41
      */
41 42
     function random_bytes($bytes)
42 43
     {
43
-        try {
44
+        try
45
+        {
44 46
             /** @var int $bytes */
45 47
             $bytes = RandomCompat_intval($bytes);
46
-        } catch (TypeError $ex) {
48
+        }
49
+        catch (TypeError $ex)
50
+        {
47 51
             throw new TypeError(
48 52
                 'random_bytes(): $bytes must be an integer'
49 53
             );
50 54
         }
51 55
 
52
-        if ($bytes < 1) {
56
+        if ($bytes < 1)
57
+        {
53 58
             throw new Error(
54 59
                 'Length must be greater than 0'
55 60
             );
@@ -57,7 +62,8 @@  discard block
 block discarded – undo
57 62
 
58 63
         /** @var string $buf */
59 64
         $buf = '';
60
-        if (!class_exists('COM')) {
65
+        if (!class_exists('COM'))
66
+        {
61 67
             throw new Error(
62 68
                 'COM does not exist'
63 69
             );
@@ -72,7 +78,8 @@  discard block
 block discarded – undo
72 78
          */
73 79
         do {
74 80
             $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
-            if (RandomCompat_strlen($buf) >= $bytes) {
81
+            if (RandomCompat_strlen($buf) >= $bytes)
82
+            {
76 83
                 /**
77 84
                  * Return our random entropy buffer here:
78 85
                  */
Please login to merge, or discard this patch.
Sources/random_compat/error_polyfill.php 1 patch
Braces   +9 added lines, -4 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 (!class_exists('Error', false)) {
29
+if (!class_exists('Error', false))
30
+{
30 31
     // We can't really avoid making this extend Exception in PHP 5.
31 32
     class Error extends Exception
32 33
     {
@@ -34,13 +35,17 @@  discard block
 block discarded – undo
34 35
     }
35 36
 }
36 37
 
37
-if (!class_exists('TypeError', false)) {
38
-    if (is_subclass_of('Error', 'Exception')) {
38
+if (!class_exists('TypeError', false))
39
+{
40
+    if (is_subclass_of('Error', 'Exception'))
41
+    {
39 42
         class TypeError extends Error
40 43
         {
41 44
             
42 45
         }
43
-    } else {
46
+    }
47
+    else
48
+    {
44 49
         class TypeError extends Exception
45 50
         {
46 51
             
Please login to merge, or discard this patch.
Sources/random_compat/random.php 1 patch
Braces   +35 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
  * SOFTWARE.
30 30
  */
31 31
 
32
-if (!defined('PHP_VERSION_ID')) {
32
+if (!defined('PHP_VERSION_ID'))
33
+{
33 34
     // This constant was introduced in PHP 5.2.7
34 35
     $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION));
35 36
     define(
@@ -44,11 +45,13 @@  discard block
 block discarded – undo
44 45
 /**
45 46
  * PHP 7.0.0 and newer have these functions natively.
46 47
  */
47
-if (PHP_VERSION_ID >= 70000) {
48
+if (PHP_VERSION_ID >= 70000)
49
+{
48 50
     return;
49 51
 }
50 52
 
51
-if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
53
+if (!defined('RANDOM_COMPAT_READ_BUFFER'))
54
+{
52 55
     define('RANDOM_COMPAT_READ_BUFFER', 8);
53 56
 }
54 57
 
@@ -58,7 +61,8 @@  discard block
 block discarded – undo
58 61
 require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php';
59 62
 require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php';
60 63
 
61
-if (!is_callable('random_bytes')) {
64
+if (!is_callable('random_bytes'))
65
+{
62 66
     /**
63 67
      * PHP 5.2.0 - 5.6.x way to implement random_bytes()
64 68
      *
@@ -73,11 +77,15 @@  discard block
 block discarded – undo
73 77
      *
74 78
      * See RATIONALE.md for our reasoning behind this particular order
75 79
      */
76
-    if (extension_loaded('libsodium')) {
80
+    if (extension_loaded('libsodium'))
81
+    {
77 82
         // See random_bytes_libsodium.php
78
-        if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
83
+        if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf'))
84
+        {
79 85
             require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php';
80
-        } elseif (method_exists('Sodium', 'randombytes_buf')) {
86
+        }
87
+        elseif (method_exists('Sodium', 'randombytes_buf'))
88
+        {
81 89
             require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php';
82 90
         }
83 91
     }
@@ -85,13 +93,15 @@  discard block
 block discarded – undo
85 93
     /**
86 94
      * Reading directly from /dev/urandom:
87 95
      */
88
-    if (DIRECTORY_SEPARATOR === '/') {
96
+    if (DIRECTORY_SEPARATOR === '/')
97
+    {
89 98
         // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
90 99
         // way to exclude Windows.
91 100
         $RandomCompatUrandom = true;
92 101
         $RandomCompat_basedir = ini_get('open_basedir');
93 102
 
94
-        if (!empty($RandomCompat_basedir)) {
103
+        if (!empty($RandomCompat_basedir))
104
+        {
95 105
             $RandomCompat_open_basedir = explode(
96 106
                 PATH_SEPARATOR,
97 107
                 strtolower($RandomCompat_basedir)
@@ -121,7 +131,9 @@  discard block
 block discarded – undo
121 131
         }
122 132
         // Unset variables after use
123 133
         $RandomCompat_basedir = null;
124
-    } else {
134
+    }
135
+    else
136
+    {
125 137
         $RandomCompatUrandom = false;
126 138
     }
127 139
 
@@ -179,14 +191,19 @@  discard block
 block discarded – undo
179 191
             strtolower(ini_get('disable_classes'))
180 192
         );
181 193
 
182
-        if (!in_array('com', $RandomCompat_disabled_classes)) {
183
-            try {
194
+        if (!in_array('com', $RandomCompat_disabled_classes))
195
+        {
196
+            try
197
+            {
184 198
                 $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
185
-                if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
199
+                if (method_exists($RandomCompatCOMtest, 'GetRandom'))
200
+                {
186 201
                     // See random_bytes_com_dotnet.php
187 202
                     require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php';
188 203
                 }
189
-            } catch (com_exception $e) {
204
+            }
205
+            catch (com_exception $e)
206
+            {
190 207
                 // Don't try to use it.
191 208
             }
192 209
         }
@@ -197,7 +214,8 @@  discard block
 block discarded – undo
197 214
     /**
198 215
      * throw new Exception
199 216
      */
200
-    if (!is_callable('random_bytes')) {
217
+    if (!is_callable('random_bytes'))
218
+    {
201 219
         /**
202 220
          * We don't have any more options, so let's throw an exception right now
203 221
          * and hope the developer won't let it fail silently.
@@ -218,7 +236,8 @@  discard block
 block discarded – undo
218 236
     }
219 237
 }
220 238
 
221
-if (!is_callable('random_int')) {
239
+if (!is_callable('random_int'))
240
+{
222 241
     require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php';
223 242
 }
224 243
 
Please login to merge, or discard this patch.