@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The news dispatcher; doesn't do anything, just delegates. |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | // Force the right area... |
| 70 | - if (substr($_REQUEST['sa'], 0, 7) == 'mailing') |
|
| 71 | - $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 71 | + if (substr($_REQUEST['sa'], 0, 7) == 'mailing') { |
|
| 72 | + $context[$context['admin_menu_name']]['current_subsection'] = 'mailingmembers'; |
|
| 73 | + } |
|
| 72 | 74 | |
| 73 | 75 | call_helper($subActions[$_REQUEST['sa']][0]); |
| 74 | 76 | } |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | $temp_news = explode("\n", $modSettings['news']); |
| 100 | 102 | |
| 101 | 103 | // Remove the items that were selected. |
| 102 | - foreach ($temp_news as $i => $news) |
|
| 103 | - if (in_array($i, $_POST['remove'])) |
|
| 104 | + foreach ($temp_news as $i => $news) { |
|
| 105 | + if (in_array($i, $_POST['remove'])) |
|
| 104 | 106 | unset($temp_news[$i]); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | // Update the database. |
| 107 | 110 | updateSettings(array('news' => implode("\n", $temp_news))); |
@@ -117,9 +120,9 @@ discard block |
||
| 117 | 120 | |
| 118 | 121 | foreach ($_POST['news'] as $i => $news) |
| 119 | 122 | { |
| 120 | - if (trim($news) == '') |
|
| 121 | - unset($_POST['news'][$i]); |
|
| 122 | - else |
|
| 123 | + if (trim($news) == '') { |
|
| 124 | + unset($_POST['news'][$i]); |
|
| 125 | + } else |
|
| 123 | 126 | { |
| 124 | 127 | $_POST['news'][$i] = $smcFunc['htmlspecialchars']($_POST['news'][$i], ENT_QUOTES); |
| 125 | 128 | preparsecode($_POST['news'][$i]); |
@@ -155,12 +158,13 @@ discard block |
||
| 155 | 158 | 'data' => array( |
| 156 | 159 | 'function' => function($news) |
| 157 | 160 | { |
| 158 | - if (is_numeric($news['id'])) |
|
| 159 | - return ' |
|
| 161 | + if (is_numeric($news['id'])) { |
|
| 162 | + return ' |
|
| 160 | 163 | <textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
| 161 | 164 | <div class="floatleft" id="preview_' . $news['id'] . '"></div>'; |
| 162 | - else |
|
| 163 | - return $news['unparsed']; |
|
| 165 | + } else { |
|
| 166 | + return $news['unparsed']; |
|
| 167 | + } |
|
| 164 | 168 | }, |
| 165 | 169 | 'class' => 'half_table', |
| 166 | 170 | ), |
@@ -186,10 +190,11 @@ discard block |
||
| 186 | 190 | 'data' => array( |
| 187 | 191 | 'function' => function($news) |
| 188 | 192 | { |
| 189 | - if (is_numeric($news['id'])) |
|
| 190 | - return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 191 | - else |
|
| 192 | - return ''; |
|
| 193 | + if (is_numeric($news['id'])) { |
|
| 194 | + return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '">'; |
|
| 195 | + } else { |
|
| 196 | + return ''; |
|
| 197 | + } |
|
| 193 | 198 | }, |
| 194 | 199 | 'class' => 'centercol icon', |
| 195 | 200 | ), |
@@ -283,12 +288,13 @@ discard block |
||
| 283 | 288 | |
| 284 | 289 | $admin_current_news = array(); |
| 285 | 290 | // Ready the current news. |
| 286 | - foreach (explode("\n", $modSettings['news']) as $id => $line) |
|
| 287 | - $admin_current_news[$id] = array( |
|
| 291 | + foreach (explode("\n", $modSettings['news']) as $id => $line) { |
|
| 292 | + $admin_current_news[$id] = array( |
|
| 288 | 293 | 'id' => $id, |
| 289 | 294 | 'unparsed' => un_preparsecode($line), |
| 290 | 295 | 'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext"><$1form></em>', parse_bbc($line)), |
| 291 | 296 | ); |
| 297 | + } |
|
| 292 | 298 | |
| 293 | 299 | $admin_current_news['last'] = array( |
| 294 | 300 | 'id' => 'last', |
@@ -355,10 +361,11 @@ discard block |
||
| 355 | 361 | 'member_count' => 0, |
| 356 | 362 | ); |
| 357 | 363 | |
| 358 | - if ($row['min_posts'] == -1) |
|
| 359 | - $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 360 | - else |
|
| 361 | - $postGroups[$row['id_group']] = $row['id_group']; |
|
| 364 | + if ($row['min_posts'] == -1) { |
|
| 365 | + $normalGroups[$row['id_group']] = $row['id_group']; |
|
| 366 | + } else { |
|
| 367 | + $postGroups[$row['id_group']] = $row['id_group']; |
|
| 368 | + } |
|
| 362 | 369 | } |
| 363 | 370 | $smcFunc['db_free_result']($request); |
| 364 | 371 | |
@@ -374,8 +381,9 @@ discard block |
||
| 374 | 381 | 'post_group_list' => $postGroups, |
| 375 | 382 | ) |
| 376 | 383 | ); |
| 377 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 378 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 384 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 385 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 386 | + } |
|
| 379 | 387 | $smcFunc['db_free_result']($query); |
| 380 | 388 | } |
| 381 | 389 | |
@@ -391,8 +399,9 @@ discard block |
||
| 391 | 399 | 'normal_group_list' => $normalGroups, |
| 392 | 400 | ) |
| 393 | 401 | ); |
| 394 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 395 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 402 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 403 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 404 | + } |
|
| 396 | 405 | $smcFunc['db_free_result']($query); |
| 397 | 406 | |
| 398 | 407 | // Also do those who have it as an additional membergroup - this ones more yucky... |
@@ -409,8 +418,9 @@ discard block |
||
| 409 | 418 | 'blank_string' => '', |
| 410 | 419 | ) |
| 411 | 420 | ); |
| 412 | - while ($row = $smcFunc['db_fetch_assoc']($query)) |
|
| 413 | - $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 421 | + while ($row = $smcFunc['db_fetch_assoc']($query)) { |
|
| 422 | + $context['groups'][$row['id_group']]['member_count'] += $row['member_count']; |
|
| 423 | + } |
|
| 414 | 424 | $smcFunc['db_free_result']($query); |
| 415 | 425 | } |
| 416 | 426 | |
@@ -461,10 +471,11 @@ discard block |
||
| 461 | 471 | { |
| 462 | 472 | $context[$key] = !empty($_REQUEST[$post]) ? $_REQUEST[$post] : ''; |
| 463 | 473 | |
| 464 | - if (empty($context[$key]) && empty($_REQUEST['xml'])) |
|
| 465 | - $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 466 | - elseif (!empty($_REQUEST['xml'])) |
|
| 467 | - continue; |
|
| 474 | + if (empty($context[$key]) && empty($_REQUEST['xml'])) { |
|
| 475 | + $context['post_error']['messages'][] = $txt['error_no_' . $post]; |
|
| 476 | + } elseif (!empty($_REQUEST['xml'])) { |
|
| 477 | + continue; |
|
| 478 | + } |
|
| 468 | 479 | |
| 469 | 480 | preparsecode($context[$key]); |
| 470 | 481 | if ($html) |
@@ -543,10 +554,12 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | // Start by finding any members! |
| 545 | 556 | $toClean = array(); |
| 546 | - if (!empty($_POST['members'])) |
|
| 547 | - $toClean[] = 'members'; |
|
| 548 | - if (!empty($_POST['exclude_members'])) |
|
| 549 | - $toClean[] = 'exclude_members'; |
|
| 557 | + if (!empty($_POST['members'])) { |
|
| 558 | + $toClean[] = 'members'; |
|
| 559 | + } |
|
| 560 | + if (!empty($_POST['exclude_members'])) { |
|
| 561 | + $toClean[] = 'exclude_members'; |
|
| 562 | + } |
|
| 550 | 563 | if (!empty($toClean)) |
| 551 | 564 | { |
| 552 | 565 | require_once($sourcedir . '/Subs-Auth.php'); |
@@ -558,11 +571,13 @@ discard block |
||
| 558 | 571 | preg_match_all('~"([^"]+)"~', $_POST[$type], $matches); |
| 559 | 572 | $_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type])))); |
| 560 | 573 | |
| 561 | - foreach ($_POST[$type] as $index => $member) |
|
| 562 | - if (strlen(trim($member)) > 0) |
|
| 574 | + foreach ($_POST[$type] as $index => $member) { |
|
| 575 | + if (strlen(trim($member)) > 0) |
|
| 563 | 576 | $_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member))); |
| 564 | - else |
|
| 565 | - unset($_POST[$type][$index]); |
|
| 577 | + } |
|
| 578 | + else { |
|
| 579 | + unset($_POST[$type][$index]); |
|
| 580 | + } |
|
| 566 | 581 | |
| 567 | 582 | // Find the members |
| 568 | 583 | $_POST[$type] = implode(',', array_keys(findMembers($_POST[$type]))); |
@@ -572,16 +587,18 @@ discard block |
||
| 572 | 587 | if (isset($_POST['member_list']) && is_array($_POST['member_list'])) |
| 573 | 588 | { |
| 574 | 589 | $members = array(); |
| 575 | - foreach ($_POST['member_list'] as $member_id) |
|
| 576 | - $members[] = (int) $member_id; |
|
| 590 | + foreach ($_POST['member_list'] as $member_id) { |
|
| 591 | + $members[] = (int) $member_id; |
|
| 592 | + } |
|
| 577 | 593 | $_POST['members'] = implode(',', $members); |
| 578 | 594 | } |
| 579 | 595 | |
| 580 | 596 | if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list'])) |
| 581 | 597 | { |
| 582 | 598 | $members = array(); |
| 583 | - foreach ($_POST['exclude_member_list'] as $member_id) |
|
| 584 | - $members[] = (int) $member_id; |
|
| 599 | + foreach ($_POST['exclude_member_list'] as $member_id) { |
|
| 600 | + $members[] = (int) $member_id; |
|
| 601 | + } |
|
| 585 | 602 | $_POST['exclude_members'] = implode(',', $members); |
| 586 | 603 | } |
| 587 | 604 | |
@@ -605,8 +622,9 @@ discard block |
||
| 605 | 622 | 'current_time' => time(), |
| 606 | 623 | ) |
| 607 | 624 | ); |
| 608 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 609 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 625 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 626 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 627 | + } |
|
| 610 | 628 | $smcFunc['db_free_result']($request); |
| 611 | 629 | |
| 612 | 630 | $request = $smcFunc['db_query']('', ' |
@@ -641,8 +659,9 @@ discard block |
||
| 641 | 659 | WHERE email_address IN(' . implode(', ', $condition_array) . ')', |
| 642 | 660 | $condition_array_params |
| 643 | 661 | ); |
| 644 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 645 | - $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 662 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 663 | + $context['recipients']['exclude_members'][] = $row['id_member']; |
|
| 664 | + } |
|
| 646 | 665 | $smcFunc['db_free_result']($request); |
| 647 | 666 | } |
| 648 | 667 | |
@@ -660,10 +679,11 @@ discard block |
||
| 660 | 679 | ); |
| 661 | 680 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 662 | 681 | { |
| 663 | - if (in_array(3, $context['recipients'])) |
|
| 664 | - $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 665 | - else |
|
| 666 | - $context['recipients']['members'][] = $row['identifier']; |
|
| 682 | + if (in_array(3, $context['recipients'])) { |
|
| 683 | + $context['recipients']['exclude_members'][] = $row['identifier']; |
|
| 684 | + } else { |
|
| 685 | + $context['recipients']['members'][] = $row['identifier']; |
|
| 686 | + } |
|
| 667 | 687 | } |
| 668 | 688 | $smcFunc['db_free_result']($request); |
| 669 | 689 | } |
@@ -710,8 +730,9 @@ discard block |
||
| 710 | 730 | $num_at_once = 1000; |
| 711 | 731 | |
| 712 | 732 | // If by PM's I suggest we half the above number. |
| 713 | - if (!empty($_POST['send_pm'])) |
|
| 714 | - $num_at_once /= 2; |
|
| 733 | + if (!empty($_POST['send_pm'])) { |
|
| 734 | + $num_at_once /= 2; |
|
| 735 | + } |
|
| 715 | 736 | |
| 716 | 737 | checkSession(); |
| 717 | 738 | |
@@ -734,8 +755,7 @@ discard block |
||
| 734 | 755 | ); |
| 735 | 756 | list ($context['total_members']) = $smcFunc['db_fetch_row']($request); |
| 736 | 757 | $smcFunc['db_free_result']($request); |
| 737 | - } |
|
| 738 | - else |
|
| 758 | + } else |
|
| 739 | 759 | { |
| 740 | 760 | $context['total_members'] = (int) $_REQUEST['total_members']; |
| 741 | 761 | } |
@@ -753,32 +773,35 @@ discard block |
||
| 753 | 773 | if (!empty($_POST['exclude_members'])) |
| 754 | 774 | { |
| 755 | 775 | $members = explode(',', $_POST['exclude_members']); |
| 756 | - foreach ($members as $member) |
|
| 757 | - if ($member >= $context['start']) |
|
| 776 | + foreach ($members as $member) { |
|
| 777 | + if ($member >= $context['start']) |
|
| 758 | 778 | $context['recipients']['exclude_members'][] = (int) $member; |
| 779 | + } |
|
| 759 | 780 | } |
| 760 | 781 | |
| 761 | 782 | // What about members we *must* do? |
| 762 | 783 | if (!empty($_POST['members'])) |
| 763 | 784 | { |
| 764 | 785 | $members = explode(',', $_POST['members']); |
| 765 | - foreach ($members as $member) |
|
| 766 | - if ($member >= $context['start']) |
|
| 786 | + foreach ($members as $member) { |
|
| 787 | + if ($member >= $context['start']) |
|
| 767 | 788 | $context['recipients']['members'][] = (int) $member; |
| 789 | + } |
|
| 768 | 790 | } |
| 769 | 791 | // Cleaning groups is simple - although deal with both checkbox and commas. |
| 770 | 792 | if (isset($_POST['groups'])) |
| 771 | 793 | { |
| 772 | 794 | if (is_array($_POST['groups'])) |
| 773 | 795 | { |
| 774 | - foreach ($_POST['groups'] as $group => $dummy) |
|
| 775 | - $context['recipients']['groups'][] = (int) $group; |
|
| 776 | - } |
|
| 777 | - else |
|
| 796 | + foreach ($_POST['groups'] as $group => $dummy) { |
|
| 797 | + $context['recipients']['groups'][] = (int) $group; |
|
| 798 | + } |
|
| 799 | + } else |
|
| 778 | 800 | { |
| 779 | 801 | $groups = explode(',', $_POST['groups']); |
| 780 | - foreach ($groups as $group) |
|
| 781 | - $context['recipients']['groups'][] = (int) $group; |
|
| 802 | + foreach ($groups as $group) { |
|
| 803 | + $context['recipients']['groups'][] = (int) $group; |
|
| 804 | + } |
|
| 782 | 805 | } |
| 783 | 806 | } |
| 784 | 807 | // Same for excluded groups |
@@ -786,15 +809,17 @@ discard block |
||
| 786 | 809 | { |
| 787 | 810 | if (is_array($_POST['exclude_groups'])) |
| 788 | 811 | { |
| 789 | - foreach ($_POST['exclude_groups'] as $group => $dummy) |
|
| 790 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 812 | + foreach ($_POST['exclude_groups'] as $group => $dummy) { |
|
| 813 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 814 | + } |
|
| 791 | 815 | } |
| 792 | 816 | // Ignore an empty string - we don't want to exclude "Regular Members" unless it's specifically selected |
| 793 | 817 | elseif ($_POST['exclude_groups'] != '') |
| 794 | 818 | { |
| 795 | 819 | $groups = explode(',', $_POST['exclude_groups']); |
| 796 | - foreach ($groups as $group) |
|
| 797 | - $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 820 | + foreach ($groups as $group) { |
|
| 821 | + $context['recipients']['exclude_groups'][] = (int) $group; |
|
| 822 | + } |
|
| 798 | 823 | } |
| 799 | 824 | } |
| 800 | 825 | // Finally - emails! |
@@ -804,14 +829,16 @@ discard block |
||
| 804 | 829 | foreach ($addressed as $curmem) |
| 805 | 830 | { |
| 806 | 831 | $curmem = trim($curmem); |
| 807 | - if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) |
|
| 808 | - $context['recipients']['emails'][$curmem] = $curmem; |
|
| 832 | + if ($curmem != '' && filter_var($curmem, FILTER_VALIDATE_EMAIL)) { |
|
| 833 | + $context['recipients']['emails'][$curmem] = $curmem; |
|
| 834 | + } |
|
| 809 | 835 | } |
| 810 | 836 | } |
| 811 | 837 | |
| 812 | 838 | // If we're only cleaning drop out here. |
| 813 | - if ($clean_only) |
|
| 814 | - return; |
|
| 839 | + if ($clean_only) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 815 | 842 | |
| 816 | 843 | require_once($sourcedir . '/Subs-Post.php'); |
| 817 | 844 | |
@@ -827,16 +854,18 @@ discard block |
||
| 827 | 854 | if (!$context['send_pm'] && !empty($_POST['send_html'])) |
| 828 | 855 | { |
| 829 | 856 | // Prepare the message for HTML. |
| 830 | - if (!empty($_POST['parse_html'])) |
|
| 831 | - $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 857 | + if (!empty($_POST['parse_html'])) { |
|
| 858 | + $_POST['message'] = str_replace(array("\n", ' '), array('<br>' . "\n", ' '), $_POST['message']); |
|
| 859 | + } |
|
| 832 | 860 | |
| 833 | 861 | // This is here to prevent spam filters from tagging this as spam. |
| 834 | 862 | if (preg_match('~\<html~i', $_POST['message']) == 0) |
| 835 | 863 | { |
| 836 | - if (preg_match('~\<body~i', $_POST['message']) == 0) |
|
| 837 | - $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 838 | - else |
|
| 839 | - $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 864 | + if (preg_match('~\<body~i', $_POST['message']) == 0) { |
|
| 865 | + $_POST['message'] = '<html><head><title>' . $_POST['subject'] . '</title></head>' . "\n" . '<body>' . $_POST['message'] . '</body></html>'; |
|
| 866 | + } else { |
|
| 867 | + $_POST['message'] = '<html>' . $_POST['message'] . '</html>'; |
|
| 868 | + } |
|
| 840 | 869 | } |
| 841 | 870 | } |
| 842 | 871 | |
@@ -890,15 +919,17 @@ discard block |
||
| 890 | 919 | foreach ($context['recipients']['emails'] as $k => $email) |
| 891 | 920 | { |
| 892 | 921 | // Done as many as we can? |
| 893 | - if ($i >= $num_at_once) |
|
| 894 | - break; |
|
| 922 | + if ($i >= $num_at_once) { |
|
| 923 | + break; |
|
| 924 | + } |
|
| 895 | 925 | |
| 896 | 926 | // Don't sent it twice! |
| 897 | 927 | unset($context['recipients']['emails'][$k]); |
| 898 | 928 | |
| 899 | 929 | // Dammit - can't PM emails! |
| 900 | - if ($context['send_pm']) |
|
| 901 | - continue; |
|
| 930 | + if ($context['send_pm']) { |
|
| 931 | + continue; |
|
| 932 | + } |
|
| 902 | 933 | |
| 903 | 934 | $to_member = array( |
| 904 | 935 | $email, |
@@ -932,8 +963,9 @@ discard block |
||
| 932 | 963 | $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}'; |
| 933 | 964 | } |
| 934 | 965 | } |
| 935 | - if (!empty($queryBuild)) |
|
| 936 | - $sendQuery .= implode(' OR ', $queryBuild); |
|
| 966 | + if (!empty($queryBuild)) { |
|
| 967 | + $sendQuery .= implode(' OR ', $queryBuild); |
|
| 968 | + } |
|
| 937 | 969 | } |
| 938 | 970 | if (!empty($context['recipients']['members'])) |
| 939 | 971 | { |
@@ -952,8 +984,9 @@ discard block |
||
| 952 | 984 | } |
| 953 | 985 | |
| 954 | 986 | // Anything to exclude? |
| 955 | - if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) |
|
| 956 | - $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 987 | + if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) { |
|
| 988 | + $sendQuery .= ' AND mem.id_group != {int:regular_group}'; |
|
| 989 | + } |
|
| 957 | 990 | if (!empty($context['recipients']['exclude_members'])) |
| 958 | 991 | { |
| 959 | 992 | $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})'; |
@@ -989,21 +1022,24 @@ discard block |
||
| 989 | 1022 | foreach ($rows as $row) |
| 990 | 1023 | { |
| 991 | 1024 | // Force them to have it? |
| 992 | - if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) |
|
| 993 | - continue; |
|
| 1025 | + if (empty($context['email_force']) && empty($prefs[$row['id_member']]['announcements'])) { |
|
| 1026 | + continue; |
|
| 1027 | + } |
|
| 994 | 1028 | |
| 995 | 1029 | // What groups are we looking at here? |
| 996 | - if (empty($row['additional_groups'])) |
|
| 997 | - $groups = array($row['id_group'], $row['id_post_group']); |
|
| 998 | - else |
|
| 999 | - $groups = array_merge( |
|
| 1030 | + if (empty($row['additional_groups'])) { |
|
| 1031 | + $groups = array($row['id_group'], $row['id_post_group']); |
|
| 1032 | + } else { |
|
| 1033 | + $groups = array_merge( |
|
| 1000 | 1034 | array($row['id_group'], $row['id_post_group']), |
| 1001 | 1035 | explode(',', $row['additional_groups']) |
| 1002 | 1036 | ); |
| 1037 | + } |
|
| 1003 | 1038 | |
| 1004 | 1039 | // Excluded groups? |
| 1005 | - if (array_intersect($groups, $context['recipients']['exclude_groups'])) |
|
| 1006 | - continue; |
|
| 1040 | + if (array_intersect($groups, $context['recipients']['exclude_groups'])) { |
|
| 1041 | + continue; |
|
| 1042 | + } |
|
| 1007 | 1043 | |
| 1008 | 1044 | // We might need this |
| 1009 | 1045 | $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name']; |
@@ -1026,10 +1062,11 @@ discard block |
||
| 1026 | 1062 | ), $_POST['subject']); |
| 1027 | 1063 | |
| 1028 | 1064 | // Send the actual email - or a PM! |
| 1029 | - if (!$context['send_pm']) |
|
| 1030 | - sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1031 | - else |
|
| 1032 | - sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1065 | + if (!$context['send_pm']) { |
|
| 1066 | + sendmail($row['email_address'], $subject, $message, null, 'news', !empty($_POST['send_html']), 5); |
|
| 1067 | + } else { |
|
| 1068 | + sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message); |
|
| 1069 | + } |
|
| 1033 | 1070 | } |
| 1034 | 1071 | } |
| 1035 | 1072 | |
@@ -1079,8 +1116,9 @@ discard block |
||
| 1079 | 1116 | |
| 1080 | 1117 | call_integration_hook('integrate_modify_news_settings', array(&$config_vars)); |
| 1081 | 1118 | |
| 1082 | - if ($return_config) |
|
| 1083 | - return $config_vars; |
|
| 1119 | + if ($return_config) { |
|
| 1120 | + return $config_vars; |
|
| 1121 | + } |
|
| 1084 | 1122 | |
| 1085 | 1123 | $context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings']; |
| 1086 | 1124 | $context['sub_template'] = 'show_settings'; |