]> git.mxchange.org Git - friendica.git/commitdiff
Introduce `Response` for Modules to create a testable way for module responses
authorPhilipp <admin@philipp.info>
Sun, 21 Nov 2021 19:06:36 +0000 (20:06 +0100)
committerPhilipp <admin@philipp.info>
Sat, 27 Nov 2021 11:40:38 +0000 (12:40 +0100)
37 files changed:
mod/settings.php
src/App.php
src/App/Page.php
src/BaseModule.php
src/Capabilities/ICanHandleRequests.php
src/Capabilities/ICanReadAndWriteToResponds.php [new file with mode: 0644]
src/Capabilities/IRespondToRequests.php [new file with mode: 0644]
src/LegacyModule.php
src/Module/Admin/Themes/Embed.php
src/Module/Admin/Tos.php
src/Module/Api/Twitter/ContactEndpoint.php
src/Module/Apps.php
src/Module/BaseNotifications.php
src/Module/BaseSettings.php
src/Module/Contact/Advanced.php
src/Module/Contact/Revoke.php
src/Module/Debug/Feed.php
src/Module/Diaspora/Receive.php
src/Module/Filer/SaveTag.php
src/Module/FriendSuggest.php
src/Module/Install.php
src/Module/Magic.php
src/Module/Notifications/Introductions.php
src/Module/Notifications/Notifications.php
src/Module/Profile/Index.php
src/Module/Register.php
src/Module/RemoteFollow.php
src/Module/Response.php [new file with mode: 0644]
src/Module/Search/Saved.php
src/Module/Security/Logout.php
src/Module/Security/TwoFactor/Recovery.php
src/Module/Settings/TwoFactor/AppSpecific.php
src/Module/Settings/TwoFactor/Recovery.php
src/Module/Settings/TwoFactor/Trusted.php
src/Module/Settings/TwoFactor/Verify.php
src/Module/Statistics.php
src/Module/Tos.php

index 080bcdeb93848a7cc086c60798583752a3b17be3..1643b19fc3194609340d7d650c695b2e49161753 100644 (file)
@@ -47,7 +47,7 @@ function settings_init(App $a)
                return;
        }
 
-       BaseSettings::content();
+       BaseSettings::createAside();
 }
 
 function settings_post(App $a)
@@ -408,7 +408,7 @@ function settings_content(App $a)
 
        if (!empty($_SESSION['submanage'])) {
                notice(DI::l10n()->t('Permission denied.'));
-               return;
+               return '';
        }
 
        if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'oauth')) {
@@ -417,7 +417,7 @@ function settings_content(App $a)
 
                        DBA::delete('application-token', ['application-id' => DI::args()->getArgv()[3], 'uid' => local_user()]);
                        DI::baseUrl()->redirect('settings/oauth/', true);
-                       return;
+                       return '';
                }
 
                $applications = DBA::selectToArray('application-view', ['id', 'uid', 'name', 'website', 'scopes', 'created_at'], ['uid' => local_user()]);
@@ -577,7 +577,7 @@ function settings_content(App $a)
        $profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
        if (!DBA::isResult($profile)) {
                notice(DI::l10n()->t('Unable to find your profile. Please contact your admin.'));
-               return;
+               return '';
        }
 
        $user = User::getById($a->getLoggedInUserId());
index 14980896efe7e22b1d25e28a4c418d3ab23b5fcd..f3f7429db0651014ebe52aa4f6942024b81c7ddc 100644 (file)
@@ -701,8 +701,8 @@ class App
                        }
 
                        // Let the module run it's internal process (init, get, post, ...)
-                       $content = $module->run($_POST, $_REQUEST);
-                       $page->run($this, $this->baseURL, $this->args, $this->mode, $content, $this->l10n, $this->profiler, $this->config, $pconfig);
+                       $response = $module->run($_POST, $_REQUEST);
+                       $page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig);
                } catch (HTTPException $e) {
                        (new ModuleHTTPException())->rawContent($e);
                }
