aboutsummaryrefslogtreecommitdiffstats
path: root/include/socgraph.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-11-01 19:16:33 -0700
committerFriendika <info@friendika.com>2011-11-01 19:16:33 -0700
commit3d9a9614e232a3ff207803be1092b1d42bcadde6 (patch)
treeaf9ba51b8cefc4246a2627ec2e94b940c6531aa4 /include/socgraph.php
parent0975ea86101281befec9258d58e28c88d7b8ae4d (diff)
downloadvolse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.tar.gz
volse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.tar.bz2
volse-hubzilla-3d9a9614e232a3ff207803be1092b1d42bcadde6.zip
common friends
Diffstat (limited to 'include/socgraph.php')
-rw-r--r--include/socgraph.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index 3e9c00633..c81c7b695 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -123,4 +123,40 @@ function poco_load($cid,$uid = 0,$url = null) {
intval($uid)
);
+}
+
+
+function count_common_friends($uid,$cid) {
+
+ $r = q("SELECT count(*) as `total`
+ FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
+ where `glink`.`cid` = %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($uid),
+ intval($uid),
+ intval($cid)
+ );
+
+ if(count($r))
+ return $r[0]['total'];
+ return 0;
+
+}
+
+
+function common_friends($uid,$cid) {
+
+ $r = q("SELECT `gcontact`.*
+ FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
+ where `glink`.`cid` = %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($uid),
+ intval($uid),
+ intval($cid)
+ );
+
+ return $r;
+
} \ No newline at end of file