@@ -5495,7 +5495,6 @@ discard block |
||
5495 | 5495 | |
5496 | 5496 | /** |
5497 | 5497 | * Tries different modes to make file/dirs writable. Wrapper function for chmod() |
5498 | - |
|
5499 | 5498 | * @param string $file The file/dir full path. |
5500 | 5499 | * @param int $value Not needed, added for legacy reasons. |
5501 | 5500 | * @return boolean true if the file/dir is already writable or the function was able to make it writable, false if the function couldn't make the file/dir writable. |
@@ -5535,7 +5534,6 @@ discard block |
||
5535 | 5534 | |
5536 | 5535 | /** |
5537 | 5536 | * Wrapper function for json_decode() with error handling. |
5538 | - |
|
5539 | 5537 | * @param string $json The string to decode. |
5540 | 5538 | * @param bool $returnAsArray To return the decoded string as an array or an object, SMF only uses Arrays but to keep on compatibility with json_decode its set to false as default. |
5541 | 5539 | * @param bool $logIt To specify if the error will be logged if theres any. |
@@ -6029,7 +6027,7 @@ discard block |
||
6029 | 6027 | $params = stream_context_get_params($stream); |
6030 | 6028 | $result = isset($params["options"]["ssl"]["peer_certificate"]) ? true : false; |
6031 | 6029 | } |
6032 | - return $result; |
|
6030 | + return $result; |
|
6033 | 6031 | } |
6034 | 6032 | |
6035 | 6033 | /** |
@@ -2932,7 +2932,7 @@ |
||
2932 | 2932 | } |
2933 | 2933 | |
2934 | 2934 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
2935 | - foreach($smileysto AS $ix=>$file) |
|
2935 | + foreach($smileysto as $ix=>$file) |
|
2936 | 2936 | // Need to use the default if user selection is disabled |
2937 | 2937 | if (empty($modSettings['smiley_sets_enable'])) |
2938 | 2938 | $smileysto[$ix] = $file . $context['user']['smiley_set_default_ext']; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | { |
392 | 392 | $val = 'CASE '; |
393 | 393 | foreach ($members as $k => $v) |
394 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
394 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
395 | 395 | $val = $val . ' END'; |
396 | 396 | $type = 'raw'; |
397 | 397 | } |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | static $non_twelve_hour, $locale_cache; |
745 | 745 | static $unsupportedFormats, $finalizedFormats; |
746 | 746 | |
747 | - $unsupportedFormatsWindows = array('z','Z'); |
|
747 | + $unsupportedFormatsWindows = array('z', 'Z'); |
|
748 | 748 | |
749 | 749 | // Ensure required values are set |
750 | 750 | $user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400); |
830 | 830 | if (empty($unsupportedFormats)) |
831 | 831 | { |
832 | - foreach($strftimeFormatSubstitutions as $format => $substitution) |
|
832 | + foreach ($strftimeFormatSubstitutions as $format => $substitution) |
|
833 | 833 | { |
834 | 834 | // Avoid a crashing bug with PHP 7 on certain versions of Windows |
835 | 835 | if ($context['server']['is_windows'] && in_array($format, $unsupportedFormatsWindows)) |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
1210 | 1210 | ), |
1211 | 1211 | 'content' => '$1', |
1212 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
1212 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
1213 | 1213 | { |
1214 | 1214 | $returnContext = ''; |
1215 | 1215 | |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
1247 | - $returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>'; |
|
1247 | + $returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>'; |
|
1248 | 1248 | else |
1249 | 1249 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
1250 | 1250 | } |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | 'type' => 'unparsed_content', |
1297 | 1297 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
1298 | 1298 | // @todo Maybe this can be simplified? |
1299 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
1299 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
1300 | 1300 | { |
1301 | 1301 | if (!isset($disabled['code'])) |
1302 | 1302 | { |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | 'type' => 'unparsed_equals_content', |
1334 | 1334 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
1335 | 1335 | // @todo Maybe this can be simplified? |
1336 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
1336 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
1337 | 1337 | { |
1338 | 1338 | if (!isset($disabled['code'])) |
1339 | 1339 | { |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | 'type' => 'unparsed_content', |
1378 | 1378 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
1379 | 1379 | // @todo Should this respect guest_hideContacts? |
1380 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1380 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1381 | 1381 | { |
1382 | 1382 | $data = strtr($data, array('<br>' => '')); |
1383 | 1383 | }, |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
1398 | 1398 | 'before' => '<div $1>', |
1399 | 1399 | 'after' => '</div>', |
1400 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1400 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1401 | 1401 | { |
1402 | 1402 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
1403 | 1403 | |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
1484 | 1484 | ), |
1485 | 1485 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
1486 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1486 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1487 | 1487 | { |
1488 | 1488 | global $image_proxy_enabled, $user_info; |
1489 | 1489 | |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | 'tag' => 'img', |
1510 | 1510 | 'type' => 'unparsed_content', |
1511 | 1511 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
1512 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1512 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1513 | 1513 | { |
1514 | 1514 | global $image_proxy_enabled, $user_info; |
1515 | 1515 | |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | 'tag' => 'iurl', |
1536 | 1536 | 'type' => 'unparsed_content', |
1537 | 1537 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
1538 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1538 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1539 | 1539 | { |
1540 | 1540 | $data = strtr($data, array('<br>' => '')); |
1541 | 1541 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | 'quoted' => 'optional', |
1550 | 1550 | 'before' => '<a href="$1" class="bbc_link">', |
1551 | 1551 | 'after' => '</a>', |
1552 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1552 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1553 | 1553 | { |
1554 | 1554 | if (substr($data, 0, 1) == '#') |
1555 | 1555 | $data = '#post_' . substr($data, 1); |
@@ -1642,7 +1642,7 @@ discard block |
||
1642 | 1642 | 'tag' => 'php', |
1643 | 1643 | 'type' => 'unparsed_content', |
1644 | 1644 | 'content' => '<span class="phpcode">$1</span>', |
1645 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
1645 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
1646 | 1646 | { |
1647 | 1647 | if (!isset($disabled['php'])) |
1648 | 1648 | { |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | 'test' => '[1-7]\]', |
1771 | 1771 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
1772 | 1772 | 'after' => '</span>', |
1773 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1773 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1774 | 1774 | { |
1775 | 1775 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
1776 | 1776 | $data = $sizes[$data] . 'em'; |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | 'tag' => 'time', |
1809 | 1809 | 'type' => 'unparsed_content', |
1810 | 1810 | 'content' => '$1', |
1811 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1811 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1812 | 1812 | { |
1813 | 1813 | if (is_numeric($data)) |
1814 | 1814 | $data = timeformat($data); |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | 'tag' => 'url', |
1842 | 1842 | 'type' => 'unparsed_content', |
1843 | 1843 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
1844 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1844 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1845 | 1845 | { |
1846 | 1846 | $data = strtr($data, array('<br>' => '')); |
1847 | 1847 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | 'quoted' => 'optional', |
1856 | 1856 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
1857 | 1857 | 'after' => '</a>', |
1858 | - 'validate' => function (&$tag, &$data, $disabled) |
|
1858 | + 'validate' => function(&$tag, &$data, $disabled) |
|
1859 | 1859 | { |
1860 | 1860 | $scheme = parse_url($data, PHP_URL_SCHEME); |
1861 | 1861 | if (empty($scheme)) |
@@ -1901,7 +1901,7 @@ discard block |
||
1901 | 1901 | { |
1902 | 1902 | if (isset($temp_bbc)) |
1903 | 1903 | $bbc_codes = $temp_bbc; |
1904 | - usort($codes, function ($a, $b) { |
|
1904 | + usort($codes, function($a, $b) { |
|
1905 | 1905 | return strcmp($a['tag'], $b['tag']); |
1906 | 1906 | }); |
1907 | 1907 | return $codes; |
@@ -2117,7 +2117,7 @@ discard block |
||
2117 | 2117 | # a run of Unicode domain name characters and a dot |
2118 | 2118 | [\p{L}\p{M}\p{N}\-.:@]+\. |
2119 | 2119 | # and then a TLD valid in the DNS or the reserved "local" TLD |
2120 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
2120 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
2121 | 2121 | ) |
2122 | 2122 | # followed by a non-domain character or end of line |
2123 | 2123 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2185,7 +2185,7 @@ 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 | $url = array_shift($matches); |
2190 | 2190 | |
2191 | 2191 | // If this isn't a clean URL, bail out |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | $fullUrl = $url; |
2211 | 2211 | |
2212 | 2212 | // Make sure that $fullUrl really is valid |
2213 | - if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false) |
|
2213 | + if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false) |
|
2214 | 2214 | return $url; |
2215 | 2215 | |
2216 | 2216 | return '[url="' . str_replace(array('[', ']'), array('[', ']'), $fullUrl) . '"]' . $url . '[/url]'; |
@@ -2274,7 +2274,7 @@ discard block |
||
2274 | 2274 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
2275 | 2275 | |
2276 | 2276 | // 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))) |
|
2277 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
2278 | 2278 | continue; |
2279 | 2279 | |
2280 | 2280 | $to_close = array(); |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | } |
2933 | 2933 | |
2934 | 2934 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
2935 | - foreach($smileysto AS $ix=>$file) |
|
2935 | + foreach ($smileysto AS $ix=>$file) |
|
2936 | 2936 | // Need to use the default if user selection is disabled |
2937 | 2937 | if (empty($modSettings['smiley_sets_enable'])) |
2938 | 2938 | $smileysto[$ix] = $file . $context['user']['smiley_set_default_ext']; |
@@ -2950,7 +2950,7 @@ discard block |
||
2950 | 2950 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
2951 | 2951 | { |
2952 | 2952 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
2953 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
2953 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
2954 | 2954 | |
2955 | 2955 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
2956 | 2956 | |
@@ -2975,7 +2975,7 @@ discard block |
||
2975 | 2975 | |
2976 | 2976 | // Replace away! |
2977 | 2977 | $message = preg_replace_callback($smileyPregSearch, |
2978 | - function ($matches) use ($smileyPregReplacements) |
|
2978 | + function($matches) use ($smileyPregReplacements) |
|
2979 | 2979 | { |
2980 | 2980 | return $smileyPregReplacements[$matches[1]]; |
2981 | 2981 | }, $message); |
@@ -3072,13 +3072,13 @@ discard block |
||
3072 | 3072 | { |
3073 | 3073 | if (defined('SID') && SID != '') |
3074 | 3074 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
3075 | - function ($m) use ($scripturl) |
|
3075 | + function($m) use ($scripturl) |
|
3076 | 3076 | { |
3077 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
3077 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
3078 | 3078 | }, $setLocation); |
3079 | 3079 | else |
3080 | 3080 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
3081 | - function ($m) use ($scripturl) |
|
3081 | + function($m) use ($scripturl) |
|
3082 | 3082 | { |
3083 | 3083 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
3084 | 3084 | }, $setLocation); |
@@ -3399,7 +3399,7 @@ discard block |
||
3399 | 3399 | |
3400 | 3400 | // Add a generic "Are you sure?" confirmation message. |
3401 | 3401 | addInlineJavaScript(' |
3402 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
3402 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
3403 | 3403 | |
3404 | 3404 | // Now add the capping code for avatars. |
3405 | 3405 | if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') |
@@ -3865,7 +3865,7 @@ discard block |
||
3865 | 3865 | if (!empty($normal)) |
3866 | 3866 | foreach ($normal as $nf) |
3867 | 3867 | echo ' |
3868 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
3868 | + <link rel="stylesheet" href="', $nf, '">'; |
|
3869 | 3869 | |
3870 | 3870 | if ($db_show_debug === true) |
3871 | 3871 | { |
@@ -3881,7 +3881,7 @@ discard block |
||
3881 | 3881 | <style>'; |
3882 | 3882 | |
3883 | 3883 | foreach ($context['css_header'] as $css) |
3884 | - echo $css .' |
|
3884 | + echo $css . ' |
|
3885 | 3885 | '; |
3886 | 3886 | |
3887 | 3887 | echo' |
@@ -3953,7 +3953,7 @@ discard block |
||
3953 | 3953 | } |
3954 | 3954 | |
3955 | 3955 | // No namespaces, sorry! |
3956 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
3956 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
3957 | 3957 | |
3958 | 3958 | $minifier = new $classType(); |
3959 | 3959 | |
@@ -4101,7 +4101,7 @@ discard block |
||
4101 | 4101 | else |
4102 | 4102 | $path = $modSettings['attachmentUploadDir']; |
4103 | 4103 | |
4104 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
4104 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
4105 | 4105 | } |
4106 | 4106 | |
4107 | 4107 | /** |
@@ -4145,10 +4145,10 @@ discard block |
||
4145 | 4145 | $valid_low = isValidIP($ip_parts[0]); |
4146 | 4146 | $valid_high = isValidIP($ip_parts[1]); |
4147 | 4147 | $count = 0; |
4148 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
4148 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
4149 | 4149 | $max = ($mode == ':' ? 'ffff' : '255'); |
4150 | 4150 | $min = 0; |
4151 | - if(!$valid_low) |
|
4151 | + if (!$valid_low) |
|
4152 | 4152 | { |
4153 | 4153 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
4154 | 4154 | $valid_low = isValidIP($ip_parts[0]); |
@@ -4162,7 +4162,7 @@ discard block |
||
4162 | 4162 | } |
4163 | 4163 | |
4164 | 4164 | $count = 0; |
4165 | - if(!$valid_high) |
|
4165 | + if (!$valid_high) |
|
4166 | 4166 | { |
4167 | 4167 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
4168 | 4168 | $valid_high = isValidIP($ip_parts[1]); |
@@ -4175,7 +4175,7 @@ discard block |
||
4175 | 4175 | } |
4176 | 4176 | } |
4177 | 4177 | |
4178 | - if($valid_high && $valid_low) |
|
4178 | + if ($valid_high && $valid_low) |
|
4179 | 4179 | { |
4180 | 4180 | $ip_array['low'] = $ip_parts[0]; |
4181 | 4181 | $ip_array['high'] = $ip_parts[1]; |
@@ -4356,7 +4356,7 @@ discard block |
||
4356 | 4356 | addInlineJavaScript(' |
4357 | 4357 | var user_menus = new smc_PopupMenu(); |
4358 | 4358 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
4359 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
4359 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
4360 | 4360 | if ($context['allow_pm']) |
4361 | 4361 | addInlineJavaScript(' |
4362 | 4362 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4651,7 +4651,7 @@ discard block |
||
4651 | 4651 | $context['total_admin_reports'] += $context['unapproved_members']; |
4652 | 4652 | } |
4653 | 4653 | |
4654 | - if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
4654 | + if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
4655 | 4655 | { |
4656 | 4656 | $context['menu_buttons']['admin']['amt'] = $context['total_admin_reports']; |
4657 | 4657 | } |
@@ -4998,7 +4998,7 @@ discard block |
||
4998 | 4998 | // No? try a fallback to $sourcedir |
4999 | 4999 | else |
5000 | 5000 | { |
5001 | - $absPath = $sourcedir .'/'. $file; |
|
5001 | + $absPath = $sourcedir . '/' . $file; |
|
5002 | 5002 | |
5003 | 5003 | if (file_exists($absPath)) |
5004 | 5004 | require_once($absPath); |
@@ -5265,15 +5265,15 @@ discard block |
||
5265 | 5265 | |
5266 | 5266 | // UTF-8 occurences of MS special characters |
5267 | 5267 | $findchars_utf8 = array( |
5268 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
5269 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
5270 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
5271 | - "\xe2\x80\x98", // left single curly quote |
|
5272 | - "\xe2\x80\x99", // right single curly quote |
|
5273 | - "\xe2\x80\x9c", // left double curly quote |
|
5274 | - "\xe2\x80\x9d", // right double curly quote |
|
5275 | - "\xe2\x80\x93", // en dash |
|
5276 | - "\xe2\x80\x94", // em dash |
|
5268 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
5269 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
5270 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
5271 | + "\xe2\x80\x98", // left single curly quote |
|
5272 | + "\xe2\x80\x99", // right single curly quote |
|
5273 | + "\xe2\x80\x9c", // left double curly quote |
|
5274 | + "\xe2\x80\x9d", // right double curly quote |
|
5275 | + "\xe2\x80\x93", // en dash |
|
5276 | + "\xe2\x80\x94", // em dash |
|
5277 | 5277 | ); |
5278 | 5278 | |
5279 | 5279 | // windows 1252 / iso equivalents |
@@ -5291,15 +5291,15 @@ discard block |
||
5291 | 5291 | |
5292 | 5292 | // safe replacements |
5293 | 5293 | $replacechars = array( |
5294 | - ',', // ‚ |
|
5295 | - ',,', // „ |
|
5296 | - '...', // … |
|
5297 | - "'", // ‘ |
|
5298 | - "'", // ’ |
|
5299 | - '"', // “ |
|
5300 | - '"', // ” |
|
5301 | - '-', // – |
|
5302 | - '--', // — |
|
5294 | + ',', // ‚ |
|
5295 | + ',,', // „ |
|
5296 | + '...', // … |
|
5297 | + "'", // ‘ |
|
5298 | + "'", // ’ |
|
5299 | + '"', // “ |
|
5300 | + '"', // ” |
|
5301 | + '-', // – |
|
5302 | + '--', // — |
|
5303 | 5303 | ); |
5304 | 5304 | |
5305 | 5305 | if ($context['utf8']) |
@@ -5619,7 +5619,7 @@ discard block |
||
5619 | 5619 | */ |
5620 | 5620 | function inet_dtop($bin) |
5621 | 5621 | { |
5622 | - if(empty($bin)) |
|
5622 | + if (empty($bin)) |
|
5623 | 5623 | return ''; |
5624 | 5624 | |
5625 | 5625 | global $db_type; |
@@ -5650,28 +5650,28 @@ discard block |
||
5650 | 5650 | */ |
5651 | 5651 | function _safe_serialize($value) |
5652 | 5652 | { |
5653 | - if(is_null($value)) |
|
5653 | + if (is_null($value)) |
|
5654 | 5654 | return 'N;'; |
5655 | 5655 | |
5656 | - if(is_bool($value)) |
|
5657 | - return 'b:'. (int) $value .';'; |
|
5656 | + if (is_bool($value)) |
|
5657 | + return 'b:' . (int) $value . ';'; |
|
5658 | 5658 | |
5659 | - if(is_int($value)) |
|
5660 | - return 'i:'. $value .';'; |
|
5659 | + if (is_int($value)) |
|
5660 | + return 'i:' . $value . ';'; |
|
5661 | 5661 | |
5662 | - if(is_float($value)) |
|
5663 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
5662 | + if (is_float($value)) |
|
5663 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
5664 | 5664 | |
5665 | - if(is_string($value)) |
|
5666 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
5665 | + if (is_string($value)) |
|
5666 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
5667 | 5667 | |
5668 | - if(is_array($value)) |
|
5668 | + if (is_array($value)) |
|
5669 | 5669 | { |
5670 | 5670 | $out = ''; |
5671 | - foreach($value as $k => $v) |
|
5671 | + foreach ($value as $k => $v) |
|
5672 | 5672 | $out .= _safe_serialize($k) . _safe_serialize($v); |
5673 | 5673 | |
5674 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
5674 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
5675 | 5675 | } |
5676 | 5676 | |
5677 | 5677 | // safe_serialize cannot serialize resources or objects. |
@@ -5713,7 +5713,7 @@ discard block |
||
5713 | 5713 | function _safe_unserialize($str) |
5714 | 5714 | { |
5715 | 5715 | // Input is not a string. |
5716 | - if(empty($str) || !is_string($str)) |
|
5716 | + if (empty($str) || !is_string($str)) |
|
5717 | 5717 | return false; |
5718 | 5718 | |
5719 | 5719 | $stack = array(); |
@@ -5727,40 +5727,40 @@ discard block |
||
5727 | 5727 | * 3 - in array, expecting value or another array |
5728 | 5728 | */ |
5729 | 5729 | $state = 0; |
5730 | - while($state != 1) |
|
5730 | + while ($state != 1) |
|
5731 | 5731 | { |
5732 | 5732 | $type = isset($str[0]) ? $str[0] : ''; |
5733 | - if($type == '}') |
|
5733 | + if ($type == '}') |
|
5734 | 5734 | $str = substr($str, 1); |
5735 | 5735 | |
5736 | - else if($type == 'N' && $str[1] == ';') |
|
5736 | + else if ($type == 'N' && $str[1] == ';') |
|
5737 | 5737 | { |
5738 | 5738 | $value = null; |
5739 | 5739 | $str = substr($str, 2); |
5740 | 5740 | } |
5741 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
5741 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
5742 | 5742 | { |
5743 | 5743 | $value = $matches[1] == '1' ? true : false; |
5744 | 5744 | $str = substr($str, 4); |
5745 | 5745 | } |
5746 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
5746 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
5747 | 5747 | { |
5748 | - $value = (int)$matches[1]; |
|
5748 | + $value = (int) $matches[1]; |
|
5749 | 5749 | $str = $matches[2]; |
5750 | 5750 | } |
5751 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
5751 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
5752 | 5752 | { |
5753 | - $value = (float)$matches[1]; |
|
5753 | + $value = (float) $matches[1]; |
|
5754 | 5754 | $str = $matches[3]; |
5755 | 5755 | } |
5756 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
5756 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
5757 | 5757 | { |
5758 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
5759 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
5758 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
5759 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
5760 | 5760 | } |
5761 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
5761 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
5762 | 5762 | { |
5763 | - $expectedLength = (int)$matches[1]; |
|
5763 | + $expectedLength = (int) $matches[1]; |
|
5764 | 5764 | $str = $matches[2]; |
5765 | 5765 | } |
5766 | 5766 | |
@@ -5768,10 +5768,10 @@ discard block |
||
5768 | 5768 | else |
5769 | 5769 | return false; |
5770 | 5770 | |
5771 | - switch($state) |
|
5771 | + switch ($state) |
|
5772 | 5772 | { |
5773 | 5773 | case 3: // In array, expecting value or another array. |
5774 | - if($type == 'a') |
|
5774 | + if ($type == 'a') |
|
5775 | 5775 | { |
5776 | 5776 | $stack[] = &$list; |
5777 | 5777 | $list[$key] = array(); |
@@ -5780,7 +5780,7 @@ discard block |
||
5780 | 5780 | $state = 2; |
5781 | 5781 | break; |
5782 | 5782 | } |
5783 | - if($type != '}') |
|
5783 | + if ($type != '}') |
|
5784 | 5784 | { |
5785 | 5785 | $list[$key] = $value; |
5786 | 5786 | $state = 2; |
@@ -5791,29 +5791,29 @@ discard block |
||
5791 | 5791 | return false; |
5792 | 5792 | |
5793 | 5793 | case 2: // in array, expecting end of array or a key |
5794 | - if($type == '}') |
|
5794 | + if ($type == '}') |
|
5795 | 5795 | { |
5796 | 5796 | // Array size is less than expected. |
5797 | - if(count($list) < end($expected)) |
|
5797 | + if (count($list) < end($expected)) |
|
5798 | 5798 | return false; |
5799 | 5799 | |
5800 | 5800 | unset($list); |
5801 | - $list = &$stack[count($stack)-1]; |
|
5801 | + $list = &$stack[count($stack) - 1]; |
|
5802 | 5802 | array_pop($stack); |
5803 | 5803 | |
5804 | 5804 | // Go to terminal state if we're at the end of the root array. |
5805 | 5805 | array_pop($expected); |
5806 | 5806 | |
5807 | - if(count($expected) == 0) |
|
5807 | + if (count($expected) == 0) |
|
5808 | 5808 | $state = 1; |
5809 | 5809 | |
5810 | 5810 | break; |
5811 | 5811 | } |
5812 | 5812 | |
5813 | - if($type == 'i' || $type == 's') |
|
5813 | + if ($type == 'i' || $type == 's') |
|
5814 | 5814 | { |
5815 | 5815 | // Array size exceeds expected length. |
5816 | - if(count($list) >= end($expected)) |
|
5816 | + if (count($list) >= end($expected)) |
|
5817 | 5817 | return false; |
5818 | 5818 | |
5819 | 5819 | $key = $value; |
@@ -5826,7 +5826,7 @@ discard block |
||
5826 | 5826 | |
5827 | 5827 | // Expecting array or value. |
5828 | 5828 | case 0: |
5829 | - if($type == 'a') |
|
5829 | + if ($type == 'a') |
|
5830 | 5830 | { |
5831 | 5831 | $data = array(); |
5832 | 5832 | $list = &$data; |
@@ -5835,7 +5835,7 @@ discard block |
||
5835 | 5835 | break; |
5836 | 5836 | } |
5837 | 5837 | |
5838 | - if($type != '}') |
|
5838 | + if ($type != '}') |
|
5839 | 5839 | { |
5840 | 5840 | $data = $value; |
5841 | 5841 | $state = 1; |
@@ -5848,7 +5848,7 @@ discard block |
||
5848 | 5848 | } |
5849 | 5849 | |
5850 | 5850 | // Trailing data in input. |
5851 | - if(!empty($str)) |
|
5851 | + if (!empty($str)) |
|
5852 | 5852 | return false; |
5853 | 5853 | |
5854 | 5854 | return $data; |
@@ -5902,7 +5902,7 @@ discard block |
||
5902 | 5902 | // Set different modes. |
5903 | 5903 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
5904 | 5904 | |
5905 | - foreach($chmodValues as $val) |
|
5905 | + foreach ($chmodValues as $val) |
|
5906 | 5906 | { |
5907 | 5907 | // If it's writable, break out of the loop. |
5908 | 5908 | if (is_writable($file)) |
@@ -5937,13 +5937,13 @@ discard block |
||
5937 | 5937 | $returnArray = @json_decode($json, $returnAsArray); |
5938 | 5938 | |
5939 | 5939 | // PHP 5.3 so no json_last_error_msg() |
5940 | - switch(json_last_error()) |
|
5940 | + switch (json_last_error()) |
|
5941 | 5941 | { |
5942 | 5942 | case JSON_ERROR_NONE: |
5943 | 5943 | $jsonError = false; |
5944 | 5944 | break; |
5945 | 5945 | case JSON_ERROR_DEPTH: |
5946 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
5946 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
5947 | 5947 | break; |
5948 | 5948 | case JSON_ERROR_STATE_MISMATCH: |
5949 | 5949 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5971,10 +5971,10 @@ discard block |
||
5971 | 5971 | loadLanguage('Errors'); |
5972 | 5972 | |
5973 | 5973 | if (!empty($jsonDebug)) |
5974 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
5974 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
5975 | 5975 | |
5976 | 5976 | else |
5977 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
5977 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
5978 | 5978 | |
5979 | 5979 | // Everyone expects an array. |
5980 | 5980 | return array(); |
@@ -6091,7 +6091,7 @@ discard block |
||
6091 | 6091 | // Convert Punycode to Unicode |
6092 | 6092 | require_once($sourcedir . '/Class-Punycode.php'); |
6093 | 6093 | $Punycode = new Punycode(); |
6094 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
6094 | + $tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
6095 | 6095 | } |
6096 | 6096 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
6097 | 6097 | else |
@@ -6185,7 +6185,7 @@ discard block |
||
6185 | 6185 | } |
6186 | 6186 | |
6187 | 6187 | // This recursive function creates the index array from the strings |
6188 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
6188 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
6189 | 6189 | { |
6190 | 6190 | static $depth = 0; |
6191 | 6191 | $depth++; |
@@ -6212,7 +6212,7 @@ discard block |
||
6212 | 6212 | }; |
6213 | 6213 | |
6214 | 6214 | // This recursive function turns the index array into a regular expression |
6215 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
6215 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
6216 | 6216 | { |
6217 | 6217 | static $depth = 0; |
6218 | 6218 | $depth++; |
@@ -6236,11 +6236,11 @@ discard block |
||
6236 | 6236 | |
6237 | 6237 | if (count(array_keys($value)) == 1) |
6238 | 6238 | { |
6239 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
6239 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
6240 | 6240 | $new_key .= $new_key_array[0]; |
6241 | 6241 | } |
6242 | 6242 | else |
6243 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
6243 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
6244 | 6244 | } |
6245 | 6245 | |
6246 | 6246 | if ($depth > 1) |
@@ -6283,10 +6283,10 @@ discard block |
||
6283 | 6283 | { |
6284 | 6284 | $regex = array(); |
6285 | 6285 | while (!empty($index)) |
6286 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
6286 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
6287 | 6287 | } |
6288 | 6288 | else |
6289 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
6289 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
6290 | 6290 | |
6291 | 6291 | // Restore PHP's internal character encoding to whatever it was originally |
6292 | 6292 | if (!empty($current_encoding)) |
@@ -6447,8 +6447,8 @@ discard block |
||
6447 | 6447 | $query_part['query_see_board'] = '1=1'; |
6448 | 6448 | // Otherwise just the groups in $user_info['groups']. |
6449 | 6449 | else |
6450 | - $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( '. implode(',', $groups) .') AND bpv.deny = 0) ' |
|
6451 | - . ( !empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '. implode(',', $groups) .') and bpv.deny = 1)' : '') |
|
6450 | + $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( ' . implode(',', $groups) . ') AND bpv.deny = 0) ' |
|
6451 | + . (!empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( ' . implode(',', $groups) . ') and bpv.deny = 1)' : '') |
|
6452 | 6452 | . ' AND bpv.id_board = b.id_board)'; |
6453 | 6453 | |
6454 | 6454 | // Build the list of boards they WANT to see. |
@@ -6512,7 +6512,7 @@ discard block |
||
6512 | 6512 | function sanitize_iri($iri) |
6513 | 6513 | { |
6514 | 6514 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
6515 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
6515 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) { |
|
6516 | 6516 | return rawurlencode($matches[0]); |
6517 | 6517 | }, $iri); |
6518 | 6518 | |
@@ -6554,7 +6554,7 @@ discard block |
||
6554 | 6554 | $unescaped = array( |
6555 | 6555 | '%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&', |
6556 | 6556 | '%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*', |
6557 | - '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
6557 | + '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
6558 | 6558 | '%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@', |
6559 | 6559 | ); |
6560 | 6560 | $iri = strtr(rawurlencode($iri), $unescaped); |
@@ -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 | // Is this a deferred or asynchonous JavaScript file? |
3915 | 3919 | $async = $type === 'js'; |
@@ -5910,7 +5914,6 @@ discard block |
||
5910 | 5914 | $isWritable = true; |
5911 | 5915 | break; |
5912 | 5916 | } |
5913 | - |
|
5914 | 5917 | else |
5915 | 5918 | @chmod($file, $val); |
5916 | 5919 | } |
@@ -6080,7 +6083,8 @@ discard block |
||
6080 | 6083 | if (!empty($tlds)) |
6081 | 6084 | { |
6082 | 6085 | // Clean $tlds and convert it to an array |
6083 | - $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) { |
|
6086 | + $tlds = array_filter(explode("\n", strtolower($tlds)), function($line) |
|
6087 | + { |
|
6084 | 6088 | $line = trim($line); |
6085 | 6089 | if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false) |
6086 | 6090 | return false; |
@@ -6091,7 +6095,9 @@ discard block |
||
6091 | 6095 | // Convert Punycode to Unicode |
6092 | 6096 | require_once($sourcedir . '/Class-Punycode.php'); |
6093 | 6097 | $Punycode = new Punycode(); |
6094 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
6098 | + $tlds = array_map(function ($input) use ($Punycode) |
|
6099 | + { |
|
6100 | +return $Punycode->decode($input); }, $tlds); |
|
6095 | 6101 | } |
6096 | 6102 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
6097 | 6103 | else |
@@ -6258,7 +6264,8 @@ discard block |
||
6258 | 6264 | } |
6259 | 6265 | |
6260 | 6266 | // Sort by key length and then alphabetically |
6261 | - uksort($regex, function($k1, $k2) use (&$strlen) { |
|
6267 | + uksort($regex, function($k1, $k2) use (&$strlen) |
|
6268 | + { |
|
6262 | 6269 | $l1 = $strlen($k1); |
6263 | 6270 | $l2 = $strlen($k2); |
6264 | 6271 | |
@@ -6512,7 +6519,8 @@ discard block |
||
6512 | 6519 | function sanitize_iri($iri) |
6513 | 6520 | { |
6514 | 6521 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
6515 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
6522 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) |
|
6523 | + { |
|
6516 | 6524 | return rawurlencode($matches[0]); |
6517 | 6525 | }, $iri); |
6518 | 6526 |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function cleanCache($type = '') |
110 | 110 | { |
111 | - if($type == 'expired') |
|
112 | - $query = 'DELETE FROM cache WHERE ttl >= ' . time().';'; |
|
111 | + if ($type == 'expired') |
|
112 | + $query = 'DELETE FROM cache WHERE ttl >= ' . time() . ';'; |
|
113 | 113 | else |
114 | 114 | $query = 'DELETE FROM cache;'; |
115 | 115 | |
116 | 116 | $result = $this->cacheDB->exec($query); |
117 | 117 | |
118 | - $query = 'VACUUM;'; |
|
118 | + $query = 'VACUUM;'; |
|
119 | 119 | $this->cacheDB->exec($query); |
120 | 120 | |
121 | 121 | return $result; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // If its invalid, use SMF's. |
158 | 158 | if (is_null($dir) || !is_writable($dir)) |
159 | - if(is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
159 | + if (is_null($cachedir_sqlite) || !is_writable($cachedir_sqlite)) |
|
160 | 160 | $this->cachedir = $cachedir; |
161 | 161 | else |
162 | 162 | $this->cachedir = $cachedir_sqlite; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | global $db_connection, $db_prefix; |
167 | 167 | |
168 | - pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time() ); |
|
168 | + pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | global $db_connection, $db_prefix; |
191 | 191 | |
192 | - pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM '. $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING'); |
|
192 | + pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM ' . $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING'); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 |
@@ -199,22 +199,22 @@ discard block |
||
199 | 199 | |
200 | 200 | case 'date': |
201 | 201 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
202 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
202 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
203 | 203 | else |
204 | 204 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
205 | 205 | break; |
206 | 206 | |
207 | 207 | case 'time': |
208 | 208 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
209 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
209 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
210 | 210 | else |
211 | 211 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'datetime': |
215 | 215 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
216 | - return 'to_timestamp('. |
|
217 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
216 | + return 'to_timestamp(' . |
|
217 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
218 | 218 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
219 | 219 | else |
220 | 220 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $old_pos = 0; |
425 | 425 | $pos = -1; |
426 | 426 | // Remove the string escape for better runtime |
427 | - $db_string_1 = str_replace('\'\'','',$db_string); |
|
427 | + $db_string_1 = str_replace('\'\'', '', $db_string); |
|
428 | 428 | while (true) |
429 | 429 | { |
430 | 430 | $pos = strpos($db_string_1, '\'', $pos + 1); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | if (!empty($keys) && (count($keys) > 0) && $returnmode > 0) |
803 | 803 | { |
804 | 804 | // we only take the first key |
805 | - $returning = ' RETURNING '.$keys[0]; |
|
805 | + $returning = ' RETURNING ' . $keys[0]; |
|
806 | 806 | $with_returning = true; |
807 | 807 | } |
808 | 808 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
834 | 834 | VALUES |
835 | 835 | ' . implode(', |
836 | - ', $insertRows).$replace.$returning, |
|
836 | + ', $insertRows) . $replace . $returning, |
|
837 | 837 | array( |
838 | 838 | 'security_override' => true, |
839 | 839 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | if ($returnmode === 2) |
847 | 847 | $return_var = array(); |
848 | 848 | |
849 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
849 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
850 | 850 | { |
851 | 851 | if (is_numeric($row[0])) // try to emulate mysql limitation |
852 | 852 | { |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | function smf_db_custom_order($field, $array_values, $desc = false) |
1011 | 1011 | { |
1012 | - $return = 'CASE '. $field . ' '; |
|
1012 | + $return = 'CASE ' . $field . ' '; |
|
1013 | 1013 | $count = count($array_values); |
1014 | 1014 | $then = ($desc ? ' THEN -' : ' THEN '); |
1015 | 1015 |
@@ -722,12 +722,12 @@ |
||
722 | 722 | $where = ''; |
723 | 723 | $count_pk = 0; |
724 | 724 | |
725 | - If ($replace_support) |
|
725 | + if ($replace_support) |
|
726 | 726 | { |
727 | 727 | foreach ($columns as $columnName => $type) |
728 | 728 | { |
729 | 729 | //check pk fiel |
730 | - IF (in_array($columnName, $keys)) |
|
730 | + if (in_array($columnName, $keys)) |
|
731 | 731 | { |
732 | 732 | $key_str .= ($count_pk > 0 ? ',' : ''); |
733 | 733 | $key_str .= $columnName; |
@@ -1697,8 +1697,7 @@ discard block |
||
1697 | 1697 | updateStats('topic'); |
1698 | 1698 | |
1699 | 1699 | // This function is needed to do the updateStats('subject') call. |
1700 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
1701 | - function($string){ |
|
1700 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1702 | 1701 | global $sourcedir; |
1703 | 1702 | if (function_exists('mb_strtolower')) |
1704 | 1703 | return mb_strtolower($string, 'UTF-8'); |
@@ -1767,7 +1766,7 @@ discard block |
||
1767 | 1766 | if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}') |
1768 | 1767 | { |
1769 | 1768 | // Set the ten lines to nothing. |
1770 | - for ($j=0; $j < 10; $j++) |
|
1769 | + for ($j = 0; $j < 10; $j++) |
|
1771 | 1770 | $settingsArray[$i++] = ''; |
1772 | 1771 | |
1773 | 1772 | continue; |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | 'default_password' => 'mysql.default_password', |
37 | 37 | 'default_host' => 'mysql.default_host', |
38 | 38 | 'default_port' => 'mysql.default_port', |
39 | - 'utf8_support' => function() { |
|
39 | + 'utf8_support' => function() |
|
40 | + { |
|
40 | 41 | return true; |
41 | 42 | }, |
42 | 43 | 'utf8_version' => '5.0.22', |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | 'utf8_default' => true, |
45 | 46 | 'utf8_required' => true, |
46 | 47 | 'alter_support' => true, |
47 | - 'validate_prefix' => function(&$value) { |
|
48 | + 'validate_prefix' => function(&$value) |
|
49 | + { |
|
48 | 50 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
49 | 51 | return true; |
50 | 52 | }, |
@@ -58,7 +60,8 @@ discard block |
||
58 | 60 | 'always_has_db' => true, |
59 | 61 | 'utf8_default' => true, |
60 | 62 | 'utf8_required' => true, |
61 | - 'utf8_support' => function() { |
|
63 | + 'utf8_support' => function() |
|
64 | + { |
|
62 | 65 | $request = pg_query('SHOW SERVER_ENCODING'); |
63 | 66 | |
64 | 67 | list ($charcode) = pg_fetch_row($request); |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | }, |
71 | 74 | 'utf8_version' => '8.0', |
72 | 75 | 'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;', |
73 | - 'validate_prefix' => function(&$value) { |
|
76 | + 'validate_prefix' => function(&$value) |
|
77 | + { |
|
74 | 78 | global $txt; |
75 | 79 | |
76 | 80 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
@@ -963,13 +967,15 @@ discard block |
||
963 | 967 | |
964 | 968 | // If redirect in effect, force ssl ON |
965 | 969 | require_once(dirname(__FILE__) . '/Sources/Subs.php'); |
966 | - if (https_redirect_active($incontext['detected_url'])) { |
|
970 | + if (https_redirect_active($incontext['detected_url'])) |
|
971 | + { |
|
967 | 972 | $incontext['ssl_chkbx_protected'] = true; |
968 | 973 | $incontext['ssl_chkbx_checked'] = true; |
969 | 974 | $_POST['force_ssl'] = true; |
970 | 975 | } |
971 | 976 | // If no cert, make sure ssl stays OFF |
972 | - if (!ssl_cert_found($incontext['detected_url'])) { |
|
977 | + if (!ssl_cert_found($incontext['detected_url'])) |
|
978 | + { |
|
973 | 979 | $incontext['ssl_chkbx_protected'] = true; |
974 | 980 | $incontext['ssl_chkbx_checked'] = false; |
975 | 981 | } |
@@ -1438,7 +1444,8 @@ discard block |
||
1438 | 1444 | reloadSettings(); |
1439 | 1445 | |
1440 | 1446 | // We need this to properly hash the password for Admin |
1441 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1447 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) |
|
1448 | + { |
|
1442 | 1449 | global $sourcedir; |
1443 | 1450 | if (function_exists('mb_strtolower')) |
1444 | 1451 | return mb_strtolower($string, 'UTF-8'); |
@@ -1696,7 +1703,8 @@ discard block |
||
1696 | 1703 | |
1697 | 1704 | // This function is needed to do the updateStats('subject') call. |
1698 | 1705 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
1699 | - function($string){ |
|
1706 | + function($string) |
|
1707 | + { |
|
1700 | 1708 | global $sourcedir; |
1701 | 1709 | if (function_exists('mb_strtolower')) |
1702 | 1710 | return mb_strtolower($string, 'UTF-8'); |
@@ -300,7 +300,7 @@ |
||
300 | 300 | echo ' |
301 | 301 | <div class="g-recaptcha centertext" data-sitekey="' . $verify_context['recaptcha_site_key'] . '" data-theme="' . $verify_context['recaptcha_theme'] . '"></div> |
302 | 302 | <br> |
303 | - <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>'; |
|
303 | + <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang . '"></script>'; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | else |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | { |
127 | 127 | $smcFunc['db_transaction']('begin'); |
128 | 128 | $db_trans = true; |
129 | - $smcFunc['db_drop_table']($table_name.'_old'); |
|
130 | - $smcFunc['db_query']('',' |
|
131 | - RENAME TABLE '. $table_name .' TO ' . $table_name . '_old', |
|
129 | + $smcFunc['db_drop_table']($table_name . '_old'); |
|
130 | + $smcFunc['db_query']('', ' |
|
131 | + RENAME TABLE '. $table_name . ' TO ' . $table_name . '_old', |
|
132 | 132 | array( |
133 | 133 | 'security_override' => true, |
134 | 134 | ) |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | { |
203 | 203 | $same_col = array(); |
204 | 204 | |
205 | - $request = $smcFunc['db_query']('',' |
|
205 | + $request = $smcFunc['db_query']('', ' |
|
206 | 206 | SELECT count(*), column_name |
207 | 207 | FROM information_schema.columns |
208 | 208 | WHERE table_name in ({string:table1},{string:table2}) AND table_schema = {string:schema} |
209 | 209 | GROUP BY column_name |
210 | 210 | HAVING count(*) > 1', |
211 | - array ( |
|
211 | + array( |
|
212 | 212 | 'table1' => $table_name, |
213 | - 'table2' => $table_name.'_old', |
|
213 | + 'table2' => $table_name . '_old', |
|
214 | 214 | 'schema' => $db_name, |
215 | 215 | ) |
216 | 216 | ); |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | $same_col[] = $row['column_name']; |
221 | 221 | } |
222 | 222 | |
223 | - $smcFunc['db_query']('',' |
|
224 | - INSERT INTO ' . $table_name .'(' |
|
223 | + $smcFunc['db_query']('', ' |
|
224 | + INSERT INTO ' . $table_name . '(' |
|
225 | 225 | . implode($same_col, ',') . |
226 | 226 | ') |
227 | 227 | SELECT '. implode($same_col, ',') . ' |
@@ -104,7 +104,7 @@ |
||
104 | 104 | * |
105 | 105 | * @param string $class The fully-qualified class name. |
106 | 106 | */ |
107 | -spl_autoload_register(function ($class) use ($sourcedir) |
|
107 | +spl_autoload_register(function($class) use ($sourcedir) |
|
108 | 108 | { |
109 | 109 | $classMap = array( |
110 | 110 | 'ReCaptcha\\' => 'ReCaptcha/', |
@@ -430,8 +430,8 @@ |
||
430 | 430 | $real_name = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name'; |
431 | 431 | |
432 | 432 | // Searches. |
433 | - $member_name_search = $member_name . ' ' . $comparison . ' ' . implode( ' OR ' . $member_name . ' ' . $comparison . ' ', $names_list); |
|
434 | - $real_name_search = $real_name . ' ' . $comparison . ' ' . implode( ' OR ' . $real_name . ' ' . $comparison . ' ', $names_list); |
|
433 | + $member_name_search = $member_name . ' ' . $comparison . ' ' . implode(' OR ' . $member_name . ' ' . $comparison . ' ', $names_list); |
|
434 | + $real_name_search = $real_name . ' ' . $comparison . ' ' . implode(' OR ' . $real_name . ' ' . $comparison . ' ', $names_list); |
|
435 | 435 | |
436 | 436 | // Search by username, display name, and email address. |
437 | 437 | $request = $smcFunc['db_query']('', ' |