]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Replace IHTTPResult for CurlResult usages
[friendica.git] / src / Protocol / Feed.php
index ebd6f5ed3008ddf1f569d55b78ec08501092cbac..0801498f21f1cc5c166a92c216a9ca8a07945cdf 100644 (file)
@@ -39,6 +39,7 @@ use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\ParseUrl;
+use Friendica\Util\Proxy;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
 
@@ -600,7 +601,9 @@ class Feed
                                }
                                $publish_at = date(DateTimeFormat::MYSQL, $publish_time);
 
-                               Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments']);
+                               if (Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], Post\Delayed::PREPARED, $publish_at, $posting['taglist'], $posting['attachments'])) {
+                                       DI::pConfig()->set($item['uid'], 'system', 'last_publish', $publish_time);
+                               }
                        }
                }
 
@@ -877,8 +880,8 @@ class Feed
                        Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA];
 
                if ($filter === 'comments') {
-                       $condition[0] .= " AND `object-type` = ? ";
-                       $condition[] = Activity\ObjectType::COMMENT;
+                       $condition[0] .= " AND `gravity` = ? ";
+                       $condition[] = GRAVITY_COMMENT;
                }
 
                if ($owner['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
@@ -957,7 +960,7 @@ class Feed
                XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
                XML::addElement($doc, $root, "title", $title);
                XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
-               XML::addElement($doc, $root, "logo", $owner["photo"]);
+               XML::addElement($doc, $root, "logo", Contact::getAvatarUrlForId($owner['id'], Proxy::SIZE_SMALL, $owner['updated']));
                XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
 
                $author = self::addAuthor($doc, $owner);
@@ -1106,9 +1109,9 @@ class Feed
                XML::addElement($doc, $entry, "id", $item["uri"]);
                XML::addElement($doc, $entry, "title", html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
 
-               $body = OStatus::formatPicturePost($item['body']);
+               $body = OStatus::formatPicturePost($item['body'], $item['uri-id']);
 
-               $body = BBCode::convert($body, false, BBCode::OSTATUS);
+               $body = BBCode::convertForUriId($item['uri-id'], $body, BBCode::ACTIVITYPUB);
 
                XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);
 
@@ -1185,7 +1188,7 @@ class Feed
        private static function getTitle(array $item)
        {
                if ($item['title'] != '') {
-                       return BBCode::convert($item['title'], false, BBCode::OSTATUS);
+                       return BBCode::convertForUriId($item['uri-id'], $item['title'], BBCode::ACTIVITYPUB);
                }
 
                // Fetch information about the post
@@ -1198,7 +1201,7 @@ class Feed
                // Remove the share element before fetching the first line
                $title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism","\n$1\n",$item['body']));
 
-               $title = HTML::toPlaintext(BBCode::convert($title, false), 0, true)."\n";
+               $title = BBCode::toPlaintext($title)."\n";
                $pos = strpos($title, "\n");
                $trailer = "";
                if (($pos == 0) || ($pos > 100)) {