From: Philipp Date: Sat, 20 Nov 2021 14:38:03 +0000 (+0100) Subject: Make `BaseModule` a real entity X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8bdd90066f82a7ff1be36be3c6c3b49800a078c8;p=friendica.git Make `BaseModule` a real entity - Add all dependencies, necessary to run the content (baseUrl, Arguments) - Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule - Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well) --- diff --git a/src/App.php b/src/App.php index 9083e98ad6..14980896ef 100644 --- a/src/App.php +++ b/src/App.php @@ -116,11 +116,6 @@ class App */ private $args; - /** - * @var Core\System The system methods - */ - private $system; - /** * @var IManagePersonalConfigValues */ @@ -326,10 +321,9 @@ class App * @param Profiler $profiler The profiler of this application * @param L10n $l10n The translator instance * @param App\Arguments $args The Friendica Arguments of the call - * @param Core\System $system The system methods * @param IManagePersonalConfigValues $pConfig Personal configuration */ - public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\System $system, IManagePersonalConfigValues $pConfig) + public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig) { $this->database = $database; $this->config = $config; @@ -339,7 +333,6 @@ class App $this->logger = $logger; $this->l10n = $l10n; $this->args = $args; - $this->system = $system; $this->pConfig = $pConfig; $this->load(); @@ -608,7 +601,7 @@ class App // Only continue when the given profile link seems valid // Valid profile links contain a path with "/profile/" and no query parameters if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") && - strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) { + strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) { if (Core\Session::get('visitor_home') != $_GET["zrl"]) { Core\Session::set('my_url', $_GET['zrl']); Core\Session::set('authenticated', 0); @@ -700,7 +693,7 @@ class App $page['page_title'] = $moduleName; if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) { - $module = new Maintenance($this->l10n); + $module = $router->getModule(Maintenance::class); } else { // determine the module class and save it to the module instance // @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet) @@ -708,12 +701,11 @@ class App } // Let the module run it's internal process (init, get, post, ...) - $module->run($this->baseURL, $this->args, $this->logger, $this->profiler, $_SERVER, $_POST); + $content = $module->run($_POST, $_REQUEST); + $page->run($this, $this->baseURL, $this->args, $this->mode, $content, $this->l10n, $this->profiler, $this->config, $pconfig); } catch (HTTPException $e) { (new ModuleHTTPException())->rawContent($e); } - - $page->run($this, $this->baseURL, $this->args, $this->mode, $module, $this->l10n, $this->profiler, $this->config, $pconfig); } /** diff --git a/src/App/Page.php b/src/App/Page.php index 0efdc12051..d302ef6c24 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -25,7 +25,6 @@ use ArrayAccess; use DOMDocument; use DOMXPath; use Friendica\App; -use Friendica\Capabilities\ICanHandleRequests; use Friendica\Content\Nav; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; @@ -33,7 +32,6 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Core\Theme; -use Friendica\Module\Special\HTTPException as ModuleHTTPException; use Friendica\Network\HTTPException; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -269,9 +267,9 @@ class Page implements ArrayAccess if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) { $pageURL .= "s"; } - + $pageURL .= "://"; - + if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") { $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; } else { @@ -338,24 +336,13 @@ class Page implements ArrayAccess * - module content * - hooks for content * - * @param ICanHandleRequests $module The module - * @param Mode $mode The Friendica execution mode + * @param string $content The content to print + * @param Mode $mode The Friendica execution mode * * @throws HTTPException\InternalServerErrorException */ - private function initContent(ICanHandleRequests $module, Mode $mode) + private function initContent(string $content, Mode $mode) { - $content = ''; - - try { - $arr = ['content' => $content]; - Hook::callAll($module->getClassName() . '_mod_content', $arr); - $content = $arr['content']; - $content .= $module->content(); - } catch (HTTPException $e) { - $content = (new ModuleHTTPException())->content($e); - } - // initialise content region if ($mode->isNormal()) { Hook::callAll('page_content_top', $this->page['content']); @@ -390,14 +377,14 @@ class Page implements ArrayAccess * @param BaseURL $baseURL The Friendica Base URL * @param Arguments $args The Friendica App arguments * @param Mode $mode The current node mode - * @param ICanHandleRequests $module The loaded Friendica module + * @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 * - * @throws HTTPException\InternalServerErrorException + * @throws HTTPException\InternalServerErrorException|HTTPException\ServiceUnavailableException */ - public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, ICanHandleRequests $module, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig) + public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, string $content, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig) { $moduleName = $args->getModuleName(); @@ -407,7 +394,7 @@ class Page implements ArrayAccess * Sets the $Page->page['content'] variable */ $timestamp = microtime(true); - $this->initContent($module, $mode); + $this->initContent($content, $mode); $profiler->set(microtime(true) - $timestamp, 'content'); // Load current theme info after module has been initialized as theme could have been set in module diff --git a/src/App/Router.php b/src/App/Router.php index 880f9a2f88..b13334ae08 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -39,6 +39,7 @@ use Friendica\Module\HTTPException\MethodNotAllowed; use Friendica\Module\HTTPException\PageNotFound; use Friendica\Network\HTTPException; use Friendica\Network\HTTPException\MethodNotAllowedException; +use Friendica\Network\HTTPException\NoContentException; use Friendica\Network\HTTPException\NotFoundException; /** @@ -103,6 +104,9 @@ class Router /** @var string */ private $baseRoutesFilepath; + /** @var array */ + private $server; + /** * @param array $server The $_SERVER variable * @param string $baseRoutesFilepath The path to a base routes file to leverage cache, can be empty @@ -123,8 +127,17 @@ class Router $this->args = $args; $this->config = $config; $this->dice = $dice; + $this->server = $server; + + $httpMethod = $this->server['REQUEST_METHOD'] ?? self::GET; + + // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS + // @todo Check allowed methods per requested path + if ($httpMethod === static::OPTIONS) { + header('Allow: ' . implode(',', Router::ALLOWED_METHODS)); + throw new NoContentException(); + } - $httpMethod = $server['REQUEST_METHOD'] ?? self::GET; $this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET; $this->routeCollector = isset($routeCollector) ? @@ -268,10 +281,9 @@ class Router return $moduleClass; } - public function getModule(): ICanHandleRequests + public function getModule(?string $module_class = null): ICanHandleRequests { - $module_class = null; - $module_parameters = []; + $module_parameters = [$this->server]; /** * ROUTING * @@ -279,7 +291,7 @@ class Router * post() and/or content() static methods can be respectively called to produce a data change or an output. **/ try { - $module_class = $this->getModuleClass(); + $module_class = $module_class ?? $this->getModuleClass(); $module_parameters[] = $this->parameters; } catch (MethodNotAllowedException $e) { $module_class = MethodNotAllowed::class; diff --git a/src/BaseModule.php b/src/BaseModule.php index 9b3bd8a570..65fc8f307c 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -23,11 +23,12 @@ namespace Friendica; use Friendica\App\Router; use Friendica\Capabilities\ICanHandleRequests; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Model\User; -use Friendica\Module\HTTPException\PageNotFound; -use Friendica\Network\HTTPException\NoContentException; +use Friendica\Module\Special\HTTPException as ModuleHTTPException; +use Friendica\Network\HTTPException; use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; @@ -44,14 +45,28 @@ abstract class BaseModule implements ICanHandleRequests { /** @var array */ protected $parameters = []; - /** @var L10n */ protected $l10n; + /** @var App\BaseURL */ + protected $baseUrl; + /** @var App\Arguments */ + protected $args; + /** @var LoggerInterface */ + protected $logger; + /** @var Profiler */ + protected $profiler; + /** @var array */ + protected $server; - public function __construct(L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = []) { $this->parameters = $parameters; $this->l10n = $l10n; + $this->baseUrl = $baseUrl; + $this->args = $args; + $this->logger = $logger; + $this->profiler = $profiler; + $this->server = $server; } /** @@ -75,48 +90,75 @@ abstract class BaseModule implements ICanHandleRequests } /** - * {@inheritDoc} + * Module GET method to display raw content from technical endpoints + * + * Extend this method if the module is supposed to return communication data, + * e.g. from protocol implementations. + * + * @param string[] $request The $_REQUEST content */ - public function rawContent() + protected function rawContent(array $request = []) { // echo ''; // exit; } /** - * {@inheritDoc} + * Module GET method to display any content + * + * Extend this method if the module is supposed to return any display + * through a GET request. It can be an HTML page through templating or a + * XML feed or a JSON output. + * + * @param string[] $request The $_REQUEST content */ - public function content(): string + protected function content(array $request = []): string { return ''; } /** - * {@inheritDoc} + * Module DELETE method to process submitted data + * + * Extend this method if the module is supposed to process DELETE requests. + * Doesn't display any content */ - public function delete() + protected function delete() { } /** - * {@inheritDoc} + * Module PATCH method to process submitted data + * + * Extend this method if the module is supposed to process PATCH requests. + * Doesn't display any content */ - public function patch() + protected function patch() { } /** - * {@inheritDoc} + * Module POST method to process submitted data + * + * Extend this method if the module is supposed to process POST requests. + * Doesn't display any content + * + * @param string[] $request The $_REQUEST content + * @param string[] $post The $_POST content + * */ - public function post() + protected function post(array $request = [], array $post = []) { - // DI::baseurl()->redirect('module'); + // $this->baseUrl->redirect('module'); } /** - * {@inheritDoc} + * Module PUT method to process submitted data + * + * Extend this method if the module is supposed to process PUT requests. + * Doesn't display any content */ - public function put() + protected function put() { } @@ -126,92 +168,73 @@ abstract class BaseModule implements ICanHandleRequests return static::class; } - public function run(App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $post) + /** + * {@inheritDoc} + */ + public function run(array $post = [], array $request = []): string { - /* The URL provided does not resolve to a valid module. - * - * On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'. - * We don't like doing this, but as it occasionally accounts for 10-20% or more of all site traffic - - * we are going to trap this and redirect back to the requested page. As long as you don't have a critical error on your page - * this will often succeed and eventually do the right thing. - * - * Otherwise we are going to emit a 404 not found. - */ - if (static::class === PageNotFound::class) { - $queryString = $server['QUERY_STRING']; - // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit. - if (!empty($queryString) && preg_match('/{[0-9]}/', $queryString) !== 0) { - exit(); - } - - if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) { - $logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $server['REQUEST_URI']]); - $baseUrl->redirect($server['REQUEST_URI']); - } - - $logger->debug('index.php: page not found.', ['request_uri' => $server['REQUEST_URI'], 'address' => $server['REMOTE_ADDR'], 'query' => $server['QUERY_STRING']]); - } - // @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb - if (substr($_REQUEST['pagename'] ?? '', 0, 12) == '.well-known/') { + if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Methods: ' . Router::GET); header('Access-Control-Allow-Credentials: false'); - } elseif (substr($_REQUEST['pagename'] ?? '', 0, 8) == 'profile/') { + } elseif (substr($request['pagename'] ?? '', 0, 8) == 'profile/') { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Methods: ' . Router::GET); header('Access-Control-Allow-Credentials: false'); - } elseif (substr($_REQUEST['pagename'] ?? '', 0, 4) == 'api/') { + } elseif (substr($request['pagename'] ?? '', 0, 4) == 'api/') { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS)); header('Access-Control-Allow-Credentials: false'); header('Access-Control-Expose-Headers: Link'); - } elseif (substr($_REQUEST['pagename'] ?? '', 0, 11) == 'oauth/token') { + } elseif (substr($request['pagename'] ?? '', 0, 11) == 'oauth/token') { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Methods: ' . Router::POST); header('Access-Control-Allow-Credentials: false'); } - // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS - // @todo Check allowed methods per requested path - if ($server['REQUEST_METHOD'] === Router::OPTIONS) { - header('Allow: ' . implode(',', Router::ALLOWED_METHODS)); - throw new NoContentException(); - } - $placeholder = ''; - $profiler->set(microtime(true), 'ready'); + $this->profiler->set(microtime(true), 'ready'); $timestamp = microtime(true); - Core\Hook::callAll($args->getModuleName() . '_mod_init', $placeholder); + Core\Hook::callAll($this->args->getModuleName() . '_mod_init', $placeholder); - $profiler->set(microtime(true) - $timestamp, 'init'); + $this->profiler->set(microtime(true) - $timestamp, 'init'); - if ($server['REQUEST_METHOD'] === Router::DELETE) { + if ($this->server['REQUEST_METHOD'] === Router::DELETE) { $this->delete(); } - if ($server['REQUEST_METHOD'] === Router::PATCH) { + if ($this->server['REQUEST_METHOD'] === Router::PATCH) { $this->patch(); } - if ($server['REQUEST_METHOD'] === Router::POST) { - Core\Hook::callAll($args->getModuleName() . '_mod_post', $post); - $this->post(); + if ($this->server['REQUEST_METHOD'] === Router::POST) { + Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post); + $this->post($request, $post); } - if ($server['REQUEST_METHOD'] === Router::PUT) { + 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(); + $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); + } } /* diff --git a/src/Capabilities/ICanHandleRequests.php b/src/Capabilities/ICanHandleRequests.php index 23feec2b73..6c4ae51385 100644 --- a/src/Capabilities/ICanHandleRequests.php +++ b/src/Capabilities/ICanHandleRequests.php @@ -2,59 +2,20 @@ namespace Friendica\Capabilities; +use Friendica\Network\HTTPException; + /** * This interface provides the capability to handle requests from clients and returns the desired outcome */ interface ICanHandleRequests { /** - * Module GET method to display raw content from technical endpoints + * @param array $post The $_POST content (in case of POST) + * @param array $request The $_REQUEST content (in case of GET, POST) * - * Extend this method if the module is supposed to return communication data, - * e.g. from protocol implementations. - */ - public function rawContent(); - - /** - * Module GET method to display any content + * @return string Returns the content of the module as string * - * Extend this method if the module is supposed to return any display - * through a GET request. It can be an HTML page through templating or a - * XML feed or a JSON output. + * @throws HTTPException\InternalServerErrorException */ - public function content(): string; - - /** - * Module DELETE method to process submitted data - * - * Extend this method if the module is supposed to process DELETE requests. - * Doesn't display any content - */ - public function delete(); - - /** - * Module PATCH method to process submitted data - * - * Extend this method if the module is supposed to process PATCH requests. - * Doesn't display any content - */ - public function patch(); - - /** - * Module POST method to process submitted data - * - * Extend this method if the module is supposed to process POST requests. - * Doesn't display any content - */ - public function post(); - - /** - * Module PUT method to process submitted data - * - * Extend this method if the module is supposed to process PUT requests. - * Doesn't display any content - */ - public function put(); - - public function getClassName(): string; + public function run(array $post = [], array $request = []): string; } diff --git a/src/LegacyModule.php b/src/LegacyModule.php index d307d84ac8..aae7db50a2 100644 --- a/src/LegacyModule.php +++ b/src/LegacyModule.php @@ -22,6 +22,8 @@ namespace Friendica; use Friendica\Core\L10n; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * This mock module enable class encapsulation of legacy global function modules. @@ -39,9 +41,9 @@ class LegacyModule extends BaseModule */ private $moduleName = ''; - public function __construct(L10n $l10n, string $file_path = '', array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, string $file_path = '', array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->setModuleFile($file_path); @@ -65,13 +67,15 @@ class LegacyModule extends BaseModule require_once $file_path; } - public function content(): string + public function content(array $request = []): string { return $this->runModuleFunction('content'); } - public function post() + public function post(array $request = [], array $post = []) { + parent::post($post); + $this->runModuleFunction('post'); } diff --git a/src/Module/AccountManagementControlDocument.php b/src/Module/AccountManagementControlDocument.php index 8de9e80afb..9a96ad68fb 100644 --- a/src/Module/AccountManagementControlDocument.php +++ b/src/Module/AccountManagementControlDocument.php @@ -30,7 +30,7 @@ use Friendica\BaseModule; */ class AccountManagementControlDocument extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $output = [ 'version' => 1, diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 81b2c2391c..5e37e614e0 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -31,7 +31,7 @@ use Friendica\Network\HTTPException\NotFoundException; */ class Acctlink extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $addr = trim($_GET['addr'] ?? ''); if (!$addr) { diff --git a/src/Module/ActivityPub/Followers.php b/src/Module/ActivityPub/Followers.php index d25e4693c9..5dd3a274a2 100644 --- a/src/Module/ActivityPub/Followers.php +++ b/src/Module/ActivityPub/Followers.php @@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub; */ class Followers extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['nickname'])) { throw new \Friendica\Network\HTTPException\NotFoundException(); diff --git a/src/Module/ActivityPub/Following.php b/src/Module/ActivityPub/Following.php index 3b45cf09a6..7a17edd1d7 100644 --- a/src/Module/ActivityPub/Following.php +++ b/src/Module/ActivityPub/Following.php @@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub; */ class Following extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['nickname'])) { throw new \Friendica\Network\HTTPException\NotFoundException(); diff --git a/src/Module/ActivityPub/Inbox.php b/src/Module/ActivityPub/Inbox.php index 149e511069..19a695fc70 100644 --- a/src/Module/ActivityPub/Inbox.php +++ b/src/Module/ActivityPub/Inbox.php @@ -35,7 +35,7 @@ use Friendica\Util\Network; */ class Inbox extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $postdata = Network::postdata(); diff --git a/src/Module/ActivityPub/Objects.php b/src/Module/ActivityPub/Objects.php index 5798c5685d..a2c553746a 100644 --- a/src/Module/ActivityPub/Objects.php +++ b/src/Module/ActivityPub/Objects.php @@ -41,7 +41,7 @@ use Friendica\Util\Strings; */ class Objects extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['guid'])) { throw new HTTPException\BadRequestException(); diff --git a/src/Module/ActivityPub/Outbox.php b/src/Module/ActivityPub/Outbox.php index c459a55e30..7cfadff949 100644 --- a/src/Module/ActivityPub/Outbox.php +++ b/src/Module/ActivityPub/Outbox.php @@ -31,7 +31,7 @@ use Friendica\Util\HTTPSignature; */ class Outbox extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['nickname'])) { throw new \Friendica\Network\HTTPException\NotFoundException(); diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index bab52fb0de..90abc54b57 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -30,7 +30,7 @@ use Friendica\Util\Strings; class Details extends BaseAdmin { - public function post() + public function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -52,7 +52,7 @@ class Details extends BaseAdmin DI::baseUrl()->redirect($redirect); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php index 6330ee2cfa..aa61594313 100644 --- a/src/Module/Admin/Addons/Index.php +++ b/src/Module/Admin/Addons/Index.php @@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin; class Index extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Blocklist/Contact.php b/src/Module/Admin/Blocklist/Contact.php index a0a5c282f8..1263b7c3f8 100644 --- a/src/Module/Admin/Blocklist/Contact.php +++ b/src/Module/Admin/Blocklist/Contact.php @@ -32,7 +32,7 @@ use Friendica\Util\Network; class Contact extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -76,7 +76,7 @@ class Contact extends BaseAdmin DI::baseUrl()->redirect('admin/blocklist/contact'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Blocklist/Server/Add.php b/src/Module/Admin/Blocklist/Server/Add.php index 47c9016d90..b7397d22b1 100644 --- a/src/Module/Admin/Blocklist/Server/Add.php +++ b/src/Module/Admin/Blocklist/Server/Add.php @@ -32,7 +32,7 @@ use GuzzleHttp\Psr7\Uri; class Add extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -66,7 +66,7 @@ class Add extends BaseAdmin DI::baseUrl()->redirect('admin/blocklist/server'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Blocklist/Server/Index.php b/src/Module/Admin/Blocklist/Server/Index.php index ebd39d36a8..3be131fac3 100644 --- a/src/Module/Admin/Blocklist/Server/Index.php +++ b/src/Module/Admin/Blocklist/Server/Index.php @@ -27,7 +27,7 @@ use Friendica\Module\BaseAdmin; class Index extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -56,7 +56,7 @@ class Index extends BaseAdmin DI::baseUrl()->redirect('admin/blocklist/server'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php index 6ef8d804ae..dac953dc88 100644 --- a/src/Module/Admin/DBSync.php +++ b/src/Module/Admin/DBSync.php @@ -30,7 +30,7 @@ use Friendica\Module\BaseAdmin; class DBSync extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index d2c8e2d83a..f5fea300fc 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin; class Features extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -60,7 +60,7 @@ class Features extends BaseAdmin DI::baseUrl()->redirect('admin/features'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php index 65d0453d93..d0b906d02b 100644 --- a/src/Module/Admin/Federation.php +++ b/src/Module/Admin/Federation.php @@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin; class Federation extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Item/Delete.php b/src/Module/Admin/Item/Delete.php index 91bb71932e..4ae0563e56 100644 --- a/src/Module/Admin/Item/Delete.php +++ b/src/Module/Admin/Item/Delete.php @@ -29,7 +29,7 @@ use Friendica\Util\Strings; class Delete extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -55,7 +55,7 @@ class Delete extends BaseAdmin DI::baseUrl()->redirect('admin/item/delete'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php index c1edabf608..2a60330291 100644 --- a/src/Module/Admin/Item/Source.php +++ b/src/Module/Admin/Item/Source.php @@ -29,7 +29,7 @@ use Friendica\Module\BaseAdmin; class Source extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index aaf603f825..6f09b2957b 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -29,7 +29,7 @@ use Psr\Log\LogLevel; class Settings extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -56,7 +56,7 @@ class Settings extends BaseAdmin DI::baseUrl()->redirect('admin/logs'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Logs/View.php b/src/Module/Admin/Logs/View.php index 3e312204b0..92055ec294 100644 --- a/src/Module/Admin/Logs/View.php +++ b/src/Module/Admin/Logs/View.php @@ -31,7 +31,7 @@ class View extends BaseAdmin { const LIMIT = 500; - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/PhpInfo.php b/src/Module/Admin/PhpInfo.php index e6cad66c76..2932a8d658 100644 --- a/src/Module/Admin/PhpInfo.php +++ b/src/Module/Admin/PhpInfo.php @@ -25,7 +25,7 @@ use Friendica\Module\BaseAdmin; class PhpInfo extends BaseAdmin { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAdminAccess(); diff --git a/src/Module/Admin/Queue.php b/src/Module/Admin/Queue.php index f43dfdc095..6fe4facefd 100644 --- a/src/Module/Admin/Queue.php +++ b/src/Module/Admin/Queue.php @@ -38,7 +38,7 @@ use Friendica\Util\DateTimeFormat; */ class Queue extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 27623880ae..71f042f8d7 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -43,7 +43,7 @@ require_once __DIR__ . '/../../../boot.php'; class Site extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -384,7 +384,7 @@ class Site extends BaseAdmin DI::baseUrl()->redirect('admin/site' . $active_panel); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Storage.php b/src/Module/Admin/Storage.php index 68d7d065d0..796f88bb32 100644 --- a/src/Module/Admin/Storage.php +++ b/src/Module/Admin/Storage.php @@ -31,7 +31,7 @@ use Friendica\Util\Strings; class Storage extends BaseAdmin { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -91,7 +91,7 @@ class Storage extends BaseAdmin DI::baseUrl()->redirect('admin/storage'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 5b2efca1e0..c919524b1e 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -37,7 +37,7 @@ use Friendica\Util\DateTimeFormat; class Summary extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php index b7161d1b96..7d64ce6370 100644 --- a/src/Module/Admin/Themes/Details.php +++ b/src/Module/Admin/Themes/Details.php @@ -30,7 +30,7 @@ use Friendica\Util\Strings; class Details extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 0d2a2dc047..17a573a1d6 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -25,24 +25,23 @@ use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Module\BaseAdmin; +use Friendica\Util\Profiler; use Friendica\Util\Strings; +use Psr\Log\LoggerInterface; class Embed extends BaseAdmin { /** @var App */ protected $app; - /** @var App\BaseURL */ - protected $baseUrl; /** @var App\Mode */ protected $mode; - public function __construct(App $app, App\BaseURL $baseUrl, App\Mode $mode, L10n $l10n, array $parameters = []) + public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, App\Mode $mode, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); - $this->app = $app; - $this->baseUrl = $baseUrl; - $this->mode = $mode; + $this->app = $app; + $this->mode = $mode; $theme = Strings::sanitizeFilePathItem($this->parameters['theme']); if (is_file("view/theme/$theme/config.php")) { @@ -50,7 +49,7 @@ class Embed extends BaseAdmin } } - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -70,7 +69,7 @@ class Embed extends BaseAdmin $this->baseUrl->redirect('admin/themes/' . $theme . '/embed?mode=minimal'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php index ad4dfef94e..0b458a9095 100644 --- a/src/Module/Admin/Themes/Index.php +++ b/src/Module/Admin/Themes/Index.php @@ -29,7 +29,7 @@ use Friendica\Util\Strings; class Index extends BaseAdmin { - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php index 0e019cc329..c8fc6703c4 100644 --- a/src/Module/Admin/Tos.php +++ b/src/Module/Admin/Tos.php @@ -21,11 +21,14 @@ 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\Util\Profiler; +use Psr\Log\LoggerInterface; class Tos extends BaseAdmin { @@ -33,19 +36,16 @@ class Tos extends BaseAdmin protected $tos; /** @var IManageConfigValues */ protected $config; - /** @var BaseURL */ - protected $baseUrl; - public function __construct(\Friendica\Module\Tos $tos, IManageConfigValues $config, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->tos = $tos; $this->config = $config; - $this->baseUrl = $baseUrl; } - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -66,7 +66,7 @@ class Tos extends BaseAdmin $this->baseUrl->redirect('admin/tos'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Active.php b/src/Module/Admin/Users/Active.php index 6bcd22be4e..fa8847d0ff 100644 --- a/src/Module/Admin/Users/Active.php +++ b/src/Module/Admin/Users/Active.php @@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers; class Active extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -60,7 +60,7 @@ class Active extends BaseUsers DI::baseUrl()->redirect(DI::args()->getQueryString()); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Blocked.php b/src/Module/Admin/Users/Blocked.php index a24c95df0b..8a8c105fa8 100644 --- a/src/Module/Admin/Users/Blocked.php +++ b/src/Module/Admin/Users/Blocked.php @@ -31,7 +31,7 @@ use Friendica\Util\Temporal; class Blocked extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -61,7 +61,7 @@ class Blocked extends BaseUsers DI::baseUrl()->redirect('admin/users/blocked'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Create.php b/src/Module/Admin/Users/Create.php index 71ab5b4cb9..644b934342 100644 --- a/src/Module/Admin/Users/Create.php +++ b/src/Module/Admin/Users/Create.php @@ -28,7 +28,7 @@ use Friendica\Module\Admin\BaseUsers; class Create extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -51,7 +51,7 @@ class Create extends BaseUsers DI::baseUrl()->redirect('admin/users/create'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Deleted.php b/src/Module/Admin/Users/Deleted.php index 6357b23963..4ebe153b87 100644 --- a/src/Module/Admin/Users/Deleted.php +++ b/src/Module/Admin/Users/Deleted.php @@ -33,7 +33,7 @@ use Friendica\Util\Temporal; class Deleted extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -44,7 +44,7 @@ class Deleted extends BaseUsers DI::baseUrl()->redirect('admin/users/deleted'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Index.php b/src/Module/Admin/Users/Index.php index eb7b57c25c..d0f29ee398 100644 --- a/src/Module/Admin/Users/Index.php +++ b/src/Module/Admin/Users/Index.php @@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers; class Index extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -67,7 +67,7 @@ class Index extends BaseUsers DI::baseUrl()->redirect(DI::args()->getQueryString()); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Admin/Users/Pending.php b/src/Module/Admin/Users/Pending.php index 801c159742..2917bc2607 100644 --- a/src/Module/Admin/Users/Pending.php +++ b/src/Module/Admin/Users/Pending.php @@ -33,7 +33,7 @@ use Friendica\Util\Temporal; class Pending extends BaseUsers { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAdminAccess(); @@ -58,7 +58,7 @@ class Pending extends BaseUsers DI::baseUrl()->redirect('admin/users/pending'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Api/Friendica/Activity.php b/src/Module/Api/Friendica/Activity.php index 1b2b95d06a..c65d32d0e7 100644 --- a/src/Module/Api/Friendica/Activity.php +++ b/src/Module/Api/Friendica/Activity.php @@ -40,7 +40,7 @@ use Friendica\Module\BaseApi; */ class Activity extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/DirectMessages/Setseen.php b/src/Module/Api/Friendica/DirectMessages/Setseen.php index 600d5fe171..6e1f3675fc 100644 --- a/src/Module/Api/Friendica/DirectMessages/Setseen.php +++ b/src/Module/Api/Friendica/DirectMessages/Setseen.php @@ -30,7 +30,7 @@ use Friendica\Module\BaseApi; */ class Setseen extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Events/Index.php b/src/Module/Api/Friendica/Events/Index.php index b6cfdd0982..177e26f52b 100644 --- a/src/Module/Api/Friendica/Events/Index.php +++ b/src/Module/Api/Friendica/Events/Index.php @@ -33,7 +33,7 @@ use Friendica\Module\BaseApi; */ class Index extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Group/Delete.php b/src/Module/Api/Friendica/Group/Delete.php index d78ea658e2..9583c003d7 100644 --- a/src/Module/Api/Friendica/Group/Delete.php +++ b/src/Module/Api/Friendica/Group/Delete.php @@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Delete extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Index.php b/src/Module/Api/Friendica/Index.php index cc0428ae1e..53229b98e7 100644 --- a/src/Module/Api/Friendica/Index.php +++ b/src/Module/Api/Friendica/Index.php @@ -32,17 +32,17 @@ require_once __DIR__ . '/../../../../include/api.php'; */ class Index extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); } - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_WRITE); } - public function rawContent() + protected function rawContent(array $request = []) { echo api_call(DI::args()->getCommand(), $this->parameters['extension'] ?? 'json'); exit(); diff --git a/src/Module/Api/Friendica/Notification.php b/src/Module/Api/Friendica/Notification.php index 9d316d94da..76bce7de27 100644 --- a/src/Module/Api/Friendica/Notification.php +++ b/src/Module/Api/Friendica/Notification.php @@ -31,7 +31,7 @@ use Friendica\Object\Api\Friendica\Notification as ApiNotification; */ class Notification extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Photo/Delete.php b/src/Module/Api/Friendica/Photo/Delete.php index ab749b4e87..7da819a7a2 100644 --- a/src/Module/Api/Friendica/Photo/Delete.php +++ b/src/Module/Api/Friendica/Photo/Delete.php @@ -33,7 +33,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException; */ class Delete extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Photoalbum/Delete.php b/src/Module/Api/Friendica/Photoalbum/Delete.php index 0a403270d1..a8bb5d45e9 100644 --- a/src/Module/Api/Friendica/Photoalbum/Delete.php +++ b/src/Module/Api/Friendica/Photoalbum/Delete.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException; */ class Delete extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Photoalbum/Update.php b/src/Module/Api/Friendica/Photoalbum/Update.php index 9fc89dbf6d..d4d6017909 100644 --- a/src/Module/Api/Friendica/Photoalbum/Update.php +++ b/src/Module/Api/Friendica/Photoalbum/Update.php @@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException; */ class Update extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Friendica/Profile/Show.php b/src/Module/Api/Friendica/Profile/Show.php index 8f60c0f84b..27a19f48e5 100644 --- a/src/Module/Api/Friendica/Profile/Show.php +++ b/src/Module/Api/Friendica/Profile/Show.php @@ -33,7 +33,7 @@ use Friendica\Network\HTTPException; */ class Show extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/GNUSocial/GNUSocial/Config.php b/src/Module/Api/GNUSocial/GNUSocial/Config.php index 6e661d2d72..a3556fcdd9 100644 --- a/src/Module/Api/GNUSocial/GNUSocial/Config.php +++ b/src/Module/Api/GNUSocial/GNUSocial/Config.php @@ -31,7 +31,7 @@ use Friendica\Module\Register; */ class Config extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { $config = [ 'site' => [ diff --git a/src/Module/Api/GNUSocial/GNUSocial/Version.php b/src/Module/Api/GNUSocial/GNUSocial/Version.php index c9c7b98fd1..67f23628c1 100644 --- a/src/Module/Api/GNUSocial/GNUSocial/Version.php +++ b/src/Module/Api/GNUSocial/GNUSocial/Version.php @@ -29,7 +29,7 @@ use Friendica\DI; */ class Version extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null); } diff --git a/src/Module/Api/GNUSocial/Help/Test.php b/src/Module/Api/GNUSocial/Help/Test.php index 78f18c3e60..e2f05183e6 100644 --- a/src/Module/Api/GNUSocial/Help/Test.php +++ b/src/Module/Api/GNUSocial/Help/Test.php @@ -29,7 +29,7 @@ use Friendica\DI; */ class Test extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) { $ok = 'true'; diff --git a/src/Module/Api/Mastodon/Accounts.php b/src/Module/Api/Mastodon/Accounts.php index 552889661b..043d94b6da 100644 --- a/src/Module/Api/Mastodon/Accounts.php +++ b/src/Module/Api/Mastodon/Accounts.php @@ -35,7 +35,7 @@ class Accounts extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Block.php b/src/Module/Api/Mastodon/Accounts/Block.php index b2ae98bd56..a4e0bb88b7 100644 --- a/src/Module/Api/Mastodon/Accounts/Block.php +++ b/src/Module/Api/Mastodon/Accounts/Block.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Block extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php index fe92696a08..c476d1090d 100644 --- a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php +++ b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php @@ -32,7 +32,7 @@ class FeaturedTags extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); diff --git a/src/Module/Api/Mastodon/Accounts/Follow.php b/src/Module/Api/Mastodon/Accounts/Follow.php index 2076d33075..443ac25402 100644 --- a/src/Module/Api/Mastodon/Accounts/Follow.php +++ b/src/Module/Api/Mastodon/Accounts/Follow.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Follow extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Followers.php b/src/Module/Api/Mastodon/Accounts/Followers.php index 4c1a6429c5..08c56b3d44 100644 --- a/src/Module/Api/Mastodon/Accounts/Followers.php +++ b/src/Module/Api/Mastodon/Accounts/Followers.php @@ -34,7 +34,7 @@ class Followers extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Following.php b/src/Module/Api/Mastodon/Accounts/Following.php index 4b67c97008..ded1e6a4b6 100644 --- a/src/Module/Api/Mastodon/Accounts/Following.php +++ b/src/Module/Api/Mastodon/Accounts/Following.php @@ -34,7 +34,7 @@ class Following extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php index 88379440ab..1edef9d81e 100644 --- a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php +++ b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php @@ -32,7 +32,7 @@ class IdentityProofs extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); diff --git a/src/Module/Api/Mastodon/Accounts/Lists.php b/src/Module/Api/Mastodon/Accounts/Lists.php index f34b961b63..7a77902e7a 100644 --- a/src/Module/Api/Mastodon/Accounts/Lists.php +++ b/src/Module/Api/Mastodon/Accounts/Lists.php @@ -35,7 +35,7 @@ class Lists extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Mute.php b/src/Module/Api/Mastodon/Accounts/Mute.php index 1c711db750..824277348f 100644 --- a/src/Module/Api/Mastodon/Accounts/Mute.php +++ b/src/Module/Api/Mastodon/Accounts/Mute.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Mute extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Note.php b/src/Module/Api/Mastodon/Accounts/Note.php index fe4611754d..cb0c181350 100644 --- a/src/Module/Api/Mastodon/Accounts/Note.php +++ b/src/Module/Api/Mastodon/Accounts/Note.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Note extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Relationships.php b/src/Module/Api/Mastodon/Accounts/Relationships.php index 451b7b49ec..c3c8864468 100644 --- a/src/Module/Api/Mastodon/Accounts/Relationships.php +++ b/src/Module/Api/Mastodon/Accounts/Relationships.php @@ -34,7 +34,7 @@ class Relationships extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php index fb3aafaec2..b7b963e11f 100644 --- a/src/Module/Api/Mastodon/Accounts/Search.php +++ b/src/Module/Api/Mastodon/Accounts/Search.php @@ -37,7 +37,7 @@ class Search extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index 5bf7b49346..9027c68a4f 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -39,7 +39,7 @@ class Statuses extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Unblock.php b/src/Module/Api/Mastodon/Accounts/Unblock.php index ae2414b8ac..23d78e739b 100644 --- a/src/Module/Api/Mastodon/Accounts/Unblock.php +++ b/src/Module/Api/Mastodon/Accounts/Unblock.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Unblock extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Unfollow.php b/src/Module/Api/Mastodon/Accounts/Unfollow.php index a15c946bb6..81f919a694 100644 --- a/src/Module/Api/Mastodon/Accounts/Unfollow.php +++ b/src/Module/Api/Mastodon/Accounts/Unfollow.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Unfollow extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/Unmute.php b/src/Module/Api/Mastodon/Accounts/Unmute.php index d1410f7824..c9673b98c3 100644 --- a/src/Module/Api/Mastodon/Accounts/Unmute.php +++ b/src/Module/Api/Mastodon/Accounts/Unmute.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Unmute extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php index 2c55bff43e..1a390d4a1f 100644 --- a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php +++ b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php @@ -32,7 +32,7 @@ use Friendica\Util\HTTPInputData; */ class UpdateCredentials extends BaseApi { - public function patch() + protected function patch() { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php index 0cce460375..472ca7f565 100644 --- a/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php +++ b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php @@ -35,7 +35,7 @@ class VerifyCredentials extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Announcements.php b/src/Module/Api/Mastodon/Announcements.php index b8d231df6a..46b1e85e05 100644 --- a/src/Module/Api/Mastodon/Announcements.php +++ b/src/Module/Api/Mastodon/Announcements.php @@ -32,7 +32,7 @@ class Announcements extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); diff --git a/src/Module/Api/Mastodon/Apps.php b/src/Module/Api/Mastodon/Apps.php index a00bd40857..7b0b103c4c 100644 --- a/src/Module/Api/Mastodon/Apps.php +++ b/src/Module/Api/Mastodon/Apps.php @@ -35,7 +35,7 @@ class Apps extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function post() + protected function post(array $request = [], array $post = []) { $request = self::getRequest([ 'client_name' => '', diff --git a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php index e9720da0f8..89e2fed086 100644 --- a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php +++ b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php @@ -30,7 +30,7 @@ use Friendica\Module\BaseApi; */ class VerifyCredentials extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $application = self::getCurrentApplication(); diff --git a/src/Module/Api/Mastodon/Blocks.php b/src/Module/Api/Mastodon/Blocks.php index 1f8b7ae6ab..fe08f875dd 100644 --- a/src/Module/Api/Mastodon/Blocks.php +++ b/src/Module/Api/Mastodon/Blocks.php @@ -34,7 +34,7 @@ class Blocks extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Bookmarks.php b/src/Module/Api/Mastodon/Bookmarks.php index 7b51e4316c..e5fcaeeaf5 100644 --- a/src/Module/Api/Mastodon/Bookmarks.php +++ b/src/Module/Api/Mastodon/Bookmarks.php @@ -36,7 +36,7 @@ class Bookmarks extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Conversations.php b/src/Module/Api/Mastodon/Conversations.php index a3f6a26a28..fc32c76ccc 100644 --- a/src/Module/Api/Mastodon/Conversations.php +++ b/src/Module/Api/Mastodon/Conversations.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Conversations extends BaseApi { - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -49,7 +49,7 @@ class Conversations extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Conversations/Read.php b/src/Module/Api/Mastodon/Conversations/Read.php index 1eadc671c1..a70cdfb00f 100644 --- a/src/Module/Api/Mastodon/Conversations/Read.php +++ b/src/Module/Api/Mastodon/Conversations/Read.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Read extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/CustomEmojis.php b/src/Module/Api/Mastodon/CustomEmojis.php index 1fedf53482..b82a9f7d69 100644 --- a/src/Module/Api/Mastodon/CustomEmojis.php +++ b/src/Module/Api/Mastodon/CustomEmojis.php @@ -37,7 +37,7 @@ class CustomEmojis extends BaseApi * @throws \ImagickException * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows */ - public function rawContent() + protected function rawContent(array $request = []) { $emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList()); diff --git a/src/Module/Api/Mastodon/Directory.php b/src/Module/Api/Mastodon/Directory.php index e48a709596..8ee6ac0360 100644 --- a/src/Module/Api/Mastodon/Directory.php +++ b/src/Module/Api/Mastodon/Directory.php @@ -39,7 +39,7 @@ class Directory extends BaseApi * @throws \ImagickException * @see https://docs.joinmastodon.org/methods/instance/directory/ */ - public function rawContent() + protected function rawContent(array $request = []) { $request = self::getRequest([ 'offset' => 0, // How many accounts to skip before returning results. Default 0. diff --git a/src/Module/Api/Mastodon/Endorsements.php b/src/Module/Api/Mastodon/Endorsements.php index b9a5bc2cdb..6c1097bc21 100644 --- a/src/Module/Api/Mastodon/Endorsements.php +++ b/src/Module/Api/Mastodon/Endorsements.php @@ -32,7 +32,7 @@ class Endorsements extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { System::jsonExit([]); } diff --git a/src/Module/Api/Mastodon/Favourited.php b/src/Module/Api/Mastodon/Favourited.php index 48aa452f24..3d3e6aad1e 100644 --- a/src/Module/Api/Mastodon/Favourited.php +++ b/src/Module/Api/Mastodon/Favourited.php @@ -37,7 +37,7 @@ class Favourited extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Filters.php b/src/Module/Api/Mastodon/Filters.php index 5bf50db1ab..38fc27ebc0 100644 --- a/src/Module/Api/Mastodon/Filters.php +++ b/src/Module/Api/Mastodon/Filters.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Filters extends BaseApi { - public function post() + public function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); @@ -41,7 +41,7 @@ class Filters extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index af4ac5771f..dbdab7e51b 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -42,7 +42,7 @@ class FollowRequests extends BaseApi * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-follow * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-follow */ - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); @@ -82,7 +82,7 @@ class FollowRequests extends BaseApi * @throws \ImagickException * @see https://docs.joinmastodon.org/methods/accounts/follow_requests/ */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Instance.php b/src/Module/Api/Mastodon/Instance.php index b7dc7d700d..ef89de3159 100644 --- a/src/Module/Api/Mastodon/Instance.php +++ b/src/Module/Api/Mastodon/Instance.php @@ -33,7 +33,7 @@ class Instance extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { System::jsonExit(InstanceEntity::get()); } diff --git a/src/Module/Api/Mastodon/Instance/Peers.php b/src/Module/Api/Mastodon/Instance/Peers.php index b1fdd062bd..01b7045b21 100644 --- a/src/Module/Api/Mastodon/Instance/Peers.php +++ b/src/Module/Api/Mastodon/Instance/Peers.php @@ -36,7 +36,7 @@ class Peers extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $return = []; diff --git a/src/Module/Api/Mastodon/Instance/Rules.php b/src/Module/Api/Mastodon/Instance/Rules.php index 3063bf9ead..9154c4d6bf 100644 --- a/src/Module/Api/Mastodon/Instance/Rules.php +++ b/src/Module/Api/Mastodon/Instance/Rules.php @@ -36,7 +36,7 @@ class Rules extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $rules = []; $id = 0; diff --git a/src/Module/Api/Mastodon/Lists.php b/src/Module/Api/Mastodon/Lists.php index e7a66f04db..ec9ad86a34 100644 --- a/src/Module/Api/Mastodon/Lists.php +++ b/src/Module/Api/Mastodon/Lists.php @@ -31,7 +31,7 @@ use Friendica\Model\Group; */ class Lists extends BaseApi { - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -51,7 +51,7 @@ class Lists extends BaseApi System::jsonExit([]); } - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -91,7 +91,7 @@ class Lists extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Lists/Accounts.php b/src/Module/Api/Mastodon/Lists/Accounts.php index feb670b271..66d6f068ec 100644 --- a/src/Module/Api/Mastodon/Lists/Accounts.php +++ b/src/Module/Api/Mastodon/Lists/Accounts.php @@ -35,12 +35,12 @@ use Friendica\Module\BaseApi; */ class Accounts extends BaseApi { - public function delete() + protected function delete() { DI::apiResponse()->unsupported(Router::DELETE); } - public function post() + protected function post(array $request = [], array $post = []) { DI::apiResponse()->unsupported(Router::POST); } @@ -48,7 +48,7 @@ class Accounts extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Markers.php b/src/Module/Api/Mastodon/Markers.php index 6a01a30cfa..5cd38925e4 100644 --- a/src/Module/Api/Mastodon/Markers.php +++ b/src/Module/Api/Mastodon/Markers.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Markers extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); @@ -41,7 +41,7 @@ class Markers extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); diff --git a/src/Module/Api/Mastodon/Media.php b/src/Module/Api/Mastodon/Media.php index dc31bdec68..65663882d4 100644 --- a/src/Module/Api/Mastodon/Media.php +++ b/src/Module/Api/Mastodon/Media.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Media extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -82,7 +82,7 @@ class Media extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Mutes.php b/src/Module/Api/Mastodon/Mutes.php index 191a2d607c..515e04848c 100644 --- a/src/Module/Api/Mastodon/Mutes.php +++ b/src/Module/Api/Mastodon/Mutes.php @@ -34,7 +34,7 @@ class Mutes extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Notifications.php b/src/Module/Api/Mastodon/Notifications.php index 274a857866..664c996c97 100644 --- a/src/Module/Api/Mastodon/Notifications.php +++ b/src/Module/Api/Mastodon/Notifications.php @@ -40,7 +40,7 @@ class Notifications extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Notifications/Clear.php b/src/Module/Api/Mastodon/Notifications/Clear.php index 4249791579..d910fe07df 100644 --- a/src/Module/Api/Mastodon/Notifications/Clear.php +++ b/src/Module/Api/Mastodon/Notifications/Clear.php @@ -30,7 +30,7 @@ use Friendica\Module\BaseApi; */ class Clear extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Notifications/Dismiss.php b/src/Module/Api/Mastodon/Notifications/Dismiss.php index b978e46eee..98861a2753 100644 --- a/src/Module/Api/Mastodon/Notifications/Dismiss.php +++ b/src/Module/Api/Mastodon/Notifications/Dismiss.php @@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\ForbiddenException; */ class Dismiss extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Preferences.php b/src/Module/Api/Mastodon/Preferences.php index 6d846c35bc..14b5efe681 100644 --- a/src/Module/Api/Mastodon/Preferences.php +++ b/src/Module/Api/Mastodon/Preferences.php @@ -34,7 +34,7 @@ class Preferences extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Proofs.php b/src/Module/Api/Mastodon/Proofs.php index c9b92246a8..f39cfcf271 100644 --- a/src/Module/Api/Mastodon/Proofs.php +++ b/src/Module/Api/Mastodon/Proofs.php @@ -32,7 +32,7 @@ class Proofs extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { System::jsonError(404, ['error' => 'Record not found']); } diff --git a/src/Module/Api/Mastodon/PushSubscription.php b/src/Module/Api/Mastodon/PushSubscription.php index e45c943f52..91e79b82db 100644 --- a/src/Module/Api/Mastodon/PushSubscription.php +++ b/src/Module/Api/Mastodon/PushSubscription.php @@ -33,7 +33,7 @@ use Friendica\Object\Api\Mastodon\Notification; */ class PushSubscription extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); @@ -99,7 +99,7 @@ class PushSubscription extends BaseApi return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray(); } - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); @@ -112,7 +112,7 @@ class PushSubscription extends BaseApi System::jsonExit([]); } - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/ScheduledStatuses.php b/src/Module/Api/Mastodon/ScheduledStatuses.php index bfb2cff455..605aaeb6d6 100644 --- a/src/Module/Api/Mastodon/ScheduledStatuses.php +++ b/src/Module/Api/Mastodon/ScheduledStatuses.php @@ -42,7 +42,7 @@ class ScheduledStatuses extends BaseApi DI::apiResponse()->unsupported(Router::PUT); } - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -63,7 +63,7 @@ class ScheduledStatuses extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 6753b09098..026d71f04b 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -40,7 +40,7 @@ class Search extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 50c35f3477..21bb972850 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -41,7 +41,7 @@ use Friendica\Util\Images; */ class Statuses extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); @@ -207,7 +207,7 @@ class Statuses extends BaseApi DI::mstdnError()->InternalError(); } - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); @@ -231,7 +231,7 @@ class Statuses extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Bookmark.php b/src/Module/Api/Mastodon/Statuses/Bookmark.php index de0ef641d3..0ff561189e 100644 --- a/src/Module/Api/Mastodon/Statuses/Bookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Bookmark.php @@ -33,7 +33,7 @@ use Friendica\Module\BaseApi; */ class Bookmark extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Card.php b/src/Module/Api/Mastodon/Statuses/Card.php index d3c1801a29..eeed4bb0a6 100644 --- a/src/Module/Api/Mastodon/Statuses/Card.php +++ b/src/Module/Api/Mastodon/Statuses/Card.php @@ -35,7 +35,7 @@ class Card extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Context.php b/src/Module/Api/Mastodon/Statuses/Context.php index 03782ef1ce..674be5f22d 100644 --- a/src/Module/Api/Mastodon/Statuses/Context.php +++ b/src/Module/Api/Mastodon/Statuses/Context.php @@ -35,7 +35,7 @@ class Context extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Favourite.php b/src/Module/Api/Mastodon/Statuses/Favourite.php index 8ec818a8ff..fc070548b9 100644 --- a/src/Module/Api/Mastodon/Statuses/Favourite.php +++ b/src/Module/Api/Mastodon/Statuses/Favourite.php @@ -33,7 +33,7 @@ use Friendica\Module\BaseApi; */ class Favourite extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/FavouritedBy.php b/src/Module/Api/Mastodon/Statuses/FavouritedBy.php index 37d9e7521a..d29da2c99e 100644 --- a/src/Module/Api/Mastodon/Statuses/FavouritedBy.php +++ b/src/Module/Api/Mastodon/Statuses/FavouritedBy.php @@ -35,7 +35,7 @@ class FavouritedBy extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Mute.php b/src/Module/Api/Mastodon/Statuses/Mute.php index 4a0e943f34..7b7a670517 100644 --- a/src/Module/Api/Mastodon/Statuses/Mute.php +++ b/src/Module/Api/Mastodon/Statuses/Mute.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Mute extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Pin.php b/src/Module/Api/Mastodon/Statuses/Pin.php index 7648d12a0b..9697d795b9 100644 --- a/src/Module/Api/Mastodon/Statuses/Pin.php +++ b/src/Module/Api/Mastodon/Statuses/Pin.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Pin extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Reblog.php b/src/Module/Api/Mastodon/Statuses/Reblog.php index d10149616a..64d30e66dd 100644 --- a/src/Module/Api/Mastodon/Statuses/Reblog.php +++ b/src/Module/Api/Mastodon/Statuses/Reblog.php @@ -35,7 +35,7 @@ use Friendica\Module\BaseApi; */ class Reblog extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/RebloggedBy.php b/src/Module/Api/Mastodon/Statuses/RebloggedBy.php index 52f1e2f67d..a3010e8826 100644 --- a/src/Module/Api/Mastodon/Statuses/RebloggedBy.php +++ b/src/Module/Api/Mastodon/Statuses/RebloggedBy.php @@ -35,7 +35,7 @@ class RebloggedBy extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Unbookmark.php b/src/Module/Api/Mastodon/Statuses/Unbookmark.php index 9279fec60e..3232e12981 100644 --- a/src/Module/Api/Mastodon/Statuses/Unbookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Unbookmark.php @@ -33,7 +33,7 @@ use Friendica\Module\BaseApi; */ class Unbookmark extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Unfavourite.php b/src/Module/Api/Mastodon/Statuses/Unfavourite.php index 7898647acc..7e5081656d 100644 --- a/src/Module/Api/Mastodon/Statuses/Unfavourite.php +++ b/src/Module/Api/Mastodon/Statuses/Unfavourite.php @@ -33,7 +33,7 @@ use Friendica\Module\BaseApi; */ class Unfavourite extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Unmute.php b/src/Module/Api/Mastodon/Statuses/Unmute.php index 80b9c2c541..c380f05d0f 100644 --- a/src/Module/Api/Mastodon/Statuses/Unmute.php +++ b/src/Module/Api/Mastodon/Statuses/Unmute.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Unmute extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Unpin.php b/src/Module/Api/Mastodon/Statuses/Unpin.php index 21f44b7cbb..9af2fe28d2 100644 --- a/src/Module/Api/Mastodon/Statuses/Unpin.php +++ b/src/Module/Api/Mastodon/Statuses/Unpin.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Unpin extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Statuses/Unreblog.php b/src/Module/Api/Mastodon/Statuses/Unreblog.php index 972a6aa1af..27708acad2 100644 --- a/src/Module/Api/Mastodon/Statuses/Unreblog.php +++ b/src/Module/Api/Mastodon/Statuses/Unreblog.php @@ -35,7 +35,7 @@ use Friendica\Module\BaseApi; */ class Unreblog extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Suggestions.php b/src/Module/Api/Mastodon/Suggestions.php index b80c239f63..bda78becf1 100644 --- a/src/Module/Api/Mastodon/Suggestions.php +++ b/src/Module/Api/Mastodon/Suggestions.php @@ -34,7 +34,7 @@ class Suggestions extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Timelines/Direct.php b/src/Module/Api/Mastodon/Timelines/Direct.php index d50c97f47e..ef2a9bb1a3 100644 --- a/src/Module/Api/Mastodon/Timelines/Direct.php +++ b/src/Module/Api/Mastodon/Timelines/Direct.php @@ -35,7 +35,7 @@ class Direct extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index de21bb2a12..2727745f03 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -36,7 +36,7 @@ class Home extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index c9316fdf53..1fe3f3b47f 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -36,7 +36,7 @@ class ListTimeline extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index 162236d1ea..91894f5c6c 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -39,7 +39,7 @@ class PublicTimeline extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index 3571dd7333..701d656e43 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -37,7 +37,7 @@ class Tag extends BaseApi /** * @throws HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Api/Mastodon/Trends.php b/src/Module/Api/Mastodon/Trends.php index 3536e737cb..c9659f7d24 100644 --- a/src/Module/Api/Mastodon/Trends.php +++ b/src/Module/Api/Mastodon/Trends.php @@ -34,7 +34,7 @@ class Trends extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $request = self::getRequest([ 'limit' => 20, // Maximum number of results to return. Defaults to 10. diff --git a/src/Module/Api/Mastodon/Unimplemented.php b/src/Module/Api/Mastodon/Unimplemented.php index f5f76afd57..9874b504a7 100644 --- a/src/Module/Api/Mastodon/Unimplemented.php +++ b/src/Module/Api/Mastodon/Unimplemented.php @@ -33,7 +33,7 @@ class Unimplemented extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function delete() + protected function delete() { DI::apiResponse()->unsupported(Router::DELETE); } @@ -41,7 +41,7 @@ class Unimplemented extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function patch() + protected function patch() { DI::apiResponse()->unsupported(Router::PATCH); } @@ -49,7 +49,7 @@ class Unimplemented extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function post() + protected function post(array $request = [], array $post = []) { DI::apiResponse()->unsupported(Router::POST); } @@ -65,7 +65,7 @@ class Unimplemented extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { DI::apiResponse()->unsupported(Router::GET); } diff --git a/src/Module/Api/Twitter/Account/RateLimitStatus.php b/src/Module/Api/Twitter/Account/RateLimitStatus.php index 9a275cecb9..82cf2c3e66 100644 --- a/src/Module/Api/Twitter/Account/RateLimitStatus.php +++ b/src/Module/Api/Twitter/Account/RateLimitStatus.php @@ -30,7 +30,7 @@ use Friendica\Util\DateTimeFormat; */ class RateLimitStatus extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) { $hash = [ diff --git a/src/Module/Api/Twitter/ContactEndpoint.php b/src/Module/Api/Twitter/ContactEndpoint.php index 9227815a00..a0e5ab11e0 100644 --- a/src/Module/Api/Twitter/ContactEndpoint.php +++ b/src/Module/Api/Twitter/ContactEndpoint.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Api\Twitter; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Database\DBA; use Friendica\DI; @@ -29,16 +30,18 @@ use Friendica\Model\User; use Friendica\Module\BaseApi; use Friendica\Model\Contact; use Friendica\Network\HTTPException; +use Friendica\Util\Profiler; use Friendica\Util\Strings; +use Psr\Log\LoggerInterface; abstract class ContactEndpoint extends BaseApi { const DEFAULT_COUNT = 20; const MAX_COUNT = 200; - public function __construct(L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); self::checkAllowedScope(self::SCOPE_READ); } diff --git a/src/Module/Api/Twitter/Followers/Ids.php b/src/Module/Api/Twitter/Followers/Ids.php index f529fc926b..5f203a0522 100644 --- a/src/Module/Api/Twitter/Followers/Ids.php +++ b/src/Module/Api/Twitter/Followers/Ids.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Ids extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Followers/Lists.php b/src/Module/Api/Twitter/Followers/Lists.php index 0bd3addd59..a812e38da6 100644 --- a/src/Module/Api/Twitter/Followers/Lists.php +++ b/src/Module/Api/Twitter/Followers/Lists.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Lists extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Friends/Ids.php b/src/Module/Api/Twitter/Friends/Ids.php index 0c25700ccf..62164840dc 100644 --- a/src/Module/Api/Twitter/Friends/Ids.php +++ b/src/Module/Api/Twitter/Friends/Ids.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Ids extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/Friends/Lists.php b/src/Module/Api/Twitter/Friends/Lists.php index 25bd32969a..57841c3c90 100644 --- a/src/Module/Api/Twitter/Friends/Lists.php +++ b/src/Module/Api/Twitter/Friends/Lists.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class Lists extends ContactEndpoint { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); diff --git a/src/Module/Api/Twitter/SavedSearches.php b/src/Module/Api/Twitter/SavedSearches.php index ac75316710..3fd30e34ea 100644 --- a/src/Module/Api/Twitter/SavedSearches.php +++ b/src/Module/Api/Twitter/SavedSearches.php @@ -31,7 +31,7 @@ use Friendica\Module\BaseApi; */ class SavedSearches extends BaseApi { - public function rawContent() + protected function rawContent(array $request = []) { self::checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); diff --git a/src/Module/Apps.php b/src/Module/Apps.php index f414f7f8cb..bb3b64aec5 100644 --- a/src/Module/Apps.php +++ b/src/Module/Apps.php @@ -21,21 +21,24 @@ namespace Friendica\Module; +use Friendica\App; use Friendica\App\BaseURL; use Friendica\BaseModule; use Friendica\Content\Nav; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; use Friendica\Core\Renderer; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Shows the App menu */ class Apps extends BaseModule { - public function __construct(L10n $l10n, IManageConfigValues $config, BaseURL $baseUrl, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $privateaddons = $config->get('config', 'private_addons'); if ($privateaddons === "1" && !local_user()) { @@ -43,7 +46,7 @@ class Apps extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $apps = Nav::getAppMenu(); diff --git a/src/Module/Attach.php b/src/Module/Attach.php index c35e6b9ba3..bd785881c3 100644 --- a/src/Module/Attach.php +++ b/src/Module/Attach.php @@ -34,7 +34,7 @@ class Attach extends BaseModule /** * Return to user an attached file given the id */ - public function rawContent() + protected function rawContent(array $request = []) { $a = DI::app(); if (empty($this->parameters['item'])) { diff --git a/src/Module/BaseAdmin.php b/src/Module/BaseAdmin.php index 83e3ca0b17..91b9e85b68 100644 --- a/src/Module/BaseAdmin.php +++ b/src/Module/BaseAdmin.php @@ -68,7 +68,7 @@ abstract class BaseAdmin extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { self::checkAdminAccess(true); diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 03c8467a43..03a28951e3 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -53,7 +53,7 @@ class BaseApi extends BaseModule */ protected static $request = []; - public function delete() + protected function delete() { self::checkAllowedScope(self::SCOPE_WRITE); @@ -62,7 +62,7 @@ class BaseApi extends BaseModule } } - public function patch() + protected function patch() { self::checkAllowedScope(self::SCOPE_WRITE); @@ -71,7 +71,7 @@ class BaseApi extends BaseModule } } - public function post() + protected function post(array $request = [], array $post = []) { self::checkAllowedScope(self::SCOPE_WRITE); diff --git a/src/Module/BaseNotifications.php b/src/Module/BaseNotifications.php index 0e39eb651d..bea0147dd9 100644 --- a/src/Module/BaseNotifications.php +++ b/src/Module/BaseNotifications.php @@ -22,6 +22,7 @@ namespace Friendica\Module; use Exception; +use Friendica\App; use Friendica\App\Arguments; use Friendica\BaseModule; use Friendica\Content\Pager; @@ -30,6 +31,8 @@ use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Navigation\Notifications\ValueObject\FormattedNotification; use Friendica\Network\HTTPException\ForbiddenException; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Base Module for each tab of the notification display @@ -86,9 +89,9 @@ abstract class BaseNotifications extends BaseModule */ abstract public function getNotifications(); - public function __construct(Arguments $args, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); if (!local_user()) { throw new ForbiddenException($this->t('Permission denied.')); @@ -98,11 +101,9 @@ abstract class BaseNotifications extends BaseModule $this->firstItemNum = ($page * self::ITEMS_PER_PAGE) - self::ITEMS_PER_PAGE; $this->showAll = ($_REQUEST['show'] ?? '') === 'all'; - - $this->args = $args; } - public function rawContent() + protected function rawContent(array $request = []) { // If the last argument of the query is NOT json, return if ($this->args->get($this->args->getArgc() - 1) !== 'json') { diff --git a/src/Module/BaseSettings.php b/src/Module/BaseSettings.php index 7afaa35d0a..d0a7d0b6c0 100644 --- a/src/Module/BaseSettings.php +++ b/src/Module/BaseSettings.php @@ -28,7 +28,7 @@ use Friendica\DI; class BaseSettings extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php index 5061254aa1..b5306cca0c 100644 --- a/src/Module/Bookmarklet.php +++ b/src/Module/Bookmarklet.php @@ -34,7 +34,7 @@ use Friendica\Util\Strings; */ class Bookmarklet extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $_GET['mode'] = 'minimal'; diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 2db4af5e9c..8d5e26a261 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -91,7 +91,7 @@ class Contact extends BaseModule DI::baseUrl()->redirect($redirectUrl); } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; diff --git a/src/Module/Contact/Advanced.php b/src/Module/Contact/Advanced.php index 8d0a4e0f3f..e34d6321b6 100644 --- a/src/Module/Contact/Advanced.php +++ b/src/Module/Contact/Advanced.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Contact; +use Friendica\App; use Friendica\App\Page; use Friendica\BaseModule; use Friendica\Content\Widget; @@ -33,6 +34,7 @@ use Friendica\Model; use Friendica\Module\Contact; use Friendica\Network\HTTPException\BadRequestException; use Friendica\Network\HTTPException\ForbiddenException; +use Friendica\Util\Profiler; use Friendica\Util\Strings; use Psr\Log\LoggerInterface; @@ -43,25 +45,22 @@ class Advanced extends BaseModule { /** @var Database */ protected $dba; - /** @var LoggerInterface */ - protected $logger; /** @var Page */ protected $page; - public function __construct(Database $dba, LoggerInterface $logger, Page $page, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); - $this->dba = $dba; - $this->logger = $logger; - $this->page = $page; + $this->dba = $dba; + $this->page = $page; if (!Session::isAuthenticated()) { throw new ForbiddenException($this->t('Permission denied.')); } } - public function post() + protected function post(array $request = [], array $post = []) { $cid = $this->parameters['id']; @@ -110,7 +109,7 @@ class Advanced extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $cid = $this->parameters['id']; diff --git a/src/Module/Contact/Contacts.php b/src/Module/Contact/Contacts.php index bfe689c1e3..4d74935387 100644 --- a/src/Module/Contact/Contacts.php +++ b/src/Module/Contact/Contacts.php @@ -14,7 +14,7 @@ use Friendica\Network\HTTPException; class Contacts extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $app = DI::app(); diff --git a/src/Module/Contact/Hovercard.php b/src/Module/Contact/Hovercard.php index 34560313d7..adc503fa51 100644 --- a/src/Module/Contact/Hovercard.php +++ b/src/Module/Contact/Hovercard.php @@ -35,7 +35,7 @@ use Friendica\Util\Strings; */ class Hovercard extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $contact_url = $_REQUEST['url'] ?? ''; diff --git a/src/Module/Contact/Media.php b/src/Module/Contact/Media.php index a3a498b6d1..f2ff694e48 100644 --- a/src/Module/Contact/Media.php +++ b/src/Module/Contact/Media.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class Media extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $cid = $this->parameters['id']; diff --git a/src/Module/Contact/Poke.php b/src/Module/Contact/Poke.php index 23ec95a435..718095c506 100644 --- a/src/Module/Contact/Poke.php +++ b/src/Module/Contact/Poke.php @@ -18,7 +18,7 @@ use Friendica\Util\XML; class Poke extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user() || empty($this->parameters['id'])) { return self::postReturn(false); @@ -123,7 +123,7 @@ class Poke extends BaseModule return $success; } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.')); diff --git a/src/Module/Contact/Revoke.php b/src/Module/Contact/Revoke.php index 88177cc3b4..edb3e6586d 100644 --- a/src/Module/Contact/Revoke.php +++ b/src/Module/Contact/Revoke.php @@ -21,8 +21,7 @@ namespace Friendica\Module\Contact; -use Friendica\App\Arguments; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Nav; use Friendica\Core\L10n; @@ -33,6 +32,8 @@ use Friendica\Model; use Friendica\Module\Contact; use Friendica\Module\Security\Login; use Friendica\Network\HTTPException; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; class Revoke extends BaseModule { @@ -41,18 +42,12 @@ class Revoke extends BaseModule /** @var Database */ protected $dba; - /** @var BaseURL */ - protected $baseUrl; - /** @var Arguments */ - protected $args; - - public function __construct(Database $dba, BaseURL $baseUrl, Arguments $args, L10n $l10n, array $parameters = []) + + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->dba = $dba; - $this->baseUrl = $baseUrl; - $this->args = $args; if (!local_user()) { return; @@ -78,7 +73,7 @@ class Revoke extends BaseModule } } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(); @@ -98,7 +93,7 @@ class Revoke extends BaseModule $this->baseUrl->redirect('contact/' . $this->parameters['id']); } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form($_SERVER['REQUEST_URI']); diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index d954ef8f39..0edd12c303 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -49,7 +49,7 @@ class Community extends BaseModule protected static $max_id; protected static $item_id; - public function content(): string + protected function content(array $request = []): string { $this->parseRequest(); diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 0f2d9cd6fc..ac04cf2aef 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -57,7 +57,7 @@ class Network extends BaseModule /** @var string */ protected static $order; - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form(); diff --git a/src/Module/Credits.php b/src/Module/Credits.php index fdd4f69749..cdd16c7b45 100644 --- a/src/Module/Credits.php +++ b/src/Module/Credits.php @@ -32,7 +32,7 @@ use Friendica\DI; */ class Credits extends BaseModule { - public function content(): string + protected function content(array $request = []): string { /* fill the page with credits */ $credits_string = file_get_contents('CREDITS.txt'); diff --git a/src/Module/DFRN/Notify.php b/src/Module/DFRN/Notify.php index eda5da9361..de03992da3 100644 --- a/src/Module/DFRN/Notify.php +++ b/src/Module/DFRN/Notify.php @@ -38,7 +38,7 @@ use Friendica\Network\HTTPException; */ class Notify extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { $postdata = Network::postdata(); diff --git a/src/Module/DFRN/Poll.php b/src/Module/DFRN/Poll.php index 0cf43f2a7e..7cb9c29219 100644 --- a/src/Module/DFRN/Poll.php +++ b/src/Module/DFRN/Poll.php @@ -29,7 +29,7 @@ use Friendica\Protocol\OStatus; */ class Poll extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { header("Content-type: application/atom+xml"); $last_update = $_GET['last_update'] ?? ''; diff --git a/src/Module/Debug/ActivityPubConversion.php b/src/Module/Debug/ActivityPubConversion.php index 7f5fa6274d..c9c2526a9c 100644 --- a/src/Module/Debug/ActivityPubConversion.php +++ b/src/Module/Debug/ActivityPubConversion.php @@ -34,7 +34,7 @@ use Friendica\Util\XML; class ActivityPubConversion extends BaseModule { - public function content(): string + protected function content(array $request = []): string { function visible_whitespace($s) { diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index c50bd08d74..d449bd07c4 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -35,7 +35,7 @@ use Friendica\Util\XML; */ class Babel extends BaseModule { - public function content(): string + protected function content(array $request = []): string { function visible_whitespace($s) { diff --git a/src/Module/Debug/Feed.php b/src/Module/Debug/Feed.php index 9368dd0268..d85a85819c 100644 --- a/src/Module/Debug/Feed.php +++ b/src/Module/Debug/Feed.php @@ -21,13 +21,15 @@ namespace Friendica\Module\Debug; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Model; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; use Friendica\Protocol; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Tests a given feed of a contact @@ -37,9 +39,9 @@ class Feed extends BaseModule /** @var ICanSendHttpRequests */ protected $httpClient; - public function __construct(BaseURL $baseUrl, ICanSendHttpRequests $httpClient, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ICanSendHttpRequests $httpClient, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->httpClient = $httpClient; @@ -49,7 +51,7 @@ class Feed extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $result = []; if (!empty($_REQUEST['url'])) { diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php index 3759931145..1477b629d0 100644 --- a/src/Module/Debug/ItemBody.php +++ b/src/Module/Debug/ItemBody.php @@ -31,7 +31,7 @@ use Friendica\Network\HTTPException; */ class ItemBody extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.')); diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php index 6fb91380ae..97a6454850 100644 --- a/src/Module/Debug/Localtime.php +++ b/src/Module/Debug/Localtime.php @@ -31,7 +31,7 @@ class Localtime extends BaseModule { static $mod_localtime = ''; - public function post() + protected function post(array $request = [], array $post = []) { $time = ($_REQUEST['time'] ?? '') ?: 'now'; @@ -42,7 +42,7 @@ class Localtime extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $time = ($_REQUEST['time'] ?? '') ?: 'now'; diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php index fcb7dda218..07f82eaacd 100644 --- a/src/Module/Debug/Probe.php +++ b/src/Module/Debug/Probe.php @@ -32,7 +32,7 @@ use Friendica\Network\Probe as NetworkProbe; */ class Probe extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); diff --git a/src/Module/Debug/WebFinger.php b/src/Module/Debug/WebFinger.php index 4527d2fb22..1f576e7f9a 100644 --- a/src/Module/Debug/WebFinger.php +++ b/src/Module/Debug/WebFinger.php @@ -31,7 +31,7 @@ use Friendica\Network\Probe; */ class WebFinger extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index 2b36fc2a30..b242f5faa3 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -37,7 +37,7 @@ use Friendica\Util\Proxy; */ class Delegation extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -112,7 +112,7 @@ class Delegation extends BaseModule // NOTREACHED } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index e3d6f4616e..7a32dac6d3 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -38,7 +38,7 @@ use Friendica\Util\Strings; */ class Fetch extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['guid'])) { throw new HTTPException\NotFoundException(); diff --git a/src/Module/Diaspora/Receive.php b/src/Module/Diaspora/Receive.php index ed4f8a5d25..60a9716f4e 100644 --- a/src/Module/Diaspora/Receive.php +++ b/src/Module/Diaspora/Receive.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Diaspora; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; @@ -28,6 +29,7 @@ use Friendica\Model\User; use Friendica\Network\HTTPException; use Friendica\Protocol\Diaspora; use Friendica\Util\Network; +use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; /** @@ -36,20 +38,17 @@ use Psr\Log\LoggerInterface; */ class Receive extends BaseModule { - /** @var LoggerInterface */ - protected $logger; /** @var IManageConfigValues */ protected $config; - public function __construct(LoggerInterface $logger, IManageConfigValues $config, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); - - $this->logger = $logger; + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); + $this->config = $config; } - public function post() + protected function post(array $request = [], array $post = []) { $enabled = $this->config->get('system', 'diaspora_enabled', false); if (!$enabled) { diff --git a/src/Module/Directory.php b/src/Module/Directory.php index a81780a280..e43d272619 100644 --- a/src/Module/Directory.php +++ b/src/Module/Directory.php @@ -38,7 +38,7 @@ use Friendica\Network\HTTPException; */ class Directory extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $app = DI::app(); $config = DI::config(); diff --git a/src/Module/Events/Json.php b/src/Module/Events/Json.php index 566cf648a2..859b0621eb 100644 --- a/src/Module/Events/Json.php +++ b/src/Module/Events/Json.php @@ -13,7 +13,7 @@ use Friendica\Util\Temporal; class Json extends \Friendica\BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(); diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 6470ab5c37..f4a671c055 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -41,7 +41,7 @@ use Friendica\Protocol\Feed as ProtocolFeed; */ class Feed extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/Filer/RemoveTag.php b/src/Module/Filer/RemoveTag.php index e6749de020..68d265c5fe 100644 --- a/src/Module/Filer/RemoveTag.php +++ b/src/Module/Filer/RemoveTag.php @@ -33,7 +33,7 @@ use Friendica\Util\XML; */ class RemoveTag extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(); diff --git a/src/Module/Filer/SaveTag.php b/src/Module/Filer/SaveTag.php index fd572a7bea..26801d3e92 100644 --- a/src/Module/Filer/SaveTag.php +++ b/src/Module/Filer/SaveTag.php @@ -21,13 +21,14 @@ namespace Friendica\Module\Filer; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model; use Friendica\Network\HTTPException; +use Friendica\Util\Profiler; use Friendica\Util\XML; use Psr\Log\LoggerInterface; @@ -36,22 +37,17 @@ use Psr\Log\LoggerInterface; */ class SaveTag extends BaseModule { - /** @var LoggerInterface */ - protected $logger; - - public function __construct(LoggerInterface $logger, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); - - $this->logger = $logger; - + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); + if (!local_user()) { notice($this->t('You must be logged in to use this module')); $baseUrl->redirect(); } } - public function rawContent() + protected function rawContent(array $request = []) { $term = XML::unescape(trim($_GET['term'] ?? '')); diff --git a/src/Module/FollowConfirm.php b/src/Module/FollowConfirm.php index 41f811698b..388c07a379 100644 --- a/src/Module/FollowConfirm.php +++ b/src/Module/FollowConfirm.php @@ -10,8 +10,9 @@ use Friendica\Model\Contact; */ class FollowConfirm extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { + parent::post($post); $uid = local_user(); if (!$uid) { notice(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/FriendSuggest.php b/src/Module/FriendSuggest.php index 940e6ff9ce..79d5fd8139 100644 --- a/src/Module/FriendSuggest.php +++ b/src/Module/FriendSuggest.php @@ -21,7 +21,7 @@ namespace Friendica\Module; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Core\Protocol; @@ -31,16 +31,16 @@ use Friendica\Database\Database; use Friendica\Model\Contact as ContactModel; use Friendica\Network\HTTPException\ForbiddenException; use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Util\Profiler; use Friendica\Util\Strings; use Friendica\Worker\Delivery; +use Psr\Log\LoggerInterface; /** * Suggest friends to a known contact */ class FriendSuggest extends BaseModule { - /** @var BaseURL */ - protected $baseUrl; /** @var Database */ protected $dba; /** @var \Friendica\Contact\FriendSuggest\Repository\FriendSuggest */ @@ -48,21 +48,20 @@ class FriendSuggest extends BaseModule /** @var \Friendica\Contact\FriendSuggest\Factory\FriendSuggest */ protected $friendSuggestFac; - public function __construct(BaseURL $baseUrl, Database $dba, \Friendica\Contact\FriendSuggest\Repository\FriendSuggest $friendSuggestRepo, \Friendica\Contact\FriendSuggest\Factory\FriendSuggest $friendSuggestFac, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); if (!local_user()) { throw new ForbiddenException($this->t('Permission denied.')); } - $this->baseUrl = $baseUrl; $this->dba = $dba; $this->friendSuggestRepo = $friendSuggestRepo; $this->friendSuggestFac = $friendSuggestFac; } - public function post() + protected function post(array $request = [], array $post = []) { $cid = intval($this->parameters['contact']); @@ -100,7 +99,7 @@ class FriendSuggest extends BaseModule info($this->t('Friend suggestion sent.')); } - public function content(): string + protected function content(array $request = []): string { $cid = intval($this->parameters['contact']); diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php index b4de151e97..74d9309bdb 100644 --- a/src/Module/Friendica.php +++ b/src/Module/Friendica.php @@ -38,7 +38,7 @@ use Friendica\Protocol\ActivityPub; */ class Friendica extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $config = DI::config(); @@ -110,7 +110,7 @@ class Friendica extends BaseModule ]); } - public function rawContent() + protected function rawContent(array $request = []) { if (ActivityPub::isRequest()) { try { diff --git a/src/Module/Group.php b/src/Module/Group.php index 39eb896d40..883f09cb55 100644 --- a/src/Module/Group.php +++ b/src/Module/Group.php @@ -32,7 +32,7 @@ require_once 'boot.php'; class Group extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { if (DI::mode()->isAjax()) { $this->ajaxPost(); @@ -140,7 +140,7 @@ class Group extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $change = false; diff --git a/src/Module/HCard.php b/src/Module/HCard.php index 110371ee95..12ea65f136 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException; */ class HCard extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') { // A logged in user views a profile of a user diff --git a/src/Module/HTTPException/MethodNotAllowed.php b/src/Module/HTTPException/MethodNotAllowed.php index 07aab537a8..bfe0e18f80 100644 --- a/src/Module/HTTPException/MethodNotAllowed.php +++ b/src/Module/HTTPException/MethodNotAllowed.php @@ -27,7 +27,7 @@ use Friendica\Network\HTTPException; class MethodNotAllowed extends BaseModule { - public function content(): string + protected function content(array $request = []): string { throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.')); } diff --git a/src/Module/HTTPException/PageNotFound.php b/src/Module/HTTPException/PageNotFound.php index 6af5e91ae6..4971ed3cd0 100644 --- a/src/Module/HTTPException/PageNotFound.php +++ b/src/Module/HTTPException/PageNotFound.php @@ -27,8 +27,39 @@ use Friendica\Network\HTTPException; class PageNotFound extends BaseModule { - public function content(): string + protected function content(array $request = []): string { throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.')); } + + public function run(array $post = [], array $request = []): string + { + /* The URL provided does not resolve to a valid module. + * + * On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'. + * We don't like doing this, but as it occasionally accounts for 10-20% or more of all site traffic - + * we are going to trap this and redirect back to the requested page. As long as you don't have a critical error on your page + * this will often succeed and eventually do the right thing. + * + * Otherwise we are going to emit a 404 not found. + */ + $queryString = $this->server['QUERY_STRING']; + // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit. + if (!empty($queryString) && preg_match('/{[0-9]}/', $queryString) !== 0) { + exit(); + } + + if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) { + $this->logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $this->server['REQUEST_URI']]); + $this->baseUrl->redirect($this->server['REQUEST_URI']); + } + + $this->logger->debug('index.php: page not found.', [ + 'request_uri' => $this->server['REQUEST_URI'], + 'address' => $this->server['REMOTE_ADDR'], + 'query' => $this->server['QUERY_STRING'] + ]); + + return parent::run($post, $request); // TODO: Change the autogenerated stub + } } diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 8910d9cce4..1ac73de531 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -31,7 +31,7 @@ use Friendica\Util\Strings; */ class Hashtag extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $result = []; diff --git a/src/Module/Help.php b/src/Module/Help.php index d0b61c2211..f4083c310b 100644 --- a/src/Module/Help.php +++ b/src/Module/Help.php @@ -32,7 +32,7 @@ use Friendica\Network\HTTPException; */ class Help extends BaseModule { - public function content(): string + protected function content(array $request = []): string { Nav::setSelected('help'); diff --git a/src/Module/Home.php b/src/Module/Home.php index f4e6b97339..ca0ce0b725 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -32,7 +32,7 @@ use Friendica\Module\Security\Login; */ class Home extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $app = DI::app(); $config = DI::config(); diff --git a/src/Module/Install.php b/src/Module/Install.php index 4385ba8517..a65e699afb 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -31,7 +31,9 @@ use Friendica\Core\Theme; use Friendica\DI; use Friendica\Network\HTTPException; use Friendica\Util\BasePath; +use Friendica\Util\Profiler; use Friendica\Util\Temporal; +use Psr\Log\LoggerInterface; class Install extends BaseModule { @@ -70,16 +72,13 @@ class Install extends BaseModule protected $app; /** @var App\Mode */ protected $mode; - /** @var App\BaseURL */ - protected $baseUrl; - public function __construct(App $app, App\Mode $mode, App\BaseURL $baseUrl, App\Arguments $args, Core\Installer $installer, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->app = $app; $this->mode = $mode; - $this->baseUrl = $baseUrl; $this->installer = $installer; if (!$this->mode->isInstall()) { @@ -105,7 +104,7 @@ class Install extends BaseModule $this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; } - public function post() + protected function post(array $request = [], array $post = []) { $configCache = $this->app->getConfigCache(); @@ -187,7 +186,7 @@ class Install extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $configCache = $this->app->getConfigCache(); diff --git a/src/Module/Invite.php b/src/Module/Invite.php index 10346a5162..8c9c59d304 100644 --- a/src/Module/Invite.php +++ b/src/Module/Invite.php @@ -35,7 +35,7 @@ use Friendica\Util\Strings; */ class Invite extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -124,7 +124,7 @@ class Invite extends BaseModule info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total)); } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Item/Activity.php b/src/Module/Item/Activity.php index 3936aa2bcb..f82d1b4305 100644 --- a/src/Module/Item/Activity.php +++ b/src/Module/Item/Activity.php @@ -38,7 +38,7 @@ use Friendica\Network\HTTPException; */ class Activity extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(); diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php index 6521ddc91a..0564e2f988 100644 --- a/src/Module/Item/Compose.php +++ b/src/Module/Item/Compose.php @@ -40,7 +40,7 @@ use Friendica\Util\Temporal; class Compose extends BaseModule { - public function post() + protected function post(array $request = [], array $post = []) { if (!empty($_REQUEST['body'])) { $_REQUEST['return'] = 'network'; @@ -51,7 +51,7 @@ class Compose extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form('compose', false); diff --git a/src/Module/Item/Follow.php b/src/Module/Item/Follow.php index f893531708..b12a0ac240 100644 --- a/src/Module/Item/Follow.php +++ b/src/Module/Item/Follow.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException; */ class Follow extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $l10n = DI::l10n(); diff --git a/src/Module/Item/Ignore.php b/src/Module/Item/Ignore.php index 33481fd2e3..0987e75e92 100644 --- a/src/Module/Item/Ignore.php +++ b/src/Module/Item/Ignore.php @@ -33,7 +33,7 @@ use Friendica\Network\HTTPException; */ class Ignore extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $l10n = DI::l10n(); diff --git a/src/Module/Item/Pin.php b/src/Module/Item/Pin.php index 12ff946553..71aff6916d 100644 --- a/src/Module/Item/Pin.php +++ b/src/Module/Item/Pin.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException; */ class Pin extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $l10n = DI::l10n(); diff --git a/src/Module/Item/Star.php b/src/Module/Item/Star.php index b3e4ed2a13..1b581f7155 100644 --- a/src/Module/Item/Star.php +++ b/src/Module/Item/Star.php @@ -35,7 +35,7 @@ use Friendica\Network\HTTPException; */ class Star extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $l10n = DI::l10n(); diff --git a/src/Module/Magic.php b/src/Module/Magic.php index c47a7a4d50..10c30c57a0 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -31,6 +31,7 @@ use Friendica\Model\User; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Util\HTTPSignature; +use Friendica\Util\Profiler; use Friendica\Util\Strings; use Psr\Log\LoggerInterface; @@ -43,26 +44,21 @@ class Magic extends BaseModule { /** @var App */ protected $app; - /** @var LoggerInterface */ - protected $logger; /** @var Database */ protected $dba; /** @var ICanSendHttpRequests */ protected $httpClient; - protected $baseUrl; - public function __construct(App $app, App\BaseURL $baseUrl, LoggerInterface $logger, Database $dba, ICanSendHttpRequests $httpClient, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->app = $app; - $this->logger = $logger; $this->dba = $dba; $this->httpClient = $httpClient; - $this->baseUrl = $baseUrl; } - public function rawContent() + protected function rawContent(array $request = []) { $this->logger->info('magic module: invoked'); diff --git a/src/Module/Maintenance.php b/src/Module/Maintenance.php index 2025a5fa4d..b695c53ab9 100644 --- a/src/Module/Maintenance.php +++ b/src/Module/Maintenance.php @@ -34,7 +34,7 @@ use Friendica\Util\Strings; */ class Maintenance extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $reason = DI::config()->get('system', 'maintenance_reason'); diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php index ff462fd3e2..e23b976860 100644 --- a/src/Module/Manifest.php +++ b/src/Module/Manifest.php @@ -27,7 +27,7 @@ use Friendica\DI; class Manifest extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/NoScrape.php b/src/Module/NoScrape.php index 06bce3e248..131cec13c0 100644 --- a/src/Module/NoScrape.php +++ b/src/Module/NoScrape.php @@ -35,7 +35,7 @@ use Friendica\Model\User; */ class NoScrape extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $a = DI::app(); diff --git a/src/Module/NodeInfo110.php b/src/Module/NodeInfo110.php index d8f8a5049a..9e5a4cac97 100644 --- a/src/Module/NodeInfo110.php +++ b/src/Module/NodeInfo110.php @@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo; */ class NodeInfo110 extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/NodeInfo120.php b/src/Module/NodeInfo120.php index aac8c6d4fc..b0d5b18c8c 100644 --- a/src/Module/NodeInfo120.php +++ b/src/Module/NodeInfo120.php @@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo; */ class NodeInfo120 extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/NodeInfo210.php b/src/Module/NodeInfo210.php index cb55411f23..3584e19d73 100644 --- a/src/Module/NodeInfo210.php +++ b/src/Module/NodeInfo210.php @@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo; */ class NodeInfo210 extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/Notifications/Introductions.php b/src/Module/Notifications/Introductions.php index b9bbd0be93..10d2bbb9fc 100644 --- a/src/Module/Notifications/Introductions.php +++ b/src/Module/Notifications/Introductions.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Notifications; +use Friendica\App; use Friendica\App\Arguments; use Friendica\App\Mode; use Friendica\Content\ContactSelector; @@ -33,6 +34,8 @@ use Friendica\Model\User; use Friendica\Module\BaseNotifications; use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory; use Friendica\Navigation\Notifications\ValueObject\Introduction; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Prints notifications about introduction @@ -44,9 +47,9 @@ class Introductions extends BaseNotifications /** @var Mode */ protected $mode; - public function __construct(Mode $mode, IntroductionFactory $notificationIntro, Arguments $args, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Mode $mode, IntroductionFactory $notificationIntro, array $server, array $parameters = []) { - parent::__construct($args, $l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->notificationIntro = $notificationIntro; $this->mode = $mode; @@ -71,7 +74,7 @@ class Introductions extends BaseNotifications ]; } - public function content(): string + protected function content(array $request = []): string { Nav::setSelected('introductions'); diff --git a/src/Module/Notifications/Notification.php b/src/Module/Notifications/Notification.php index 486054f98f..525159840f 100644 --- a/src/Module/Notifications/Notification.php +++ b/src/Module/Notifications/Notification.php @@ -42,7 +42,7 @@ class Notification extends BaseModule * @throws \ImagickException * @throws \Exception */ - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); @@ -73,7 +73,7 @@ class Notification extends BaseModule * * @throws HTTPException\UnauthorizedException */ - public function rawContent() + protected function rawContent(array $request = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); @@ -101,7 +101,7 @@ class Notification extends BaseModule * @throws HTTPException\InternalServerErrorException * @throws \Exception */ - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { notice(DI::l10n()->t('You must be logged in to show this page.')); diff --git a/src/Module/Notifications/Notifications.php b/src/Module/Notifications/Notifications.php index 269acb79db..6b9a9fa28d 100644 --- a/src/Module/Notifications/Notifications.php +++ b/src/Module/Notifications/Notifications.php @@ -21,13 +21,15 @@ namespace Friendica\Module\Notifications; +use Friendica\App; use Friendica\App\Arguments; -use Friendica\App\BaseURL; use Friendica\Content\Nav; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Module\BaseNotifications; use Friendica\Navigation\Notifications\ValueObject\FormattedNotification; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Prints all notification types except introduction: @@ -41,15 +43,11 @@ class Notifications extends BaseNotifications /** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification */ protected $formattedNotificationFactory; - /** @var BaseURL */ - protected $baseUrl; - - public function __construct(BaseURL $baseUrl, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, Arguments $args, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, array $server, array $parameters = []) { - parent::__construct($args, $l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->formattedNotificationFactory = $formattedNotificationFactory; - $this->baseUrl = $baseUrl; } /** @@ -96,7 +94,7 @@ class Notifications extends BaseNotifications ]; } - public function content(): string + protected function content(array $request = []): string { Nav::setSelected('notifications'); diff --git a/src/Module/OAuth/Acknowledge.php b/src/Module/OAuth/Acknowledge.php index f0915df41a..f19837364d 100644 --- a/src/Module/OAuth/Acknowledge.php +++ b/src/Module/OAuth/Acknowledge.php @@ -30,13 +30,13 @@ use Friendica\Module\BaseApi; */ class Acknowledge extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { DI::session()->set('oauth_acknowledge', true); DI::app()->redirect(DI::session()->get('return_path')); } - public function content(): string + protected function content(array $request = []): string { DI::session()->set('return_path', $_REQUEST['return_path'] ?? ''); diff --git a/src/Module/OAuth/Authorize.php b/src/Module/OAuth/Authorize.php index d39cbe353d..851e0f4611 100644 --- a/src/Module/OAuth/Authorize.php +++ b/src/Module/OAuth/Authorize.php @@ -37,7 +37,7 @@ class Authorize extends BaseApi /** * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function rawContent() + protected function rawContent(array $request = []) { $request = self::getRequest([ 'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance. @@ -97,7 +97,7 @@ class Authorize extends BaseApi self::$oauth_code = $token['code']; } - public function content(): string + protected function content(array $request = []): string { if (empty(self::$oauth_code)) { return ''; diff --git a/src/Module/OAuth/Revoke.php b/src/Module/OAuth/Revoke.php index bf906ab454..8e92c63c3f 100644 --- a/src/Module/OAuth/Revoke.php +++ b/src/Module/OAuth/Revoke.php @@ -32,7 +32,7 @@ use Friendica\Module\BaseApi; */ class Revoke extends BaseApi { - public function post() + public function post(array $request = [], array $post = []) { $request = self::getRequest([ 'client_id' => '', // Client ID, obtained during app registration diff --git a/src/Module/OAuth/Token.php b/src/Module/OAuth/Token.php index 6aef63f302..20ba22490c 100644 --- a/src/Module/OAuth/Token.php +++ b/src/Module/OAuth/Token.php @@ -34,7 +34,7 @@ use Friendica\Security\OAuth; */ class Token extends BaseApi { - public function post() + protected function post(array $request = [], array $post = []) { $request = self::getRequest([ 'client_id' => '', // Client ID, obtained during app registration diff --git a/src/Module/Oembed.php b/src/Module/Oembed.php index 1b38c0e973..f433ca188a 100644 --- a/src/Module/Oembed.php +++ b/src/Module/Oembed.php @@ -37,7 +37,7 @@ use Friendica\Util\Strings; */ class Oembed extends BaseModule { - public function content(): string + protected function content(array $request = []): string { // Unused form: /oembed/b2h?url=... if (DI::args()->getArgv()[1] == 'b2h') { diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index e5212c2519..1342ba3af6 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -36,7 +36,7 @@ class OpenSearch extends BaseModule /** * @throws \Exception */ - public function rawContent() + protected function rawContent(array $request = []) { header('Content-type: application/opensearchdescription+xml'); diff --git a/src/Module/Owa.php b/src/Module/Owa.php index 6062f2c998..2b8aa81bdb 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -44,7 +44,7 @@ use Friendica\Util\Strings; */ class Owa extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $ret = [ 'success' => false ]; diff --git a/src/Module/ParseUrl.php b/src/Module/ParseUrl.php index 092d6ec747..7ccc8bd570 100644 --- a/src/Module/ParseUrl.php +++ b/src/Module/ParseUrl.php @@ -31,7 +31,7 @@ use Friendica\Util; class ParseUrl extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!Session::isAuthenticated()) { throw new \Friendica\Network\HTTPException\ForbiddenException(); diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php index 1f6b58e4aa..44176ecf8d 100644 --- a/src/Module/PermissionTooltip.php +++ b/src/Module/PermissionTooltip.php @@ -15,7 +15,7 @@ use Friendica\Network\HTTPException; */ class PermissionTooltip extends \Friendica\BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $type = $this->parameters['type']; $referenceId = $this->parameters['id']; diff --git a/src/Module/Photo.php b/src/Module/Photo.php index 824edeb6af..e1eae44bd7 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -51,7 +51,7 @@ class Photo extends BaseModule * Fetch a photo or an avatar, in optional size, check for permissions and * return the image */ - public function rawContent() + protected function rawContent(array $request = []) { $totalstamp = microtime(true); diff --git a/src/Module/Profile/Common.php b/src/Module/Profile/Common.php index 4a335ddf7f..2bda4466b9 100644 --- a/src/Module/Profile/Common.php +++ b/src/Module/Profile/Common.php @@ -35,7 +35,7 @@ use Friendica\Network\HTTPException; class Common extends BaseProfile { - public function content(): string + protected function content(array $request = []): string { if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); diff --git a/src/Module/Profile/Contacts.php b/src/Module/Profile/Contacts.php index e20fd3f2d5..133b2c81af 100644 --- a/src/Module/Profile/Contacts.php +++ b/src/Module/Profile/Contacts.php @@ -34,7 +34,7 @@ use Friendica\Network\HTTPException; class Contacts extends Module\BaseProfile { - public function content(): string + protected function content(array $request = []): string { if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); diff --git a/src/Module/Profile/Index.php b/src/Module/Profile/Index.php index 653eb2a199..3f7b3d3fd0 100644 --- a/src/Module/Profile/Index.php +++ b/src/Module/Profile/Index.php @@ -35,13 +35,13 @@ use Friendica\Core\L10n; */ class Index extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { - (new Profile($this->l10n, $this->parameters))->rawContent(); + (new Profile($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->rawContent(); } - public function content(): string + protected function content(array $request = []): string { - return (new Status($this->l10n, $this->parameters))->content(); + return (new Status($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->content(); } } diff --git a/src/Module/Profile/Media.php b/src/Module/Profile/Media.php index 74af5f95e2..049232dffb 100644 --- a/src/Module/Profile/Media.php +++ b/src/Module/Profile/Media.php @@ -29,7 +29,7 @@ use Friendica\Network\HTTPException; class Media extends BaseProfile { - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php index a497fc4dd6..6624d993f9 100644 --- a/src/Module/Profile/Profile.php +++ b/src/Module/Profile/Profile.php @@ -46,7 +46,7 @@ use Friendica\Util\Temporal; class Profile extends BaseProfile { - public function rawContent() + protected function rawContent(array $request = []) { if (ActivityPub::isRequest()) { $user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]); @@ -73,7 +73,7 @@ class Profile extends BaseProfile } } - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/Profile/Schedule.php b/src/Module/Profile/Schedule.php index 1e9cd5fa5d..c14c19b9b2 100644 --- a/src/Module/Profile/Schedule.php +++ b/src/Module/Profile/Schedule.php @@ -33,7 +33,7 @@ use Friendica\Util\DateTimeFormat; class Schedule extends BaseProfile { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -50,7 +50,7 @@ class Schedule extends BaseProfile Post\Delayed::deleteById($_REQUEST['delete']); } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php index ad9a4acdee..a3b0ff1ea4 100644 --- a/src/Module/Profile/Status.php +++ b/src/Module/Profile/Status.php @@ -46,7 +46,7 @@ use Friendica\Util\XML; class Status extends BaseProfile { - public function content(): string + protected function content(array $request = []): string { $args = DI::args(); diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php index abe9a8c2e9..c84564e0f8 100644 --- a/src/Module/Proxy.php +++ b/src/Module/Proxy.php @@ -44,7 +44,7 @@ class Proxy extends BaseModule /** * Fetch remote image content */ - public function rawContent() + protected function rawContent(array $request = []) { $request = $this->getRequestInfo(); diff --git a/src/Module/PublicRSAKey.php b/src/Module/PublicRSAKey.php index d159255eee..f0e9dc285b 100644 --- a/src/Module/PublicRSAKey.php +++ b/src/Module/PublicRSAKey.php @@ -33,7 +33,7 @@ use Friendica\Util\Strings; */ class PublicRSAKey extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (empty($this->parameters['nick'])) { throw new BadRequestException(); diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php index 38cd684294..c4882b1bff 100644 --- a/src/Module/RandomProfile.php +++ b/src/Module/RandomProfile.php @@ -30,7 +30,7 @@ use Friendica\Model\Contact; */ class RandomProfile extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php index fe071fc550..dacee205b0 100644 --- a/src/Module/ReallySimpleDiscovery.php +++ b/src/Module/ReallySimpleDiscovery.php @@ -31,7 +31,7 @@ use Friendica\Util\XML; */ class ReallySimpleDiscovery extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { header('Content-Type: text/xml'); diff --git a/src/Module/Register.php b/src/Module/Register.php index 609e86a919..90c3007817 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -21,6 +21,7 @@ namespace Friendica\Module; +use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; @@ -32,7 +33,9 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model; use Friendica\Model\User; +use Friendica\Util\Profiler; use Friendica\Util\Proxy; +use Psr\Log\LoggerInterface; /** * @author Hypolite Petovan @@ -46,9 +49,9 @@ class Register extends BaseModule /** @var Tos */ protected $tos; - public function __construct(Tos $tos, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Tos $tos, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->tos = $tos; } @@ -62,7 +65,7 @@ class Register extends BaseModule * * @return string */ - public function content(): string + protected function content(array $request = []): string { // logged in users can register others (people/pages/groups) // even with closed registrations, unless specifically prohibited by site policy. @@ -189,7 +192,7 @@ class Register extends BaseModule * Extend this method if the module is supposed to process POST requests. * Doesn't display any content */ - public function post() + protected function post(array $request = [], array $post = []) { BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register'); diff --git a/src/Module/RemoteFollow.php b/src/Module/RemoteFollow.php index bc42998e30..ee74078dde 100644 --- a/src/Module/RemoteFollow.php +++ b/src/Module/RemoteFollow.php @@ -21,7 +21,7 @@ namespace Friendica\Module; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\App\Page; use Friendica\BaseModule; use Friendica\Content\Widget; @@ -36,6 +36,8 @@ use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Network\HTTPException; use Friendica\Network\Probe; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Remotely follow the account on this system by the provided account @@ -46,23 +48,20 @@ class RemoteFollow extends BaseModule protected $owner; /** @var Page */ protected $page; - /** @var BaseURL */ - protected $baseUrl; - public function __construct(L10n $l10n, Page $page, BaseURL $baseUrl, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->owner = User::getOwnerDataByNick($this->parameters['profile']); if (!$this->owner) { throw new HTTPException\NotFoundException($this->t('User not found.')); } - $this->baseUrl = $baseUrl; $this->page = $page; } - public function post() + protected function post(array $request = [], array $post = []) { if (!empty($_POST['cancel']) || empty($_POST['dfrn_url'])) { $this->baseUrl->redirect(); @@ -106,7 +105,7 @@ class RemoteFollow extends BaseModule System::externalRedirect($follow_link); } - public function content(): string + protected function content(array $request = []): string { if (empty($this->owner)) { return ''; diff --git a/src/Module/RobotsTxt.php b/src/Module/RobotsTxt.php index ec7ee086ec..9297c98de7 100644 --- a/src/Module/RobotsTxt.php +++ b/src/Module/RobotsTxt.php @@ -28,7 +28,7 @@ use Friendica\BaseModule; */ class RobotsTxt extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $allDisalloweds = [ '/settings/', diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php index 0866b5f9ae..ec54804002 100644 --- a/src/Module/Search/Acl.php +++ b/src/Module/Search/Acl.php @@ -48,7 +48,7 @@ class Acl extends BaseModule const TYPE_PRIVATE_MESSAGE = 'm'; const TYPE_ANY_CONTACT = 'a'; - public function rawContent() + protected function rawContent(array $request = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.')); diff --git a/src/Module/Search/Directory.php b/src/Module/Search/Directory.php index bbd90f137d..ca57b3251d 100644 --- a/src/Module/Search/Directory.php +++ b/src/Module/Search/Directory.php @@ -31,7 +31,7 @@ use Friendica\Module\Security\Login; */ class Directory extends BaseSearch { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { notice(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Search/Filed.php b/src/Module/Search/Filed.php index 519b0ece02..cfecce8eba 100644 --- a/src/Module/Search/Filed.php +++ b/src/Module/Search/Filed.php @@ -17,7 +17,7 @@ use Friendica\Module\Security\Login; class Filed extends BaseSearch { - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form(); diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 2118aeaaee..ad90e729ed 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -41,7 +41,7 @@ use Friendica\Network\HTTPException; class Index extends BaseSearch { - public function content(): string + protected function content(array $request = []): string { $search = (!empty($_GET['q']) ? trim(rawurldecode($_GET['q'])) : ''); diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index c941833675..fd20352bf7 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -21,32 +21,27 @@ namespace Friendica\Module\Search; -use Friendica\App\Arguments; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Core\Search; use Friendica\Database\Database; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; class Saved extends BaseModule { - /** @var Arguments */ - protected $args; /** @var Database */ protected $dba; - /** @var BaseURL */ - protected $baseUrl; - public function __construct(BaseURL $baseUrl, Database $dba, Arguments $args, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); - $this->baseUrl = $baseUrl; - $this->dba = $dba; - $this->args = $args; + $this->dba = $dba; } - public function rawContent() + protected function rawContent(array $request = []) { $action = $this->args->get(2, 'none'); $search = trim(rawurldecode($_GET['term'] ?? '')); diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php index 5c47e97496..90f2d663a7 100644 --- a/src/Module/Security/Login.php +++ b/src/Module/Security/Login.php @@ -33,7 +33,7 @@ use Friendica\Module\Register; */ class Login extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $return_path = $_REQUEST['return_path'] ?? '' ; @@ -46,7 +46,7 @@ class Login extends BaseModule return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED); } - public function post() + protected function post(array $request = [], array $post = []) { $return_path = Session::get('return_path'); Session::clear(); diff --git a/src/Module/Security/Logout.php b/src/Module/Security/Logout.php index 61b32c28b9..b8bc0f0224 100644 --- a/src/Module/Security/Logout.php +++ b/src/Module/Security/Logout.php @@ -21,7 +21,7 @@ namespace Friendica\Module\Security; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Cache\Capability\ICanCache; use Friendica\Core\Hook; @@ -31,6 +31,8 @@ use Friendica\Core\System; use Friendica\Model\Profile; use Friendica\Model\User\Cookie; use Friendica\Security\TwoFactor; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * Logout module @@ -43,19 +45,16 @@ class Logout extends BaseModule protected $cookie; /** @var IHandleSessions */ protected $session; - /** @var BaseURL */ - protected $baseUrl; /** @var TwoFactor\Repository\TrustedBrowser */ protected $trustedBrowserRepo; - public function __construct(TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->cache = $cache; $this->cookie = $cookie; $this->session = $session; - $this->baseUrl = $baseUrl; $this->trustedBrowserRepo = $trustedBrowserRepo; } @@ -63,7 +62,7 @@ class Logout extends BaseModule /** * Process logout requests */ - public function rawContent() + protected function rawContent(array $request = []) { $visitor_home = null; if (remote_user()) { diff --git a/src/Module/Security/OpenID.php b/src/Module/Security/OpenID.php index 360c9c672f..af2b0fd095 100644 --- a/src/Module/Security/OpenID.php +++ b/src/Module/Security/OpenID.php @@ -31,7 +31,7 @@ use LightOpenID; */ class OpenID extends BaseModule { - public function content(): string + protected function content(array $request = []): string { if (DI::config()->get('system', 'no_openid')) { DI::baseUrl()->redirect(); diff --git a/src/Module/Security/TwoFactor/Recovery.php b/src/Module/Security/TwoFactor/Recovery.php index 60de6e4048..6b5c86e661 100644 --- a/src/Module/Security/TwoFactor/Recovery.php +++ b/src/Module/Security/TwoFactor/Recovery.php @@ -29,6 +29,8 @@ use Friendica\Core\Session\Capability\IHandleSessions; use Friendica\Model\User; use Friendica\Security\Authentication; use Friendica\Security\TwoFactor\Model\RecoveryCode; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * // Page 1a: Recovery code verification @@ -41,22 +43,19 @@ class Recovery extends BaseModule protected $session; /** @var App */ protected $app; - /** @var App\BaseURL */ - protected $baseUrl; /** @var Authentication */ protected $auth; - public function __construct(App $app, App\BaseURL $baseUrl, Authentication $auth, IHandleSessions $session, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->app = $app; - $this->baseUrl = $baseUrl; $this->auth = $auth; $this->session = $session; } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -79,7 +78,7 @@ class Recovery extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { $this->baseUrl->redirect(); diff --git a/src/Module/Security/TwoFactor/Verify.php b/src/Module/Security/TwoFactor/Verify.php index 3669943ba4..454cc9f7cf 100644 --- a/src/Module/Security/TwoFactor/Verify.php +++ b/src/Module/Security/TwoFactor/Verify.php @@ -38,7 +38,7 @@ class Verify extends BaseModule { private static $errors = []; - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -78,7 +78,7 @@ class Verify extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { DI::baseUrl()->redirect(); diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index a2e4588396..d385544afd 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -36,7 +36,7 @@ use Friendica\Util\Strings; */ class Delegation extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!DI::app()->isLoggedIn()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -62,7 +62,7 @@ class Delegation extends BaseSettings DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index aab8f864b1..2155391a95 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -36,7 +36,7 @@ use Friendica\Network\HTTPException; */ class Display extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!DI::app()->isLoggedIn()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -112,7 +112,7 @@ class Display extends BaseSettings DI::baseUrl()->redirect('settings/display'); } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index 161c440b60..9f25db5245 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -41,7 +41,7 @@ use Friendica\Util\Temporal; class Index extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -135,7 +135,7 @@ class Index extends BaseSettings DI::baseUrl()->redirect('settings/profile'); } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { notice(DI::l10n()->t('You must be logged in to use this module')); diff --git a/src/Module/Settings/Profile/Photo/Crop.php b/src/Module/Settings/Profile/Photo/Crop.php index 3b5f109d79..a77057e1ab 100644 --- a/src/Module/Settings/Profile/Photo/Crop.php +++ b/src/Module/Settings/Profile/Photo/Crop.php @@ -33,7 +33,7 @@ use Friendica\Network\HTTPException; class Crop extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!Session::isAuthenticated()) { return; @@ -160,7 +160,7 @@ class Crop extends BaseSettings DI::baseUrl()->redirect($path); } - public function content(): string + protected function content(array $request = []): string { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Settings/Profile/Photo/Index.php b/src/Module/Settings/Profile/Photo/Index.php index 2e65a01c61..309a893e66 100644 --- a/src/Module/Settings/Profile/Photo/Index.php +++ b/src/Module/Settings/Profile/Photo/Index.php @@ -34,7 +34,7 @@ use Friendica\Util\Strings; class Index extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!Session::isAuthenticated()) { return; @@ -106,7 +106,7 @@ class Index extends BaseSettings DI::baseUrl()->redirect('settings/profile/photo/crop/' . $resource_id); } - public function content(): string + protected function content(array $request = []): string { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Settings/TwoFactor/AppSpecific.php b/src/Module/Settings/TwoFactor/AppSpecific.php index 21db4f8abf..d87f27eccb 100644 --- a/src/Module/Settings/TwoFactor/AppSpecific.php +++ b/src/Module/Settings/TwoFactor/AppSpecific.php @@ -21,13 +21,15 @@ namespace Friendica\Module\Settings\TwoFactor; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Renderer; use Friendica\Security\TwoFactor\Model\AppSpecificPassword; use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * // Page 5: 2FA enabled, app-specific password generation @@ -40,15 +42,12 @@ class AppSpecific extends BaseSettings /** @var IManagePersonalConfigValues */ protected $pConfig; - /** @var BaseURL */ - protected $baseUrl; - - public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->pConfig = $pConfig; - $this->baseUrl = $baseUrl; if (!local_user()) { return; @@ -66,7 +65,7 @@ class AppSpecific extends BaseSettings } } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -109,7 +108,7 @@ class AppSpecific extends BaseSettings } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form('settings/2fa/app_specific'); diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php index 0dcef14ad9..ec57a8d147 100644 --- a/src/Module/Settings/TwoFactor/Index.php +++ b/src/Module/Settings/TwoFactor/Index.php @@ -33,7 +33,7 @@ use PragmaRX\Google2FA\Google2FA; class Index extends BaseSettings { - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -94,7 +94,7 @@ class Index extends BaseSettings } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form('settings/2fa'); diff --git a/src/Module/Settings/TwoFactor/Recovery.php b/src/Module/Settings/TwoFactor/Recovery.php index 961c2cd904..0d324aacaf 100644 --- a/src/Module/Settings/TwoFactor/Recovery.php +++ b/src/Module/Settings/TwoFactor/Recovery.php @@ -21,13 +21,15 @@ namespace Friendica\Module\Settings\TwoFactor; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Renderer; use Friendica\Security\TwoFactor\Model\RecoveryCode; use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; /** * // Page 3: 2FA enabled but not verified, show recovery codes @@ -38,15 +40,12 @@ class Recovery extends BaseSettings { /** @var IManagePersonalConfigValues */ protected $pConfig; - /** @var BaseURL */ - protected $baseUrl; - public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->pConfig = $pConfig; - $this->baseUrl = $baseUrl; if (!local_user()) { return; @@ -64,7 +63,7 @@ class Recovery extends BaseSettings } } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -81,7 +80,7 @@ class Recovery extends BaseSettings } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form('settings/2fa/recovery'); diff --git a/src/Module/Settings/TwoFactor/Trusted.php b/src/Module/Settings/TwoFactor/Trusted.php index 844cd4dff4..4e6068e237 100644 --- a/src/Module/Settings/TwoFactor/Trusted.php +++ b/src/Module/Settings/TwoFactor/Trusted.php @@ -2,14 +2,16 @@ namespace Friendica\Module\Settings\TwoFactor; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Renderer; use Friendica\Module\BaseSettings; use Friendica\Security\TwoFactor; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Profiler; use Friendica\Util\Temporal; +use Psr\Log\LoggerInterface; use UAParser\Parser; /** @@ -19,17 +21,14 @@ class Trusted extends BaseSettings { /** @var IManagePersonalConfigValues */ protected $pConfig; - /** @var BaseURL */ - protected $baseUrl; /** @var TwoFactor\Repository\TrustedBrowser */ protected $trustedBrowserRepo; - public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, L10n $l10n, array $parameters = []) + 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 = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->pConfig = $pConfig; - $this->baseUrl = $baseUrl; $this->trustedBrowserRepo = $trustedBrowserRepo; if (!local_user()) { @@ -48,7 +47,7 @@ class Trusted extends BaseSettings } } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -78,7 +77,7 @@ class Trusted extends BaseSettings } - public function content(): string + protected function content(array $request = []): string { parent::content(); diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 93fdde9207..29569dae05 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -25,14 +25,16 @@ use BaconQrCode\Renderer\Image\SvgImageBackEnd; use BaconQrCode\Renderer\ImageRenderer; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\Core\L10n; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; +use Friendica\Util\Profiler; use PragmaRX\Google2FA\Google2FA; +use Psr\Log\LoggerInterface; /** * // Page 4: 2FA enabled but not verified, QR code and verification @@ -43,15 +45,12 @@ class Verify extends BaseSettings { /** @var IManagePersonalConfigValues */ protected $pConfig; - /** @var BaseURL */ - protected $baseUrl; - public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->pConfig = $pConfig; - $this->baseUrl = $baseUrl; if (!local_user()) { return; @@ -70,7 +69,7 @@ class Verify extends BaseSettings } } - public function post() + protected function post(array $request = [], array $post = []) { if (!local_user()) { return; @@ -96,7 +95,7 @@ class Verify extends BaseSettings } } - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { return Login::form('settings/2fa/verify'); diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index b5d79c4af5..431cbfe106 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -51,7 +51,7 @@ class UserExport extends BaseSettings * @throws HTTPException\ForbiddenException * @throws HTTPException\InternalServerErrorException */ - public function content(): string + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -85,7 +85,7 @@ class UserExport extends BaseSettings * * @throws HTTPException\ForbiddenException */ - public function rawContent() + protected function rawContent(array $request = []) { if (!DI::app()->isLoggedIn()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); diff --git a/src/Module/Smilies.php b/src/Module/Smilies.php index ded7980050..ae368cd71c 100644 --- a/src/Module/Smilies.php +++ b/src/Module/Smilies.php @@ -33,7 +33,7 @@ use Friendica\DI; */ class Smilies extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!empty(DI::args()->getArgv()[1]) && (DI::args()->getArgv()[1] === "json")) { $smilies = Content\Smilies::getList(); @@ -45,7 +45,7 @@ class Smilies extends BaseModule } } - public function content(): string + protected function content(array $request = []): string { $smilies = Content\Smilies::getList(); $count = count($smilies['texts'] ?? []); diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php index f4a1334d2e..408999b572 100644 --- a/src/Module/Statistics.php +++ b/src/Module/Statistics.php @@ -21,25 +21,24 @@ namespace Friendica\Module; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; class Statistics extends BaseModule { /** @var IManageConfigValues */ protected $config; - /** @var LoggerInterface */ - protected $logger; - public function __construct(IManageConfigValues $config, LoggerInterface $logger, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); - $this->logger = $logger; $this->config = $config; if (!$this->config->get("system", "nodeinfo")) { @@ -47,7 +46,7 @@ class Statistics extends BaseModule } } - public function rawContent() + protected function rawContent(array $request = []) { $registration_open = intval($this->config->get('config', 'register_policy')) !== Register::CLOSED diff --git a/src/Module/Theme.php b/src/Module/Theme.php index 6c164b5ba5..a57751ceaf 100644 --- a/src/Module/Theme.php +++ b/src/Module/Theme.php @@ -30,7 +30,7 @@ use Friendica\Util\Strings; */ class Theme extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { header('Content-Type: text/css'); diff --git a/src/Module/ThemeDetails.php b/src/Module/ThemeDetails.php index 5b931e1172..82d2ff1860 100644 --- a/src/Module/ThemeDetails.php +++ b/src/Module/ThemeDetails.php @@ -29,7 +29,7 @@ use Friendica\Core\Theme; */ class ThemeDetails extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!empty($_REQUEST['theme'])) { $theme = $_REQUEST['theme']; diff --git a/src/Module/ToggleMobile.php b/src/Module/ToggleMobile.php index a0fb2f88f6..5817394cec 100644 --- a/src/Module/ToggleMobile.php +++ b/src/Module/ToggleMobile.php @@ -29,7 +29,7 @@ use Friendica\DI; */ class ToggleMobile extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $a = DI::app(); diff --git a/src/Module/Tos.php b/src/Module/Tos.php index 1b71627535..53ef949205 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -21,12 +21,14 @@ namespace Friendica\Module; -use Friendica\App\BaseURL; +use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Content\Text\BBCode; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; class Tos extends BaseModule { @@ -38,8 +40,6 @@ class Tos extends BaseModule /** @var IManageConfigValues */ protected $config; - /** @var BaseURL */ - protected $baseUrl; /** * constructor for the module, initializing the text variables @@ -48,12 +48,11 @@ 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(IManageConfigValues $config, BaseURL $baseUrl, L10n $l10n, array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = []) { - parent::__construct($l10n, $parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters); $this->config = $config; - $this->baseUrl = $baseUrl; $this->privacy_operate = $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'); $this->privacy_distribute = $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'); @@ -76,7 +75,7 @@ class Tos extends BaseModule * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function content(): string + protected function content(array $request = []): string { if (strlen($this->config->get('system', 'singleuser'))) { $this->baseUrl->redirect('profile/' . $this->config->get('system', 'singleuser')); diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index 07ed5a610f..9a1ffd771f 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -33,7 +33,7 @@ use Friendica\Module\Conversation\Community as CommunityModule; */ class Community extends CommunityModule { - public function rawContent() + protected function rawContent(array $request = []) { $this->parseRequest(); diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index 3652b11263..073df23810 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -9,7 +9,7 @@ use Friendica\Module\Conversation\Network as NetworkModule; class Network extends NetworkModule { - public function rawContent() + protected function rawContent(array $request = []) { if (!isset($_GET['p']) || !isset($_GET['item'])) { exit(); diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index b06aea8044..691d9d955d 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -35,7 +35,7 @@ use Friendica\Util\DateTimeFormat; class Profile extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $a = DI::app(); @@ -93,7 +93,7 @@ class Profile extends BaseModule ); if (!DBA::isResult($items_stmt)) { - return ''; + return; } // Set a time stamp for this page. We will make use of it when we diff --git a/src/Module/Welcome.php b/src/Module/Welcome.php index 92845cdaff..9144541cbc 100644 --- a/src/Module/Welcome.php +++ b/src/Module/Welcome.php @@ -30,7 +30,7 @@ use Friendica\DI; */ class Welcome extends BaseModule { - public function content(): string + protected function content(array $request = []): string { $config = DI::config(); diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php index a65b4db1a1..485004d70c 100644 --- a/src/Module/WellKnown/HostMeta.php +++ b/src/Module/WellKnown/HostMeta.php @@ -33,7 +33,7 @@ use Friendica\Util\Crypto; */ class HostMeta extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/WellKnown/NodeInfo.php b/src/Module/WellKnown/NodeInfo.php index a419792806..403c26f21c 100644 --- a/src/Module/WellKnown/NodeInfo.php +++ b/src/Module/WellKnown/NodeInfo.php @@ -30,7 +30,7 @@ use Friendica\DI; */ class NodeInfo extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { self::printWellKnown(); } diff --git a/src/Module/WellKnown/SecurityTxt.php b/src/Module/WellKnown/SecurityTxt.php index 73a627c2e7..1455db130f 100644 --- a/src/Module/WellKnown/SecurityTxt.php +++ b/src/Module/WellKnown/SecurityTxt.php @@ -29,7 +29,7 @@ use Friendica\BaseModule; */ class SecurityTxt extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $name = 'security.txt'; $fp = fopen($name, 'rt'); diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php index c401825236..dc29f089a2 100644 --- a/src/Module/WellKnown/XSocialRelay.php +++ b/src/Module/WellKnown/XSocialRelay.php @@ -32,7 +32,7 @@ use Friendica\Protocol\Relay; */ class XSocialRelay extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { $config = DI::config(); diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 4a8e32e8ea..5d3205b7a1 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -36,7 +36,7 @@ use Friendica\Protocol\Salmon; */ class Xrd extends BaseModule { - public function rawContent() + protected function rawContent(array $request = []) { // @TODO: Replace with parameter from router if (DI::args()->getArgv()[0] == 'xrd') {