diff options
Diffstat (limited to 'mod/acl.php')
-rw-r--r-- | mod/acl.php | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/mod/acl.php b/mod/acl.php index e919bb912..6383d774c 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -90,23 +90,21 @@ function acl_init(&$a){ // Getting info from the abook is better for local users because it contains info about permissions if(local_channel()) { if($extra_channels_sql != '') - $extra_channels_sql = " OR (abook_channel IN ($extra_channels_sql)) and not (abook_flags & ". intval(ABOOK_FLAG_HIDDEN) . ') > 0'; + $extra_channels_sql = " OR (abook_channel IN ($extra_channels_sql)) and abook_hidden = 0 "; $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags FROM abook left join xchan on abook_xchan = xchan_hash - WHERE (abook_channel = %d $extra_channels_sql) AND not ( abook_flags & %d )>0 and not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , - intval(local_channel()), - intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED), - intval(XCHAN_FLAGS_DELETED) + WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + intval(local_channel()) ); } else { // Visitors $r = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags FROM xchan left join xlink on xlink_link = xchan_hash - WHERE xlink_xchan = '%s' AND NOT (xchan_flags & %d) > 0 $sql_extra2 order by $order_extra2 xchan_name asc" , - dbesc(get_observer_hash()), - intval(XCHAN_FLAGS_DELETED)); + WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + dbesc(get_observer_hash()) + ); // Find contacts of extra channels // This is probably more complicated than it needs to be @@ -120,10 +118,7 @@ function acl_init(&$a){ $r2 = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND not ( abook_flags & %d )>0 and not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , - intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_HIDDEN), - intval(XCHAN_FLAGS_DELETED) - ); + WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and abook_hidden = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"); if($r2) $r = array_merge($r,$r2); @@ -152,8 +147,7 @@ function acl_init(&$a){ if((count($r) < 100) && $type == 'c') { $r2 = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags FROM xchan - WHERE not (xchan_flags & %d )>0 $sql_extra2 order by $order_extra2 xchan_name asc" , - intval(XCHAN_FLAGS_DELETED) + WHERE xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" ); if($r2) $r = array_merge($r,$r2); @@ -165,24 +159,21 @@ function acl_init(&$a){ $r = q("SELECT xchan_hash as id, xchan_name as name, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and ( (abook_their_perms = null) or (abook_their_perms & %d )>0) - and not (xchan_flags & %d)>0 + and xchan_deleted = 0 $sql_extra3 ORDER BY `xchan_name` ASC ", intval(local_channel()), - intval(PERMS_W_MAIL), - intval(XCHAN_FLAGS_DELETED) + intval(PERMS_W_MAIL) ); } elseif(($type == 'a') || ($type == 'p')) { $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d - and not (xchan_flags & %d)>0 + and xchan_deleted = 0 $sql_extra3 ORDER BY xchan_name ASC ", - intval(local_channel()), - intval(XCHAN_FLAGS_DELETED) - + intval(local_channel()) ); } @@ -226,7 +217,7 @@ function acl_init(&$a){ "xid" => $g['hash'], "link" => $g['nick'], "nick" => substr($g['nick'],0,strpos($g['nick'],'@')), - "self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''), + "self" => (intval($g['abook_self']) ? 'abook-self' : ''), "taggable" => 'taggable', "label" => t('network') ); @@ -239,7 +230,7 @@ function acl_init(&$a){ "xid" => $g['hash'], "link" => $g['nick'], "nick" => (($g['nick']) ? substr($g['nick'],0,strpos($g['nick'],'@')) : t('RSS')), - "self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''), + "self" => (intval($g['abook_self']) ? 'abook-self' : ''), "taggable" => '', "label" => '', ); |