1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/8323] Allow sending PMs to temporarily banned users

Added an argument to the phpbb_get_banned_user_ids() function to allow specifying a banned end time (default true for current functionality, false for only permanent bans, timestamp to find banned until a specified time)

PHPBB3-8323
This commit is contained in:
Nathan
2012-07-10 09:58:10 -05:00
parent 0f4956b280
commit 362ba43f18
5 changed files with 39 additions and 18 deletions

View File

@@ -269,46 +269,46 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
case RULE_IS_LIKE:
$result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_IS_NOT_LIKE:
$result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_IS:
$result = ($check0 == $rule_row['rule_string']);
break;
case RULE_IS_NOT:
$result = ($check0 != $rule_row['rule_string']);
break;
case RULE_BEGINS_WITH:
$result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0);
break;
case RULE_ENDS_WITH:
$result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0);
break;
case RULE_IS_FRIEND:
case RULE_IS_FOE:
case RULE_ANSWERED:
case RULE_FORWARDED:
$result = ($check0 == 1);
break;
case RULE_IS_USER:
$result = ($check0 == $rule_row['rule_user_id']);
break;
case RULE_IS_GROUP:
$result = in_array($rule_row['rule_group_id'], $check0);
break;
case RULE_TO_GROUP:
$result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']]));
break;
case RULE_TO_ME:
$result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']]));
break;
@@ -1828,11 +1828,12 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
return;
}
// Get permanently banned users (do not allow sending to these users)
if (!function_exists('phpbb_get_banned_user_ids'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
}
$banned_users = phpbb_get_banned_user_ids(array_keys($recipients));
$banned_users = phpbb_get_banned_user_ids(array_keys($recipients), false);
$recipients = array_diff(array_keys($recipients), $banned_users);
if (!sizeof($recipients))