index d302ef6c24770f2b3d8ef2ac63e3e6cca7edfcd6..7996dca94fbba6b11a3e35e7fd4f8e94cc2eb5c5 100644 (file)
@@ -25,6 +25,7 @@ use ArrayAccess;
 use DOMDocument;
 use DOMXPath;
 use Friendica\App;
+use Friendica\Capabilities\IRespondToRequests;
 use Friendica\Content\Nav;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
@@ -336,19 +337,19 @@ class Page implements ArrayAccess
         * - module content
         * - hooks for content
         *
-        * @param string $content The content to print
-        * @param Mode   $mode   The Friendica execution mode
+        * @param IRespondToRequests $response The Module response class
+        * @param Mode               $mode     The Friendica execution mode
         *
         * @throws HTTPException\InternalServerErrorException
         */
-       private function initContent(string $content, Mode $mode)
+       private function initContent(IRespondToRequests $response, Mode $mode)
        {
                // initialise content region
                if ($mode->isNormal()) {
                        Hook::callAll('page_content_top', $this->page['content']);
                }
 
-               $this->page['content'] .= $content;
+               $this->page['content'] .= $response->getContent();
        }
 
        /**
@@ -373,18 +374,18 @@ class Page implements ArrayAccess
        /**
         * Executes the creation of the current page and prints it to the screen
         *
-        * @param App                         $app     The Friendica App
-        * @param BaseURL                     $baseURL The Friendica Base URL
-        * @param Arguments                   $args    The Friendica App arguments
-        * @param Mode                        $mode    The current node mode
-        * @param string                      $content The content to print on frontend
-        * @param L10n                        $l10n    The l10n language class
-        * @param IManageConfigValues         $config  The Configuration of this node
-        * @param IManagePersonalConfigValues $pconfig The personal/user configuration
+        * @param App                         $app      The Friendica App
+        * @param BaseURL                     $baseURL  The Friendica Base URL
+        * @param Arguments                   $args     The Friendica App arguments
+        * @param Mode                        $mode     The current node mode
+        * @param IRespondToRequests          $response The Response of the module class, including type, content & headers
+        * @param L10n                        $l10n     The l10n language class
+        * @param IManageConfigValues         $config   The Configuration of this node
+        * @param IManagePersonalConfigValues $pconfig  The personal/user configuration
         *
         * @throws HTTPException\InternalServerErrorException|HTTPException\ServiceUnavailableException
         */
-       public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, string $content, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig)
+       public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, IRespondToRequests $response, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig)
        {
                $moduleName = $args->getModuleName();
 
@@ -394,7 +395,7 @@ class Page implements ArrayAccess
                 * Sets the $Page->page['content'] variable
                 */
                $timestamp = microtime(true);
-               $this->initContent($content, $mode);
+               $this->initContent($response, $mode);
                $profiler->set(microtime(true) - $timestamp, 'content');
 
                // Load current theme info after module has been initialized as theme could have been set in module
@@ -433,6 +434,16 @@ class Page implements ArrayAccess
                        $this->page['nav']      = Nav::build($app);
                }
 
+               foreach ($response->getHeaders() as $key => $values) {
+                       if (is_array($values)) {
+                               foreach ($values as $value) {
+                                       header($key, $value);
+                               }
+                       } else {
+                               header($key, $values);
+                       }
+               }
+
                // Build the page - now that we have all the components
                if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) {
                        $doc = new DOMDocument();
index 65fc8f307c49dbdca624c43dd11072dfa4956a95..c68af875d7aae46bb388c9928b7c4186359ce22b 100644 (file)
@@ -23,10 +23,13 @@ namespace Friendica;
 
 use Friendica\App\Router;
 use Friendica\Capabilities\ICanHandleRequests;
+use Friendica\Capabilities\ICanReadAndWriteToResponds;
+use Friendica\Capabilities\IRespondToRequests;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Model\User;
+use Friendica\Module\Response;
 use Friendica\Module\Special\HTTPException as ModuleHTTPException;
 use Friendica\Network\HTTPException;
 use Friendica\Util\Profiler;
@@ -57,8 +60,10 @@ abstract class BaseModule implements ICanHandleRequests
        protected $profiler;
        /** @var array */
        protected $server;
+       /** @var ICanReadAndWriteToResponds */
+       protected $response;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
                $this->parameters = $parameters;
                $this->l10n       = $l10n;
@@ -67,6 +72,7 @@ abstract class BaseModule implements ICanHandleRequests
                $this->logger     = $logger;
                $this->profiler   = $profiler;
                $this->server     = $server;
+               $this->response   = $response;
        }
 
        /**
@@ -171,7 +177,7 @@ abstract class BaseModule implements ICanHandleRequests
        /**
         * {@inheritDoc}
         */
