]> git.mxchange.org Git - friendica.git/commitdiff
Fix for author-thumb/owner-thumb - DFRN: Relocate stuff
authorMichael Vogel <icarus@dabo.de>
Sun, 19 Jun 2016 18:01:25 +0000 (20:01 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 19 Jun 2016 18:01:25 +0000 (20:01 +0200)
include/conversation.php
include/dfrn.php

index ffd9d45e2bd19271810c0994831edb9ed517729d..c4d4fcdde80b57273093f3321007842eddb33b24 100644 (file)
@@ -443,7 +443,7 @@ function item_joins() {
        return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND
                NOT `contact`.`blocked` AND NOT `contact`.`pending`
                LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
-               LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`author-id`";
+               LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`";
 }
 
 /**
index 9828763bfcc38ab6f46f48050bbbd75338d14d8f..9d91cbce7b585118f12b191089f069a4e01a39a3 100644 (file)
@@ -369,6 +369,7 @@ class dfrn {
                xml::add_element($doc, $relocate, "dfrn:url", $owner['url']);
                xml::add_element($doc, $relocate, "dfrn:name", $owner['name']);
                xml::add_element($doc, $relocate, "dfrn:addr", $owner['addr']);
+               xml::add_element($doc, $relocate, "dfrn:avatar", $owner['avatar']);
                xml::add_element($doc, $relocate, "dfrn:photo", $photos[4]);
                xml::add_element($doc, $relocate, "dfrn:thumb", $photos[5]);
                xml::add_element($doc, $relocate, "dfrn:micro", $photos[6]);
@@ -1548,6 +1549,7 @@ class dfrn {
                $relocate["url"] = $xpath->query("dfrn:url/text()", $relocation)->item(0)->nodeValue;
                $relocate["addr"] = $xpath->query("dfrn:addr/text()", $relocation)->item(0)->nodeValue;
                $relocate["name"] = $xpath->query("dfrn:name/text()", $relocation)->item(0)->nodeValue;
+               $relocate["avatar"] = $xpath->query("dfrn:avatar/text()", $relocation)->item(0)->nodeValue;
                $relocate["photo"] = $xpath->query("dfrn:photo/text()", $relocation)->item(0)->nodeValue;
                $relocate["thumb"] = $xpath->query("dfrn:thumb/text()", $relocation)->item(0)->nodeValue;
                $relocate["micro"] = $xpath->query("dfrn:micro/text()", $relocation)->item(0)->nodeValue;
@@ -1557,6 +1559,9 @@ class dfrn {
                $relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
                $relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
 
+               if (($relocate["avatar"] == "") AND ($relocate["photo"] != ""))
+                       $relocate["avatar"] = $relocate["photo"];
+
                if ($relocate["addr"] == "")
                        $relocate["addr"] = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$3@$2", $relocate["url"]);
 
@@ -1583,7 +1588,7 @@ class dfrn {
                                        `server_url` = '%s'
                        WHERE `nurl` = '%s';",
                                        dbesc($relocate["name"]),
-                                       dbesc($relocate["photo"]),
+                                       dbesc($relocate["avatar"]),
                                        dbesc($relocate["url"]),
                                        dbesc(normalise_link($relocate["url"])),
                                        dbesc($relocate["addr"]),
@@ -1595,9 +1600,7 @@ class dfrn {
                // Update the contact table. We try to find every entry.
                $x = q("UPDATE `contact` SET
                                        `name` = '%s',
-                                       `photo` = '%s',
-                                       `thumb` = '%s',
-                                       `micro` = '%s',
+                                       `avatar` = '%s',
                                        `url` = '%s',
                                        `nurl` = '%s',
                                        `addr` = '%s',
@@ -1608,9 +1611,7 @@ class dfrn {
                                        `site-pubkey` = '%s'
                        WHERE (`id` = %d AND `uid` = %d) OR (`nurl` = '%s');",
                                        dbesc($relocate["name"]),
-                                       dbesc($relocate["photo"]),
-                                       dbesc($relocate["thumb"]),
-                                       dbesc($relocate["micro"]),
+                                       dbesc($relocate["avatar"]),
                                        dbesc($relocate["url"]),
                                        dbesc(normalise_link($relocate["url"])),
                                        dbesc($relocate["addr"]),
@@ -1623,6 +1624,8 @@ class dfrn {
                                        intval($importer["importer_uid"]),
                                        dbesc(normalise_link($old["url"])));
 
+               update_contact_avatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
+
                if ($x === false)
                        return false;