X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsocgraph.php;h=87a7543de783e27c3d045dade8a3b5aeeb120691;hb=3bd2b731b2040e1025caef68e7da1f07907ae809;hp=84cfe4468a50223777c0e2849876f70842198837;hpb=00c342e13d833fd215e5dc03a508e1abe660fe21;p=friendica.git diff --git a/include/socgraph.php b/include/socgraph.php index 84cfe4468a..87a7543de7 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -150,7 +150,8 @@ 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 ) ", + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d ) + order by `gcontact`.`name` asc ", intval($cid), intval($uid), intval($uid), @@ -161,6 +162,37 @@ function common_friends($uid,$cid) { } +function count_all_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 ", + intval($cid), + intval($uid) + ); + + if(count($r)) + return $r[0]['total']; + return 0; + +} + + +function all_friends($uid,$cid,$start = 0, $limit = 80) { + + $r = q("SELECT `gcontact`.* + FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` + where `glink`.`cid` = %d and `glink`.`uid` = %d + order by `gcontact`.`name` asc LIMIT %d, %d ", + intval($cid), + intval($uid), + intval($start), + intval($limit) + ); + + return $r; +} + function suggestion_query($uid, $start = 0, $limit = 40) {