aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-08 20:08:50 -0800
committerfriendica <info@friendica.com>2013-12-08 20:08:50 -0800
commit082ac6777829c98ded48c271f4210ac5d6e1a68f (patch)
tree664a2ee7f0451640dac4d2672e40e3cfe044fcfb /include
parent8959487f1c7e5b785df2f8e7658da8b2534b2ad9 (diff)
downloadvolse-hubzilla-082ac6777829c98ded48c271f4210ac5d6e1a68f.tar.gz
volse-hubzilla-082ac6777829c98ded48c271f4210ac5d6e1a68f.tar.bz2
volse-hubzilla-082ac6777829c98ded48c271f4210ac5d6e1a68f.zip
suggestion widget tweaked to make it comanche capable. Remove old versions of specs that are so obsolete it isn't funny. Zot protocol reference is in red's github wiki, and in the code. We should move the github copy to /doc once it is updated to match the code. There's no point in documenting dfrn in the red code base.
Diffstat (limited to 'include')
-rw-r--r--include/contact_widgets.php52
-rwxr-xr-xinclude/items.php12
-rw-r--r--include/widgets.php53
3 files changed, 62 insertions, 55 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 2fa5dee0b..ac5382862 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -153,55 +153,3 @@ function common_friends_visitor_widget($profile_uid) {
};
-function suggest_widget() {
-
- require_once('include/socgraph.php');
-
- $r = suggestion_query(local_user(),get_observer_hash(),0,20);
-
- if(! $r) {
- return;
- }
-
- $arr = array();
-
- // Get two random entries from the top 20 returned.
- // We'll grab the first one and the one immediately following.
- // This will throw some entropy intot he situation so you won't
- // be looking at the same two mug shots every time the widget runs
-
-
- $index = ((count($r) > 2) ? mt_rand(0,count($r) - 2) : 0);
-
-
- for($x = $index; $x <= ($index+1); $x ++) {
-
- $rr = $r[$x];
- if(! $rr['xchan_url'])
- break;
-
- $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr'];
-
- $arr[] = array(
- 'url' => chanlink_url($rr['xchan_url']),
- 'profile' => $rr['xchan_url'],
- 'name' => $rr['xchan_name'],
- 'photo' => $rr['xchan_photo_m'],
- 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
- 'conntxt' => t('Connect'),
- 'connlnk' => $connlnk,
- 'ignore' => t('Ignore/Hide')
- );
- }
-
-
- $o = replace_macros(get_markup_template('suggest_widget.tpl'),array(
- '$title' => t('Suggestions'),
- '$more' => t('See more...'),
- '$entries' => $arr
- ));
-
- return $o;
-
-}
-
diff --git a/include/items.php b/include/items.php
index 4af544de1..dd3cf7644 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3692,6 +3692,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_options = '';
$sql_extra2 = '';
$sql_extra3 = '';
+ $def_acl = '';
+
$item_uids = ' true ';
if($channel) {
@@ -3708,7 +3710,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) ";
- if($arr['group'] && $uid) {
+ if($arr['gid'] && $uid) {
$r = q("SELECT * FROM `group` WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
intval($uid)
@@ -3718,7 +3720,6 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
return $result;
}
-
$contact_str = '';
$contacts = group_get_members($group);
if($contacts) {
@@ -3730,11 +3731,15 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
else {
$contact_str = ' 0 ';
- info( t('Group is empty'));
+ $result['message'] = t('Collection is empty.');
+ return $result;
}
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent and item_restrict = 0 ) ";
+ $x = group_rec_byhash($uid,$r[0]['hash']);
+ $result['headline'] = sprintf( t('Collection: %s'),$x['name']);
+
}
elseif($arr['cid'] && $uid) {
@@ -3744,6 +3749,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
);
if($r) {
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval($arr['uid']) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) and item_restrict = 0 ) ";
+ $result['headline'] = sprintf( t('Connection: %s'),$r[0]['xchan_name']);
}
else {
$result['message'] = t('Connection not found.');
diff --git a/include/widgets.php b/include/widgets.php
index 5be77498c..f152e8ee1 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -39,4 +39,57 @@ function widget_collections($args) {
return group_side($page,$page,true,$_REQUEST['gid'],'',0);
+}
+
+
+function widget_suggestions($arr) {
+
+ require_once('include/socgraph.php');
+
+ $r = suggestion_query(local_user(),get_observer_hash(),0,20);
+
+ if(! $r) {
+ return;
+ }
+
+ $arr = array();
+
+ // Get two random entries from the top 20 returned.
+ // We'll grab the first one and the one immediately following.
+ // This will throw some entropy intot he situation so you won't
+ // be looking at the same two mug shots every time the widget runs
+
+
+ $index = ((count($r) > 2) ? mt_rand(0,count($r) - 2) : 0);
+
+
+ for($x = $index; $x <= ($index+1); $x ++) {
+
+ $rr = $r[$x];
+ if(! $rr['xchan_url'])
+ break;
+
+ $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr'];
+
+ $arr[] = array(
+ 'url' => chanlink_url($rr['xchan_url']),
+ 'profile' => $rr['xchan_url'],
+ 'name' => $rr['xchan_name'],
+ 'photo' => $rr['xchan_photo_m'],
+ 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'ignore' => t('Ignore/Hide')
+ );
+ }
+
+
+ $o = replace_macros(get_markup_template('suggest_widget.tpl'),array(
+ '$title' => t('Suggestions'),
+ '$more' => t('See more...'),
+ '$entries' => $arr
+ ));
+
+ return $o;
+
} \ No newline at end of file