@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // Set a list of common functions. |
105 | 105 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
106 | 106 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
107 | - { |
|
107 | + { |
|
108 | 108 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
109 | 109 | return $string; |
110 | 110 | } : function($string) |
@@ -929,7 +929,6 @@ discard block |
||
929 | 929 | $user_info_min[$row['id_member']]['time_offset'] = ($tz_user->getOffset($time_user) - |
930 | 930 | $tz_system->getOffset($time_system)) / 3600; |
931 | 931 | } |
932 | - |
|
933 | 932 | else |
934 | 933 | $user_info_min[$row['id_member']]['time_offset'] = empty($row['time_offset']) ? 0 : $row['time_offset']; |
935 | 934 | } |
@@ -1657,7 +1656,6 @@ discard block |
||
1657 | 1656 | $time_user = new DateTime('now', $tz_user); |
1658 | 1657 | $profile['time_offset'] = ($tz_user->getOffset($time_user) - $tz_system->getOffset($time_system)) / 3600; |
1659 | 1658 | } |
1660 | - |
|
1661 | 1659 | else |
1662 | 1660 | { |
1663 | 1661 | // !!! Compatibility. |
@@ -2322,7 +2320,6 @@ discard block |
||
2322 | 2320 | loadLanguage('index+Modifications'); |
2323 | 2321 | $context['template_layers'] = array(); |
2324 | 2322 | } |
2325 | - |
|
2326 | 2323 | else |
2327 | 2324 | { |
2328 | 2325 | // Custom templates to load, or just default? |
@@ -78,7 +78,8 @@ discard block |
||
78 | 78 | $db_passwd = str_replace(array('\\','\''), array('\\\\','\\\''), $db_passwd); |
79 | 79 | |
80 | 80 | // Since pg_connect doesn't feed error info to pg_last_error, we have to catch issues with a try/catch. |
81 | - set_error_handler(function($errno, $errstr) { |
|
81 | + set_error_handler(function($errno, $errstr) |
|
82 | + { |
|
82 | 83 | throw new ErrorException($errstr, $errno);}); |
83 | 84 | try |
84 | 85 | { |
@@ -939,7 +940,8 @@ discard block |
||
939 | 940 | $error_array[2] = null; |
940 | 941 | |
941 | 942 | if(empty($db_persist)) |
942 | - { // without pooling |
|
943 | + { |
|
944 | +// without pooling |
|
943 | 945 | if (empty($pg_error_data_prep)) |
944 | 946 | $pg_error_data_prep = pg_prepare($db_connection, 'smf_log_errors', |
945 | 947 | 'INSERT INTO ' . $db_prefix . 'log_errors |
@@ -950,7 +952,8 @@ discard block |
||
950 | 952 | pg_execute($db_connection, 'smf_log_errors', $error_array); |
951 | 953 | } |
952 | 954 | else |
953 | - { //with pooling |
|
955 | + { |
|
956 | +//with pooling |
|
954 | 957 | $pg_error_data_prep = pg_prepare($db_connection, '', |
955 | 958 | 'INSERT INTO ' . $db_prefix . 'log_errors |
956 | 959 | (id_member, log_time, ip, url, message, session, error_type, file, line, backtrace) |
@@ -280,7 +280,6 @@ discard block |
||
280 | 280 | $this_category[$row_board['id_board']]['board_class'] = 'on'; |
281 | 281 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts']; |
282 | 282 | } |
283 | - |
|
284 | 283 | else |
285 | 284 | { |
286 | 285 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts']; |
@@ -415,7 +414,6 @@ discard block |
||
415 | 414 | $this_last_post['href'] = $scripturl . '?topic=' . $row_board['id_topic'] . '.msg' . ($user_info['is_guest'] ? $row_board['id_msg'] : $row_board['new_from']) . (empty($row_board['is_read']) ? ';boardseen' : '') . '#new'; |
416 | 415 | $this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>'; |
417 | 416 | } |
418 | - |
|
419 | 417 | else |
420 | 418 | { |
421 | 419 | $this_last_post['href'] = ''; |
@@ -510,8 +508,7 @@ discard block |
||
510 | 508 | $board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']); |
511 | 509 | } |
512 | 510 | } |
513 | - |
|
514 | - else |
|
511 | + else |
|
515 | 512 | foreach ($this_category as &$board) |
516 | 513 | { |
517 | 514 | if (isset($boards_parsed_data_by_cat_id[$board['id_cat']][$board['id']])) |
@@ -359,7 +359,8 @@ |
||
359 | 359 | call_integration_hook('integrate_fetch_alerts', array(&$alerts, &$formats)); |
360 | 360 | |
361 | 361 | // Substitute $scripturl into the link formats. (Done here to make life easier for hooked mods.) |
362 | - $formats = array_map(function ($format) use ($scripturl) { |
|
362 | + $formats = array_map(function ($format) use ($scripturl) |
|
363 | + { |
|
363 | 364 | $format['link'] = str_replace('{scripturl}', $scripturl, $format['link']); |
364 | 365 | $format['text'] = str_replace('{scripturl}', $scripturl, $format['text']); |
365 | 366 |
@@ -1704,7 +1704,8 @@ |
||
1704 | 1704 | // Missing, but we have a fallback. |
1705 | 1705 | else |
1706 | 1706 | { |
1707 | - usort($fallbacks[$tzid], function ($a, $b) { |
|
1707 | + usort($fallbacks[$tzid], function ($a, $b) |
|
1708 | + { |
|
1708 | 1709 | return $a['ts'] > $b['ts']; |
1709 | 1710 | }); |
1710 | 1711 |
@@ -807,7 +807,8 @@ |
||
807 | 807 | { |
808 | 808 | $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = $txt[$new_url['label']]; |
809 | 809 | $context['spider_logs']['rows'][$k]['data']['viewing']['class'] = $new_url['class']; |
810 | - } else |
|
810 | + } |
|
811 | + else |
|
811 | 812 | $context['spider_logs']['rows'][$k]['data']['viewing']['value'] = $new_url; |
812 | 813 | } |
813 | 814 | } |
@@ -280,7 +280,6 @@ discard block |
||
280 | 280 | $condition = 'id_member IN ({array_int:members})'; |
281 | 281 | $parameters['members'] = $members; |
282 | 282 | } |
283 | - |
|
284 | 283 | elseif ($members === null) |
285 | 284 | $condition = '1=1'; |
286 | 285 | |
@@ -383,11 +382,9 @@ discard block |
||
383 | 382 | $val = $val . ' END'; |
384 | 383 | $type = 'raw'; |
385 | 384 | } |
386 | - |
|
387 | 385 | else |
388 | 386 | $val = alert_count($members, true); |
389 | 387 | } |
390 | - |
|
391 | 388 | elseif ($type == 'int' && ($val === '+' || $val === '-')) |
392 | 389 | { |
393 | 390 | $val = $var . ' ' . $val . ' 1'; |
@@ -2174,12 +2171,12 @@ discard block |
||
2174 | 2171 | 'tag' => 'cowsay', |
2175 | 2172 | 'parameters' => array( |
2176 | 2173 | 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
2177 | - { |
|
2174 | + { |
|
2178 | 2175 | return $smcFunc['substr']($eyes . 'oo', 0, 2); |
2179 | 2176 | }, |
2180 | 2177 | ), |
2181 | 2178 | 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function ($tongue) use ($smcFunc) |
2182 | - { |
|
2179 | + { |
|
2183 | 2180 | return $smcFunc['substr']($tongue . ' ', 0, 2); |
2184 | 2181 | }, |
2185 | 2182 | ), |
@@ -2504,7 +2501,8 @@ discard block |
||
2504 | 2501 | |
2505 | 2502 | foreach (array('path', 'query', 'fragment') as $part) |
2506 | 2503 | { |
2507 | - switch ($part) { |
|
2504 | + switch ($part) |
|
2505 | + { |
|
2508 | 2506 | case 'path': |
2509 | 2507 | $part_disallowed_chars = '<>' . $bracket_quote_chars . $space_chars . $excluded_trailing_chars . '/#&'; |
2510 | 2508 | $part_excluded_trailing_chars = str_replace('?', '', $excluded_trailing_chars); |
@@ -3534,7 +3532,7 @@ discard block |
||
3534 | 3532 | |
3535 | 3533 | // Replace away! |
3536 | 3534 | $message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements) |
3537 | - { |
|
3535 | + { |
|
3538 | 3536 | return $smileyPregReplacements[$matches[1]]; |
3539 | 3537 | }, $message); |
3540 | 3538 | } |
@@ -4345,7 +4343,6 @@ discard block |
||
4345 | 4343 | if (!isset($minSeed) && isset($js_file['options']['seed'])) |
4346 | 4344 | $minSeed = $js_file['options']['seed']; |
4347 | 4345 | } |
4348 | - |
|
4349 | 4346 | else |
4350 | 4347 | { |
4351 | 4348 | echo ' |
@@ -6268,7 +6265,8 @@ discard block |
||
6268 | 6265 | $zones[$tzkey]['tzid'] = $tzid; |
6269 | 6266 | $zones[$tzkey]['dst_type'] = count($tzinfo) > 1 ? 1 : ($tzinfo[0]['isdst'] ? 2 : 0); |
6270 | 6267 | |
6271 | - foreach ($tzinfo as $transition) { |
|
6268 | + foreach ($tzinfo as $transition) |
|
6269 | + { |
|
6272 | 6270 | $zones[$tzkey]['abbrs'][] = $transition['abbr']; |
6273 | 6271 | } |
6274 | 6272 | |
@@ -6353,7 +6351,8 @@ discard block |
||
6353 | 6351 | $desc = implode(', ', array_slice(array_unique($tzvalue['locations']), 0, 5)) . (count($tzvalue['locations']) > 5 ? ', ' . $txt['etc'] : ''); |
6354 | 6352 | |
6355 | 6353 | // We don't want abbreviations like '+03' or '-11'. |
6356 | - $abbrs = array_filter($tzvalue['abbrs'], function ($abbr) { |
|
6354 | + $abbrs = array_filter($tzvalue['abbrs'], function ($abbr) |
|
6355 | + { |
|
6357 | 6356 | return !strspn($abbr, '+-'); |
6358 | 6357 | }); |
6359 | 6358 | $abbrs = count($abbrs) == count($tzvalue['abbrs']) ? array_unique($abbrs) : array(); |
@@ -6754,7 +6753,6 @@ discard block |
||
6754 | 6753 | $isWritable = true; |
6755 | 6754 | break; |
6756 | 6755 | } |
6757 | - |
|
6758 | 6756 | else |
6759 | 6757 | @chmod($file, $val); |
6760 | 6758 | } |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | && !empty($_SERVER['HTTP_X_SMF_AJAX']) |
65 | 65 | && isset($_REQUEST['ajax']) |
66 | 66 | ) |
67 | - ) |
|
68 | - { |
|
67 | + ) { |
|
69 | 68 | $context['from_ajax'] = true; |
70 | 69 | $context['template_layers'] = array(); |
71 | 70 | } |
@@ -137,8 +136,7 @@ discard block |
||
137 | 136 | && !empty($_SERVER['HTTP_X_SMF_AJAX']) |
138 | 137 | && isset($_REQUEST['ajax']) |
139 | 138 | ) |
140 | - ) |
|
141 | - { |
|
139 | + ) { |
|
142 | 140 | $context['from_ajax'] = true; |
143 | 141 | $context['template_layers'] = array(); |
144 | 142 | } |
@@ -517,8 +515,7 @@ discard block |
||
517 | 515 | && !empty($_SERVER['HTTP_X_SMF_AJAX']) |
518 | 516 | && isset($_REQUEST['ajax']) |
519 | 517 | ) |
520 | - ) |
|
521 | - { |
|
518 | + ) { |
|
522 | 519 | $context['from_ajax'] = true; |
523 | 520 | $context['template_layers'] = array(); |
524 | 521 | } |
@@ -1232,7 +1232,8 @@ discard block |
||
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // It's important to do the numbered ones before the named ones, or messes happen. |
1235 | - uksort($substitutions, function($a, $b) { |
|
1235 | + uksort($substitutions, function($a, $b) |
|
1236 | + { |
|
1236 | 1237 | if (is_int($a) && is_int($b)) |
1237 | 1238 | return $a > $b ? 1 : ($a < $b ? -1 : 0); |
1238 | 1239 | elseif (is_int($a)) |
@@ -1771,8 +1772,12 @@ discard block |
||
1771 | 1772 | unset($mtime, $settingsFile, $settingsText); |
1772 | 1773 | $defined_vars = get_defined_vars(); |
1773 | 1774 | } |
1774 | - catch (Throwable $e) {} |
|
1775 | - catch (ErrorException $e) {} |
|
1775 | + catch (Throwable $e) |
|
1776 | + { |
|
1777 | +} |
|
1778 | + catch (ErrorException $e) |
|
1779 | + { |
|
1780 | +} |
|
1776 | 1781 | if (isset($e)) |
1777 | 1782 | return false; |
1778 | 1783 | |
@@ -1928,7 +1933,8 @@ discard block |
||
1928 | 1933 | // For the same reason, replace literal returns and newlines with "\r" and "\n" |
1929 | 1934 | elseif (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false)) |
1930 | 1935 | { |
1931 | - return strtr(preg_replace_callback('/[\r\n]+/', function($m) { |
|
1936 | + return strtr(preg_replace_callback('/[\r\n]+/', function($m) |
|
1937 | + { |
|
1932 | 1938 | return '\' . "' . strtr($m[0], array("\r" => '\r', "\n" => '\n')) . '" . \''; |
1933 | 1939 | }, var_export($var, true)), array("'' . " => '', " . ''" => '')); |
1934 | 1940 | } |