]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/OStatus.php
Merge pull request #10633 from nupplaphil/task/httprequest_optimiziations
[friendica.git] / src / Protocol / OStatus.php
index 03ff68d963ce33db7c5af782f26015ad907c0b85..5a0135f9cb4b90c454b11d6af1990e5bd1ee7b9c 100644 (file)
@@ -727,7 +727,7 @@ class OStatus
 
                self::$conv_list[$conversation] = true;
 
-               $curlResult = DI::httpRequest()->get($conversation, ['accept_content' => 'application/atom+xml, text/html']);
+               $curlResult = DI::httpRequest()->get($conversation, ['accept_content' => ['application/atom+xml', 'text/html']]);
 
                if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
                        return;
@@ -735,7 +735,8 @@ class OStatus
 
                $xml = '';
 
-               if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+xml')) {
+               if ($curlResult->inHeader('Content-Type') &&
+                       in_array('application/atom+xml', $curlResult->getHeader('Content-Type'))) {
                        $xml = $curlResult->getBody();
                }
 
@@ -920,7 +921,7 @@ class OStatus
                }
 
                $stored = false;
-               $curlResult = DI::httpRequest()->get($related, ['accept_content' => 'application/atom+xml, text/html']);
+               $curlResult = DI::httpRequest()->get($related, ['accept_content' => ['application/atom+xml', 'text/html']]);
 
                if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
                        return;
@@ -928,7 +929,8 @@ class OStatus
 
                $xml = '';
 
-               if (stristr($curlResult->getHeader(), 'Content-Type: application/atom+xml')) {
+               if ($curlResult->inHeader('Content-Type') &&
+                       in_array('application/atom+xml', $curlResult->getHeader('Content-Type'))) {
                        Logger::log('Directly fetched XML for URI ' . $related_uri, Logger::DEBUG);
                        $xml = $curlResult->getBody();
                }
@@ -1418,7 +1420,7 @@ class OStatus
                XML::addElement($doc, $author, "name", $owner["nick"]);
                XML::addElement($doc, $author, "email", $owner["addr"]);
                if ($show_profile) {
-                       XML::addElement($doc, $author, "summary", BBCode::convert($owner["about"], false, BBCode::OSTATUS));
+                       XML::addElement($doc, $author, "summary", BBCode::convertForUriId($owner['uri-id'], $owner["about"], BBCode::OSTATUS));
                }
 
                $attributes = ["rel" => "alternate", "type" => "text/html", "href" => $owner["url"]];
@@ -1445,7 +1447,7 @@ class OStatus
                XML::addElement($doc, $author, "poco:preferredUsername", $owner["nick"]);
                XML::addElement($doc, $author, "poco:displayName", $owner["name"]);
                if ($show_profile) {
-                       XML::addElement($doc, $author, "poco:note", BBCode::convert($owner["about"], false, BBCode::OSTATUS));
+                       XML::addElement($doc, $author, "poco:note", BBCode::convertForUriId($owner['uri-id'], $owner["about"], BBCode::OSTATUS));
 
                        if (trim($owner["location"]) != "") {
                                $element = $doc->createElement("poco:address");