@@ -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']])) |
@@ -279,7 +279,6 @@ discard block |
||
| 279 | 279 | $condition = 'id_member IN ({array_int:members})'; |
| 280 | 280 | $parameters['members'] = $members; |
| 281 | 281 | } |
| 282 | - |
|
| 283 | 282 | elseif ($members === null) |
| 284 | 283 | $condition = '1=1'; |
| 285 | 284 | |
@@ -382,11 +381,9 @@ discard block |
||
| 382 | 381 | $val = $val . ' END'; |
| 383 | 382 | $type = 'raw'; |
| 384 | 383 | } |
| 385 | - |
|
| 386 | 384 | else |
| 387 | 385 | $val = alert_count($members, true); |
| 388 | 386 | } |
| 389 | - |
|
| 390 | 387 | elseif ($type == 'int' && ($val === '+' || $val === '-')) |
| 391 | 388 | { |
| 392 | 389 | $val = $var . ' ' . $val . ' 1'; |
@@ -2202,12 +2199,12 @@ discard block |
||
| 2202 | 2199 | 'tag' => 'cowsay', |
| 2203 | 2200 | 'parameters' => array( |
| 2204 | 2201 | 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
| 2205 | - { |
|
| 2202 | + { |
|
| 2206 | 2203 | return $smcFunc['substr']($eyes . 'oo', 0, 2); |
| 2207 | 2204 | }, |
| 2208 | 2205 | ), |
| 2209 | 2206 | 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function ($tongue) use ($smcFunc) |
| 2210 | - { |
|
| 2207 | + { |
|
| 2211 | 2208 | return $smcFunc['substr']($tongue . ' ', 0, 2); |
| 2212 | 2209 | }, |
| 2213 | 2210 | ), |
@@ -3314,7 +3311,7 @@ discard block |
||
| 3314 | 3311 | |
| 3315 | 3312 | // Replace away! |
| 3316 | 3313 | $message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements) |
| 3317 | - { |
|
| 3314 | + { |
|
| 3318 | 3315 | return $smileyPregReplacements[$matches[1]]; |
| 3319 | 3316 | }, $message); |
| 3320 | 3317 | } |
@@ -4112,7 +4109,6 @@ discard block |
||
| 4112 | 4109 | if (!isset($minSeed) && isset($js_file['options']['seed'])) |
| 4113 | 4110 | $minSeed = $js_file['options']['seed']; |
| 4114 | 4111 | } |
| 4115 | - |
|
| 4116 | 4112 | else |
| 4117 | 4113 | { |
| 4118 | 4114 | echo ' |
@@ -6029,7 +6025,8 @@ discard block |
||
| 6029 | 6025 | $zones[$tzkey]['tzid'] = $tzid; |
| 6030 | 6026 | $zones[$tzkey]['dst_type'] = count($tzinfo) > 1 ? 1 : ($tzinfo[0]['isdst'] ? 2 : 0); |
| 6031 | 6027 | |
| 6032 | - foreach ($tzinfo as $transition) { |
|
| 6028 | + foreach ($tzinfo as $transition) |
|
| 6029 | + { |
|
| 6033 | 6030 | $zones[$tzkey]['abbrs'][] = $transition['abbr']; |
| 6034 | 6031 | } |
| 6035 | 6032 | |
@@ -6114,7 +6111,8 @@ discard block |
||
| 6114 | 6111 | $desc = implode(', ', array_slice(array_unique($tzvalue['locations']), 0, 5)) . (count($tzvalue['locations']) > 5 ? ', ' . $txt['etc'] : ''); |
| 6115 | 6112 | |
| 6116 | 6113 | // We don't want abbreviations like '+03' or '-11'. |
| 6117 | - $abbrs = array_filter($tzvalue['abbrs'], function ($abbr) { |
|
| 6114 | + $abbrs = array_filter($tzvalue['abbrs'], function ($abbr) |
|
| 6115 | + { |
|
| 6118 | 6116 | return !strspn($abbr, '+-'); |
| 6119 | 6117 | }); |
| 6120 | 6118 | $abbrs = count($abbrs) == count($tzvalue['abbrs']) ? array_unique($abbrs) : array(); |
@@ -6462,7 +6460,6 @@ discard block |
||
| 6462 | 6460 | $isWritable = true; |
| 6463 | 6461 | break; |
| 6464 | 6462 | } |
| 6465 | - |
|
| 6466 | 6463 | else |
| 6467 | 6464 | @chmod($file, $val); |
| 6468 | 6465 | } |
@@ -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 | } |
@@ -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 | |
@@ -1926,7 +1931,8 @@ discard block |
||
| 1926 | 1931 | // For the same reason, replace literal returns and newlines with "\r" and "\n" |
| 1927 | 1932 | elseif (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false)) |
| 1928 | 1933 | { |
| 1929 | - return strtr(preg_replace_callback('/[\r\n]+/', function($m) { |
|
| 1934 | + return strtr(preg_replace_callback('/[\r\n]+/', function($m) |
|
| 1935 | + { |
|
| 1930 | 1936 | return '\' . "' . strtr($m[0], array("\r" => '\r', "\n" => '\n')) . '" . \''; |
| 1931 | 1937 | }, $var), array("'' . " => '', " . ''" => '')); |
| 1932 | 1938 | } |
@@ -2248,7 +2254,8 @@ discard block |
||
| 2248 | 2254 | // Search for a working temp directory. |
| 2249 | 2255 | foreach ($temp_dir_options as $id_temp => $temp_option) |
| 2250 | 2256 | { |
| 2251 | - switch ($temp_option) { |
|
| 2257 | + switch ($temp_option) |
|
| 2258 | + { |
|
| 2252 | 2259 | case 'cachedir': |
| 2253 | 2260 | $possible_temp = rtrim($cachedir, '/'); |
| 2254 | 2261 | break; |