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)
This commit is contained in:
Philipp Holzer 2021-11-20 15:38:03 +01:00
commit 8bdd90066f
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
252 changed files with 615 additions and 623 deletions

View file

@ -116,11 +116,6 @@ class App
*/ */
private $args; private $args;
/**
* @var Core\System The system methods
*/
private $system;
/** /**
* @var IManagePersonalConfigValues * @var IManagePersonalConfigValues
*/ */
@ -326,10 +321,9 @@ class App
* @param Profiler $profiler The profiler of this application * @param Profiler $profiler The profiler of this application
* @param L10n $l10n The translator instance * @param L10n $l10n The translator instance
* @param App\Arguments $args The Friendica Arguments of the call * @param App\Arguments $args The Friendica Arguments of the call
* @param Core\System $system The system methods
* @param IManagePersonalConfigValues $pConfig Personal configuration * @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->database = $database;
$this->config = $config; $this->config = $config;
@ -339,7 +333,6 @@ class App
$this->logger = $logger; $this->logger = $logger;
$this->l10n = $l10n; $this->l10n = $l10n;
$this->args = $args; $this->args = $args;
$this->system = $system;
$this->pConfig = $pConfig; $this->pConfig = $pConfig;
$this->load(); $this->load();
@ -608,7 +601,7 @@ class App
// Only continue when the given profile link seems valid // Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters // Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") && 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"]) { if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
Core\Session::set('my_url', $_GET['zrl']); Core\Session::set('my_url', $_GET['zrl']);
Core\Session::set('authenticated', 0); Core\Session::set('authenticated', 0);
@ -700,7 +693,7 @@ class App
$page['page_title'] = $moduleName; $page['page_title'] = $moduleName;
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) { if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
$module = new Maintenance($this->l10n); $module = $router->getModule(Maintenance::class);
} else { } else {
// determine the module class and save it to the module instance // 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) // @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, ...) // 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) { } catch (HTTPException $e) {
(new ModuleHTTPException())->rawContent($e); (new ModuleHTTPException())->rawContent($e);
} }
$page->run($this, $this->baseURL, $this->args, $this->mode, $module, $this->l10n, $this->profiler, $this->config, $pconfig);
} }
/** /**

View file

@ -25,7 +25,6 @@ use ArrayAccess;
use DOMDocument; use DOMDocument;
use DOMXPath; use DOMXPath;
use Friendica\App; use Friendica\App;
use Friendica\Capabilities\ICanHandleRequests;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
@ -33,7 +32,6 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -269,9 +267,9 @@ class Page implements ArrayAccess
if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) { if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
$pageURL .= "s"; $pageURL .= "s";
} }
$pageURL .= "://"; $pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") { if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else { } else {
@ -338,24 +336,13 @@ class Page implements ArrayAccess
* - module content * - module content
* - hooks for content * - hooks for content
* *
* @param ICanHandleRequests $module The module * @param string $content The content to print
* @param Mode $mode The Friendica execution mode * @param Mode $mode The Friendica execution mode
* *
* @throws HTTPException\InternalServerErrorException * @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 // initialise content region
if ($mode->isNormal()) { if ($mode->isNormal()) {
Hook::callAll('page_content_top', $this->page['content']); Hook::callAll('page_content_top', $this->page['content']);
@ -390,14 +377,14 @@ class Page implements ArrayAccess
* @param BaseURL $baseURL The Friendica Base URL * @param BaseURL $baseURL The Friendica Base URL
* @param Arguments $args The Friendica App arguments * @param Arguments $args The Friendica App arguments
* @param Mode $mode The current node mode * @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 L10n $l10n The l10n language class
* @param IManageConfigValues $config The Configuration of this node * @param IManageConfigValues $config The Configuration of this node
* @param IManagePersonalConfigValues $pconfig The personal/user configuration * @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(); $moduleName = $args->getModuleName();
@ -407,7 +394,7 @@ class Page implements ArrayAccess
* Sets the $Page->page['content'] variable * Sets the $Page->page['content'] variable
*/ */
$timestamp = microtime(true); $timestamp = microtime(true);
$this->initContent($module, $mode); $this->initContent($content, $mode);
$profiler->set(microtime(true) - $timestamp, 'content'); $profiler->set(microtime(true) - $timestamp, 'content');
// Load current theme info after module has been initialized as theme could have been set in module // Load current theme info after module has been initialized as theme could have been set in module

View file

