From 82eb265a20d73beff7673299a6c4ab8a4d8b8673 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 17 Aug 2014 17:48:41 -0700 Subject: add collections widget to connections page - and some more work on realms --- include/widgets.php | 7 +++++++ include/zot.php | 16 +++++++++++++++- mod/connections.php | 3 +++ version.inc | 2 +- view/pdl/mod_connections.pdl | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/widgets.php b/include/widgets.php index 96bced87f..1aa018fb6 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -48,6 +48,13 @@ function widget_collections($args) { $abook_id = 0; $wmode = 0; break; + case 'connections': + $every = 'connections'; + $each = 'group'; + $edit = true; + $current = $_REQUEST['gid']; + $abook_id = 0; + $wmode = 0; case 'groups': $every = 'connections'; $each = argv(0); diff --git a/include/zot.php b/include/zot.php index bd9526f2d..8dcc19522 100644 --- a/include/zot.php +++ b/include/zot.php @@ -989,8 +989,22 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { // Are we a directory server of some kind? + $other_realm = false; + $realm = get_directory_realm(); + if(array_key_exists('site',$arr) + && array_key_exists('realm',$arr['site']) + && (strpos($arr['site']['realm'],$realm) !== false)) + $other_realm = true; + if($dirmode != DIRECTORY_MODE_NORMAL) { - if(array_key_exists('profile',$arr) && is_array($arr['profile'])) { + + // We're some kind of directory server. However we can only add directory information + // if the entry is in the same realm (or is a sub-realm). Sub-realms are denoted by + // including the parent realm in the name. e.g. 'RED_GLOBAL:foo' would allow an entry to + // be in directories for the local realm (foo) and also the RED_GLOBAL realm. + + + if(array_key_exists('profile',$arr) && is_array($arr['profile']) && (! $other_realm)) { $profile_changed = import_directory_profile($xchan_hash,$arr['profile'],$address,$ud_flags, 1); if($profile_changed) { $what .= 'profile '; diff --git a/mod/connections.php b/mod/connections.php index 1875ed908..028889647 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -337,6 +337,9 @@ function connections_content(&$a) { } $sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : ""); + if($_REQUEST['gid']) { + $sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_user()) . " ) "; + } $r = q("SELECT COUNT(abook.abook_id) AS total 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 ) $sql_extra $sql_extra2 ", diff --git a/version.inc b/version.inc index 652a04db0..6d17789e1 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-08-16.769 +2014-08-17.770 diff --git a/view/pdl/mod_connections.pdl b/view/pdl/mod_connections.pdl index fc86e4490..fd3f25483 100644 --- a/view/pdl/mod_connections.pdl +++ b/view/pdl/mod_connections.pdl @@ -1,5 +1,6 @@ [region=aside] [widget=follow][/widget] +[widget=collections][var=mode][connections[/arg][/widget] [widget=suggestions][/widget] [widget=findpeople][/widget] [/region] -- cgit v1.2.3