@@ -389,7 +389,9 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | foreach ($xml_data as $item) |
| 391 | 391 | { |
| 392 | - $link = array_filter($item['content'], function ($e) { return ($e['tag'] == 'link'); }); |
|
| 392 | + $link = array_filter($item['content'], function ($e) |
|
| 393 | + { |
|
| 394 | +return ($e['tag'] == 'link'); }); |
|
| 393 | 395 | $link = array_pop($link); |
| 394 | 396 | |
| 395 | 397 | echo ' |
@@ -446,7 +448,7 @@ discard block |
||
| 446 | 448 | return $val; |
| 447 | 449 | |
| 448 | 450 | $val = preg_replace_callback('~\b' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+)(#[^"]*)?$~', function($m) use ($scripturl) |
| 449 | - { |
|
| 451 | + { |
|
| 450 | 452 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? $m[2] : ""); |
| 451 | 453 | }, $val); |
| 452 | 454 | return $val; |
@@ -867,7 +869,8 @@ discard block |
||
| 867 | 869 | // Sort the attachments by size to make things easier below |
| 868 | 870 | if (!empty($loaded_attachments)) |
| 869 | 871 | { |
| 870 | - uasort($loaded_attachments, function($a, $b) { |
|
| 872 | + uasort($loaded_attachments, function($a, $b) |
|
| 873 | + { |
|
| 871 | 874 | if ($a['filesize'] == $b['filesize']) |
| 872 | 875 | return 0; |
| 873 | 876 | return ($a['filesize'] < $b['filesize']) ? -1 : 1; |
@@ -1283,7 +1286,8 @@ discard block |
||
| 1283 | 1286 | // Sort the attachments by size to make things easier below |
| 1284 | 1287 | if (!empty($loaded_attachments)) |
| 1285 | 1288 | { |
| 1286 | - uasort($loaded_attachments, function($a, $b) { |
|
| 1289 | + uasort($loaded_attachments, function($a, $b) |
|
| 1290 | + { |
|
| 1287 | 1291 | if ($a['filesize'] == $b['filesize']) |
| 1288 | 1292 | return 0; |
| 1289 | 1293 | return ($a['filesize'] < $b['filesize']) ? -1 : 1; |
@@ -1281,7 +1281,9 @@ |
||
| 1281 | 1281 | // File Upload. |
| 1282 | 1282 | if ($context['can_post_attachment']) |
| 1283 | 1283 | { |
| 1284 | - $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) { return '.' . $smcFunc['htmltrim']($val); } , explode(',', $context['allowed_extensions']))); |
|
| 1284 | + $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) |
|
| 1285 | + { |
|
| 1286 | +return '.' . $smcFunc['htmltrim']($val); } , explode(',', $context['allowed_extensions']))); |
|
| 1285 | 1287 | |
| 1286 | 1288 | loadJavaScriptFile('dropzone.min.js', array('defer' => true), 'smf_dropzone'); |
| 1287 | 1289 | loadJavaScriptFile('smf_fileUpload.js', array('defer' => true, 'minimize' => true), 'smf_fileUpload'); |
@@ -222,7 +222,6 @@ |
||
| 222 | 222 | |
| 223 | 223 | $this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content')); |
| 224 | 224 | } |
| 225 | - |
|
| 226 | 225 | else |
| 227 | 226 | { |
| 228 | 227 | // Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1 |
@@ -332,7 +332,6 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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. |
@@ -1112,7 +1109,8 @@ discard block |
||
| 1112 | 1109 | $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
| 1113 | 1110 | |
| 1114 | 1111 | // Need to sort the tags by name length. |
| 1115 | - uksort($valid_tags, function ($a, $b) { |
|
| 1112 | + uksort($valid_tags, function ($a, $b) |
|
| 1113 | + { |
|
| 1116 | 1114 | return strlen($a) < strlen($b) ? 1 : -1; |
| 1117 | 1115 | }); |
| 1118 | 1116 | |
@@ -1980,7 +1978,7 @@ discard block |
||
| 1980 | 1978 | |
| 1981 | 1979 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
| 1982 | 1980 | array_walk_recursive($context['smileys'], function (&$filename, $key) |
| 1983 | - { |
|
| 1981 | + { |
|
| 1984 | 1982 | global $context, $user_info, $modSettings; |
| 1985 | 1983 | if ($key == 'filename') |
| 1986 | 1984 | // Need to use the default if user selection is disabled |
@@ -199,7 +199,6 @@ |
||
| 199 | 199 | list ($context['attachments']['quantity'], $context['attachments']['total_size']) = $smcFunc['db_fetch_row']($request); |
| 200 | 200 | $smcFunc['db_free_result']($request); |
| 201 | 201 | } |
| 202 | - |
|
| 203 | 202 | else |
| 204 | 203 | $context['attachments'] = array( |
| 205 | 204 | 'quantity' => 0, |
@@ -99,7 +99,8 @@ |
||
| 99 | 99 | if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0) |
| 100 | 100 | { |
| 101 | 101 | $db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string); |
| 102 | - if ($smcFunc['db_support_ignore']){ |
|
| 102 | + if ($smcFunc['db_support_ignore']) |
|
| 103 | + { |
|
| 103 | 104 | //pg style "INSERT INTO.... ON CONFLICT DO NOTHING" |
| 104 | 105 | $db_string = $db_string.' ON CONFLICT DO NOTHING'; |
| 105 | 106 | } |
@@ -93,7 +93,6 @@ |
||
| 93 | 93 | |
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | - |
|
| 97 | 96 | elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
| 98 | 97 | { |
| 99 | 98 | // Just increase the stats and don't add this hidden user to any list. |
@@ -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 | } |