aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-03-10 15:50:45 -0700
committerzotlabs <mike@macgirvin.com>2019-03-10 15:50:45 -0700
commitcada0b6df12dab6e91aa7b560eccdf9f334f2b98 (patch)
tree16dd75609a8a39a3c5b9ba467eb1af04be8809f5
parent51024d382172c5e2e62bacc6d9103a1caa40e4a5 (diff)
downloadvolse-hubzilla-cada0b6df12dab6e91aa7b560eccdf9f334f2b98.tar.gz
volse-hubzilla-cada0b6df12dab6e91aa7b560eccdf9f334f2b98.tar.bz2
volse-hubzilla-cada0b6df12dab6e91aa7b560eccdf9f334f2b98.zip
init_groups_visitor: include xchans from all zot-like networks
-rw-r--r--include/security.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/security.php b/include/security.php
index 493d34699..4af46c257 100644
--- a/include/security.php
+++ b/include/security.php
@@ -575,11 +575,29 @@ function init_groups_visitor($contact_id) {
}
}
- // physical groups this channel is a member of
-
- $r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan = '%s' ",
+ $x = q("select * from xchan where xchan_hash = '%s'",
dbesc($contact_id)
);
+
+ if (! $x) {
+ return $groups;
+ }
+
+ // include xchans for all zot-like networks
+
+ $xchans = q("select xchan_hash from xchan where xchan_hash = '%s' OR ( xchan_guid = '%s' AND xchan_pubkey = '%s' ) ",
+ dbesc($contact_id),
+ dbesc($x[0]['xchan_guid']),
+ dbesc($x[0]['xchan_pubkey'])
+ );
+
+ if($xchans) {
+ $hashes = ids_to_querystr($xchans,'xchan_hash',true);
+ }
+
+ // physical groups this identity is a member of
+
+ $r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan in ( " . protect_sprintf($hashes) . " ) " );
if($r) {
foreach($r as $rr)
$groups[] = $rr['hash'];