@ -39,6 +39,7 @@ use Friendica\Module\HTTPException\MethodNotAllowed;
use Friendica\Module\HTTPException\PageNotFound; use Friendica\Module\HTTPException\PageNotFound;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\MethodNotAllowedException; use Friendica\Network\HTTPException\MethodNotAllowedException;
use Friendica\Network\HTTPException\NoContentException;
use Friendica\Network\HTTPException\NotFoundException; use Friendica\Network\HTTPException\NotFoundException;
/** /**
@ -103,6 +104,9 @@ class Router
/** @var string */ /** @var string */
private $baseRoutesFilepath; private $baseRoutesFilepath;
/** @var array */
private $server;
/** /**
* @param array $server The $_SERVER variable * @param array $server The $_SERVER variable
* @param string $baseRoutesFilepath The path to a base routes file to leverage cache, can be empty * @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->args = $args;
$this->config = $config; $this->config = $config;
$this->dice = $dice; $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->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
$this->routeCollector = isset($routeCollector) ? $this->routeCollector = isset($routeCollector) ?
@ -268,10 +281,9 @@ class Router
return $moduleClass; return $moduleClass;
} }
public function getModule(): ICanHandleRequests public function getModule(?string $module_class = null): ICanHandleRequests
{ {
$module_class = null; $module_parameters = [$this->server];
$module_parameters = [];
/** /**
* ROUTING * 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. * post() and/or content() static methods can be respectively called to produce a data change or an output.
**/ **/
try { try {
$module_class = $this->getModuleClass(); $module_class = $module_class ?? $this->getModuleClass();
$module_parameters[] = $this->parameters; $module_parameters[] = $this->parameters;
} catch (MethodNotAllowedException $e) { } catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class; $module_class = MethodNotAllowed::class;

View file

@ -23,11 +23,12 @@ namespace Friendica;
use Friendica\App\Router; use Friendica\App\Router;
use Friendica\Capabilities\ICanHandleRequests; use Friendica\Capabilities\ICanHandleRequests;
use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Module\HTTPException\PageNotFound; use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException\NoContentException; use Friendica\Network\HTTPException;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -44,14 +45,28 @@ abstract class BaseModule implements ICanHandleRequests
{ {
/** @var array */ /** @var array */
protected $parameters = []; protected $parameters = [];
/** @var L10n */ /** @var L10n */
protected $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->parameters = $parameters;
$this->l10n = $l10n; $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 ''; // echo '';
// exit; // 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 ''; 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; 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 // @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-Origin: *');
header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET); header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false'); 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-Origin: *');
header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET); header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false'); 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-Origin: *');
header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS)); header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS));
header('Access-Control-Allow-Credentials: false'); header('Access-Control-Allow-Credentials: false');
header('Access-Control-Expose-Headers: Link'); 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-Origin: *');
header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::POST); header('Access-Control-Allow-Methods: ' . Router::POST);
header('Access-Control-Allow-Credentials: false'); 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 = ''; $placeholder = '';
$profiler->set(microtime(true), 'ready'); $this->profiler->set(microtime(true), 'ready');
$timestamp = microtime(true); $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(); $this->delete();
} }
if ($server['REQUEST_METHOD'] === Router::PATCH) { if ($this->server['REQUEST_METHOD'] === Router::PATCH) {
$this->patch(); $this->patch();
} }
if ($server['REQUEST_METHOD'] === Router::POST) { if ($this->server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($args->getModuleName() . '_mod_post', $post); Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post);
$this->post(); $this->post($request, $post);
} }
if ($server['REQUEST_METHOD'] === Router::PUT) { if ($this->server['REQUEST_METHOD'] === Router::PUT) {
$this->put(); $this->put();
} }
// "rawContent" is especially meant for technical endpoints. // "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff. // 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);
}
} }
/* /*

View file

@ -2,59 +2,20 @@
namespace Friendica\Capabilities; namespace Friendica\Capabilities;
use Friendica\Network\HTTPException;
/** /**
* This interface provides the capability to handle requests from clients and returns the desired outcome * This interface provides the capability to handle requests from clients and returns the desired outcome
*/ */
interface ICanHandleRequests 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, * @return string Returns the content of the module as string
* e.g. from protocol implementations.
*/
public function rawContent();
/**
* Module GET method to display any content
* *
* Extend this method if the module is supposed to return any display * @throws HTTPException\InternalServerErrorException
* through a GET request. It can be an HTML page through templating or a
* XML feed or a JSON output.
*/ */
public function content(): string; public function run(array $post = [], array $request = []): 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;
} }

View file

@ -22,6 +22,8 @@
namespace Friendica; namespace Friendica;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* This mock module enable class encapsulation of legacy global function modules. * This mock module enable class encapsulation of legacy global function modules.
@ -39,9 +41,9 @@ class LegacyModule extends BaseModule
*/ */
private $moduleName = ''; 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); $this->setModuleFile($file_path);
@ -65,13 +67,15 @@ class LegacyModule extends BaseModule
require_once $file_path; require_once $file_path;
} }
public function content(): string public function content(array $request = []): string
{ {
return $this->runModuleFunction('content'); return $this->runModuleFunction('content');
} }
public function post() public function post(array $request = [], array $post = [])
{ {
parent::post($post);
$this->runModuleFunction('post'); $this->runModuleFunction('post');
} }

View file

