X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=b9d573979a721430eec0467b725635c5b0efb8b7;hb=8b02c285472ea28002cf9c8924e2885dd207ccd8;hp=ff0abdb2ab31d997a2dde3b725629a9fddf5814a;hpb=d09b3f5bdeae444f785f6283e55dbf2f61caadac;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index ff0abdb2ab..b9d573979a 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -1,6 +1,6 @@ comments * - /feed/[nickname]/activity => activity * - * The nocache GET parameter is provided mainly for debug purposes, requires auth - * * @author Hypolite Petovan */ class Feed extends BaseModule { - public static function content(array $parameters = []) + protected function rawContent(array $request = []) { - $a = DI::app(); - - $last_update = $_GET['last_update'] ?? ''; - $nocache = !empty($_GET['nocache']) && local_user(); - - // @TODO: Replace with parameter from router - if ($a->argc < 2) { - throw new \Friendica\Network\HTTPException\BadRequestException(); - } - - $type = null; - // @TODO: Replace with parameter from router - if ($a->argc > 2) { - $type = $a->argv[2]; - } - + $nick = $this->parameters['nickname'] ?? ''; + $type = $this->parameters['type'] ?? null; switch ($type) { case 'posts': case 'comments': @@ -72,10 +58,19 @@ class Feed extends BaseModule $type = 'posts'; } - // @TODO: Replace with parameter from router - $nickname = $a->argv[1]; - header("Content-type: application/atom+xml; charset=utf-8"); - echo OStatus::feed($nickname, $last_update, 10, $type, $nocache, true); - exit(); + $last_update = $this->getRequestValue($request, 'last_update', ''); + + $owner = User::getOwnerDataByNick($nick); + if (!$owner || $owner['account_expired'] || $owner['account_removed']) { + throw new HTTPException\NotFoundException($this->t('User not found.')); + } + + if ($owner['blocked']) { + throw new HTTPException\UnauthorizedException($this->t('Access to this profile has been restricted.')); + } + + $feed = ProtocolFeed::atom($owner, $last_update, 10, $type); + + $this->httpExit($feed, Response::TYPE_ATOM); } }