]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
The avatar picture wasn't updated at the contact table
[friendica.git] / include / items.php
index 7d1ab1cb36c52398a62f4b5f1c10adac68c55a60..3261e9468385d59a4a2cd1266e3bd654b308579f 100644 (file)
@@ -2381,6 +2381,19 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                $contact_updated = $photo_timestamp;
 
                require_once("include/Photo.php");
+               $photos = import_profile_photo($photo_url,$contact['uid'],$contact['id']);
+
+               q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
+                       WHERE `uid` = %d AND `id` = %d",
+                       dbesc(datetime_convert()),
+                       dbesc($photos[0]),
+                       dbesc($photos[1]),
+                       dbesc($photos[2]),
+                       intval($contact['uid']),
+                       intval($contact['id'])
+               );
+
+               /*
                $photo_failure = false;
                $have_photo = false;
 
@@ -2433,7 +2446,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                                intval($contact['uid']),
                                intval($contact['id'])
                        );
-               }
+               }*/
        }
 
        if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
@@ -3119,6 +3132,21 @@ function local_delivery($importer,$data) {
 
                logger('local_delivery: Updating photo for ' . $importer['name']);
                require_once("include/Photo.php");
+
+               $photos = import_profile_photo($photo_url,$importer['importer_uid'],$importer['id']);
+
+               q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
+                       WHERE `uid` = %d AND `id` = %d",
+                       dbesc(datetime_convert()),
+                       dbesc($photos[0]),
+                       dbesc($photos[1]),
+                       dbesc($photos[2]),
+                       intval($importer['importer_uid']),
+                       intval($importer['id'])
+               );
+
+
+               /*
                $photo_failure = false;
                $have_photo = false;
 
@@ -3171,7 +3199,7 @@ function local_delivery($importer,$data) {
                                intval($importer['importer_uid']),
                                intval($importer['id'])
                        );
-               }
+               } */
        }
 
        if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) {
@@ -4392,7 +4420,7 @@ function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
 }
 
 
-function atom_author($tag,$name,$uri,$h,$w,$photo) {
+function atom_author($tag,$name,$uri,$h,$w,$photo,$geo) {
        $o = '';
        if(! $tag)
                return $o;
@@ -4410,6 +4438,10 @@ function atom_author($tag,$name,$uri,$h,$w,$photo) {
        $o .= "\t".'<link rel="avatar" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
 
        if ($tag == "author") {
+
+               if($geo)
+                       $o .= '<georss:point>'.xmlify($geo).'</georss:point>'."\r\n";
+
                $r = q("SELECT `profile`.`locality`, `profile`.`region`, `profile`.`country-name`,
                                `profile`.`name`, `profile`.`pub_keywords`, `profile`.`about`,
                                `profile`.`homepage`,`contact`.`nick` FROM `profile`
@@ -4473,11 +4505,11 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
        $o = "\r\n\r\n<entry>\r\n";
 
        if(is_array($author))
-               $o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb']);
+               $o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb'], $item['coord']);
        else
-               $o .= atom_author('author',(($item['author-name']) ? $item['author-name'] : $item['name']),(($item['author-link']) ? $item['author-link'] : $item['url']),80,80,(($item['author-avatar']) ? $item['author-avatar'] : $item['thumb']));
+               $o .= atom_author('author',(($item['author-name']) ? $item['author-name'] : $item['name']),(($item['author-link']) ? $item['author-link'] : $item['url']),80,80,(($item['author-avatar']) ? $item['author-avatar'] : $item['thumb']), $item['coord']);
        if(strlen($item['owner-name']))
-               $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
+               $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar'], $item['coord']);
 
        if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
                $parent = q("SELECT `guid` FROM `item` WHERE `id` = %d", intval($item["parent"]));