aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorn-aleha <nick_aleha@myway.com>2014-05-05 19:36:21 +0300
committern-aleha <nick_aleha@myway.com>2014-05-07 23:00:42 +0300
commit0166493a897c66c5e387aac06a8e2ae2bc17b63f (patch)
treea34c0b9ffcf3766593c7107bbb22e54154d2216b /phpBB/includes
parent324daf72fec829a4a937879ef0615829443114cc (diff)
downloadforums-0166493a897c66c5e387aac06a8e2ae2bc17b63f.tar
forums-0166493a897c66c5e387aac06a8e2ae2bc17b63f.tar.gz
forums-0166493a897c66c5e387aac06a8e2ae2bc17b63f.tar.bz2
forums-0166493a897c66c5e387aac06a8e2ae2bc17b63f.tar.xz
forums-0166493a897c66c5e387aac06a8e2ae2bc17b63f.zip
[ticket/12493] Fix sql query for selection of users that have disabled PM
This fixes a bug where a user A could not send a PM to user B when both users allowed other users to send them a PM. More precisely, it fixes the selection of users that either are inactive or have disabled private messages. PHPBB3-12493
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 3219771c93..16b3ca8573 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -1226,6 +1226,8 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
// Check for disallowed recipients
if (!empty($address_list['u']))
{
+ $can_ignore_allow_pm = $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_');
+
// Administrator deactivated users check and we need to check their
// PM status (do they want to receive PM's?)
// Only check PM status if not a moderator or admin, since they
@@ -1233,14 +1235,11 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
$sql = 'SELECT user_id, user_allow_pm
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . '
- AND (user_type = ' . USER_INACTIVE . '
- AND user_inactive_reason = ' . INACTIVE_MANUAL . ')';
-
- $can_ignore_allow_pm = ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
- if (!$can_ignore_allow_pm)
- {
- $sql .= ' OR user_allow_pm = 0';
- }
+ AND (
+ (user_type = ' . USER_INACTIVE . '
+ AND user_inactive_reason = ' . INACTIVE_MANUAL . ')
+ ' . ($can_ignore_allow_pm ? '' : ' OR user_allow_pm = 0') . '
+ )';
$result = $db->sql_query($sql);