]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Diaspora.php
Merge remote-tracking branch 'upstream/develop' into failed
[friendica.git] / src / Protocol / Diaspora.php
index b579f92df05e85b39edb817d84c205b44a748818..bd99b361e345b8a767e7597ddbf34d6cb871b315 100644 (file)
@@ -22,6 +22,7 @@
 namespace Friendica\Protocol;
 
 use Friendica\Content\Feature;
+use Friendica\Content\PageInfo;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\Markdown;
 use Friendica\Core\Cache\Duration;
@@ -1568,7 +1569,7 @@ class Diaspora
         */
        private static function plink($addr, $guid, $parent_guid = '')
        {
-               $contact = Contact::getDetailsByAddr($addr);
+               $contact = Contact::getByURL($addr);
                if (empty($contact)) {
                        Logger::info('No contact data for address', ['addr' => $addr]);
                        return '';
@@ -2603,7 +2604,7 @@ class Diaspora
 
                // Do we already have this item?
                $fields = ['body', 'title', 'attach', 'app', 'created', 'object-type', 'uri', 'guid',
-                       'author-name', 'author-link', 'author-avatar'];
+                       'author-name', 'author-link', 'author-avatar', 'plink'];
                $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
                $item = Item::selectFirst($fields, $condition);
 
@@ -2621,7 +2622,7 @@ class Diaspora
                                $item["body"] = self::replacePeopleGuid($item["body"], $item["author-link"]);
 
                                // Add OEmbed and other information to the body
-                               $item["body"] = add_page_info_to_body($item["body"], false, true);
+                               $item["body"] = PageInfo::searchAndAppendToBody($item["body"], false, true);
 
                                return $item;
                        } else {
@@ -2647,7 +2648,7 @@ class Diaspora
 
                        if ($stored) {
                                $fields = ['body', 'title', 'attach', 'app', 'created', 'object-type', 'uri', 'guid',
-                                       'author-name', 'author-link', 'author-avatar'];
+                                       'author-name', 'author-link', 'author-avatar', 'plink'];
                                $condition = ['guid' => $guid, 'visible' => true, 'deleted' => false, 'private' => [Item::PUBLIC, Item::UNLISTED]];
                                $item = Item::selectFirst($fields, $condition);
 
@@ -2749,8 +2750,6 @@ class Diaspora
                        return false;
                }
 
-               $orig_url = DI::baseUrl()."/display/".$original_item["guid"];
-
                $datarray = [];
 
                $datarray["uid"] = $importer["uid"];
@@ -2779,7 +2778,7 @@ class Diaspora
                        $original_item["author-name"],
                        $original_item["author-link"],
                        $original_item["author-avatar"],
-                       $orig_url,
+                       $original_item["plink"],
                        $original_item["created"],
                        $original_item["guid"]
                );
@@ -2987,7 +2986,7 @@ class Diaspora
 
                        // Add OEmbed and other information to the body
                        if (!self::isHubzilla($contact["url"])) {
-                               $body = add_page_info_to_body($body, false, true);
+                               $body = PageInfo::searchAndAppendToBody($body, false, true);
                        }
                }
 
@@ -3731,7 +3730,7 @@ class Diaspora
 
        private static function prependParentAuthorMention($body, $profile_url)
        {
-               $profile = Contact::getDetailsByURL($profile_url);
+               $profile = Contact::getByURL($profile_url, false, ['addr', 'name', 'contact-type']);
                if (!empty($profile['addr'])
                        && $profile['contact-type'] != Contact::TYPE_COMMUNITY
                        && !strstr($body, $profile['addr'])