diff options
author | friendica <info@friendica.com> | 2014-05-08 17:08:34 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-08 17:08:34 -0700 |
commit | 2fe8bae7a59ae61b2b0708a480d250e46dab7673 (patch) | |
tree | 5c2a12c3e646ec08d87de75890df7c1c938260ec /include | |
parent | 350e6490b8e2e5e0d0e6ed20bdc80d6c86b9a382 (diff) | |
download | volse-hubzilla-2fe8bae7a59ae61b2b0708a480d250e46dab7673.tar.gz volse-hubzilla-2fe8bae7a59ae61b2b0708a480d250e46dab7673.tar.bz2 volse-hubzilla-2fe8bae7a59ae61b2b0708a480d250e46dab7673.zip |
show hidden connections in contact block if and only if the observer is the profile owner
Diffstat (limited to 'include')
-rwxr-xr-x | include/text.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/text.php b/include/text.php index b36e550f9..0e136fe8e 100755 --- a/include/text.php +++ b/include/text.php @@ -705,12 +705,22 @@ function contact_block() { if($shown == 0) return; + + $is_owner = ((local_user() && local_user() == $a->profile['uid']) ? true : false); + + $abook_flags = ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF; + $xchan_flags = XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED; + if(! $is_owner) { + $abook_flags = $abook_flags | ABOOK_FLAGS_HIDDEN; + $xchan_flags = $xchan_flags | XCHAN_FLAGS_HIDDEN; + } + if((! is_array($a->profile)) || ($a->profile['hide_friends'])) return $o; $r = q("SELECT COUNT(abook_id) AS total FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and not ( abook_flags & %d ) and not (xchan_flags & %d)", intval($a->profile['uid']), - intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_HIDDEN|XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED) + intval($abook_flags), + intval($xchan_flags) ); if(count($r)) { $total = intval($r[0]['total']); @@ -723,8 +733,8 @@ function contact_block() { $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d AND not ( abook_flags & %d) and not (xchan_flags & %d ) ORDER BY RAND() LIMIT %d", intval($a->profile['uid']), - intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_HIDDEN|XCHAN_FLAGS_ORPHAN|XCHAN_FLAGS_DELETED), + intval($abook_flags), + intval($xchan_flags), intval($shown) ); |