@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | else |
| 238 | 238 | { |
| 239 | 239 | $query_this_board = '{query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? ' |
| 240 | - AND b.id_board != {int:recycle_board}' : ''). ' |
|
| 240 | + AND b.id_board != {int:recycle_board}' : '') . ' |
|
| 241 | 241 | AND m.id_msg >= {int:max_id_msg}'; |
| 242 | 242 | $query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 100 - $_REQUEST['start'] * 6); |
| 243 | 243 | $query_parameters['recycle_board'] = $modSettings['recycle_board']; |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | ); |
| 1125 | 1125 | else |
| 1126 | 1126 | $request = $smcFunc['db_query']('', ' |
| 1127 | - SELECT DISTINCT t.id_topic,'.$_REQUEST['sort'].' |
|
| 1127 | + SELECT DISTINCT t.id_topic,'.$_REQUEST['sort'] . ' |
|
| 1128 | 1128 | FROM {db_prefix}topics AS t |
| 1129 | 1129 | INNER JOIN {db_prefix}messages AS m ON (m.id_topic = t.id_topic AND m.id_member = {int:current_member})' . (strpos($_REQUEST['sort'], 'ms.') === false ? '' : ' |
| 1130 | 1130 | INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)') . (strpos($_REQUEST['sort'], 'mems.') === false ? '' : ' |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | if ($is_topics) |
| 1392 | 1392 | { |
| 1393 | 1393 | $context['recent_buttons'] = array( |
| 1394 | - 'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'custom' => 'data-confirm="'. $txt['are_sure_mark_read'] .'"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1394 | + 'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1395 | 1395 | ); |
| 1396 | 1396 | |
| 1397 | 1397 | if ($context['showCheckboxes']) |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | elseif (!$is_topics && isset($context['topics_to_mark'])) |
| 1408 | 1408 | { |
| 1409 | 1409 | $context['recent_buttons'] = array( |
| 1410 | - 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'custom' => 'data-confirm="'. $txt['are_sure_mark_read'] .'"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1410 | + 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1411 | 1411 | ); |
| 1412 | 1412 | |
| 1413 | 1413 | if ($context['showCheckboxes']) |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | if (!empty($modSettings['search_simple_fulltext'])) |
| 208 | 208 | { |
| 209 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
| 209 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
| 210 | 210 | { |
| 211 | 211 | //we use the default language "default_text_search_config", otherwise we had to assgine the language here |
| 212 | 212 | //to_tsvector(body) -> to_tsvector($language,body) to_tsquery(...) -> to_tsquery($language,...) |
| 213 | 213 | $language_ftx = 'english'; |
| 214 | - $request = $smcFunc['db_query']('',' |
|
| 214 | + $request = $smcFunc['db_query']('', ' |
|
| 215 | 215 | SHOW default_text_search_config', |
| 216 | 216 | array() |
| 217 | 217 | ); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // remove any indexed words that are used in the complex body search terms |
| 236 | 236 | $words['indexed_words'] = array_diff($words['indexed_words'], $words['complex_words']); |
| 237 | 237 | |
| 238 | - if($smcFunc['db_title'] == "PostgreSQL"){ |
|
| 238 | + if ($smcFunc['db_title'] == "PostgreSQL") { |
|
| 239 | 239 | $row = 0; |
| 240 | 240 | foreach ($words['indexed_words'] as $fulltextWord) { |
| 241 | 241 | $query_params['boolean_match'] .= ($row <> 0 ? '&' : ''); |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | // if we have bool terms to search, add them in |
| 253 | 253 | if ($query_params['boolean_match']) { |
| 254 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
| 254 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
| 255 | 255 | { |
| 256 | 256 | //we use the default language "default_text_search_config", otherwise we had to assgine the language here |
| 257 | 257 | //to_tsvector(body) -> to_tsvector($language,body) to_tsquery(...) -> to_tsquery($language,...) |
| 258 | 258 | $language_ftx = 'english'; |
| 259 | - $request = $smcFunc['db_query']('',' |
|
| 259 | + $request = $smcFunc['db_query']('', ' |
|
| 260 | 260 | SHOW default_text_search_config', |
| 261 | 261 | array() |
| 262 | 262 | ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 278 | + $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? (' |
|
| 279 | 279 | INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . ' |
| 280 | 280 | (' . implode(', ', array_keys($query_select)) . ')') : '') . ' |
| 281 | 281 | SELECT ' . implode(', ', $query_select) . ' |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | // Build the reports button array. |
| 113 | 113 | $context['report_buttons'] = array( |
| 114 | 114 | 'generate_reports' => array('text' => 'generate_reports', 'image' => 'print.png', 'url' => $scripturl . '?action=admin;area=reports', 'active' => true), |
| 115 | - 'print' => array('text' => 'print', 'image' => 'print.png', 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type']. ';st=print', 'custom' => 'target="_blank"'), |
|
| 115 | + 'print' => array('text' => 'print', 'image' => 'print.png', 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type'] . ';st=print', 'custom' => 'target="_blank"'), |
|
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | // Allow mods to add additional buttons here |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $request = $smcFunc['db_query']('', ' |
| 345 | 345 | SELECT id_board, id_group |
| 346 | 346 | FROM {db_prefix}moderator_groups |
| 347 | - WHERE ' . $board_clause .' AND ' . $group_clause, |
|
| 347 | + WHERE ' . $board_clause . ' AND ' . $group_clause, |
|
| 348 | 348 | array( |
| 349 | 349 | ) |
| 350 | 350 | ); |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Use cache when possible. |
| 74 | - if (($cache = cache_get_data('attachment_lookup_id-'. $attachId)) != null) |
|
| 74 | + if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) |
|
| 75 | 75 | list($file, $thumbFile) = $cache; |
| 76 | 76 | |
| 77 | 77 | // Get the info from the DB. |
| 78 | - if(empty($file) || empty($thumbFile) && !empty($file['id_thumb'])) |
|
| 78 | + if (empty($file) || empty($thumbFile) && !empty($file['id_thumb'])) |
|
| 79 | 79 | { |
| 80 | 80 | // Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request. |
| 81 | 81 | $attachRequest = null; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | $file['filePath'] = getAttachmentFilename($file['filename'], $attachId, $file['id_folder'], false, $file['file_hash']); |
| 145 | 145 | // ensure variant attachment compatibility |
| 146 | 146 | $filePath = pathinfo($file['filePath']); |
| 147 | - $file['filePath'] = !file_exists($file['filePath']) ? substr($file['filePath'], 0, -(strlen($filePath['extension'])+1)) : $file['filePath']; |
|
| 148 | - $file['etag'] = '"'. md5_file($file['filePath']) .'"'; |
|
| 147 | + $file['filePath'] = !file_exists($file['filePath']) ? substr($file['filePath'], 0, -(strlen($filePath['extension']) + 1)) : $file['filePath']; |
|
| 148 | + $file['etag'] = '"' . md5_file($file['filePath']) . '"'; |
|
| 149 | 149 | |
| 150 | 150 | // now get the thumbfile! |
| 151 | 151 | $thumbFile = array(); |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | // set filePath and ETag time |
| 173 | 173 | $thumbFile['filePath'] = getAttachmentFilename($thumbFile['filename'], $attachId, $thumbFile['id_folder'], false, $thumbFile['file_hash']); |
| 174 | - $thumbFile['etag'] = '"'. md5_file($thumbFile['filePath']) .'"'; |
|
| 174 | + $thumbFile['etag'] = '"' . md5_file($thumbFile['filePath']) . '"'; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // Cache it. |
| 179 | - if(!empty($file) || !empty($thumbFile)) |
|
| 180 | - cache_put_data('attachment_lookup_id-'. $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
| 179 | + if (!empty($file) || !empty($thumbFile)) |
|
| 180 | + cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Update the download counter (unless it's a thumbnail). |
@@ -289,17 +289,17 @@ discard block |
||
| 289 | 289 | if (!empty($modSettings['attachmentRecodeLineEndings']) && !isset($_REQUEST['image']) && in_array($file['fileext'], array('txt', 'css', 'htm', 'html', 'php', 'xml'))) |
| 290 | 290 | { |
| 291 | 291 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) |
| 292 | - $callback = function ($buffer) |
|
| 292 | + $callback = function($buffer) |
|
| 293 | 293 | { |
| 294 | 294 | return preg_replace('~[\r]?\n~', "\r\n", $buffer); |
| 295 | 295 | }; |
| 296 | 296 | elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) |
| 297 | - $callback = function ($buffer) |
|
| 297 | + $callback = function($buffer) |
|
| 298 | 298 | { |
| 299 | 299 | return preg_replace('~[\r]?\n~', "\r", $buffer); |
| 300 | 300 | }; |
| 301 | 301 | else |
| 302 | - $callback = function ($buffer) |
|
| 302 | + $callback = function($buffer) |
|
| 303 | 303 | { |
| 304 | 304 | return preg_replace('~[\r]?\n~', "\n", $buffer); |
| 305 | 305 | }; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // Just send a generic message. |
| 77 | 77 | else |
| 78 | 78 | $this->setResponse(array( |
| 79 | - 'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error', |
|
| 79 | + 'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error', |
|
| 80 | 80 | 'type' => 'error', |
| 81 | 81 | 'data' => false, |
| 82 | 82 | )); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | // Gotta urlencode the filename. |
| 405 | 405 | if ($this->_attachResults) |
| 406 | 406 | foreach ($this->_attachResults as $k => $v) |
| 407 | - $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
| 407 | + $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
| 408 | 408 | |
| 409 | 409 | $this->_response = array( |
| 410 | 410 | 'files' => $this->_attachResults ? $this->_attachResults : false, |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | ob_start(); |
| 432 | 432 | |
| 433 | 433 | // Set the header. |
| 434 | - header('Content-Type: application/json; charset='. $context['character_set'] .''); |
|
| 434 | + header('Content-Type: application/json; charset=' . $context['character_set'] . ''); |
|
| 435 | 435 | |
| 436 | 436 | echo json_encode($this->_response ? $this->_response : array()); |
| 437 | 437 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | 'value' => $txt['ban_added'], |
| 184 | 184 | ), |
| 185 | 185 | 'data' => array( |
| 186 | - 'function' => function ($rowData) use ($context) |
|
| 186 | + 'function' => function($rowData) use ($context) |
|
| 187 | 187 | { |
| 188 | 188 | return timeformat($rowData['ban_time'], empty($context['ban_time_format']) ? true : $context['ban_time_format']); |
| 189 | 189 | }, |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | 'value' => $txt['ban_expires'], |
| 199 | 199 | ), |
| 200 | 200 | 'data' => array( |
| 201 | - 'function' => function ($rowData) use ($txt) |
|
| 201 | + 'function' => function($rowData) use ($txt) |
|
| 202 | 202 | { |
| 203 | 203 | // This ban never expires...whahaha. |
| 204 | 204 | if ($rowData['expire_time'] === null) |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | 'style' => 'width: 60%;text-align: left;', |
| 402 | 402 | ), |
| 403 | 403 | 'data' => array( |
| 404 | - 'function' => function ($ban_item) use ($txt) |
|
| 404 | + 'function' => function($ban_item) use ($txt) |
|
| 405 | 405 | { |
| 406 | 406 | if (in_array($ban_item['type'], array('ip', 'hostname', 'email'))) |
| 407 | 407 | return '<strong>' . $txt[$ban_item['type']] . ':</strong> ' . $ban_item[$ban_item['type']]; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | 'style' => 'width: 15%; text-align: center;', |
| 430 | 430 | ), |
| 431 | 431 | 'data' => array( |
| 432 | - 'function' => function ($ban_item) use ($txt, $context, $scripturl) |
|
| 432 | + 'function' => function($ban_item) use ($txt, $context, $scripturl) |
|
| 433 | 433 | { |
| 434 | 434 | return '<a href="' . $scripturl . '?action=admin;area=ban;sa=edittrigger;bg=' . $context['ban_group_id'] . ';bi=' . $ban_item['id'] . '">' . $txt['ban_edit_trigger'] . '</a>'; |
| 435 | 435 | }, |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // We come from the mod center. |
| 557 | - elseif(isset($_GET['msg']) && !empty($_GET['msg'])) |
|
| 557 | + elseif (isset($_GET['msg']) && !empty($_GET['msg'])) |
|
| 558 | 558 | { |
| 559 | 559 | $request = $smcFunc['db_query']('', ' |
| 560 | 560 | SELECT poster_name, poster_ip, poster_email |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) |
| 1430 | 1430 | $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
| 1431 | 1431 | |
| 1432 | - if(!empty($ban_info['id'])) |
|
| 1432 | + if (!empty($ban_info['id'])) |
|
| 1433 | 1433 | { |
| 1434 | 1434 | // Verify the ban group exists. |
| 1435 | 1435 | $request = $smcFunc['db_query']('', ' |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | $smcFunc['db_free_result']($request); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | - if(!empty($ban_info['name'])) |
|
| 1450 | + if (!empty($ban_info['name'])) |
|
| 1451 | 1451 | { |
| 1452 | 1452 | // Make sure the name does not already exist (Of course, if it exists in the ban group we are editing, proceed.) |
| 1453 | 1453 | $request = $smcFunc['db_query']('', ' |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | if (empty($ban_info['cannot']['access']) && empty($ban_info['cannot']['register']) && empty($ban_info['cannot']['post']) && empty($ban_info['cannot']['login'])) |
| 1517 | 1517 | $context['ban_errors'][] = 'ban_unknown_restriction_type'; |
| 1518 | 1518 | |
| 1519 | - if(!empty($ban_info['name'])) |
|
| 1519 | + if (!empty($ban_info['name'])) |
|
| 1520 | 1520 | { |
| 1521 | 1521 | // Check whether a ban with this name already exists. |
| 1522 | 1522 | $request = $smcFunc['db_query']('', ' |
@@ -1795,7 +1795,7 @@ discard block |
||
| 1795 | 1795 | if ($context['selected_entity'] === 'ip') |
| 1796 | 1796 | { |
| 1797 | 1797 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1798 | - 'function' => function ($rowData) |
|
| 1798 | + 'function' => function($rowData) |
|
| 1799 | 1799 | { |
| 1800 | 1800 | return range2ip( |
| 1801 | 1801 | $rowData['ip_low'] |
@@ -1812,7 +1812,7 @@ discard block |
||
| 1812 | 1812 | elseif ($context['selected_entity'] === 'hostname') |
| 1813 | 1813 | { |
| 1814 | 1814 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1815 | - 'function' => function ($rowData) use ($smcFunc) |
|
| 1815 | + 'function' => function($rowData) use ($smcFunc) |
|
| 1816 | 1816 | { |
| 1817 | 1817 | return strtr($smcFunc['htmlspecialchars']($rowData['hostname']), array('%' => '*')); |
| 1818 | 1818 | }, |
@@ -1825,7 +1825,7 @@ discard block |
||
| 1825 | 1825 | elseif ($context['selected_entity'] === 'email') |
| 1826 | 1826 | { |
| 1827 | 1827 | $listOptions['columns']['banned_entity']['data'] = array( |
| 1828 | - 'function' => function ($rowData) use ($smcFunc) |
|
| 1828 | + 'function' => function($rowData) use ($smcFunc) |
|
| 1829 | 1829 | { |
| 1830 | 1830 | return strtr($smcFunc['htmlspecialchars']($rowData['email_address']), array('%' => '*')); |
| 1831 | 1831 | }, |
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | 'value' => $txt['ban_log_date'], |
| 2033 | 2033 | ), |
| 2034 | 2034 | 'data' => array( |
| 2035 | - 'function' => function ($rowData) |
|
| 2035 | + 'function' => function($rowData) |
|
| 2036 | 2036 | { |
| 2037 | 2037 | return timeformat($rowData['log_time']); |
| 2038 | 2038 | }, |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | $log_entries = array(); |
| 2123 | 2123 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2124 | 2124 | { |
| 2125 | - $row['ip'] = $row['ip'] === null? $dash : inet_dtop($row['ip']); |
|
| 2125 | + $row['ip'] = $row['ip'] === null ? $dash : inet_dtop($row['ip']); |
|
| 2126 | 2126 | $log_entries[] = $row; |
| 2127 | 2127 | } |
| 2128 | 2128 | $smcFunc['db_free_result']($request); |
@@ -2170,7 +2170,7 @@ discard block |
||
| 2170 | 2170 | if ($low == $high) |
| 2171 | 2171 | return $low; |
| 2172 | 2172 | else |
| 2173 | - return $low . '-'.$high; |
|
| 2173 | + return $low . '-' . $high; |
|
| 2174 | 2174 | } |
| 2175 | 2175 | |
| 2176 | 2176 | /** |
@@ -2286,7 +2286,7 @@ discard block |
||
| 2286 | 2286 | $request = $smcFunc['db_query']('', ' |
| 2287 | 2287 | SELECT mem.id_member, mem.is_activated |
| 2288 | 2288 | FROM {db_prefix}members AS mem |
| 2289 | - WHERE ' . implode( ' OR ', $queryPart), |
|
| 2289 | + WHERE ' . implode(' OR ', $queryPart), |
|
| 2290 | 2290 | $queryValues |
| 2291 | 2291 | ); |
| 2292 | 2292 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // Set a list of common functions. |
| 74 | 74 | $ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);'; |
| 75 | - $ent_check = empty($modSettings['disableEntityCheck']) ? function ($string) |
|
| 75 | + $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
|
| 76 | 76 | { |
| 77 | 77 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
| 78 | 78 | return $string; |
| 79 | - } : function ($string) |
|
| 79 | + } : function($string) |
|
| 80 | 80 | { |
| 81 | 81 | return $string; |
| 82 | 82 | }; |
| 83 | - $fix_utf8mb4 = function ($string) use ($utf8) |
|
| 83 | + $fix_utf8mb4 = function($string) use ($utf8) |
|
| 84 | 84 | { |
| 85 | 85 | if (!$utf8) |
| 86 | 86 | return $string; |
@@ -98,21 +98,21 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | elseif ($ord < 224) |
| 100 | 100 | { |
| 101 | - $new_string .= $string[$i] . $string[$i+1]; |
|
| 101 | + $new_string .= $string[$i] . $string[$i + 1]; |
|
| 102 | 102 | $i += 2; |
| 103 | 103 | } |
| 104 | 104 | elseif ($ord < 240) |
| 105 | 105 | { |
| 106 | - $new_string .= $string[$i] . $string[$i+1] . $string[$i+2]; |
|
| 106 | + $new_string .= $string[$i] . $string[$i + 1] . $string[$i + 2]; |
|
| 107 | 107 | $i += 3; |
| 108 | 108 | } |
| 109 | 109 | elseif ($ord < 248) |
| 110 | 110 | { |
| 111 | 111 | // Magic happens. |
| 112 | 112 | $val = (ord($string[$i]) & 0x07) << 18; |
| 113 | - $val += (ord($string[$i+1]) & 0x3F) << 12; |
|
| 114 | - $val += (ord($string[$i+2]) & 0x3F) << 6; |
|
| 115 | - $val += (ord($string[$i+3]) & 0x3F); |
|
| 113 | + $val += (ord($string[$i + 1]) & 0x3F) << 12; |
|
| 114 | + $val += (ord($string[$i + 2]) & 0x3F) << 6; |
|
| 115 | + $val += (ord($string[$i + 3]) & 0x3F); |
|
| 116 | 116 | $new_string .= '&#' . $val . ';'; |
| 117 | 117 | $i += 4; |
| 118 | 118 | } |
@@ -125,24 +125,24 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | // global array of anonymous helper functions, used mostly to properly handle multi byte strings |
| 127 | 127 | $smcFunc += array( |
| 128 | - 'entity_fix' => function ($string) |
|
| 128 | + 'entity_fix' => function($string) |
|
| 129 | 129 | { |
| 130 | 130 | $num = $string[0] === 'x' ? hexdec(substr($string, 1)) : (int) $string; |
| 131 | 131 | return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? '' : '&#' . $num . ';'; |
| 132 | 132 | }, |
| 133 | - 'htmlspecialchars' => function ($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4) |
|
| 133 | + 'htmlspecialchars' => function($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4) |
|
| 134 | 134 | { |
| 135 | 135 | return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset))); |
| 136 | 136 | }, |
| 137 | - 'htmltrim' => function ($string) use ($utf8, $space_chars, $ent_check) |
|
| 137 | + 'htmltrim' => function($string) use ($utf8, $space_chars, $ent_check) |
|
| 138 | 138 | { |
| 139 | 139 | return preg_replace('~^(?:[ \t\n\r\x0B\x00' . $space_chars . ']| )+|(?:[ \t\n\r\x0B\x00' . $space_chars . ']| )+$~' . ($utf8 ? 'u' : ''), '', $ent_check($string)); |
| 140 | 140 | }, |
| 141 | - 'strlen' => function ($string) use ($ent_list, $utf8, $ent_check) |
|
| 141 | + 'strlen' => function($string) use ($ent_list, $utf8, $ent_check) |
|
| 142 | 142 | { |
| 143 | 143 | return strlen(preg_replace('~' . $ent_list . ($utf8 ? '|.~u' : '~'), '_', $ent_check($string))); |
| 144 | 144 | }, |
| 145 | - 'strpos' => function ($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings) |
|
| 145 | + 'strpos' => function($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings) |
|
| 146 | 146 | { |
| 147 | 147 | $haystack_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : ''), $ent_check($haystack), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 148 | 148 | |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | }, |
| 170 | - 'substr' => function ($string, $start, $length = null) use ($utf8, $ent_check, $modSettings) |
|
| 170 | + 'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $modSettings) |
|
| 171 | 171 | { |
| 172 | 172 | $ent_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 173 | 173 | return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length)); |
| 174 | 174 | }, |
| 175 | - 'strtolower' => $utf8 ? function ($string) use ($sourcedir) |
|
| 175 | + 'strtolower' => $utf8 ? function($string) use ($sourcedir) |
|
| 176 | 176 | { |
| 177 | 177 | if (!function_exists('mb_strtolower')) |
| 178 | 178 | { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | return mb_strtolower($string, 'UTF-8'); |
| 184 | 184 | } : 'strtolower', |
| 185 | - 'strtoupper' => $utf8 ? function ($string) |
|
| 185 | + 'strtoupper' => $utf8 ? function($string) |
|
| 186 | 186 | { |
| 187 | 187 | global $sourcedir; |
| 188 | 188 | |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | 'truncate' => function($string, $length) use ($utf8, $ent_check, $ent_list, &$smcFunc) |
| 198 | 198 | { |
| 199 | 199 | $string = $ent_check($string); |
| 200 | - preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~'. ($utf8 ? 'u' : ''), $string, $matches); |
|
| 200 | + preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~' . ($utf8 ? 'u' : ''), $string, $matches); |
|
| 201 | 201 | $string = $matches[0]; |
| 202 | 202 | while (strlen($string) > $length) |
| 203 | - $string = preg_replace('~(?:' . $ent_list . '|.)$~'. ($utf8 ? 'u' : ''), '', $string); |
|
| 203 | + $string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string); |
|
| 204 | 204 | return $string; |
| 205 | 205 | }, |
| 206 | - 'ucfirst' => $utf8 ? function ($string) use (&$smcFunc) |
|
| 206 | + 'ucfirst' => $utf8 ? function($string) use (&$smcFunc) |
|
| 207 | 207 | { |
| 208 | 208 | return $smcFunc['strtoupper']($smcFunc['substr']($string, 0, 1)) . $smcFunc['substr']($string, 1); |
| 209 | 209 | } : 'ucfirst', |
| 210 | - 'ucwords' => $utf8 ? function ($string) use (&$smcFunc) |
|
| 210 | + 'ucwords' => $utf8 ? function($string) use (&$smcFunc) |
|
| 211 | 211 | { |
| 212 | 212 | $words = preg_split('~([\s\r\n\t]+)~', $string, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 213 | 213 | for ($i = 0, $n = count($words); $i < $n; $i += 2) |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | else |
| 607 | 607 | { |
| 608 | 608 | // !!! Compatibility. |
| 609 | - $user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 :$user_settings['time_offset']; |
|
| 609 | + $user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 : $user_settings['time_offset']; |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | // If the user is a guest, initialize all the critical user settings. |
@@ -1261,9 +1261,9 @@ discard block |
||
| 1261 | 1261 | if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false) |
| 1262 | 1262 | $row['avatar'] = $boardurl . '/proxy.php?request=' . urlencode($row['avatar']) . '&hash=' . md5($row['avatar'] . $image_proxy_secret); |
| 1263 | 1263 | |
| 1264 | - if ( isset($row['member_ip']) ) |
|
| 1264 | + if (isset($row['member_ip'])) |
|
| 1265 | 1265 | $row['member_ip'] = inet_dtop($row['member_ip']); |
| 1266 | - if ( isset($row['member_ip2']) ) |
|
| 1266 | + if (isset($row['member_ip2'])) |
|
| 1267 | 1267 | $row['member_ip2'] = inet_dtop($row['member_ip2']); |
| 1268 | 1268 | $new_loaded_ids[] = $row['id_member']; |
| 1269 | 1269 | $loaded_ids[] = $row['id_member']; |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | 'name' => $profile['real_name'], |
| 1412 | 1412 | 'id' => $profile['id_member'], |
| 1413 | 1413 | 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], |
| 1414 | - 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" '. (!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '').'>' . $profile['real_name'] . '</a>', |
|
| 1414 | + 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '') . '>' . $profile['real_name'] . '</a>', |
|
| 1415 | 1415 | 'email' => $profile['email_address'], |
| 1416 | 1416 | 'show_email' => !$user_info['is_guest'] && ($user_info['id'] == $profile['id_member'] || allowedTo('moderate_forum')), |
| 1417 | 1417 | 'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']), |
@@ -1426,9 +1426,9 @@ discard block |
||
| 1426 | 1426 | $loadedLanguages = getLanguages(); |
| 1427 | 1427 | |
| 1428 | 1428 | $memberContext[$user] += array( |
| 1429 | - 'username_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['member_name'] .'</span>', |
|
| 1430 | - 'name_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['real_name'] .'</span>', |
|
| 1431 | - 'link_color' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>' . $profile['real_name'] . '</a>', |
|
| 1429 | + 'username_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['member_name'] . '</span>', |
|
| 1430 | + 'name_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</span>', |
|
| 1431 | + 'link_color' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</a>', |
|
| 1432 | 1432 | 'is_buddy' => $profile['buddy'], |
| 1433 | 1433 | 'is_reverse_buddy' => in_array($user_info['id'], $buddy_list), |
| 1434 | 1434 | 'buddies' => $buddy_list, |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | if (!empty($image)) |
| 1499 | 1499 | $memberContext[$user]['avatar'] = array( |
| 1500 | 1500 | 'name' => $profile['avatar'], |
| 1501 | - 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_'. $profile['member_name'].'">', |
|
| 1501 | + 'image' => '<img class="avatar" src="' . $image . '" alt="avatar_' . $profile['member_name'] . '">', |
|
| 1502 | 1502 | 'href' => $image, |
| 1503 | 1503 | 'url' => $image, |
| 1504 | 1504 | ); |
@@ -2813,7 +2813,7 @@ discard block |
||
| 2813 | 2813 | $langName = $smcFunc['ucwords'](strtr($matches[1], array('_' => ' '))); |
| 2814 | 2814 | |
| 2815 | 2815 | // Get the line we need. |
| 2816 | - $fp = @fopen($language_dir .'/'. $entry); |
|
| 2816 | + $fp = @fopen($language_dir . '/' . $entry); |
|
| 2817 | 2817 | |
| 2818 | 2818 | // Yay! |
| 2819 | 2819 | if ($fp) |
@@ -3463,7 +3463,7 @@ discard block |
||
| 3463 | 3463 | $port = 0; |
| 3464 | 3464 | |
| 3465 | 3465 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
| 3466 | - if(strpos($server,'/') !== false) |
|
| 3466 | + if (strpos($server, '/') !== false) |
|
| 3467 | 3467 | $host = $server; |
| 3468 | 3468 | else |
| 3469 | 3469 | { |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if ($connection) { |
| 72 | 72 | if (!empty($db_options['port'])) |
| 73 | - $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', $db_options['port'] , null ,$flags); |
|
| 73 | + $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', $db_options['port'], null, $flags); |
|
| 74 | 74 | else |
| 75 | - $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd,'', 0, null, $flags); |
|
| 75 | + $success = mysqli_real_connect($connection, $db_server, $db_user, $db_passwd, '', 0, null, $flags); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Something's wrong, show an error if its fatal (which we assume it is) |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $replacement[$key] = 'null'; |
| 283 | 283 | if (!isValidIP($value)) |
| 284 | 284 | smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
| 285 | - $replacement[$key] = sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($value))); |
|
| 285 | + $replacement[$key] = sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($value))); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | return implode(', ', $replacement); |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards. |
| 870 | 870 | * @return string The escaped string |
| 871 | 871 | */ |
| 872 | -function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false) |
|
| 872 | +function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false) |
|
| 873 | 873 | { |
| 874 | 874 | $replacements = array( |
| 875 | 875 | '%' => '\%', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | require_once($sourcedir . '/Subs-Auth.php'); |
| 53 | 53 | |
| 54 | 54 | // Posting the password... check it. |
| 55 | - if (isset($_POST[$type. '_pass'])) |
|
| 55 | + if (isset($_POST[$type . '_pass'])) |
|
| 56 | 56 | { |
| 57 | 57 | // Check to ensure we're forcing SSL for authentication |
| 58 | 58 | if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | if ($ip_number == 'ip2' && $user_info['ip2'] == $user_info['ip']) |
| 181 | 181 | continue; |
| 182 | - $ban_query[] = ' {inet:'.$ip_number.'} BETWEEN bi.ip_low and bi.ip_high'; |
|
| 182 | + $ban_query[] = ' {inet:' . $ip_number . '} BETWEEN bi.ip_low and bi.ip_high'; |
|
| 183 | 183 | $ban_query_vars[$ip_number] = $user_info[$ip_number]; |
| 184 | 184 | // IP was valid, maybe there's also a hostname... |
| 185 | 185 | if (empty($modSettings['disableHostnameLookup']) && $user_info[$ip_number] != 'unknown') |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | $hostname = host_from_ip($user_info[$ip_number]); |
| 188 | 188 | if (strlen($hostname) > 0) |
| 189 | 189 | { |
| 190 | - $ban_query[] = '({string:hostname'.$ip_number.'} LIKE bi.hostname)'; |
|
| 191 | - $ban_query_vars['hostname'.$ip_number] = $hostname; |
|
| 190 | + $ban_query[] = '({string:hostname' . $ip_number . '} LIKE bi.hostname)'; |
|
| 191 | + $ban_query_vars['hostname' . $ip_number] = $hostname; |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | return true; |
| 913 | 913 | |
| 914 | 914 | // Let's ensure this is an array. |
| 915 | - $permission = (array)$permission; |
|
| 915 | + $permission = (array) $permission; |
|
| 916 | 916 | |
| 917 | 917 | // Are we checking the _current_ board, or some other boards? |
| 918 | 918 | if ($boards === null) |