]> git.mxchange.org Git - friendica.git/blobdiff - include/socgraph.php
Merge branch 'master' of https://github.com/friendica/friendica into threaded_items
[friendica.git] / include / socgraph.php
index b7c4ccc71e7680b1d94ff91e172960cf4926311d..4fe9eaf9095cd029e20a11103f521e027757451e 100644 (file)
@@ -71,20 +71,24 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
 
                $name = $entry->displayName;
 
-               foreach($entry->urls as $url) {
-                       if($url->type == 'profile') {
-                               $profile_url = $url->value;
-                               continue;
-                       }
-                       if($url->type == 'webfinger') {
-                               $connect_url = str_replace('acct:' , '', $url->value);
-                               continue;
+               if(isset($entry->urls)) {
+                       foreach($entry->urls as $url) {
+                               if($url->type == 'profile') {
+                                       $profile_url = $url->value;
+                                       continue;
+                               }
+                               if($url->type == 'webfinger') {
+                                       $connect_url = str_replace('acct:' , '', $url->value);
+                                       continue;
+                               }
                        }
-               } 
-               foreach($entry->photos as $photo) {
-                       if($photo->type == 'profile') {
-                               $profile_photo = $photo->value;
-                               continue;
+               }
+               if(isset($entry->photos)) { 
+                       foreach($entry->photos as $photo) {
+                               if($photo->type == 'profile') {
+                                       $profile_photo = $photo->value;
+                                       continue;
+                               }
                        }
                }
 
@@ -184,7 +188,7 @@ function count_common_friends($uid,$cid) {
 }
 
 
-function common_friends($uid,$cid,$limit=9999,$shuffle = false) {
+function common_friends($uid,$cid,$start = 0,$limit=9999,$shuffle = false) {
 
        if($shuffle)
                $sql_extra = " order by rand() ";
@@ -195,11 +199,12 @@ function common_friends($uid,$cid,$limit=9999,$shuffle = false) {
                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 blocked = 0 and hidden = 0 and id != %d ) 
-               $sql_extra limit 0, %d",
+               $sql_extra limit %d, %d",
                intval($cid),
                intval($uid),
                intval($uid),
                intval($cid),
+               intval($start),
                intval($limit)
        );
 
@@ -224,7 +229,7 @@ function count_common_friends_zcid($uid,$zcid) {
 
 }
 
-function common_friends_zcid($uid,$zcid,$limit = 9999,$shuffle) {
+function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = false) {
 
        if($shuffle)
                $sql_extra = " order by rand() ";
@@ -235,9 +240,10 @@ function common_friends_zcid($uid,$zcid,$limit = 9999,$shuffle) {
                FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
                where `glink`.`zcid` = %d
                and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) 
-               $sql_extra limit 0, %d",
+               $sql_extra limit %d, %d",
                intval($zcid),
                intval($uid),
+               intval($start),
                intval($limit)
        );