-       public function run(array $post = [], array $request = []): string
+       public function run(array $post = [], array $request = []): IRespondToRequests
        {
                // @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
                if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
@@ -205,36 +211,43 @@ abstract class BaseModule implements ICanHandleRequests
                Core\Hook::callAll($this->args->getModuleName() . '_mod_init', $placeholder);
 
                $this->profiler->set(microtime(true) - $timestamp, 'init');
-
-               if ($this->server['REQUEST_METHOD'] === Router::DELETE) {
-                       $this->delete();
-               }
-
-               if ($this->server['REQUEST_METHOD'] === Router::PATCH) {
-                       $this->patch();
-               }
-
-               if ($this->server['REQUEST_METHOD'] === Router::POST) {
-                       Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post);
-                       $this->post($request, $post);
+               $this->response->setType(IRespondToRequests::TYPE_CONTENT);
+
+               switch ($this->server['REQUEST_METHOD']) {
+                       case Router::DELETE:
+                               $this->response->setType(IRespondToRequests::TYPE_DELETE);
+                               $this->delete();
+                               break;
+                       case Router::PATCH:
+                               $this->response->setType(IRespondToRequests::TYPE_PATCH);
+                               $this->patch();
+                               break;
+                       case Router::POST:
+                               Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post);
+                               $this->response->setType(IRespondToRequests::TYPE_POST);
+                               $this->post($request, $post);
+                               break;
+                       case Router::PUT:
+                               $this->response->setType(IRespondToRequests::TYPE_PUT);
+                               $this->put();
+                               break;
+                       default:
+                               // "rawContent" is especially meant for technical endpoints.
+                               // This endpoint doesn't need any theme initialization or other comparable stuff.
+                               $this->rawContent($request);
+
+                               try {
+                                       $arr = ['content' => ''];
+                                       Hook::callAll(static::class . '_mod_content', $arr);
+                                       $this->response->addContent($arr['content']);
+                                       $this->response->addContent($this->content($_REQUEST));
+                               } catch (HTTPException $e) {
+                                       $this->response->addContent((new ModuleHTTPException())->content($e));
+                               }
+                               break;
                }
 
-               if ($this->server['REQUEST_METHOD'] === Router::PUT) {
-                       $this->put();
-               }
-
-               // "rawContent" is especially meant for technical endpoints.
-               // This endpoint doesn't need any theme initialization or other comparable stuff.
-               $this->rawContent($request);
-
-               try {
-                       $arr = ['content' => ''];
-                       Hook::callAll(static::class . '_mod_content', $arr);
-                       $content = $arr['content'];
-                       return $content . $this->content($_REQUEST);
-               } catch (HTTPException $e) {
-                       return (new ModuleHTTPException())->content($e);
-               }
+               return $this->response;
        }
 
        /*
@@ -250,9 +263,9 @@ abstract class BaseModule implements ICanHandleRequests
         */
        public static function getFormSecurityToken($typename = '')
        {
-               $user = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
+               $user      = User::getById(DI::app()->getLoggedInUserId(), ['guid', 'prvkey']);
                $timestamp = time();
-               $sec_hash = hash('whirlpool', ($user['guid'] ?? '') . ($user['prvkey'] ?? '') . session_id() . $timestamp . $typename);
+               $sec_hash  = hash('whirlpool', ($user['guid'] ?? '') . ($user['prvkey'] ?? '') . session_id() . $timestamp . $typename);
 
                return $timestamp . '.' . $sec_hash;
        }
