From 7038ad2e5967e8f88341cede961c1efa3f910b15 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 19 Feb 2013 23:31:26 -0800 Subject: set xchan hidden flag correctly when local directory update --- include/dir_fns.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/dir_fns.php') diff --git a/include/dir_fns.php b/include/dir_fns.php index be1bcd503..2444e29ce 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -39,6 +39,26 @@ function syncdirs($uid) { $profile['keywords'] = $tags; } + $hidden = (1 - intval($p[0]['publish'])); + + $r = q("select xchan_flags from xchan where xchan_hash = '%s' limit 1", + dbesc($p[0]['channel_hash']) + ); + + // Be careful - XCHAN_FLAGS_HIDDEN should evaluate to 1 + if(($r[0]['xchan_flags'] & XCHAN_FLAGS_HIDDEN) != $hidden) + $new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_HIDDEN; + else + $new_flags = $r[0]['xchan_flags']; + + if($new_flags != $r[0]['xchan_flags']) { + $r = q("update xchan set xchan_flags = %d where xchan_hash = '%s' limit 1", + intval($new_flags), + dbesc($xchan_hash) + ); + } + + if(perm_is_allowed($uid,'','view_profile')) { import_directory_profile($hash,$profile); -- cgit v1.2.3