aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-01 20:33:19 -0700
committerfriendica <info@friendica.com>2012-05-01 20:33:19 -0700
commit594803afca25bf173cc42bb523a6931cc386777a (patch)
tree6804918c2ae778f7b5667794e4d9571c17450248 /include
parent066d69b21c4d612b35a3e15ae1d5db6344935e53 (diff)
downloadvolse-hubzilla-594803afca25bf173cc42bb523a6931cc386777a.tar.gz
volse-hubzilla-594803afca25bf173cc42bb523a6931cc386777a.tar.bz2
volse-hubzilla-594803afca25bf173cc42bb523a6931cc386777a.zip
reduce the scope a bit
Diffstat (limited to 'include')
-rw-r--r--include/contact_widgets.php6
-rw-r--r--include/socgraph.php24
2 files changed, 11 insertions, 19 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 0bf0b29d4..3fd311e4a 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -154,17 +154,17 @@ function common_friends_visitor_widget($profile_uid) {
}
}
- if($cid == 0 && $zcid == 0)
+ if($zcid == 0)
return;
require_once('include/socgraph.php');
- $t = count_common_friends_remote($profile_uid,$cid,$zcid);
+ $t = count_common_friends_zcid($profile_uid,$zcid);
if(! $t)
return;
- $r = common_friends_remote($profile_uid,$cid,$zcid);
+ $r = common_friends_zcid($profile_uid,$zcid);
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d friend in common", "%d friends in common", $t), $t),
diff --git a/include/socgraph.php b/include/socgraph.php
index bd1fbded5..a3e20a641 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -200,18 +200,14 @@ function common_friends($uid,$cid) {
}
-function count_common_friends_remote($uid,$cid,$zid) {
+function count_common_friends_zcid($uid,$zcid) {
$r = q("SELECT count(*) as `total`
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where ((`glink`.cid != 0 and `glink`.`cid` = %d) or ( `glink`.`zcid` != 0 and `glink`.`zcid` = %d ))
- and `glink`.`uid` = %d
- and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d ) ",
- intval($cid),
- intval($zid),
+ where `glink`.`zcid` = %d
+ and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 ) ",
+ intval($zcid),
intval($uid),
- intval($uid),
- intval($cid)
);
if(count($r))
@@ -220,19 +216,15 @@ function count_common_friends_remote($uid,$cid,$zid) {
}
-function common_friends_remote($uid,$cid,$zid,$limit = 6) {
+function common_friends_zcid($uid,$zcid,$limit = 6) {
$r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
- where ((`glink`.cid != 0 and `glink`.`cid` = %d) or ( `glink`.`zcid` != 0 and `glink`.`zcid` = %d ))
- and `glink`.`uid` = %d
- and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d )
+ where `glink`.`zcid` = %d
+ and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 )
order by `gcontact`.`name` asc limit 0, %d",
- intval($cid),
- intval($zid),
+ intval($zcid),
intval($uid),
- intval($uid),
- intval($cid),
intval($limit)
);