index 6c4ae51385410f49c73178ba493215f10385c4cd..ceb580875a334b185413dd92d4ea66331dacb1a7 100644 (file)
@@ -13,9 +13,9 @@ interface ICanHandleRequests
         * @param array $post    The $_POST content (in case of POST)
         * @param array $request The $_REQUEST content (in case of GET, POST)
         *
-        * @return string Returns the content of the module as string
+        * @return IRespondToRequests responding to the request handling
         *
         * @throws HTTPException\InternalServerErrorException
         */
-       public function run(array $post = [], array $request = []): string;
+       public function run(array $post = [], array $request = []): IRespondToRequests;
 }
diff --git a/src/Capabilities/ICanReadAndWriteToResponds.php b/src/Capabilities/ICanReadAndWriteToResponds.php
new file mode 100644 (file)
index 0000000..6b8ed5a
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Friendica\Capabilities;
+
+use Friendica\Network\HTTPException\InternalServerErrorException;
+
+interface ICanReadAndWriteToResponds extends IRespondToRequests
+{
+       /**
+        * Adds a header entry to the module response
+        *
+        * @param string $key
+        * @param string $value
+        */
+       public function addHeader(string $key, string $value);
+
+       /**
+        * Adds output content to the module response
+        *
+        * @param string $content
+        */
+       public function addContent(string $content);
+
+       /**
+        * Sets the response type of the current request
+        *
+        * @param string $type
+        *
+        * @throws InternalServerErrorException
+        */
+       public function setType(string $type);
+}
diff --git a/src/Capabilities/IRespondToRequests.php b/src/Capabilities/IRespondToRequests.php
new file mode 100644 (file)
index 0000000..974802f
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Friendica\Capabilities;
+
+interface IRespondToRequests
+{
+       const TYPE_CONTENT     = 'content';
+       const TYPE_RAW_CONTENT = 'rawContent';
+       const TYPE_POST        = 'post';
+       const TYPE_PUT         = 'put';
+       const TYPE_DELETE      = 'delete';
+       const TYPE_PATCH       = 'patch';
+
+       const ALLOWED_TYPES = [
+               self::TYPE_CONTENT,
+               self::TYPE_RAW_CONTENT,
+               self::TYPE_POST,
+               self::TYPE_PUT,
+               self::TYPE_DELETE,
+               self::TYPE_PATCH,
+       ];
+
+       /**
+        * Returns all set headers during the module execution
+        *
+        * @return string[][]
+        */
+       public function getHeaders(): array;
+
+       /**
+        * Returns the output of the module
+        *
+        * @return string
+        */
+       public function getContent(): string;
+
+       /**
+        * Returns the response type of the current request
+        *
+        * @return string
+        */
+       public function getTyp(): string;
+}
index bd1792ca5975c4bef388a1a8d9e0240d5252f860..f0dfe0e01522d9e68ab796f448e9d66e96c7b9e2 100644 (file)
@@ -22,6 +22,7 @@
 namespace Friendica;
 
 use Friendica\Core\L10n;
+use Friendica\Module\Response;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
 
@@ -41,9 +42,9 @@ class LegacyModule extends BaseModule
         */
        private $moduleName = '';
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, string $file_path = '', array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, string $file_path = '', array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->setModuleFile($file_path);
 
index 17a573a1d624b31938ef6b730960fabf15f91ba7..1eb3018d56235e4ae98021a9025975724c561b80 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Module\BaseAdmin;
+use Friendica\Module\Response;
 use Friendica\Util\Profiler;
 use Friendica\Util\Strings;
 use Psr\Log\LoggerInterface;
@@ -36,9 +37,9 @@ class Embed extends BaseAdmin
        /** @var App\Mode */
        protected $mode;
 
-       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, App\Mode $mode, array $server, array $parameters = [])
+       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Mode $mode, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->app  = $app;
                $this->mode = $mode;
index c8fc6703c4d527fc0c9b6c03daa34e7b3d874cda..ecf2cdc5ba5577ca58d2a304a5df988c612ddf5e 100644 (file)
 namespace Friendica\Module\Admin;
 
 use Friendica\App;
