@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // Set a list of common functions. |
| 99 | 99 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
| 100 | 100 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
| 101 | - { |
|
| 101 | + { |
|
| 102 | 102 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
| 103 | 103 | return $string; |
| 104 | 104 | } : function($string) |
@@ -2147,7 +2147,6 @@ discard block |
||
| 2147 | 2147 | loadLanguage('index+Modifications'); |
| 2148 | 2148 | $context['template_layers'] = array(); |
| 2149 | 2149 | } |
| 2150 | - |
|
| 2151 | 2150 | else |
| 2152 | 2151 | { |
| 2153 | 2152 | // Custom templates to load, or just default? |
@@ -2525,14 +2524,12 @@ discard block |
||
| 2525 | 2524 | $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName; |
| 2526 | 2525 | $filePath = $settings['default_theme_dir'] . '/css/' . $fileName; |
| 2527 | 2526 | } |
| 2528 | - |
|
| 2529 | 2527 | else |
| 2530 | 2528 | { |
| 2531 | 2529 | $fileUrl = false; |
| 2532 | 2530 | $filePath = false; |
| 2533 | 2531 | } |
| 2534 | 2532 | } |
| 2535 | - |
|
| 2536 | 2533 | else |
| 2537 | 2534 | { |
| 2538 | 2535 | $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName; |
@@ -2639,14 +2636,12 @@ discard block |
||
| 2639 | 2636 | $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName; |
| 2640 | 2637 | $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName; |
| 2641 | 2638 | } |
| 2642 | - |
|
| 2643 | 2639 | else |
| 2644 | 2640 | { |
| 2645 | 2641 | $fileUrl = false; |
| 2646 | 2642 | $filePath = false; |
| 2647 | 2643 | } |
| 2648 | 2644 | } |
| 2649 | - |
|
| 2650 | 2645 | else |
| 2651 | 2646 | { |
| 2652 | 2647 | $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName; |
@@ -7116,32 +7116,32 @@ discard block |
||
| 7116 | 7116 | */ |
| 7117 | 7117 | function truncate_array($array, $max_length = 1900, $deep = 3) |
| 7118 | 7118 | { |
| 7119 | - $array = (array) $array; |
|
| 7119 | + $array = (array) $array; |
|
| 7120 | 7120 | |
| 7121 | - $curr_length = array_length($array, $deep); |
|
| 7121 | + $curr_length = array_length($array, $deep); |
|
| 7122 | 7122 | |
| 7123 | - if ($curr_length <= $max_length) |
|
| 7124 | - return $array; |
|
| 7123 | + if ($curr_length <= $max_length) |
|
| 7124 | + return $array; |
|
| 7125 | 7125 | |
| 7126 | - else |
|
| 7127 | - { |
|
| 7128 | - // Truncate each element's value to a reasonable length |
|
| 7129 | - $param_max = floor($max_length / count($array)); |
|
| 7126 | + else |
|
| 7127 | + { |
|
| 7128 | + // Truncate each element's value to a reasonable length |
|
| 7129 | + $param_max = floor($max_length / count($array)); |
|
| 7130 | 7130 | |
| 7131 | - $current_deep = $deep - 1; |
|
| 7131 | + $current_deep = $deep - 1; |
|
| 7132 | 7132 | |
| 7133 | - foreach ($array as $key => &$value) |
|
| 7134 | - { |
|
| 7135 | - if (is_array($value)) |
|
| 7136 | - if ($current_deep > 0) |
|
| 7137 | - $value = truncate_array($value, $current_deep); |
|
| 7133 | + foreach ($array as $key => &$value) |
|
| 7134 | + { |
|
| 7135 | + if (is_array($value)) |
|
| 7136 | + if ($current_deep > 0) |
|
| 7137 | + $value = truncate_array($value, $current_deep); |
|
| 7138 | 7138 | |
| 7139 | - else |
|
| 7140 | - $value = substr($value, 0, $param_max - strlen($key) - 5); |
|
| 7141 | - } |
|
| 7139 | + else |
|
| 7140 | + $value = substr($value, 0, $param_max - strlen($key) - 5); |
|
| 7141 | + } |
|
| 7142 | 7142 | |
| 7143 | - return $array; |
|
| 7144 | - } |
|
| 7143 | + return $array; |
|
| 7144 | + } |
|
| 7145 | 7145 | } |
| 7146 | 7146 | |
| 7147 | 7147 | /** |
@@ -7152,29 +7152,29 @@ discard block |
||
| 7152 | 7152 | */ |
| 7153 | 7153 | function array_length($array, $deep = 3) |
| 7154 | 7154 | { |
| 7155 | - // Work with arrays |
|
| 7156 | - $array = (array) $array; |
|
| 7157 | - $length = 0; |
|
| 7155 | + // Work with arrays |
|
| 7156 | + $array = (array) $array; |
|
| 7157 | + $length = 0; |
|
| 7158 | 7158 | |
| 7159 | - $deep_count = $deep - 1; |
|
| 7159 | + $deep_count = $deep - 1; |
|
| 7160 | 7160 | |
| 7161 | - foreach ($array as $value) |
|
| 7162 | - { |
|
| 7163 | - // Recursive? |
|
| 7164 | - if (is_array($value)) |
|
| 7165 | - { |
|
| 7166 | - // No can't do |
|
| 7167 | - if ($deep_count <= 0) |
|
| 7168 | - continue; |
|
| 7161 | + foreach ($array as $value) |
|
| 7162 | + { |
|
| 7163 | + // Recursive? |
|
| 7164 | + if (is_array($value)) |
|
| 7165 | + { |
|
| 7166 | + // No can't do |
|
| 7167 | + if ($deep_count <= 0) |
|
| 7168 | + continue; |
|
| 7169 | 7169 | |
| 7170 | - $length += array_length($value, $deep_count); |
|
| 7171 | - } |
|
| 7170 | + $length += array_length($value, $deep_count); |
|
| 7171 | + } |
|
| 7172 | 7172 | |
| 7173 | - else |
|
| 7174 | - $length += strlen($value); |
|
| 7175 | - } |
|
| 7173 | + else |
|
| 7174 | + $length += strlen($value); |
|
| 7175 | + } |
|
| 7176 | 7176 | |
| 7177 | - return $length; |
|
| 7177 | + return $length; |
|
| 7178 | 7178 | } |
| 7179 | 7179 | |
| 7180 | 7180 | ?> |
| 7181 | 7181 | \ No newline at end of file |
@@ -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'; |
@@ -2162,7 +2159,7 @@ discard block |
||
| 2162 | 2159 | 'tag' => 'cowsay', |
| 2163 | 2160 | 'parameters' => array( |
| 2164 | 2161 | 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
| 2165 | - { |
|
| 2162 | + { |
|
| 2166 | 2163 | static $css_added; |
| 2167 | 2164 | |
| 2168 | 2165 | if (empty($css_added)) |
@@ -2179,7 +2176,7 @@ discard block |
||
| 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 | ), |
@@ -3277,7 +3274,7 @@ discard block |
||
| 3277 | 3274 | |
| 3278 | 3275 | // Replace away! |
| 3279 | 3276 | $message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements) |
| 3280 | - { |
|
| 3277 | + { |
|
| 3281 | 3278 | return $smileyPregReplacements[$matches[1]]; |
| 3282 | 3279 | }, $message); |
| 3283 | 3280 | } |
@@ -4073,7 +4070,6 @@ discard block |
||
| 4073 | 4070 | if (!isset($minSeed) && isset($js_file['options']['seed'])) |
| 4074 | 4071 | $minSeed = $js_file['options']['seed']; |
| 4075 | 4072 | } |
| 4076 | - |
|
| 4077 | 4073 | else |
| 4078 | 4074 | { |
| 4079 | 4075 | echo ' |
@@ -6255,7 +6251,6 @@ discard block |
||
| 6255 | 6251 | $isWritable = true; |
| 6256 | 6252 | break; |
| 6257 | 6253 | } |
| 6258 | - |
|
| 6259 | 6254 | else |
| 6260 | 6255 | @chmod($file, $val); |
| 6261 | 6256 | } |
@@ -7187,7 +7182,6 @@ discard block |
||
| 7187 | 7182 | |
| 7188 | 7183 | $length += array_length($value, $deep_count); |
| 7189 | 7184 | } |
| 7190 | - |
|
| 7191 | 7185 | else |
| 7192 | 7186 | $length += strlen($value); |
| 7193 | 7187 | } |
@@ -978,7 +978,7 @@ |
||
| 978 | 978 | { |
| 979 | 979 | $row = $smcFunc['db_fetch_assoc']($result); |
| 980 | 980 | if ($row['standard_conforming_strings'] !== 'on') |
| 981 | - { |
|
| 981 | + { |
|
| 982 | 982 | $incontext['continue'] = 0; |
| 983 | 983 | $incontext['error'] = $txt['error_pg_scs']; |
| 984 | 984 | } |
@@ -1213,7 +1213,8 @@ discard block |
||
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | // It's important to do the numbered ones before the named ones, or messes happen. |
| 1216 | - uksort($substitutions, function($a, $b) { |
|
| 1216 | + uksort($substitutions, function($a, $b) |
|
| 1217 | + { |
|
| 1217 | 1218 | if (is_int($a) && is_int($b)) |
| 1218 | 1219 | return $a > $b; |
| 1219 | 1220 | elseif (is_int($a)) |
@@ -1752,8 +1753,12 @@ discard block |
||
| 1752 | 1753 | unset($mtime, $settingsFile, $settingsText); |
| 1753 | 1754 | $defined_vars = get_defined_vars(); |
| 1754 | 1755 | } |
| 1755 | - catch (Throwable $e) {} |
|
| 1756 | - catch (ErrorException $e) {} |
|
| 1756 | + catch (Throwable $e) |
|
| 1757 | + { |
|
| 1758 | +} |
|
| 1759 | + catch (ErrorException $e) |
|
| 1760 | + { |
|
| 1761 | +} |
|
| 1757 | 1762 | if (isset($e)) |
| 1758 | 1763 | return false; |
| 1759 | 1764 | |
@@ -1913,7 +1918,8 @@ discard block |
||
| 1913 | 1918 | // For the same reason, replace literal returns and newlines with "\r" and "\n" |
| 1914 | 1919 | elseif (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false)) |
| 1915 | 1920 | { |
| 1916 | - return strtr(preg_replace_callback('/[\r\n]+/', function($m) { |
|
| 1921 | + return strtr(preg_replace_callback('/[\r\n]+/', function($m) |
|
| 1922 | + { |
|
| 1917 | 1923 | return '\' . "' . strtr($m[0], array("\r" => '\r', "\n" => '\n')) . '" . \''; |
| 1918 | 1924 | }, $var), array("'' . " => '', " . ''" => '')); |
| 1919 | 1925 | } |