@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | /** |
21 | 21 | * Constants for reply types. |
22 | - */ |
|
22 | + */ |
|
23 | 23 | const NOTIFY_TYPE_REPLY_AND_MODIFY = 1; |
24 | 24 | const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2; |
25 | 25 | const NOTIFY_TYPE_ONLY_REPLIES = 3; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Constants for frequencies. |
30 | - */ |
|
30 | + */ |
|
31 | 31 | const FREQUENCY_NOTHING = 0; |
32 | 32 | const FREQUENCY_EVERYTHING = 1; |
33 | 33 | const FREQUENCY_FIRST_UNREAD_MSG = 2; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | const FREQUENCY_WEEKLY_DIGEST = 4; |
36 | 36 | |
37 | 37 | /** |
38 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
38 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
39 | 39 | * @return bool Always returns true |
40 | 40 | */ |
41 | 41 | public function execute() |
@@ -103,7 +103,7 @@ |
||
103 | 103 | if ($type == 'edit') |
104 | 104 | { |
105 | 105 | // Filter out members who have already been notified about this post's topic |
106 | - $unnotified = array_filter($watched, function ($member) |
|
106 | + $unnotified = array_filter($watched, function($member) |
|
107 | 107 | { |
108 | 108 | return empty($member['sent']); |
109 | 109 | }); |
@@ -281,7 +281,7 @@ |
||
281 | 281 | { |
282 | 282 | /** |
283 | 283 | * Constants for notfication types. |
284 | - */ |
|
284 | + */ |
|
285 | 285 | const RECEIVE_NOTIFY_EMAIL = 0x02; |
286 | 286 | const RECEIVE_NOTIFY_ALERT = 0x01; |
287 | 287 |
@@ -419,7 +419,7 @@ |
||
419 | 419 | $board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']); |
420 | 420 | } |
421 | 421 | } |
422 | - else |
|
422 | + else |
|
423 | 423 | foreach ($this_category as &$board) |
424 | 424 | { |
425 | 425 | if (!empty($moderators[$board['id']])) |
@@ -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. |
@@ -280,7 +280,7 @@ |
||
280 | 280 | $ret .= |
281 | 281 | chr(($this->m_arColors[$i] & 0x000000FF)) . // R |
282 | 282 | chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G |
283 | - chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
283 | + chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $ret; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | if ($c === $n) { |
147 | 147 | $q = $delta; |
148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
148 | + for ($k = static::BASE; ; $k += static::BASE) { |
|
149 | 149 | $t = $this->calculateThreshold($k, $bias); |
150 | 150 | if ($q < $t) { |
151 | 151 | break; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $oldi = $i; |
228 | 228 | $w = 1; |
229 | 229 | |
230 | - for ($k = static::BASE;; $k += static::BASE) |
|
230 | + for ($k = static::BASE; ; $k += static::BASE) |
|
231 | 231 | { |
232 | 232 | $digit = static::$decodeTable[$input[$pos++]]; |
233 | 233 | $i = $i + ($digit * $w); |
@@ -94,7 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | $input = mb_strtolower($input, $this->encoding); |
96 | 96 | $parts = explode('.', $input); |
97 | - foreach ($parts as &$part) { |
|
97 | + foreach ($parts as &$part) |
|
98 | + { |
|
98 | 99 | $part = $this->encodePart($part); |
99 | 100 | } |
100 | 101 | $output = implode('.', $parts); |
@@ -119,13 +120,16 @@ discard block |
||
119 | 120 | $h = $b = count($codePoints['basic']); |
120 | 121 | |
121 | 122 | $output = ''; |
122 | - foreach ($codePoints['basic'] as $code) { |
|
123 | + foreach ($codePoints['basic'] as $code) |
|
124 | + { |
|
123 | 125 | $output .= $this->codePointToChar($code); |
124 | 126 | } |
125 | - if ($input === $output) { |
|
127 | + if ($input === $output) |
|
128 | + { |
|
126 | 129 | return $output; |
127 | 130 | } |
128 | - if ($b > 0) { |
|
131 | + if ($b > 0) |
|
132 | + { |
|
129 | 133 | $output .= static::DELIMITER; |
130 | 134 | } |
131 | 135 | |
@@ -134,20 +138,26 @@ discard block |
||
134 | 138 | |
135 | 139 | $i = 0; |
136 | 140 | $length = mb_strlen($input, $this->encoding); |
137 | - while ($h < $length) { |
|
141 | + while ($h < $length) |
|
142 | + { |
|
138 | 143 | $m = $codePoints['nonBasic'][$i++]; |
139 | 144 | $delta = $delta + ($m - $n) * ($h + 1); |
140 | 145 | $n = $m; |
141 | 146 | |
142 | - foreach ($codePoints['all'] as $c) { |
|
143 | - if ($c < $n || $c < static::INITIAL_N) { |
|
147 | + foreach ($codePoints['all'] as $c) |
|
148 | + { |
|
149 | + if ($c < $n || $c < static::INITIAL_N) |
|
150 | + { |
|
144 | 151 | $delta++; |
145 | 152 | } |
146 | - if ($c === $n) { |
|
153 | + if ($c === $n) |
|
154 | + { |
|
147 | 155 | $q = $delta; |
148 | - for ($k = static::BASE;; $k += static::BASE) { |
|
156 | + for ($k = static::BASE;; $k += static::BASE) |
|
157 | + { |
|
149 | 158 | $t = $this->calculateThreshold($k, $bias); |
150 | - if ($q < $t) { |
|
159 | + if ($q < $t) |
|
160 | + { |
|
151 | 161 | break; |
152 | 162 | } |
153 | 163 |
@@ -107,7 +107,7 @@ |
||
107 | 107 | </div>'; |
108 | 108 | |
109 | 109 | // Show the last post if there is one. |
110 | - if(!empty($board['last_post']['id'])) |
|
110 | + if (!empty($board['last_post']['id'])) |
|
111 | 111 | echo' |
112 | 112 | <div class="lastpost lpr_border"> |
113 | 113 | ', function_exists('template_bi_' . $board['type'] . '_lastpost') ? call_user_func('template_bi_' . $board['type'] . '_lastpost', $board) : template_bi_board_lastpost($board), ' |
@@ -50,7 +50,7 @@ |
||
50 | 50 | </div>'; |
51 | 51 | |
52 | 52 | // Show the last post if there is one. |
53 | - if(!empty($board['last_post']['id'])) |
|
53 | + if (!empty($board['last_post']['id'])) |
|
54 | 54 | echo ' |
55 | 55 | <div class="lastpost lpr_border"> |
56 | 56 | ', function_exists('template_bi_' . $board['type'] . '_lastpost') ? call_user_func('template_bi_' . $board['type'] . '_lastpost', $board) : template_bi_board_lastpost($board), ' |
@@ -27,53 +27,53 @@ |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | if (!is_callable('random_bytes')) { |
30 | - /** |
|
31 | - * Powered by ext/mcrypt (and thankfully NOT libmcrypt) |
|
32 | - * |
|
33 | - * @ref https://bugs.php.net/bug.php?id=55169 |
|
34 | - * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 |
|
35 | - * |
|
36 | - * @param int $bytes |
|
37 | - * |
|
38 | - * @throws Exception |
|
39 | - * |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - function random_bytes($bytes) |
|
43 | - { |
|
44 | - try { |
|
45 | - /** @var int $bytes */ |
|
46 | - $bytes = RandomCompat_intval($bytes); |
|
47 | - } catch (TypeError $ex) { |
|
48 | - throw new TypeError( |
|
49 | - 'random_bytes(): $bytes must be an integer' |
|
50 | - ); |
|
51 | - } |
|
30 | + /** |
|
31 | + * Powered by ext/mcrypt (and thankfully NOT libmcrypt) |
|
32 | + * |
|
33 | + * @ref https://bugs.php.net/bug.php?id=55169 |
|
34 | + * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 |
|
35 | + * |
|
36 | + * @param int $bytes |
|
37 | + * |
|
38 | + * @throws Exception |
|
39 | + * |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + function random_bytes($bytes) |
|
43 | + { |
|
44 | + try { |
|
45 | + /** @var int $bytes */ |
|
46 | + $bytes = RandomCompat_intval($bytes); |
|
47 | + } catch (TypeError $ex) { |
|
48 | + throw new TypeError( |
|
49 | + 'random_bytes(): $bytes must be an integer' |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | - if ($bytes < 1) { |
|
54 | - throw new Error( |
|
55 | - 'Length must be greater than 0' |
|
56 | - ); |
|
57 | - } |
|
53 | + if ($bytes < 1) { |
|
54 | + throw new Error( |
|
55 | + 'Length must be greater than 0' |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** @var string|bool $buf */ |
|
60 | - $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); |
|
61 | - if ( |
|
62 | - is_string($buf) |
|
63 | - && |
|
64 | - RandomCompat_strlen($buf) === $bytes |
|
65 | - ) { |
|
66 | - /** |
|
67 | - * Return our random entropy buffer here: |
|
68 | - */ |
|
69 | - return $buf; |
|
70 | - } |
|
59 | + /** @var string|bool $buf */ |
|
60 | + $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); |
|
61 | + if ( |
|
62 | + is_string($buf) |
|
63 | + && |
|
64 | + RandomCompat_strlen($buf) === $bytes |
|
65 | + ) { |
|
66 | + /** |
|
67 | + * Return our random entropy buffer here: |
|
68 | + */ |
|
69 | + return $buf; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * If we reach here, PHP has failed us. |
|
74 | - */ |
|
75 | - throw new Exception( |
|
76 | - 'Could not gather sufficient random data' |
|
77 | - ); |
|
78 | - } |
|
72 | + /** |
|
73 | + * If we reach here, PHP has failed us. |
|
74 | + */ |
|
75 | + throw new Exception( |
|
76 | + 'Could not gather sufficient random data' |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | } |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | * SOFTWARE. |
27 | 27 | */ |
28 | 28 | |
29 | -if (!is_callable('random_bytes')) { |
|
29 | +if (!is_callable('random_bytes')) |
|
30 | +{ |
|
30 | 31 | /** |
31 | 32 | * Powered by ext/mcrypt (and thankfully NOT libmcrypt) |
32 | 33 | * |
@@ -41,16 +42,20 @@ discard block |
||
41 | 42 | */ |
42 | 43 | function random_bytes($bytes) |
43 | 44 | { |
44 | - try { |
|
45 | + try |
|
46 | + { |
|
45 | 47 | /** @var int $bytes */ |
46 | 48 | $bytes = RandomCompat_intval($bytes); |
47 | - } catch (TypeError $ex) { |
|
49 | + } |
|
50 | + catch (TypeError $ex) |
|
51 | + { |
|
48 | 52 | throw new TypeError( |
49 | 53 | 'random_bytes(): $bytes must be an integer' |
50 | 54 | ); |
51 | 55 | } |
52 | 56 | |
53 | - if ($bytes < 1) { |
|
57 | + if ($bytes < 1) |
|
58 | + { |
|
54 | 59 | throw new Error( |
55 | 60 | 'Length must be greater than 0' |
56 | 61 | ); |