X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FOStatus.php;h=127773f3c6ce1a15dd7ee61a76f191544c0dbf6d;hb=e5a29cf979ffecf63033efd2a5b4038ed950e024;hp=b2d0004c06ef7fd7e1da8dd50c7695d069337384;hpb=08da1ed038c9b193ded0ca70b3b1c1085bb7e90a;p=friendica.git diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index b2d0004c06..127773f3c6 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -53,7 +53,7 @@ class OStatus * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact, $onlyfetch) + private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact = null, $onlyfetch) { $author = []; $author["author-link"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context); @@ -72,7 +72,7 @@ class OStatus } $author["author-id"] = Contact::getIdForURL($author["author-link"]); - $author["contact-id"] = $contact["id"]; + $author['contact-id'] = defaults($contact, 'id', $author['author-id']); $contact = []; @@ -322,7 +322,7 @@ class OStatus * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - private static function process($xml, array $importer, array &$contact, &$hub, $stored = false, $initialize = true) + private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true) { if ($initialize) { self::$itemlist = []; @@ -417,13 +417,6 @@ class OStatus $author = self::fetchAuthor($xpath, $entry, $importer, $contact, $stored); } - $value = XML::getFirstNodeValue($xpath, 'atom:author/poco:preferredUsername/text()', $entry); - if ($value != "") { - $nickname = $value; - } else { - $nickname = $author["author-name"]; - } - $item = array_merge($header, $author); $item["uri"] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry); @@ -463,7 +456,7 @@ class OStatus } if ($item["verb"] == ACTIVITY_FOLLOW) { - Contact::addRelationship($importer, $contact, $item, $nickname); + Contact::addRelationship($importer, $contact, $item); continue; } @@ -745,7 +738,7 @@ class OStatus self::$conv_list[$conversation] = true; - $curlResult = Network::curl($conversation, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']); + $curlResult = Network::curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']); if (!$curlResult->isSuccess()) { return; @@ -938,7 +931,7 @@ class OStatus } $stored = false; - $curlResult = Network::curl($related, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']); + $curlResult = Network::curl($related, false, ['accept_content' => 'application/atom+xml, text/html']); if (!$curlResult->isSuccess()) { return; @@ -1515,7 +1508,7 @@ class OStatus $author->appendChild($urls); } - XML::addElement($doc, $author, "followers", "", ["url" => System::baseUrl()."/viewcontacts/".$owner["nick"]]); + XML::addElement($doc, $author, "followers", "", ["url" => System::baseUrl() . "/profile/" . $owner["nick"] . "/contacts/followers"]); XML::addElement($doc, $author, "statusnet:profile_info", "", ["local_id" => $owner["uid"]]); if ($profile["publish"]) { @@ -1763,19 +1756,16 @@ class OStatus $verb = NAMESPACE_ACTIVITY_SCHEMA."favorite"; self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false); - $as_object = $doc->createElement("activity:object"); - $parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]); + if (DBA::isResult($parent)) { + $as_object = $doc->createElement("activity:object"); - if (!$parent) { - $parent = []; - } - - XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent)); + XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent)); - self::entryContent($doc, $as_object, $parent, $owner, "New entry"); + self::entryContent($doc, $as_object, $parent, $owner, "New entry"); - $entry->appendChild($as_object); + $entry->appendChild($as_object); + } self::entryFooter($doc, $entry, $item, $owner); @@ -2229,7 +2219,7 @@ class OStatus $check_date = DateTimeFormat::utc($last_update); $authorid = Contact::getIdForURL($owner["url"], 0, true); - $condition = ["`uid` = ? AND `created` > ? AND NOT `deleted` + $condition = ["`uid` = ? AND `received` > ? AND NOT `deleted` AND NOT `private` AND `visible` AND `wall` AND `parent-network` IN (?, ?)", $owner["uid"], $check_date, Protocol::OSTATUS, Protocol::DFRN]; @@ -2244,7 +2234,7 @@ class OStatus $condition[] = $authorid; } - $params = ['order' => ['created' => true], 'limit' => $max_items]; + $params = ['order' => ['received' => true], 'limit' => $max_items]; if ($filter === 'posts') { $ret = Item::selectThread([], $condition, $params);