Exemplo n.º 1
0
function expand_groups($a, $check_dead = false)
{
    if (!(is_array($a) && count($a))) {
        return array();
    }
    $groups = implode(',', $a);
    $groups = dbesc($groups);
    $r = q("SELECT `contact-id` FROM `group_member` WHERE `gid` IN ( {$groups} )");
    $ret = array();
    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;
}
Exemplo n.º 2
0
function get_acl_permissions($user = null)
{
    $allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
    if (is_array($user)) {
        $allow_cid = strlen($user['allow_cid']) ? explode('><', $user['allow_cid']) : array();
        $allow_gid = strlen($user['allow_gid']) ? explode('><', $user['allow_gid']) : array();
        $deny_cid = strlen($user['deny_cid']) ? explode('><', $user['deny_cid']) : array();
        $deny_gid = strlen($user['deny_gid']) ? explode('><', $user['deny_gid']) : array();
        array_walk($allow_cid, 'fixacl');
        array_walk($allow_gid, 'fixacl');
        array_walk($deny_cid, 'fixacl');
        array_walk($deny_gid, 'fixacl');
    }
    $allow_cid = prune_deadguys($allow_cid);
    return array('allow_cid' => $allow_cid, 'allow_gid' => $allow_gid, 'deny_cid' => $deny_cid, 'deny_gid' => $deny_gid);
}