X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FOStatus.php;h=5e34636b215f8900b84f964723e0fa068da84da7;hb=79a646550f4498440d6ee3148b17b3b0d6d5e743;hp=6531d75af1d8c765af170f3e02d5f682c8564317;hpb=d693bc1b2fc1b2e6819ed45b64cfc6d0d6cab90a;p=friendica.git diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 6531d75af1..5e34636b21 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1,6 +1,6 @@ firstChild) || empty($doc->firstChild->tagName)) { return false; @@ -499,7 +498,7 @@ class OStatus $item['verb'] = Activity::LIKE; $item['thr-parent'] = $orig_uri; - $item['gravity'] = GRAVITY_ACTIVITY; + $item['gravity'] = Item::GRAVITY_ACTIVITY; $item['object-type'] = Activity\ObjectType::NOTE; } @@ -714,7 +713,7 @@ class OStatus } } else { $item['thr-parent'] = $item['uri']; - $item['gravity'] = GRAVITY_PARENT; + $item['gravity'] = Item::GRAVITY_PARENT; } self::$itemlist[] = $item; @@ -938,7 +937,7 @@ class OStatus break; default: - Logger::warning('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']); + Logger::notice('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']); } } } @@ -1061,9 +1060,9 @@ class OStatus $attributes = [ 'uri' => 'https://friendi.ca', - 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, + 'version' => App::VERSION . '-' . DB_UPDATE_VERSION, ]; - XML::addElement($doc, $root, 'generator', FRIENDICA_PLATFORM, $attributes); + XML::addElement($doc, $root, 'generator', App::PLATFORM, $attributes); 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'))); @@ -1169,10 +1168,6 @@ class OStatus ]; XML::addElement($doc, $root, 'link', '', $attributes); break; - - default: - Logger::warning('Unsupported type', ['type' => $siteinfo['type'], 'url' => $siteinfo['url'] ?? '']); - break; } if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) { @@ -1189,7 +1184,7 @@ class OStatus } } - foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) { + foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) { $attributes = ['rel' => 'enclosure', 'href' => $attachment['url'], 'type' => $attachment['mimetype']]; @@ -1363,7 +1358,7 @@ class OStatus */ private static function likeEntry(DOMDocument $doc, array $item, array $owner, bool $toplevel): DOMElement { - if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) { + if (($item['gravity'] != Item::GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) { Logger::info('OStatus entry is from author ' . $owner['url'] . ' - not from ' . $item['author-link'] . '. Quitting.'); } @@ -1513,7 +1508,7 @@ class OStatus */ private static function noteEntry(DOMDocument $doc, array $item, array $owner, bool $toplevel): DOMElement { - if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) { + if (($item['gravity'] != Item::GRAVITY_PARENT) && (Strings::normaliseLink($item['author-link']) != Strings::normaliseLink($owner['url']))) { Logger::info('OStatus entry is from author ' . $owner['url'] . ' - not from ' . $item['author-link'] . '. Quitting.'); } @@ -1556,7 +1551,7 @@ class OStatus if ($owner['contact-type'] == Contact::TYPE_COMMUNITY) { $contact = Contact::getByURL($item['author-link']) ?: $owner; - $contact['nickname'] = $contact['nickname'] ?? $contact['nick']; + $contact['nickname'] = $contact['nickname'] ?? $contact['nick']; $author = self::addAuthor($doc, $contact, false); $entry->appendChild($author); } @@ -1601,7 +1596,7 @@ class OStatus XML::addElement($doc, $entry, 'id', $item['uri']); XML::addElement($doc, $entry, 'title', html_entity_decode($title, ENT_QUOTES, 'UTF-8')); - $body = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']); + $body = Post\Media::addAttachmentsToBody($item['uri-id'], DI::contentItem()->addSharedPost($item)); $body = self::formatPicturePost($body, $item['uri-id']); if (!empty($item['title'])) { @@ -1643,7 +1638,7 @@ class OStatus { $mentioned = []; - if ($item['gravity'] != GRAVITY_PARENT) { + if ($item['gravity'] != Item::GRAVITY_PARENT) { $parent = Post::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]); $thrparent = Post::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner['uid'], 'uri' => $item['thr-parent']]);