]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/DFRN.php
Merge pull request #8462 from annando/issue-8254-3
[friendica.git] / src / Protocol / DFRN.php
index 078deff7a3876ab348c3a72d049a36805a94acad..4c71de4d57554f81dacc1edbd6f3e3f4f118b20c 100644 (file)
@@ -1052,6 +1052,7 @@ class DFRN
                if ($item['private']) {
                        // Friendica versions prior to 2020.3 can't handle "unlisted" properly. So we can only transmit public and private
                        XML::addElement($doc, $entry, "dfrn:private", ($item['private'] == Item::PRIVATE ? Item::PRIVATE : Item::PUBLIC));
+                       XML::addElement($doc, $entry, "dfrn:unlisted", $item['private'] == Item::UNLISTED);
                }
 
                if ($item['extid']) {
@@ -2368,32 +2369,11 @@ class DFRN
 
                $item["body"] = XML::getFirstNodeValue($xpath, "dfrn:env/text()", $entry);
                $item["body"] = str_replace([' ',"\t","\r","\n"], ['','','',''], $item["body"]);
-               // make sure nobody is trying to sneak some html tags by us
+
                $item["body"] = Strings::base64UrlDecode($item["body"]);
 
                $item["body"] = BBCode::limitBodySize($item["body"]);
 
-               /// @todo Do we really need this check for HTML elements? (It was copied from the old function)
-               if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
-                       $base_url = DI::baseUrl()->get();
-                       $item['body'] = HTML::relToAbs($item['body'], $base_url);
-
-                       $item['body'] = HTML::toBBCodeVideo($item['body']);
-
-                       $item['body'] = OEmbed::HTML2BBCode($item['body']);
-
-                       $config = HTMLPurifier_Config::createDefault();
-                       $config->set('Cache.DefinitionImpl', null);
-
-                       // we shouldn't need a whitelist, because the bbcode converter
-                       // will strip out any unsupported tags.
-
-                       $purifier = new HTMLPurifier($config);
-                       $item['body'] = $purifier->purify($item['body']);
-
-                       $item['body'] = @HTML::toBBCode($item['body']);
-               }
-
                /// @todo We should check for a repeated post and if we know the repeated author.
 
                // We don't need the content element since "dfrn:env" is always present
@@ -2405,6 +2385,11 @@ class DFRN
 
                $item["private"] = XML::getFirstNodeValue($xpath, "dfrn:private/text()", $entry);
 
+               $unlisted = XML::getFirstNodeValue($xpath, "dfrn:unlisted/text()", $entry);
+               if (!empty($unlisted) && ($item['private'] != Item::PRIVATE)) {
+                       $item['private'] = Item::UNLISTED;
+               }
+
                $item["extid"] = XML::getFirstNodeValue($xpath, "dfrn:extid/text()", $entry);
 
                if (XML::getFirstNodeValue($xpath, "dfrn:bookmark/text()", $entry) == "true") {
@@ -2710,7 +2695,7 @@ class DFRN
 
                Logger::log('deleting item '.$item['id'].' uri='.$uri, Logger::DEBUG);
 
-               Item::delete(['id' => $item['id']]);
+               Item::markForDeletion(['id' => $item['id']]);
        }
 
        /**