]> git.mxchange.org Git - friendica.git/commitdiff
suggest query for no friends messed up
authorfriendica <info@friendica.com>
Sun, 18 Dec 2011 21:03:20 +0000 (13:03 -0800)
committerfriendica <info@friendica.com>
Sun, 18 Dec 2011 21:03:20 +0000 (13:03 -0800)
include/socgraph.php

index 78a5514a0d462e7ef51c2c3b6a58f02dbaa424c7..5420b06c89343b49282636c6b9dc0d2163626d0e 100644 (file)
@@ -231,20 +231,22 @@ function suggestion_query($uid, $start = 0, $limit = 40) {
                intval($limit)
        );
 
-       if(count($r))
+       if(count($r) && count($r) >= ($limit -1))
                return $r;
 
-       $r = q("SELECT gcontact.* from gcontact 
+       $r2 = q("SELECT gcontact.* from gcontact 
                left join glink on glink.gcid = gcontact.id 
-               where uid = 0 and cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d)
+               where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d)
                and not gcontact.id in ( select gcid from gcign where uid = %d )
-               order by rand limit %d, %d ",
+               order by rand() limit %d, %d ",
+               intval($uid),
                intval($uid),
                intval($start),
                intval($limit)
        );
 
-       return $r;
+
+       return array_merge($r,$r2);
 
 }