X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=4c942cd762c1608a0a6a73c62d86e49ca0eaa763;hb=e198edf652479bd0a969b3aabb469361dba0fd6b;hp=5df68f223ed57b93a365f8f1cc8580e306111d70;hpb=103535d6206e9f2c2260d0554ecc41d31baaf9dd;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 5df68f223e..4c942cd762 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -1,10 +1,31 @@ . + * + */ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\System; -use Friendica\Protocol\OStatus; +use Friendica\DI; +use Friendica\Protocol\Feed as ProtocolFeed; +use Friendica\Network\HTTPException; /** * Provides public Atom feeds @@ -18,32 +39,26 @@ use Friendica\Protocol\OStatus; * * The nocache GET parameter is provided mainly for debug purposes, requires auth * - * @brief Provides public Atom feeds - * * @author Hypolite Petovan */ class Feed extends BaseModule { - public static function content() + protected function rawContent(array $request = []) { - $a = self::getApp(); - - $last_update = x($_GET, 'last_update') ? $_GET['last_update'] : ''; - $nocache = x($_GET, 'nocache') && local_user(); - - if ($a->argc < 2) { - System::httpExit(400); - } + $last_update = $this->getRequestValue($request, 'last_update', ''); + $nocache = !empty($request['nocache']) && local_user(); $type = null; - if ($a->argc > 2) { - $type = $a->argv[2]; + // @TODO: Replace with parameter from router + if (DI::args()->getArgc() > 2) { + $type = DI::args()->getArgv()[2]; } switch ($type) { case 'posts': case 'comments': case 'activity': + // Correct type names, no change needed break; case 'replies': $type = 'comments'; @@ -52,9 +67,11 @@ class Feed extends BaseModule $type = 'posts'; } - $nickname = $a->argv[1]; - header("Content-type: application/atom+xml"); - echo OStatus::feed($nickname, $last_update, 10, $type, $nocache); - killme(); + $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.')); + } + + System::httpExit($feed, Response::TYPE_ATOM); } }