$cid, 'uid' => $owner_id, 'blocked' => false])) { $remote_verified = true; $groups = Group::getIdsByContactId($cid); } } if ($remote_verified) { $gs = '<<>>'; // should be impossible to match if (is_array($groups)) { foreach ($groups as $g) { $gs .= '|<' . intval($g) . '>'; } } $sql = sprintf( " AND (NOT (deny_cid REGEXP '<%d>' OR deny_gid REGEXP '%s') AND (allow_cid REGEXP '<%d>' OR allow_gid REGEXP '%s' OR (allow_cid = '' AND allow_gid = ''))) ", intval($cid), DBA::escape($gs), intval($cid), DBA::escape($gs) ); } } return $sql; } }