>'; // should be impossible to match $groups = Group::getIdsByContactId($remote_contact); 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($remote_contact), DBA::escape($gs), intval($remote_contact), DBA::escape($gs) ); } return $sql; } }