X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=b9d573979a721430eec0467b725635c5b0efb8b7;hb=8b02c285472ea28002cf9c8924e2885dd207ccd8;hp=1465e10e7196a349ecf999924b20c8a10d2fa001;hpb=d2da2492b76fbc77ad11c8a5482e2674381b2af0;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 1465e10e71..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 { protected function rawContent(array $request = []) { - $last_update = $this->getRequestValue($request, 'last_update', ''); - $nocache = !empty($request['nocache']) && Session::getLocalUser(); - - $type = null; - // @TODO: Replace with parameter from router - if (DI::args()->getArgc() > 2) { - $type = DI::args()->getArgv()[2]; - } - + $nick = $this->parameters['nickname'] ?? ''; + $type = $this->parameters['type'] ?? null; switch ($type) { case 'posts': case 'comments': @@ -68,11 +58,19 @@ class Feed extends BaseModule $type = 'posts'; } - $feed = ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true); - if (empty($feed)) { - throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); + $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.')); } - System::httpExit($feed, Response::TYPE_ATOM); + $feed = ProtocolFeed::atom($owner, $last_update, 10, $type); + + $this->httpExit($feed, Response::TYPE_ATOM); } }