@@ -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)) |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1211 | 1211 | ), |
| 1212 | 1212 | 'content' => '$1', |
| 1213 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1213 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1214 | 1214 | { |
| 1215 | 1215 | $returnContext = ''; |
| 1216 | 1216 | |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1248 | - $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 | + $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>'; |
|
| 1249 | 1249 | else |
| 1250 | 1250 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
| 1251 | 1251 | } |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | 'type' => 'unparsed_content', |
| 1298 | 1298 | '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>', |
| 1299 | 1299 | // @todo Maybe this can be simplified? |
| 1300 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1300 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1301 | 1301 | { |
| 1302 | 1302 | if (!isset($disabled['code'])) |
| 1303 | 1303 | { |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | 'type' => 'unparsed_equals_content', |
| 1335 | 1335 | '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>', |
| 1336 | 1336 | // @todo Maybe this can be simplified? |
| 1337 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1337 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1338 | 1338 | { |
| 1339 | 1339 | if (!isset($disabled['code'])) |
| 1340 | 1340 | { |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | 'type' => 'unparsed_content', |
| 1379 | 1379 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1380 | 1380 | // @todo Should this respect guest_hideContacts? |
| 1381 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1381 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1382 | 1382 | { |
| 1383 | 1383 | $data = strtr($data, array('<br>' => '')); |
| 1384 | 1384 | }, |
@@ -1398,7 +1398,7 @@ discard block |
||
| 1398 | 1398 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1399 | 1399 | 'before' => '<div $1>', |
| 1400 | 1400 | 'after' => '</div>', |
| 1401 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1401 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1402 | 1402 | { |
| 1403 | 1403 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
| 1404 | 1404 | |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1485 | 1485 | ), |
| 1486 | 1486 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1487 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1487 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1488 | 1488 | { |
| 1489 | 1489 | global $image_proxy_enabled, $user_info; |
| 1490 | 1490 | |
@@ -1510,7 +1510,7 @@ discard block |
||
| 1510 | 1510 | 'tag' => 'img', |
| 1511 | 1511 | 'type' => 'unparsed_content', |
| 1512 | 1512 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1513 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1513 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1514 | 1514 | { |
| 1515 | 1515 | global $image_proxy_enabled, $user_info; |
| 1516 | 1516 | |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | 'tag' => 'iurl', |
| 1537 | 1537 | 'type' => 'unparsed_content', |
| 1538 | 1538 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1539 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1539 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1540 | 1540 | { |
| 1541 | 1541 | $data = strtr($data, array('<br>' => '')); |
| 1542 | 1542 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1550,7 +1550,7 @@ discard block |
||
| 1550 | 1550 | 'quoted' => 'optional', |
| 1551 | 1551 | 'before' => '<a href="$1" class="bbc_link">', |
| 1552 | 1552 | 'after' => '</a>', |
| 1553 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1553 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1554 | 1554 | { |
| 1555 | 1555 | if (substr($data, 0, 1) == '#') |
| 1556 | 1556 | $data = '#post_' . substr($data, 1); |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | 'tag' => 'php', |
| 1644 | 1644 | 'type' => 'unparsed_content', |
| 1645 | 1645 | 'content' => '<span class="phpcode">$1</span>', |
| 1646 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1646 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1647 | 1647 | { |
| 1648 | 1648 | if (!isset($disabled['php'])) |
| 1649 | 1649 | { |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | 'test' => '[1-7]\]', |
| 1793 | 1793 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1794 | 1794 | 'after' => '</span>', |
| 1795 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1795 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1796 | 1796 | { |
| 1797 | 1797 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1798 | 1798 | $data = $sizes[$data] . 'em'; |
@@ -1830,7 +1830,7 @@ discard block |
||
| 1830 | 1830 | 'tag' => 'time', |
| 1831 | 1831 | 'type' => 'unparsed_content', |
| 1832 | 1832 | 'content' => '$1', |
| 1833 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1833 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1834 | 1834 | { |
| 1835 | 1835 | if (is_numeric($data)) |
| 1836 | 1836 | $data = timeformat($data); |
@@ -1863,7 +1863,7 @@ discard block |
||
| 1863 | 1863 | 'tag' => 'url', |
| 1864 | 1864 | 'type' => 'unparsed_content', |
| 1865 | 1865 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1866 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1866 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1867 | 1867 | { |
| 1868 | 1868 | $data = strtr($data, array('<br>' => '')); |
| 1869 | 1869 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1877,7 +1877,7 @@ discard block |
||
| 1877 | 1877 | 'quoted' => 'optional', |
| 1878 | 1878 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1879 | 1879 | 'after' => '</a>', |
| 1880 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1880 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1881 | 1881 | { |
| 1882 | 1882 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1883 | 1883 | if (empty($scheme)) |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | { |
| 1924 | 1924 | if (isset($temp_bbc)) |
| 1925 | 1925 | $bbc_codes = $temp_bbc; |
| 1926 | - usort($codes, function ($a, $b) { |
|
| 1926 | + usort($codes, function($a, $b) { |
|
| 1927 | 1927 | return strcmp($a['tag'], $b['tag']); |
| 1928 | 1928 | }); |
| 1929 | 1929 | return $codes; |
@@ -2139,7 +2139,7 @@ discard block |
||
| 2139 | 2139 | # a run of Unicode domain name characters and a dot |
| 2140 | 2140 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2141 | 2141 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2142 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2142 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 2143 | 2143 | ) |
| 2144 | 2144 | # followed by a non-domain character or end of line |
| 2145 | 2145 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | )? |
| 2208 | 2208 | '; |
| 2209 | 2209 | |
| 2210 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2210 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2211 | 2211 | $url = array_shift($matches); |
| 2212 | 2212 | |
| 2213 | 2213 | // If this isn't a clean URL, bail out |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | $fullUrl = $url; |
| 2233 | 2233 | |
| 2234 | 2234 | // Make sure that $fullUrl really is valid |
| 2235 | - if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false) |
|
| 2235 | + if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false) |
|
| 2236 | 2236 | return $url; |
| 2237 | 2237 | |
| 2238 | 2238 | return '[url="' . str_replace(array('[', ']'), array('[', ']'), $fullUrl) . '"]' . $url . '[/url]'; |
@@ -2296,7 +2296,7 @@ discard block |
||
| 2296 | 2296 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2297 | 2297 | |
| 2298 | 2298 | // A closing tag that doesn't match any open tags? Skip it. |
| 2299 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2299 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2300 | 2300 | continue; |
| 2301 | 2301 | |
| 2302 | 2302 | $to_close = array(); |
@@ -2969,7 +2969,7 @@ discard block |
||
| 2969 | 2969 | { |
| 2970 | 2970 | $exts = array('svg', 'png', 'gif', 'jpg'); |
| 2971 | 2971 | $fname = pathinfo($smileysto[$i], PATHINFO_FILENAME); |
| 2972 | - $alt_images = glob($smileys_dir . $fname . '.{' . (implode(',', $exts)) . '}', GLOB_BRACE); |
|
| 2972 | + $alt_images = glob($smileys_dir . $fname . '.{' . (implode(',', $exts)) . '}', GLOB_BRACE); |
|
| 2973 | 2973 | if (!empty($alt_images)) |
| 2974 | 2974 | { |
| 2975 | 2975 | foreach ($exts as $ext) |
@@ -2985,7 +2985,7 @@ discard block |
||
| 2985 | 2985 | } |
| 2986 | 2986 | |
| 2987 | 2987 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2988 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2988 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2989 | 2989 | |
| 2990 | 2990 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2991 | 2991 | |
@@ -3010,7 +3010,7 @@ discard block |
||
| 3010 | 3010 | |
| 3011 | 3011 | // Replace away! |
| 3012 | 3012 | $message = preg_replace_callback($smileyPregSearch, |
| 3013 | - function ($matches) use ($smileyPregReplacements) |
|
| 3013 | + function($matches) use ($smileyPregReplacements) |
|
| 3014 | 3014 | { |
| 3015 | 3015 | return $smileyPregReplacements[$matches[1]]; |
| 3016 | 3016 | }, $message); |
@@ -3107,13 +3107,13 @@ discard block |
||
| 3107 | 3107 | { |
| 3108 | 3108 | if (defined('SID') && SID != '') |
| 3109 | 3109 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 3110 | - function ($m) use ($scripturl) |
|
| 3110 | + function($m) use ($scripturl) |
|
| 3111 | 3111 | { |
| 3112 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 3112 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 3113 | 3113 | }, $setLocation); |
| 3114 | 3114 | else |
| 3115 | 3115 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 3116 | - function ($m) use ($scripturl) |
|
| 3116 | + function($m) use ($scripturl) |
|
| 3117 | 3117 | { |
| 3118 | 3118 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 3119 | 3119 | }, $setLocation); |
@@ -3434,7 +3434,7 @@ discard block |
||
| 3434 | 3434 | |
| 3435 | 3435 | // Add a generic "Are you sure?" confirmation message. |
| 3436 | 3436 | addInlineJavaScript(' |
| 3437 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3437 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3438 | 3438 | |
| 3439 | 3439 | // Now add the capping code for avatars. |
| 3440 | 3440 | 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') |
@@ -3900,7 +3900,7 @@ discard block |
||
| 3900 | 3900 | if (!empty($normal)) |
| 3901 | 3901 | foreach ($normal as $nf) |
| 3902 | 3902 | echo ' |
| 3903 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3903 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3904 | 3904 | |
| 3905 | 3905 | if ($db_show_debug === true) |
| 3906 | 3906 | { |
@@ -3916,7 +3916,7 @@ discard block |
||
| 3916 | 3916 | <style>'; |
| 3917 | 3917 | |
| 3918 | 3918 | foreach ($context['css_header'] as $css) |
| 3919 | - echo $css .' |
|
| 3919 | + echo $css . ' |
|
| 3920 | 3920 | '; |
| 3921 | 3921 | |
| 3922 | 3922 | echo' |
@@ -3960,7 +3960,7 @@ discard block |
||
| 3960 | 3960 | |
| 3961 | 3961 | |
| 3962 | 3962 | // No namespaces, sorry! |
| 3963 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3963 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3964 | 3964 | |
| 3965 | 3965 | // Temp path. |
| 3966 | 3966 | $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
@@ -4140,7 +4140,7 @@ discard block |
||
| 4140 | 4140 | else |
| 4141 | 4141 | $path = $modSettings['attachmentUploadDir']; |
| 4142 | 4142 | |
| 4143 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 4143 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 4144 | 4144 | } |
| 4145 | 4145 | |
| 4146 | 4146 | /** |
@@ -4184,10 +4184,10 @@ discard block |
||
| 4184 | 4184 | $valid_low = isValidIP($ip_parts[0]); |
| 4185 | 4185 | $valid_high = isValidIP($ip_parts[1]); |
| 4186 | 4186 | $count = 0; |
| 4187 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4187 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4188 | 4188 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 4189 | 4189 | $min = 0; |
| 4190 | - if(!$valid_low) |
|
| 4190 | + if (!$valid_low) |
|
| 4191 | 4191 | { |
| 4192 | 4192 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 4193 | 4193 | $valid_low = isValidIP($ip_parts[0]); |
@@ -4201,7 +4201,7 @@ discard block |
||
| 4201 | 4201 | } |
| 4202 | 4202 | |
| 4203 | 4203 | $count = 0; |
| 4204 | - if(!$valid_high) |
|
| 4204 | + if (!$valid_high) |
|
| 4205 | 4205 | { |
| 4206 | 4206 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 4207 | 4207 | $valid_high = isValidIP($ip_parts[1]); |
@@ -4214,7 +4214,7 @@ discard block |
||
| 4214 | 4214 | } |
| 4215 | 4215 | } |
| 4216 | 4216 | |
| 4217 | - if($valid_high && $valid_low) |
|
| 4217 | + if ($valid_high && $valid_low) |
|
| 4218 | 4218 | { |
| 4219 | 4219 | $ip_array['low'] = $ip_parts[0]; |
| 4220 | 4220 | $ip_array['high'] = $ip_parts[1]; |
@@ -4395,7 +4395,7 @@ discard block |
||
| 4395 | 4395 | addInlineJavaScript(' |
| 4396 | 4396 | var user_menus = new smc_PopupMenu(); |
| 4397 | 4397 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4398 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4398 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4399 | 4399 | if ($context['allow_pm']) |
| 4400 | 4400 | addInlineJavaScript(' |
| 4401 | 4401 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4690,7 +4690,7 @@ discard block |
||
| 4690 | 4690 | $context['total_admin_reports'] += $context['unapproved_members']; |
| 4691 | 4691 | } |
| 4692 | 4692 | |
| 4693 | - if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4693 | + if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4694 | 4694 | { |
| 4695 | 4695 | $context['menu_buttons']['admin']['amt'] = $context['total_admin_reports']; |
| 4696 | 4696 | } |
@@ -5037,7 +5037,7 @@ discard block |
||
| 5037 | 5037 | // No? try a fallback to $sourcedir |
| 5038 | 5038 | else |
| 5039 | 5039 | { |
| 5040 | - $absPath = $sourcedir .'/'. $file; |
|
| 5040 | + $absPath = $sourcedir . '/' . $file; |
|
| 5041 | 5041 | |
| 5042 | 5042 | if (file_exists($absPath)) |
| 5043 | 5043 | require_once($absPath); |
@@ -5304,15 +5304,15 @@ discard block |
||
| 5304 | 5304 | |
| 5305 | 5305 | // UTF-8 occurences of MS special characters |
| 5306 | 5306 | $findchars_utf8 = array( |
| 5307 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5308 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5309 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5310 | - "\xe2\x80\x98", // left single curly quote |
|
| 5311 | - "\xe2\x80\x99", // right single curly quote |
|
| 5312 | - "\xe2\x80\x9c", // left double curly quote |
|
| 5313 | - "\xe2\x80\x9d", // right double curly quote |
|
| 5314 | - "\xe2\x80\x93", // en dash |
|
| 5315 | - "\xe2\x80\x94", // em dash |
|
| 5307 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5308 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5309 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5310 | + "\xe2\x80\x98", // left single curly quote |
|
| 5311 | + "\xe2\x80\x99", // right single curly quote |
|
| 5312 | + "\xe2\x80\x9c", // left double curly quote |
|
| 5313 | + "\xe2\x80\x9d", // right double curly quote |
|
| 5314 | + "\xe2\x80\x93", // en dash |
|
| 5315 | + "\xe2\x80\x94", // em dash |
|
| 5316 | 5316 | ); |
| 5317 | 5317 | |
| 5318 | 5318 | // windows 1252 / iso equivalents |
@@ -5330,15 +5330,15 @@ discard block |
||
| 5330 | 5330 | |
| 5331 | 5331 | // safe replacements |
| 5332 | 5332 | $replacechars = array( |
| 5333 | - ',', // ‚ |
|
| 5334 | - ',,', // „ |
|
| 5335 | - '...', // … |
|
| 5336 | - "'", // ‘ |
|
| 5337 | - "'", // ’ |
|
| 5338 | - '"', // “ |
|
| 5339 | - '"', // ” |
|
| 5340 | - '-', // – |
|
| 5341 | - '--', // — |
|
| 5333 | + ',', // ‚ |
|
| 5334 | + ',,', // „ |
|
| 5335 | + '...', // … |
|
| 5336 | + "'", // ‘ |
|
| 5337 | + "'", // ’ |
|
| 5338 | + '"', // “ |
|
| 5339 | + '"', // ” |
|
| 5340 | + '-', // – |
|
| 5341 | + '--', // — |
|
| 5342 | 5342 | ); |
| 5343 | 5343 | |
| 5344 | 5344 | if ($context['utf8']) |
@@ -5658,7 +5658,7 @@ discard block |
||
| 5658 | 5658 | */ |
| 5659 | 5659 | function inet_dtop($bin) |
| 5660 | 5660 | { |
| 5661 | - if(empty($bin)) |
|
| 5661 | + if (empty($bin)) |
|
| 5662 | 5662 | return ''; |
| 5663 | 5663 | |
| 5664 | 5664 | global $db_type; |
@@ -5689,28 +5689,28 @@ discard block |
||
| 5689 | 5689 | */ |
| 5690 | 5690 | function _safe_serialize($value) |
| 5691 | 5691 | { |
| 5692 | - if(is_null($value)) |
|
| 5692 | + if (is_null($value)) |
|
| 5693 | 5693 | return 'N;'; |
| 5694 | 5694 | |
| 5695 | - if(is_bool($value)) |
|
| 5696 | - return 'b:'. (int) $value .';'; |
|
| 5695 | + if (is_bool($value)) |
|
| 5696 | + return 'b:' . (int) $value . ';'; |
|
| 5697 | 5697 | |
| 5698 | - if(is_int($value)) |
|
| 5699 | - return 'i:'. $value .';'; |
|
| 5698 | + if (is_int($value)) |
|
| 5699 | + return 'i:' . $value . ';'; |
|
| 5700 | 5700 | |
| 5701 | - if(is_float($value)) |
|
| 5702 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5701 | + if (is_float($value)) |
|
| 5702 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5703 | 5703 | |
| 5704 | - if(is_string($value)) |
|
| 5705 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5704 | + if (is_string($value)) |
|
| 5705 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5706 | 5706 | |
| 5707 | - if(is_array($value)) |
|
| 5707 | + if (is_array($value)) |
|
| 5708 | 5708 | { |
| 5709 | 5709 | $out = ''; |
| 5710 | - foreach($value as $k => $v) |
|
| 5710 | + foreach ($value as $k => $v) |
|
| 5711 | 5711 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5712 | 5712 | |
| 5713 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5713 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5714 | 5714 | } |
| 5715 | 5715 | |
| 5716 | 5716 | // safe_serialize cannot serialize resources or objects. |
@@ -5752,7 +5752,7 @@ discard block |
||
| 5752 | 5752 | function _safe_unserialize($str) |
| 5753 | 5753 | { |
| 5754 | 5754 | // Input is not a string. |
| 5755 | - if(empty($str) || !is_string($str)) |
|
| 5755 | + if (empty($str) || !is_string($str)) |
|
| 5756 | 5756 | return false; |
| 5757 | 5757 | |
| 5758 | 5758 | $stack = array(); |
@@ -5766,40 +5766,40 @@ discard block |
||
| 5766 | 5766 | * 3 - in array, expecting value or another array |
| 5767 | 5767 | */ |
| 5768 | 5768 | $state = 0; |
| 5769 | - while($state != 1) |
|
| 5769 | + while ($state != 1) |
|
| 5770 | 5770 | { |
| 5771 | 5771 | $type = isset($str[0]) ? $str[0] : ''; |
| 5772 | - if($type == '}') |
|
| 5772 | + if ($type == '}') |
|
| 5773 | 5773 | $str = substr($str, 1); |
| 5774 | 5774 | |
| 5775 | - else if($type == 'N' && $str[1] == ';') |
|
| 5775 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5776 | 5776 | { |
| 5777 | 5777 | $value = null; |
| 5778 | 5778 | $str = substr($str, 2); |
| 5779 | 5779 | } |
| 5780 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5780 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5781 | 5781 | { |
| 5782 | 5782 | $value = $matches[1] == '1' ? true : false; |
| 5783 | 5783 | $str = substr($str, 4); |
| 5784 | 5784 | } |
| 5785 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5785 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5786 | 5786 | { |
| 5787 | - $value = (int)$matches[1]; |
|
| 5787 | + $value = (int) $matches[1]; |
|
| 5788 | 5788 | $str = $matches[2]; |
| 5789 | 5789 | } |
| 5790 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5790 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5791 | 5791 | { |
| 5792 | - $value = (float)$matches[1]; |
|
| 5792 | + $value = (float) $matches[1]; |
|
| 5793 | 5793 | $str = $matches[3]; |
| 5794 | 5794 | } |
| 5795 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5795 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5796 | 5796 | { |
| 5797 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5798 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5797 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5798 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5799 | 5799 | } |
| 5800 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5800 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5801 | 5801 | { |
| 5802 | - $expectedLength = (int)$matches[1]; |
|
| 5802 | + $expectedLength = (int) $matches[1]; |
|
| 5803 | 5803 | $str = $matches[2]; |
| 5804 | 5804 | } |
| 5805 | 5805 | |
@@ -5807,10 +5807,10 @@ discard block |
||
| 5807 | 5807 | else |
| 5808 | 5808 | return false; |
| 5809 | 5809 | |
| 5810 | - switch($state) |
|
| 5810 | + switch ($state) |
|
| 5811 | 5811 | { |
| 5812 | 5812 | case 3: // In array, expecting value or another array. |
| 5813 | - if($type == 'a') |
|
| 5813 | + if ($type == 'a') |
|
| 5814 | 5814 | { |
| 5815 | 5815 | $stack[] = &$list; |
| 5816 | 5816 | $list[$key] = array(); |
@@ -5819,7 +5819,7 @@ discard block |
||
| 5819 | 5819 | $state = 2; |
| 5820 | 5820 | break; |
| 5821 | 5821 | } |
| 5822 | - if($type != '}') |
|
| 5822 | + if ($type != '}') |
|
| 5823 | 5823 | { |
| 5824 | 5824 | $list[$key] = $value; |
| 5825 | 5825 | $state = 2; |
@@ -5830,29 +5830,29 @@ discard block |
||
| 5830 | 5830 | return false; |
| 5831 | 5831 | |
| 5832 | 5832 | case 2: // in array, expecting end of array or a key |
| 5833 | - if($type == '}') |
|
| 5833 | + if ($type == '}') |
|
| 5834 | 5834 | { |
| 5835 | 5835 | // Array size is less than expected. |
| 5836 | - if(count($list) < end($expected)) |
|
| 5836 | + if (count($list) < end($expected)) |
|
| 5837 | 5837 | return false; |
| 5838 | 5838 | |
| 5839 | 5839 | unset($list); |
| 5840 | - $list = &$stack[count($stack)-1]; |
|
| 5840 | + $list = &$stack[count($stack) - 1]; |
|
| 5841 | 5841 | array_pop($stack); |
| 5842 | 5842 | |
| 5843 | 5843 | // Go to terminal state if we're at the end of the root array. |
| 5844 | 5844 | array_pop($expected); |
| 5845 | 5845 | |
| 5846 | - if(count($expected) == 0) |
|
| 5846 | + if (count($expected) == 0) |
|
| 5847 | 5847 | $state = 1; |
| 5848 | 5848 | |
| 5849 | 5849 | break; |
| 5850 | 5850 | } |
| 5851 | 5851 | |
| 5852 | - if($type == 'i' || $type == 's') |
|
| 5852 | + if ($type == 'i' || $type == 's') |
|
| 5853 | 5853 | { |
| 5854 | 5854 | // Array size exceeds expected length. |
| 5855 | - if(count($list) >= end($expected)) |
|
| 5855 | + if (count($list) >= end($expected)) |
|
| 5856 | 5856 | return false; |
| 5857 | 5857 | |
| 5858 | 5858 | $key = $value; |
@@ -5865,7 +5865,7 @@ discard block |
||
| 5865 | 5865 | |
| 5866 | 5866 | // Expecting array or value. |
| 5867 | 5867 | case 0: |
| 5868 | - if($type == 'a') |
|
| 5868 | + if ($type == 'a') |
|
| 5869 | 5869 | { |
| 5870 | 5870 | $data = array(); |
| 5871 | 5871 | $list = &$data; |
@@ -5874,7 +5874,7 @@ discard block |
||
| 5874 | 5874 | break; |
| 5875 | 5875 | } |
| 5876 | 5876 | |
| 5877 | - if($type != '}') |
|
| 5877 | + if ($type != '}') |
|
| 5878 | 5878 | { |
| 5879 | 5879 | $data = $value; |
| 5880 | 5880 | $state = 1; |
@@ -5887,7 +5887,7 @@ discard block |
||
| 5887 | 5887 | } |
| 5888 | 5888 | |
| 5889 | 5889 | // Trailing data in input. |
| 5890 | - if(!empty($str)) |
|
| 5890 | + if (!empty($str)) |
|
| 5891 | 5891 | return false; |
| 5892 | 5892 | |
| 5893 | 5893 | return $data; |
@@ -5941,7 +5941,7 @@ discard block |
||
| 5941 | 5941 | // Set different modes. |
| 5942 | 5942 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5943 | 5943 | |
| 5944 | - foreach($chmodValues as $val) |
|
| 5944 | + foreach ($chmodValues as $val) |
|
| 5945 | 5945 | { |
| 5946 | 5946 | // If it's writable, break out of the loop. |
| 5947 | 5947 | if (is_writable($file)) |
@@ -5976,13 +5976,13 @@ discard block |
||
| 5976 | 5976 | $returnArray = @json_decode($json, $returnAsArray); |
| 5977 | 5977 | |
| 5978 | 5978 | // PHP 5.3 so no json_last_error_msg() |
| 5979 | - switch(json_last_error()) |
|
| 5979 | + switch (json_last_error()) |
|
| 5980 | 5980 | { |
| 5981 | 5981 | case JSON_ERROR_NONE: |
| 5982 | 5982 | $jsonError = false; |
| 5983 | 5983 | break; |
| 5984 | 5984 | case JSON_ERROR_DEPTH: |
| 5985 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5985 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5986 | 5986 | break; |
| 5987 | 5987 | case JSON_ERROR_STATE_MISMATCH: |
| 5988 | 5988 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -6010,10 +6010,10 @@ discard block |
||
| 6010 | 6010 | loadLanguage('Errors'); |
| 6011 | 6011 | |
| 6012 | 6012 | if (!empty($jsonDebug)) |
| 6013 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 6013 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 6014 | 6014 | |
| 6015 | 6015 | else |
| 6016 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 6016 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 6017 | 6017 | |
| 6018 | 6018 | // Everyone expects an array. |
| 6019 | 6019 | return array(); |
@@ -6130,7 +6130,7 @@ discard block |
||
| 6130 | 6130 | // Convert Punycode to Unicode |
| 6131 | 6131 | require_once($sourcedir . '/Class-Punycode.php'); |
| 6132 | 6132 | $Punycode = new Punycode(); |
| 6133 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6133 | + $tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6134 | 6134 | } |
| 6135 | 6135 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
| 6136 | 6136 | else |
@@ -6224,7 +6224,7 @@ discard block |
||
| 6224 | 6224 | } |
| 6225 | 6225 | |
| 6226 | 6226 | // This recursive function creates the index array from the strings |
| 6227 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6227 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6228 | 6228 | { |
| 6229 | 6229 | static $depth = 0; |
| 6230 | 6230 | $depth++; |
@@ -6251,7 +6251,7 @@ discard block |
||
| 6251 | 6251 | }; |
| 6252 | 6252 | |
| 6253 | 6253 | // This recursive function turns the index array into a regular expression |
| 6254 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6254 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6255 | 6255 | { |
| 6256 | 6256 | static $depth = 0; |
| 6257 | 6257 | $depth++; |
@@ -6275,11 +6275,11 @@ discard block |
||
| 6275 | 6275 | |
| 6276 | 6276 | if (count(array_keys($value)) == 1) |
| 6277 | 6277 | { |
| 6278 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 6278 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 6279 | 6279 | $new_key .= $new_key_array[0]; |
| 6280 | 6280 | } |
| 6281 | 6281 | else |
| 6282 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 6282 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 6283 | 6283 | } |
| 6284 | 6284 | |
| 6285 | 6285 | if ($depth > 1) |
@@ -6322,10 +6322,10 @@ discard block |
||
| 6322 | 6322 | { |
| 6323 | 6323 | $regex = array(); |
| 6324 | 6324 | while (!empty($index)) |
| 6325 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6325 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6326 | 6326 | } |
| 6327 | 6327 | else |
| 6328 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6328 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6329 | 6329 | |
| 6330 | 6330 | // Restore PHP's internal character encoding to whatever it was originally |
| 6331 | 6331 | if (!empty($current_encoding)) |
@@ -6549,7 +6549,7 @@ discard block |
||
| 6549 | 6549 | function sanitize_iri($iri) |
| 6550 | 6550 | { |
| 6551 | 6551 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
| 6552 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
| 6552 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) { |
|
| 6553 | 6553 | return rawurlencode($matches[0]); |
| 6554 | 6554 | }, $iri); |
| 6555 | 6555 | |
@@ -6591,7 +6591,7 @@ discard block |
||
| 6591 | 6591 | $unescaped = array( |
| 6592 | 6592 | '%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&', |
| 6593 | 6593 | '%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*', |
| 6594 | - '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
| 6594 | + '%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':', |
|
| 6595 | 6595 | '%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@', |
| 6596 | 6596 | ); |
| 6597 | 6597 | $iri = strtr(rawurlencode($iri), $unescaped); |