@ -30,7 +30,7 @@ use Friendica\BaseModule;
*/ */
class AccountManagementControlDocument extends BaseModule class AccountManagementControlDocument extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$output = [ $output = [
'version' => 1, 'version' => 1,

View file

@ -31,7 +31,7 @@ use Friendica\Network\HTTPException\NotFoundException;
*/ */
class Acctlink extends BaseModule class Acctlink extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$addr = trim($_GET['addr'] ?? ''); $addr = trim($_GET['addr'] ?? '');
if (!$addr) { if (!$addr) {

View file

@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub;
*/ */
class Followers extends BaseModule class Followers extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (empty($this->parameters['nickname'])) { if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub;
*/ */
class Following extends BaseModule class Following extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (empty($this->parameters['nickname'])) { if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Network;
*/ */
class Inbox extends BaseModule class Inbox extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$postdata = Network::postdata(); $postdata = Network::postdata();

View file

@ -41,7 +41,7 @@ use Friendica\Util\Strings;
*/ */
class Objects extends BaseModule class Objects extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (empty($this->parameters['guid'])) { if (empty($this->parameters['guid'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();

View file

@ -31,7 +31,7 @@ use Friendica\Util\HTTPSignature;
*/ */
class Outbox extends BaseModule class Outbox extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (empty($this->parameters['nickname'])) { if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -30,7 +30,7 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin class Details extends BaseAdmin
{ {
public function post() public function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -52,7 +52,7 @@ class Details extends BaseAdmin
DI::baseUrl()->redirect($redirect); DI::baseUrl()->redirect($redirect);
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Index extends BaseAdmin class Index extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -32,7 +32,7 @@ use Friendica\Util\Network;
class Contact extends BaseAdmin class Contact extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -76,7 +76,7 @@ class Contact extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/contact'); DI::baseUrl()->redirect('admin/blocklist/contact');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -32,7 +32,7 @@ use GuzzleHttp\Psr7\Uri;
class Add extends BaseAdmin class Add extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -66,7 +66,7 @@ class Add extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/server'); DI::baseUrl()->redirect('admin/blocklist/server');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -27,7 +27,7 @@ use Friendica\Module\BaseAdmin;
class Index extends BaseAdmin class Index extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -56,7 +56,7 @@ class Index extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/server'); DI::baseUrl()->redirect('admin/blocklist/server');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseAdmin;
class DBSync extends BaseAdmin class DBSync extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Features extends BaseAdmin class Features extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -60,7 +60,7 @@ class Features extends BaseAdmin
DI::baseUrl()->redirect('admin/features'); DI::baseUrl()->redirect('admin/features');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Federation extends BaseAdmin class Federation extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Util\Strings;
class Delete extends BaseAdmin class Delete extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -55,7 +55,7 @@ class Delete extends BaseAdmin
DI::baseUrl()->redirect('admin/item/delete'); DI::baseUrl()->redirect('admin/item/delete');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Module\BaseAdmin;
class Source extends BaseAdmin class Source extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -29,7 +29,7 @@ use Psr\Log\LogLevel;
class Settings extends BaseAdmin class Settings extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -56,7 +56,7 @@ class Settings extends BaseAdmin
DI::baseUrl()->redirect('admin/logs'); DI::baseUrl()->redirect('admin/logs');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -31,7 +31,7 @@ class View extends BaseAdmin
{ {
const LIMIT = 500; const LIMIT = 500;
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -25,7 +25,7 @@ use Friendica\Module\BaseAdmin;
class PhpInfo extends BaseAdmin class PhpInfo extends BaseAdmin
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();

View file

@ -38,7 +38,7 @@ use Friendica\Util\DateTimeFormat;
*/ */
class Queue extends BaseAdmin class Queue extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -43,7 +43,7 @@ require_once __DIR__ . '/../../../boot.php';
class Site extends BaseAdmin class Site extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -384,7 +384,7 @@ class Site extends BaseAdmin
DI::baseUrl()->redirect('admin/site' . $active_panel); DI::baseUrl()->redirect('admin/site' . $active_panel);
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -31,7 +31,7 @@ use Friendica\Util\Strings;
class Storage extends BaseAdmin class Storage extends BaseAdmin
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -91,7 +91,7 @@ class Storage extends BaseAdmin
DI::baseUrl()->redirect('admin/storage'); DI::baseUrl()->redirect('admin/storage');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -37,7 +37,7 @@ use Friendica\Util\DateTimeFormat;
class Summary extends BaseAdmin class Summary extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin class Details extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -25,24 +25,23 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Module\BaseAdmin; use Friendica\Module\BaseAdmin;
use Friendica\Util\Profiler;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Psr\Log\LoggerInterface;
class Embed extends BaseAdmin class Embed extends BaseAdmin
{ {
/** @var App */ /** @var App */
protected $app; protected $app;
/** @var App\BaseURL */
protected $baseUrl;
/** @var App\Mode */ /** @var App\Mode */
protected $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->app = $app;
$this->baseUrl = $baseUrl; $this->mode = $mode;
$this->mode = $mode;
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']); $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) { 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(); self::checkAdminAccess();
@ -70,7 +69,7 @@ class Embed extends BaseAdmin
$this->baseUrl->redirect('admin/themes/' . $theme . '/embed?mode=minimal'); $this->baseUrl->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Util\Strings;
class Index extends BaseAdmin class Index extends BaseAdmin
{ {
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -21,11 +21,14 @@
namespace Friendica\Module\Admin; namespace Friendica\Module\Admin;
use Friendica\App;
use Friendica\App\BaseURL; use Friendica\App\BaseURL;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Module\BaseAdmin; use Friendica\Module\BaseAdmin;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
class Tos extends BaseAdmin class Tos extends BaseAdmin
{ {
@ -33,19 +36,16 @@ class Tos extends BaseAdmin
protected $tos; protected $tos;
/** @var IManageConfigValues */ /** @var IManageConfigValues */
protected $config; 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->tos = $tos;
$this->config = $config; $this->config = $config;
$this->baseUrl = $baseUrl;
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -66,7 +66,7 @@ class Tos extends BaseAdmin
$this->baseUrl->redirect('admin/tos'); $this->baseUrl->redirect('admin/tos');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Active extends BaseUsers class Active extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -60,7 +60,7 @@ class Active extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString()); DI::baseUrl()->redirect(DI::args()->getQueryString());
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -31,7 +31,7 @@ use Friendica\Util\Temporal;
class Blocked extends BaseUsers class Blocked extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -61,7 +61,7 @@ class Blocked extends BaseUsers
DI::baseUrl()->redirect('admin/users/blocked'); DI::baseUrl()->redirect('admin/users/blocked');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\Admin\BaseUsers;
class Create extends BaseUsers class Create extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -51,7 +51,7 @@ class Create extends BaseUsers
DI::baseUrl()->redirect('admin/users/create'); DI::baseUrl()->redirect('admin/users/create');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Deleted extends BaseUsers class Deleted extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -44,7 +44,7 @@ class Deleted extends BaseUsers
DI::baseUrl()->redirect('admin/users/deleted'); DI::baseUrl()->redirect('admin/users/deleted');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Index extends BaseUsers class Index extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -67,7 +67,7 @@ class Index extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString()); DI::baseUrl()->redirect(DI::args()->getQueryString());
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Pending extends BaseUsers class Pending extends BaseUsers
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -58,7 +58,7 @@ class Pending extends BaseUsers
DI::baseUrl()->redirect('admin/users/pending'); DI::baseUrl()->redirect('admin/users/pending');
} }
public function content(): string protected function content(array $request = []): string
{ {
parent::content(); parent::content();

View file

@ -40,7 +40,7 @@ use Friendica\Module\BaseApi;
*/ */
class Activity extends BaseApi class Activity extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/ */
class Setseen extends BaseApi class Setseen extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Index extends BaseApi class Index extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\BadRequestException;
*/ */
class Delete extends BaseApi class Delete extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,17 +32,17 @@ require_once __DIR__ . '/../../../../include/api.php';
*/ */
class Index extends BaseApi class Index extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
} }
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
} }
public function rawContent() protected function rawContent(array $request = [])
{ {
echo api_call(DI::args()->getCommand(), $this->parameters['extension'] ?? 'json'); echo api_call(DI::args()->getCommand(), $this->parameters['extension'] ?? 'json');
exit(); exit();

View file

@ -31,7 +31,7 @@ use Friendica\Object\Api\Friendica\Notification as ApiNotification;
*/ */
class Notification extends BaseApi class Notification extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Delete extends BaseApi class Delete extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Delete extends BaseApi class Delete extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Update extends BaseApi class Update extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException;
*/ */
class Show extends BaseApi class Show extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\Register;
*/ */
class Config extends BaseApi class Config extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$config = [ $config = [
'site' => [ 'site' => [

View file

@ -29,7 +29,7 @@ use Friendica\DI;
*/ */
class Version extends BaseApi class Version extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null); DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null);
} }

View file

@ -29,7 +29,7 @@ use Friendica\DI;
*/ */
class Test extends BaseApi class Test extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true'; $ok = 'true';

View file

@ -35,7 +35,7 @@ class Accounts extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Block extends BaseApi class Block extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class FeaturedTags extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Follow extends BaseApi class Follow extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Followers extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Following extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class IdentityProofs extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -35,7 +35,7 @@ class Lists extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Mute extends BaseApi class Mute extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Note extends BaseApi class Note extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Relationships extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class Search extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -39,7 +39,7 @@ class Statuses extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unblock extends BaseApi class Unblock extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unfollow extends BaseApi class Unfollow extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unmute extends BaseApi class Unmute extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Util\HTTPInputData;
*/ */
class UpdateCredentials extends BaseApi class UpdateCredentials extends BaseApi
{ {
public function patch() protected function patch()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class VerifyCredentials extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class Announcements extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -35,7 +35,7 @@ class Apps extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function post() protected function post(array $request = [], array $post = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'client_name' => '', 'client_name' => '',

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/ */
class VerifyCredentials extends BaseApi class VerifyCredentials extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$application = self::getCurrentApplication(); $application = self::getCurrentApplication();

View file

@ -34,7 +34,7 @@ class Blocks extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class Bookmarks extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Conversations extends BaseApi class Conversations extends BaseApi
{ {
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -49,7 +49,7 @@ class Conversations extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Read extends BaseApi class Read extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class CustomEmojis extends BaseApi
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows * @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()); $emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());

View file

@ -39,7 +39,7 @@ class Directory extends BaseApi
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/instance/directory/ * @see https://docs.joinmastodon.org/methods/instance/directory/
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'offset' => 0, // How many accounts to skip before returning results. Default 0. 'offset' => 0, // How many accounts to skip before returning results. Default 0.

View file

@ -32,7 +32,7 @@ class Endorsements extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
System::jsonExit([]); System::jsonExit([]);
} }

View file

@ -37,7 +37,7 @@ class Favourited extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Filters extends BaseApi class Filters extends BaseApi
{ {
public function post() public function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -41,7 +41,7 @@ class Filters extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -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#accept-follow
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-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); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -82,7 +82,7 @@ class FollowRequests extends BaseApi
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests/ * @see https://docs.joinmastodon.org/methods/accounts/follow_requests/
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ class Instance extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
System::jsonExit(InstanceEntity::get()); System::jsonExit(InstanceEntity::get());
} }

View file

@ -36,7 +36,7 @@ class Peers extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$return = []; $return = [];

View file

@ -36,7 +36,7 @@ class Rules extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$rules = []; $rules = [];
$id = 0; $id = 0;

View file

@ -31,7 +31,7 @@ use Friendica\Model\Group;
*/ */
class Lists extends BaseApi class Lists extends BaseApi
{ {
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -51,7 +51,7 @@ class Lists extends BaseApi
System::jsonExit([]); System::jsonExit([]);
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -91,7 +91,7 @@ class Lists extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,12 +35,12 @@ use Friendica\Module\BaseApi;
*/ */
class Accounts extends BaseApi class Accounts extends BaseApi
{ {
public function delete() protected function delete()
{ {
DI::apiResponse()->unsupported(Router::DELETE); DI::apiResponse()->unsupported(Router::DELETE);
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
DI::apiResponse()->unsupported(Router::POST); DI::apiResponse()->unsupported(Router::POST);
} }
@ -48,7 +48,7 @@ class Accounts extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Markers extends BaseApi class Markers extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -41,7 +41,7 @@ class Markers extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Media extends BaseApi class Media extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -82,7 +82,7 @@ class Media extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Mutes extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -40,7 +40,7 @@ class Notifications extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/ */
class Clear extends BaseApi class Clear extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\ForbiddenException;
*/ */
class Dismiss extends BaseApi class Dismiss extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Preferences extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class Proofs extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
System::jsonError(404, ['error' => 'Record not found']); System::jsonError(404, ['error' => 'Record not found']);
} }

View file

@ -33,7 +33,7 @@ use Friendica\Object\Api\Mastodon\Notification;
*/ */
class PushSubscription extends BaseApi class PushSubscription extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_PUSH); self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -99,7 +99,7 @@ class PushSubscription extends BaseApi
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray(); return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
} }
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_PUSH); self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -112,7 +112,7 @@ class PushSubscription extends BaseApi
System::jsonExit([]); System::jsonExit([]);
} }
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_PUSH); self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -42,7 +42,7 @@ class ScheduledStatuses extends BaseApi
DI::apiResponse()->unsupported(Router::PUT); DI::apiResponse()->unsupported(Router::PUT);
} }
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -63,7 +63,7 @@ class ScheduledStatuses extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -40,7 +40,7 @@ class Search extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -41,7 +41,7 @@ use Friendica\Util\Images;
*/ */
class Statuses extends BaseApi class Statuses extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -207,7 +207,7 @@ class Statuses extends BaseApi
DI::mstdnError()->InternalError(); DI::mstdnError()->InternalError();
} }
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -231,7 +231,7 @@ class Statuses extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Bookmark extends BaseApi class Bookmark extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Card extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Context extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Favourite extends BaseApi class Favourite extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class FavouritedBy extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Mute extends BaseApi class Mute extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Pin extends BaseApi class Pin extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
*/ */
class Reblog extends BaseApi class Reblog extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class RebloggedBy extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unbookmark extends BaseApi class Unbookmark extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unfavourite extends BaseApi class Unfavourite extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unmute extends BaseApi class Unmute extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unpin extends BaseApi class Unpin extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
*/ */
class Unreblog extends BaseApi class Unreblog extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Suggestions extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Direct extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class Home extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class ListTimeline extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -39,7 +39,7 @@ class PublicTimeline extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class Tag extends BaseApi
/** /**
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Trends extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'limit' => 20, // Maximum number of results to return. Defaults to 10. 'limit' => 20, // Maximum number of results to return. Defaults to 10.

View file

@ -33,7 +33,7 @@ class Unimplemented extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function delete() protected function delete()
{ {
DI::apiResponse()->unsupported(Router::DELETE); DI::apiResponse()->unsupported(Router::DELETE);
} }
@ -41,7 +41,7 @@ class Unimplemented extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function patch() protected function patch()
{ {
DI::apiResponse()->unsupported(Router::PATCH); DI::apiResponse()->unsupported(Router::PATCH);
} }
@ -49,7 +49,7 @@ class Unimplemented extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function post() protected function post(array $request = [], array $post = [])
{ {
DI::apiResponse()->unsupported(Router::POST); DI::apiResponse()->unsupported(Router::POST);
} }
@ -65,7 +65,7 @@ class Unimplemented extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
DI::apiResponse()->unsupported(Router::GET); DI::apiResponse()->unsupported(Router::GET);
} }

View file

@ -30,7 +30,7 @@ use Friendica\Util\DateTimeFormat;
*/ */
class RateLimitStatus extends BaseApi class RateLimitStatus extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$hash = [ $hash = [

View file

@ -21,6 +21,7 @@
namespace Friendica\Module\Api\Twitter; namespace Friendica\Module\Api\Twitter;
use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -29,16 +30,18 @@ use Friendica\Model\User;
use Friendica\Module\BaseApi; use Friendica\Module\BaseApi;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Psr\Log\LoggerInterface;
abstract class ContactEndpoint extends BaseApi abstract class ContactEndpoint extends BaseApi
{ {
const DEFAULT_COUNT = 20; const DEFAULT_COUNT = 20;
const MAX_COUNT = 200; 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); self::checkAllowedScope(self::SCOPE_READ);
} }

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Ids extends ContactEndpoint class Ids extends ContactEndpoint
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Lists extends ContactEndpoint class Lists extends ContactEndpoint
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Ids extends ContactEndpoint class Ids extends ContactEndpoint
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Lists extends ContactEndpoint class Lists extends ContactEndpoint
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class SavedSearches extends BaseApi class SavedSearches extends BaseApi
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -21,21 +21,24 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\App;
use Friendica\App\BaseURL; use Friendica\App\BaseURL;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* Shows the App menu * Shows the App menu
*/ */
class Apps extends BaseModule 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'); $privateaddons = $config->get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) { 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(); $apps = Nav::getAppMenu();

View file

@ -34,7 +34,7 @@ class Attach extends BaseModule
/** /**
* Return to user an attached file given the id * Return to user an attached file given the id
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$a = DI::app(); $a = DI::app();
if (empty($this->parameters['item'])) { if (empty($this->parameters['item'])) {

View file

@ -68,7 +68,7 @@ abstract class BaseAdmin extends BaseModule
} }
} }
public function content(): string protected function content(array $request = []): string
{ {
self::checkAdminAccess(true); self::checkAdminAccess(true);

View file

@ -53,7 +53,7 @@ class BaseApi extends BaseModule
*/ */
protected static $request = []; protected static $request = [];
public function delete() protected function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -62,7 +62,7 @@ class BaseApi extends BaseModule
} }
} }
public function patch() protected function patch()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); 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); self::checkAllowedScope(self::SCOPE_WRITE);

View file

@ -22,6 +22,7 @@
namespace Friendica\Module; namespace Friendica\Module;
use Exception; use Exception;
use Friendica\App;
use Friendica\App\Arguments; use Friendica\App\Arguments;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\Pager; use Friendica\Content\Pager;
@ -30,6 +31,8 @@ use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Navigation\Notifications\ValueObject\FormattedNotification; use Friendica\Navigation\Notifications\ValueObject\FormattedNotification;
use Friendica\Network\HTTPException\ForbiddenException; use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* Base Module for each tab of the notification display * Base Module for each tab of the notification display
@ -86,9 +89,9 @@ abstract class BaseNotifications extends BaseModule
*/ */
abstract public function getNotifications(); 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()) { if (!local_user()) {
throw new ForbiddenException($this->t('Permission denied.')); 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->firstItemNum = ($page * self::ITEMS_PER_PAGE) - self::ITEMS_PER_PAGE;
$this->showAll = ($_REQUEST['show'] ?? '') === 'all'; $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 the last argument of the query is NOT json, return
if ($this->args->get($this->args->getArgc() - 1) !== 'json') { if ($this->args->get($this->args->getArgc() - 1) !== 'json') {

View file

@ -28,7 +28,7 @@ use Friendica\DI;
class BaseSettings extends BaseModule class BaseSettings extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$a = DI::app(); $a = DI::app();

View file

@ -34,7 +34,7 @@ use Friendica\Util\Strings;
*/ */
class Bookmarklet extends BaseModule class Bookmarklet extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$_GET['mode'] = 'minimal'; $_GET['mode'] = 'minimal';

View file

@ -91,7 +91,7 @@ class Contact extends BaseModule
DI::baseUrl()->redirect($redirectUrl); DI::baseUrl()->redirect($redirectUrl);
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;

View file

@ -21,6 +21,7 @@
namespace Friendica\Module\Contact; namespace Friendica\Module\Contact;
use Friendica\App;
use Friendica\App\Page; use Friendica\App\Page;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\Widget; use Friendica\Content\Widget;
@ -33,6 +34,7 @@ use Friendica\Model;
use Friendica\Module\Contact; use Friendica\Module\Contact;
use Friendica\Network\HTTPException\BadRequestException; use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\ForbiddenException; use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Util\Profiler;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -43,25 +45,22 @@ class Advanced extends BaseModule
{ {
/** @var Database */ /** @var Database */
protected $dba; protected $dba;
/** @var LoggerInterface */
protected $logger;
/** @var Page */ /** @var Page */
protected $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->dba = $dba;
$this->logger = $logger; $this->page = $page;
$this->page = $page;
if (!Session::isAuthenticated()) { if (!Session::isAuthenticated()) {
throw new ForbiddenException($this->t('Permission denied.')); throw new ForbiddenException($this->t('Permission denied.'));
} }
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
$cid = $this->parameters['id']; $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']; $cid = $this->parameters['id'];

View file

@ -14,7 +14,7 @@ use Friendica\Network\HTTPException;
class Contacts extends BaseModule class Contacts extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$app = DI::app(); $app = DI::app();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Strings;
*/ */
class Hovercard extends BaseModule class Hovercard extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$contact_url = $_REQUEST['url'] ?? ''; $contact_url = $_REQUEST['url'] ?? '';

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\BadRequestException;
*/ */
class Media extends BaseModule class Media extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$cid = $this->parameters['id']; $cid = $this->parameters['id'];

View file

@ -18,7 +18,7 @@ use Friendica\Util\XML;
class Poke extends BaseModule class Poke extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user() || empty($this->parameters['id'])) { if (!local_user() || empty($this->parameters['id'])) {
return self::postReturn(false); return self::postReturn(false);
@ -123,7 +123,7 @@ class Poke extends BaseModule
return $success; return $success;
} }
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));

View file

@ -21,8 +21,7 @@
namespace Friendica\Module\Contact; namespace Friendica\Module\Contact;
use Friendica\App\Arguments; use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -33,6 +32,8 @@ use Friendica\Model;
use Friendica\Module\Contact; use Friendica\Module\Contact;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
class Revoke extends BaseModule class Revoke extends BaseModule
{ {
@ -41,18 +42,12 @@ class Revoke extends BaseModule
/** @var Database */ /** @var Database */
protected $dba; protected $dba;
/** @var BaseURL */
protected $baseUrl; public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
/** @var Arguments */
protected $args;
public function __construct(Database $dba, BaseURL $baseUrl, Arguments $args, L10n $l10n, array $parameters = [])
{ {
parent::__construct($l10n, $parameters); parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->dba = $dba; $this->dba = $dba;
$this->baseUrl = $baseUrl;
$this->args = $args;
if (!local_user()) { if (!local_user()) {
return; return;
@ -78,7 +73,7 @@ class Revoke extends BaseModule
} }
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(); throw new HTTPException\UnauthorizedException();
@ -98,7 +93,7 @@ class Revoke extends BaseModule
$this->baseUrl->redirect('contact/' . $this->parameters['id']); $this->baseUrl->redirect('contact/' . $this->parameters['id']);
} }
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']); return Login::form($_SERVER['REQUEST_URI']);

View file

@ -49,7 +49,7 @@ class Community extends BaseModule
protected static $max_id; protected static $max_id;
protected static $item_id; protected static $item_id;
public function content(): string protected function content(array $request = []): string
{ {
$this->parseRequest(); $this->parseRequest();

View file

@ -57,7 +57,7 @@ class Network extends BaseModule
/** @var string */ /** @var string */
protected static $order; protected static $order;
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
return Login::form(); return Login::form();

View file

@ -32,7 +32,7 @@ use Friendica\DI;
*/ */
class Credits extends BaseModule class Credits extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
/* fill the page with credits */ /* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt'); $credits_string = file_get_contents('CREDITS.txt');

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/ */
class Notify extends BaseModule class Notify extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
$postdata = Network::postdata(); $postdata = Network::postdata();

View file

@ -29,7 +29,7 @@ use Friendica\Protocol\OStatus;
*/ */
class Poll extends BaseModule class Poll extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
header("Content-type: application/atom+xml"); header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? ''; $last_update = $_GET['last_update'] ?? '';

View file

@ -34,7 +34,7 @@ use Friendica\Util\XML;
class ActivityPubConversion extends BaseModule class ActivityPubConversion extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
function visible_whitespace($s) function visible_whitespace($s)
{ {

View file

@ -35,7 +35,7 @@ use Friendica\Util\XML;
*/ */
class Babel extends BaseModule class Babel extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
function visible_whitespace($s) function visible_whitespace($s)
{ {

View file

@ -21,13 +21,15 @@
namespace Friendica\Module\Debug; namespace Friendica\Module\Debug;
use Friendica\App\BaseURL; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Model; use Friendica\Model;
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
use Friendica\Protocol; use Friendica\Protocol;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* Tests a given feed of a contact * Tests a given feed of a contact
@ -37,9 +39,9 @@ class Feed extends BaseModule
/** @var ICanSendHttpRequests */ /** @var ICanSendHttpRequests */
protected $httpClient; 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; $this->httpClient = $httpClient;
@ -49,7 +51,7 @@ class Feed extends BaseModule
} }
} }
public function content(): string protected function content(array $request = []): string
{ {
$result = []; $result = [];
if (!empty($_REQUEST['url'])) { if (!empty($_REQUEST['url'])) {

View file

@ -31,7 +31,7 @@ use Friendica\Network\HTTPException;
*/ */
class ItemBody extends BaseModule class ItemBody extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));

View file

@ -31,7 +31,7 @@ class Localtime extends BaseModule
{ {
static $mod_localtime = ''; static $mod_localtime = '';
public function post() protected function post(array $request = [], array $post = [])
{ {
$time = ($_REQUEST['time'] ?? '') ?: 'now'; $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'; $time = ($_REQUEST['time'] ?? '') ?: 'now';

View file

@ -32,7 +32,7 @@ use Friendica\Network\Probe as NetworkProbe;
*/ */
class Probe extends BaseModule class Probe extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));

View file

@ -31,7 +31,7 @@ use Friendica\Network\Probe;
*/ */
class WebFinger extends BaseModule class WebFinger extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.')); throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));

View file

@ -37,7 +37,7 @@ use Friendica\Util\Proxy;
*/ */
class Delegation extends BaseModule class Delegation extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -112,7 +112,7 @@ class Delegation extends BaseModule
// NOTREACHED // NOTREACHED
} }
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.')); throw new ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -38,7 +38,7 @@ use Friendica\Util\Strings;
*/ */
class Fetch extends BaseModule class Fetch extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (empty($this->parameters['guid'])) { if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();

View file

@ -21,6 +21,7 @@
namespace Friendica\Module\Diaspora; namespace Friendica\Module\Diaspora;
use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -28,6 +29,7 @@ use Friendica\Model\User;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
@ -36,20 +38,17 @@ use Psr\Log\LoggerInterface;
*/ */
class Receive extends BaseModule class Receive extends BaseModule
{ {
/** @var LoggerInterface */
protected $logger;
/** @var IManageConfigValues */ /** @var IManageConfigValues */
protected $config; 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); parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->logger = $logger;
$this->config = $config; $this->config = $config;
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
$enabled = $this->config->get('system', 'diaspora_enabled', false); $enabled = $this->config->get('system', 'diaspora_enabled', false);
if (!$enabled) { if (!$enabled) {

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/ */
class Directory extends BaseModule class Directory extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$app = DI::app(); $app = DI::app();
$config = DI::config(); $config = DI::config();

View file

@ -13,7 +13,7 @@ use Friendica\Util\Temporal;
class Json extends \Friendica\BaseModule class Json extends \Friendica\BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(); throw new HTTPException\UnauthorizedException();

View file

@ -41,7 +41,7 @@ use Friendica\Protocol\Feed as ProtocolFeed;
*/ */
class Feed extends BaseModule class Feed extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$a = DI::app(); $a = DI::app();

View file

@ -33,7 +33,7 @@ use Friendica\Util\XML;
*/ */
class RemoveTag extends BaseModule class RemoveTag extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();

View file

@ -21,13 +21,14 @@
namespace Friendica\Module\Filer; namespace Friendica\Module\Filer;
use Friendica\App\BaseURL; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model; use Friendica\Model;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Friendica\Util\XML; use Friendica\Util\XML;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -36,22 +37,17 @@ use Psr\Log\LoggerInterface;
*/ */
class SaveTag extends BaseModule class SaveTag extends BaseModule
{ {
/** @var LoggerInterface */ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
protected $logger;
public function __construct(LoggerInterface $logger, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
{ {
parent::__construct($l10n, $parameters); parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->logger = $logger;
if (!local_user()) { if (!local_user()) {
notice($this->t('You must be logged in to use this module')); notice($this->t('You must be logged in to use this module'));
$baseUrl->redirect(); $baseUrl->redirect();
} }
} }
public function rawContent() protected function rawContent(array $request = [])
{ {
$term = XML::unescape(trim($_GET['term'] ?? '')); $term = XML::unescape(trim($_GET['term'] ?? ''));

View file

@ -10,8 +10,9 @@ use Friendica\Model\Contact;
*/ */
class FollowConfirm extends BaseModule class FollowConfirm extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
parent::post($post);
$uid = local_user(); $uid = local_user();
if (!$uid) { if (!$uid) {
notice(DI::l10n()->t('Permission denied.')); notice(DI::l10n()->t('Permission denied.'));

View file

@ -21,7 +21,7 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\App\BaseURL; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -31,16 +31,16 @@ use Friendica\Database\Database;
use Friendica\Model\Contact as ContactModel; use Friendica\Model\Contact as ContactModel;
use Friendica\Network\HTTPException\ForbiddenException; use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Network\HTTPException\NotFoundException; use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\Profiler;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Worker\Delivery; use Friendica\Worker\Delivery;
use Psr\Log\LoggerInterface;
/** /**
* Suggest friends to a known contact * Suggest friends to a known contact
*/ */
class FriendSuggest extends BaseModule class FriendSuggest extends BaseModule
{ {
/** @var BaseURL */
protected $baseUrl;
/** @var Database */ /** @var Database */
protected $dba; protected $dba;
/** @var \Friendica\Contact\FriendSuggest\Repository\FriendSuggest */ /** @var \Friendica\Contact\FriendSuggest\Repository\FriendSuggest */
@ -48,21 +48,20 @@ class FriendSuggest extends BaseModule
/** @var \Friendica\Contact\FriendSuggest\Factory\FriendSuggest */ /** @var \Friendica\Contact\FriendSuggest\Factory\FriendSuggest */
protected $friendSuggestFac; 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()) { if (!local_user()) {
throw new ForbiddenException($this->t('Permission denied.')); throw new ForbiddenException($this->t('Permission denied.'));
} }
$this->baseUrl = $baseUrl;
$this->dba = $dba; $this->dba = $dba;
$this->friendSuggestRepo = $friendSuggestRepo; $this->friendSuggestRepo = $friendSuggestRepo;
$this->friendSuggestFac = $friendSuggestFac; $this->friendSuggestFac = $friendSuggestFac;
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
$cid = intval($this->parameters['contact']); $cid = intval($this->parameters['contact']);
@ -100,7 +99,7 @@ class FriendSuggest extends BaseModule
info($this->t('Friend suggestion sent.')); info($this->t('Friend suggestion sent.'));
} }
public function content(): string protected function content(array $request = []): string
{ {
$cid = intval($this->parameters['contact']); $cid = intval($this->parameters['contact']);

View file

@ -38,7 +38,7 @@ use Friendica\Protocol\ActivityPub;
*/ */
class Friendica extends BaseModule class Friendica extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$config = DI::config(); $config = DI::config();
@ -110,7 +110,7 @@ class Friendica extends BaseModule
]); ]);
} }
public function rawContent() protected function rawContent(array $request = [])
{ {
if (ActivityPub::isRequest()) { if (ActivityPub::isRequest()) {
try { try {

View file

@ -32,7 +32,7 @@ require_once 'boot.php';
class Group extends BaseModule class Group extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
if (DI::mode()->isAjax()) { if (DI::mode()->isAjax()) {
$this->ajaxPost(); $this->ajaxPost();
@ -140,7 +140,7 @@ class Group extends BaseModule
} }
} }
public function content(): string protected function content(array $request = []): string
{ {
$change = false; $change = false;

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class HCard extends BaseModule class HCard extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') { if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user // A logged in user views a profile of a user

View file

@ -27,7 +27,7 @@ use Friendica\Network\HTTPException;
class MethodNotAllowed extends BaseModule class MethodNotAllowed extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.')); throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.'));
} }

View file

@ -27,8 +27,39 @@ use Friendica\Network\HTTPException;
class PageNotFound extends BaseModule class PageNotFound extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.')); 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
}
} }

View file

@ -31,7 +31,7 @@ use Friendica\Util\Strings;
*/ */
class Hashtag extends BaseModule class Hashtag extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$result = []; $result = [];

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException;
*/ */
class Help extends BaseModule class Help extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
Nav::setSelected('help'); Nav::setSelected('help');

View file

@ -32,7 +32,7 @@ use Friendica\Module\Security\Login;
*/ */
class Home extends BaseModule class Home extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$app = DI::app(); $app = DI::app();
$config = DI::config(); $config = DI::config();

View file

@ -31,7 +31,9 @@ use Friendica\Core\Theme;
use Friendica\DI; use Friendica\DI;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\BasePath; use Friendica\Util\BasePath;
use Friendica\Util\Profiler;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
use Psr\Log\LoggerInterface;
class Install extends BaseModule class Install extends BaseModule
{ {
@ -70,16 +72,13 @@ class Install extends BaseModule
protected $app; protected $app;
/** @var App\Mode */ /** @var App\Mode */
protected $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->app = $app;
$this->mode = $mode; $this->mode = $mode;
$this->baseUrl = $baseUrl;
$this->installer = $installer; $this->installer = $installer;
if (!$this->mode->isInstall()) { if (!$this->mode->isInstall()) {
@ -105,7 +104,7 @@ class Install extends BaseModule
$this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; $this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
} }
public function post() protected function post(array $request = [], array $post = [])
{ {
$configCache = $this->app->getConfigCache(); $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(); $configCache = $this->app->getConfigCache();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Strings;
*/ */
class Invite extends BaseModule class Invite extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); 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)); info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
} }
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/ */
class Activity extends BaseModule class Activity extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!Session::isAuthenticated()) { if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();

View file

@ -40,7 +40,7 @@ use Friendica\Util\Temporal;
class Compose extends BaseModule class Compose extends BaseModule
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!empty($_REQUEST['body'])) { if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network'; $_REQUEST['return'] = 'network';
@ -51,7 +51,7 @@ class Compose extends BaseModule
} }
} }
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('compose', false); return Login::form('compose', false);

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class Follow extends BaseModule class Follow extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException;
*/ */
class Ignore extends BaseModule class Ignore extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class Pin extends BaseModule class Pin extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
*/ */
class Star extends BaseModule class Star extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();

View file

@ -31,6 +31,7 @@ use Friendica\Model\User;
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Util\HTTPSignature; use Friendica\Util\HTTPSignature;
use Friendica\Util\Profiler;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -43,26 +44,21 @@ class Magic extends BaseModule
{ {
/** @var App */ /** @var App */
protected $app; protected $app;
/** @var LoggerInterface */
protected $logger;
/** @var Database */ /** @var Database */
protected $dba; protected $dba;
/** @var ICanSendHttpRequests */ /** @var ICanSendHttpRequests */
protected $httpClient; 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->app = $app;
$this->logger = $logger;
$this->dba = $dba; $this->dba = $dba;
$this->httpClient = $httpClient; $this->httpClient = $httpClient;
$this->baseUrl = $baseUrl;
} }
public function rawContent() protected function rawContent(array $request = [])
{ {
$this->logger->info('magic module: invoked'); $this->logger->info('magic module: invoked');

View file

@ -34,7 +34,7 @@ use Friendica\Util\Strings;
*/ */
class Maintenance extends BaseModule class Maintenance extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
$reason = DI::config()->get('system', 'maintenance_reason'); $reason = DI::config()->get('system', 'maintenance_reason');

View file

@ -27,7 +27,7 @@ use Friendica\DI;
class Manifest extends BaseModule class Manifest extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$config = DI::config(); $config = DI::config();

View file

@ -35,7 +35,7 @@ use Friendica\Model\User;
*/ */
class NoScrape extends BaseModule class NoScrape extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$a = DI::app(); $a = DI::app();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/ */
class NodeInfo110 extends BaseModule class NodeInfo110 extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$config = DI::config(); $config = DI::config();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/ */
class NodeInfo120 extends BaseModule class NodeInfo120 extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$config = DI::config(); $config = DI::config();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/ */
class NodeInfo210 extends BaseModule class NodeInfo210 extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$config = DI::config(); $config = DI::config();

View file

@ -21,6 +21,7 @@
namespace Friendica\Module\Notifications; namespace Friendica\Module\Notifications;
use Friendica\App;
use Friendica\App\Arguments; use Friendica\App\Arguments;
use Friendica\App\Mode; use Friendica\App\Mode;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
@ -33,6 +34,8 @@ use Friendica\Model\User;
use Friendica\Module\BaseNotifications; use Friendica\Module\BaseNotifications;
use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory; use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory;
use Friendica\Navigation\Notifications\ValueObject\Introduction; use Friendica\Navigation\Notifications\ValueObject\Introduction;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* Prints notifications about introduction * Prints notifications about introduction
@ -44,9 +47,9 @@ class Introductions extends BaseNotifications
/** @var Mode */ /** @var Mode */
protected $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->notificationIntro = $notificationIntro;
$this->mode = $mode; $this->mode = $mode;
@ -71,7 +74,7 @@ class Introductions extends BaseNotifications
]; ];
} }
public function content(): string protected function content(array $request = []): string
{ {
Nav::setSelected('introductions'); Nav::setSelected('introductions');

View file

@ -42,7 +42,7 @@ class Notification extends BaseModule
* @throws \ImagickException * @throws \ImagickException
* @throws \Exception * @throws \Exception
*/ */
public function post() protected function post(array $request = [], array $post = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
@ -73,7 +73,7 @@ class Notification extends BaseModule
* *
* @throws HTTPException\UnauthorizedException * @throws HTTPException\UnauthorizedException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
@ -101,7 +101,7 @@ class Notification extends BaseModule
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \Exception * @throws \Exception
*/ */
public function content(): string protected function content(array $request = []): string
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to show this page.')); notice(DI::l10n()->t('You must be logged in to show this page.'));

View file

@ -21,13 +21,15 @@
namespace Friendica\Module\Notifications; namespace Friendica\Module\Notifications;
use Friendica\App;
use Friendica\App\Arguments; use Friendica\App\Arguments;
use Friendica\App\BaseURL;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Module\BaseNotifications; use Friendica\Module\BaseNotifications;
use Friendica\Navigation\Notifications\ValueObject\FormattedNotification; use Friendica\Navigation\Notifications\ValueObject\FormattedNotification;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/** /**
* Prints all notification types except introduction: * Prints all notification types except introduction:
@ -41,15 +43,11 @@ class Notifications extends BaseNotifications
/** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification */ /** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification */
protected $formattedNotificationFactory; protected $formattedNotificationFactory;
/** @var BaseURL */ public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, array $server, array $parameters = [])
protected $baseUrl;
public function __construct(BaseURL $baseUrl, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, Arguments $args, L10n $l10n, array $parameters = [])
{ {
parent::__construct($args, $l10n, $parameters); parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->formattedNotificationFactory = $formattedNotificationFactory; $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'); Nav::setSelected('notifications');

View file

@ -30,13 +30,13 @@ use Friendica\Module\BaseApi;
*/ */
class Acknowledge extends BaseApi class Acknowledge extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
DI::session()->set('oauth_acknowledge', true); DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path')); 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'] ?? ''); DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');

View file

@ -37,7 +37,7 @@ class Authorize extends BaseApi
/** /**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance. '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']; self::$oauth_code = $token['code'];
} }
public function content(): string protected function content(array $request = []): string
{ {
if (empty(self::$oauth_code)) { if (empty(self::$oauth_code)) {
return ''; return '';

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Revoke extends BaseApi class Revoke extends BaseApi
{ {
public function post() public function post(array $request = [], array $post = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration 'client_id' => '', // Client ID, obtained during app registration

View file

@ -34,7 +34,7 @@ use Friendica\Security\OAuth;
*/ */
class Token extends BaseApi class Token extends BaseApi
{ {
public function post() protected function post(array $request = [], array $post = [])
{ {
$request = self::getRequest([ $request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration 'client_id' => '', // Client ID, obtained during app registration

View file

@ -37,7 +37,7 @@ use Friendica\Util\Strings;
*/ */
class Oembed extends BaseModule class Oembed extends BaseModule
{ {
public function content(): string protected function content(array $request = []): string
{ {
// Unused form: /oembed/b2h?url=... // Unused form: /oembed/b2h?url=...
if (DI::args()->getArgv()[1] == 'b2h') { if (DI::args()->getArgv()[1] == 'b2h') {

View file

@ -36,7 +36,7 @@ class OpenSearch extends BaseModule
/** /**
* @throws \Exception * @throws \Exception
*/ */
public function rawContent() protected function rawContent(array $request = [])
{ {
header('Content-type: application/opensearchdescription+xml'); header('Content-type: application/opensearchdescription+xml');

View file

@ -44,7 +44,7 @@ use Friendica\Util\Strings;
*/ */
class Owa extends BaseModule class Owa extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
$ret = [ 'success' => false ]; $ret = [ 'success' => false ];

View file

@ -31,7 +31,7 @@ use Friendica\Util;
class ParseUrl extends BaseModule class ParseUrl extends BaseModule
{ {
public function rawContent() protected function rawContent(array $request = [])
{ {
if (!Session::isAuthenticated()) { if (!Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(); throw new \Friendica\Network\HTTPException\ForbiddenException();

Some files were not shown because too many files have changed in this diff Show more