@@ -881,7 +881,6 @@ discard block |
||
881 | 881 | $is_writable = true; |
882 | 882 | break; |
883 | 883 | } |
884 | - |
|
885 | 884 | else |
886 | 885 | { |
887 | 886 | // Convert the chmod value from octal (0777) to text ("777"). |
@@ -935,8 +934,9 @@ discard block |
||
935 | 934 | { |
936 | 935 | // Wait for a response that isn't continued with -, but don't wait too long. |
937 | 936 | $time = time(); |
938 | - do |
|
939 | - $this->last_message = fgets($this->connection, 1024); |
|
937 | + do { |
|
938 | + $this->last_message = fgets($this->connection, 1024); |
|
939 | + } |
|
940 | 940 | while ((strlen($this->last_message) < 4 || strpos($this->last_message, ' ') === 0 || strpos($this->last_message, ' ', 3) !== 3) && time() - $time < 5); |
941 | 941 | |
942 | 942 | // Was the desired response returned? |
@@ -957,8 +957,9 @@ discard block |
||
957 | 957 | // Request a passive connection - this means, we'll talk to you, you don't talk to us. |
958 | 958 | @fwrite($this->connection, 'PASV' . "\r\n"); |
959 | 959 | $time = time(); |
960 | - do |
|
961 | - $response = fgets($this->connection, 1024); |
|
960 | + do { |
|
961 | + $response = fgets($this->connection, 1024); |
|
962 | + } |
|
962 | 963 | while (strpos($response, ' ', 3) !== 3 && time() - $time < 5); |
963 | 964 | |
964 | 965 | // If it's not 227, we weren't given an IP and port, which means it failed. |
@@ -1080,8 +1081,9 @@ discard block |
||
1080 | 1081 | |
1081 | 1082 | @fwrite($this->connection, 'PWD' . "\r\n"); |
1082 | 1083 | $time = time(); |
1083 | - do |
|
1084 | - $response = fgets($this->connection, 1024); |
|
1084 | + do { |
|
1085 | + $response = fgets($this->connection, 1024); |
|
1086 | + } |
|
1085 | 1087 | while ($response[3] != ' ' && time() - $time < 5); |
1086 | 1088 | |
1087 | 1089 | // Check for 257! |
@@ -94,7 +94,8 @@ discard block |
||
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 |
||
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 |
||
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 | |
@@ -182,8 +192,10 @@ discard block |
||
182 | 192 | { |
183 | 193 | $input = strtolower($input); |
184 | 194 | $parts = explode('.', $input); |
185 | - foreach ($parts as &$part) { |
|
186 | - if (strpos($part, static::PREFIX) !== 0) { |
|
195 | + foreach ($parts as &$part) |
|
196 | + { |
|
197 | + if (strpos($part, static::PREFIX) !== 0) |
|
198 | + { |
|
187 | 199 | continue; |
188 | 200 | } |
189 | 201 | |
@@ -209,24 +221,30 @@ discard block |
||
209 | 221 | $output = ''; |
210 | 222 | |
211 | 223 | $pos = strrpos($input, static::DELIMITER); |
212 | - if ($pos !== false) { |
|
224 | + if ($pos !== false) |
|
225 | + { |
|
213 | 226 | $output = substr($input, 0, $pos++); |
214 | - } else { |
|
227 | + } |
|
228 | + else |
|
229 | + { |
|
215 | 230 | $pos = 0; |
216 | 231 | } |
217 | 232 | |
218 | 233 | $outputLength = strlen($output); |
219 | 234 | $inputLength = strlen($input); |
220 | - while ($pos < $inputLength) { |
|
235 | + while ($pos < $inputLength) |
|
236 | + { |
|
221 | 237 | $oldi = $i; |
222 | 238 | $w = 1; |
223 | 239 | |
224 | - for ($k = static::BASE;; $k += static::BASE) { |
|
240 | + for ($k = static::BASE;; $k += static::BASE) |
|
241 | + { |
|
225 | 242 | $digit = static::$decodeTable[$input[$pos++]]; |
226 | 243 | $i = $i + ($digit * $w); |
227 | 244 | $t = $this->calculateThreshold($k, $bias); |
228 | 245 | |
229 | - if ($digit < $t) { |
|
246 | + if ($digit < $t) |
|
247 | + { |
|
230 | 248 | break; |
231 | 249 | } |
232 | 250 | |
@@ -253,9 +271,12 @@ discard block |
||
253 | 271 | */ |
254 | 272 | protected function calculateThreshold($k, $bias) |
255 | 273 | { |
256 | - if ($k <= $bias + static::TMIN) { |
|
274 | + if ($k <= $bias + static::TMIN) |
|
275 | + { |
|
257 | 276 | return static::TMIN; |
258 | - } elseif ($k >= $bias + static::TMAX) { |
|
277 | + } |
|
278 | + elseif ($k >= $bias + static::TMAX) |
|
279 | + { |
|
259 | 280 | return static::TMAX; |
260 | 281 | } |
261 | 282 | return $k - $bias; |
@@ -279,7 +300,8 @@ discard block |
||
279 | 300 | $delta += (int) ($delta / $numPoints); |
280 | 301 | |
281 | 302 | $k = 0; |
282 | - while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) { |
|
303 | + while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) |
|
304 | + { |
|
283 | 305 | $delta = (int) ($delta / (static::BASE - static::TMIN)); |
284 | 306 | $k = $k + static::BASE; |
285 | 307 | } |
@@ -303,12 +325,16 @@ discard block |
||
303 | 325 | ); |
304 | 326 | |
305 | 327 | $length = mb_strlen($input, $this->encoding); |
306 | - for ($i = 0; $i < $length; $i++) { |
|
328 | + for ($i = 0; $i < $length; $i++) |
|
329 | + { |
|
307 | 330 | $char = mb_substr($input, $i, 1, $this->encoding); |
308 | 331 | $code = $this->charToCodePoint($char); |
309 | - if ($code < 128) { |
|
332 | + if ($code < 128) |
|
333 | + { |
|
310 | 334 | $codePoints['all'][] = $codePoints['basic'][] = $code; |
311 | - } else { |
|
335 | + } |
|
336 | + else |
|
337 | + { |
|
312 | 338 | $codePoints['all'][] = $codePoints['nonBasic'][] = $code; |
313 | 339 | } |
314 | 340 | } |
@@ -325,13 +351,20 @@ discard block |
||
325 | 351 | protected function charToCodePoint($char) |
326 | 352 | { |
327 | 353 | $code = ord($char[0]); |
328 | - if ($code < 128) { |
|
354 | + if ($code < 128) |
|
355 | + { |
|
329 | 356 | return $code; |
330 | - } elseif ($code < 224) { |
|
357 | + } |
|
358 | + elseif ($code < 224) |
|
359 | + { |
|
331 | 360 | return (($code - 192) * 64) + (ord($char[1]) - 128); |
332 | - } elseif ($code < 240) { |
|
361 | + } |
|
362 | + elseif ($code < 240) |
|
363 | + { |
|
333 | 364 | return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128); |
334 | - } else { |
|
365 | + } |
|
366 | + else |
|
367 | + { |
|
335 | 368 | return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128); |
336 | 369 | } |
337 | 370 | } |
@@ -344,13 +377,20 @@ discard block |
||
344 | 377 | */ |
345 | 378 | protected function codePointToChar($code) |
346 | 379 | { |
347 | - if ($code <= 0x7F) { |
|
380 | + if ($code <= 0x7F) |
|
381 | + { |
|
348 | 382 | return chr($code); |
349 | - } elseif ($code <= 0x7FF) { |
|
383 | + } |
|
384 | + elseif ($code <= 0x7FF) |
|
385 | + { |
|
350 | 386 | return chr(($code >> 6) + 192) . chr(($code & 63) + 128); |
351 | - } elseif ($code <= 0xFFFF) { |
|
387 | + } |
|
388 | + elseif ($code <= 0xFFFF) |
|
389 | + { |
|
352 | 390 | return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128); |
353 | - } else { |
|
391 | + } |
|
392 | + else |
|
393 | + { |
|
354 | 394 | return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128); |
355 | 395 | } |
356 | 396 | } |
@@ -1252,7 +1252,6 @@ |
||
1252 | 1252 | if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages']) |
1253 | 1253 | $pages .= ' <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>'; |
1254 | 1254 | } |
1255 | - |
|
1256 | 1255 | else |
1257 | 1256 | $pages = ''; |
1258 | 1257 |
@@ -440,7 +440,8 @@ |
||
440 | 440 | $ip_address = inet_pton($ip_address); |
441 | 441 | $cidr_network = inet_pton($cidr_network); |
442 | 442 | $binMask = str_repeat("f", $cidr_subnetmask / 4); |
443 | - switch ($cidr_subnetmask % 4) { |
|
443 | + switch ($cidr_subnetmask % 4) |
|
444 | + { |
|
444 | 445 | case 0: |
445 | 446 | break; |
446 | 447 | case 1: |
@@ -2291,7 +2291,6 @@ |
||
2291 | 2291 | list ($hookData['class'], $hookData['method']) = explode('::', $modFunc); |
2292 | 2292 | $hookData['pureFunc'] = $hookData['method']; |
2293 | 2293 | } |
2294 | - |
|
2295 | 2294 | else |
2296 | 2295 | $hookData['pureFunc'] = $modFunc; |
2297 | 2296 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Set a list of common functions. |
79 | 79 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
80 | 80 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
81 | - { |
|
81 | + { |
|
82 | 82 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
83 | 83 | return $string; |
84 | 84 | } : function($string) |
@@ -2131,7 +2131,6 @@ discard block |
||
2131 | 2131 | loadLanguage('index+Modifications'); |
2132 | 2132 | $context['template_layers'] = array(); |
2133 | 2133 | } |
2134 | - |
|
2135 | 2134 | else |
2136 | 2135 | { |
2137 | 2136 | // Custom templates to load, or just default? |
@@ -2510,14 +2509,12 @@ discard block |
||
2510 | 2509 | $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
2511 | 2510 | $filePath = $settings['default_theme_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
2512 | 2511 | } |
2513 | - |
|
2514 | 2512 | else |
2515 | 2513 | { |
2516 | 2514 | $fileUrl = false; |
2517 | 2515 | $filePath = false; |
2518 | 2516 | } |
2519 | 2517 | } |
2520 | - |
|
2521 | 2518 | else |
2522 | 2519 | { |
2523 | 2520 | $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -2618,14 +2615,12 @@ discard block |
||
2618 | 2615 | $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
2619 | 2616 | $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
2620 | 2617 | } |
2621 | - |
|
2622 | 2618 | else |
2623 | 2619 | { |
2624 | 2620 | $fileUrl = false; |
2625 | 2621 | $filePath = false; |
2626 | 2622 | } |
2627 | 2623 | } |
2628 | - |
|
2629 | 2624 | else |
2630 | 2625 | { |
2631 | 2626 | $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -849,7 +849,6 @@ |
||
849 | 849 | die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B"); |
850 | 850 | } |
851 | 851 | } |
852 | - |
|
853 | 852 | elseif ($_REQUEST['format'] === '.wav') |
854 | 853 | { |
855 | 854 | require_once($sourcedir . '/Subs-Sound.php'); |
@@ -756,7 +756,6 @@ |
||
756 | 756 | $groups[$row['id_group']]['num_members'] += $row['num_members']; |
757 | 757 | $smcFunc['db_free_result']($query); |
758 | 758 | } |
759 | - |
|
760 | 759 | else |
761 | 760 | { |
762 | 761 | $query = $smcFunc['db_query']('', ' |
@@ -253,9 +253,10 @@ discard block |
||
253 | 253 | |
254 | 254 | // Phar doesn't handle open_basedir restrictions very well and throws a PHP Warning. Ignore that. |
255 | 255 | set_error_handler(function($errno, $errstr, $errfile, $errline) |
256 | - { |
|
256 | + { |
|
257 | 257 | // error was suppressed with the @-operator |
258 | - if (0 === error_reporting()) { |
|
258 | + if (0 === error_reporting()) |
|
259 | + { |
|
259 | 260 | return false; |
260 | 261 | } |
261 | 262 | if (strpos($errstr, 'PharData::__construct(): open_basedir') === false) |
@@ -269,7 +270,7 @@ discard block |
||
269 | 270 | |
270 | 271 | // go though each file in the archive |
271 | 272 | foreach ($iterator as $file_info) |
272 | - { |
|
273 | + { |
|
273 | 274 | $i = $iterator->getSubPathname(); |
274 | 275 | // If this is a file, and it doesn't exist.... happy days! |
275 | 276 | if (substr($i, -1) != '/' && !file_exists($destination . '/' . $i)) |