X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdfrn.php;h=27fc644c6b21d2dbbf99d6b17f36c43cb1dfaa52;hb=497fd34026fbaa83b11a64d3a0a6e20f1360e5d6;hp=c9b907accdeb86bdd6f3d97792b3fb5738458cfe;hpb=3c9a80a31c519c93980d7f90b52039aea9bfa02b;p=friendica.git diff --git a/include/dfrn.php b/include/dfrn.php index c9b907accd..27fc644c6b 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -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; @@ -1631,17 +1634,23 @@ class dfrn { $fields = array( 'owner-link' => array($old["url"], $relocate["url"]), 'author-link' => array($old["url"], $relocate["url"]), - 'owner-avatar' => array($old["photo"], $relocate["photo"]), - 'author-avatar' => array($old["photo"], $relocate["photo"]), + //'owner-avatar' => array($old["photo"], $relocate["photo"]), + //'author-avatar' => array($old["photo"], $relocate["photo"]), ); - foreach ($fields as $n=>$f){ - $x = q("UPDATE `item` SET `%s` = '%s' WHERE `%s` = '%s' AND `uid` = %d", - $n, dbesc($f[1]), + foreach ($fields as $n=>$f) { + $r = q("SELECT `id` FROM `item` WHERE `%s` = '%s' AND `uid` = %d LIMIT 1", $n, dbesc($f[0]), intval($importer["importer_uid"])); - if ($x === false) - return false; + + if ($r) { + $x = q("UPDATE `item` SET `%s` = '%s' WHERE `%s` = '%s' AND `uid` = %d", + $n, dbesc($f[1]), + $n, dbesc($f[0]), + intval($importer["importer_uid"])); + if ($x === false) + return false; } + } /// @TODO /// merge with current record, current contents have priority @@ -1683,7 +1692,7 @@ class dfrn { $changed = true; if ($entrytype == DFRN_REPLY_RC) - proc_run("php", "include/notifier.php","comment-import", $current["id"]); + proc_run(PRIORITY_HIGH, "include/notifier.php","comment-import", $current["id"]); } // update last-child if it changes @@ -2243,7 +2252,7 @@ class dfrn { if($posted_id AND $parent AND ($entrytype == DFRN_REPLY_RC)) { logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG); - proc_run("php", "include/notifier.php", "comment-import", $posted_id); + proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $posted_id); } return true; @@ -2414,7 +2423,7 @@ class dfrn { if($entrytype == DFRN_REPLY_RC) { logger("Notifying followers about deletion of post ".$item["id"], LOGGER_DEBUG); - proc_run("php", "include/notifier.php","drop", $item["id"]); + proc_run(PRIORITY_HIGH, "include/notifier.php","drop", $item["id"]); } } }