X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFeed.php;h=0ccffbb96b38bbb7e7ada2f11ea321946fb0f1e9;hb=0031b4e18cff5ded33c5f8599d6d93ea090986ff;hp=5df68f223ed57b93a365f8f1cc8580e306111d70;hpb=5881fa7229a25efd382668e6cd4a3af0f8d3198c;p=friendica.git diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 5df68f223e..0ccffbb96b 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -1,10 +1,29 @@ . + * + */ namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Core\System; -use Friendica\Protocol\OStatus; +use Friendica\DI; +use Friendica\Protocol\Feed as ProtocolFeed; /** * Provides public Atom feeds @@ -18,24 +37,24 @@ 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() + public static function content(array $parameters = []) { - $a = self::getApp(); + $a = DI::app(); - $last_update = x($_GET, 'last_update') ? $_GET['last_update'] : ''; - $nocache = x($_GET, 'nocache') && local_user(); + $last_update = $_GET['last_update'] ?? ''; + $nocache = !empty($_GET['nocache']) && local_user(); + // @TODO: Replace with parameter from router if ($a->argc < 2) { - System::httpExit(400); + throw new \Friendica\Network\HTTPException\BadRequestException(); } $type = null; + // @TODO: Replace with parameter from router if ($a->argc > 2) { $type = $a->argv[2]; } @@ -44,6 +63,7 @@ class Feed extends BaseModule case 'posts': case 'comments': case 'activity': + // Correct type names, no change needed break; case 'replies': $type = 'comments'; @@ -52,9 +72,10 @@ class Feed extends BaseModule $type = 'posts'; } + // @TODO: Replace with parameter from router $nickname = $a->argv[1]; - header("Content-type: application/atom+xml"); - echo OStatus::feed($nickname, $last_update, 10, $type, $nocache); - killme(); + header("Content-type: application/atom+xml; charset=utf-8"); + echo ProtocolFeed::atom($nickname, $last_update, 10, $type, $nocache, true); + exit(); } }