@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | $smcFunc['db_free_result']($request); |
272 | 272 | |
273 | - if($withSender) |
|
273 | + if ($withSender) |
|
274 | 274 | { |
275 | 275 | $senders = loadMemberData($senders); |
276 | 276 | foreach ($senders as $member) |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | if (count($context['ip']) !== 2) |
1953 | 1953 | fatal_lang_error('invalid_tracking_ip', false); |
1954 | 1954 | |
1955 | - $ip_string = array('{inet:ip_address_low}','{inet:ip_address_high}'); |
|
1955 | + $ip_string = array('{inet:ip_address_low}', '{inet:ip_address_high}'); |
|
1956 | 1956 | $fields = array( |
1957 | 1957 | 'ip_address_low' => $context['ip']['low'], |
1958 | 1958 | 'ip_address_high' => $context['ip']['high'], |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | |
1961 | 1961 | $ip_var = $context['ip']; |
1962 | 1962 | |
1963 | - if ($context['ip']['low'] !== $context['ip']['high']) |
|
1963 | + if ($context['ip']['low'] !== $context['ip']['high']) |
|
1964 | 1964 | $context['ip'] = $context['ip']['low'] . ' - ' . $context['ip']['high']; |
1965 | 1965 | else |
1966 | 1966 | $context['ip'] = $context['ip']['low']; |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | namespace { |
20 | 20 | |
21 | - if (!defined('PASSWORD_DEFAULT')) { |
|
21 | + if (!defined('PASSWORD_DEFAULT')) |
|
22 | + { |
|
22 | 23 | |
23 | 24 | define('PASSWORD_BCRYPT', 1); |
24 | 25 | define('PASSWORD_DEFAULT', PASSWORD_BCRYPT); |
@@ -34,31 +35,39 @@ discard block |
||
34 | 35 | * |
35 | 36 | * @return string|false The hashed password, or false on error. |
36 | 37 | */ |
37 | - function password_hash($password, $algo, array $options = array()) { |
|
38 | + function password_hash($password, $algo, array $options = array()) |
|
39 | + { |
|
38 | 40 | global $smcFunc; |
39 | 41 | |
40 | - if (!function_exists('crypt')) { |
|
42 | + if (!function_exists('crypt')) |
|
43 | + { |
|
41 | 44 | trigger_error("Crypt must be loaded for password_hash to function", E_USER_WARNING); |
42 | 45 | return null; |
43 | 46 | } |
44 | - if (!is_string($password)) { |
|
47 | + if (!is_string($password)) |
|
48 | + { |
|
45 | 49 | trigger_error("password_hash(): Password must be a string", E_USER_WARNING); |
46 | 50 | return null; |
47 | 51 | } |
48 | - if (!is_int($algo)) { |
|
52 | + if (!is_int($algo)) |
|
53 | + { |
|
49 | 54 | trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING); |
50 | 55 | return null; |
51 | 56 | } |
52 | - if (PasswordCompat\binary\_strlen($password) > 72) { |
|
57 | + if (PasswordCompat\binary\_strlen($password) > 72) |
|
58 | + { |
|
53 | 59 | $password = PasswordCompat\binary\_substr($password, 0, 72); |
54 | 60 | } |
55 | - switch ($algo) { |
|
61 | + switch ($algo) |
|
62 | + { |
|
56 | 63 | case PASSWORD_BCRYPT: |
57 | 64 | // Note that this is a C constant, but not exposed to PHP, so we don't define it here. |
58 | 65 | $cost = 10; |
59 | - if (isset($options['cost'])) { |
|
66 | + if (isset($options['cost'])) |
|
67 | + { |
|
60 | 68 | $cost = $options['cost']; |
61 | - if ($cost < 4 || $cost > 31) { |
|
69 | + if ($cost < 4 || $cost > 31) |
|
70 | + { |
|
62 | 71 | trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
63 | 72 | return null; |
64 | 73 | } |
@@ -76,8 +85,10 @@ discard block |
||
76 | 85 | return null; |
77 | 86 | } |
78 | 87 | $salt_requires_encoding = false; |
79 | - if (isset($options['salt'])) { |
|
80 | - switch (gettype($options['salt'])) { |
|
88 | + if (isset($options['salt'])) |
|
89 | + { |
|
90 | + switch (gettype($options['salt'])) |
|
91 | + { |
|
81 | 92 | case 'NULL': |
82 | 93 | case 'boolean': |
83 | 94 | case 'integer': |
@@ -86,7 +97,8 @@ discard block |
||
86 | 97 | $salt = (string) $options['salt']; |
87 | 98 | break; |
88 | 99 | case 'object': |
89 | - if (method_exists($options['salt'], '__tostring')) { |
|
100 | + if (method_exists($options['salt'], '__tostring')) |
|
101 | + { |
|
90 | 102 | $salt = (string) $options['salt']; |
91 | 103 | break; |
92 | 104 | } |
@@ -96,51 +108,70 @@ discard block |
||
96 | 108 | trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); |
97 | 109 | return null; |
98 | 110 | } |
99 | - if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) { |
|
111 | + if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) |
|
112 | + { |
|
100 | 113 | trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING); |
101 | 114 | return null; |
102 | - } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) { |
|
115 | + } |
|
116 | + elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) |
|
117 | + { |
|
103 | 118 | $salt_requires_encoding = true; |
104 | 119 | } |
105 | - } else { |
|
120 | + } |
|
121 | + else |
|
122 | + { |
|
106 | 123 | $buffer = ''; |
107 | 124 | $buffer_valid = false; |
108 | - if (function_exists('random_bytes')) { |
|
125 | + if (function_exists('random_bytes')) |
|
126 | + { |
|
109 | 127 | $buffer = random_bytes($raw_salt_len); |
110 | - if ($buffer) { |
|
128 | + if ($buffer) |
|
129 | + { |
|
111 | 130 | $buffer_valid = true; |
112 | 131 | } |
113 | 132 | } |
114 | - if (!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) { |
|
133 | + if (!$buffer_valid && function_exists('mcrypt_create_iv') && !defined('PHALANGER')) |
|
134 | + { |
|
115 | 135 | $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM); |
116 | - if ($buffer) { |
|
136 | + if ($buffer) |
|
137 | + { |
|
117 | 138 | $buffer_valid = true; |
118 | 139 | } |
119 | 140 | } |
120 | - if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) { |
|
141 | + if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) |
|
142 | + { |
|
121 | 143 | $buffer = openssl_random_pseudo_bytes($raw_salt_len); |
122 | - if ($buffer) { |
|
144 | + if ($buffer) |
|
145 | + { |
|
123 | 146 | $buffer_valid = true; |
124 | 147 | } |
125 | 148 | } |
126 | - if (!$buffer_valid && @is_readable('/dev/urandom')) { |
|
149 | + if (!$buffer_valid && @is_readable('/dev/urandom')) |
|
150 | + { |
|
127 | 151 | $f = fopen('/dev/urandom', 'r'); |
128 | 152 | $read = PasswordCompat\binary\_strlen($buffer); |
129 | - while ($read < $raw_salt_len) { |
|
153 | + while ($read < $raw_salt_len) |
|
154 | + { |
|
130 | 155 | $buffer .= fread($f, $raw_salt_len - $read); |
131 | 156 | $read = PasswordCompat\binary\_strlen($buffer); |
132 | 157 | } |
133 | 158 | fclose($f); |
134 | - if ($read >= $raw_salt_len) { |
|
159 | + if ($read >= $raw_salt_len) |
|
160 | + { |
|
135 | 161 | $buffer_valid = true; |
136 | 162 | } |
137 | 163 | } |
138 | - if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) { |
|
164 | + if (!$buffer_valid || PasswordCompat\binary\_strlen($buffer) < $raw_salt_len) |
|
165 | + { |
|
139 | 166 | $bl = PasswordCompat\binary\_strlen($buffer); |
140 | - for ($i = 0; $i < $raw_salt_len; $i++) { |
|
141 | - if ($i < $bl) { |
|
167 | + for ($i = 0; $i < $raw_salt_len; $i++) |
|
168 | + { |
|
169 | + if ($i < $bl) |
|
170 | + { |
|
142 | 171 | $buffer[$i] = $buffer[$i] ^ chr($smcFunc['random_int'](0, 255)); |
143 | - } else { |
|
172 | + } |
|
173 | + else |
|
174 | + { |
|
144 | 175 | $buffer .= chr($smcFunc['random_int'](0, 255)); |
145 | 176 | } |
146 | 177 | } |
@@ -148,7 +179,8 @@ discard block |
||
148 | 179 | $salt = $buffer; |
149 | 180 | $salt_requires_encoding = true; |
150 | 181 | } |
151 | - if ($salt_requires_encoding) { |
|
182 | + if ($salt_requires_encoding) |
|
183 | + { |
|
152 | 184 | // encode string with the Base64 variant used by crypt |
153 | 185 | $base64_digits = |
154 | 186 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
@@ -164,7 +196,8 @@ discard block |
||
164 | 196 | |
165 | 197 | $ret = crypt($password, $hash); |
166 | 198 | |
167 | - if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != $resultLength) { |
|
199 | + if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != $resultLength) |
|
200 | + { |
|
168 | 201 | return false; |
169 | 202 | } |
170 | 203 | |
@@ -187,13 +220,15 @@ discard block |
||
187 | 220 | * |
188 | 221 | * @return array The array of information about the hash. |
189 | 222 | */ |
190 | - function password_get_info($hash) { |
|
223 | + function password_get_info($hash) |
|
224 | + { |
|
191 | 225 | $return = array( |
192 | 226 | 'algo' => 0, |
193 | 227 | 'algoName' => 'unknown', |
194 | 228 | 'options' => array(), |
195 | 229 | ); |
196 | - if (PasswordCompat\binary\_substr($hash, 0, 4) == '$2y$' && PasswordCompat\binary\_strlen($hash) == 60) { |
|
230 | + if (PasswordCompat\binary\_substr($hash, 0, 4) == '$2y$' && PasswordCompat\binary\_strlen($hash) == 60) |
|
231 | + { |
|
197 | 232 | $return['algo'] = PASSWORD_BCRYPT; |
198 | 233 | $return['algoName'] = 'bcrypt'; |
199 | 234 | list($cost) = sscanf($hash, "$2y$%d$"); |
@@ -213,15 +248,19 @@ discard block |
||
213 | 248 | * |
214 | 249 | * @return boolean True if the password needs to be rehashed. |
215 | 250 | */ |
216 | - function password_needs_rehash($hash, $algo, array $options = array()) { |
|
251 | + function password_needs_rehash($hash, $algo, array $options = array()) |
|
252 | + { |
|
217 | 253 | $info = password_get_info($hash); |
218 | - if ($info['algo'] != $algo) { |
|
254 | + if ($info['algo'] != $algo) |
|
255 | + { |
|
219 | 256 | return true; |
220 | 257 | } |
221 | - switch ($algo) { |
|
258 | + switch ($algo) |
|
259 | + { |
|
222 | 260 | case PASSWORD_BCRYPT: |
223 | 261 | $cost = isset($options['cost']) ? $options['cost'] : 10; |
224 | - if ($cost != $info['options']['cost']) { |
|
262 | + if ($cost != $info['options']['cost']) |
|
263 | + { |
|
225 | 264 | return true; |
226 | 265 | } |
227 | 266 | break; |
@@ -237,21 +276,26 @@ discard block |
||
237 | 276 | * |
238 | 277 | * @return boolean If the password matches the hash |
239 | 278 | */ |
240 | - function password_verify($password, $hash) { |
|
241 | - if (!function_exists('crypt')) { |
|
279 | + function password_verify($password, $hash) |
|
280 | + { |
|
281 | + if (!function_exists('crypt')) |
|
282 | + { |
|
242 | 283 | trigger_error("Crypt must be loaded for password_verify to function", E_USER_WARNING); |
243 | 284 | return false; |
244 | 285 | } |
245 | - if (PasswordCompat\binary\_strlen($password) > 72) { |
|
286 | + if (PasswordCompat\binary\_strlen($password) > 72) |
|
287 | + { |
|
246 | 288 | $password = PasswordCompat\binary\_substr($password, 0, 72); |
247 | 289 | } |
248 | 290 | $ret = crypt($password, $hash); |
249 | - if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) { |
|
291 | + if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) |
|
292 | + { |
|
250 | 293 | return false; |
251 | 294 | } |
252 | 295 | |
253 | 296 | $status = 0; |
254 | - for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) { |
|
297 | + for ($i = 0; $i < PasswordCompat\binary\_strlen($ret); $i++) |
|
298 | + { |
|
255 | 299 | $status |= (ord($ret[$i]) ^ ord($hash[$i])); |
256 | 300 | } |
257 | 301 | |
@@ -273,8 +317,10 @@ discard block |
||
273 | 317 | * @internal |
274 | 318 | * @return int The number of bytes |
275 | 319 | */ |
276 | - function _strlen($binary_string) { |
|
277 | - if (function_exists('mb_strlen')) { |
|
320 | + function _strlen($binary_string) |
|
321 | + { |
|
322 | + if (function_exists('mb_strlen')) |
|
323 | + { |
|
278 | 324 | return mb_strlen($binary_string, '8bit'); |
279 | 325 | } |
280 | 326 | return strlen($binary_string); |
@@ -292,8 +338,10 @@ discard block |
||
292 | 338 | * @internal |
293 | 339 | * @return string The substring |
294 | 340 | */ |
295 | - function _substr($binary_string, $start, $length) { |
|
296 | - if (function_exists('mb_substr')) { |
|
341 | + function _substr($binary_string, $start, $length) |
|
342 | + { |
|
343 | + if (function_exists('mb_substr')) |
|
344 | + { |
|
297 | 345 | return mb_substr($binary_string, $start, $length, '8bit'); |
298 | 346 | } |
299 | 347 | return substr($binary_string, $start, $length); |
@@ -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(); |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | // Are the result fresh? |
998 | 998 | if (!$update_cache && !empty($_SESSION['search_cache']['id_search'])) |
999 | 999 | { |
1000 | - $request = $smcFunc['db_query']('',' |
|
1000 | + $request = $smcFunc['db_query']('', ' |
|
1001 | 1001 | SELECT id_search |
1002 | 1002 | FROM {db_prefix}log_search_results |
1003 | 1003 | WHERE id_search = {int:search_id} |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | SELECT |
1120 | 1120 | {int:id_search}, |
1121 | 1121 | t.id_topic, |
1122 | - ' . $relevance. ', |
|
1122 | + ' . $relevance . ', |
|
1123 | 1123 | ' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ', |
1124 | 1124 | 1 |
1125 | 1125 | FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : ' |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | if (empty($subject_query['where'])) |
1353 | 1353 | continue; |
1354 | 1354 | |
1355 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( ' |
|
1355 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? (' |
|
1356 | 1356 | INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics |
1357 | 1357 | (' . ($createTemporary ? '' : 'id_search, ') . 'id_topic)') : '') . ' |
1358 | 1358 | SELECT ' . ($createTemporary ? '' : $_SESSION['search_cache']['id_search'] . ', ') . 't.id_topic |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | } |
1580 | 1580 | $main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance'; |
1581 | 1581 | |
1582 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ( ' |
|
1582 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? (' |
|
1583 | 1583 | INSERT IGNORE INTO ' . '{db_prefix}log_search_results |
1584 | 1584 | (' . implode(', ', array_keys($main_query['select'])) . ')') : '') . ' |
1585 | 1585 | SELECT |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | $relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance'; |
1648 | 1648 | |
1649 | 1649 | $usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts)); |
1650 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( ' |
|
1650 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? (' |
|
1651 | 1651 | INSERT IGNORE INTO {db_prefix}log_search_results |
1652 | 1652 | (id_search, id_topic, relevance, id_msg, num_matches)') : '') . ' |
1653 | 1653 | SELECT |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | if (strlen($query) == 0) |
2117 | 2117 | continue; |
2118 | 2118 | |
2119 | - $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function ($m) |
|
2119 | + $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function($m) |
|
2120 | 2120 | { |
2121 | 2121 | return isset($m[2]) && "$m[2]" == "$m[1]" ? stripslashes("$m[1]") : "<strong class=\"highlight\">$m[1]</strong>"; |
2122 | 2122 | }, $body_highlighted); |
@@ -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 | )); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | // Gotta urlencode the filename. |
411 | 411 | if ($this->_attachResults) |
412 | 412 | foreach ($this->_attachResults as $k => $v) |
413 | - $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
413 | + $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
414 | 414 | |
415 | 415 | $this->_response = array( |
416 | 416 | 'files' => $this->_attachResults ? $this->_attachResults : false, |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | ob_start(); |
438 | 438 | |
439 | 439 | // Set the header. |
440 | - header('content-type: application/json; charset='. $context['character_set'] .''); |
|
440 | + header('content-type: application/json; charset=' . $context['character_set'] . ''); |
|
441 | 441 | |
442 | 442 | echo $smcFunc['json_encode']($this->_response ? $this->_response : array()); |
443 | 443 |
@@ -199,7 +199,6 @@ |
||
199 | 199 | list ($context['attachments']['quantity'], $context['attachments']['total_size']) = $smcFunc['db_fetch_row']($request); |
200 | 200 | $smcFunc['db_free_result']($request); |
201 | 201 | } |
202 | - |
|
203 | 202 | else |
204 | 203 | $context['attachments'] = array( |
205 | 204 | 'quantity' => 0, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic) |
247 | 247 | WHERE t.id_topic IS NULL |
248 | 248 | GROUP BY m.id_topic, m.id_board', |
249 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
249 | + 'fix_processing' => function($row) use ($smcFunc) |
|
250 | 250 | { |
251 | 251 | global $salvageBoardID; |
252 | 252 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | // Remove all topics that have zero messages in the messages table. |
333 | 333 | 'fix_collect' => array( |
334 | 334 | 'index' => 'id_topic', |
335 | - 'process' => function ($topics) use ($smcFunc) |
|
335 | + 'process' => function($topics) use ($smcFunc) |
|
336 | 336 | { |
337 | 337 | $smcFunc['db_query']('', ' |
338 | 338 | DELETE FROM {db_prefix}topics |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | AND p.id_poll IS NULL |
370 | 370 | GROUP BY o.id_poll, t.id_topic, t.id_board, t.id_member_started, m.member_name |
371 | 371 | ', |
372 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
372 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
373 | 373 | { |
374 | 374 | global $salvageBoardID; |
375 | 375 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | LEFT JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll) |
507 | 507 | WHERE p.id_poll BETWEEN {STEP_LOW} AND {STEP_HIGH} |
508 | 508 | AND t.id_poll IS NULL', |
509 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
509 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
510 | 510 | { |
511 | 511 | global $salvageBoardID; |
512 | 512 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
618 | 618 | GROUP BY t.id_topic, t.id_first_msg, t.id_last_msg, t.approved, mf.approved |
619 | 619 | ORDER BY t.id_topic', |
620 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
620 | + 'fix_processing' => function($row) use ($smcFunc) |
|
621 | 621 | { |
622 | 622 | $row['firstmsg_approved'] = (int) $row['firstmsg_approved']; |
623 | 623 | $row['myid_first_msg'] = (int) $row['myid_first_msg']; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | ) |
647 | 647 | ); |
648 | 648 | }, |
649 | - 'message_function' => function ($row) use ($txt, &$context) |
|
649 | + 'message_function' => function($row) use ($txt, &$context) |
|
650 | 650 | { |
651 | 651 | // A pretend error? |
652 | 652 | if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
681 | 681 | GROUP BY t.id_topic, t.num_replies, mf.approved |
682 | 682 | ORDER BY t.id_topic', |
683 | - 'fix_processing' => function ($row) |
|
683 | + 'fix_processing' => function($row) |
|
684 | 684 | { |
685 | 685 | global $smcFunc; |
686 | 686 | $row['my_num_replies'] = (int) $row['my_num_replies']; |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | ) |
700 | 700 | ); |
701 | 701 | }, |
702 | - 'message_function' => function ($row) |
|
702 | + 'message_function' => function($row) |
|
703 | 703 | { |
704 | 704 | global $txt, $context; |
705 | 705 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | GROUP BY t.id_topic, t.unapproved_posts |
731 | 731 | HAVING unapproved_posts != COUNT(mu.id_msg) |
732 | 732 | ORDER BY t.id_topic', |
733 | - 'fix_processing' => function ($row) |
|
733 | + 'fix_processing' => function($row) |
|
734 | 734 | { |
735 | 735 | global $smcFunc; |
736 | 736 | $row['my_unapproved_posts'] = (int) $row['my_unapproved_posts']; |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | WHERE b.id_board IS NULL |
771 | 771 | AND t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
772 | 772 | GROUP BY t.id_board', |
773 | - 'fix_processing' => function ($row) |
|
773 | + 'fix_processing' => function($row) |
|
774 | 774 | { |
775 | 775 | global $smcFunc, $salvageCatID, $txt; |
776 | 776 | createSalvageArea(); |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | ORDER BY b.id_cat, b.id_board', |
818 | 818 | 'fix_collect' => array( |
819 | 819 | 'index' => 'id_cat', |
820 | - 'process' => function ($cats) |
|
820 | + 'process' => function($cats) |
|
821 | 821 | { |
822 | 822 | global $smcFunc, $salvageCatID; |
823 | 823 | createSalvageArea(); |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | // Last step-make sure all non-guest posters still exist. |
854 | 854 | 'fix_collect' => array( |
855 | 855 | 'index' => 'id_msg', |
856 | - 'process' => function ($msgs) |
|
856 | + 'process' => function($msgs) |
|
857 | 857 | { |
858 | 858 | global $smcFunc; |
859 | 859 | $smcFunc['db_query']('', ' |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | ORDER BY b.id_parent, b.id_board', |
881 | 881 | 'fix_collect' => array( |
882 | 882 | 'index' => 'id_parent', |
883 | - 'process' => function ($parents) |
|
883 | + 'process' => function($parents) |
|
884 | 884 | { |
885 | 885 | global $smcFunc, $salvageBoardID, $salvageCatID; |
886 | 886 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | AND p.id_poll IS NULL', |
918 | 918 | 'fix_collect' => array( |
919 | 919 | 'index' => 'id_poll', |
920 | - 'process' => function ($polls) |
|
920 | + 'process' => function($polls) |
|
921 | 921 | { |
922 | 922 | global $smcFunc; |
923 | 923 | $smcFunc['db_query']('', ' |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | ORDER BY cal.id_topic', |
950 | 950 | 'fix_collect' => array( |
951 | 951 | 'index' => 'id_topic', |
952 | - 'process' => function ($events) |
|
952 | + 'process' => function($events) |
|
953 | 953 | { |
954 | 954 | global $smcFunc; |
955 | 955 | $smcFunc['db_query']('', ' |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | AND lt.id_member BETWEEN {STEP_LOW} AND {STEP_HIGH}', |
980 | 980 | 'fix_collect' => array( |
981 | 981 | 'index' => 'id_topic', |
982 | - 'process' => function ($topics) |
|
982 | + 'process' => function($topics) |
|
983 | 983 | { |
984 | 984 | global $smcFunc; |
985 | 985 | $smcFunc['db_query']('', ' |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | GROUP BY lt.id_member', |
1010 | 1010 | 'fix_collect' => array( |
1011 | 1011 | 'index' => 'id_member', |
1012 | - 'process' => function ($members) |
|
1012 | + 'process' => function($members) |
|
1013 | 1013 | { |
1014 | 1014 | global $smcFunc; |
1015 | 1015 | $smcFunc['db_query']('', ' |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | GROUP BY lb.id_board', |
1040 | 1040 | 'fix_collect' => array( |
1041 | 1041 | 'index' => 'id_board', |
1042 | - 'process' => function ($boards) |
|
1042 | + 'process' => function($boards) |
|
1043 | 1043 | { |
1044 | 1044 | global $smcFunc; |
1045 | 1045 | $smcFunc['db_query']('', ' |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | GROUP BY lb.id_member', |
1070 | 1070 | 'fix_collect' => array( |
1071 | 1071 | 'index' => 'id_member', |
1072 | - 'process' => function ($members) use ($smcFunc) |
|
1072 | + 'process' => function($members) use ($smcFunc) |
|
1073 | 1073 | { |
1074 | 1074 | $smcFunc['db_query']('', ' |
1075 | 1075 | DELETE FROM {db_prefix}log_boards |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | GROUP BY lmr.id_board', |
1099 | 1099 | 'fix_collect' => array( |
1100 | 1100 | 'index' => 'id_board', |
1101 | - 'process' => function ($boards) use ($smcFunc) |
|
1101 | + 'process' => function($boards) use ($smcFunc) |
|
1102 | 1102 | { |
1103 | 1103 | $smcFunc['db_query']('', ' |
1104 | 1104 | DELETE FROM {db_prefix}log_mark_read |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | GROUP BY lmr.id_member', |
1128 | 1128 | 'fix_collect' => array( |
1129 | 1129 | 'index' => 'id_member', |
1130 | - 'process' => function ($members) use ($smcFunc) |
|
1130 | + 'process' => function($members) use ($smcFunc) |
|
1131 | 1131 | { |
1132 | 1132 | $smcFunc['db_query']('', ' |
1133 | 1133 | DELETE FROM {db_prefix}log_mark_read |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | GROUP BY pmr.id_pm', |
1157 | 1157 | 'fix_collect' => array( |
1158 | 1158 | 'index' => 'id_pm', |
1159 | - 'process' => function ($pms) use ($smcFunc) |
|
1159 | + 'process' => function($pms) use ($smcFunc) |
|
1160 | 1160 | { |
1161 | 1161 | $smcFunc['db_query']('', ' |
1162 | 1162 | DELETE FROM {db_prefix}pm_recipients |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | GROUP BY pmr.id_member', |
1187 | 1187 | 'fix_collect' => array( |
1188 | 1188 | 'index' => 'id_member', |
1189 | - 'process' => function ($members) |
|
1189 | + 'process' => function($members) |
|
1190 | 1190 | { |
1191 | 1191 | global $smcFunc; |
1192 | 1192 | $smcFunc['db_query']('', ' |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | AND mem.id_member IS NULL', |
1217 | 1217 | 'fix_collect' => array( |
1218 | 1218 | 'index' => 'id_pm', |
1219 | - 'process' => function ($guestMessages) |
|
1219 | + 'process' => function($guestMessages) |
|
1220 | 1220 | { |
1221 | 1221 | global $smcFunc; |
1222 | 1222 | $smcFunc['db_query']('', ' |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | GROUP BY ln.id_member', |
1247 | 1247 | 'fix_collect' => array( |
1248 | 1248 | 'index' => 'id_member', |
1249 | - 'process' => function ($members) use ($smcFunc) |
|
1249 | + 'process' => function($members) use ($smcFunc) |
|
1250 | 1250 | { |
1251 | 1251 | $smcFunc['db_query']('', ' |
1252 | 1252 | DELETE FROM {db_prefix}log_notify |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | LEFT JOIN {db_prefix}log_search_subjects AS lss ON (lss.id_topic = t.id_topic) |
1274 | 1274 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
1275 | 1275 | AND lss.id_topic IS NULL', |
1276 | - 'fix_full_processing' => function ($result) |
|
1276 | + 'fix_full_processing' => function($result) |
|
1277 | 1277 | { |
1278 | 1278 | global $smcFunc; |
1279 | 1279 | |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | array('word', 'id_topic') |
1303 | 1303 | ); |
1304 | 1304 | }, |
1305 | - 'message_function' => function ($row) |
|
1305 | + 'message_function' => function($row) |
|
1306 | 1306 | { |
1307 | 1307 | global $txt, $context; |
1308 | 1308 | |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | AND t.id_topic IS NULL', |
1331 | 1331 | 'fix_collect' => array( |
1332 | 1332 | 'index' => 'id_topic', |
1333 | - 'process' => function ($deleteTopics) |
|
1333 | + 'process' => function($deleteTopics) |
|
1334 | 1334 | { |
1335 | 1335 | global $smcFunc; |
1336 | 1336 | $smcFunc['db_query']('', ' |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | AND mem.id_member IS NULL', |
1361 | 1361 | 'fix_collect' => array( |
1362 | 1362 | 'index' => 'id_member', |
1363 | - 'process' => function ($members) |
|
1363 | + 'process' => function($members) |
|
1364 | 1364 | { |
1365 | 1365 | global $smcFunc; |
1366 | 1366 | $smcFunc['db_query']('', ' |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | AND p.id_poll IS NULL', |
1390 | 1390 | 'fix_collect' => array( |
1391 | 1391 | 'index' => 'id_poll', |
1392 | - 'process' => function ($polls) |
|
1392 | + 'process' => function($polls) |
|
1393 | 1393 | { |
1394 | 1394 | global $smcFunc; |
1395 | 1395 | $smcFunc['db_query']('', ' |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | AND lrc.id_report IS NULL', |
1419 | 1419 | 'fix_collect' => array( |
1420 | 1420 | 'index' => 'id_report', |
1421 | - 'process' => function ($reports) |
|
1421 | + 'process' => function($reports) |
|
1422 | 1422 | { |
1423 | 1423 | global $smcFunc; |
1424 | 1424 | $smcFunc['db_query']('', ' |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | AND lr.id_report IS NULL', |
1448 | 1448 | 'fix_collect' => array( |
1449 | 1449 | 'index' => 'id_report', |
1450 | - 'process' => function ($reports) |
|
1450 | + 'process' => function($reports) |
|
1451 | 1451 | { |
1452 | 1452 | global $smcFunc; |
1453 | 1453 | $smcFunc['db_query']('', ' |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | GROUP BY lgr.id_member', |
1478 | 1478 | 'fix_collect' => array( |
1479 | 1479 | 'index' => 'id_member', |
1480 | - 'process' => function ($members) |
|
1480 | + 'process' => function($members) |
|
1481 | 1481 | { |
1482 | 1482 | global $smcFunc; |
1483 | 1483 | $smcFunc['db_query']('', ' |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | GROUP BY lgr.id_group', |
1508 | 1508 | 'fix_collect' => array( |
1509 | 1509 | 'index' => 'id_group', |
1510 | - 'process' => function ($groups) |
|
1510 | + 'process' => function($groups) |
|
1511 | 1511 | { |
1512 | 1512 | global $smcFunc; |
1513 | 1513 | $smcFunc['db_query']('', ' |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
1113 | 1113 | |
1114 | 1114 | // Need to sort the tags by name length. |
1115 | - uksort($valid_tags, function ($a, $b) { |
|
1115 | + uksort($valid_tags, function($a, $b) { |
|
1116 | 1116 | return strlen($a) < strlen($b) ? 1 : -1; |
1117 | 1117 | }); |
1118 | 1118 | |
@@ -1979,7 +1979,7 @@ discard block |
||
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
1982 | - array_walk_recursive($context['smileys'], function (&$filename, $key) |
|
1982 | + array_walk_recursive($context['smileys'], function(&$filename, $key) |
|
1983 | 1983 | { |
1984 | 1984 | global $context, $user_info, $modSettings; |
1985 | 1985 | if ($key == 'filename') |
@@ -332,7 +332,6 @@ discard block |
||
332 | 332 | $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
333 | 333 | } |
334 | 334 | } |
335 | - |
|
336 | 335 | elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
337 | 336 | { |
338 | 337 | // Is this the element that we've been waiting for to be closed? |
@@ -592,7 +591,6 @@ discard block |
||
592 | 591 | $parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]'; |
593 | 592 | $parts[$i + 3] = ''; |
594 | 593 | } |
595 | - |
|
596 | 594 | else |
597 | 595 | { |
598 | 596 | // We're in a list item. |
@@ -631,7 +629,6 @@ discard block |
||
631 | 629 | $parts[$i + 2] = ''; |
632 | 630 | $parts[$i + 3] = ''; |
633 | 631 | } |
634 | - |
|
635 | 632 | else |
636 | 633 | { |
637 | 634 | // Remove the trailing breaks from the list item. |
@@ -1112,7 +1109,8 @@ discard block |
||
1112 | 1109 | $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
1113 | 1110 | |
1114 | 1111 | // Need to sort the tags by name length. |
1115 | - uksort($valid_tags, function ($a, $b) { |
|
1112 | + uksort($valid_tags, function ($a, $b) |
|
1113 | + { |
|
1116 | 1114 | return strlen($a) < strlen($b) ? 1 : -1; |
1117 | 1115 | }); |
1118 | 1116 | |
@@ -1980,7 +1978,7 @@ discard block |
||
1980 | 1978 | |
1981 | 1979 | // Set proper extensions; do this post caching so cache doesn't become extension-specific |
1982 | 1980 | array_walk_recursive($context['smileys'], function (&$filename, $key) |
1983 | - { |
|
1981 | + { |
|
1984 | 1982 | global $context, $user_info, $modSettings; |
1985 | 1983 | if ($key == 'filename') |
1986 | 1984 | // Need to use the default if user selection is disabled |
@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | if (class_exists('Imagick')) |
43 | 43 | { |
44 | - $temp = New Imagick; |
|
44 | + $temp = new Imagick; |
|
45 | 45 | $temp2 = $temp->getVersion(); |
46 | 46 | $im_version = $temp2['versionString']; |
47 | 47 | $extension_version = 'Imagick ' . phpversion('Imagick'); |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | call_integration_hook('integrate_pre_load_theme', array(&$id_theme)); |
1784 | 1784 | |
1785 | 1785 | // We already load the basic stuff? |
1786 | - if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme ) |
|
1786 | + if (empty($settings['theme_id']) || $settings['theme_id'] != $id_theme) |
|
1787 | 1787 | { |
1788 | 1788 | $member = empty($user_info['id']) ? -1 : $user_info['id']; |
1789 | 1789 | |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | SELECT variable, value, id_member, id_theme |
1809 | 1809 | FROM {db_prefix}themes |
1810 | 1810 | WHERE id_member' . (empty($themeData[0]) ? ' IN (-1, 0, {int:id_member})' : ' = {int:id_member}') . ' |
1811 | - AND id_theme' . ($id_theme == 1 ? ' = {int:id_theme}' : ' IN ({int:id_theme}, 1)') .' |
|
1811 | + AND id_theme' . ($id_theme == 1 ? ' = {int:id_theme}' : ' IN ({int:id_theme}, 1)') . ' |
|
1812 | 1812 | ORDER BY id_theme asc', |
1813 | 1813 | array( |
1814 | 1814 | 'id_theme' => $id_theme, |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | if (!isset($context['javascript_vars'])) |
2048 | 2048 | $context['javascript_vars'] = array(); |
2049 | 2049 | |
2050 | - $context['login_url'] = $scripturl . '?action=login2'; |
|
2050 | + $context['login_url'] = $scripturl . '?action=login2'; |
|
2051 | 2051 | $context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | '; |
2052 | 2052 | $context['session_var'] = $_SESSION['session_var']; |
2053 | 2053 | $context['session_id'] = $_SESSION['session_value']; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Set a list of common functions. |
79 | 79 | $ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);'; |
80 | 80 | $ent_check = empty($modSettings['disableEntityCheck']) ? function($string) |
81 | - { |
|
81 | + { |
|
82 | 82 | $string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string); |
83 | 83 | return $string; |
84 | 84 | } : function($string) |
@@ -2140,7 +2140,6 @@ discard block |
||
2140 | 2140 | loadLanguage('index+Modifications'); |
2141 | 2141 | $context['template_layers'] = array(); |
2142 | 2142 | } |
2143 | - |
|
2144 | 2143 | else |
2145 | 2144 | { |
2146 | 2145 | // Custom templates to load, or just default? |
@@ -2519,14 +2518,12 @@ discard block |
||
2519 | 2518 | $fileUrl = $settings['default_theme_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
2520 | 2519 | $filePath = $settings['default_theme_dir'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
2521 | 2520 | } |
2522 | - |
|
2523 | 2521 | else |
2524 | 2522 | { |
2525 | 2523 | $fileUrl = false; |
2526 | 2524 | $filePath = false; |
2527 | 2525 | } |
2528 | 2526 | } |
2529 | - |
|
2530 | 2527 | else |
2531 | 2528 | { |
2532 | 2529 | $fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -2627,14 +2624,12 @@ discard block |
||
2627 | 2624 | $fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
2628 | 2625 | $filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
2629 | 2626 | } |
2630 | - |
|
2631 | 2627 | else |
2632 | 2628 | { |
2633 | 2629 | $fileUrl = false; |
2634 | 2630 | $filePath = false; |
2635 | 2631 | } |
2636 | 2632 | } |
2637 | - |
|
2638 | 2633 | else |
2639 | 2634 | { |
2640 | 2635 | $fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName . ($has_seed ? '' : $params['seed']); |
@@ -222,7 +222,6 @@ |
||
222 | 222 | |
223 | 223 | $this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content')); |
224 | 224 | } |
225 | - |
|
226 | 225 | else |
227 | 226 | { |
228 | 227 | // Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1 |