X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=59714af387baa60f3e4ec2df537fa162c0a4c1a6;hb=36a89623331f4d62959f742202afa0bd4ff85994;hp=8db92c275a7a067c78628b8f90ed335b9ac9e05a;hpb=3842f02b021f2f32dbe6707c22af5760c3353dfa;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 8db92c275a..59714af387 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -23,7 +23,8 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; -use Friendica\DI; +use Friendica\Model\User; +use Friendica\Network\HTTPException; use Friendica\Protocol\Feed as ProtocolFeed; /** @@ -36,23 +37,14 @@ use Friendica\Protocol\Feed as ProtocolFeed; * - /feed/[nickname]/replies => 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 content(array $request = []): string + 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': @@ -66,6 +58,19 @@ class Feed extends BaseModule $type = 'posts'; } - System::httpExit(ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true), Response::TYPE_ATOM); + $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); } }