X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=654b8a4e9d4fcb62e99ab04aa68faa05e85a89f4;hb=b7a2b6b3527faa309a3498c887ee5c31cbdb7ce7;hp=9acde7bb30c61e8c2654650beca795f318a04672;hpb=4ba28e019926b43b7f7eee59885b4baf9e7173e9;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 9acde7bb30..654b8a4e9d 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 = $request['last_update'] ?? ''; - $nocache = !empty($request['nocache']) && local_user(); - - $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': @@ -67,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'] || $owner['hidewall']) { + throw new HTTPException\UnauthorizedException($this->t('Access to this profile has been restricted.')); + } + + $feed = ProtocolFeed::atom($owner, $last_update, 10, $type); + System::httpExit($feed, Response::TYPE_ATOM); } }