@@ -223,7 +223,8 @@ discard block |
||
223 | 223 | checkSession('get'); |
224 | 224 | validateToken('admin-msm', 'get'); |
225 | 225 | |
226 | - if ($db_type == 'postgresql') { |
|
226 | + if ($db_type == 'postgresql') |
|
227 | + { |
|
227 | 228 | $smcFunc['db_query']('', ' |
228 | 229 | DROP INDEX IF EXISTS {db_prefix}messages_ftx', |
229 | 230 | array( |
@@ -787,7 +788,8 @@ discard block |
||
787 | 788 | // We need this for db_get_version |
788 | 789 | db_extend(); |
789 | 790 | |
790 | - if ($smcFunc['db_title'] == 'PostgreSQL') { |
|
791 | + if ($smcFunc['db_title'] == 'PostgreSQL') |
|
792 | + { |
|
791 | 793 | $request = $smcFunc['db_query']('', ' |
792 | 794 | SELECT |
793 | 795 | indexname |
@@ -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 | } |
@@ -269,7 +277,8 @@ discard block |
||
269 | 277 | $lookup = implode('', array_keys($this->getLookup())); |
270 | 278 | $code = ''; |
271 | 279 | |
272 | - for ($i = 0; $i < $length; $i++) { |
|
280 | + for ($i = 0; $i < $length; $i++) |
|
281 | + { |
|
273 | 282 | $code .= $lookup[mt_rand(0, strlen($lookup) - 1)]; |
274 | 283 | } |
275 | 284 | |
@@ -315,7 +324,8 @@ discard block |
||
315 | 324 | { |
316 | 325 | $lookup = $this->getLookup(); |
317 | 326 | |
318 | - if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) { |
|
327 | + if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) |
|
328 | + { |
|
319 | 329 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
320 | 330 | } |
321 | 331 | |
@@ -324,12 +334,14 @@ discard block |
||
324 | 334 | $length = 0; |
325 | 335 | $binary = ''; |
326 | 336 | |
327 | - for ($i = 0; $i < strlen($hash); $i++) { |
|
337 | + for ($i = 0; $i < strlen($hash); $i++) |
|
338 | + { |
|
328 | 339 | $buffer = $buffer << 5; |
329 | 340 | $buffer += $lookup[$hash[$i]]; |
330 | 341 | $length += 5; |
331 | 342 | |
332 | - if ($length >= 8) { |
|
343 | + if ($length >= 8) |
|
344 | + { |
|
333 | 345 | $length -= 8; |
334 | 346 | $binary .= chr(($buffer & (0xFF << $length)) >> $length); |
335 | 347 | } |
@@ -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 |
@@ -93,7 +93,6 @@ |
||
93 | 93 | |
94 | 94 | continue; |
95 | 95 | } |
96 | - |
|
97 | 96 | elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
98 | 97 | { |
99 | 98 | // Just increase the stats and don't add this hidden user to any list. |
@@ -3219,7 +3219,7 @@ discard block |
||
3219 | 3219 | // Deleting an existing label? |
3220 | 3220 | elseif (isset($_POST['delete'], $_POST['delete_label'])) |
3221 | 3221 | { |
3222 | - foreach ($_POST['delete_label'] AS $label => $dummy) |
|
3222 | + foreach ($_POST['delete_label'] as $label => $dummy) |
|
3223 | 3223 | { |
3224 | 3224 | unset($the_labels[$label]); |
3225 | 3225 | $labels_to_remove[] = $label; |
@@ -3260,7 +3260,7 @@ discard block |
||
3260 | 3260 | if (!empty($labels_to_add)) |
3261 | 3261 | { |
3262 | 3262 | $inserts = array(); |
3263 | - foreach ($labels_to_add AS $label) |
|
3263 | + foreach ($labels_to_add as $label) |
|
3264 | 3264 | $inserts[] = array($user_info['id'], $label); |
3265 | 3265 | |
3266 | 3266 | $smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array()); |
@@ -3269,7 +3269,7 @@ discard block |
||
3269 | 3269 | // Update existing labels as needed |
3270 | 3270 | if (!empty($label_upates)) |
3271 | 3271 | { |
3272 | - foreach ($label_updates AS $id => $name) |
|
3272 | + foreach ($label_updates as $id => $name) |
|
3273 | 3273 | { |
3274 | 3274 | $smcFunc['db_query']('', ' |
3275 | 3275 | UPDATE {db_prefix}labels |
@@ -849,7 +849,6 @@ |
||
849 | 849 | die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B"); |
850 | 850 | } |
851 | 851 | } |
852 | - |
|
853 | 852 | elseif ($_REQUEST['format'] === '.wav') |
854 | 853 | { |
855 | 854 | require_once($sourcedir . '/Subs-Sound.php'); |
@@ -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']('', ' |
@@ -253,9 +253,10 @@ discard block |
||
253 | 253 | |
254 | 254 | // Phar doesn't handle open_basedir restrictions very well and throws a PHP Warning. Ignore that. |
255 | 255 | set_error_handler(function($errno, $errstr, $errfile, $errline) |
256 | - { |
|
256 | + { |
|
257 | 257 | // error was suppressed with the @-operator |
258 | - if (0 === error_reporting()) { |
|
258 | + if (0 === error_reporting()) |
|
259 | + { |
|
259 | 260 | return false; |
260 | 261 | } |
261 | 262 | if (strpos($errstr, 'PharData::__construct(): open_basedir') === false) |
@@ -269,7 +270,7 @@ discard block |
||
269 | 270 | |
270 | 271 | // go though each file in the archive |
271 | 272 | foreach ($iterator as $file_info) |
272 | - { |
|
273 | + { |
|
273 | 274 | $i = $iterator->getSubPathname(); |
274 | 275 | // If this is a file, and it doesn't exist.... happy days! |
275 | 276 | if (substr($i, -1) != '/' && !file_exists($destination . '/' . $i)) |
@@ -425,7 +425,8 @@ discard block |
||
425 | 425 | if (!empty($day['events'])) |
426 | 426 | { |
427 | 427 | // Sort events by start time (all day events will be listed first) |
428 | - uasort($day['events'], function($a, $b) { |
|
428 | + uasort($day['events'], function($a, $b) |
|
429 | + { |
|
429 | 430 | if ($a['start_timestamp'] == $b['start_timestamp']) |
430 | 431 | return 0; |
431 | 432 | |
@@ -619,7 +620,8 @@ discard block |
||
619 | 620 | if (!empty($day['events'])) |
620 | 621 | { |
621 | 622 | // Sort events by start time (all day events will be listed first) |
622 | - uasort($day['events'], function($a, $b) { |
|
623 | + uasort($day['events'], function($a, $b) |
|
624 | + { |
|
623 | 625 | if ($a['start_timestamp'] == $b['start_timestamp']) |
624 | 626 | return 0; |
625 | 627 | return ($a['start_timestamp'] < $b['start_timestamp']) ? -1 : 1; |