@@ -30,9 +30,12 @@ discard block |
||
30 | 30 | |
31 | 31 | // We don't allow control characters, characters out of range, byte markers, etc |
32 | 32 | if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E) |
33 | - return ''; |
|
34 | - else |
|
35 | - return '&#' . $num . ';'; |
|
33 | + { |
|
34 | + return ''; |
|
35 | + } |
|
36 | + else { |
|
37 | + return '&#' . $num . ';'; |
|
38 | + } |
|
36 | 39 | } |
37 | 40 | |
38 | 41 | /** |
@@ -49,12 +52,17 @@ discard block |
||
49 | 52 | global $modSettings; |
50 | 53 | |
51 | 54 | if (empty($string)) |
52 | - return $string; |
|
55 | + { |
|
56 | + return $string; |
|
57 | + } |
|
53 | 58 | |
54 | 59 | if (empty($modSettings['disableEntityCheck'])) |
55 | - $check = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', htmlspecialchars($string, $quote_style, $charset, $double)); |
|
56 | - else |
|
57 | - $check = htmlspecialchars($string, $quote_style, $charset, $double); |
|
60 | + { |
|
61 | + $check = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', htmlspecialchars($string, $quote_style, $charset, $double)); |
|
62 | + } |
|
63 | + else { |
|
64 | + $check = htmlspecialchars($string, $quote_style, $charset, $double); |
|
65 | + } |
|
58 | 66 | |
59 | 67 | return $check; |
60 | 68 | } |
@@ -130,7 +138,9 @@ discard block |
||
130 | 138 | { |
131 | 139 | $offset += $result; |
132 | 140 | if (array_slice($haystack_arr, $offset, $needle_size) === $needle_arr) |
133 | - return $right ? ($count - $offset - $needle_size + 1) : $offset; |
|
141 | + { |
|
142 | + return $right ? ($count - $offset - $needle_size + 1) : $offset; |
|
143 | + } |
|
134 | 144 | |
135 | 145 | $result = array_search($needle_arr[0], array_slice($haystack_arr, ++$offset)); |
136 | 146 | } |
@@ -153,9 +163,12 @@ discard block |
||
153 | 163 | global $modSettings; |
154 | 164 | |
155 | 165 | if (empty($modSettings['disableEntityCheck'])) |
156 | - $ent_arr = preg_split('~(&#\d{1,7};|"|&|<|>| |.)~u', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
157 | - else |
|
158 | - $ent_arr = preg_split('~(|"|&|<|>| |.)~u', $string, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
166 | + { |
|
167 | + $ent_arr = preg_split('~(&#\d{1,7};|"|&|<|>| |.)~u', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
168 | + } |
|
169 | + else { |
|
170 | + $ent_arr = preg_split('~(|"|&|<|>| |.)~u', $string, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
171 | + } |
|
159 | 172 | |
160 | 173 | return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length)); |
161 | 174 | } |
@@ -170,7 +183,9 @@ discard block |
||
170 | 183 | public static function strtolower($string) |
171 | 184 | { |
172 | 185 | if (function_exists('mb_strtolower')) |
173 | - return mb_strtolower($string, 'UTF-8'); |
|
186 | + { |
|
187 | + return mb_strtolower($string, 'UTF-8'); |
|
188 | + } |
|
174 | 189 | else |
175 | 190 | { |
176 | 191 | require_once(SUBSDIR . '/Charset.subs.php'); |
@@ -188,7 +203,9 @@ discard block |
||
188 | 203 | public static function strtoupper($string) |
189 | 204 | { |
190 | 205 | if (function_exists('mb_strtoupper')) |
191 | - return mb_strtoupper($string, 'UTF-8'); |
|
206 | + { |
|
207 | + return mb_strtoupper($string, 'UTF-8'); |
|
208 | + } |
|
192 | 209 | else |
193 | 210 | { |
194 | 211 | require_once(SUBSDIR . '/Charset.subs.php'); |
@@ -214,12 +231,16 @@ discard block |
||
214 | 231 | $ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);'; |
215 | 232 | |
216 | 233 | if (empty($modSettings['disableEntityCheck'])) |
217 | - $string = preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string); |
|
234 | + { |
|
235 | + $string = preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string); |
|
236 | + } |
|
218 | 237 | |
219 | 238 | preg_match('~^(' . $ent_list . '|.){' . self::strlen(substr($string, 0, $length)) . '}~u', $string, $matches); |
220 | 239 | $string = $matches[0]; |
221 | 240 | while (strlen($string) > $length) |
222 | - $string = preg_replace('~(?:' . $ent_list . '|.)$~u', '', $string); |
|
241 | + { |
|
242 | + $string = preg_replace('~(?:' . $ent_list . '|.)$~u', '', $string); |
|
243 | + } |
|
223 | 244 | |
224 | 245 | return $string; |
225 | 246 | } |
@@ -261,12 +282,15 @@ discard block |
||
261 | 282 | |
262 | 283 | // Always one clown in the audience who likes long words or not using the spacebar |
263 | 284 | if (!empty($space_pos) && ($length - $space_pos <= $buffer)) |
264 | - $string = self::substr($string, 0, $space_pos); |
|
285 | + { |
|
286 | + $string = self::substr($string, 0, $space_pos); |
|
287 | + } |
|
265 | 288 | |
266 | 289 | $string = rtrim($string) . ($ellipsis ? $ellipsis : ''); |
267 | 290 | } |
268 | - else |
|
269 | - $string = self::substr($string, 0, $length - $ending) . ($ellipsis ? $ellipsis : ''); |
|
291 | + else { |
|
292 | + $string = self::substr($string, 0, $length - $ending) . ($ellipsis ? $ellipsis : ''); |
|
293 | + } |
|
270 | 294 | } |
271 | 295 | |
272 | 296 | return $string; |
@@ -288,7 +312,9 @@ discard block |
||
288 | 312 | { |
289 | 313 | // If its shorter than the maximum length, while accounting for html tags, simply return |
290 | 314 | if (self::strlen(preg_replace('~<.*?>~', '', $string)) <= $length) |
291 | - return $string; |
|
315 | + { |
|
316 | + return $string; |
|
317 | + } |
|
292 | 318 | |
293 | 319 | // Start off empty |
294 | 320 | $total_length = $exact ? self::strlen($ellipsis) : 0; |
@@ -306,14 +332,18 @@ discard block |
||
306 | 332 | { |
307 | 333 | // Opening tag add the closing tag to the top of the stack |
308 | 334 | if (preg_match('~<[\w]+[^>]*>~s', $tag[0])) |
309 | - array_unshift($open_tags, $tag[2]); |
|
335 | + { |
|
336 | + array_unshift($open_tags, $tag[2]); |
|
337 | + } |
|
310 | 338 | // Closing tag |
311 | 339 | elseif (preg_match('~<\/([\w]+)[^>]*>~s', $tag[0], $close_tag)) |
312 | 340 | { |
313 | 341 | // Remove its starting tag |
314 | 342 | $pos = array_search($close_tag[1], $open_tags); |
315 | 343 | if ($pos !== false) |
316 | - array_splice($open_tags, $pos, 1); |
|
344 | + { |
|
345 | + array_splice($open_tags, $pos, 1); |
|
346 | + } |
|
317 | 347 | } |
318 | 348 | } |
319 | 349 | |
@@ -340,7 +370,9 @@ discard block |
||
340 | 370 | |
341 | 371 | // Are we there yet? |
342 | 372 | if ($total_length >= $length) |
343 | - break; |
|
373 | + { |
|
374 | + break; |
|
375 | + } |
|
344 | 376 | } |
345 | 377 | |
346 | 378 | // Our truncated string up to the last space |
@@ -374,13 +406,17 @@ discard block |
||
374 | 406 | foreach ($dropped_tags as $closing_tag) |
375 | 407 | { |
376 | 408 | if (!in_array($closing_tag[1], $open_tags)) |
377 | - array_unshift($open_tags, $closing_tag[1]); |
|
409 | + { |
|
410 | + array_unshift($open_tags, $closing_tag[1]); |
|
411 | + } |
|
378 | 412 | } |
379 | 413 | } |
380 | 414 | else |
381 | 415 | { |
382 | 416 | foreach ($dropped_tags as $closing_tag) |
383 | - $open_tags[] = $closing_tag[1]; |
|
417 | + { |
|
418 | + $open_tags[] = $closing_tag[1]; |
|
419 | + } |
|
384 | 420 | } |
385 | 421 | } |
386 | 422 | |
@@ -392,7 +428,9 @@ discard block |
||
392 | 428 | |
393 | 429 | // Finally close any html tags that were left open |
394 | 430 | foreach ($open_tags as $tag) |
395 | - $truncate .= '</' . $tag . '>'; |
|
431 | + { |
|
432 | + $truncate .= '</' . $tag . '>'; |
|
433 | + } |
|
396 | 434 | |
397 | 435 | return $truncate; |
398 | 436 | } |
@@ -416,7 +454,9 @@ discard block |
||
416 | 454 | { |
417 | 455 | $words = preg_split('~([\s\r\n\t]+)~', $string, -1, PREG_SPLIT_DELIM_CAPTURE); |
418 | 456 | for ($i = 0, $n = count($words); $i < $n; $i += 2) |
419 | - $words[$i] = self::ucfirst($words[$i]); |
|
457 | + { |
|
458 | + $words[$i] = self::ucfirst($words[$i]); |
|
459 | + } |
|
420 | 460 | return implode('', $words); |
421 | 461 | } |
422 | 462 | |
@@ -438,9 +478,12 @@ discard block |
||
438 | 478 | { |
439 | 479 | $ent_list = '&(#\d{1,7}|quot|amp|lt|gt|nbsp);'; |
440 | 480 | if (function_exists('mb_strlen')) |
441 | - return mb_strlen(preg_replace('~' . $ent_list . '|.~u', '_', $string), 'UTF-8'); |
|
442 | - else |
|
443 | - return strlen(preg_replace('~' . $ent_list . '|.~u', '_', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string))); |
|
481 | + { |
|
482 | + return mb_strlen(preg_replace('~' . $ent_list . '|.~u', '_', $string), 'UTF-8'); |
|
483 | + } |
|
484 | + else { |
|
485 | + return strlen(preg_replace('~' . $ent_list . '|.~u', '_', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string))); |
|
486 | + } |
|
444 | 487 | } |
445 | 488 | else |
446 | 489 | { |
@@ -468,14 +511,18 @@ discard block |
||
468 | 511 | public static function stripslashes_recursive($var, $level = 0) |
469 | 512 | { |
470 | 513 | if (!is_array($var)) |
471 | - return stripslashes($var); |
|
514 | + { |
|
515 | + return stripslashes($var); |
|
516 | + } |
|
472 | 517 | |
473 | 518 | // Reindex the array without slashes, this time. |
474 | 519 | $new_var = array(); |
475 | 520 | |
476 | 521 | // Strip the slashes from every element. |
477 | 522 | foreach ($var as $k => $v) |
478 | - $new_var[stripslashes($k)] = $level > 25 ? null : self::stripslashes_recursive($v, $level + 1); |
|
523 | + { |
|
524 | + $new_var[stripslashes($k)] = $level > 25 ? null : self::stripslashes_recursive($v, $level + 1); |
|
525 | + } |
|
479 | 526 | |
480 | 527 | return $new_var; |
481 | 528 | } |
@@ -499,14 +546,18 @@ discard block |
||
499 | 546 | public static function urldecode_recursive($var, $level = 0) |
500 | 547 | { |
501 | 548 | if (!is_array($var)) |
502 | - return urldecode($var); |
|
549 | + { |
|
550 | + return urldecode($var); |
|
551 | + } |
|
503 | 552 | |
504 | 553 | // Reindex the array... |
505 | 554 | $new_var = array(); |
506 | 555 | |
507 | 556 | // Add the htmlspecialchars to every element. |
508 | 557 | foreach ($var as $k => $v) |
509 | - $new_var[urldecode($k)] = $level > 25 ? null : self::urldecode_recursive($v, $level + 1); |
|
558 | + { |
|
559 | + $new_var[urldecode($k)] = $level > 25 ? null : self::urldecode_recursive($v, $level + 1); |
|
560 | + } |
|
510 | 561 | |
511 | 562 | return $new_var; |
512 | 563 | } |
@@ -531,14 +582,18 @@ discard block |
||
531 | 582 | $db = database(); |
532 | 583 | |
533 | 584 | if (!is_array($var)) |
534 | - return $db->unescape_string($var); |
|
585 | + { |
|
586 | + return $db->unescape_string($var); |
|
587 | + } |
|
535 | 588 | |
536 | 589 | // Reindex the array without slashes, this time. |
537 | 590 | $new_var = array(); |
538 | 591 | |
539 | 592 | // Strip the slashes from every element. |
540 | 593 | foreach ($var as $k => $v) |
541 | - $new_var[$db->unescape_string($k)] = self::unescapestring_recursive($v); |
|
594 | + { |
|
595 | + $new_var[$db->unescape_string($k)] = self::unescapestring_recursive($v); |
|
596 | + } |
|
542 | 597 | |
543 | 598 | return $new_var; |
544 | 599 | } |
@@ -593,10 +648,14 @@ discard block |
||
593 | 648 | public static function strftime(string $format, int $timestamp = null) |
594 | 649 | { |
595 | 650 | if (function_exists('strftime') && (PHP_VERSION_ID < 80100)) |
596 | - return \strftime($format, $timestamp); |
|
651 | + { |
|
652 | + return \strftime($format, $timestamp); |
|
653 | + } |
|
597 | 654 | |
598 | 655 | if (is_null($timestamp)) |
599 | - $timestamp = time(); |
|
656 | + { |
|
657 | + $timestamp = time(); |
|
658 | + } |
|
600 | 659 | |
601 | 660 | $date_equivalents = array ( |
602 | 661 | '%a' => 'D', |
@@ -671,7 +730,9 @@ discard block |
||
671 | 730 | public static function gmstrftime(string $format, int $timestamp = null) |
672 | 731 | { |
673 | 732 | if (function_exists('gmstrftime') && (PHP_VERSION_ID < 80100)) |
674 | - return \gmstrftime($format, $timestamp); |
|
733 | + { |
|
734 | + return \gmstrftime($format, $timestamp); |
|
735 | + } |
|
675 | 736 | |
676 | 737 | return self::strftime($format, $timestamp); |
677 | 738 | } |
@@ -688,7 +749,9 @@ discard block |
||
688 | 749 | global $modSettings; |
689 | 750 | |
690 | 751 | if (!empty($modSettings['using_utf8mb4'])) |
691 | - return $string; |
|
752 | + { |
|
753 | + return $string; |
|
754 | + } |
|
692 | 755 | |
693 | 756 | $result = $string; |
694 | 757 | |
@@ -713,14 +776,18 @@ discard block |
||
713 | 776 | $entity = self::uniord(chr($ord[$i]) . chr($ord[$i + 1]) . chr($ord[$i + 2]) . chr($ord[$i + 3])); |
714 | 777 | |
715 | 778 | if ($entity === false) |
716 | - $result .= "\xEF\xBF\xBD"; |
|
717 | - else |
|
718 | - $result .= '&#x' . dechex($entity) . ';'; |
|
779 | + { |
|
780 | + $result .= "\xEF\xBF\xBD"; |
|
781 | + } |
|
782 | + else { |
|
783 | + $result .= '&#x' . dechex($entity) . ';'; |
|
784 | + } |
|
719 | 785 | |
720 | 786 | $i += 3; |
721 | 787 | } |
722 | - else |
|
723 | - $result .= $string[$i]; |
|
788 | + else { |
|
789 | + $result .= $string[$i]; |
|
790 | + } |
|
724 | 791 | } |
725 | 792 | } |
726 | 793 | |
@@ -739,25 +806,39 @@ discard block |
||
739 | 806 | static function uniord($c) |
740 | 807 | { |
741 | 808 | if (ord($c[0]) >= 0 && ord($c[0]) <= 127) |
742 | - return ord($c[0]); |
|
809 | + { |
|
810 | + return ord($c[0]); |
|
811 | + } |
|
743 | 812 | |
744 | 813 | if (ord($c[0]) >= 192 && ord($c[0]) <= 223) |
745 | - return (ord($c[0]) - 192) * 64 + (ord($c[1]) - 128); |
|
814 | + { |
|
815 | + return (ord($c[0]) - 192) * 64 + (ord($c[1]) - 128); |
|
816 | + } |
|
746 | 817 | |
747 | 818 | if (ord($c[0]) >= 224 && ord($c[0]) <= 239) |
748 | - return (ord($c[0]) - 224) * 4096 + (ord($c[1]) - 128) * 64 + (ord($c[2]) - 128); |
|
819 | + { |
|
820 | + return (ord($c[0]) - 224) * 4096 + (ord($c[1]) - 128) * 64 + (ord($c[2]) - 128); |
|
821 | + } |
|
749 | 822 | |
750 | 823 | if (ord($c[0]) >= 240 && ord($c[0]) <= 247) |
751 | - return (ord($c[0]) - 240) * 262144 + (ord($c[1]) - 128) * 4096 + (ord($c[2]) - 128) * 64 + (ord($c[3]) - 128); |
|
824 | + { |
|
825 | + return (ord($c[0]) - 240) * 262144 + (ord($c[1]) - 128) * 4096 + (ord($c[2]) - 128) * 64 + (ord($c[3]) - 128); |
|
826 | + } |
|
752 | 827 | |
753 | 828 | if (ord($c[0]) >= 248 && ord($c[0]) <= 251) |
754 | - return (ord($c[0]) - 248) * 16777216 + (ord($c[1]) - 128) * 262144 + (ord($c[2]) - 128) * 4096 + (ord($c[3]) - 128) * 64 + (ord($c[4]) - 128); |
|
829 | + { |
|
830 | + return (ord($c[0]) - 248) * 16777216 + (ord($c[1]) - 128) * 262144 + (ord($c[2]) - 128) * 4096 + (ord($c[3]) - 128) * 64 + (ord($c[4]) - 128); |
|
831 | + } |
|
755 | 832 | |
756 | 833 | if (ord($c[0]) >= 252 && ord($c[0]) <= 253) |
757 | - return (ord($c[0]) - 252) * 1073741824 + (ord($c[1]) - 128) * 16777216 + (ord($c[2]) - 128) * 262144 + (ord($c[3]) - 128) * 4096 + (ord($c[4]) - 128) * 64 + (ord($c[5]) - 128); |
|
834 | + { |
|
835 | + return (ord($c[0]) - 252) * 1073741824 + (ord($c[1]) - 128) * 16777216 + (ord($c[2]) - 128) * 262144 + (ord($c[3]) - 128) * 4096 + (ord($c[4]) - 128) * 64 + (ord($c[5]) - 128); |
|
836 | + } |
|
758 | 837 | |
759 | 838 | if (ord($c[0]) >= 254 && ord($c[0]) <= 255) |
760 | - return false; |
|
839 | + { |
|
840 | + return false; |
|
841 | + } |
|
761 | 842 | |
762 | 843 | return 0; |
763 | 844 | } |
@@ -598,7 +598,7 @@ |
||
598 | 598 | if (is_null($timestamp)) |
599 | 599 | $timestamp = time(); |
600 | 600 | |
601 | - $date_equivalents = array ( |
|
601 | + $date_equivalents = array( |
|
602 | 602 | '%a' => 'D', |
603 | 603 | '%A' => 'l', |
604 | 604 | '%d' => 'd', |
@@ -110,13 +110,17 @@ discard block |
||
110 | 110 | function call_template_callbacks($id, $array) |
111 | 111 | { |
112 | 112 | if (empty($array)) |
113 | - return; |
|
113 | + { |
|
114 | + return; |
|
115 | + } |
|
114 | 116 | |
115 | 117 | foreach ($array as $callback) |
116 | 118 | { |
117 | 119 | $func = 'template_' . $id . '_' . $callback; |
118 | 120 | if (function_exists($func)) |
119 | - $func(); |
|
121 | + { |
|
122 | + $func(); |
|
123 | + } |
|
120 | 124 | } |
121 | 125 | } |
122 | 126 | |
@@ -137,8 +141,10 @@ discard block |
||
137 | 141 | // Tell IE to render the page in standards not compatibility mode. really for ie >= 8 |
138 | 142 | // Note if this is not in the first 4k, its ignored, that's why its here |
139 | 143 | if (isBrowser('ie')) |
140 | - echo ' |
|
144 | + { |
|
145 | + echo ' |
|
141 | 146 | <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />'; |
147 | + } |
|
142 | 148 | |
143 | 149 | echo ' |
144 | 150 | <meta name="viewport" content="width=device-width" /> |
@@ -147,13 +153,17 @@ discard block |
||
147 | 153 | |
148 | 154 | // OpenID enabled? Advertise the location of our endpoint using YADIS protocol. |
149 | 155 | if (!empty($modSettings['enableOpenID'])) |
150 | - echo ' |
|
156 | + { |
|
157 | + echo ' |
|
151 | 158 | <meta http-equiv="x-xrds-location" content="' . $scripturl . '?action=xrds" />'; |
159 | + } |
|
152 | 160 | |
153 | 161 | // Please don't index these Mr Robot. |
154 | 162 | if (!empty($context['robot_no_index'])) |
155 | - echo ' |
|
163 | + { |
|
164 | + echo ' |
|
156 | 165 | <meta name="robots" content="noindex" />'; |
166 | + } |
|
157 | 167 | |
158 | 168 | // If we have any Open Graph data, here is where is inserted. |
159 | 169 | if (!empty($context['open_graph'])) |
@@ -167,8 +177,10 @@ discard block |
||
167 | 177 | |
168 | 178 | // Present a canonical url for search engines to prevent duplicate content in their indices. |
169 | 179 | if (!empty($context['canonical_url'])) |
170 | - echo ' |
|
180 | + { |
|
181 | + echo ' |
|
171 | 182 | <link rel="canonical" href="', $context['canonical_url'], '" />'; |
183 | + } |
|
172 | 184 | |
173 | 185 | // Show all the relative links, such as help, search, contents, and the like. |
174 | 186 | echo ' |
@@ -320,8 +332,10 @@ discard block |
||
320 | 332 | <input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />'; |
321 | 333 | |
322 | 334 | if (!empty($modSettings['enableOpenID'])) |
323 | - echo ' |
|
335 | + { |
|
336 | + echo ' |
|
324 | 337 | <a class="icon icon-margin i-openid" href="', $scripturl, '?action=login;openid" title="' . $txt['openid'] . '"><s>' . $txt['openid'] . '"</s></a>'; |
338 | + } |
|
325 | 339 | echo ' |
326 | 340 | </div> |
327 | 341 | </form> |
@@ -353,18 +367,24 @@ discard block |
||
353 | 367 | |
354 | 368 | // Can't limit it to a specific topic if we are not in one |
355 | 369 | if (!empty($context['current_topic'])) |
356 | - echo ' |
|
370 | + { |
|
371 | + echo ' |
|
357 | 372 | <option value="topic"', ($selected == 'current_topic' ? ' selected="selected"' : ''), '>', $txt['search_thistopic'], '</option>'; |
373 | + } |
|
358 | 374 | |
359 | 375 | // Can't limit it to a specific board if we are not in one |
360 | 376 | if (!empty($context['current_board'])) |
361 | - echo ' |
|
377 | + { |
|
378 | + echo ' |
|
362 | 379 | <option value="board"', ($selected == 'current_board' ? ' selected="selected"' : ''), '>', $txt['search_thisbrd'], '</option>'; |
380 | + } |
|
363 | 381 | |
364 | 382 | if (!empty($context['additional_dropdown_search'])) |
365 | - foreach ($context['additional_dropdown_search'] as $name => $engine) |
|
383 | + { |
|
384 | + foreach ($context['additional_dropdown_search'] as $name => $engine) |
|
366 | 385 | echo ' |
367 | 386 | <option value="', $name, '">', $engine['name'], '</option>'; |
387 | + } |
|
368 | 388 | |
369 | 389 | echo ' |
370 | 390 | <option value="members"', ($selected == 'members' ? ' selected="selected"' : ''), '>', $txt['search_members'], ' </option> |
@@ -374,12 +394,16 @@ discard block |
||
374 | 394 | |
375 | 395 | // Search within current topic? |
376 | 396 | if (!empty($context['current_topic'])) |
377 | - echo ' |
|
397 | + { |
|
398 | + echo ' |
|
378 | 399 | <input type="hidden" name="', (!empty($modSettings['search_dropdown']) ? 'sd_topic' : 'topic'), '" value="', $context['current_topic'], '" />'; |
400 | + } |
|
379 | 401 | // If we're on a certain board, limit it to this board ;). |
380 | 402 | if (!empty($context['current_board'])) |
381 | - echo ' |
|
403 | + { |
|
404 | + echo ' |
|
382 | 405 | <input type="hidden" name="', (!empty($modSettings['search_dropdown']) ? 'sd_brd[' : 'brd['), $context['current_board'], ']"', ' value="', $context['current_board'], '" />'; |
406 | + } |
|
383 | 407 | |
384 | 408 | echo ' |
385 | 409 | <button type="submit" name="search;sa=results" class="', (!empty($modSettings['search_dropdown'])) ? 'with_select' : '', '"><i class="icon i-search icon-shade"></i></button> |
@@ -435,9 +459,11 @@ discard block |
||
435 | 459 | |
436 | 460 | // Show the load time? |
437 | 461 | if ($context['show_load_time']) |
438 | - echo ' |
|
462 | + { |
|
463 | + echo ' |
|
439 | 464 | <p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>'; |
440 | -} |
|
465 | + } |
|
466 | + } |
|
441 | 467 | |
442 | 468 | /** |
443 | 469 | * Section down the page, at closing html tag |
@@ -473,7 +499,9 @@ discard block |
||
473 | 499 | |
474 | 500 | // Anything special to put out? |
475 | 501 | if (!empty($context['insert_after_template'])) |
476 | - echo $context['insert_after_template']; |
|
502 | + { |
|
503 | + echo $context['insert_after_template']; |
|
504 | + } |
|
477 | 505 | |
478 | 506 | echo ' |
479 | 507 | </body> |
@@ -493,7 +521,9 @@ discard block |
||
493 | 521 | |
494 | 522 | // If linktree is empty, just return - also allow an override. |
495 | 523 | if (empty($context[$default])) |
496 | - return; |
|
524 | + { |
|
525 | + return; |
|
526 | + } |
|
497 | 527 | |
498 | 528 | // @todo - Look at changing markup here slightly. Need to incorporate relevant aria roles. |
499 | 529 | echo ' |
@@ -511,14 +541,18 @@ discard block |
||
511 | 541 | // Dividers moved to pseudo-elements in CSS. |
512 | 542 | // Show something before the link? |
513 | 543 | if (isset($tree['extra_before'])) |
514 | - echo $tree['extra_before']; |
|
544 | + { |
|
545 | + echo $tree['extra_before']; |
|
546 | + } |
|
515 | 547 | |
516 | 548 | // Show the link, including a URL if it should have one. |
517 | 549 | echo $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '">' . ($pos == 0 ? '<i class="icon i-home"><s>' . $txt['home'] . '</s></i>' : $tree['name']) . '</a>' : $tree['name']; |
518 | 550 | |
519 | 551 | // Show something after the link...? |
520 | 552 | if (isset($tree['extra_after'])) |
521 | - echo $tree['extra_after']; |
|
553 | + { |
|
554 | + echo $tree['extra_after']; |
|
555 | + } |
|
522 | 556 | |
523 | 557 | echo ' |
524 | 558 | </span> |
@@ -575,10 +609,12 @@ discard block |
||
575 | 609 | <ul class="menulevel3" role="menu">'; |
576 | 610 | |
577 | 611 | foreach ($childbutton['sub_buttons'] as $grandchildact => $grandchildbutton) |
578 | - echo ' |
|
612 | + { |
|
613 | + echo ' |
|
579 | 614 | <li id="button_', $grandchildact, '" class="listlevel3"> |
580 | 615 | <a class="linklevel3" href="', $grandchildbutton['href'], '" ', isset($grandchildbutton['target']) ? 'target="' . $grandchildbutton['target'] . '"' : '', '>', $grandchildbutton['title'], '</a> |
581 | 616 | </li>'; |
617 | + } |
|
582 | 618 | |
583 | 619 | echo ' |
584 | 620 | </ul>'; |
@@ -647,23 +683,31 @@ discard block |
||
647 | 683 | |
648 | 684 | // Not sure if this can happen, but people can misuse functions very efficiently |
649 | 685 | if (empty($button_strip)) |
650 | - return ''; |
|
686 | + { |
|
687 | + return ''; |
|
688 | + } |
|
651 | 689 | |
652 | 690 | if (!is_array($strip_options)) |
653 | - $strip_options = array(); |
|
691 | + { |
|
692 | + $strip_options = array(); |
|
693 | + } |
|
654 | 694 | |
655 | 695 | // Create the buttons... now with cleaner markup (yay!). |
656 | 696 | $buttons = array(); |
657 | 697 | foreach ($button_strip as $key => $value) |
658 | 698 | { |
659 | 699 | if (!isset($value['test']) || !empty($context[$value['test']])) |
660 | - $buttons[] = ' |
|
700 | + { |
|
701 | + $buttons[] = ' |
|
661 | 702 | <li role="menuitem"><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="linklevel1 button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a></li>'; |
703 | + } |
|
662 | 704 | } |
663 | 705 | |
664 | 706 | // No buttons? No button strip either. |
665 | 707 | if (empty($buttons)) |
666 | - return ''; |
|
708 | + { |
|
709 | + return ''; |
|
710 | + } |
|
667 | 711 | |
668 | 712 | echo ' |
669 | 713 | <ul role="menubar" class="buttonlist', !empty($direction) ? ' float' . $direction : '', (empty($buttons) ? ' hide"' : '"'), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '> |
@@ -777,7 +821,9 @@ discard block |
||
777 | 821 | global $context; |
778 | 822 | |
779 | 823 | if (empty($error_id)) |
780 | - return; |
|
824 | + { |
|
825 | + return; |
|
826 | + } |
|
781 | 827 | |
782 | 828 | $error = isset($context[$error_id]) ? $context[$error_id] : array(); |
783 | 829 | |
@@ -786,12 +832,14 @@ discard block |
||
786 | 832 | |
787 | 833 | // Optional title for our results |
788 | 834 | if (!empty($error['title'])) |
789 | - echo ' |
|
835 | + { |
|
836 | + echo ' |
|
790 | 837 | <dl> |
791 | 838 | <dt> |
792 | 839 | <strong id="', $error_id, '_title">', $error['title'], '</strong> |
793 | 840 | </dt> |
794 | 841 | <dd>'; |
842 | + } |
|
795 | 843 | |
796 | 844 | // Everything that went wrong, or correctly :) |
797 | 845 | if (!empty($error['errors'])) |
@@ -800,17 +848,21 @@ discard block |
||
800 | 848 | <ul', (isset($error['type']) ? ' class="error"' : ''), ' id="', $error_id, '_list">'; |
801 | 849 | |
802 | 850 | foreach ($error['errors'] as $key => $err) |
803 | - echo ' |
|
851 | + { |
|
852 | + echo ' |
|
804 | 853 | <li id="', $error_id, '_', $key, '">', $err, '</li>'; |
854 | + } |
|
805 | 855 | echo ' |
806 | 856 | </ul>'; |
807 | 857 | } |
808 | 858 | |
809 | 859 | // All done |
810 | 860 | if (!empty($error['title'])) |
811 | - echo ' |
|
861 | + { |
|
862 | + echo ' |
|
812 | 863 | </dd> |
813 | 864 | </dl>'; |
865 | + } |
|
814 | 866 | |
815 | 867 | echo ' |
816 | 868 | </div>'; |
@@ -851,16 +903,22 @@ discard block |
||
851 | 903 | // Hmmm. I'm a tad wary of having floatleft here but anyway............ |
852 | 904 | // @todo - Try using table-cell display here. Should do auto rtl support. Less markup, less css. :) |
853 | 905 | if (!empty($options['page_index_markup'])) |
854 | - $pages = '<ul ' . (isset($options['page_index_id']) ? 'id="' . $options['page_index_id'] . '" ' : '') . 'class="pagelinks floatleft" role="menubar">' . $options['page_index_markup'] . '</ul>'; |
|
906 | + { |
|
907 | + $pages = '<ul ' . (isset($options['page_index_id']) ? 'id="' . $options['page_index_id'] . '" ' : '') . 'class="pagelinks floatleft" role="menubar">' . $options['page_index_markup'] . '</ul>'; |
|
908 | + } |
|
855 | 909 | else |
856 | 910 | { |
857 | 911 | if (!isset($options['page_index'])) |
858 | - $options['page_index'] = 'page_index'; |
|
912 | + { |
|
913 | + $options['page_index'] = 'page_index'; |
|
914 | + } |
|
859 | 915 | $pages = empty($context[$options['page_index']]) ? '' : '<ul ' . (isset($options['page_index_id']) ? 'id="' . $options['page_index_id'] . '" ' : '') . 'class="pagelinks floatleft" role="menubar">' . $context[$options['page_index']] . '</ul>'; |
860 | 916 | } |
861 | 917 | |
862 | 918 | if (!isset($options['extra'])) |
863 | - $options['extra'] = ''; |
|
919 | + { |
|
920 | + $options['extra'] = ''; |
|
921 | + } |
|
864 | 922 | |
865 | 923 | echo ' |
866 | 924 | <nav class="pagesection"> |
@@ -250,7 +250,7 @@ |
||
250 | 250 | ORDER BY LENGTH(code) DESC', |
251 | 251 | array( |
252 | 252 | ), |
253 | - function ($row) use (&$smileysfrom, &$smileysto, &$smileysdescs) |
|
253 | + function($row) use (&$smileysfrom, &$smileysto, &$smileysdescs) |
|
254 | 254 | { |
255 | 255 | $smileysfrom[] = $row['code']; |
256 | 256 | $smileysto[] = htmlspecialchars($row['filename']); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | self::ATTR_TAG => 'code', |
359 | 359 | self::ATTR_TYPE => self::TYPE_UNPARSED_CONTENT, |
360 | 360 | self::ATTR_CONTENT => '<div class="codeheader">' . $txt['code'] . ': <a href="#" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code prettyprint">$1</pre>', |
361 | - self::ATTR_VALIDATE => $this->isDisabled('code') ? null : function (&$tag, &$data) { |
|
361 | + self::ATTR_VALIDATE => $this->isDisabled('code') ? null : function(&$tag, &$data) { |
|
362 | 362 | $data = tabToHtmlTab(strtr($data, array('[' => '[', ']' => ']'))); |
363 | 363 | }, |
364 | 364 | self::ATTR_BLOCK_LEVEL => true, |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | self::ATTR_TAG => 'code', |
370 | 370 | self::ATTR_TYPE => self::TYPE_UNPARSED_EQUALS_CONTENT, |
371 | 371 | self::ATTR_CONTENT => '<div class="codeheader">' . $txt['code'] . ': ($2) <a href="#" onclick="return elkSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><pre class="bbc_code prettyprint">$1</pre>', |
372 | - self::ATTR_VALIDATE => $this->isDisabled('code') ? null : function (&$tag, &$data) { |
|
372 | + self::ATTR_VALIDATE => $this->isDisabled('code') ? null : function(&$tag, &$data) { |
|
373 | 373 | $data[0] = tabToHtmlTab(strtr($data[0], array('[' => '[', ']' => ']'))); |
374 | 374 | }, |
375 | 375 | self::ATTR_BLOCK_LEVEL => true, |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | ), |
480 | 480 | ), |
481 | 481 | self::ATTR_CONTENT => '<img src="$1" title="{title}" alt="{alt}" style="{width}{height}" class="bbc_img resized" />', |
482 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
482 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
483 | 483 | $data = addProtocol($data); |
484 | 484 | }, |
485 | 485 | self::ATTR_DISABLED_CONTENT => '($1)', |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | self::ATTR_TAG => 'img', |
492 | 492 | self::ATTR_TYPE => self::TYPE_UNPARSED_CONTENT, |
493 | 493 | self::ATTR_CONTENT => '<img src="$1" alt="" class="bbc_img" />', |
494 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
494 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
495 | 495 | $data = addProtocol($data); |
496 | 496 | }, |
497 | 497 | self::ATTR_DISABLED_CONTENT => '($1)', |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | self::ATTR_TAG => 'iurl', |
504 | 504 | self::ATTR_TYPE => self::TYPE_UNPARSED_CONTENT, |
505 | 505 | self::ATTR_CONTENT => '<a href="$1" class="bbc_link">$1</a>', |
506 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
506 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
507 | 507 | //$data = removeBr($data); |
508 | 508 | $data = addProtocol($data); |
509 | 509 | }, |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | self::ATTR_TYPE => self::TYPE_UNPARSED_EQUALS, |
517 | 517 | self::ATTR_BEFORE => '<a href="$1" class="bbc_link">', |
518 | 518 | self::ATTR_AFTER => '</a>', |
519 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
519 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
520 | 520 | if ($data[0] === '#') |
521 | 521 | { |
522 | 522 | $data = '#post_' . substr($data, 1); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | self::ATTR_TEST => '[1-7]{1}', |
731 | 731 | self::ATTR_BEFORE => '<span style="font-size: $1;" class="bbc_size">', |
732 | 732 | self::ATTR_AFTER => '</span>', |
733 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
733 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
734 | 734 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
735 | 735 | $data = $sizes[(int) $data] . 'em'; |
736 | 736 | }, |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | self::ATTR_TAG => 'url', |
868 | 868 | self::ATTR_TYPE => self::TYPE_UNPARSED_CONTENT, |
869 | 869 | self::ATTR_CONTENT => '<a href="$1" class="bbc_link" target="_blank" rel="noopener noreferrer">$1</a>', |
870 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
870 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
871 | 871 | $data = addProtocol($data); |
872 | 872 | }, |
873 | 873 | self::ATTR_BLOCK_LEVEL => false, |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | self::ATTR_TYPE => self::TYPE_UNPARSED_EQUALS, |
880 | 880 | self::ATTR_BEFORE => '<a href="$1" class="bbc_link" target="_blank" rel="noopener noreferrer">', |
881 | 881 | self::ATTR_AFTER => '</a>', |
882 | - self::ATTR_VALIDATE => function (&$tag, &$data) { |
|
882 | + self::ATTR_VALIDATE => function(&$tag, &$data) { |
|
883 | 883 | $data = addProtocol($data); |
884 | 884 | }, |
885 | 885 | self::ATTR_DISALLOW_CHILDREN => array( |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | 'sort' => $sort, |
1018 | 1018 | 'items_per_page' => $items_per_page, |
1019 | 1019 | ), |
1020 | - function ($row) use ($txt) |
|
1020 | + function($row) use ($txt) |
|
1021 | 1021 | { |
1022 | 1022 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
1023 | 1023 | if (!empty($row['private'])) |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | LIMIT ' . $number, |
1242 | 1242 | array( |
1243 | 1243 | ), |
1244 | - function ($row) use(&$ids, &$emails) |
|
1244 | + function($row) use(&$ids, &$emails) |
|
1245 | 1245 | { |
1246 | 1246 | // Just get the data and go. |
1247 | 1247 | $ids[] = $row['id_mail']; |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | |
1428 | 1428 | // If it sent, keep a record so we can save it in our allowed to reply log |
1429 | 1429 | if (!empty($unq_head) && $result) |
1430 | - $sent[] = array_merge($unq_head_array, array(time(),$email['to'])); |
|
1430 | + $sent[] = array_merge($unq_head_array, array(time(), $email['to'])); |
|
1431 | 1431 | |
1432 | 1432 | // Track total emails sent |
1433 | 1433 | if ($result && !empty($modSettings['trackStats'])) |
@@ -80,14 +80,18 @@ discard block |
||
80 | 80 | |
81 | 81 | // Call this function recursively for the hotmail addresses. |
82 | 82 | if (!empty($hotmail_to)) |
83 | - $mail_result = sendmail($hotmail_to, $subject, $message, $from, $message_type . $message_id, $send_html, $priority, true, $is_private, $from_wrapper, $reference); |
|
83 | + { |
|
84 | + $mail_result = sendmail($hotmail_to, $subject, $message, $from, $message_type . $message_id, $send_html, $priority, true, $is_private, $from_wrapper, $reference); |
|
85 | + } |
|
84 | 86 | |
85 | 87 | // The remaining addresses no longer need the fix. |
86 | 88 | $hotmail_fix = false; |
87 | 89 | |
88 | 90 | // No other addresses left? Return instantly. |
89 | 91 | if (empty($to_array)) |
90 | - return $mail_result; |
|
92 | + { |
|
93 | + return $mail_result; |
|
94 | + } |
|
91 | 95 | } |
92 | 96 | |
93 | 97 | // Get rid of entities. |
@@ -111,22 +115,29 @@ discard block |
||
111 | 115 | // Be sure there is never an email in the from name if using maillist styles |
112 | 116 | $dmarc_from = $from; |
113 | 117 | if (filter_var($dmarc_from, FILTER_VALIDATE_EMAIL)) |
114 | - $dmarc_from = str_replace(strstr($dmarc_from, '@'), '', $dmarc_from); |
|
118 | + { |
|
119 | + $dmarc_from = str_replace(strstr($dmarc_from, '@'), '', $dmarc_from); |
|
120 | + } |
|
115 | 121 | |
116 | 122 | // Add in the 'via' if desired, helps prevent email clients from learning/replacing legit names/emails |
117 | 123 | if (!empty($modSettings['maillist_sitename']) && empty($modSettings['dmarc_spec_standard'])) |
118 | - // @memo (2014) "via" is still a draft, and it's not yet clear if it will be localized or not. |
|
124 | + { |
|
125 | + // @memo (2014) "via" is still a draft, and it's not yet clear if it will be localized or not. |
|
119 | 126 | // To play safe, we are keeping it hard-coded, but the string is available for translation. |
120 | 127 | $from = $dmarc_from . ' ' . /* $txt['via'] */ 'via' . ' ' . $modSettings['maillist_sitename']; |
121 | - else |
|
122 | - $from = $dmarc_from; |
|
128 | + } |
|
129 | + else { |
|
130 | + $from = $dmarc_from; |
|
131 | + } |
|
123 | 132 | } |
124 | 133 | |
125 | 134 | // Take care of from / subject encodings |
126 | 135 | list (, $from_name, $from_encoding) = mimespecialchars(addcslashes($from !== null ? $from : (!empty($modSettings['maillist_sitename']) ? $modSettings['maillist_sitename'] : $context['forum_name']), '<>()\'\\"'), true, $hotmail_fix, $line_break); |
127 | 136 | list (, $subject) = mimespecialchars($subject, true, $hotmail_fix, $line_break); |
128 | 137 | if ($from_encoding !== 'base64') |
129 | - $from_name = '"' . $from_name . '"'; |
|
138 | + { |
|
139 | + $from_name = '"' . $from_name . '"'; |
|
140 | + } |
|
130 | 141 | |
131 | 142 | // Construct the from / replyTo mail headers, based on if we showing a users name |
132 | 143 | if ($from_wrapper !== null) |
@@ -136,7 +147,9 @@ discard block |
||
136 | 147 | // If they reply where is it going to be sent? |
137 | 148 | $headers .= 'Reply-To: "' . (!empty($modSettings['maillist_sitename']) ? $modSettings['maillist_sitename'] : $context['forum_name']) . '" <' . (!empty($modSettings['maillist_sitename_address']) ? $modSettings['maillist_sitename_address'] : (empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'])) . '>' . $line_break; |
138 | 149 | if ($reference !== null) |
139 | - $headers .= 'References: <' . $reference . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>' . $line_break; |
|
150 | + { |
|
151 | + $headers .= 'References: <' . $reference . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>' . $line_break; |
|
152 | + } |
|
140 | 153 | } |
141 | 154 | else |
142 | 155 | { |
@@ -150,7 +163,9 @@ discard block |
||
150 | 163 | |
151 | 164 | // Return path, date, mailer |
152 | 165 | if ($use_sendmail) |
153 | - $headers .= 'Return-Path: <' . $return_path . '>' . $line_break; |
|
166 | + { |
|
167 | + $headers .= 'Return-Path: <' . $return_path . '>' . $line_break; |
|
168 | + } |
|
154 | 169 | $headers .= 'Date: ' . gmdate('D, d M Y H:i:s') . ' -0000' . $line_break; |
155 | 170 | $headers .= 'X-Mailer: ELK' . $line_break; |
156 | 171 | |
@@ -170,7 +185,9 @@ discard block |
||
170 | 185 | |
171 | 186 | // Pass this to the integration before we start modifying the output -- it'll make it easier later. |
172 | 187 | if (in_array(false, call_integration_hook('integrate_outgoing_email', array(&$subject, &$message, &$headers)), true)) |
173 | - return false; |
|
188 | + { |
|
189 | + return false; |
|
190 | + } |
|
174 | 191 | |
175 | 192 | // Save the original message... |
176 | 193 | $orig_message = $message; |
@@ -223,15 +240,20 @@ discard block |
||
223 | 240 | |
224 | 241 | // Are we using the mail queue, if so this is where we butt in... |
225 | 242 | if (!empty($modSettings['mail_queue']) && $priority != 0) |
226 | - return AddMailQueue(false, $to_array, $subject, $message, $headers, $send_html, $priority, $is_private, $message_type . $message_id); |
|
243 | + { |
|
244 | + return AddMailQueue(false, $to_array, $subject, $message, $headers, $send_html, $priority, $is_private, $message_type . $message_id); |
|
245 | + } |
|
227 | 246 | // If it's a priority mail, send it now - note though that this should NOT be used for sending many at once. |
228 | 247 | elseif (!empty($modSettings['mail_queue']) && !empty($modSettings['mail_period_limit'])) |
229 | 248 | { |
230 | 249 | list ($last_mail_time, $mails_this_minute) = @explode('|', $modSettings['mail_recent']); |
231 | 250 | if (empty($mails_this_minute) || time() > (int) $last_mail_time + 60) |
232 | - $new_queue_stat = time() . '|' . 1; |
|
233 | - else |
|
234 | - $new_queue_stat = $last_mail_time . '|' . ((int) $mails_this_minute + 1); |
|
251 | + { |
|
252 | + $new_queue_stat = time() . '|' . 1; |
|
253 | + } |
|
254 | + else { |
|
255 | + $new_queue_stat = $last_mail_time . '|' . ((int) $mails_this_minute + 1); |
|
256 | + } |
|
235 | 257 | |
236 | 258 | updateSettings(array('mail_recent' => $new_queue_stat)); |
237 | 259 | } |
@@ -265,7 +287,9 @@ discard block |
||
265 | 287 | $message = mail_insert_key($message, $unq_head, $line_break); |
266 | 288 | } |
267 | 289 | elseif (empty($modSettings['mail_no_message_id'])) |
268 | - $unq_id = ($need_break ? $line_break : '') . 'Message-ID: <' . md5($boardurl . microtime()) . '-' . $message_id . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>'; |
|
290 | + { |
|
291 | + $unq_id = ($need_break ? $line_break : '') . 'Message-ID: <' . md5($boardurl . microtime()) . '-' . $message_id . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>'; |
|
292 | + } |
|
269 | 293 | |
270 | 294 | // This is frequently not set, or not set according to the needs of PBE and bounce detection |
271 | 295 | // We have to use ini_set, since "-f <address>" doesn't work on windows systems, so we need both |
@@ -287,7 +311,9 @@ discard block |
||
287 | 311 | |
288 | 312 | // Track total emails sent |
289 | 313 | if (!empty($modSettings['trackStats'])) |
290 | - trackStats(array('email' => '+')); |
|
314 | + { |
|
315 | + trackStats(array('email' => '+')); |
|
316 | + } |
|
291 | 317 | } |
292 | 318 | |
293 | 319 | // Put it back |
@@ -304,9 +330,10 @@ discard block |
||
304 | 330 | log_email($sent); |
305 | 331 | } |
306 | 332 | } |
307 | - else |
|
308 | - // SMTP protocol it is |
|
333 | + else { |
|
334 | + // SMTP protocol it is |
|
309 | 335 | $mail_result = $mail_result && smtp_mail($to_array, $subject, $message, $headers, $priority, $message_type . $message_id); |
336 | + } |
|
310 | 337 | |
311 | 338 | // Clear out the stat cache. |
312 | 339 | trackStats(); |
@@ -340,7 +367,9 @@ discard block |
||
340 | 367 | static $cur_insert_len = 0; |
341 | 368 | |
342 | 369 | if ($cur_insert_len == 0) |
343 | - $cur_insert = array(); |
|
370 | + { |
|
371 | + $cur_insert = array(); |
|
372 | + } |
|
344 | 373 | |
345 | 374 | // If we're flushing, make the final inserts - also if we're near the MySQL length limit! |
346 | 375 | if (($flush || $cur_insert_len > 800000) && !empty($cur_insert)) |
@@ -417,7 +446,9 @@ discard block |
||
417 | 446 | |
418 | 447 | // If they are using SSI there is a good chance obExit will never be called. So lets be nice and flush it for them. |
419 | 448 | if (ELK === 'SSI') |
420 | - return AddMailQueue(true); |
|
449 | + { |
|
450 | + return AddMailQueue(true); |
|
451 | + } |
|
421 | 452 | |
422 | 453 | return true; |
423 | 454 | } |
@@ -451,12 +482,16 @@ discard block |
||
451 | 482 | $simple = true; |
452 | 483 | |
453 | 484 | foreach ($matches[1] as $entity) |
454 | - if ($entity > 128) |
|
485 | + { |
|
486 | + if ($entity > 128) |
|
455 | 487 | $simple = false; |
488 | + } |
|
456 | 489 | unset($matches); |
457 | 490 | |
458 | 491 | if ($simple) |
459 | - $string = preg_replace_callback('~&#(\d{3,7});~', 'mimespecialchars_callback', $string); |
|
492 | + { |
|
493 | + $string = preg_replace_callback('~&#(\d{3,7});~', 'mimespecialchars_callback', $string); |
|
494 | + } |
|
460 | 495 | else |
461 | 496 | { |
462 | 497 | $string = preg_replace_callback('~&#(\d{3,7});~', 'fixchar__callback', $string); |
@@ -484,17 +519,21 @@ discard block |
||
484 | 519 | |
485 | 520 | // Show the characterset and the transfer-encoding for header strings. |
486 | 521 | if ($with_charset) |
487 | - $string = '=?' . $charset . '?B?' . $string . '?='; |
|
522 | + { |
|
523 | + $string = '=?' . $charset . '?B?' . $string . '?='; |
|
524 | + } |
|
488 | 525 | |
489 | 526 | // Break it up in lines (mail body). |
490 | - else |
|
491 | - $string = chunk_split($string, 76, $line_break); |
|
527 | + else { |
|
528 | + $string = chunk_split($string, 76, $line_break); |
|
529 | + } |
|
492 | 530 | |
493 | 531 | return array($charset, $string, 'base64'); |
494 | 532 | } |
495 | - else |
|
496 | - return array($charset, $string, '7bit'); |
|
497 | -} |
|
533 | + else { |
|
534 | + return array($charset, $string, '7bit'); |
|
535 | + } |
|
536 | + } |
|
498 | 537 | |
499 | 538 | /** |
500 | 539 | * Converts out of ascii range characters in to HTML entities |
@@ -512,16 +551,25 @@ discard block |
||
512 | 551 | $c_ord = ord($c[0]); |
513 | 552 | |
514 | 553 | if ($c_strlen === 1 && $c_ord <= 0x7F) |
515 | - return $c; |
|
554 | + { |
|
555 | + return $c; |
|
556 | + } |
|
516 | 557 | elseif ($c_strlen === 2 && $c_ord >= 0xC0 && $c_ord <= 0xDF) |
517 | - return '&#' . ((($c_ord ^ 0xC0) << 6) + (ord($c[1]) ^ 0x80)) . ';'; |
|
558 | + { |
|
559 | + return '&#' . ((($c_ord ^ 0xC0) << 6) + (ord($c[1]) ^ 0x80)) . ';'; |
|
560 | + } |
|
518 | 561 | elseif ($c_strlen === 3 && $c_ord >= 0xE0 && $c_ord <= 0xEF) |
519 | - return '&#' . ((($c_ord ^ 0xE0) << 12) + ((ord($c[1]) ^ 0x80) << 6) + (ord($c[2]) ^ 0x80)) . ';'; |
|
562 | + { |
|
563 | + return '&#' . ((($c_ord ^ 0xE0) << 12) + ((ord($c[1]) ^ 0x80) << 6) + (ord($c[2]) ^ 0x80)) . ';'; |
|
564 | + } |
|
520 | 565 | elseif ($c_strlen === 4 && $c_ord >= 0xF0 && $c_ord <= 0xF7) |
521 | - return '&#' . ((($c_ord ^ 0xF0) << 18) + ((ord($c[1]) ^ 0x80) << 12) + ((ord($c[2]) ^ 0x80) << 6) + (ord($c[3]) ^ 0x80)) . ';'; |
|
522 | - else |
|
523 | - return ''; |
|
524 | -} |
|
566 | + { |
|
567 | + return '&#' . ((($c_ord ^ 0xF0) << 18) + ((ord($c[1]) ^ 0x80) << 12) + ((ord($c[2]) ^ 0x80) << 6) + (ord($c[3]) ^ 0x80)) . ';'; |
|
568 | + } |
|
569 | + else { |
|
570 | + return ''; |
|
571 | + } |
|
572 | + } |
|
525 | 573 | |
526 | 574 | /** |
527 | 575 | * Callback for the preg_replace in mimespecialchars |
@@ -571,7 +619,9 @@ discard block |
||
571 | 619 | { |
572 | 620 | $socket = fsockopen($modSettings['smtp_host'], 110, $errno, $errstr, 2); |
573 | 621 | if (!$socket && (substr($modSettings['smtp_host'], 0, 5) == 'smtp.' || substr($modSettings['smtp_host'], 0, 11) == 'ssl://smtp.')) |
574 | - $socket = fsockopen(strtr($modSettings['smtp_host'], array('smtp.' => 'pop.')), 110, $errno, $errstr, 2); |
|
622 | + { |
|
623 | + $socket = fsockopen(strtr($modSettings['smtp_host'], array('smtp.' => 'pop.')), 110, $errno, $errstr, 2); |
|
624 | + } |
|
575 | 625 | |
576 | 626 | if ($socket) |
577 | 627 | { |
@@ -593,7 +643,9 @@ discard block |
||
593 | 643 | if (substr($modSettings['smtp_host'], 0, 4) == 'ssl:' && (empty($modSettings['smtp_port']) || $modSettings['smtp_port'] == 25)) |
594 | 644 | { |
595 | 645 | if ($socket = @fsockopen($modSettings['smtp_host'], 465, $errno, $errstr, 3)) |
596 | - Errors::instance()->log_error($txt['smtp_port_ssl']); |
|
646 | + { |
|
647 | + Errors::instance()->log_error($txt['smtp_port_ssl']); |
|
648 | + } |
|
597 | 649 | } |
598 | 650 | |
599 | 651 | // Unable to connect! Don't show any error message, but just log one and try to continue anyway. |
@@ -606,7 +658,9 @@ discard block |
||
606 | 658 | |
607 | 659 | // Wait for a response of 220, without "-" continue. |
608 | 660 | if (!server_parse(null, $socket, '220')) |
609 | - return false; |
|
661 | + { |
|
662 | + return false; |
|
663 | + } |
|
610 | 664 | |
611 | 665 | // This should be set in the ACP |
612 | 666 | if (empty($modSettings['smtp_client'])) |
@@ -628,22 +682,32 @@ discard block |
||
628 | 682 | } |
629 | 683 | |
630 | 684 | if (!server_parse('AUTH LOGIN', $socket, '334')) |
631 | - return false; |
|
685 | + { |
|
686 | + return false; |
|
687 | + } |
|
632 | 688 | // Send the username and password, encoded. |
633 | 689 | if (!server_parse(base64_encode($modSettings['smtp_username']), $socket, '334')) |
634 | - return false; |
|
690 | + { |
|
691 | + return false; |
|
692 | + } |
|
635 | 693 | // The password is already encoded ;) |
636 | 694 | if (!server_parse($modSettings['smtp_password'], $socket, '235')) |
637 | - return false; |
|
695 | + { |
|
696 | + return false; |
|
697 | + } |
|
638 | 698 | } |
639 | 699 | elseif (!server_parse('HELO ' . $modSettings['smtp_client'], $socket, '250')) |
640 | - return false; |
|
700 | + { |
|
701 | + return false; |
|
702 | + } |
|
641 | 703 | } |
642 | 704 | else |
643 | 705 | { |
644 | 706 | // Just say "helo". |
645 | 707 | if (!server_parse('HELO ' . $modSettings['smtp_client'], $socket, '250')) |
646 | - return false; |
|
708 | + { |
|
709 | + return false; |
|
710 | + } |
|
647 | 711 | } |
648 | 712 | |
649 | 713 | // Fix the message for any lines beginning with a period! (the first is ignored, you see.) |
@@ -683,30 +747,44 @@ discard block |
||
683 | 747 | if ($i != 0) |
684 | 748 | { |
685 | 749 | if (!server_parse('RSET', $socket, '250')) |
686 | - return false; |
|
750 | + { |
|
751 | + return false; |
|
752 | + } |
|
687 | 753 | } |
688 | 754 | |
689 | 755 | // From, to, and then start the data... |
690 | 756 | if (!server_parse('MAIL FROM: <' . $return_path . '>', $socket, '250')) |
691 | - return false; |
|
757 | + { |
|
758 | + return false; |
|
759 | + } |
|
692 | 760 | if (!server_parse('RCPT TO: <' . $mail_to . '>', $socket, '250')) |
693 | - return false; |
|
761 | + { |
|
762 | + return false; |
|
763 | + } |
|
694 | 764 | if (!server_parse('DATA', $socket, '354')) |
695 | - return false; |
|
765 | + { |
|
766 | + return false; |
|
767 | + } |
|
696 | 768 | |
697 | 769 | fputs($socket, 'Subject: ' . $subject . $line_break); |
698 | 770 | if (strlen($mail_to) > 0) |
699 | - fputs($socket, 'To: <' . $mail_to . '>' . $line_break); |
|
771 | + { |
|
772 | + fputs($socket, 'To: <' . $mail_to . '>' . $line_break); |
|
773 | + } |
|
700 | 774 | fputs($socket, $headers . $line_break . $line_break); |
701 | 775 | fputs($socket, $message . $line_break); |
702 | 776 | |
703 | 777 | // Send a ., or in other words "end of data". |
704 | 778 | if (!server_parse('.', $socket, '250')) |
705 | - return false; |
|
779 | + { |
|
780 | + return false; |
|
781 | + } |
|
706 | 782 | |
707 | 783 | // track the number of emails sent |
708 | 784 | if (!empty($modSettings['trackStats'])) |
709 | - trackStats(array('email' => '+')); |
|
785 | + { |
|
786 | + trackStats(array('email' => '+')); |
|
787 | + } |
|
710 | 788 | |
711 | 789 | // Keep our post via email log |
712 | 790 | if (!empty($unq_head)) |
@@ -751,21 +829,27 @@ discard block |
||
751 | 829 | global $txt; |
752 | 830 | |
753 | 831 | if ($message !== null) |
754 | - fputs($socket, $message . "\r\n"); |
|
832 | + { |
|
833 | + fputs($socket, $message . "\r\n"); |
|
834 | + } |
|
755 | 835 | |
756 | 836 | // No response yet. |
757 | 837 | $server_response = ''; |
758 | 838 | |
759 | 839 | while (substr($server_response, 3, 1) != ' ') |
760 | - if (!($server_response = fgets($socket, 256))) |
|
840 | + { |
|
841 | + if (!($server_response = fgets($socket, 256))) |
|
761 | 842 | { |
762 | 843 | // @todo Change this message to reflect that it may mean bad user/password/server issues/etc. |
763 | 844 | Errors::instance()->log_error($txt['smtp_bad_response']); |
845 | + } |
|
764 | 846 | return false; |
765 | 847 | } |
766 | 848 | |
767 | 849 | if ($response === null) |
768 | - return substr($server_response, 0, 3); |
|
850 | + { |
|
851 | + return substr($server_response, 0, 3); |
|
852 | + } |
|
769 | 853 | |
770 | 854 | if (substr($server_response, 0, 3) != $response) |
771 | 855 | { |
@@ -833,17 +917,23 @@ discard block |
||
833 | 917 | { |
834 | 918 | loadLanguage('EmailTemplates', $lang); |
835 | 919 | if (!empty($modSettings['maillist_enabled'])) |
836 | - loadLanguage('MaillistTemplates', $lang); |
|
920 | + { |
|
921 | + loadLanguage('MaillistTemplates', $lang); |
|
922 | + } |
|
837 | 923 | |
838 | 924 | if (!empty($additional_files)) |
839 | 925 | { |
840 | 926 | foreach ($additional_files as $file) |
841 | - loadLanguage($file, $lang); |
|
927 | + { |
|
928 | + loadLanguage($file, $lang); |
|
929 | + } |
|
842 | 930 | } |
843 | 931 | } |
844 | 932 | |
845 | 933 | if (!isset($txt[$template . '_subject']) || !isset($txt[$template . '_body'])) |
846 | - throw new Elk_Exception('email_no_template', 'template', array($template)); |
|
934 | + { |
|
935 | + throw new Elk_Exception('email_no_template', 'template', array($template)); |
|
936 | + } |
|
847 | 937 | |
848 | 938 | $ret = array( |
849 | 939 | 'subject' => $txt[$template . '_subject'], |
@@ -852,7 +942,9 @@ discard block |
||
852 | 942 | if (!empty($suffixes)) |
853 | 943 | { |
854 | 944 | foreach ($suffixes as $key) |
855 | - $ret[$key] = $txt[$template . '_' . $key]; |
|
945 | + { |
|
946 | + $ret[$key] = $txt[$template . '_' . $key]; |
|
947 | + } |
|
856 | 948 | } |
857 | 949 | |
858 | 950 | // Add in the default replacements. |
@@ -932,9 +1024,13 @@ discard block |
||
932 | 1024 | $context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : ''; |
933 | 1025 | |
934 | 1026 | if (empty($context[$key]) && empty($_REQUEST['xml'])) |
935 | - $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
1027 | + { |
|
1028 | + $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
1029 | + } |
|
936 | 1030 | elseif (!empty($_REQUEST['xml'])) |
937 | - continue; |
|
1031 | + { |
|
1032 | + continue; |
|
1033 | + } |
|
938 | 1034 | |
939 | 1035 | preparsecode($context[$key]); |
940 | 1036 | |
@@ -972,7 +1068,9 @@ discard block |
||
972 | 1068 | global $user_info; |
973 | 1069 | |
974 | 1070 | if (empty($matches[1])) |
975 | - return ''; |
|
1071 | + { |
|
1072 | + return ''; |
|
1073 | + } |
|
976 | 1074 | |
977 | 1075 | $use_ref = true; |
978 | 1076 | $ref = &$user_info; |
@@ -980,7 +1078,9 @@ discard block |
||
980 | 1078 | foreach (explode('.', $matches[1]) as $index) |
981 | 1079 | { |
982 | 1080 | if ($use_ref && isset($ref[$index])) |
983 | - $ref = &$ref[$index]; |
|
1081 | + { |
|
1082 | + $ref = &$ref[$index]; |
|
1083 | + } |
|
984 | 1084 | else |
985 | 1085 | { |
986 | 1086 | $use_ref = false; |
@@ -1021,7 +1121,9 @@ discard block |
||
1021 | 1121 | { |
1022 | 1122 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
1023 | 1123 | if (!empty($row['private'])) |
1024 | - $row['subject'] = $txt['personal_message']; |
|
1124 | + { |
|
1125 | + $row['subject'] = $txt['personal_message']; |
|
1126 | + } |
|
1025 | 1127 | |
1026 | 1128 | return $row; |
1027 | 1129 | } |
@@ -1118,7 +1220,8 @@ discard block |
||
1118 | 1220 | |
1119 | 1221 | // If we have failed to many times, tell mail to wait a bit and try again. |
1120 | 1222 | if ($modSettings['mail_failed_attempts'] > 5) |
1121 | - $db->query('', ' |
|
1223 | + { |
|
1224 | + $db->query('', ' |
|
1122 | 1225 | UPDATE {db_prefix}settings |
1123 | 1226 | SET value = {string:next_mail_send} |
1124 | 1227 | WHERE variable = {string:mail_next_send} |
@@ -1129,6 +1232,7 @@ discard block |
||
1129 | 1232 | 'last_send' => $modSettings['mail_next_send'], |
1130 | 1233 | ) |
1131 | 1234 | ); |
1235 | + } |
|
1132 | 1236 | |
1133 | 1237 | // Add our email back to the queue, manually. |
1134 | 1238 | $db->insert('insert', |
@@ -1215,7 +1319,9 @@ discard block |
||
1215 | 1319 | ) |
1216 | 1320 | ); |
1217 | 1321 | if ($db->affected_rows() == 0) |
1218 | - return false; |
|
1322 | + { |
|
1323 | + return false; |
|
1324 | + } |
|
1219 | 1325 | |
1220 | 1326 | return $delay; |
1221 | 1327 | } |
@@ -1280,17 +1386,23 @@ discard block |
||
1280 | 1386 | |
1281 | 1387 | // Do we have another script to send out the queue? |
1282 | 1388 | if (!empty($modSettings['mail_queue_use_cron']) && empty($force_send)) |
1283 | - return false; |
|
1389 | + { |
|
1390 | + return false; |
|
1391 | + } |
|
1284 | 1392 | |
1285 | 1393 | // How many emails can we send each time we are called in a period |
1286 | 1394 | if (!$batch_size) |
1287 | 1395 | { |
1288 | 1396 | // Batch size has been set in the ACP, use it |
1289 | 1397 | if (!empty($modSettings['mail_batch_size'])) |
1290 | - $batch_size = $modSettings['mail_batch_size']; |
|
1398 | + { |
|
1399 | + $batch_size = $modSettings['mail_batch_size']; |
|
1400 | + } |
|
1291 | 1401 | // No per period setting or batch size, set to send 5 every 5 seconds, or 60 per minute |
1292 | 1402 | elseif (empty($modSettings['mail_period_limit'])) |
1293 | - $batch_size = 5; |
|
1403 | + { |
|
1404 | + $batch_size = 5; |
|
1405 | + } |
|
1294 | 1406 | // A per period limit but no defined batch size, set a batch size |
1295 | 1407 | else |
1296 | 1408 | { |
@@ -1303,7 +1415,9 @@ discard block |
||
1303 | 1415 | |
1304 | 1416 | // If we came with a timestamp, and that doesn't match the next event, then someone else has beaten us. |
1305 | 1417 | if (isset($_GET['ts']) && $_GET['ts'] != $modSettings['mail_next_send'] && empty($force_send)) |
1306 | - return false; |
|
1418 | + { |
|
1419 | + return false; |
|
1420 | + } |
|
1307 | 1421 | |
1308 | 1422 | // Prepare to send each email, and log that for future proof. |
1309 | 1423 | require_once(SUBSDIR . '/Maillist.subs.php'); |
@@ -1315,7 +1429,9 @@ discard block |
||
1315 | 1429 | // Update next send time for our mail queue, if there was something to update. Otherwise bail out :P |
1316 | 1430 | $delay = updateNextSendTime(); |
1317 | 1431 | if ($delay === false) |
1318 | - return false; |
|
1432 | + { |
|
1433 | + return false; |
|
1434 | + } |
|
1319 | 1435 | |
1320 | 1436 | $modSettings['mail_next_send'] = time() + $delay; |
1321 | 1437 | } |
@@ -1337,16 +1453,21 @@ discard block |
||
1337 | 1453 | { |
1338 | 1454 | // If this is likely one of the last cycles for this period, then send any remaining quota |
1339 | 1455 | if (($mail_time - (time() - 60)) < $delay * 2) |
1340 | - $batch_size = $modSettings['mail_period_limit'] - $mail_number; |
|
1456 | + { |
|
1457 | + $batch_size = $modSettings['mail_period_limit'] - $mail_number; |
|
1458 | + } |
|
1341 | 1459 | // Some batch sizes may need to be adjusted to fit as we approach the end |
1342 | 1460 | elseif ($mail_number + $batch_size > $modSettings['mail_period_limit']) |
1343 | - $batch_size = $modSettings['mail_period_limit'] - $mail_number; |
|
1461 | + { |
|
1462 | + $batch_size = $modSettings['mail_period_limit'] - $mail_number; |
|
1463 | + } |
|
1344 | 1464 | |
1345 | 1465 | $mail_number += $batch_size; |
1346 | 1466 | } |
1347 | 1467 | // No more I'm afraid, return! |
1348 | - else |
|
1349 | - return false; |
|
1468 | + else { |
|
1469 | + return false; |
|
1470 | + } |
|
1350 | 1471 | |
1351 | 1472 | // Reflect that we're about to send some, do it now to be safe. |
1352 | 1473 | updateSettings(array('mail_recent' => $mail_time . '|' . $mail_number)); |
@@ -1357,14 +1478,20 @@ discard block |
||
1357 | 1478 | |
1358 | 1479 | // Delete, delete, delete!!! |
1359 | 1480 | if (!empty($ids)) |
1360 | - deleteMailQueueItems($ids); |
|
1481 | + { |
|
1482 | + deleteMailQueueItems($ids); |
|
1483 | + } |
|
1361 | 1484 | |
1362 | 1485 | // Don't believe we have any left after this batch? |
1363 | 1486 | if (count($ids) < $batch_size) |
1364 | - resetNextSendTime(); |
|
1487 | + { |
|
1488 | + resetNextSendTime(); |
|
1489 | + } |
|
1365 | 1490 | |
1366 | 1491 | if (empty($ids)) |
1367 | - return false; |
|
1492 | + { |
|
1493 | + return false; |
|
1494 | + } |
|
1368 | 1495 | |
1369 | 1496 | // We have some to send, lets send them! |
1370 | 1497 | $sent = array(); |
@@ -1420,28 +1547,37 @@ discard block |
||
1420 | 1547 | $email['body'] = mail_insert_key($email['body'], $unq_head, $line_break); |
1421 | 1548 | } |
1422 | 1549 | elseif ($email['message_id'] !== null && empty($modSettings['mail_no_message_id'])) |
1423 | - $unq_id = ($need_break ? $line_break : '') . 'Message-ID: <' . md5($scripturl . microtime()) . '-' . $email['message_id'] . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>'; |
|
1550 | + { |
|
1551 | + $unq_id = ($need_break ? $line_break : '') . 'Message-ID: <' . md5($scripturl . microtime()) . '-' . $email['message_id'] . strstr(empty($modSettings['maillist_mail_from']) ? $webmaster_email : $modSettings['maillist_mail_from'], '@') . '>'; |
|
1552 | + } |
|
1424 | 1553 | |
1425 | 1554 | // No point logging a specific error here, as we have no language. PHP error is helpful anyway... |
1426 | 1555 | $result = mail(strtr($email['to'], array("\r" => '', "\n" => '')), $email['subject'], $email['body'], $email['headers'] . $unq_id); |
1427 | 1556 | |
1428 | 1557 | // If it sent, keep a record so we can save it in our allowed to reply log |
1429 | 1558 | if (!empty($unq_head) && $result) |
1430 | - $sent[] = array_merge($unq_head_array, array(time(),$email['to'])); |
|
1559 | + { |
|
1560 | + $sent[] = array_merge($unq_head_array, array(time(),$email['to'])); |
|
1561 | + } |
|
1431 | 1562 | |
1432 | 1563 | // Track total emails sent |
1433 | 1564 | if ($result && !empty($modSettings['trackStats'])) |
1434 | - trackStats(array('email' => '+')); |
|
1565 | + { |
|
1566 | + trackStats(array('email' => '+')); |
|
1567 | + } |
|
1435 | 1568 | |
1436 | 1569 | // Try to stop a timeout, this would be bad... |
1437 | 1570 | detectServer()->setTimeLimit(300); |
1438 | 1571 | } |
1439 | - else |
|
1440 | - $result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['headers'], $email['priority'], $email['message_type'] . $email['message_id']); |
|
1572 | + else { |
|
1573 | + $result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['headers'], $email['priority'], $email['message_type'] . $email['message_id']); |
|
1574 | + } |
|
1441 | 1575 | |
1442 | 1576 | // Hopefully it sent? |
1443 | 1577 | if (!$result) |
1444 | - $failed_emails[] = array(time(), $email['to'], $email['body_fail'], $email['subject'], $email['headers'], $email['send_html'], $email['priority'], $email['private'], $email['message_id']); |
|
1578 | + { |
|
1579 | + $failed_emails[] = array(time(), $email['to'], $email['body_fail'], $email['subject'], $email['headers'], $email['send_html'], $email['priority'], $email['private'], $email['message_id']); |
|
1580 | + } |
|
1445 | 1581 | } |
1446 | 1582 | |
1447 | 1583 | // Clear out the stat cache. |
@@ -1449,7 +1585,9 @@ discard block |
||
1449 | 1585 | |
1450 | 1586 | // Log each of the sent emails. |
1451 | 1587 | if (!empty($sent)) |
1452 | - log_email($sent); |
|
1588 | + { |
|
1589 | + log_email($sent); |
|
1590 | + } |
|
1453 | 1591 | |
1454 | 1592 | // Any emails that didn't send? |
1455 | 1593 | if (!empty($failed_emails)) |
@@ -1460,7 +1598,9 @@ discard block |
||
1460 | 1598 | } |
1461 | 1599 | // We were able to send the email, clear our failed attempts. |
1462 | 1600 | elseif (!empty($modSettings['mail_failed_attempts'])) |
1463 | - updateSuccessQueue(); |
|
1601 | + { |
|
1602 | + updateSuccessQueue(); |
|
1603 | + } |
|
1464 | 1604 | |
1465 | 1605 | // Had something to send... |
1466 | 1606 | return true; |
@@ -1511,7 +1651,9 @@ discard block |
||
1511 | 1651 | global $txt; |
1512 | 1652 | |
1513 | 1653 | if ($time_diff < 0) |
1514 | - $time_diff = 0; |
|
1654 | + { |
|
1655 | + $time_diff = 0; |
|
1656 | + } |
|
1515 | 1657 | |
1516 | 1658 | // Just do a bit of an if fest... |
1517 | 1659 | if ($time_diff > 86400) |
@@ -1532,6 +1674,7 @@ discard block |
||
1532 | 1674 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
1533 | 1675 | } |
1534 | 1676 | // Otherwise must be second |
1535 | - else |
|
1536 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
1537 | -} |
|
1677 | + else { |
|
1678 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
1679 | + } |
|
1680 | + } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * Icons that are default with ElkArte |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - protected $_stable_icons = array(); |
|
44 | + protected $_stable_icons = array(); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Icons to load in addition to the default |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if ($this->_allowCustomIcons()) |
104 | 104 | { |
105 | 105 | // Merge in additional ones |
106 | - $custom_icons = array_map(function ($element) { |
|
106 | + $custom_icons = array_map(function($element) { |
|
107 | 107 | return $element['value']; |
108 | 108 | }, $this->_custom_icons); |
109 | 109 |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | global $modSettings, $scripturl; |
251 | 251 | |
252 | - return static function ($tag, &$data, $disabled) use ($modSettings, $scripturl) { |
|
252 | + return static function($tag, &$data, $disabled) use ($modSettings, $scripturl) { |
|
253 | 253 | $num = $data; |
254 | 254 | $attachment = []; |
255 | 255 | $preview = self::isPreview($num); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | { |
326 | 326 | global $txt, $scripturl; |
327 | 327 | |
328 | - return static function ($tag, &$data) use ($txt, $scripturl) { |
|
328 | + return static function($tag, &$data) use ($txt, $scripturl) { |
|
329 | 329 | $num = $data; |
330 | 330 | $attachment = false; |
331 | 331 |
@@ -174,7 +174,7 @@ |
||
174 | 174 | { |
175 | 175 | // Now loop through the remaining (database-based) settings. |
176 | 176 | $this->configVars = array_map( |
177 | - function ($configVar) |
|
177 | + function($configVar) |
|
178 | 178 | { |
179 | 179 | // We just saved the file-based settings, so skip their definitions. |
180 | 180 | if (!is_array($configVar) || $configVar[2] === 'file') |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | global $context; |
104 | 104 | |
105 | 105 | $inlinePermissions = array_filter($this->configVars, |
106 | - function ($configVar) |
|
106 | + function($configVar) |
|
107 | 107 | { |
108 | 108 | return isset($configVar[0]) && $configVar[0] === 'permissions'; |
109 | 109 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | global $helptxt, $modSettings; |
315 | 315 | |
316 | 316 | $bbcChoice = array_filter($this->configVars, |
317 | - function ($configVar) |
|
317 | + function($configVar) |
|
318 | 318 | { |
319 | 319 | return isset($configVar[0]) && $configVar[0] === 'bbc'; |
320 | 320 | } |