diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 461ad0c36..675339559 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -227,6 +227,23 @@ function fixacl(&$item) { $item = intval(str_replace(array('<','>'),array('',''),$item)); } +function prune_deadguys($arr) { + + if(! $arr) + return $arr; + $str = dbesc(implode(',',$arr)); + $r = q("select id from contact where id in ( " . $str . ") and blocked = 0 and pending = 0 and archive = 0 "); + if($r) { + $ret = array(); + foreach($r as $rr) + $ret[] = $rr['id']; + return $ret; + } + return array(); +} + + + function populate_acl($user = null,$celeb = false) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; @@ -246,6 +263,14 @@ function populate_acl($user = null,$celeb = false) { array_walk($deny_gid,'fixacl'); } + $allow_cid = prune_deadguys($allow_cid); + + // We shouldn't need to prune deadguys from the block list. Either way they can't get the message. + // Also no point enumerating groups and checking them, that will take place on delivery. + +// $deny_cid = prune_deadguys($deny_cid); + + /*$o = ''; $o .= '
'; $o .= '
'; diff --git a/include/group.php b/include/group.php index 7ede242c0..aa226688a 100644 --- a/include/group.php +++ b/include/group.php @@ -279,7 +279,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0 return $o; } -function expand_groups($a) { +function expand_groups($a,$check_dead = false) { if(! (is_array($a) && count($a))) return array(); $groups = implode(',', $a); @@ -289,6 +289,10 @@ function expand_groups($a) { if(count($r)) foreach($r as $rr) $ret[] = $rr['contact-id']; + if($check_dead) { + require_once('include/acl_selectors.php'); + $ret = prune_deadguys($ret); + } return $ret; } diff --git a/include/notifier.php b/include/notifier.php index 091d09b56..3398254b6 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -309,7 +309,7 @@ function notifier_run(&$argv, &$argc){ } $allow_people = expand_acl($parent['allow_cid']); - $allow_groups = expand_groups(expand_acl($parent['allow_gid'])); + $allow_groups = expand_groups(expand_acl($parent['allow_gid']),true); $deny_people = expand_acl($parent['deny_cid']); $deny_groups = expand_groups(expand_acl($parent['deny_gid']));