@@ -223,7 +223,8 @@ discard block |
||
223 | 223 | checkSession('get'); |
224 | 224 | validateToken('admin-msm', 'get'); |
225 | 225 | |
226 | - if ($db_type == 'postgresql') { |
|
226 | + if ($db_type == 'postgresql') |
|
227 | + { |
|
227 | 228 | $smcFunc['db_query']('', ' |
228 | 229 | DROP INDEX IF EXISTS {db_prefix}messages_ftx', |
229 | 230 | array( |
@@ -787,7 +788,8 @@ discard block |
||
787 | 788 | // We need this for db_get_version |
788 | 789 | db_extend(); |
789 | 790 | |
790 | - if ($smcFunc['db_title'] == 'PostgreSQL') { |
|
791 | + if ($smcFunc['db_title'] == 'PostgreSQL') |
|
792 | + { |
|
791 | 793 | $request = $smcFunc['db_query']('', ' |
792 | 794 | SELECT |
793 | 795 | indexname |
@@ -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'); |
@@ -64,7 +64,8 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->buildLookup(); |
66 | 66 | |
67 | - if ($initKey !== null) { |
|
67 | + if ($initKey !== null) |
|
68 | + { |
|
68 | 69 | $this->setInitKey($initKey); |
69 | 70 | } |
70 | 71 | } |
@@ -98,7 +99,8 @@ discard block |
||
98 | 99 | */ |
99 | 100 | public function setRange($range) |
100 | 101 | { |
101 | - if (!is_numeric($range)) { |
|
102 | + if (!is_numeric($range)) |
|
103 | + { |
|
102 | 104 | throw new \InvalidArgumentException('Invalid window range'); |
103 | 105 | } |
104 | 106 | $this->range = $range; |
@@ -114,7 +116,8 @@ discard block |
||
114 | 116 | */ |
115 | 117 | public function setInitKey($key) |
116 | 118 | { |
117 | - if (preg_match('/^[' . implode('', array_keys($this->getLookup())) . ']+$/', $key) == false) { |
|
119 | + if (preg_match('/^[' . implode('', array_keys($this->getLookup())) . ']+$/', $key) == false) |
|
120 | + { |
|
118 | 121 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
119 | 122 | } |
120 | 123 | $this->initKey = $key; |
@@ -140,7 +143,8 @@ discard block |
||
140 | 143 | */ |
141 | 144 | public function setLookup($lookup) |
142 | 145 | { |
143 | - if (!is_array($lookup)) { |
|
146 | + if (!is_array($lookup)) |
|
147 | + { |
|
144 | 148 | throw new \InvalidArgumentException('Lookup value must be an array'); |
145 | 149 | } |
146 | 150 | $this->lookup = $lookup; |
@@ -176,7 +180,8 @@ discard block |
||
176 | 180 | */ |
177 | 181 | public function setRefresh($seconds) |
178 | 182 | { |
179 | - if (!is_numeric($seconds)) { |
|
183 | + if (!is_numeric($seconds)) |
|
184 | + { |
|
180 | 185 | throw new \InvalidArgumentException('Seconds must be numeric'); |
181 | 186 | } |
182 | 187 | $this->refreshSeconds = $seconds; |
@@ -217,7 +222,8 @@ discard block |
||
217 | 222 | */ |
218 | 223 | public function validateCode($code, $initKey = null, $timestamp = null, $range = null) |
219 | 224 | { |
220 | - if (strlen($code) !== $this->getCodeLength()) { |
|
225 | + if (strlen($code) !== $this->getCodeLength()) |
|
226 | + { |
|
221 | 227 | throw new \InvalidArgumentException('Incorrect code length'); |
222 | 228 | } |
223 | 229 | |
@@ -227,8 +233,10 @@ discard block |
||
227 | 233 | |
228 | 234 | $binary = $this->base32_decode($initKey); |
229 | 235 | |
230 | - for ($time = ($timestamp - $range); $time <= ($timestamp + $range); $time++) { |
|
231 | - if ($this->generateOneTime($binary, $time) == $code) { |
|
236 | + for ($time = ($timestamp - $range); $time <= ($timestamp + $range); $time++) |
|
237 | + { |
|
238 | + if ($this->generateOneTime($binary, $time) == $code) |
|
239 | + { |
|
232 | 240 | return true; |
233 | 241 | } |
234 | 242 | } |
@@ -269,7 +277,8 @@ discard block |
||
269 | 277 | $lookup = implode('', array_keys($this->getLookup())); |
270 | 278 | $code = ''; |
271 | 279 | |
272 | - for ($i = 0; $i < $length; $i++) { |
|
280 | + for ($i = 0; $i < $length; $i++) |
|
281 | + { |
|
273 | 282 | $code .= $lookup[mt_rand(0, strlen($lookup) - 1)]; |
274 | 283 | } |
275 | 284 | |
@@ -315,7 +324,8 @@ discard block |
||
315 | 324 | { |
316 | 325 | $lookup = $this->getLookup(); |
317 | 326 | |
318 | - if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) { |
|
327 | + if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) |
|
328 | + { |
|
319 | 329 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
320 | 330 | } |
321 | 331 | |
@@ -324,12 +334,14 @@ discard block |
||
324 | 334 | $length = 0; |
325 | 335 | $binary = ''; |
326 | 336 | |
327 | - for ($i = 0; $i < strlen($hash); $i++) { |
|
337 | + for ($i = 0; $i < strlen($hash); $i++) |
|
338 | + { |
|
328 | 339 | $buffer = $buffer << 5; |
329 | 340 | $buffer += $lookup[$hash[$i]]; |
330 | 341 | $length += 5; |
331 | 342 | |
332 | - if ($length >= 8) { |
|
343 | + if ($length >= 8) |
|
344 | + { |
|
333 | 345 | $length -= 8; |
334 | 346 | $binary .= chr(($buffer & (0xFF << $length)) >> $length); |
335 | 347 | } |
@@ -302,7 +302,6 @@ discard block |
||
302 | 302 | $condition = 'id_member IN ({array_int:members})'; |
303 | 303 | $parameters['members'] = $members; |
304 | 304 | } |
305 | - |
|
306 | 305 | elseif ($members === null) |
307 | 306 | $condition = '1=1'; |
308 | 307 | |
@@ -1739,7 +1738,7 @@ discard block |
||
1739 | 1738 | 'before' => '<span style="text-shadow: $1 $2">', |
1740 | 1739 | 'after' => '</span>', |
1741 | 1740 | 'validate' => function(&$tag, &$data, $disabled) |
1742 | - { |
|
1741 | + { |
|
1743 | 1742 | |
1744 | 1743 | if ($data[1] == 'top' || (is_numeric($data[1]) && $data[1] < 50)) |
1745 | 1744 | $data[1] = '0 -2px 1px'; |
@@ -1901,7 +1900,8 @@ discard block |
||
1901 | 1900 | { |
1902 | 1901 | if (isset($temp_bbc)) |
1903 | 1902 | $bbc_codes = $temp_bbc; |
1904 | - usort($codes, function ($a, $b) { |
|
1903 | + usort($codes, function ($a, $b) |
|
1904 | + { |
|
1905 | 1905 | return strcmp($a['tag'], $b['tag']); |
1906 | 1906 | }); |
1907 | 1907 | return $codes; |
@@ -2185,7 +2185,8 @@ discard block |
||
2185 | 2185 | )? |
2186 | 2186 | '; |
2187 | 2187 | |
2188 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
2188 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) |
|
2189 | + { |
|
2189 | 2190 | $url = array_shift($matches); |
2190 | 2191 | |
2191 | 2192 | // If this isn't a clean URL, bail out |
@@ -2274,7 +2275,9 @@ discard block |
||
2274 | 2275 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
2275 | 2276 | |
2276 | 2277 | // A closing tag that doesn't match any open tags? Skip it. |
2277 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
2278 | + if (!in_array($look_for, array_map(function($code) |
|
2279 | + { |
|
2280 | +return $code['tag'];}, $open_tags))) |
|
2278 | 2281 | continue; |
2279 | 2282 | |
2280 | 2283 | $to_close = array(); |
@@ -3759,7 +3762,6 @@ discard block |
||
3759 | 3762 | if (!isset($minSeed) && isset($js_file['options']['seed'])) |
3760 | 3763 | $minSeed = $js_file['options']['seed']; |
3761 | 3764 | } |
3762 | - |
|
3763 | 3765 | else |
3764 | 3766 | echo ' |
3765 | 3767 | <script src="', $js_file['fileUrl'], '"', !empty($js_file['options']['async']) ? ' async' : '', !empty($js_file['options']['defer']) ? ' defer' : '', '></script>'; |
@@ -3909,7 +3911,9 @@ discard block |
||
3909 | 3911 | return $data; |
3910 | 3912 | |
3911 | 3913 | // Different pages include different files, so we use a hash to label the different combinations |
3912 | - $hash = md5(implode(' ', array_map(function($file) { return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data))); |
|
3914 | + $hash = md5(implode(' ', array_map(function($file) |
|
3915 | + { |
|
3916 | +return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data))); |
|
3913 | 3917 | |
3914 | 3918 | // Did we already do this? |
3915 | 3919 | list($toCache, $async, $defer) = array_pad((array) cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type . '_' . $hash, 86400), 3, null); |
@@ -5914,7 +5918,6 @@ discard block |
||
5914 | 5918 | $isWritable = true; |
5915 | 5919 | break; |
5916 | 5920 | } |
5917 | - |
|
5918 | 5921 | else |
5919 | 5922 | @chmod($file, $val); |
5920 | 5923 | } |
@@ -6084,7 +6087,8 @@ discard block |
||
6084 | 6087 | if (!empty($tlds)) |
6085 | 6088 | { |
6086 | 6089 | // Clean $tlds and convert it to an array |
6087 | - $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) { |
|
6090 | + $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) |
|
6091 | + { |
|
6088 | 6092 | $line = trim($line); |
6089 | 6093 | if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false) |
6090 | 6094 | return false; |
@@ -6095,7 +6099,9 @@ discard block |
||
6095 | 6099 | // Convert Punycode to Unicode |
6096 | 6100 | require_once($sourcedir . '/Class-Punycode.php'); |
6097 | 6101 | $Punycode = new Punycode(); |
6098 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
6102 | + $tlds = array_map(function ($input) use ($Punycode) |
|
6103 | + { |
|
6104 | +return $Punycode->decode($input); }, $tlds); |
|
6099 | 6105 | } |
6100 | 6106 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
6101 | 6107 | else |
@@ -6262,7 +6268,8 @@ discard block |
||
6262 | 6268 | } |
6263 | 6269 | |
6264 | 6270 | // Sort by key length and then alphabetically |
6265 | - uksort($regex, function($k1, $k2) use (&$strlen) { |
|
6271 | + uksort($regex, function($k1, $k2) use (&$strlen) |
|
6272 | + { |
|
6266 | 6273 | $l1 = $strlen($k1); |
6267 | 6274 | $l2 = $strlen($k2); |
6268 | 6275 | |
@@ -6516,7 +6523,8 @@ discard block |
||
6516 | 6523 | function sanitize_iri($iri) |
6517 | 6524 | { |
6518 | 6525 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
6519 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
6526 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) |
|
6527 | + { |
|
6520 | 6528 | return rawurlencode($matches[0]); |
6521 | 6529 | }, $iri); |
6522 | 6530 |
@@ -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 | } |