@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | require_once($sourcedir . '/Load.php'); |
| 76 | 76 | |
| 77 | 77 | // If $maintenance is set specifically to 2, then we're upgrading or something. |
| 78 | -if (!empty($maintenance) && 2 === $maintenance) |
|
| 78 | +if (!empty($maintenance) && 2 === $maintenance) |
|
| 79 | 79 | display_maintenance_message(); |
| 80 | 80 | |
| 81 | 81 | // Create a variable to store some SMF specific functions in. |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @param string $class The fully-qualified class name. |
| 127 | 127 | */ |
| 128 | -spl_autoload_register(function ($class) use ($sourcedir) |
|
| 128 | +spl_autoload_register(function($class) use ($sourcedir) |
|
| 129 | 129 | { |
| 130 | 130 | $classMap = array( |
| 131 | 131 | 'ReCaptcha\\' => 'ReCaptcha/', |
@@ -282,7 +282,7 @@ |
||
| 282 | 282 | '{db_prefix}log_notify', |
| 283 | 283 | array('id_member' => 'int', 'id_topic' => 'int', 'id_board' => 'int'), |
| 284 | 284 | array($user_info['id'], $log['id_topic'], 0), |
| 285 | - array('id_member','id_topic', 'id_board') |
|
| 285 | + array('id_member', 'id_topic', 'id_board') |
|
| 286 | 286 | ); |
| 287 | 287 | } |
| 288 | 288 | else |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | { |
| 378 | 378 | $val = 'CASE '; |
| 379 | 379 | foreach ($members as $k => $v) |
| 380 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' '; |
|
| 380 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' '; |
|
| 381 | 381 | |
| 382 | 382 | $val = $val . ' END'; |
| 383 | 383 | $type = 'raw'; |
@@ -1041,11 +1041,11 @@ discard block |
||
| 1041 | 1041 | // Anything that isn't a specification, punctuation mark, or whitespace. |
| 1042 | 1042 | '~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u', |
| 1043 | 1043 | // A series of punctuation marks (except %), possibly separated by whitespace. |
| 1044 | - '~([^%\P{P}])(\s*)(?'.'>(\1|[^%\P{Po}])\s*(?!$))*~u', |
|
| 1044 | + '~([^%\P{P}])(\s*)(?' . '>(\1|[^%\P{Po}])\s*(?!$))*~u', |
|
| 1045 | 1045 | // Unwanted trailing punctuation and whitespace. |
| 1046 | - '~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u', |
|
| 1046 | + '~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u', |
|
| 1047 | 1047 | // Unwanted opening punctuation and whitespace. |
| 1048 | - '~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u', |
|
| 1048 | + '~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u', |
|
| 1049 | 1049 | ), |
| 1050 | 1050 | array( |
| 1051 | 1051 | '', |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | $width = !empty($width) ? ' width="' . $width . '"' : ''; |
| 1453 | 1453 | $height = !empty($height) ? ' height="' . $height . '"' : ''; |
| 1454 | 1454 | |
| 1455 | - $returnContext .= '<div class="videocontainer"><div><video controls preload="none" src="'. $currentAttachment['href'] . '" playsinline' . $width . $height . ' style="object-fit:contain;"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : ''); |
|
| 1455 | + $returnContext .= '<div class="videocontainer"><div><video controls preload="none" src="' . $currentAttachment['href'] . '" playsinline' . $width . $height . ' style="object-fit:contain;"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : ''); |
|
| 1456 | 1456 | } |
| 1457 | 1457 | // Audio. |
| 1458 | 1458 | elseif (strpos($currentAttachment['mime_type'], 'audio/') === 0) |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | $width = 'max-width:100%; width: ' . (!empty($width) ? $width : '400') . 'px;'; |
| 1461 | 1461 | $height = !empty($height) ? 'height: ' . $height . 'px;' : ''; |
| 1462 | 1462 | |
| 1463 | - $returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="'. $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>'; |
|
| 1463 | + $returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="' . $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>'; |
|
| 1464 | 1464 | } |
| 1465 | 1465 | // Anything else. |
| 1466 | 1466 | else |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | 'type' => 'unparsed_commas_content', |
| 1624 | 1624 | 'test' => '\d+,\d+\]', |
| 1625 | 1625 | 'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>', |
| 1626 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1626 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1627 | 1627 | { |
| 1628 | 1628 | $scheme = parse_url($data[0], PHP_URL_SCHEME); |
| 1629 | 1629 | if (empty($scheme)) |
@@ -2161,7 +2161,7 @@ discard block |
||
| 2161 | 2161 | $codes[] = array( |
| 2162 | 2162 | 'tag' => 'cowsay', |
| 2163 | 2163 | 'parameters' => array( |
| 2164 | - 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc) |
|
| 2164 | + 'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc) |
|
| 2165 | 2165 | { |
| 2166 | 2166 | static $css_added; |
| 2167 | 2167 | |
@@ -2178,7 +2178,7 @@ discard block |
||
| 2178 | 2178 | return $smcFunc['substr']($eyes . 'oo', 0, 2); |
| 2179 | 2179 | }, |
| 2180 | 2180 | ), |
| 2181 | - 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function ($tongue) use ($smcFunc) |
|
| 2181 | + 't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => ' ', 'validate' => function($tongue) use ($smcFunc) |
|
| 2182 | 2182 | { |
| 2183 | 2183 | return $smcFunc['substr']($tongue . ' ', 0, 2); |
| 2184 | 2184 | }, |
@@ -3550,7 +3550,7 @@ discard block |
||
| 3550 | 3550 | if ($fp != false) |
| 3551 | 3551 | { |
| 3552 | 3552 | // Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.) |
| 3553 | - fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: '. SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n"); |
|
| 3553 | + fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: ' . SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n"); |
|
| 3554 | 3554 | |
| 3555 | 3555 | // Read in the HTTP/1.1 or whatever. |
| 3556 | 3556 | $test = substr(fgets($fp, 11), -1); |
@@ -4154,7 +4154,7 @@ discard block |
||
| 4154 | 4154 | $toMinify = array(); |
| 4155 | 4155 | $normal = array(); |
| 4156 | 4156 | |
| 4157 | - usort($context['css_files'], function ($a, $b) |
|
| 4157 | + usort($context['css_files'], function($a, $b) |
|
| 4158 | 4158 | { |
| 4159 | 4159 | return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0); |
| 4160 | 4160 | }); |
@@ -5446,7 +5446,7 @@ discard block |
||
| 5446 | 5446 | { |
| 5447 | 5447 | fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n"); |
| 5448 | 5448 | fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
| 5449 | - fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n"); |
|
| 5449 | + fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n"); |
|
| 5450 | 5450 | if ($keep_alive) |
| 5451 | 5451 | fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n"); |
| 5452 | 5452 | else |
@@ -5456,7 +5456,7 @@ discard block |
||
| 5456 | 5456 | { |
| 5457 | 5457 | fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n"); |
| 5458 | 5458 | fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n"); |
| 5459 | - fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n"); |
|
| 5459 | + fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n"); |
|
| 5460 | 5460 | if ($keep_alive) |
| 5461 | 5461 | fwrite($fp, 'connection: Keep-Alive' . "\r\n"); |
| 5462 | 5462 | else |
@@ -5704,13 +5704,13 @@ discard block |
||
| 5704 | 5704 | |
| 5705 | 5705 | // UTF-8 occurences of MS special characters |
| 5706 | 5706 | $findchars_utf8 = array( |
| 5707 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5708 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5709 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5710 | - "\xe2\x80\x98", // left single curly quote |
|
| 5711 | - "\xe2\x80\x99", // right single curly quote |
|
| 5712 | - "\xe2\x80\x9c", // left double curly quote |
|
| 5713 | - "\xe2\x80\x9d", // right double curly quote |
|
| 5707 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5708 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5709 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5710 | + "\xe2\x80\x98", // left single curly quote |
|
| 5711 | + "\xe2\x80\x99", // right single curly quote |
|
| 5712 | + "\xe2\x80\x9c", // left double curly quote |
|
| 5713 | + "\xe2\x80\x9d", // right double curly quote |
|
| 5714 | 5714 | ); |
| 5715 | 5715 | |
| 5716 | 5716 | // windows 1252 / iso equivalents |
@@ -5726,13 +5726,13 @@ discard block |
||
| 5726 | 5726 | |
| 5727 | 5727 | // safe replacements |
| 5728 | 5728 | $replacechars = array( |
| 5729 | - ',', // ‚ |
|
| 5730 | - ',,', // „ |
|
| 5731 | - '...', // … |
|
| 5732 | - "'", // ‘ |
|
| 5733 | - "'", // ’ |
|
| 5734 | - '"', // “ |
|
| 5735 | - '"', // ” |
|
| 5729 | + ',', // ‚ |
|
| 5730 | + ',,', // „ |
|
| 5731 | + '...', // … |
|
| 5732 | + "'", // ‘ |
|
| 5733 | + "'", // ’ |
|
| 5734 | + '"', // “ |
|
| 5735 | + '"', // ” |
|
| 5736 | 5736 | ); |
| 5737 | 5737 | |
| 5738 | 5738 | if ($context['utf8']) |
@@ -6913,7 +6913,7 @@ discard block |
||
| 6913 | 6913 | EXISTS ( |
| 6914 | 6914 | SELECT bpv.id_board |
| 6915 | 6915 | FROM ' . $db_prefix . 'board_permissions_view AS bpv |
| 6916 | - WHERE bpv.id_group IN ('. implode(',', $groups) .') |
|
| 6916 | + WHERE bpv.id_group IN ('. implode(',', $groups) . ') |
|
| 6917 | 6917 | AND bpv.deny = 0 |
| 6918 | 6918 | AND bpv.id_board = b.id_board |
| 6919 | 6919 | )'; |
@@ -6923,7 +6923,7 @@ discard block |
||
| 6923 | 6923 | AND NOT EXISTS ( |
| 6924 | 6924 | SELECT bpv.id_board |
| 6925 | 6925 | FROM ' . $db_prefix . 'board_permissions_view AS bpv |
| 6926 | - WHERE bpv.id_group IN ( '. implode(',', $groups) .') |
|
| 6926 | + WHERE bpv.id_group IN ( '. implode(',', $groups) . ') |
|
| 6927 | 6927 | AND bpv.deny = 1 |
| 6928 | 6928 | AND bpv.id_board = b.id_board |
| 6929 | 6929 | )'; |
@@ -7194,8 +7194,8 @@ discard block |
||
| 7194 | 7194 | $i = 0; |
| 7195 | 7195 | while (empty($done)) |
| 7196 | 7196 | { |
| 7197 | - if (strpos($format, '{'. --$i . '}') !== false) |
|
| 7198 | - $replacements['{'. $i . '}'] = array_pop($list); |
|
| 7197 | + if (strpos($format, '{' . --$i . '}') !== false) |
|
| 7198 | + $replacements['{' . $i . '}'] = array_pop($list); |
|
| 7199 | 7199 | else |
| 7200 | 7200 | $done = true; |
| 7201 | 7201 | } |
@@ -7205,8 +7205,8 @@ discard block |
||
| 7205 | 7205 | $i = 0; |
| 7206 | 7206 | while (empty($done)) |
| 7207 | 7207 | { |
| 7208 | - if (strpos($format, '{'. ++$i . '}') !== false) |
|
| 7209 | - $replacements['{'. $i . '}'] = array_shift($list); |
|
| 7208 | + if (strpos($format, '{' . ++$i . '}') !== false) |
|
| 7209 | + $replacements['{' . $i . '}'] = array_shift($list); |
|
| 7210 | 7210 | else |
| 7211 | 7211 | $done = true; |
| 7212 | 7212 | } |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | // Prevents warnings about constants that are already defined. |
| 1737 | 1737 | $settingsText = preg_replace_callback( |
| 1738 | 1738 | '~\bdefine\s*\(\s*(["\'])(\w+)\1~', |
| 1739 | - function ($matches) |
|
| 1739 | + function($matches) |
|
| 1740 | 1740 | { |
| 1741 | 1741 | return 'define(\'' . md5(mt_rand()) . '\''; |
| 1742 | 1742 | }, |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | // Handle eval errors gracefully in both PHP 5 and PHP 7 |
| 1747 | 1747 | try |
| 1748 | 1748 | { |
| 1749 | - if($settingsText !== '' && @eval($settingsText) === false) |
|
| 1749 | + if ($settingsText !== '' && @eval($settingsText) === false) |
|
| 1750 | 1750 | throw new ErrorException('eval error'); |
| 1751 | 1751 | |
| 1752 | 1752 | unset($mtime, $settingsFile, $settingsText); |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | } |
| 1954 | 1954 | |
| 1955 | 1955 | // Everything is simpler if we convert heredocs to normal strings first. |
| 1956 | - if (preg_match_all('/<<<(\'?)(\w+)\'?'. $line_ending . '(.*?)'. $line_ending . '\2;$/m', $code_str, $matches)) |
|
| 1956 | + if (preg_match_all('/<<<(\'?)(\w+)\'?' . $line_ending . '(.*?)' . $line_ending . '\2;$/m', $code_str, $matches)) |
|
| 1957 | 1957 | { |
| 1958 | 1958 | foreach ($matches[0] as $mkey => $heredoc) |
| 1959 | 1959 | { |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | // Split before everything that could possibly delimit a comment or a string. |
| 1970 | - $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|'. $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
| 1970 | + $parts = preg_split('~(?=#+|/(?=/|\*)|\*/|' . $line_ending . '|(?<!\\\)[\'"])~m', $code_str); |
|
| 1971 | 1971 | |
| 1972 | 1972 | $in_string = 0; |
| 1973 | 1973 | $in_comment = 0; |
@@ -67,8 +67,7 @@ |
||
| 67 | 67 | $sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8); |
| 68 | 68 | switch ($word[$i] === 's' ? 0 : mt_rand(0, 2)) |
| 69 | 69 | { |
| 70 | - case 0 : |
|
| 71 | - for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 70 | + case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 72 | 71 | for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
| 73 | 72 | $sound_word .= $word[$i] === 's' ? $sound_letter[$j] : chr(mt_rand(max(ord($sound_letter[$j]) - 1, 0x00), min(ord($sound_letter[$j]) + 1, 0xFF))); |
| 74 | 73 | break; |
@@ -816,7 +816,7 @@ |
||
| 816 | 816 | |
| 817 | 817 | $out = 'POST /smf/stats/collect_stats.php HTTP/1.1' . "\r\n"; |
| 818 | 818 | $out .= 'Host: www.simplemachines.org' . "\r\n"; |
| 819 | - $out .= 'user-agent: '. SMF_USER_AGENT . "\r\n"; |
|
| 819 | + $out .= 'user-agent: ' . SMF_USER_AGENT . "\r\n"; |
|
| 820 | 820 | $out .= 'content-type: application/x-www-form-urlencoded' . "\r\n"; |
| 821 | 821 | $out .= 'connection: Close' . "\r\n"; |
| 822 | 822 | $out .= 'content-length: ' . $length . "\r\n\r\n"; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | display_db_error(); |
| 74 | 74 | |
| 75 | 75 | // We need to escape ' and \ |
| 76 | - $db_passwd = str_replace(array('\\','\''), array('\\\\','\\\''), $db_passwd); |
|
| 76 | + $db_passwd = str_replace(array('\\', '\''), array('\\\\', '\\\''), $db_passwd); |
|
| 77 | 77 | |
| 78 | 78 | if (!empty($db_options['persist'])) |
| 79 | 79 | $connection = @pg_pconnect((empty($db_server) ? '' : 'host=' . $db_server . ' ') . 'dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'' . (empty($db_options['port']) ? '' : ' port=\'' . $db_options['port'] . '\'')); |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | if (filter_var($error_array[2], FILTER_VALIDATE_IP) === false) |
| 926 | 926 | $error_array[2] = null; |
| 927 | 927 | |
| 928 | - if(empty($db_persist)) |
|
| 928 | + if (empty($db_persist)) |
|
| 929 | 929 | { // without pooling |
| 930 | 930 | if (empty($pg_error_data_prep)) |
| 931 | 931 | $pg_error_data_prep = pg_prepare($db_connection, 'smf_log_errors', |
@@ -1259,7 +1259,7 @@ |
||
| 1259 | 1259 | // File Upload. |
| 1260 | 1260 | if ($context['can_post_attachment']) |
| 1261 | 1261 | { |
| 1262 | - $acceptedFiles = empty($context['allowed_extensions']) ? '' : implode(',', array_map(function ($val) use ($smcFunc) |
|
| 1262 | + $acceptedFiles = empty($context['allowed_extensions']) ? '' : implode(',', array_map(function($val) use ($smcFunc) |
|
| 1263 | 1263 | { |
| 1264 | 1264 | return !empty($val) ? ('.' . $smcFunc['htmltrim']($val)) : ''; |
| 1265 | 1265 | }, explode(',', $context['allowed_extensions']))); |
@@ -581,7 +581,7 @@ |
||
| 581 | 581 | $value['id'] = $key; |
| 582 | 582 | |
| 583 | 583 | $button = ' |
| 584 | - <a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>'.(!empty($value['icon']) ? '<span class="main_icons '.$value['icon'].'"></span>' : '').'' . $txt[$value['text']] . '</a>'; |
|
| 584 | + <a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . (!empty($value['icon']) ? '<span class="main_icons ' . $value['icon'] . '"></span>' : '') . '' . $txt[$value['text']] . '</a>'; |
|
| 585 | 585 | |
| 586 | 586 | if (!empty($value['sub_buttons'])) |
| 587 | 587 | { |