@@ -157,12 +157,14 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $parts = explode('.', $preprocessed); |
| 160 | - foreach ($parts as $p => &$part) { |
|
| 160 | + foreach ($parts as $p => &$part) |
|
| 161 | + { |
|
| 161 | 162 | $part = $this->encodePart($part); |
| 162 | 163 | |
| 163 | 164 | $validation_status = $this->validateLabel($part, true); |
| 164 | 165 | |
| 165 | - switch ($validation_status) { |
|
| 166 | + switch ($validation_status) |
|
| 167 | + { |
|
| 166 | 168 | case self::IDNA_ERROR_LABEL_TOO_LONG: |
| 167 | 169 | case self::IDNA_ERROR_LEADING_HYPHEN: |
| 168 | 170 | case self::IDNA_ERROR_TRAILING_HYPHEN: |
@@ -215,13 +217,16 @@ discard block |
||
| 215 | 217 | $h = $b = count($codePoints['basic']); |
| 216 | 218 | |
| 217 | 219 | $output = ''; |
| 218 | - foreach ($codePoints['basic'] as $code) { |
|
| 220 | + foreach ($codePoints['basic'] as $code) |
|
| 221 | + { |
|
| 219 | 222 | $output .= $this->codePointToChar($code); |
| 220 | 223 | } |
| 221 | - if ($input === $output) { |
|
| 224 | + if ($input === $output) |
|
| 225 | + { |
|
| 222 | 226 | return $output; |
| 223 | 227 | } |
| 224 | - if ($b > 0) { |
|
| 228 | + if ($b > 0) |
|
| 229 | + { |
|
| 225 | 230 | $output .= static::DELIMITER; |
| 226 | 231 | } |
| 227 | 232 | |
@@ -230,20 +235,26 @@ discard block |
||
| 230 | 235 | |
| 231 | 236 | $i = 0; |
| 232 | 237 | $length = mb_strlen($input, $this->encoding); |
| 233 | - while ($h < $length) { |
|
| 238 | + while ($h < $length) |
|
| 239 | + { |
|
| 234 | 240 | $m = $codePoints['nonBasic'][$i++]; |
| 235 | 241 | $delta = $delta + ($m - $n) * ($h + 1); |
| 236 | 242 | $n = $m; |
| 237 | 243 | |
| 238 | - foreach ($codePoints['all'] as $c) { |
|
| 239 | - if ($c < $n || $c < static::INITIAL_N) { |
|
| 244 | + foreach ($codePoints['all'] as $c) |
|
| 245 | + { |
|
| 246 | + if ($c < $n || $c < static::INITIAL_N) |
|
| 247 | + { |
|
| 240 | 248 | $delta++; |
| 241 | 249 | } |
| 242 | - if ($c === $n) { |
|
| 250 | + if ($c === $n) |
|
| 251 | + { |
|
| 243 | 252 | $q = $delta; |
| 244 | - for ($k = static::BASE;; $k += static::BASE) { |
|
| 253 | + for ($k = static::BASE;; $k += static::BASE) |
|
| 254 | + { |
|
| 245 | 255 | $t = $this->calculateThreshold($k, $bias); |
| 246 | - if ($q < $t) { |
|
| 256 | + if ($q < $t) |
|
| 257 | + { |
|
| 247 | 258 | break; |
| 248 | 259 | } |
| 249 | 260 | |
@@ -530,7 +541,8 @@ discard block |
||
| 530 | 541 | |
| 531 | 542 | $labels = explode('.', $domain); |
| 532 | 543 | |
| 533 | - foreach ($labels as $l => $label) { |
|
| 544 | + foreach ($labels as $l => $label) |
|
| 545 | + { |
|
| 534 | 546 | $label = preg_replace('/[' . $regexes['ignored'] . ']/u', '', $label); |
| 535 | 547 | |
| 536 | 548 | $label = utf8_normalize_c(strtr($label, $maps)); |
@@ -1330,8 +1330,10 @@ |
||
| 1330 | 1330 | 'calendar_updated' => time(), |
| 1331 | 1331 | )); |
| 1332 | 1332 | |
| 1333 | - if (!empty($cache_enable) && $cache_enable >= 3) { |
|
| 1334 | - foreach ($affectedBoards as $b => $junk) { |
|
| 1333 | + if (!empty($cache_enable) && $cache_enable >= 3) |
|
| 1334 | + { |
|
| 1335 | + foreach ($affectedBoards as $b => $junk) |
|
| 1336 | + { |
|
| 1335 | 1337 | cache_put_data('board-' . $b, null); |
| 1336 | 1338 | } |
| 1337 | 1339 | } |
@@ -569,9 +569,11 @@ |
||
| 569 | 569 | updateSettings(array( |
| 570 | 570 | 'calendar_updated' => time(), |
| 571 | 571 | )); |
| 572 | - if (!empty($cache_enable) && $cache_enable >= 3) { |
|
| 572 | + if (!empty($cache_enable) && $cache_enable >= 3) |
|
| 573 | + { |
|
| 573 | 574 | cache_put_data('board-' . $recycle_board, null); |
| 574 | - foreach ($adjustBoards as $stats) { |
|
| 575 | + foreach ($adjustBoards as $stats) |
|
| 576 | + { |
|
| 575 | 577 | cache_put_data('board-' . $stats['id_board'], null); |
| 576 | 578 | } |
| 577 | 579 | } |
@@ -170,11 +170,14 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | // If this user subscribes both to the topic and the board there will be two records returned. |
| 172 | 172 | // Copy board/topic data to the new record or it will be lost. |
| 173 | - if (!empty($this->members['watching'][$row['id_member']])) { |
|
| 174 | - if ($this->members['watching'][$row['id_member']]['id_board'] > 0) { |
|
| 173 | + if (!empty($this->members['watching'][$row['id_member']])) |
|
| 174 | + { |
|
| 175 | + if ($this->members['watching'][$row['id_member']]['id_board'] > 0) |
|
| 176 | + { |
|
| 175 | 177 | $row['id_board'] = $this->members['watching'][$row['id_member']]['id_board']; |
| 176 | 178 | } |
| 177 | - if ($this->members['watching'][$row['id_member']]['id_topic'] > 0) { |
|
| 179 | + if ($this->members['watching'][$row['id_member']]['id_topic'] > 0) |
|
| 180 | + { |
|
| 178 | 181 | $row['id_topic'] = $this->members['watching'][$row['id_member']]['id_topic']; |
| 179 | 182 | } |
| 180 | 183 | } |
@@ -191,7 +194,8 @@ discard block |
||
| 191 | 194 | foreach ($this->members[$member_type] as $member_id => $member_data) |
| 192 | 195 | { |
| 193 | 196 | // The member receiving the alert has ignored the member mentioning them. |
| 194 | - if (!empty($member_data['mentioned_by']['ignored'])) { |
|
| 197 | + if (!empty($member_data['mentioned_by']['ignored'])) |
|
| 198 | + { |
|
| 195 | 199 | unset($this->members[$member_type][$member_id], $msgOptions[$member_type . '_members'][$member_id]); |
| 196 | 200 | } |
| 197 | 201 | |
@@ -202,7 +206,8 @@ discard block |
||
| 202 | 206 | } |
| 203 | 207 | } |
| 204 | 208 | |
| 205 | - $unnotified = array_filter($this->members['watching'], function ($member) { |
|
| 209 | + $unnotified = array_filter($this->members['watching'], function ($member) |
|
| 210 | + { |
|
| 206 | 211 | return empty($member['sent']); |
| 207 | 212 | }); |
| 208 | 213 | |
@@ -416,7 +416,8 @@ |
||
| 416 | 416 | if (!@touch($this->temp_dir . DIRECTORY_SEPARATOR . 'lock')) |
| 417 | 417 | return true; |
| 418 | 418 | |
| 419 | - register_shutdown_function(function () { |
|
| 419 | + register_shutdown_function(function () |
|
| 420 | + { |
|
| 420 | 421 | if (file_exists($this->temp_dir . DIRECTORY_SEPARATOR . 'lock')) |
| 421 | 422 | unlink($this->temp_dir . DIRECTORY_SEPARATOR . 'lock'); |
| 422 | 423 | }); |
@@ -348,7 +348,8 @@ |
||
| 348 | 348 | |
| 349 | 349 | $message = $txt[$e->getMessage()] ?? $e->getMessage(); |
| 350 | 350 | |
| 351 | - if (!empty($modSettings['enableErrorLogging'])) { |
|
| 351 | + if (!empty($modSettings['enableErrorLogging'])) |
|
| 352 | + { |
|
| 352 | 353 | log_error($message, 'general', $e->getFile(), $e->getLine()); |
| 353 | 354 | } |
| 354 | 355 | |
@@ -708,9 +708,11 @@ |
||
| 708 | 708 | updateSettings(array( |
| 709 | 709 | 'calendar_updated' => time(), |
| 710 | 710 | )); |
| 711 | - if (!empty($cache_enable) && $cache_enable >= 3) { |
|
| 711 | + if (!empty($cache_enable) && $cache_enable >= 3) |
|
| 712 | + { |
|
| 712 | 713 | cache_put_data('board-' . $toBoard, null); |
| 713 | - foreach ($fromBoards as $stats) { |
|
| 714 | + foreach ($fromBoards as $stats) |
|
| 715 | + { |
|
| 714 | 716 | cache_put_data('board-' . $stats['id_board'], null); |
| 715 | 717 | } |
| 716 | 718 | } |
@@ -740,7 +740,8 @@ discard block |
||
| 740 | 740 | $smcFunc['db_free_result']($request); |
| 741 | 741 | |
| 742 | 742 | // Random emails from the queue.. |
| 743 | - if (!empty($ids)) { |
|
| 743 | + if (!empty($ids)) |
|
| 744 | + { |
|
| 744 | 745 | $request = $smcFunc['db_query']('', ' |
| 745 | 746 | SELECT id_mail, recipient, body, subject, headers, send_html, time_sent, private, priority |
| 746 | 747 | FROM {db_prefix}mail_queue |
@@ -811,22 +812,27 @@ discard block |
||
| 811 | 812 | { |
| 812 | 813 | // First, figure out when the next send attempt should happen based on the current priority. |
| 813 | 814 | $next_send_time = $email['time_sent']; |
| 814 | - if ($email['priority'] >= $priority_offset) { |
|
| 815 | - for ($i = 0; $i < $email['priority']; $i++) { |
|
| 815 | + if ($email['priority'] >= $priority_offset) |
|
| 816 | + { |
|
| 817 | + for ($i = 0; $i < $email['priority']; $i++) |
|
| 818 | + { |
|
| 816 | 819 | $next_send_time += 20 * max(0, $email['priority'] - $priority_offset); |
| 817 | 820 | } |
| 818 | 821 | } |
| 819 | 822 | |
| 820 | 823 | // If the email is too old, discard it. |
| 821 | - if ($next_send_time > $email['time_sent'] + $smtp_expire) { |
|
| 824 | + if ($next_send_time > $email['time_sent'] + $smtp_expire) |
|
| 825 | + { |
|
| 822 | 826 | continue; |
| 823 | 827 | } |
| 824 | 828 | |
| 825 | 829 | ++$email['priority']; |
| 826 | 830 | |
| 827 | 831 | // Don't send if it's too soon. |
| 828 | - if (time() < $next_send_time) { |
|
| 829 | - if ($email['priority'] < $max_priority) { |
|
| 832 | + if (time() < $next_send_time) |
|
| 833 | + { |
|
| 834 | + if ($email['priority'] < $max_priority) |
|
| 835 | + { |
|
| 830 | 836 | $failed_emails[] = array($email['to'], $email['body'], $email['subject'], $email['headers'], $email['send_html'], $email['time_sent'], $email['private'], $email['priority']); |
| 831 | 837 | } |
| 832 | 838 | |
@@ -855,7 +861,8 @@ discard block |
||
| 855 | 861 | $result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['headers']); |
| 856 | 862 | |
| 857 | 863 | // If we failed, and we haven't already hit the limit, schedule this for another attempt. |
| 858 | - if (empty($result) && $email['priority'] < $max_priority) { |
|
| 864 | + if (empty($result) && $email['priority'] < $max_priority) |
|
| 865 | + { |
|
| 859 | 866 | $failed_emails[] = array($email['to'], $email['body'], $email['subject'], $email['headers'], $email['send_html'], $email['time_sent'], $email['private'], $email['priority']); |
| 860 | 867 | } |
| 861 | 868 | } |
@@ -97,7 +97,6 @@ discard block |
||
| 97 | 97 | if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) |
| 98 | 98 | obExit_cron(); |
| 99 | 99 | } |
| 100 | - |
|
| 101 | 100 | else |
| 102 | 101 | $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0'; |
| 103 | 102 | |
@@ -323,7 +322,8 @@ discard block |
||
| 323 | 322 | |
| 324 | 323 | $message = $txt[$e->getMessage()] ?? $e->getMessage(); |
| 325 | 324 | |
| 326 | - if (!empty($modSettings['enableErrorLogging'])) { |
|
| 325 | + if (!empty($modSettings['enableErrorLogging'])) |
|
| 326 | + { |
|
| 327 | 327 | log_error($message, 'cron', $e->getFile(), $e->getLine()); |
| 328 | 328 | } |
| 329 | 329 | } |