aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-04-10 11:58:29 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-04-10 11:58:29 -0400
commitd3b5df2548446c76e94e41837abc8b5a8d034b42 (patch)
tree0d4689df3fb430c72b6160322720af08006fc4b3 /phpBB/includes/acp
parentc910ce1cc6763bd31e7be6548f86b5c571c725c5 (diff)
parent83ca7305444e09180f0cee0352c4426bb72b793f (diff)
downloadforums-d3b5df2548446c76e94e41837abc8b5a8d034b42.tar
forums-d3b5df2548446c76e94e41837abc8b5a8d034b42.tar.gz
forums-d3b5df2548446c76e94e41837abc8b5a8d034b42.tar.bz2
forums-d3b5df2548446c76e94e41837abc8b5a8d034b42.tar.xz
forums-d3b5df2548446c76e94e41837abc8b5a8d034b42.zip
Merge branch 'ticket/erikfrerejean/9581' into develop-olympus
* ticket/erikfrerejean/9581: [ticket/9581] Fix missing index [ticket/9581] Slightly tweaked queries [ticket/9581] Make banlist table select optional [ticket/9581] Mass e-mail to banned users
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_email.php45
1 files changed, 35 insertions, 10 deletions
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index 350693a630..133fe47e09 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -82,23 +82,48 @@ class acp_email
{
if ($group_id)
{
- $sql = 'SELECT u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type
- FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
- WHERE ug.group_id = ' . $group_id . '
+ $sql_ary = array(
+ 'SELECT' => 'u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type',
+ 'FROM' => array(
+ USERS_TABLE => 'u',
+ USER_GROUP_TABLE => 'ug',
+ ),
+ 'WHERE' => 'ug.group_id = ' . $group_id . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_allow_massemail = 1
- AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
- ORDER BY u.user_lang, u.user_notify_type';
+ AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')',
+ 'ORDER_BY' => 'u.user_lang, u.user_notify_type',
+ );
}
else
{
- $sql = 'SELECT username, username_clean, user_email, user_jabber, user_notify_type, user_lang
- FROM ' . USERS_TABLE . '
- WHERE user_allow_massemail = 1
- AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
- ORDER BY user_lang, user_notify_type';
+ $sql_ary = array(
+ 'SELECT' => 'u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type',
+ 'FROM' => array(
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => 'u.user_allow_massemail = 1
+ AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')',
+ 'ORDER_BY' => 'u.user_lang, u.user_notify_type',
+ );
}
+
+ // Mail banned or not
+ if (!isset($_REQUEST['mail_banned_flag']))
+ {
+ $sql_ary['WHERE'] .= ' AND (b.ban_id IS NULL
+ OR b.ban_exclude = 1)';
+ $sql_ary['LEFT_JOIN'] = array(
+ array(
+ 'FROM' => array(
+ BANLIST_TABLE => 'b',
+ ),
+ 'ON' => 'u.user_id = b.ban_userid',
+ ),
+ );
+ }
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);