X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapitimelineuser.php;h=62d0a5e0d5bbbd78319b3f0aa5aee6833be18ab5;hb=c48cdc7d50cc2920e3f41e34e9b5e19638331dd9;hp=b0ca7e923fb741787fd2a6c3fecc5408cef600b5;hpb=2e1c7c779d7d7a12529efdb42437fbc063475ba6;p=quix0rs-gnu-social.git diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index b0ca7e923f..62d0a5e0d5 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -201,8 +201,19 @@ class ApiTimelineUserAction extends ApiBareAuthAction case 'json': $this->showJsonTimeline($this->notices); break; + case 'as': + header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); + $doc = new ActivityStreamJSONDocument($this->auth_user); + $doc->setTitle($atom->title); + $doc->addLink($link, 'alternate', 'text/html'); + $doc->addItemsFromNotices($this->notices); + + // XXX: Add paging extension? + + $this->raw($doc->asString()); + break; default: - // TRANS: Client error displayed when trying to handle an unknown API method. + // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } @@ -311,8 +322,11 @@ class ApiTimelineUserAction extends ApiBareAuthAction $this->clientError(_('Atom post must not be empty.')); } - $dom = DOMDocument::loadXML($xml); - if (!$dom) { + $old = error_reporting(error_reporting() & ~(E_WARNING | E_NOTICE)); + $dom = new DOMDocument(); + $ok = $dom->loadXML($xml); + error_reporting($old); + if (!$ok) { // TRANS: Client error displayed attempting to post an API that is not well-formed XML. $this->clientError(_('Atom post must be well-formed XML.')); } @@ -433,7 +447,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction } else { $group = User_group::staticGet('uri', $uri); if (!empty($group)) { - $options['groups'][] = $uri; + $options['groups'][] = $group->id; } else { // @fixme: hook for discovery here common_log(LOG_WARNING, sprintf('AtomPub post with unknown attention URI %s', $uri));