]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Feed.php
Merge pull request #12025 from annando/no-boot-src-module
[friendica.git] / src / Module / Feed.php
index 8db92c275a7a067c78628b8f90ed335b9ac9e05a..1465e10e7196a349ecf999924b20c8a10d2fa001 100644 (file)
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
+use Friendica\Core\Session;
 use Friendica\Core\System;
 use Friendica\DI;
 use Friendica\Protocol\Feed as ProtocolFeed;
+use Friendica\Network\HTTPException;
 
 /**
  * Provides public Atom feeds
@@ -42,10 +44,10 @@ use Friendica\Protocol\Feed as ProtocolFeed;
  */
 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();
+               $last_update = $this->getRequestValue($request, 'last_update', '');
+               $nocache     = !empty($request['nocache']) && Session::getLocalUser();
 
                $type = null;
                // @TODO: Replace with parameter from router
@@ -66,6 +68,11 @@ class Feed extends BaseModule
                                $type = 'posts';
                }
 
-               System::httpExit(ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true), Response::TYPE_ATOM);
+               $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);
        }
 }