@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | if (!empty($boardUpdateParameters['deny_groups'])) |
661 | 661 | { |
662 | 662 | $insert = array(); |
663 | - foreach($boardOptions['deny_groups'] as $value) |
|
663 | + foreach ($boardOptions['deny_groups'] as $value) |
|
664 | 664 | $insert[] = array($value, $board_id, 1); |
665 | 665 | |
666 | 666 | $smcFunc['db_query']('', ' |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | '{db_prefix}board_permissions_view', |
675 | 675 | array('id_group' => 'int', 'id_board' => 'int', 'deny' => 'int'), |
676 | 676 | $insert, |
677 | - array('id_group','id_board','deny') |
|
677 | + array('id_group', 'id_board', 'deny') |
|
678 | 678 | ); |
679 | 679 | } |
680 | 680 | |
681 | 681 | if (!empty($boardUpdateParameters['member_groups'])) |
682 | 682 | { |
683 | 683 | $insert = array(); |
684 | - foreach($boardOptions['access_groups'] as $value) |
|
684 | + foreach ($boardOptions['access_groups'] as $value) |
|
685 | 685 | $insert[] = array($value, $board_id, 0); |
686 | 686 | $smcFunc['db_query']('', ' |
687 | 687 | DELETE FROM {db_prefix}board_permissions_view |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | '{db_prefix}board_permissions_view', |
695 | 695 | array('id_group' => 'int', 'id_board' => 'int', 'deny' => 'int'), |
696 | 696 | $insert, |
697 | - array('id_group','id_board','deny') |
|
697 | + array('id_group', 'id_board', 'deny') |
|
698 | 698 | ); |
699 | 699 | } |
700 | 700 | |
@@ -901,14 +901,14 @@ discard block |
||
901 | 901 | |
902 | 902 | $insert = array(); |
903 | 903 | |
904 | - foreach(explode(',', $default_memgrps) as $value) |
|
904 | + foreach (explode(',', $default_memgrps) as $value) |
|
905 | 905 | $insert[] = array($value, $board_id, 0); |
906 | 906 | |
907 | 907 | $smcFunc['db_insert']('', |
908 | 908 | '{db_prefix}board_permissions_view', |
909 | 909 | array('id_group' => 'int', 'id_board' => 'int', 'deny' => 'int'), |
910 | 910 | $insert, |
911 | - array('id_group','id_board','deny'), |
|
911 | + array('id_group', 'id_board', 'deny'), |
|
912 | 912 | 1 |
913 | 913 | ); |
914 | 914 |
@@ -1129,7 +1129,7 @@ |
||
1129 | 1129 | '{db_prefix}log_subscribed', |
1130 | 1130 | array( |
1131 | 1131 | 'id_subscribe' => 'int', 'id_member' => 'int', 'old_id_group' => 'int', 'start_time' => 'int', |
1132 | - 'end_time' => 'int', 'status' => 'int','pending_details' => 'string-65534' |
|
1132 | + 'end_time' => 'int', 'status' => 'int', 'pending_details' => 'string-65534' |
|
1133 | 1133 | ), |
1134 | 1134 | array( |
1135 | 1135 | $context['sub_id'], $id_member, $id_group, $starttime, |
@@ -756,7 +756,6 @@ |
||
756 | 756 | $groups[$row['id_group']]['num_members'] += $row['num_members']; |
757 | 757 | $smcFunc['db_free_result']($query); |
758 | 758 | } |
759 | - |
|
760 | 759 | else |
761 | 760 | { |
762 | 761 | $query = $smcFunc['db_query']('', ' |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | global $smcFunc; |
225 | 225 | |
226 | - $result = $smcFunc['db_query']('',' |
|
226 | + $result = $smcFunc['db_query']('', ' |
|
227 | 227 | SELECT DISTINCT id_search |
228 | 228 | FROM {db_prefix}log_search_results |
229 | 229 | WHERE id_msg = {int:id_msg}', |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if (count($id_searchs) < 1) |
240 | 240 | return; |
241 | 241 | |
242 | - $smcFunc['db_query']('',' |
|
242 | + $smcFunc['db_query']('', ' |
|
243 | 243 | DELETE FROM {db_prefix}log_search_results |
244 | 244 | WHERE id_search in ({array_int:id_searchs})', |
245 | 245 | array( |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | |
250 | - $smcFunc['db_query']('',' |
|
250 | + $smcFunc['db_query']('', ' |
|
251 | 251 | DELETE FROM {db_prefix}log_search_topics |
252 | 252 | WHERE id_search in ({array_int:id_searchs})', |
253 | 253 | array( |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | |
258 | - $smcFunc['db_query']('',' |
|
258 | + $smcFunc['db_query']('', ' |
|
259 | 259 | DELETE FROM {db_prefix}log_search_messages |
260 | 260 | WHERE id_search in ({array_int:id_searchs})', |
261 | 261 | array( |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $backtrace = debug_backtrace(); |
46 | 46 | |
47 | 47 | // are we in a loop? |
48 | - if($error_call > 2) |
|
48 | + if ($error_call > 2) |
|
49 | 49 | { |
50 | 50 | var_dump($backtrace); |
51 | 51 | die('Error loop.'); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $url['error'] = $error; |
550 | 550 | // Url field got a max length of 1024 in db |
551 | 551 | if (strlen($url['error']) > 500) |
552 | - $url['error'] = substr($url['error'],0,500); |
|
552 | + $url['error'] = substr($url['error'], 0, 500); |
|
553 | 553 | |
554 | 554 | if (!empty($sprintf)) |
555 | 555 | $url['error_params'] = $sprintf; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var array Which databases support this method? |
35 | 35 | */ |
36 | - protected $supported_databases = array('mysql','postgresql'); |
|
36 | + protected $supported_databases = array('mysql', 'postgresql'); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * The constructor function |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $query_where = array(); |
177 | 177 | $query_params = $search_data['params']; |
178 | 178 | |
179 | - if( $smcFunc['db_title'] == "PostgreSQL") |
|
179 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
180 | 180 | $modSettings['search_simple_fulltext'] = true; |
181 | 181 | |
182 | 182 | if ($query_params['id_search']) |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // if we have bool terms to search, add them in |
257 | 257 | if ($query_params['boolean_match']) |
258 | 258 | { |
259 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
259 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
260 | 260 | { |
261 | 261 | $language_ftx = $smcFunc['db_search_language'](); |
262 | 262 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
271 | - $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( ' |
|
271 | + $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? (' |
|
272 | 272 | INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . ' |
273 | 273 | (' . implode(', ', array_keys($query_select)) . ')') : '') . ' |
274 | 274 | SELECT ' . implode(', ', $query_select) . ' |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | /** |
21 | 21 | * Constants for receiving email notfications. |
22 | - */ |
|
22 | + */ |
|
23 | 23 | const RECEIVE_NOTIFY_EMAIL = 0x02; |
24 | 24 | const RECEIVE_NOTIFY_ALERT = 0x01; |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Constants for reply types. |
28 | - */ |
|
28 | + */ |
|
29 | 29 | const NOTIFY_TYPE_REPLY_AND_MODIFY = 1; |
30 | 30 | const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2; |
31 | 31 | const NOTIFY_TYPE_ONLY_REPLIES = 3; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Constants for frequencies. |
36 | - */ |
|
36 | + */ |
|
37 | 37 | const FREQUENCY_NOTHING = 0; |
38 | 38 | const FREQUENCY_EVERYTHING = 1; |
39 | 39 | const FREQUENCY_FIRST_UNREAD_MSG = 2; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | const FREQUENCY_WEEKLY_DIGEST = 4; |
42 | 42 | |
43 | 43 | /** |
44 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
44 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
45 | 45 | * @return bool Always returns true |
46 | 46 | */ |
47 | 47 | public function execute() |
@@ -64,7 +64,8 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->buildLookup(); |
66 | 66 | |
67 | - if ($initKey !== null) { |
|
67 | + if ($initKey !== null) |
|
68 | + { |
|
68 | 69 | $this->setInitKey($initKey); |
69 | 70 | } |
70 | 71 | } |
@@ -98,7 +99,8 @@ discard block |
||
98 | 99 | */ |
99 | 100 | public function setRange($range) |
100 | 101 | { |
101 | - if (!is_numeric($range)) { |
|
102 | + if (!is_numeric($range)) |
|
103 | + { |
|
102 | 104 | throw new \InvalidArgumentException('Invalid window range'); |
103 | 105 | } |
104 | 106 | $this->range = $range; |
@@ -114,7 +116,8 @@ discard block |
||
114 | 116 | */ |
115 | 117 | public function setInitKey($key) |
116 | 118 | { |
117 | - if (preg_match('/^[' . implode('', array_keys($this->getLookup())) . ']+$/', $key) == false) { |
|
119 | + if (preg_match('/^[' . implode('', array_keys($this->getLookup())) . ']+$/', $key) == false) |
|
120 | + { |
|
118 | 121 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
119 | 122 | } |
120 | 123 | $this->initKey = $key; |
@@ -140,7 +143,8 @@ discard block |
||
140 | 143 | */ |
141 | 144 | public function setLookup($lookup) |
142 | 145 | { |
143 | - if (!is_array($lookup)) { |
|
146 | + if (!is_array($lookup)) |
|
147 | + { |
|
144 | 148 | throw new \InvalidArgumentException('Lookup value must be an array'); |
145 | 149 | } |
146 | 150 | $this->lookup = $lookup; |
@@ -176,7 +180,8 @@ discard block |
||
176 | 180 | */ |
177 | 181 | public function setRefresh($seconds) |
178 | 182 | { |
179 | - if (!is_numeric($seconds)) { |
|
183 | + if (!is_numeric($seconds)) |
|
184 | + { |
|
180 | 185 | throw new \InvalidArgumentException('Seconds must be numeric'); |
181 | 186 | } |
182 | 187 | $this->refreshSeconds = $seconds; |
@@ -217,7 +222,8 @@ discard block |
||
217 | 222 | */ |
218 | 223 | public function validateCode($code, $initKey = null, $timestamp = null, $range = null) |
219 | 224 | { |
220 | - if (strlen($code) !== $this->getCodeLength()) { |
|
225 | + if (strlen($code) !== $this->getCodeLength()) |
|
226 | + { |
|
221 | 227 | throw new \InvalidArgumentException('Incorrect code length'); |
222 | 228 | } |
223 | 229 | |
@@ -227,8 +233,10 @@ discard block |
||
227 | 233 | |
228 | 234 | $binary = $this->base32_decode($initKey); |
229 | 235 | |
230 | - for ($time = ($timestamp - $range); $time <= ($timestamp + $range); $time++) { |
|
231 | - if ($this->generateOneTime($binary, $time) == $code) { |
|
236 | + for ($time = ($timestamp - $range); $time <= ($timestamp + $range); $time++) |
|
237 | + { |
|
238 | + if ($this->generateOneTime($binary, $time) == $code) |
|
239 | + { |
|
232 | 240 | return true; |
233 | 241 | } |
234 | 242 | } |
@@ -271,7 +279,8 @@ discard block |
||
271 | 279 | $lookup = implode('', array_keys($this->getLookup())); |
272 | 280 | $code = ''; |
273 | 281 | |
274 | - for ($i = 0; $i < $length; $i++) { |
|
282 | + for ($i = 0; $i < $length; $i++) |
|
283 | + { |
|
275 | 284 | $code .= $lookup[$smcFunc['random_int'](0, strlen($lookup) - 1)]; |
276 | 285 | } |
277 | 286 | |
@@ -317,7 +326,8 @@ discard block |
||
317 | 326 | { |
318 | 327 | $lookup = $this->getLookup(); |
319 | 328 | |
320 | - if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) { |
|
329 | + if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) |
|
330 | + { |
|
321 | 331 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
322 | 332 | } |
323 | 333 | |
@@ -326,12 +336,14 @@ discard block |
||
326 | 336 | $length = 0; |
327 | 337 | $binary = ''; |
328 | 338 | |
329 | - for ($i = 0; $i < strlen($hash); $i++) { |
|
339 | + for ($i = 0; $i < strlen($hash); $i++) |
|
340 | + { |
|
330 | 341 | $buffer = $buffer << 5; |
331 | 342 | $buffer += $lookup[$hash[$i]]; |
332 | 343 | $length += 5; |
333 | 344 | |
334 | - if ($length >= 8) { |
|
345 | + if ($length >= 8) |
|
346 | + { |
|
335 | 347 | $length -= 8; |
336 | 348 | $binary .= chr(($buffer & (0xFF << $length)) >> $length); |
337 | 349 | } |
@@ -1076,7 +1076,8 @@ |
||
1076 | 1076 | { |
1077 | 1077 | unset($topics[$row['id_topic']]); // If we can't see it, we should not merge it and not adjust counts! Instead skip it. |
1078 | 1078 | continue; |
1079 | - }elseif (!$row['approved']) |
|
1079 | + } |
|
1080 | + elseif (!$row['approved']) |
|
1080 | 1081 | $boardTotals[$row['id_board']]['unapproved_topics']++; |
1081 | 1082 | else |
1082 | 1083 | $boardTotals[$row['id_board']]['topics']++; |
@@ -1339,7 +1339,7 @@ |
||
1339 | 1339 | list ($member_started) = $smcFunc['db_fetch_row']($request); |
1340 | 1340 | list ($member_updated) = $smcFunc['db_fetch_row']($request); |
1341 | 1341 | // First and last message are the same, so only row was returned. |
1342 | - if ($member_updated === NULL) |
|
1342 | + if ($member_updated === null) |
|
1343 | 1343 | $member_updated = $member_started; |
1344 | 1344 | |
1345 | 1345 | $smcFunc['db_free_result']($request); |