]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Diaspora.php
Check for last-activity value before feeding it to strtotime in Module\NoScrape
[friendica.git] / src / Protocol / Diaspora.php
index bb955dca1ecb728a3fd51d9f4e612fb3003a7d33..fe5b27d334f313d0b1817ac1bafb46e09b925113 100644 (file)
@@ -499,7 +499,7 @@ class Diaspora
                }
 
                if (!($fields = self::validPosting($msg))) {
-                       Logger::warning('Invalid posting');
+                       Logger::warning('Invalid posting', ['msg' => $msg]);
                        return false;
                }
 
@@ -534,7 +534,7 @@ class Diaspora
                if (is_null($fields)) {
                        $private = true;
                        if (!($fields = self::validPosting($msg))) {
-                               Logger::warning('Invalid posting');
+                               Logger::warning('Invalid posting', ['msg' => $msg]);
                                return false;
                        }
                } else {
@@ -826,9 +826,15 @@ class Diaspora
         */
        public static function isSupportedByContactUrl(string $url, ?bool $update = null): bool
        {
-               $contact = Contact::getByURL($url, $update);
+               $contact = Contact::getByURL($url, $update, ['uri-id', 'network']);
 
-               return DI::dsprContact()->existsByUriId($contact['uri-id'] ?? 0);
+               $supported = DI::dsprContact()->existsByUriId($contact['uri-id'] ?? 0);
+
+               if (!$supported && is_null($update) && ($contact['network'] == Protocol::DFRN)) {
+                       $supported = self::isSupportedByContactUrl($url, true);
+               }
+
+               return $supported;
        }
 
        /**
@@ -3387,7 +3393,7 @@ class Diaspora
                                $body = '### ' . html_entity_decode($title) . "\n\n" . $body;
                        }
 
-                       $attachments = Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]);
+                       $attachments = Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT]);
                        if (!empty($attachments)) {
                                $body .= "\n[hr]\n";
                                foreach ($attachments as $attachment) {
@@ -4064,7 +4070,7 @@ class Diaspora
                        return false;
                }
 
-               if (!self::isSupportedByContactUrl($parent_post['author-link'], false)) {
+               if (!self::isSupportedByContactUrl($parent_post['author-link'])) {
                        Logger::info('Parent author is no Diaspora contact.', ['parent-id' => $parent_id]);
                        return false;
                }