-use Friendica\App\BaseURL;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Module\BaseAdmin;
+use Friendica\Module\Response;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
 
@@ -37,9 +37,9 @@ class Tos extends BaseAdmin
        /** @var IManageConfigValues */
        protected $config;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Module\Tos $tos, IManageConfigValues $config, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, \Friendica\Module\Tos $tos, IManageConfigValues $config, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->tos     = $tos;
                $this->config  = $config;
index a0e5ab11e035f8930710b69a1d39881ccca1e749..2b2936820def35eb5401fe7256541531fc9119df 100644 (file)
@@ -29,6 +29,7 @@ use Friendica\Model\Profile;
 use Friendica\Model\User;
 use Friendica\Module\BaseApi;
 use Friendica\Model\Contact;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPException;
 use Friendica\Util\Profiler;
 use Friendica\Util\Strings;
@@ -39,9 +40,9 @@ abstract class ContactEndpoint extends BaseApi
        const DEFAULT_COUNT = 20;
        const MAX_COUNT = 200;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                self::checkAllowedScope(self::SCOPE_READ);
        }
index bb3b64aec518e39be9428c7956011c935ccb70f1..6b8d18b94244385d2c3dbccf26a4461d07527412 100644 (file)
@@ -36,9 +36,9 @@ use Psr\Log\LoggerInterface;
  */
 class Apps extends BaseModule
 {
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $privateaddons = $config->get('config', 'private_addons');
                if ($privateaddons === "1" && !local_user()) {
index bea0147dd9c11c510dd6c709990f5708c818130b..bd19fb4777c35b55b8673b4c17ef276304649afc 100644 (file)
@@ -89,9 +89,9 @@ abstract class BaseNotifications extends BaseModule
         */
        abstract public function getNotifications();
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                if (!local_user()) {
                        throw new ForbiddenException($this->t('Permission denied.'));
index d0a7d0b6c0a4e00062017e2630e4bbe7328a9cf8..ff8d2c3af944a410ac7bd87fe7f5e4cb0c48ffe9 100644 (file)
@@ -28,10 +28,8 @@ use Friendica\DI;
 
 class BaseSettings extends BaseModule
 {
-       protected function content(array $request = []): string
+       public static function createAside()
        {
-               $a = DI::app();
-
                $tpl = Renderer::getMarkupTemplate('settings/head.tpl');
                DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
                        '$ispublic' => DI::l10n()->t('everybody')
@@ -125,6 +123,13 @@ class BaseSettings extends BaseModule
                        '$class' => 'settings-widget',
                        '$items' => $tabs,
                ]);
+       }
+
+       protected function content(array $request = []): string
+       {
+               $a = DI::app();
+
+               static::createAside();
 
                return '';
        }
index e34d6321b64694cf1f0467275f57dda1cc12e231..2d99abf72da6612c3ab9d2957cf1ff598b113ea3 100644 (file)
@@ -32,6 +32,7 @@ use Friendica\Core\Session;
 use Friendica\Database\Database;
 use Friendica\Model;
 use Friendica\Module\Contact;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPException\BadRequestException;
 use Friendica\Network\HTTPException\ForbiddenException;
 use Friendica\Util\Profiler;
@@ -48,9 +49,9 @@ class Advanced extends BaseModule
        /** @var Page */
        protected $page;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->dba  = $dba;
                $this->page = $page;
index edb3e6586d49428ff5ef1a47273d1a6111660ee9..4c3a6dade58abcdd8836c2a9eb0e0ebf8ec078d2 100644 (file)
@@ -30,6 +30,7 @@ use Friendica\Core\Renderer;
 use Friendica\Database\Database;
 use Friendica\Model;
 use Friendica\Module\Contact;
+use Friendica\Module\Response;
 use Friendica\Module\Security\Login;
 use Friendica\Network\HTTPException;
 use Friendica\Util\Profiler;
@@ -43,9 +44,9 @@ class Revoke extends BaseModule
        /** @var Database */
        protected $dba;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->dba     = $dba;
 
index d85a85819c9b0e5bc56ddcd6a815fd166ed0ee95..5d6d03658ab3f1d0b9168010172399dbf049a655 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\BaseModule;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Model;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
 use Friendica\Protocol;
 use Friendica\Util\Profiler;
@@ -39,9 +40,9 @@ class Feed extends BaseModule
        /** @var ICanSendHttpRequests */
        protected $httpClient;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->httpClient = $httpClient;
 
index 60a9716f4e4bfd192d11476167d7ef3f017a38a4..242b774b33a450190d9c5ae677545a0dc997675d 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\BaseModule;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\L10n;
 use Friendica\Model\User;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPException;
 use Friendica\Protocol\Diaspora;
 use Friendica\Util\Network;
@@ -41,9 +42,9 @@ class Receive extends BaseModule
        /** @var IManageConfigValues */
        protected $config;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->config = $config;
        }
index 26801d3e9254da55f4ef2eadf62cfa6d313498a6..3adf4f1fb5fc2e3ec57e257c01402487bf4bad98 100644 (file)
@@ -27,6 +27,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\Model;
+use Friendica\Module\Response;
 use Friendica\Network\HTTPException;
 use Friendica\Util\Profiler;
 use Friendica\Util\XML;
@@ -37,9 +38,9 @@ use Psr\Log\LoggerInterface;
  */
 class SaveTag extends BaseModule
 {
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                if (!local_user()) {
                        notice($this->t('You must be logged in to use this module'));
index 79d5fd81391f21ae887c4d0401d661a30dac3da1..153f86d60765b1975489bb3c547c42a685df3eb3 100644 (file)
@@ -48,9 +48,9 @@ class FriendSuggest extends BaseModule
        /** @var \Friendica\Contact\FriendSuggest\Factory\FriendSuggest */
        protected $friendSuggestFac;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler,Database $dba, \Friendica\Contact\FriendSuggest\Repository\FriendSuggest $friendSuggestRepo, \Friendica\Contact\FriendSuggest\Factory\FriendSuggest $friendSuggestFac, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, \Friendica\Contact\FriendSuggest\Repository\FriendSuggest $friendSuggestRepo, \Friendica\Contact\FriendSuggest\Factory\FriendSuggest $friendSuggestFac, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                if (!local_user()) {
                        throw new ForbiddenException($this->t('Permission denied.'));
index a65e699afb0d54c8aa46f697ab747182c8bbb816..2b287d96beaaf720e540826311ec4b4e9341f984 100644 (file)
@@ -73,9 +73,9 @@ class Install extends BaseModule
        /** @var App\Mode */
        protected $mode;
 
-       public function __construct(App $app, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Core\Installer $installer, array $server, array $parameters = [])
+       public function __construct(App $app, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Core\Installer $installer, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->app       = $app;
                $this->mode      = $mode;
index 10c30c57a0ec2dd8159aa35cff83923fc375c20e..c861d3054b73e1f68f520171447e8be40210bb14 100644 (file)
@@ -49,9 +49,9 @@ class Magic extends BaseModule
        /** @var ICanSendHttpRequests */
        protected $httpClient;
 
-       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
+       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->app        = $app;
                $this->dba        = $dba;
index 10d2bbb9fcdd0516d2f7492e58cf779b09d64a85..f8eacb85eddd301cb80f5c3ff7e42cbfb3e5cddb 100644 (file)
@@ -32,6 +32,7 @@ use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Model\User;
 use Friendica\Module\BaseNotifications;
+use Friendica\Module\Response;
 use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory;
 use Friendica\Navigation\Notifications\ValueObject\Introduction;
 use Friendica\Util\Profiler;
@@ -47,9 +48,9 @@ class Introductions extends BaseNotifications
        /** @var Mode */
        protected $mode;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Mode $mode, IntroductionFactory $notificationIntro, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Mode $mode, IntroductionFactory $notificationIntro, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->notificationIntro = $notificationIntro;
                $this->mode              = $mode;
index 6b9a9fa28d81482a1644611778ddd2cbd92a71fc..5ed8a014196b37722316cfe8f5acb4fd4ab3cedc 100644 (file)
@@ -27,6 +27,7 @@ use Friendica\Content\Nav;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Module\BaseNotifications;
+use Friendica\Module\Response;
 use Friendica\Navigation\Notifications\ValueObject\FormattedNotification;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
@@ -43,9 +44,9 @@ class Notifications extends BaseNotifications
        /** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification */
        protected $formattedNotificationFactory;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->formattedNotificationFactory = $formattedNotificationFactory;
        }
index 3f7b3d3fd098ad8a885da6b21c77d7d999baeeb4..6980380fced308f8ca46cbd6361e8f1caaed0f6e 100644 (file)
@@ -37,11 +37,11 @@ class Index extends BaseModule
 {
        protected function rawContent(array $request = [])
        {
-               (new Profile($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->rawContent();
+               (new Profile($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->rawContent();
        }
 
        protected function content(array $request = []): string
        {
-               return (new Status($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->content();
+               return (new Status($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->content();
        }
 }
index 90c30078179fa58de981bb00031fab8e02990332..baadef489849438530553f06846b3561328b11e4 100644 (file)
@@ -49,9 +49,9 @@ class Register extends BaseModule
        /** @var Tos */
        protected $tos;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Tos $tos, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Tos $tos, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->tos = $tos;
        }
index ee74078dde8842bb1038dcb071f5542452c28191..ee2dcfe4dcf7b816b9f181844d4939bff14ac172 100644 (file)
@@ -49,9 +49,9 @@ class RemoteFollow extends BaseModule
        /** @var Page */
        protected $page;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->owner = User::getOwnerDataByNick($this->parameters['profile']);
                if (!$this->owner) {
diff --git a/src/Module/Response.php b/src/Module/Response.php
new file mode 100644 (file)
index 0000000..87fbbf0
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\Capabilities\ICanReadAndWriteToResponds;
+use Friendica\Capabilities\IRespondToRequests;
+use Friendica\Network\HTTPException\InternalServerErrorException;
+
+class Response implements ICanReadAndWriteToResponds
+{
+       /**
+        * @var string[][]
+        */
+       protected $headers = [];
+       /**
+        * @var string
+        */
+       protected $content = '';
+       /**
+        * @var string
+        */
+       protected $type = IRespondToRequests::TYPE_CONTENT;
+
+       /**
+        * {@inheritDoc}
+        */
+       public function addHeader(string $key, string $value)
+       {
+               $this->headers[$key][] = $value;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function addContent(string $content)
+       {
+               $this->content .= $content;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function getHeaders(): array
+       {
+               return $this->headers;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function getContent(): string
+       {
+               return $this->content;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function setType(string $type)
+       {
+               if (!in_array($type, IRespondToRequests::ALLOWED_TYPES)) {
+                       throw new InternalServerErrorException('wrong type');
+               }
+
+               $this->type = $type;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function getTyp(): string
+       {
+               return $this->type;
+       }
+}
index fd20352bf7570552a4dfa280ec70a467512c79a9..9dd1ed0196502849495115b5405333008d4b6aa1 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\BaseModule;
 use Friendica\Core\L10n;
 use Friendica\Core\Search;
 use Friendica\Database\Database;
+use Friendica\Module\Response;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
 
@@ -34,9 +35,9 @@ class Saved extends BaseModule
        /** @var Database */
        protected $dba;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler,  Database $dba, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->dba = $dba;
        }
index b8bc0f0224279796abc20f9581253cb5153f875d..f9c702d51b22af2543ff308aa934b59a766dd582 100644 (file)
@@ -30,6 +30,7 @@ use Friendica\Core\Session\Capability\IHandleSessions;
 use Friendica\Core\System;
 use Friendica\Model\Profile;
 use Friendica\Model\User\Cookie;
+use Friendica\Module\Response;
 use Friendica\Security\TwoFactor;
 use Friendica\Util\Profiler;
 use Psr\Log\LoggerInterface;
@@ -48,9 +49,9 @@ class Logout extends BaseModule
        /** @var TwoFactor\Repository\TrustedBrowser */
        protected $trustedBrowserRepo;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->cache              = $cache;
                $this->cookie             = $cookie;
index 6b5c86e661565d472e61dd927e9878c49c0fd1e8..6556e07c233c8aba025ded0b42895846bccd53cc 100644 (file)
@@ -27,6 +27,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session\Capability\IHandleSessions;
 use Friendica\Model\User;
+use Friendica\Module\Response;
 use Friendica\Security\Authentication;
 use Friendica\Security\TwoFactor\Model\RecoveryCode;
 use Friendica\Util\Profiler;
@@ -46,9 +47,9 @@ class Recovery extends BaseModule
        /** @var Authentication */
        protected $auth;
 
-       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Authentication $auth, IHandleSessions $session, array $server, array $parameters = [])
+       public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Authentication $auth, IHandleSessions $session, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->app     = $app;
                $this->auth    = $auth;
index d87f27eccbfc5642a47d27bbfdf16655158b8991..94dfc6d4121df6ada787f62fc069c996c3021c15 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Renderer;
+use Friendica\Module\Response;
 use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
 use Friendica\Module\BaseSettings;
 use Friendica\Module\Security\Login;
@@ -43,9 +44,9 @@ class AppSpecific extends BaseSettings
        /** @var IManagePersonalConfigValues */
        protected $pConfig;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->pConfig = $pConfig;
 
index 0d324aacaf9f7d4a6a9d08995029c56aafcf0c94..fb13b8b60d65d11819ea2e63b5181279f14406b6 100644 (file)
@@ -25,6 +25,7 @@ use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Renderer;
+use Friendica\Module\Response;
 use Friendica\Security\TwoFactor\Model\RecoveryCode;
 use Friendica\Module\BaseSettings;
 use Friendica\Module\Security\Login;
@@ -41,9 +42,9 @@ class Recovery extends BaseSettings
        /** @var IManagePersonalConfigValues */
        protected $pConfig;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->pConfig = $pConfig;
 
index 4e6068e237e688d08b6db23a37a92bde0c2c1714..1507d5fc5ea1ccf776c3e4c89c8248dbfee7ff4c 100644 (file)
@@ -7,6 +7,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Renderer;
 use Friendica\Module\BaseSettings;
+use Friendica\Module\Response;
 use Friendica\Security\TwoFactor;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Profiler;
@@ -24,9 +25,9 @@ class Trusted extends BaseSettings
        /** @var TwoFactor\Repository\TrustedBrowser */
        protected $trustedBrowserRepo;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->pConfig            = $pConfig;
                $this->trustedBrowserRepo = $trustedBrowserRepo;
index 29569dae0599a71158406ecf03e7b6b9e8a567c6..3c1853d7f3deae237c2a404fce6601ba5cbb459d 100644 (file)
@@ -31,6 +31,7 @@ use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session;
 use Friendica\Module\BaseSettings;
+use Friendica\Module\Response;
 use Friendica\Module\Security\Login;
 use Friendica\Util\Profiler;
 use PragmaRX\Google2FA\Google2FA;
@@ -46,9 +47,9 @@ class Verify extends BaseSettings
        /** @var IManagePersonalConfigValues */
        protected $pConfig;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->pConfig = $pConfig;
 
index 408999b57238a5619724ba20de28b51ea9777741..823b399a500b5f509ee76f8c1010de6cfb0e7acb 100644 (file)
@@ -35,9 +35,9 @@ class Statistics extends BaseModule
        /** @var IManageConfigValues */
        protected $config;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, Response $response, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->config = $config;
 
index 53ef9492059e59a5e9fec1fab8d6a998a8105888..78e4df69c26cc3f9ae65aba810bea913bab39227 100644 (file)
@@ -48,9 +48,9 @@ class Tos extends BaseModule
         * be properties of the class, however cannot be set directly as the property
         * cannot depend on a function result when declaring the variable.
         **/
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->config  = $config;