@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | case 'datetime': |
| 257 | 257 | 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) |
| 258 | - return 'str_to_date('. |
|
| 259 | - 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]). |
|
| 258 | + return 'str_to_date(' . |
|
| 259 | + 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]) . |
|
| 260 | 260 | ',\'%Y-%m-%d %h:%i:%s\')'; |
| 261 | 261 | else |
| 262 | 262 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $old_pos = 0; |
| 461 | 461 | $pos = -1; |
| 462 | 462 | // Remove the string escape for better runtime |
| 463 | - $db_string_1 = str_replace('\\\'','',$db_string); |
|
| 463 | + $db_string_1 = str_replace('\\\'', '', $db_string); |
|
| 464 | 464 | while (true) |
| 465 | 465 | { |
| 466 | 466 | $pos = strpos($db_string_1, '\'', $pos + 1); |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | { |
| 843 | 843 | $count = count($insertRows); |
| 844 | 844 | $ai = 0; |
| 845 | - for($i = 0; $i < $count; $i++) |
|
| 845 | + for ($i = 0; $i < $count; $i++) |
|
| 846 | 846 | { |
| 847 | 847 | $old_id = $smcFunc['db_insert_id'](); |
| 848 | 848 | |
@@ -868,13 +868,13 @@ discard block |
||
| 868 | 868 | $count2 = count($indexed_columns); |
| 869 | 869 | for ($x = 0; $x < $count2; $x++) |
| 870 | 870 | { |
| 871 | - $where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x]; |
|
| 871 | + $where_string += key($indexed_columns[$x]) . ' = ' . $insertRows[$i][$x]; |
|
| 872 | 872 | if (($x + 1) < $count2) |
| 873 | 873 | $where_string += ' AND '; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $request = $smcFunc['db_query']('',' |
|
| 877 | - SELECT `'. $keys[0] . '` FROM ' . $table .' |
|
| 876 | + $request = $smcFunc['db_query']('', ' |
|
| 877 | + SELECT `'. $keys[0] . '` FROM ' . $table . ' |
|
| 878 | 878 | WHERE ' . $where_string . ' LIMIT 1', |
| 879 | 879 | array() |
| 880 | 880 | ); |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $return_var = array(); |
| 904 | 904 | $count = count($insertRows); |
| 905 | 905 | $start = smf_db_insert_id($table, $keys[0]); |
| 906 | - for ($i = 0; $i < $count; $i++ ) |
|
| 906 | + for ($i = 0; $i < $count; $i++) |
|
| 907 | 907 | $return_var[] = $start + $i; |
| 908 | 908 | } |
| 909 | 909 | return $return_var; |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssi', |
| 1037 | 1037 | $error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6], |
| 1038 | 1038 | $error_array[7], $error_array[8]); |
| 1039 | - mysqli_stmt_execute ($mysql_error_data_prep); |
|
| 1039 | + mysqli_stmt_execute($mysql_error_data_prep); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /** |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | */ |
| 1051 | 1051 | function smf_db_custom_order($field, $array_values, $desc = false) |
| 1052 | 1052 | { |
| 1053 | - $return = 'CASE '. $field . ' '; |
|
| 1053 | + $return = 'CASE ' . $field . ' '; |
|
| 1054 | 1054 | $count = count($array_values); |
| 1055 | 1055 | $then = ($desc ? ' THEN -' : ' THEN '); |
| 1056 | 1056 | |
@@ -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, ',') . ' |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | $id_theme = $modSettings['theme_guests']; |
| 1747 | 1747 | |
| 1748 | 1748 | // We already load the basic stuff? |
| 1749 | - if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme ) |
|
| 1749 | + if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme) |
|
| 1750 | 1750 | { |
| 1751 | 1751 | // Verify the id_theme... no foul play. |
| 1752 | 1752 | // Always allow the board specific theme, if they are overriding. |
@@ -2018,7 +2018,7 @@ discard block |
||
| 2018 | 2018 | if (!isset($context['javascript_vars'])) |
| 2019 | 2019 | $context['javascript_vars'] = array(); |
| 2020 | 2020 | |
| 2021 | - $context['login_url'] = $scripturl . '?action=login2'; |
|
| 2021 | + $context['login_url'] = $scripturl . '?action=login2'; |
|
| 2022 | 2022 | $context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | '; |
| 2023 | 2023 | $context['session_var'] = $_SESSION['session_var']; |
| 2024 | 2024 | $context['session_id'] = $_SESSION['session_value']; |
@@ -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']('', ' |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | $val = 'CASE '; |
| 388 | 388 | foreach ($members as $k => $v) |
| 389 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
| 389 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
| 390 | 390 | $val = $val . ' END'; |
| 391 | 391 | $type = 'raw'; |
| 392 | 392 | } |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400); |
| 818 | 818 | if (empty($unsupportedFormats)) |
| 819 | 819 | { |
| 820 | - foreach($strftimeFormatSubstitutions as $format => $substitution) |
|
| 820 | + foreach ($strftimeFormatSubstitutions as $format => $substitution) |
|
| 821 | 821 | { |
| 822 | 822 | $value = @strftime('%' . $format); |
| 823 | 823 | |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1183 | 1183 | ), |
| 1184 | 1184 | 'content' => '$1', |
| 1185 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1185 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $returnContext = ''; |
| 1188 | 1188 | |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1220 | - $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>'; |
|
| 1220 | + $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>'; |
|
| 1221 | 1221 | else |
| 1222 | 1222 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
| 1223 | 1223 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | 'type' => 'unparsed_content', |
| 1247 | 1247 | '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>', |
| 1248 | 1248 | // @todo Maybe this can be simplified? |
| 1249 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1249 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1250 | 1250 | { |
| 1251 | 1251 | if (!isset($disabled['code'])) |
| 1252 | 1252 | { |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | 'type' => 'unparsed_equals_content', |
| 1284 | 1284 | '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>', |
| 1285 | 1285 | // @todo Maybe this can be simplified? |
| 1286 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1286 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1287 | 1287 | { |
| 1288 | 1288 | if (!isset($disabled['code'])) |
| 1289 | 1289 | { |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | 'type' => 'unparsed_content', |
| 1328 | 1328 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1329 | 1329 | // @todo Should this respect guest_hideContacts? |
| 1330 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1330 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | $data = strtr($data, array('<br>' => '')); |
| 1333 | 1333 | }, |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | 'type' => 'unparsed_commas_content', |
| 1347 | 1347 | 'test' => '\d+,\d+\]', |
| 1348 | 1348 | 'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">', |
| 1349 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1349 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1350 | 1350 | { |
| 1351 | 1351 | if (isset($disabled['url'])) |
| 1352 | 1352 | $tag['content'] = '$1'; |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1363 | 1363 | 'before' => '<div $1>', |
| 1364 | 1364 | 'after' => '</div>', |
| 1365 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1365 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1366 | 1366 | { |
| 1367 | 1367 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
| 1368 | 1368 | |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1412 | 1412 | ), |
| 1413 | 1413 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1414 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1414 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1415 | 1415 | { |
| 1416 | 1416 | global $image_proxy_enabled, $image_proxy_secret, $boardurl, $user_info; |
| 1417 | 1417 | |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | 'tag' => 'img', |
| 1438 | 1438 | 'type' => 'unparsed_content', |
| 1439 | 1439 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1440 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1440 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | global $image_proxy_enabled, $image_proxy_secret, $boardurl, $user_info; |
| 1443 | 1443 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | 'tag' => 'iurl', |
| 1464 | 1464 | 'type' => 'unparsed_content', |
| 1465 | 1465 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1466 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1466 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1467 | 1467 | { |
| 1468 | 1468 | $data = strtr($data, array('<br>' => '')); |
| 1469 | 1469 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | 'quoted' => 'optional', |
| 1478 | 1478 | 'before' => '<a href="$1" class="bbc_link">', |
| 1479 | 1479 | 'after' => '</a>', |
| 1480 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1480 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1481 | 1481 | { |
| 1482 | 1482 | if (substr($data, 0, 1) == '#') |
| 1483 | 1483 | $data = '#post_' . substr($data, 1); |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | 'tag' => 'php', |
| 1558 | 1558 | 'type' => 'unparsed_content', |
| 1559 | 1559 | 'content' => '<span class="phpcode">$1</span>', |
| 1560 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1560 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1561 | 1561 | { |
| 1562 | 1562 | if (!isset($disabled['php'])) |
| 1563 | 1563 | { |
@@ -1655,7 +1655,7 @@ discard block |
||
| 1655 | 1655 | 'test' => '[1-7]\]', |
| 1656 | 1656 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1657 | 1657 | 'after' => '</span>', |
| 1658 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1658 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1659 | 1659 | { |
| 1660 | 1660 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1661 | 1661 | $data = $sizes[$data] . 'em'; |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | 'tag' => 'time', |
| 1694 | 1694 | 'type' => 'unparsed_content', |
| 1695 | 1695 | 'content' => '$1', |
| 1696 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1696 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1697 | 1697 | { |
| 1698 | 1698 | if (is_numeric($data)) |
| 1699 | 1699 | $data = timeformat($data); |
@@ -1721,7 +1721,7 @@ discard block |
||
| 1721 | 1721 | 'tag' => 'url', |
| 1722 | 1722 | 'type' => 'unparsed_content', |
| 1723 | 1723 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1724 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1724 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1725 | 1725 | { |
| 1726 | 1726 | $data = strtr($data, array('<br>' => '')); |
| 1727 | 1727 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | 'quoted' => 'optional', |
| 1736 | 1736 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1737 | 1737 | 'after' => '</a>', |
| 1738 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1738 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1739 | 1739 | { |
| 1740 | 1740 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1741 | 1741 | if (empty($scheme)) |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | { |
| 1762 | 1762 | if (isset($temp_bbc)) |
| 1763 | 1763 | $bbc_codes = $temp_bbc; |
| 1764 | - usort($codes, function ($a, $b) { |
|
| 1764 | + usort($codes, function($a, $b) { |
|
| 1765 | 1765 | return strcmp($a['tag'], $b['tag']); |
| 1766 | 1766 | }); |
| 1767 | 1767 | return $codes; |
@@ -1998,7 +1998,7 @@ discard block |
||
| 1998 | 1998 | # a run of Unicode domain name characters and a dot |
| 1999 | 1999 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2000 | 2000 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2001 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2001 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 2002 | 2002 | ) |
| 2003 | 2003 | # followed by a non-domain character or end of line |
| 2004 | 2004 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2066,7 +2066,7 @@ discard block |
||
| 2066 | 2066 | )? |
| 2067 | 2067 | '; |
| 2068 | 2068 | |
| 2069 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2069 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2070 | 2070 | $url = array_shift($matches); |
| 2071 | 2071 | |
| 2072 | 2072 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2148 | 2148 | |
| 2149 | 2149 | // A closing tag that doesn't match any open tags? Skip it. |
| 2150 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2150 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2151 | 2151 | continue; |
| 2152 | 2152 | |
| 2153 | 2153 | $to_close = array(); |
@@ -2810,7 +2810,7 @@ discard block |
||
| 2810 | 2810 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2811 | 2811 | { |
| 2812 | 2812 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2813 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2813 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2814 | 2814 | |
| 2815 | 2815 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2816 | 2816 | |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | |
| 2828 | 2828 | // Replace away! |
| 2829 | 2829 | $message = preg_replace_callback($smileyPregSearch, |
| 2830 | - function ($matches) use ($smileyPregReplacements) |
|
| 2830 | + function($matches) use ($smileyPregReplacements) |
|
| 2831 | 2831 | { |
| 2832 | 2832 | return $smileyPregReplacements[$matches[1]]; |
| 2833 | 2833 | }, $message); |
@@ -2893,13 +2893,13 @@ discard block |
||
| 2893 | 2893 | { |
| 2894 | 2894 | if (defined('SID') && SID != '') |
| 2895 | 2895 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2896 | - function ($m) use ($scripturl) |
|
| 2896 | + function($m) use ($scripturl) |
|
| 2897 | 2897 | { |
| 2898 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2898 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2899 | 2899 | }, $setLocation); |
| 2900 | 2900 | else |
| 2901 | 2901 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2902 | - function ($m) use ($scripturl) |
|
| 2902 | + function($m) use ($scripturl) |
|
| 2903 | 2903 | { |
| 2904 | 2904 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2905 | 2905 | }, $setLocation); |
@@ -3222,7 +3222,7 @@ discard block |
||
| 3222 | 3222 | |
| 3223 | 3223 | // Add a generic "Are you sure?" confirmation message. |
| 3224 | 3224 | addInlineJavaScript(' |
| 3225 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3225 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3226 | 3226 | |
| 3227 | 3227 | // Now add the capping code for avatars. |
| 3228 | 3228 | 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') |
@@ -3583,7 +3583,7 @@ discard block |
||
| 3583 | 3583 | |
| 3584 | 3584 | else |
| 3585 | 3585 | echo ' |
| 3586 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
| 3586 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
| 3587 | 3587 | } |
| 3588 | 3588 | |
| 3589 | 3589 | // Inline JavaScript - Actually useful some times! |
@@ -3661,14 +3661,14 @@ discard block |
||
| 3661 | 3661 | |
| 3662 | 3662 | else |
| 3663 | 3663 | echo ' |
| 3664 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
| 3664 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
| 3665 | 3665 | } |
| 3666 | 3666 | |
| 3667 | 3667 | // Print the rest after the minified files. |
| 3668 | 3668 | if (!empty($normal)) |
| 3669 | 3669 | foreach ($normal as $nf) |
| 3670 | 3670 | echo ' |
| 3671 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3671 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3672 | 3672 | |
| 3673 | 3673 | if ($db_show_debug === true) |
| 3674 | 3674 | { |
@@ -3684,7 +3684,7 @@ discard block |
||
| 3684 | 3684 | <style>'; |
| 3685 | 3685 | |
| 3686 | 3686 | foreach ($context['css_header'] as $css) |
| 3687 | - echo $css .' |
|
| 3687 | + echo $css . ' |
|
| 3688 | 3688 | '; |
| 3689 | 3689 | |
| 3690 | 3690 | echo' |
@@ -3713,27 +3713,27 @@ discard block |
||
| 3713 | 3713 | return false; |
| 3714 | 3714 | |
| 3715 | 3715 | // Did we already did this? |
| 3716 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
| 3716 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
| 3717 | 3717 | |
| 3718 | 3718 | // Already done? |
| 3719 | 3719 | if (!empty($toCache)) |
| 3720 | 3720 | return true; |
| 3721 | 3721 | |
| 3722 | 3722 | // No namespaces, sorry! |
| 3723 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3723 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3724 | 3724 | |
| 3725 | 3725 | // Temp path. |
| 3726 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
| 3726 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3727 | 3727 | |
| 3728 | 3728 | // What kind of file are we going to create? |
| 3729 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
| 3729 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
| 3730 | 3730 | |
| 3731 | 3731 | // File has to exists, if it isn't try to create it. |
| 3732 | 3732 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3733 | 3733 | { |
| 3734 | 3734 | loadLanguage('Errors'); |
| 3735 | 3735 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3736 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3736 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3737 | 3737 | |
| 3738 | 3738 | // The process failed so roll back to print each individual file. |
| 3739 | 3739 | return $data; |
@@ -3768,14 +3768,14 @@ discard block |
||
| 3768 | 3768 | { |
| 3769 | 3769 | loadLanguage('Errors'); |
| 3770 | 3770 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3771 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3771 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3772 | 3772 | |
| 3773 | 3773 | // The process failed so roll back to print each individual file. |
| 3774 | 3774 | return $data; |
| 3775 | 3775 | } |
| 3776 | 3776 | |
| 3777 | 3777 | // And create a long lived cache entry. |
| 3778 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
| 3778 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
| 3779 | 3779 | |
| 3780 | 3780 | return true; |
| 3781 | 3781 | } |
@@ -3835,7 +3835,7 @@ discard block |
||
| 3835 | 3835 | else |
| 3836 | 3836 | $path = $modSettings['attachmentUploadDir']; |
| 3837 | 3837 | |
| 3838 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3838 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3839 | 3839 | } |
| 3840 | 3840 | |
| 3841 | 3841 | /** |
@@ -3879,10 +3879,10 @@ discard block |
||
| 3879 | 3879 | $valid_low = isValidIP($ip_parts[0]); |
| 3880 | 3880 | $valid_high = isValidIP($ip_parts[1]); |
| 3881 | 3881 | $count = 0; |
| 3882 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3882 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3883 | 3883 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3884 | 3884 | $min = 0; |
| 3885 | - if(!$valid_low) |
|
| 3885 | + if (!$valid_low) |
|
| 3886 | 3886 | { |
| 3887 | 3887 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3888 | 3888 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3896,7 +3896,7 @@ discard block |
||
| 3896 | 3896 | } |
| 3897 | 3897 | |
| 3898 | 3898 | $count = 0; |
| 3899 | - if(!$valid_high) |
|
| 3899 | + if (!$valid_high) |
|
| 3900 | 3900 | { |
| 3901 | 3901 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3902 | 3902 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3909,7 +3909,7 @@ discard block |
||
| 3909 | 3909 | } |
| 3910 | 3910 | } |
| 3911 | 3911 | |
| 3912 | - if($valid_high && $valid_low) |
|
| 3912 | + if ($valid_high && $valid_low) |
|
| 3913 | 3913 | { |
| 3914 | 3914 | $ip_array['low'] = $ip_parts[0]; |
| 3915 | 3915 | $ip_array['high'] = $ip_parts[1]; |
@@ -4091,7 +4091,7 @@ discard block |
||
| 4091 | 4091 | addInlineJavaScript(' |
| 4092 | 4092 | var user_menus = new smc_PopupMenu(); |
| 4093 | 4093 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4094 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4094 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4095 | 4095 | if ($context['allow_pm']) |
| 4096 | 4096 | addInlineJavaScript(' |
| 4097 | 4097 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4727,7 +4727,7 @@ discard block |
||
| 4727 | 4727 | // No? try a fallback to $sourcedir |
| 4728 | 4728 | else |
| 4729 | 4729 | { |
| 4730 | - $absPath = $sourcedir .'/'. $file; |
|
| 4730 | + $absPath = $sourcedir . '/' . $file; |
|
| 4731 | 4731 | |
| 4732 | 4732 | if (file_exists($absPath)) |
| 4733 | 4733 | require_once($absPath); |
@@ -4808,15 +4808,15 @@ discard block |
||
| 4808 | 4808 | |
| 4809 | 4809 | // UTF-8 occurences of MS special characters |
| 4810 | 4810 | $findchars_utf8 = array( |
| 4811 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4812 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4813 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4814 | - "\xe2\x80\x98", // left single curly quote |
|
| 4815 | - "\xe2\x80\x99", // right single curly quote |
|
| 4816 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4817 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4818 | - "\xe2\x80\x93", // en dash |
|
| 4819 | - "\xe2\x80\x94", // em dash |
|
| 4811 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4812 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4813 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4814 | + "\xe2\x80\x98", // left single curly quote |
|
| 4815 | + "\xe2\x80\x99", // right single curly quote |
|
| 4816 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4817 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4818 | + "\xe2\x80\x93", // en dash |
|
| 4819 | + "\xe2\x80\x94", // em dash |
|
| 4820 | 4820 | ); |
| 4821 | 4821 | |
| 4822 | 4822 | // windows 1252 / iso equivalents |
@@ -4834,15 +4834,15 @@ discard block |
||
| 4834 | 4834 | |
| 4835 | 4835 | // safe replacements |
| 4836 | 4836 | $replacechars = array( |
| 4837 | - ',', // ‚ |
|
| 4838 | - ',,', // „ |
|
| 4839 | - '...', // … |
|
| 4840 | - "'", // ‘ |
|
| 4841 | - "'", // ’ |
|
| 4842 | - '"', // “ |
|
| 4843 | - '"', // ” |
|
| 4844 | - '-', // – |
|
| 4845 | - '--', // — |
|
| 4837 | + ',', // ‚ |
|
| 4838 | + ',,', // „ |
|
| 4839 | + '...', // … |
|
| 4840 | + "'", // ‘ |
|
| 4841 | + "'", // ’ |
|
| 4842 | + '"', // “ |
|
| 4843 | + '"', // ” |
|
| 4844 | + '-', // – |
|
| 4845 | + '--', // — |
|
| 4846 | 4846 | ); |
| 4847 | 4847 | |
| 4848 | 4848 | if ($context['utf8']) |
@@ -5260,7 +5260,7 @@ discard block |
||
| 5260 | 5260 | */ |
| 5261 | 5261 | function inet_dtop($bin) |
| 5262 | 5262 | { |
| 5263 | - if(empty($bin)) |
|
| 5263 | + if (empty($bin)) |
|
| 5264 | 5264 | return ''; |
| 5265 | 5265 | |
| 5266 | 5266 | global $db_type; |
@@ -5291,28 +5291,28 @@ discard block |
||
| 5291 | 5291 | */ |
| 5292 | 5292 | function _safe_serialize($value) |
| 5293 | 5293 | { |
| 5294 | - if(is_null($value)) |
|
| 5294 | + if (is_null($value)) |
|
| 5295 | 5295 | return 'N;'; |
| 5296 | 5296 | |
| 5297 | - if(is_bool($value)) |
|
| 5298 | - return 'b:'. (int) $value .';'; |
|
| 5297 | + if (is_bool($value)) |
|
| 5298 | + return 'b:' . (int) $value . ';'; |
|
| 5299 | 5299 | |
| 5300 | - if(is_int($value)) |
|
| 5301 | - return 'i:'. $value .';'; |
|
| 5300 | + if (is_int($value)) |
|
| 5301 | + return 'i:' . $value . ';'; |
|
| 5302 | 5302 | |
| 5303 | - if(is_float($value)) |
|
| 5304 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5303 | + if (is_float($value)) |
|
| 5304 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5305 | 5305 | |
| 5306 | - if(is_string($value)) |
|
| 5307 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5306 | + if (is_string($value)) |
|
| 5307 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5308 | 5308 | |
| 5309 | - if(is_array($value)) |
|
| 5309 | + if (is_array($value)) |
|
| 5310 | 5310 | { |
| 5311 | 5311 | $out = ''; |
| 5312 | - foreach($value as $k => $v) |
|
| 5312 | + foreach ($value as $k => $v) |
|
| 5313 | 5313 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5314 | 5314 | |
| 5315 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5315 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5316 | 5316 | } |
| 5317 | 5317 | |
| 5318 | 5318 | // safe_serialize cannot serialize resources or objects. |
@@ -5354,7 +5354,7 @@ discard block |
||
| 5354 | 5354 | function _safe_unserialize($str) |
| 5355 | 5355 | { |
| 5356 | 5356 | // Input is not a string. |
| 5357 | - if(empty($str) || !is_string($str)) |
|
| 5357 | + if (empty($str) || !is_string($str)) |
|
| 5358 | 5358 | return false; |
| 5359 | 5359 | |
| 5360 | 5360 | $stack = array(); |
@@ -5368,40 +5368,40 @@ discard block |
||
| 5368 | 5368 | * 3 - in array, expecting value or another array |
| 5369 | 5369 | */ |
| 5370 | 5370 | $state = 0; |
| 5371 | - while($state != 1) |
|
| 5371 | + while ($state != 1) |
|
| 5372 | 5372 | { |
| 5373 | 5373 | $type = isset($str[0]) ? $str[0] : ''; |
| 5374 | - if($type == '}') |
|
| 5374 | + if ($type == '}') |
|
| 5375 | 5375 | $str = substr($str, 1); |
| 5376 | 5376 | |
| 5377 | - else if($type == 'N' && $str[1] == ';') |
|
| 5377 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5378 | 5378 | { |
| 5379 | 5379 | $value = null; |
| 5380 | 5380 | $str = substr($str, 2); |
| 5381 | 5381 | } |
| 5382 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5382 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5383 | 5383 | { |
| 5384 | 5384 | $value = $matches[1] == '1' ? true : false; |
| 5385 | 5385 | $str = substr($str, 4); |
| 5386 | 5386 | } |
| 5387 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5387 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5388 | 5388 | { |
| 5389 | - $value = (int)$matches[1]; |
|
| 5389 | + $value = (int) $matches[1]; |
|
| 5390 | 5390 | $str = $matches[2]; |
| 5391 | 5391 | } |
| 5392 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5392 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5393 | 5393 | { |
| 5394 | - $value = (float)$matches[1]; |
|
| 5394 | + $value = (float) $matches[1]; |
|
| 5395 | 5395 | $str = $matches[3]; |
| 5396 | 5396 | } |
| 5397 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5397 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5398 | 5398 | { |
| 5399 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5400 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5399 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5400 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5401 | 5401 | } |
| 5402 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5402 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5403 | 5403 | { |
| 5404 | - $expectedLength = (int)$matches[1]; |
|
| 5404 | + $expectedLength = (int) $matches[1]; |
|
| 5405 | 5405 | $str = $matches[2]; |
| 5406 | 5406 | } |
| 5407 | 5407 | |
@@ -5409,10 +5409,10 @@ discard block |
||
| 5409 | 5409 | else |
| 5410 | 5410 | return false; |
| 5411 | 5411 | |
| 5412 | - switch($state) |
|
| 5412 | + switch ($state) |
|
| 5413 | 5413 | { |
| 5414 | 5414 | case 3: // In array, expecting value or another array. |
| 5415 | - if($type == 'a') |
|
| 5415 | + if ($type == 'a') |
|
| 5416 | 5416 | { |
| 5417 | 5417 | $stack[] = &$list; |
| 5418 | 5418 | $list[$key] = array(); |
@@ -5421,7 +5421,7 @@ discard block |
||
| 5421 | 5421 | $state = 2; |
| 5422 | 5422 | break; |
| 5423 | 5423 | } |
| 5424 | - if($type != '}') |
|
| 5424 | + if ($type != '}') |
|
| 5425 | 5425 | { |
| 5426 | 5426 | $list[$key] = $value; |
| 5427 | 5427 | $state = 2; |
@@ -5432,29 +5432,29 @@ discard block |
||
| 5432 | 5432 | return false; |
| 5433 | 5433 | |
| 5434 | 5434 | case 2: // in array, expecting end of array or a key |
| 5435 | - if($type == '}') |
|
| 5435 | + if ($type == '}') |
|
| 5436 | 5436 | { |
| 5437 | 5437 | // Array size is less than expected. |
| 5438 | - if(count($list) < end($expected)) |
|
| 5438 | + if (count($list) < end($expected)) |
|
| 5439 | 5439 | return false; |
| 5440 | 5440 | |
| 5441 | 5441 | unset($list); |
| 5442 | - $list = &$stack[count($stack)-1]; |
|
| 5442 | + $list = &$stack[count($stack) - 1]; |
|
| 5443 | 5443 | array_pop($stack); |
| 5444 | 5444 | |
| 5445 | 5445 | // Go to terminal state if we're at the end of the root array. |
| 5446 | 5446 | array_pop($expected); |
| 5447 | 5447 | |
| 5448 | - if(count($expected) == 0) |
|
| 5448 | + if (count($expected) == 0) |
|
| 5449 | 5449 | $state = 1; |
| 5450 | 5450 | |
| 5451 | 5451 | break; |
| 5452 | 5452 | } |
| 5453 | 5453 | |
| 5454 | - if($type == 'i' || $type == 's') |
|
| 5454 | + if ($type == 'i' || $type == 's') |
|
| 5455 | 5455 | { |
| 5456 | 5456 | // Array size exceeds expected length. |
| 5457 | - if(count($list) >= end($expected)) |
|
| 5457 | + if (count($list) >= end($expected)) |
|
| 5458 | 5458 | return false; |
| 5459 | 5459 | |
| 5460 | 5460 | $key = $value; |
@@ -5467,7 +5467,7 @@ discard block |
||
| 5467 | 5467 | |
| 5468 | 5468 | // Expecting array or value. |
| 5469 | 5469 | case 0: |
| 5470 | - if($type == 'a') |
|
| 5470 | + if ($type == 'a') |
|
| 5471 | 5471 | { |
| 5472 | 5472 | $data = array(); |
| 5473 | 5473 | $list = &$data; |
@@ -5476,7 +5476,7 @@ discard block |
||
| 5476 | 5476 | break; |
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | - if($type != '}') |
|
| 5479 | + if ($type != '}') |
|
| 5480 | 5480 | { |
| 5481 | 5481 | $data = $value; |
| 5482 | 5482 | $state = 1; |
@@ -5489,7 +5489,7 @@ discard block |
||
| 5489 | 5489 | } |
| 5490 | 5490 | |
| 5491 | 5491 | // Trailing data in input. |
| 5492 | - if(!empty($str)) |
|
| 5492 | + if (!empty($str)) |
|
| 5493 | 5493 | return false; |
| 5494 | 5494 | |
| 5495 | 5495 | return $data; |
@@ -5543,7 +5543,7 @@ discard block |
||
| 5543 | 5543 | // Set different modes. |
| 5544 | 5544 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5545 | 5545 | |
| 5546 | - foreach($chmodValues as $val) |
|
| 5546 | + foreach ($chmodValues as $val) |
|
| 5547 | 5547 | { |
| 5548 | 5548 | // If it's writable, break out of the loop. |
| 5549 | 5549 | if (is_writable($file)) |
@@ -5578,13 +5578,13 @@ discard block |
||
| 5578 | 5578 | $returnArray = @json_decode($json, $returnAsArray); |
| 5579 | 5579 | |
| 5580 | 5580 | // PHP 5.3 so no json_last_error_msg() |
| 5581 | - switch(json_last_error()) |
|
| 5581 | + switch (json_last_error()) |
|
| 5582 | 5582 | { |
| 5583 | 5583 | case JSON_ERROR_NONE: |
| 5584 | 5584 | $jsonError = false; |
| 5585 | 5585 | break; |
| 5586 | 5586 | case JSON_ERROR_DEPTH: |
| 5587 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5587 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5588 | 5588 | break; |
| 5589 | 5589 | case JSON_ERROR_STATE_MISMATCH: |
| 5590 | 5590 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5612,10 +5612,10 @@ discard block |
||
| 5612 | 5612 | loadLanguage('Errors'); |
| 5613 | 5613 | |
| 5614 | 5614 | if (!empty($jsonDebug)) |
| 5615 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5615 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5616 | 5616 | |
| 5617 | 5617 | else |
| 5618 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5618 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5619 | 5619 | |
| 5620 | 5620 | // Everyone expects an array. |
| 5621 | 5621 | return array(); |
@@ -5727,7 +5727,7 @@ discard block |
||
| 5727 | 5727 | }); |
| 5728 | 5728 | |
| 5729 | 5729 | // Convert Punycode to Unicode |
| 5730 | - $tlds = array_map(function ($input) { |
|
| 5730 | + $tlds = array_map(function($input) { |
|
| 5731 | 5731 | $prefix = 'xn--'; |
| 5732 | 5732 | $safe_char = 0xFFFC; |
| 5733 | 5733 | $base = 36; |
@@ -5743,7 +5743,7 @@ discard block |
||
| 5743 | 5743 | |
| 5744 | 5744 | foreach ($enco_parts as $encoded) |
| 5745 | 5745 | { |
| 5746 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5746 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5747 | 5747 | { |
| 5748 | 5748 | $output_parts[] = $encoded; |
| 5749 | 5749 | continue; |
@@ -5754,7 +5754,7 @@ discard block |
||
| 5754 | 5754 | $idx = 0; |
| 5755 | 5755 | $char = 0x80; |
| 5756 | 5756 | $decoded = array(); |
| 5757 | - $output=''; |
|
| 5757 | + $output = ''; |
|
| 5758 | 5758 | $delim_pos = strrpos($encoded, '-'); |
| 5759 | 5759 | |
| 5760 | 5760 | if ($delim_pos > strlen($prefix)) |
@@ -5770,7 +5770,7 @@ discard block |
||
| 5770 | 5770 | |
| 5771 | 5771 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5772 | 5772 | { |
| 5773 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5773 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5774 | 5774 | { |
| 5775 | 5775 | $cp = ord($encoded{$enco_idx++}); |
| 5776 | 5776 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5811,15 +5811,15 @@ discard block |
||
| 5811 | 5811 | |
| 5812 | 5812 | // 2 bytes |
| 5813 | 5813 | elseif ($v < (1 << 11)) |
| 5814 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5814 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5815 | 5815 | |
| 5816 | 5816 | // 3 bytes |
| 5817 | 5817 | elseif ($v < (1 << 16)) |
| 5818 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5818 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5819 | 5819 | |
| 5820 | 5820 | // 4 bytes |
| 5821 | 5821 | elseif ($v < (1 << 21)) |
| 5822 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5822 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5823 | 5823 | |
| 5824 | 5824 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5825 | 5825 | else |
@@ -5924,7 +5924,7 @@ discard block |
||
| 5924 | 5924 | } |
| 5925 | 5925 | |
| 5926 | 5926 | // This recursive function creates the index array from the strings |
| 5927 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5927 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5928 | 5928 | { |
| 5929 | 5929 | static $depth = 0; |
| 5930 | 5930 | $depth++; |
@@ -5951,7 +5951,7 @@ discard block |
||
| 5951 | 5951 | }; |
| 5952 | 5952 | |
| 5953 | 5953 | // This recursive function turns the index array into a regular expression |
| 5954 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5954 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5955 | 5955 | { |
| 5956 | 5956 | static $depth = 0; |
| 5957 | 5957 | $depth++; |
@@ -5975,11 +5975,11 @@ discard block |
||
| 5975 | 5975 | |
| 5976 | 5976 | if (count(array_keys($value)) == 1) |
| 5977 | 5977 | { |
| 5978 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 5978 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 5979 | 5979 | $new_key .= $new_key_array[0]; |
| 5980 | 5980 | } |
| 5981 | 5981 | else |
| 5982 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 5982 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 5983 | 5983 | } |
| 5984 | 5984 | |
| 5985 | 5985 | if ($depth > 1) |
@@ -6022,10 +6022,10 @@ discard block |
||
| 6022 | 6022 | { |
| 6023 | 6023 | $regex = array(); |
| 6024 | 6024 | while (!empty($index)) |
| 6025 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6025 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6026 | 6026 | } |
| 6027 | 6027 | else |
| 6028 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6028 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6029 | 6029 | |
| 6030 | 6030 | // Restore PHP's internal character encoding to whatever it was originally |
| 6031 | 6031 | if (!empty($current_encoding)) |
@@ -899,13 +899,13 @@ |
||
| 899 | 899 | if ($start_char === 'C') |
| 900 | 900 | $limit_seek = $limit; |
| 901 | 901 | else |
| 902 | - $limit_seek = $limit + 1; |
|
| 902 | + $limit_seek = $limit + 1; |
|
| 903 | 903 | |
| 904 | 904 | $request = $smcFunc['db_query']('', ' |
| 905 | 905 | SELECT id_msg, id_member, approved |
| 906 | 906 | FROM {db_prefix}messages |
| 907 | 907 | WHERE id_topic = {int:current_topic} |
| 908 | - AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
| 908 | + AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
| 909 | 909 | AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . ' |
| 910 | 910 | ORDER BY id_msg ' . ($ascending_seek ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : ' |
| 911 | 911 | LIMIT {int:limit}'), |