@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $smcFunc['db_free_result']($result_boards); |
| 136 | 136 | |
| 137 | 137 | // Run through the categories and boards (or only boards).... |
| 138 | - for (reset($row_boards); key($row_boards)!==null; next($row_boards)) |
|
| 138 | + for (reset($row_boards); key($row_boards) !== null; next($row_boards)) |
|
| 139 | 139 | { |
| 140 | 140 | $row_board = current($row_boards); |
| 141 | 141 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $row_boards[$row_board['id_parent']]['id_msg'] = $row_board['id_msg']; |
| 304 | 304 | $row_boards[$row_board['id_parent']]['subject'] = $row_board['subject']; |
| 305 | 305 | $row_boards[$row_board['id_parent']]['poster_time'] = $row_board['poster_time']; |
| 306 | - $row_boards[$row_board['id_parent']]['short_subject'] = (!empty($row_board['short_subject']) ? $row_board['short_subject'] : '') ; |
|
| 306 | + $row_boards[$row_board['id_parent']]['short_subject'] = (!empty($row_board['short_subject']) ? $row_board['short_subject'] : ''); |
|
| 307 | 307 | $row_boards[$row_board['id_parent']]['poster_name'] = $row_board['poster_name']; |
| 308 | 308 | $row_boards[$row_board['id_parent']]['real_name'] = $row_board['real_name']; |
| 309 | 309 | $row_boards[$row_board['id_parent']]['id_member'] = $row_board['id_member']; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // Set the last post in the root board |
| 370 | 370 | if (!$isChild && !empty($row_board['poster_time']) |
| 371 | - && ( empty($this_category[$row_board['id_board']]['last_post']['timestamp']) |
|
| 371 | + && (empty($this_category[$row_board['id_board']]['last_post']['timestamp']) |
|
| 372 | 372 | || $this_category[$row_board['id_board']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']) |
| 373 | 373 | ) |
| 374 | 374 | ) |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | if ($boardIndexOptions['include_categories']) |
| 399 | 399 | foreach ($categories as &$category) |
| 400 | 400 | { |
| 401 | - foreach ($category['boards'] as &$board ) |
|
| 401 | + foreach ($category['boards'] as &$board) |
|
| 402 | 402 | { |
| 403 | 403 | if (!empty($moderators[$board['id']])) |
| 404 | 404 | { |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | else |
| 423 | - foreach ($this_category as &$board ) |
|
| 423 | + foreach ($this_category as &$board) |
|
| 424 | 424 | { |
| 425 | 425 | if (!empty($moderators[$board['id']])) |
| 426 | 426 | { |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - unset($category,$board); |
|
| 444 | + unset($category, $board); |
|
| 445 | 445 | |
| 446 | 446 | if ($boardIndexOptions['include_categories']) |
| 447 | 447 | sortCategories($categories); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $fields = ''; |
| 460 | 460 | foreach ($context['print_custom_fields']['below_signature'] as $field) |
| 461 | 461 | if (!empty($field['output_html'])) |
| 462 | - $fields .= ' |
|
| 462 | + $fields .= ' |
|
| 463 | 463 | <li>' . $field['output_html'] . '</li>'; |
| 464 | 464 | |
| 465 | 465 | if (!empty($fields)) |
@@ -3167,7 +3167,7 @@ discard block |
||
| 3167 | 3167 | <div class="floatright tfa_qrcode"> |
| 3168 | 3168 | <div id="qrcode"></div> |
| 3169 | 3169 | <script type="text/javascript"> |
| 3170 | - new QRCode(document.getElementById("qrcode"), "' , $context['tfa_qr_url'],'"); |
|
| 3170 | + new QRCode(document.getElementById("qrcode"), "' , $context['tfa_qr_url'], '"); |
|
| 3171 | 3171 | </script> |
| 3172 | 3172 | </div>'; |
| 3173 | 3173 | |
@@ -371,7 +371,7 @@ |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | return (string) substr( |
| 374 | - (string )$binary_string, |
|
| 374 | + (string) $binary_string, |
|
| 375 | 375 | (int) $start, |
| 376 | 376 | (int) $length |
| 377 | 377 | ); |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | 'member_name' => $regOptions['username'], |
| 587 | 587 | 'email_address' => $regOptions['email'], |
| 588 | 588 | 'passwd' => hash_password($regOptions['username'], $regOptions['password']), |
| 589 | - 'password_salt' => substr(md5($smcFunc['random_int']()), 0, 4) , |
|
| 589 | + 'password_salt' => substr(md5($smcFunc['random_int']()), 0, 4), |
|
| 590 | 590 | 'posts' => 0, |
| 591 | 591 | 'date_registered' => time(), |
| 592 | 592 | 'member_ip' => $regOptions['interface'] == 'admin' ? '127.0.0.1' : $user_info['ip'], |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | 'time_offset', |
| 677 | 677 | ); |
| 678 | 678 | $knownInets = array( |
| 679 | - 'member_ip','member_ip2', |
|
| 679 | + 'member_ip', 'member_ip2', |
|
| 680 | 680 | ); |
| 681 | 681 | |
| 682 | 682 | // Call an optional function to validate the users' input. |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | $checkName = strtr($name, array('_' => '\\_', '%' => '\\%')); |
| 905 | 905 | |
| 906 | 906 | //when we got no wildcard we can use equal -> fast |
| 907 | - $operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '=' ); |
|
| 907 | + $operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '='); |
|
| 908 | 908 | |
| 909 | 909 | // Make sure they don't want someone else's name. |
| 910 | 910 | $request = $smcFunc['db_query']('', ' |
@@ -1273,7 +1273,7 @@ discard block |
||
| 1273 | 1273 | $user_info['buddies'][] = $userReceiver; |
| 1274 | 1274 | |
| 1275 | 1275 | // And add a nice alert. Don't abuse though! |
| 1276 | - if ((cache_get_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, 86400)) == null) |
|
| 1276 | + if ((cache_get_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, 86400)) == null) |
|
| 1277 | 1277 | { |
| 1278 | 1278 | $smcFunc['db_insert']('insert', |
| 1279 | 1279 | '{db_prefix}background_tasks', |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | ); |
| 1289 | 1289 | |
| 1290 | 1290 | // Store this in a cache entry to avoid creating multiple alerts. Give it a long life cycle. |
| 1291 | - cache_put_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, '1', 86400); |
|
| 1291 | + cache_put_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, '1', 86400); |
|
| 1292 | 1292 | } |
| 1293 | 1293 | } |
| 1294 | 1294 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | // Remove the phrase parts and extract the words. |
| 661 | 661 | $wordArray = preg_replace('~(?:^|\s)(?:[-]?)"(?:[^"]+)"(?:$|\s)~' . ($context['utf8'] ? 'u' : ''), ' ', $search_params['search']); |
| 662 | - $wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES)); |
|
| 662 | + $wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES)); |
|
| 663 | 663 | |
| 664 | 664 | // A minus sign in front of a word excludes the word.... so... |
| 665 | 665 | $excludedWords = array(); |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | // Are the result fresh? |
| 992 | 992 | if (!$update_cache && !empty($_SESSION['search_cache']['id_search'])) |
| 993 | 993 | { |
| 994 | - $request = $smcFunc['db_query']('',' |
|
| 994 | + $request = $smcFunc['db_query']('', ' |
|
| 995 | 995 | SELECT id_search |
| 996 | 996 | FROM {db_prefix}log_search_results |
| 997 | 997 | WHERE id_search = {int:search_id} |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | SELECT |
| 1114 | 1114 | {int:id_search}, |
| 1115 | 1115 | t.id_topic, |
| 1116 | - ' . $relevance. ', |
|
| 1116 | + ' . $relevance . ', |
|
| 1117 | 1117 | ' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ', |
| 1118 | 1118 | 1 |
| 1119 | 1119 | FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : ' |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | if (empty($subject_query['where'])) |
| 1347 | 1347 | continue; |
| 1348 | 1348 | |
| 1349 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1349 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? (' |
|
| 1350 | 1350 | INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics |
| 1351 | 1351 | (' . ($createTemporary ? '' : 'id_search, ') . 'id_topic)') : '') . ' |
| 1352 | 1352 | SELECT ' . ($createTemporary ? '' : $_SESSION['search_cache']['id_search'] . ', ') . 't.id_topic |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | } |
| 1574 | 1574 | $main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance'; |
| 1575 | 1575 | |
| 1576 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1576 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? (' |
|
| 1577 | 1577 | INSERT IGNORE INTO ' . '{db_prefix}log_search_results |
| 1578 | 1578 | (' . implode(', ', array_keys($main_query['select'])) . ')') : '') . ' |
| 1579 | 1579 | SELECT |
@@ -1641,7 +1641,7 @@ discard block |
||
| 1641 | 1641 | $relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance'; |
| 1642 | 1642 | |
| 1643 | 1643 | $usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts)); |
| 1644 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1644 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? (' |
|
| 1645 | 1645 | INSERT IGNORE INTO {db_prefix}log_search_results |
| 1646 | 1646 | (id_search, id_topic, relevance, id_msg, num_matches)') : '') . ' |
| 1647 | 1647 | SELECT |
@@ -2110,7 +2110,7 @@ discard block |
||
| 2110 | 2110 | if (strlen($query) == 0) |
| 2111 | 2111 | continue; |
| 2112 | 2112 | |
| 2113 | - $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function ($m) |
|
| 2113 | + $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function($m) |
|
| 2114 | 2114 | { |
| 2115 | 2115 | return isset($m[2]) && "$m[2]" == "$m[1]" ? stripslashes("$m[1]") : "<strong class=\"highlight\">$m[1]</strong>"; |
| 2116 | 2116 | }, $body_highlighted); |
@@ -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 '. alert_count($v, false) . ' '; |
|
| 394 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, false) . ' '; |
|
| 395 | 395 | $val = $val . ' END'; |
| 396 | 396 | $type = 'raw'; |
| 397 | 397 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | static $non_twelve_hour, $locale_cache; |
| 742 | 742 | static $unsupportedFormats, $finalizedFormats; |
| 743 | 743 | |
| 744 | - $unsupportedFormatsWindows = array('z','Z'); |
|
| 744 | + $unsupportedFormatsWindows = array('z', 'Z'); |
|
| 745 | 745 | |
| 746 | 746 | // Ensure required values are set |
| 747 | 747 | $user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0; |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | $unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400); |
| 827 | 827 | if (empty($unsupportedFormats)) |
| 828 | 828 | { |
| 829 | - foreach($strftimeFormatSubstitutions as $format => $substitution) |
|
| 829 | + foreach ($strftimeFormatSubstitutions as $format => $substitution) |
|
| 830 | 830 | { |
| 831 | 831 | // Avoid a crashing bug with PHP 7 on certain versions of Windows |
| 832 | 832 | if ($context['server']['is_windows'] && in_array($format, $unsupportedFormatsWindows)) |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1207 | 1207 | ), |
| 1208 | 1208 | 'content' => '$1', |
| 1209 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1209 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1210 | 1210 | { |
| 1211 | 1211 | $returnContext = ''; |
| 1212 | 1212 | |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1244 | - $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>'; |
|
| 1244 | + $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>'; |
|
| 1245 | 1245 | else |
| 1246 | 1246 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
| 1247 | 1247 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | 'type' => 'unparsed_content', |
| 1294 | 1294 | '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>', |
| 1295 | 1295 | // @todo Maybe this can be simplified? |
| 1296 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1296 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1297 | 1297 | { |
| 1298 | 1298 | if (!isset($disabled['code'])) |
| 1299 | 1299 | { |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | 'type' => 'unparsed_equals_content', |
| 1331 | 1331 | '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>', |
| 1332 | 1332 | // @todo Maybe this can be simplified? |
| 1333 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1333 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1334 | 1334 | { |
| 1335 | 1335 | if (!isset($disabled['code'])) |
| 1336 | 1336 | { |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | 'type' => 'unparsed_content', |
| 1375 | 1375 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1376 | 1376 | // @todo Should this respect guest_hideContacts? |
| 1377 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1377 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1378 | 1378 | { |
| 1379 | 1379 | $data = strtr($data, array('<br>' => '')); |
| 1380 | 1380 | }, |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1395 | 1395 | 'before' => '<div $1>', |
| 1396 | 1396 | 'after' => '</div>', |
| 1397 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1397 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1398 | 1398 | { |
| 1399 | 1399 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
| 1400 | 1400 | |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1481 | 1481 | ), |
| 1482 | 1482 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1483 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1483 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1484 | 1484 | { |
| 1485 | 1485 | global $image_proxy_enabled, $user_info; |
| 1486 | 1486 | |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | 'tag' => 'img', |
| 1507 | 1507 | 'type' => 'unparsed_content', |
| 1508 | 1508 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1509 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1509 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1510 | 1510 | { |
| 1511 | 1511 | global $image_proxy_enabled, $user_info; |
| 1512 | 1512 | |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | 'tag' => 'iurl', |
| 1533 | 1533 | 'type' => 'unparsed_content', |
| 1534 | 1534 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1535 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1535 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1536 | 1536 | { |
| 1537 | 1537 | $data = strtr($data, array('<br>' => '')); |
| 1538 | 1538 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1546,7 +1546,7 @@ discard block |
||
| 1546 | 1546 | 'quoted' => 'optional', |
| 1547 | 1547 | 'before' => '<a href="$1" class="bbc_link">', |
| 1548 | 1548 | 'after' => '</a>', |
| 1549 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1549 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1550 | 1550 | { |
| 1551 | 1551 | if (substr($data, 0, 1) == '#') |
| 1552 | 1552 | $data = '#post_' . substr($data, 1); |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | 'tag' => 'php', |
| 1640 | 1640 | 'type' => 'unparsed_content', |
| 1641 | 1641 | 'content' => '<span class="phpcode">$1</span>', |
| 1642 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1642 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1643 | 1643 | { |
| 1644 | 1644 | if (!isset($disabled['php'])) |
| 1645 | 1645 | { |
@@ -1767,7 +1767,7 @@ discard block |
||
| 1767 | 1767 | 'test' => '[1-7]\]', |
| 1768 | 1768 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1769 | 1769 | 'after' => '</span>', |
| 1770 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1770 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1771 | 1771 | { |
| 1772 | 1772 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1773 | 1773 | $data = $sizes[$data] . 'em'; |
@@ -1805,7 +1805,7 @@ discard block |
||
| 1805 | 1805 | 'tag' => 'time', |
| 1806 | 1806 | 'type' => 'unparsed_content', |
| 1807 | 1807 | 'content' => '$1', |
| 1808 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1808 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1809 | 1809 | { |
| 1810 | 1810 | if (is_numeric($data)) |
| 1811 | 1811 | $data = timeformat($data); |
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | 'tag' => 'url', |
| 1839 | 1839 | 'type' => 'unparsed_content', |
| 1840 | 1840 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1841 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1841 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1842 | 1842 | { |
| 1843 | 1843 | $data = strtr($data, array('<br>' => '')); |
| 1844 | 1844 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1852,7 +1852,7 @@ discard block |
||
| 1852 | 1852 | 'quoted' => 'optional', |
| 1853 | 1853 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1854 | 1854 | 'after' => '</a>', |
| 1855 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1855 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1856 | 1856 | { |
| 1857 | 1857 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1858 | 1858 | if (empty($scheme)) |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | { |
| 1899 | 1899 | if (isset($temp_bbc)) |
| 1900 | 1900 | $bbc_codes = $temp_bbc; |
| 1901 | - usort($codes, function ($a, $b) { |
|
| 1901 | + usort($codes, function($a, $b) { |
|
| 1902 | 1902 | return strcmp($a['tag'], $b['tag']); |
| 1903 | 1903 | }); |
| 1904 | 1904 | return $codes; |
@@ -2114,7 +2114,7 @@ discard block |
||
| 2114 | 2114 | # a run of Unicode domain name characters and a dot |
| 2115 | 2115 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2116 | 2116 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2117 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2117 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 2118 | 2118 | ) |
| 2119 | 2119 | # followed by a non-domain character or end of line |
| 2120 | 2120 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | )? |
| 2183 | 2183 | '; |
| 2184 | 2184 | |
| 2185 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2185 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2186 | 2186 | $url = array_shift($matches); |
| 2187 | 2187 | |
| 2188 | 2188 | // If this isn't a clean URL, bail out |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | $fullUrl = $url; |
| 2208 | 2208 | |
| 2209 | 2209 | // Make sure that $fullUrl really is valid |
| 2210 | - if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false) |
|
| 2210 | + if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false) |
|
| 2211 | 2211 | return $url; |
| 2212 | 2212 | |
| 2213 | 2213 | return '[url="' . str_replace(array('[', ']'), array('[', ']'), $fullUrl) . '"]' . $url . '[/url]'; |
@@ -2271,7 +2271,7 @@ discard block |
||
| 2271 | 2271 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2272 | 2272 | |
| 2273 | 2273 | // A closing tag that doesn't match any open tags? Skip it. |
| 2274 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2274 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2275 | 2275 | continue; |
| 2276 | 2276 | |
| 2277 | 2277 | $to_close = array(); |
@@ -2929,7 +2929,7 @@ discard block |
||
| 2929 | 2929 | } |
| 2930 | 2930 | |
| 2931 | 2931 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
| 2932 | - foreach($smileysto AS $ix=>$file) |
|
| 2932 | + foreach ($smileysto AS $ix=>$file) |
|
| 2933 | 2933 | // Need to use the default if user selection is disabled |
| 2934 | 2934 | if (empty($modSettings['smiley_sets_enable'])) |
| 2935 | 2935 | $smileysto[$ix] = $file . $context['user']['smiley_set_default_ext']; |
@@ -2947,7 +2947,7 @@ discard block |
||
| 2947 | 2947 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2948 | 2948 | { |
| 2949 | 2949 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2950 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2950 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2951 | 2951 | |
| 2952 | 2952 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2953 | 2953 | |
@@ -2972,7 +2972,7 @@ discard block |
||
| 2972 | 2972 | |
| 2973 | 2973 | // Replace away! |
| 2974 | 2974 | $message = preg_replace_callback($smileyPregSearch, |
| 2975 | - function ($matches) use ($smileyPregReplacements) |
|
| 2975 | + function($matches) use ($smileyPregReplacements) |
|
| 2976 | 2976 | { |
| 2977 | 2977 | return $smileyPregReplacements[$matches[1]]; |
| 2978 | 2978 | }, $message); |
@@ -3069,13 +3069,13 @@ discard block |
||
| 3069 | 3069 | { |
| 3070 | 3070 | if (defined('SID') && SID != '') |
| 3071 | 3071 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 3072 | - function ($m) use ($scripturl) |
|
| 3072 | + function($m) use ($scripturl) |
|
| 3073 | 3073 | { |
| 3074 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 3074 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 3075 | 3075 | }, $setLocation); |
| 3076 | 3076 | else |
| 3077 | 3077 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 3078 | - function ($m) use ($scripturl) |
|
| 3078 | + function($m) use ($scripturl) |
|
| 3079 | 3079 | { |
| 3080 | 3080 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 3081 | 3081 | }, $setLocation); |
@@ -3396,7 +3396,7 @@ discard block |
||
| 3396 | 3396 | |
| 3397 | 3397 | // Add a generic "Are you sure?" confirmation message. |
| 3398 | 3398 | addInlineJavaScript(' |
| 3399 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3399 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3400 | 3400 | |
| 3401 | 3401 | // Now add the capping code for avatars. |
| 3402 | 3402 | 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') |
@@ -3862,7 +3862,7 @@ discard block |
||
| 3862 | 3862 | if (!empty($normal)) |
| 3863 | 3863 | foreach ($normal as $nf) |
| 3864 | 3864 | echo ' |
| 3865 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3865 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3866 | 3866 | |
| 3867 | 3867 | if ($db_show_debug === true) |
| 3868 | 3868 | { |
@@ -3878,7 +3878,7 @@ discard block |
||
| 3878 | 3878 | <style>'; |
| 3879 | 3879 | |
| 3880 | 3880 | foreach ($context['css_header'] as $css) |
| 3881 | - echo $css .' |
|
| 3881 | + echo $css . ' |
|
| 3882 | 3882 | '; |
| 3883 | 3883 | |
| 3884 | 3884 | echo' |
@@ -3950,7 +3950,7 @@ discard block |
||
| 3950 | 3950 | } |
| 3951 | 3951 | |
| 3952 | 3952 | // No namespaces, sorry! |
| 3953 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3953 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3954 | 3954 | |
| 3955 | 3955 | $minifier = new $classType(); |
| 3956 | 3956 | |
@@ -4095,7 +4095,7 @@ discard block |
||
| 4095 | 4095 | else |
| 4096 | 4096 | $path = $modSettings['attachmentUploadDir']; |
| 4097 | 4097 | |
| 4098 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 4098 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 4099 | 4099 | } |
| 4100 | 4100 | |
| 4101 | 4101 | /** |
@@ -4139,10 +4139,10 @@ discard block |
||
| 4139 | 4139 | $valid_low = isValidIP($ip_parts[0]); |
| 4140 | 4140 | $valid_high = isValidIP($ip_parts[1]); |
| 4141 | 4141 | $count = 0; |
| 4142 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4142 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 4143 | 4143 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 4144 | 4144 | $min = 0; |
| 4145 | - if(!$valid_low) |
|
| 4145 | + if (!$valid_low) |
|
| 4146 | 4146 | { |
| 4147 | 4147 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 4148 | 4148 | $valid_low = isValidIP($ip_parts[0]); |
@@ -4156,7 +4156,7 @@ discard block |
||
| 4156 | 4156 | } |
| 4157 | 4157 | |
| 4158 | 4158 | $count = 0; |
| 4159 | - if(!$valid_high) |
|
| 4159 | + if (!$valid_high) |
|
| 4160 | 4160 | { |
| 4161 | 4161 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 4162 | 4162 | $valid_high = isValidIP($ip_parts[1]); |
@@ -4169,7 +4169,7 @@ discard block |
||
| 4169 | 4169 | } |
| 4170 | 4170 | } |
| 4171 | 4171 | |
| 4172 | - if($valid_high && $valid_low) |
|
| 4172 | + if ($valid_high && $valid_low) |
|
| 4173 | 4173 | { |
| 4174 | 4174 | $ip_array['low'] = $ip_parts[0]; |
| 4175 | 4175 | $ip_array['high'] = $ip_parts[1]; |
@@ -4350,7 +4350,7 @@ discard block |
||
| 4350 | 4350 | addInlineJavaScript(' |
| 4351 | 4351 | var user_menus = new smc_PopupMenu(); |
| 4352 | 4352 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4353 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4353 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4354 | 4354 | if ($context['allow_pm']) |
| 4355 | 4355 | addInlineJavaScript(' |
| 4356 | 4356 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4645,7 +4645,7 @@ discard block |
||
| 4645 | 4645 | $context['total_admin_reports'] += $context['unapproved_members']; |
| 4646 | 4646 | } |
| 4647 | 4647 | |
| 4648 | - if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4648 | + if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin'])) |
|
| 4649 | 4649 | { |
| 4650 | 4650 | $context['menu_buttons']['admin']['amt'] = $context['total_admin_reports']; |
| 4651 | 4651 | } |
@@ -4992,7 +4992,7 @@ discard block |
||
| 4992 | 4992 | // No? try a fallback to $sourcedir |
| 4993 | 4993 | else |
| 4994 | 4994 | { |
| 4995 | - $absPath = $sourcedir .'/'. $file; |
|
| 4995 | + $absPath = $sourcedir . '/' . $file; |
|
| 4996 | 4996 | |
| 4997 | 4997 | if (file_exists($absPath)) |
| 4998 | 4998 | require_once($absPath); |
@@ -5259,15 +5259,15 @@ discard block |
||
| 5259 | 5259 | |
| 5260 | 5260 | // UTF-8 occurences of MS special characters |
| 5261 | 5261 | $findchars_utf8 = array( |
| 5262 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5263 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5264 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5265 | - "\xe2\x80\x98", // left single curly quote |
|
| 5266 | - "\xe2\x80\x99", // right single curly quote |
|
| 5267 | - "\xe2\x80\x9c", // left double curly quote |
|
| 5268 | - "\xe2\x80\x9d", // right double curly quote |
|
| 5269 | - "\xe2\x80\x93", // en dash |
|
| 5270 | - "\xe2\x80\x94", // em dash |
|
| 5262 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 5263 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 5264 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 5265 | + "\xe2\x80\x98", // left single curly quote |
|
| 5266 | + "\xe2\x80\x99", // right single curly quote |
|
| 5267 | + "\xe2\x80\x9c", // left double curly quote |
|
| 5268 | + "\xe2\x80\x9d", // right double curly quote |
|
| 5269 | + "\xe2\x80\x93", // en dash |
|
| 5270 | + "\xe2\x80\x94", // em dash |
|
| 5271 | 5271 | ); |
| 5272 | 5272 | |
| 5273 | 5273 | // windows 1252 / iso equivalents |
@@ -5285,15 +5285,15 @@ discard block |
||
| 5285 | 5285 | |
| 5286 | 5286 | // safe replacements |
| 5287 | 5287 | $replacechars = array( |
| 5288 | - ',', // ‚ |
|
| 5289 | - ',,', // „ |
|
| 5290 | - '...', // … |
|
| 5291 | - "'", // ‘ |
|
| 5292 | - "'", // ’ |
|
| 5293 | - '"', // “ |
|
| 5294 | - '"', // ” |
|
| 5295 | - '-', // – |
|
| 5296 | - '--', // — |
|
| 5288 | + ',', // ‚ |
|
| 5289 | + ',,', // „ |
|
| 5290 | + '...', // … |
|
| 5291 | + "'", // ‘ |
|
| 5292 | + "'", // ’ |
|
| 5293 | + '"', // “ |
|
| 5294 | + '"', // ” |
|
| 5295 | + '-', // – |
|
| 5296 | + '--', // — |
|
| 5297 | 5297 | ); |
| 5298 | 5298 | |
| 5299 | 5299 | if ($context['utf8']) |
@@ -5613,7 +5613,7 @@ discard block |
||
| 5613 | 5613 | */ |
| 5614 | 5614 | function inet_dtop($bin) |
| 5615 | 5615 | { |
| 5616 | - if(empty($bin)) |
|
| 5616 | + if (empty($bin)) |
|
| 5617 | 5617 | return ''; |
| 5618 | 5618 | |
| 5619 | 5619 | global $db_type; |
@@ -5644,28 +5644,28 @@ discard block |
||
| 5644 | 5644 | */ |
| 5645 | 5645 | function _safe_serialize($value) |
| 5646 | 5646 | { |
| 5647 | - if(is_null($value)) |
|
| 5647 | + if (is_null($value)) |
|
| 5648 | 5648 | return 'N;'; |
| 5649 | 5649 | |
| 5650 | - if(is_bool($value)) |
|
| 5651 | - return 'b:'. (int) $value .';'; |
|
| 5650 | + if (is_bool($value)) |
|
| 5651 | + return 'b:' . (int) $value . ';'; |
|
| 5652 | 5652 | |
| 5653 | - if(is_int($value)) |
|
| 5654 | - return 'i:'. $value .';'; |
|
| 5653 | + if (is_int($value)) |
|
| 5654 | + return 'i:' . $value . ';'; |
|
| 5655 | 5655 | |
| 5656 | - if(is_float($value)) |
|
| 5657 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5656 | + if (is_float($value)) |
|
| 5657 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5658 | 5658 | |
| 5659 | - if(is_string($value)) |
|
| 5660 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5659 | + if (is_string($value)) |
|
| 5660 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5661 | 5661 | |
| 5662 | - if(is_array($value)) |
|
| 5662 | + if (is_array($value)) |
|
| 5663 | 5663 | { |
| 5664 | 5664 | $out = ''; |
| 5665 | - foreach($value as $k => $v) |
|
| 5665 | + foreach ($value as $k => $v) |
|
| 5666 | 5666 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5667 | 5667 | |
| 5668 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5668 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5669 | 5669 | } |
| 5670 | 5670 | |
| 5671 | 5671 | // safe_serialize cannot serialize resources or objects. |
@@ -5707,7 +5707,7 @@ discard block |
||
| 5707 | 5707 | function _safe_unserialize($str) |
| 5708 | 5708 | { |
| 5709 | 5709 | // Input is not a string. |
| 5710 | - if(empty($str) || !is_string($str)) |
|
| 5710 | + if (empty($str) || !is_string($str)) |
|
| 5711 | 5711 | return false; |
| 5712 | 5712 | |
| 5713 | 5713 | $stack = array(); |
@@ -5721,40 +5721,40 @@ discard block |
||
| 5721 | 5721 | * 3 - in array, expecting value or another array |
| 5722 | 5722 | */ |
| 5723 | 5723 | $state = 0; |
| 5724 | - while($state != 1) |
|
| 5724 | + while ($state != 1) |
|
| 5725 | 5725 | { |
| 5726 | 5726 | $type = isset($str[0]) ? $str[0] : ''; |
| 5727 | - if($type == '}') |
|
| 5727 | + if ($type == '}') |
|
| 5728 | 5728 | $str = substr($str, 1); |
| 5729 | 5729 | |
| 5730 | - else if($type == 'N' && $str[1] == ';') |
|
| 5730 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5731 | 5731 | { |
| 5732 | 5732 | $value = null; |
| 5733 | 5733 | $str = substr($str, 2); |
| 5734 | 5734 | } |
| 5735 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5735 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5736 | 5736 | { |
| 5737 | 5737 | $value = $matches[1] == '1' ? true : false; |
| 5738 | 5738 | $str = substr($str, 4); |
| 5739 | 5739 | } |
| 5740 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5740 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5741 | 5741 | { |
| 5742 | - $value = (int)$matches[1]; |
|
| 5742 | + $value = (int) $matches[1]; |
|
| 5743 | 5743 | $str = $matches[2]; |
| 5744 | 5744 | } |
| 5745 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5745 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5746 | 5746 | { |
| 5747 | - $value = (float)$matches[1]; |
|
| 5747 | + $value = (float) $matches[1]; |
|
| 5748 | 5748 | $str = $matches[3]; |
| 5749 | 5749 | } |
| 5750 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5750 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5751 | 5751 | { |
| 5752 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5753 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5752 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5753 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5754 | 5754 | } |
| 5755 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5755 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5756 | 5756 | { |
| 5757 | - $expectedLength = (int)$matches[1]; |
|
| 5757 | + $expectedLength = (int) $matches[1]; |
|
| 5758 | 5758 | $str = $matches[2]; |
| 5759 | 5759 | } |
| 5760 | 5760 | |
@@ -5762,10 +5762,10 @@ discard block |
||
| 5762 | 5762 | else |
| 5763 | 5763 | return false; |
| 5764 | 5764 | |
| 5765 | - switch($state) |
|
| 5765 | + switch ($state) |
|
| 5766 | 5766 | { |
| 5767 | 5767 | case 3: // In array, expecting value or another array. |
| 5768 | - if($type == 'a') |
|
| 5768 | + if ($type == 'a') |
|
| 5769 | 5769 | { |
| 5770 | 5770 | $stack[] = &$list; |
| 5771 | 5771 | $list[$key] = array(); |
@@ -5774,7 +5774,7 @@ discard block |
||
| 5774 | 5774 | $state = 2; |
| 5775 | 5775 | break; |
| 5776 | 5776 | } |
| 5777 | - if($type != '}') |
|
| 5777 | + if ($type != '}') |
|
| 5778 | 5778 | { |
| 5779 | 5779 | $list[$key] = $value; |
| 5780 | 5780 | $state = 2; |
@@ -5785,29 +5785,29 @@ discard block |
||
| 5785 | 5785 | return false; |
| 5786 | 5786 | |
| 5787 | 5787 | case 2: // in array, expecting end of array or a key |
| 5788 | - if($type == '}') |
|
| 5788 | + if ($type == '}') |
|
| 5789 | 5789 | { |
| 5790 | 5790 | // Array size is less than expected. |
| 5791 | - if(count($list) < end($expected)) |
|
| 5791 | + if (count($list) < end($expected)) |
|
| 5792 | 5792 | return false; |
| 5793 | 5793 | |
| 5794 | 5794 | unset($list); |
| 5795 | - $list = &$stack[count($stack)-1]; |
|
| 5795 | + $list = &$stack[count($stack) - 1]; |
|
| 5796 | 5796 | array_pop($stack); |
| 5797 | 5797 | |
| 5798 | 5798 | // Go to terminal state if we're at the end of the root array. |
| 5799 | 5799 | array_pop($expected); |
| 5800 | 5800 | |
| 5801 | - if(count($expected) == 0) |
|
| 5801 | + if (count($expected) == 0) |
|
| 5802 | 5802 | $state = 1; |
| 5803 | 5803 | |
| 5804 | 5804 | break; |
| 5805 | 5805 | } |
| 5806 | 5806 | |
| 5807 | - if($type == 'i' || $type == 's') |
|
| 5807 | + if ($type == 'i' || $type == 's') |
|
| 5808 | 5808 | { |
| 5809 | 5809 | // Array size exceeds expected length. |
| 5810 | - if(count($list) >= end($expected)) |
|
| 5810 | + if (count($list) >= end($expected)) |
|
| 5811 | 5811 | return false; |
| 5812 | 5812 | |
| 5813 | 5813 | $key = $value; |
@@ -5820,7 +5820,7 @@ discard block |
||
| 5820 | 5820 | |
| 5821 | 5821 | // Expecting array or value. |
| 5822 | 5822 | case 0: |
| 5823 | - if($type == 'a') |
|
| 5823 | + if ($type == 'a') |
|
| 5824 | 5824 | { |
| 5825 | 5825 | $data = array(); |
| 5826 | 5826 | $list = &$data; |
@@ -5829,7 +5829,7 @@ discard block |
||
| 5829 | 5829 | break; |
| 5830 | 5830 | } |
| 5831 | 5831 | |
| 5832 | - if($type != '}') |
|
| 5832 | + if ($type != '}') |
|
| 5833 | 5833 | { |
| 5834 | 5834 | $data = $value; |
| 5835 | 5835 | $state = 1; |
@@ -5842,7 +5842,7 @@ discard block |
||
| 5842 | 5842 | } |
| 5843 | 5843 | |
| 5844 | 5844 | // Trailing data in input. |
| 5845 | - if(!empty($str)) |
|
| 5845 | + if (!empty($str)) |
|
| 5846 | 5846 | return false; |
| 5847 | 5847 | |
| 5848 | 5848 | return $data; |
@@ -5896,7 +5896,7 @@ discard block |
||
| 5896 | 5896 | // Set different modes. |
| 5897 | 5897 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5898 | 5898 | |
| 5899 | - foreach($chmodValues as $val) |
|
| 5899 | + foreach ($chmodValues as $val) |
|
| 5900 | 5900 | { |
| 5901 | 5901 | // If it's writable, break out of the loop. |
| 5902 | 5902 | if (is_writable($file)) |
@@ -5931,13 +5931,13 @@ discard block |
||
| 5931 | 5931 | $returnArray = @json_decode($json, $returnAsArray); |
| 5932 | 5932 | |
| 5933 | 5933 | // PHP 5.3 so no json_last_error_msg() |
| 5934 | - switch(json_last_error()) |
|
| 5934 | + switch (json_last_error()) |
|
| 5935 | 5935 | { |
| 5936 | 5936 | case JSON_ERROR_NONE: |
| 5937 | 5937 | $jsonError = false; |
| 5938 | 5938 | break; |
| 5939 | 5939 | case JSON_ERROR_DEPTH: |
| 5940 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5940 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5941 | 5941 | break; |
| 5942 | 5942 | case JSON_ERROR_STATE_MISMATCH: |
| 5943 | 5943 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5965,10 +5965,10 @@ discard block |
||
| 5965 | 5965 | loadLanguage('Errors'); |
| 5966 | 5966 | |
| 5967 | 5967 | if (!empty($jsonDebug)) |
| 5968 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5968 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5969 | 5969 | |
| 5970 | 5970 | else |
| 5971 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5971 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5972 | 5972 | |
| 5973 | 5973 | // Everyone expects an array. |
| 5974 | 5974 | return array(); |
@@ -6085,7 +6085,7 @@ discard block |
||
| 6085 | 6085 | // Convert Punycode to Unicode |
| 6086 | 6086 | require_once($sourcedir . '/Class-Punycode.php'); |
| 6087 | 6087 | $Punycode = new Punycode(); |
| 6088 | - $tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6088 | + $tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds); |
|
| 6089 | 6089 | } |
| 6090 | 6090 | // Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update |
| 6091 | 6091 | else |
@@ -6179,7 +6179,7 @@ discard block |
||
| 6179 | 6179 | } |
| 6180 | 6180 | |
| 6181 | 6181 | // This recursive function creates the index array from the strings |
| 6182 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6182 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 6183 | 6183 | { |
| 6184 | 6184 | static $depth = 0; |
| 6185 | 6185 | $depth++; |
@@ -6206,7 +6206,7 @@ discard block |
||
| 6206 | 6206 | }; |
| 6207 | 6207 | |
| 6208 | 6208 | // This recursive function turns the index array into a regular expression |
| 6209 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6209 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 6210 | 6210 | { |
| 6211 | 6211 | static $depth = 0; |
| 6212 | 6212 | $depth++; |
@@ -6230,11 +6230,11 @@ discard block |
||
| 6230 | 6230 | |
| 6231 | 6231 | if (count(array_keys($value)) == 1) |
| 6232 | 6232 | { |
| 6233 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 6233 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 6234 | 6234 | $new_key .= $new_key_array[0]; |
| 6235 | 6235 | } |
| 6236 | 6236 | else |
| 6237 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 6237 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 6238 | 6238 | } |
| 6239 | 6239 | |
| 6240 | 6240 | if ($depth > 1) |
@@ -6277,10 +6277,10 @@ discard block |
||
| 6277 | 6277 | { |
| 6278 | 6278 | $regex = array(); |
| 6279 | 6279 | while (!empty($index)) |
| 6280 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6280 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6281 | 6281 | } |
| 6282 | 6282 | else |
| 6283 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6283 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6284 | 6284 | |
| 6285 | 6285 | // Restore PHP's internal character encoding to whatever it was originally |
| 6286 | 6286 | if (!empty($current_encoding)) |
@@ -6442,8 +6442,8 @@ discard block |
||
| 6442 | 6442 | $query_part['query_see_board'] = '1=1'; |
| 6443 | 6443 | // Otherwise just the groups in $user_info['groups']. |
| 6444 | 6444 | else |
| 6445 | - $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( '. implode(',', $groups) .') AND bpv.deny = 0) ' |
|
| 6446 | - . ( !empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '. implode(',', $groups) .') and bpv.deny = 1)' : '') |
|
| 6445 | + $query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( ' . implode(',', $groups) . ') AND bpv.deny = 0) ' |
|
| 6446 | + . (!empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( ' . implode(',', $groups) . ') and bpv.deny = 1)' : '') |
|
| 6447 | 6447 | . ' AND bpv.id_board = b.id_board)'; |
| 6448 | 6448 | |
| 6449 | 6449 | // Build the list of boards they WANT to see. |
@@ -6507,7 +6507,7 @@ discard block |
||
| 6507 | 6507 | function sanitize_iri($iri) |
| 6508 | 6508 | { |
| 6509 | 6509 | // Encode any non-ASCII characters (but not space or control characters of any sort) |
| 6510 | - $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) { |
|
| 6510 | + $iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) { |
|
| 6511 | 6511 | return rawurlencode($matches[0]); |
| 6512 | 6512 | }, $iri); |
| 6513 | 6513 | |