*/
private $args;
- /**
- * @var Core\System The system methods
- */
- private $system;
-
/**
* @var IManagePersonalConfigValues
*/
* @param Profiler $profiler The profiler of this application
* @param L10n $l10n The translator instance
* @param App\Arguments $args The Friendica Arguments of the call
- * @param Core\System $system The system methods
* @param IManagePersonalConfigValues $pConfig Personal configuration
*/
- public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\System $system, IManagePersonalConfigValues $pConfig)
+ public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig)
{
$this->database = $database;
$this->config = $config;
$this->logger = $logger;
$this->l10n = $l10n;
$this->args = $args;
- $this->system = $system;
$this->pConfig = $pConfig;
$this->load();
// Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") &&
- strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
+ strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
Core\Session::set('my_url', $_GET['zrl']);
Core\Session::set('authenticated', 0);
$page['page_title'] = $moduleName;
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
- $module = new Maintenance($this->l10n);
+ $module = $router->getModule(Maintenance::class);
} else {
// determine the module class and save it to the module instance
// @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
}
// Let the module run it's internal process (init, get, post, ...)
- $module->run($this->baseURL, $this->args, $this->logger, $this->profiler, $_SERVER, $_POST);
+ $content = $module->run($_POST, $_REQUEST);
+ $page->run($this, $this->baseURL, $this->args, $this->mode, $content, $this->l10n, $this->profiler, $this->config, $pconfig);
} catch (HTTPException $e) {
(new ModuleHTTPException())->rawContent($e);
}
-
- $page->run($this, $this->baseURL, $this->args, $this->mode, $module, $this->l10n, $this->profiler, $this->config, $pconfig);
}
/**
use DOMDocument;
use DOMXPath;
use Friendica\App;
-use Friendica\Capabilities\ICanHandleRequests;
use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Theme;
-use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException;
use Friendica\Util\Network;
use Friendica\Util\Strings;
if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
$pageURL .= "s";
}
-
+
$pageURL .= "://";
-
+
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
* - module content
* - hooks for content
*
- * @param ICanHandleRequests $module The module
- * @param Mode $mode The Friendica execution mode
+ * @param string $content The content to print
+ * @param Mode $mode The Friendica execution mode
*
* @throws HTTPException\InternalServerErrorException
*/
- private function initContent(ICanHandleRequests $module, Mode $mode)
+ private function initContent(string $content, Mode $mode)
{
- $content = '';
-
- try {
- $arr = ['content' => $content];
- Hook::callAll($module->getClassName() . '_mod_content', $arr);
- $content = $arr['content'];
- $content .= $module->content();
- } catch (HTTPException $e) {
- $content = (new ModuleHTTPException())->content($e);
- }
-
// initialise content region
if ($mode->isNormal()) {
Hook::callAll('page_content_top', $this->page['content']);
* @param BaseURL $baseURL The Friendica Base URL
* @param Arguments $args The Friendica App arguments
* @param Mode $mode The current node mode
- * @param ICanHandleRequests $module The loaded Friendica module
+ * @param string $content The content to print on frontend
* @param L10n $l10n The l10n language class
* @param IManageConfigValues $config The Configuration of this node
* @param IManagePersonalConfigValues $pconfig The personal/user configuration
*
- * @throws HTTPException\InternalServerErrorException
+ * @throws HTTPException\InternalServerErrorException|HTTPException\ServiceUnavailableException
*/
- public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, ICanHandleRequests $module, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig)
+ public function run(App $app, BaseURL $baseURL, Arguments $args, Mode $mode, string $content, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig)
{
$moduleName = $args->getModuleName();
* Sets the $Page->page['content'] variable
*/
$timestamp = microtime(true);
- $this->initContent($module, $mode);
+ $this->initContent($content, $mode);
$profiler->set(microtime(true) - $timestamp, 'content');
// Load current theme info after module has been initialized as theme could have been set in module
use Friendica\Module\HTTPException\PageNotFound;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\MethodNotAllowedException;
+use Friendica\Network\HTTPException\NoContentException;
use Friendica\Network\HTTPException\NotFoundException;
/**
/** @var string */
private $baseRoutesFilepath;
+ /** @var array */
+ private $server;
+
/**
* @param array $server The $_SERVER variable
* @param string $baseRoutesFilepath The path to a base routes file to leverage cache, can be empty
$this->args = $args;
$this->config = $config;
$this->dice = $dice;
+ $this->server = $server;
+
+ $httpMethod = $this->server['REQUEST_METHOD'] ?? self::GET;
+
+ // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
+ // @todo Check allowed methods per requested path
+ if ($httpMethod === static::OPTIONS) {
+ header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
+ throw new NoContentException();
+ }
- $httpMethod = $server['REQUEST_METHOD'] ?? self::GET;
$this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
$this->routeCollector = isset($routeCollector) ?
return $moduleClass;
}
- public function getModule(): ICanHandleRequests
+ public function getModule(?string $module_class = null): ICanHandleRequests
{
- $module_class = null;
- $module_parameters = [];
+ $module_parameters = [$this->server];
/**
* ROUTING
*
* post() and/or content() static methods can be respectively called to produce a data change or an output.
**/
try {
- $module_class = $this->getModuleClass();
+ $module_class = $module_class ?? $this->getModuleClass();
$module_parameters[] = $this->parameters;
} catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class;
use Friendica\App\Router;
use Friendica\Capabilities\ICanHandleRequests;
+use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Model\User;
-use Friendica\Module\HTTPException\PageNotFound;
-use Friendica\Network\HTTPException\NoContentException;
+use Friendica\Module\Special\HTTPException as ModuleHTTPException;
+use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
{
/** @var array */
protected $parameters = [];
-
/** @var L10n */
protected $l10n;
+ /** @var App\BaseURL */
+ protected $baseUrl;
+ /** @var App\Arguments */
+ protected $args;
+ /** @var LoggerInterface */
+ protected $logger;
+ /** @var Profiler */
+ protected $profiler;
+ /** @var array */
+ protected $server;
- public function __construct(L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
$this->parameters = $parameters;
$this->l10n = $l10n;
+ $this->baseUrl = $baseUrl;
+ $this->args = $args;
+ $this->logger = $logger;
+ $this->profiler = $profiler;
+ $this->server = $server;
}
/**
}
/**
- * {@inheritDoc}
+ * Module GET method to display raw content from technical endpoints
+ *
+ * Extend this method if the module is supposed to return communication data,
+ * e.g. from protocol implementations.
+ *
+ * @param string[] $request The $_REQUEST content
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
// echo '';
// exit;
}
/**
- * {@inheritDoc}
+ * Module GET method to display any content
+ *
+ * Extend this method if the module is supposed to return any display
+ * through a GET request. It can be an HTML page through templating or a
+ * XML feed or a JSON output.
+ *
+ * @param string[] $request The $_REQUEST content
*/
- public function content(): string
+ protected function content(array $request = []): string
{
return '';
}
/**
- * {@inheritDoc}
+ * Module DELETE method to process submitted data
+ *
+ * Extend this method if the module is supposed to process DELETE requests.
+ * Doesn't display any content
*/
- public function delete()
+ protected function delete()
{
}
/**
- * {@inheritDoc}
+ * Module PATCH method to process submitted data
+ *
+ * Extend this method if the module is supposed to process PATCH requests.
+ * Doesn't display any content
*/
- public function patch()
+ protected function patch()
{
}
/**
- * {@inheritDoc}
+ * Module POST method to process submitted data
+ *
+ * Extend this method if the module is supposed to process POST requests.
+ * Doesn't display any content
+ *
+ * @param string[] $request The $_REQUEST content
+ * @param string[] $post The $_POST content
+ *
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
- // DI::baseurl()->redirect('module');
+ // $this->baseUrl->redirect('module');
}
/**
- * {@inheritDoc}
+ * Module PUT method to process submitted data
+ *
+ * Extend this method if the module is supposed to process PUT requests.
+ * Doesn't display any content
*/
- public function put()
+ protected function put()
{
}
return static::class;
}
- public function run(App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $post)
+ /**
+ * {@inheritDoc}
+ */
+ public function run(array $post = [], array $request = []): string
{
- /* The URL provided does not resolve to a valid module.
- *
- * On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'.
- * We don't like doing this, but as it occasionally accounts for 10-20% or more of all site traffic -
- * we are going to trap this and redirect back to the requested page. As long as you don't have a critical error on your page
- * this will often succeed and eventually do the right thing.
- *
- * Otherwise we are going to emit a 404 not found.
- */
- if (static::class === PageNotFound::class) {
- $queryString = $server['QUERY_STRING'];
- // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
- if (!empty($queryString) && preg_match('/{[0-9]}/', $queryString) !== 0) {
- exit();
- }
-
- if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
- $logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $server['REQUEST_URI']]);
- $baseUrl->redirect($server['REQUEST_URI']);
- }
-
- $logger->debug('index.php: page not found.', ['request_uri' => $server['REQUEST_URI'], 'address' => $server['REMOTE_ADDR'], 'query' => $server['QUERY_STRING']]);
- }
-
// @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
- if (substr($_REQUEST['pagename'] ?? '', 0, 12) == '.well-known/') {
+ if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false');
- } elseif (substr($_REQUEST['pagename'] ?? '', 0, 8) == 'profile/') {
+ } elseif (substr($request['pagename'] ?? '', 0, 8) == 'profile/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false');
- } elseif (substr($_REQUEST['pagename'] ?? '', 0, 4) == 'api/') {
+ } elseif (substr($request['pagename'] ?? '', 0, 4) == 'api/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS));
header('Access-Control-Allow-Credentials: false');
header('Access-Control-Expose-Headers: Link');
- } elseif (substr($_REQUEST['pagename'] ?? '', 0, 11) == 'oauth/token') {
+ } elseif (substr($request['pagename'] ?? '', 0, 11) == 'oauth/token') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::POST);
header('Access-Control-Allow-Credentials: false');
}
- // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
- // @todo Check allowed methods per requested path
- if ($server['REQUEST_METHOD'] === Router::OPTIONS) {
- header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
- throw new NoContentException();
- }
-
$placeholder = '';
- $profiler->set(microtime(true), 'ready');
+ $this->profiler->set(microtime(true), 'ready');
$timestamp = microtime(true);
- Core\Hook::callAll($args->getModuleName() . '_mod_init', $placeholder);
+ Core\Hook::callAll($this->args->getModuleName() . '_mod_init', $placeholder);
- $profiler->set(microtime(true) - $timestamp, 'init');
+ $this->profiler->set(microtime(true) - $timestamp, 'init');
- if ($server['REQUEST_METHOD'] === Router::DELETE) {
+ if ($this->server['REQUEST_METHOD'] === Router::DELETE) {
$this->delete();
}
- if ($server['REQUEST_METHOD'] === Router::PATCH) {
+ if ($this->server['REQUEST_METHOD'] === Router::PATCH) {
$this->patch();
}
- if ($server['REQUEST_METHOD'] === Router::POST) {
- Core\Hook::callAll($args->getModuleName() . '_mod_post', $post);
- $this->post();
+ if ($this->server['REQUEST_METHOD'] === Router::POST) {
+ Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post);
+ $this->post($request, $post);
}
- if ($server['REQUEST_METHOD'] === Router::PUT) {
+ if ($this->server['REQUEST_METHOD'] === Router::PUT) {
$this->put();
}
// "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff.
- $this->rawContent();
+ $this->rawContent($request);
+
+ try {
+ $arr = ['content' => ''];
+ Hook::callAll(static::class . '_mod_content', $arr);
+ $content = $arr['content'];
+ return $content . $this->content($_REQUEST);
+ } catch (HTTPException $e) {
+ return (new ModuleHTTPException())->content($e);
+ }
}
/*
namespace Friendica\Capabilities;
+use Friendica\Network\HTTPException;
+
/**
* This interface provides the capability to handle requests from clients and returns the desired outcome
*/
interface ICanHandleRequests
{
/**
- * Module GET method to display raw content from technical endpoints
+ * @param array $post The $_POST content (in case of POST)
+ * @param array $request The $_REQUEST content (in case of GET, POST)
*
- * Extend this method if the module is supposed to return communication data,
- * e.g. from protocol implementations.
- */
- public function rawContent();
-
- /**
- * Module GET method to display any content
+ * @return string Returns the content of the module as string
*
- * Extend this method if the module is supposed to return any display
- * through a GET request. It can be an HTML page through templating or a
- * XML feed or a JSON output.
+ * @throws HTTPException\InternalServerErrorException
*/
- public function content(): string;
-
- /**
- * Module DELETE method to process submitted data
- *
- * Extend this method if the module is supposed to process DELETE requests.
- * Doesn't display any content
- */
- public function delete();
-
- /**
- * Module PATCH method to process submitted data
- *
- * Extend this method if the module is supposed to process PATCH requests.
- * Doesn't display any content
- */
- public function patch();
-
- /**
- * Module POST method to process submitted data
- *
- * Extend this method if the module is supposed to process POST requests.
- * Doesn't display any content
- */
- public function post();
-
- /**
- * Module PUT method to process submitted data
- *
- * Extend this method if the module is supposed to process PUT requests.
- * Doesn't display any content
- */
- public function put();
-
- public function getClassName(): string;
+ public function run(array $post = [], array $request = []): string;
}
namespace Friendica;
use Friendica\Core\L10n;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* This mock module enable class encapsulation of legacy global function modules.
*/
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);
require_once $file_path;
}
- public function content(): string
+ public function content(array $request = []): string
{
return $this->runModuleFunction('content');
}
- public function post()
+ public function post(array $request = [], array $post = [])
{
+ parent::post($post);
+
$this->runModuleFunction('post');
}
*/
class AccountManagementControlDocument extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$output = [
'version' => 1,
*/
class Acctlink extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$addr = trim($_GET['addr'] ?? '');
if (!$addr) {
*/
class Followers extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
*/
class Following extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
*/
class Inbox extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$postdata = Network::postdata();
*/
class Objects extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['guid'])) {
throw new HTTPException\BadRequestException();
*/
class Outbox extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
class Details extends BaseAdmin
{
- public function post()
+ public function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect($redirect);
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Index extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Contact extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/blocklist/contact');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Add extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/blocklist/server');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Index extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/blocklist/server');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class DBSync extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Features extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/features');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Federation extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Delete extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/item/delete');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Source extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Settings extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/logs');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
{
const LIMIT = 500;
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class PhpInfo extends BaseAdmin
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAdminAccess();
*/
class Queue extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Site extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Storage extends BaseAdmin
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/storage');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Summary extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Details extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Module\BaseAdmin;
+use Friendica\Util\Profiler;
use Friendica\Util\Strings;
+use Psr\Log\LoggerInterface;
class Embed extends BaseAdmin
{
/** @var App */
protected $app;
- /** @var App\BaseURL */
- protected $baseUrl;
/** @var App\Mode */
protected $mode;
- public function __construct(App $app, App\BaseURL $baseUrl, App\Mode $mode, L10n $l10n, array $parameters = [])
+ public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, App\Mode $mode, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
- $this->app = $app;
- $this->baseUrl = $baseUrl;
- $this->mode = $mode;
+ $this->app = $app;
+ $this->mode = $mode;
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) {
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
$this->baseUrl->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Index extends BaseAdmin
{
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
namespace Friendica\Module\Admin;
+use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Module\BaseAdmin;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
class Tos extends BaseAdmin
{
protected $tos;
/** @var IManageConfigValues */
protected $config;
- /** @var BaseURL */
- protected $baseUrl;
- public function __construct(\Friendica\Module\Tos $tos, IManageConfigValues $config, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Module\Tos $tos, IManageConfigValues $config, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->tos = $tos;
$this->config = $config;
- $this->baseUrl = $baseUrl;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
$this->baseUrl->redirect('admin/tos');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Active extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Blocked extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/blocked');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Create extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/create');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Deleted extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/deleted');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Index extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Pending extends BaseUsers
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/pending');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
*/
class Activity extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Setseen extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Index extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Delete extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Index extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
echo api_call(DI::args()->getCommand(), $this->parameters['extension'] ?? 'json');
exit();
*/
class Notification extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Delete extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Delete extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Update extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Show extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Config extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = [
'site' => [
*/
class Version extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null);
}
*/
class Test extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true';
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Block extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
*/
class Follow extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Mute extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
*/
class Note extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Unblock extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
*/
class Unfollow extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
*/
class Unmute extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
*/
class UpdateCredentials extends BaseApi
{
- public function patch()
+ protected function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$request = self::getRequest([
'client_name' => '',
*/
class VerifyCredentials extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$application = self::getCurrentApplication();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Conversations extends BaseApi
{
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Read extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/instance/directory/
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$request = self::getRequest([
'offset' => 0, // How many accounts to skip before returning results. Default 0.
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
System::jsonExit([]);
}
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Filters extends BaseApi
{
- public function post()
+ public function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-follow
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-follow
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests/
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
System::jsonExit(InstanceEntity::get());
}
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$return = [];
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$rules = [];
$id = 0;
*/
class Lists extends BaseApi
{
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
System::jsonExit([]);
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Accounts extends BaseApi
{
- public function delete()
+ protected function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
DI::apiResponse()->unsupported(Router::POST);
}
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Markers extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
*/
class Media extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Clear extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Dismiss extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
System::jsonError(404, ['error' => 'Record not found']);
}
*/
class PushSubscription extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
}
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
System::jsonExit([]);
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
DI::apiResponse()->unsupported(Router::PUT);
}
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Statuses extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
DI::mstdnError()->InternalError();
}
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Bookmark extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Favourite extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Mute extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Pin extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Reblog extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
*/
class Unbookmark extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Unfavourite extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Unmute extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Unpin extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Unreblog extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$uid = self::getCurrentUserID();
/**
* @throws HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$request = self::getRequest([
'limit' => 20, // Maximum number of results to return. Defaults to 10.
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function delete()
+ protected function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function patch()
+ protected function patch()
{
DI::apiResponse()->unsupported(Router::PATCH);
}
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
DI::apiResponse()->unsupported(Router::POST);
}
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
DI::apiResponse()->unsupported(Router::GET);
}
*/
class RateLimitStatus extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$hash = [
namespace Friendica\Module\Api\Twitter;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\BaseApi;
use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
+use Friendica\Util\Profiler;
use Friendica\Util\Strings;
+use Psr\Log\LoggerInterface;
abstract class ContactEndpoint extends BaseApi
{
const DEFAULT_COUNT = 20;
const MAX_COUNT = 200;
- public function __construct(L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
self::checkAllowedScope(self::SCOPE_READ);
}
*/
class Ids extends ContactEndpoint
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
*/
class Lists extends ContactEndpoint
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
*/
class Ids extends ContactEndpoint
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
*/
class Lists extends ContactEndpoint
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();
*/
class SavedSearches extends BaseApi
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
namespace Friendica\Module;
+use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\BaseModule;
use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Shows the App menu
*/
class Apps extends BaseModule
{
- public function __construct(L10n $l10n, IManageConfigValues $config, BaseURL $baseUrl, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$privateaddons = $config->get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$apps = Nav::getAppMenu();
/**
* Return to user an attached file given the id
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$a = DI::app();
if (empty($this->parameters['item'])) {
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
self::checkAdminAccess(true);
*/
protected static $request = [];
- public function delete()
+ protected function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public function patch()
+ protected function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
namespace Friendica\Module;
use Exception;
+use Friendica\App;
use Friendica\App\Arguments;
use Friendica\BaseModule;
use Friendica\Content\Pager;
use Friendica\Core\System;
use Friendica\Navigation\Notifications\ValueObject\FormattedNotification;
use Friendica\Network\HTTPException\ForbiddenException;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Base Module for each tab of the notification display
*/
abstract public function getNotifications();
- public function __construct(Arguments $args, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
if (!local_user()) {
throw new ForbiddenException($this->t('Permission denied.'));
$this->firstItemNum = ($page * self::ITEMS_PER_PAGE) - self::ITEMS_PER_PAGE;
$this->showAll = ($_REQUEST['show'] ?? '') === 'all';
-
- $this->args = $args;
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
// If the last argument of the query is NOT json, return
if ($this->args->get($this->args->getArgc() - 1) !== 'json') {
class BaseSettings extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
*/
class Bookmarklet extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$_GET['mode'] = 'minimal';
DI::baseUrl()->redirect($redirectUrl);
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
namespace Friendica\Module\Contact;
+use Friendica\App;
use Friendica\App\Page;
use Friendica\BaseModule;
use Friendica\Content\Widget;
use Friendica\Module\Contact;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\ForbiddenException;
+use Friendica\Util\Profiler;
use Friendica\Util\Strings;
use Psr\Log\LoggerInterface;
{
/** @var Database */
protected $dba;
- /** @var LoggerInterface */
- protected $logger;
/** @var Page */
protected $page;
- public function __construct(Database $dba, LoggerInterface $logger, Page $page, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
- $this->dba = $dba;
- $this->logger = $logger;
- $this->page = $page;
+ $this->dba = $dba;
+ $this->page = $page;
if (!Session::isAuthenticated()) {
throw new ForbiddenException($this->t('Permission denied.'));
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$cid = $this->parameters['id'];
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$cid = $this->parameters['id'];
class Contacts extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$app = DI::app();
*/
class Hovercard extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$contact_url = $_REQUEST['url'] ?? '';
*/
class Media extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$cid = $this->parameters['id'];
class Poke extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user() || empty($this->parameters['id'])) {
return self::postReturn(false);
return $success;
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
namespace Friendica\Module\Contact;
-use Friendica\App\Arguments;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Module\Contact;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
class Revoke extends BaseModule
{
/** @var Database */
protected $dba;
- /** @var BaseURL */
- protected $baseUrl;
- /** @var Arguments */
- protected $args;
-
- public function __construct(Database $dba, BaseURL $baseUrl, Arguments $args, L10n $l10n, array $parameters = [])
+
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->dba = $dba;
- $this->baseUrl = $baseUrl;
- $this->args = $args;
if (!local_user()) {
return;
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException();
$this->baseUrl->redirect('contact/' . $this->parameters['id']);
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']);
protected static $max_id;
protected static $item_id;
- public function content(): string
+ protected function content(array $request = []): string
{
$this->parseRequest();
/** @var string */
protected static $order;
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form();
*/
class Credits extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
/* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt');
*/
class Notify extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$postdata = Network::postdata();
*/
class Poll extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? '';
class ActivityPubConversion extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
function visible_whitespace($s)
{
*/
class Babel extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
function visible_whitespace($s)
{
namespace Friendica\Module\Debug;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Model;
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
use Friendica\Protocol;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Tests a given feed of a contact
/** @var ICanSendHttpRequests */
protected $httpClient;
- public function __construct(BaseURL $baseUrl, ICanSendHttpRequests $httpClient, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->httpClient = $httpClient;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$result = [];
if (!empty($_REQUEST['url'])) {
*/
class ItemBody extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));
{
static $mod_localtime = '';
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
*/
class Probe extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
*/
class WebFinger extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
*/
class Delegation extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
// NOTREACHED
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Fetch extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException();
namespace Friendica\Module\Diaspora;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Network;
+use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
*/
class Receive extends BaseModule
{
- /** @var LoggerInterface */
- protected $logger;
/** @var IManageConfigValues */
protected $config;
- public function __construct(LoggerInterface $logger, IManageConfigValues $config, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
-
- $this->logger = $logger;
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+
$this->config = $config;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$enabled = $this->config->get('system', 'diaspora_enabled', false);
if (!$enabled) {
*/
class Directory extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$app = DI::app();
$config = DI::config();
class Json extends \Friendica\BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException();
*/
class Feed extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
*/
class RemoveTag extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException();
namespace Friendica\Module\Filer;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Network\HTTPException;
+use Friendica\Util\Profiler;
use Friendica\Util\XML;
use Psr\Log\LoggerInterface;
*/
class SaveTag extends BaseModule
{
- /** @var LoggerInterface */
- protected $logger;
-
- public function __construct(LoggerInterface $logger, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
-
- $this->logger = $logger;
-
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+
if (!local_user()) {
notice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$term = XML::unescape(trim($_GET['term'] ?? ''));
*/
class FollowConfirm extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
+ parent::post($post);
$uid = local_user();
if (!$uid) {
notice(DI::l10n()->t('Permission denied.'));
namespace Friendica\Module;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Model\Contact as ContactModel;
use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Network\HTTPException\NotFoundException;
+use Friendica\Util\Profiler;
use Friendica\Util\Strings;
use Friendica\Worker\Delivery;
+use Psr\Log\LoggerInterface;
/**
* Suggest friends to a known contact
*/
class FriendSuggest extends BaseModule
{
- /** @var BaseURL */
- protected $baseUrl;
/** @var Database */
protected $dba;
/** @var \Friendica\Contact\FriendSuggest\Repository\FriendSuggest */
/** @var \Friendica\Contact\FriendSuggest\Factory\FriendSuggest */
protected $friendSuggestFac;
- public function __construct(BaseURL $baseUrl, Database $dba, \Friendica\Contact\FriendSuggest\Repository\FriendSuggest $friendSuggestRepo, \Friendica\Contact\FriendSuggest\Factory\FriendSuggest $friendSuggestFac, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler,Database $dba, \Friendica\Contact\FriendSuggest\Repository\FriendSuggest $friendSuggestRepo, \Friendica\Contact\FriendSuggest\Factory\FriendSuggest $friendSuggestFac, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
if (!local_user()) {
throw new ForbiddenException($this->t('Permission denied.'));
}
- $this->baseUrl = $baseUrl;
$this->dba = $dba;
$this->friendSuggestRepo = $friendSuggestRepo;
$this->friendSuggestFac = $friendSuggestFac;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$cid = intval($this->parameters['contact']);
info($this->t('Friend suggestion sent.'));
}
- public function content(): string
+ protected function content(array $request = []): string
{
$cid = intval($this->parameters['contact']);
*/
class Friendica extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$config = DI::config();
]);
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (ActivityPub::isRequest()) {
try {
class Group extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (DI::mode()->isAjax()) {
$this->ajaxPost();
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$change = false;
*/
class HCard extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user
class MethodNotAllowed extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.'));
}
class PageNotFound extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.'));
}
+
+ public function run(array $post = [], array $request = []): string
+ {
+ /* The URL provided does not resolve to a valid module.
+ *
+ * On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'.
+ * We don't like doing this, but as it occasionally accounts for 10-20% or more of all site traffic -
+ * we are going to trap this and redirect back to the requested page. As long as you don't have a critical error on your page
+ * this will often succeed and eventually do the right thing.
+ *
+ * Otherwise we are going to emit a 404 not found.
+ */
+ $queryString = $this->server['QUERY_STRING'];
+ // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
+ if (!empty($queryString) && preg_match('/{[0-9]}/', $queryString) !== 0) {
+ exit();
+ }
+
+ if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
+ $this->logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $this->server['REQUEST_URI']]);
+ $this->baseUrl->redirect($this->server['REQUEST_URI']);
+ }
+
+ $this->logger->debug('index.php: page not found.', [
+ 'request_uri' => $this->server['REQUEST_URI'],
+ 'address' => $this->server['REMOTE_ADDR'],
+ 'query' => $this->server['QUERY_STRING']
+ ]);
+
+ return parent::run($post, $request); // TODO: Change the autogenerated stub
+ }
}
*/
class Hashtag extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$result = [];
*/
class Help extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
Nav::setSelected('help');
*/
class Home extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$app = DI::app();
$config = DI::config();
use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\BasePath;
+use Friendica\Util\Profiler;
use Friendica\Util\Temporal;
+use Psr\Log\LoggerInterface;
class Install extends BaseModule
{
protected $app;
/** @var App\Mode */
protected $mode;
- /** @var App\BaseURL */
- protected $baseUrl;
- public function __construct(App $app, App\Mode $mode, App\BaseURL $baseUrl, App\Arguments $args, Core\Installer $installer, L10n $l10n, array $parameters = [])
+ public function __construct(App $app, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Core\Installer $installer, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->app = $app;
$this->mode = $mode;
- $this->baseUrl = $baseUrl;
$this->installer = $installer;
if (!$this->mode->isInstall()) {
$this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$configCache = $this->app->getConfigCache();
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$configCache = $this->app->getConfigCache();
*/
class Invite extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Activity extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
class Compose extends BaseModule
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network';
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form('compose', false);
*/
class Follow extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$l10n = DI::l10n();
*/
class Ignore extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$l10n = DI::l10n();
*/
class Pin extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$l10n = DI::l10n();
*/
class Star extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$l10n = DI::l10n();
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Util\HTTPSignature;
+use Friendica\Util\Profiler;
use Friendica\Util\Strings;
use Psr\Log\LoggerInterface;
{
/** @var App */
protected $app;
- /** @var LoggerInterface */
- protected $logger;
/** @var Database */
protected $dba;
/** @var ICanSendHttpRequests */
protected $httpClient;
- protected $baseUrl;
- public function __construct(App $app, App\BaseURL $baseUrl, LoggerInterface $logger, Database $dba, ICanSendHttpRequests $httpClient, L10n $l10n, array $parameters = [])
+ public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, ICanSendHttpRequests $httpClient, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->app = $app;
- $this->logger = $logger;
$this->dba = $dba;
$this->httpClient = $httpClient;
- $this->baseUrl = $baseUrl;
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$this->logger->info('magic module: invoked');
*/
class Maintenance extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$reason = DI::config()->get('system', 'maintenance_reason');
class Manifest extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
*/
class NoScrape extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$a = DI::app();
*/
class NodeInfo110 extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
*/
class NodeInfo120 extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
*/
class NodeInfo210 extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
namespace Friendica\Module\Notifications;
+use Friendica\App;
use Friendica\App\Arguments;
use Friendica\App\Mode;
use Friendica\Content\ContactSelector;
use Friendica\Module\BaseNotifications;
use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory;
use Friendica\Navigation\Notifications\ValueObject\Introduction;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Prints notifications about introduction
/** @var Mode */
protected $mode;
- public function __construct(Mode $mode, IntroductionFactory $notificationIntro, Arguments $args, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Mode $mode, IntroductionFactory $notificationIntro, array $server, array $parameters = [])
{
- parent::__construct($args, $l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->notificationIntro = $notificationIntro;
$this->mode = $mode;
];
}
- public function content(): string
+ protected function content(array $request = []): string
{
Nav::setSelected('introductions');
* @throws \ImagickException
* @throws \Exception
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
*
* @throws HTTPException\UnauthorizedException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
* @throws HTTPException\InternalServerErrorException
* @throws \Exception
*/
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to show this page.'));
namespace Friendica\Module\Notifications;
+use Friendica\App;
use Friendica\App\Arguments;
-use Friendica\App\BaseURL;
use Friendica\Content\Nav;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Module\BaseNotifications;
use Friendica\Navigation\Notifications\ValueObject\FormattedNotification;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Prints all notification types except introduction:
/** @var \Friendica\Navigation\Notifications\Factory\FormattedNotification */
protected $formattedNotificationFactory;
- /** @var BaseURL */
- protected $baseUrl;
-
- public function __construct(BaseURL $baseUrl, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, Arguments $args, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, \Friendica\Navigation\Notifications\Factory\FormattedNotification $formattedNotificationFactory, array $server, array $parameters = [])
{
- parent::__construct($args, $l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->formattedNotificationFactory = $formattedNotificationFactory;
- $this->baseUrl = $baseUrl;
}
/**
];
}
- public function content(): string
+ protected function content(array $request = []): string
{
Nav::setSelected('notifications');
*/
class Acknowledge extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path'));
}
- public function content(): string
+ protected function content(array $request = []): string
{
DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$request = self::getRequest([
'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
self::$oauth_code = $token['code'];
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (empty(self::$oauth_code)) {
return '';
*/
class Revoke extends BaseApi
{
- public function post()
+ public function post(array $request = [], array $post = [])
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration
*/
class Token extends BaseApi
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration
*/
class Oembed extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
// Unused form: /oembed/b2h?url=...
if (DI::args()->getArgv()[1] == 'b2h') {
/**
* @throws \Exception
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
header('Content-type: application/opensearchdescription+xml');
*/
class Owa extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$ret = [ 'success' => false ];
class ParseUrl extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();
*/
class PermissionTooltip extends \Friendica\BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$type = $this->parameters['type'];
$referenceId = $this->parameters['id'];
* Fetch a photo or an avatar, in optional size, check for permissions and
* return the image
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$totalstamp = microtime(true);
class Common extends BaseProfile
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
class Contacts extends Module\BaseProfile
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
*/
class Index extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
- (new Profile($this->l10n, $this->parameters))->rawContent();
+ (new Profile($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->rawContent();
}
- public function content(): string
+ protected function content(array $request = []): string
{
- return (new Status($this->l10n, $this->parameters))->content();
+ return (new Status($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->content();
}
}
class Media extends BaseProfile
{
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
class Profile extends BaseProfile
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
class Schedule extends BaseProfile
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
Post\Delayed::deleteById($_REQUEST['delete']);
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
class Status extends BaseProfile
{
- public function content(): string
+ protected function content(array $request = []): string
{
$args = DI::args();
/**
* Fetch remote image content
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$request = $this->getRequestInfo();
*/
class PublicRSAKey extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (empty($this->parameters['nick'])) {
throw new BadRequestException();
*/
class RandomProfile extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
*/
class ReallySimpleDiscovery extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
header('Content-Type: text/xml');
namespace Friendica\Module;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\DI;
use Friendica\Model;
use Friendica\Model\User;
+use Friendica\Util\Profiler;
use Friendica\Util\Proxy;
+use Psr\Log\LoggerInterface;
/**
* @author Hypolite Petovan <hypolite@mrpetovan.com>
/** @var Tos */
protected $tos;
- public function __construct(Tos $tos, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Tos $tos, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->tos = $tos;
}
*
* @return string
*/
- public function content(): string
+ protected function content(array $request = []): string
{
// logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy.
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
- public function post()
+ protected function post(array $request = [], array $post = [])
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
namespace Friendica\Module;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\App\Page;
use Friendica\BaseModule;
use Friendica\Content\Widget;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Network\Probe;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Remotely follow the account on this system by the provided account
protected $owner;
/** @var Page */
protected $page;
- /** @var BaseURL */
- protected $baseUrl;
- public function __construct(L10n $l10n, Page $page, BaseURL $baseUrl, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, App\Page $page, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->owner = User::getOwnerDataByNick($this->parameters['profile']);
if (!$this->owner) {
throw new HTTPException\NotFoundException($this->t('User not found.'));
}
- $this->baseUrl = $baseUrl;
$this->page = $page;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!empty($_POST['cancel']) || empty($_POST['dfrn_url'])) {
$this->baseUrl->redirect();
System::externalRedirect($follow_link);
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (empty($this->owner)) {
return '';
*/
class RobotsTxt extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$allDisalloweds = [
'/settings/',
const TYPE_PRIVATE_MESSAGE = 'm';
const TYPE_ANY_CONTACT = 'a';
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
*/
class Directory extends BaseSearch
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
class Filed extends BaseSearch
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form();
class Index extends BaseSearch
{
- public function content(): string
+ protected function content(array $request = []): string
{
$search = (!empty($_GET['q']) ? trim(rawurldecode($_GET['q'])) : '');
namespace Friendica\Module\Search;
-use Friendica\App\Arguments;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Search;
use Friendica\Database\Database;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
class Saved extends BaseModule
{
- /** @var Arguments */
- protected $args;
/** @var Database */
protected $dba;
- /** @var BaseURL */
- protected $baseUrl;
- public function __construct(BaseURL $baseUrl, Database $dba, Arguments $args, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Database $dba, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
- $this->baseUrl = $baseUrl;
- $this->dba = $dba;
- $this->args = $args;
+ $this->dba = $dba;
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$action = $this->args->get(2, 'none');
$search = trim(rawurldecode($_GET['term'] ?? ''));
*/
class Login extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$return_path = $_REQUEST['return_path'] ?? '' ;
return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
$return_path = Session::get('return_path');
Session::clear();
namespace Friendica\Module\Security;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Cache\Capability\ICanCache;
use Friendica\Core\Hook;
use Friendica\Model\Profile;
use Friendica\Model\User\Cookie;
use Friendica\Security\TwoFactor;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* Logout module
protected $cookie;
/** @var IHandleSessions */
protected $session;
- /** @var BaseURL */
- protected $baseUrl;
/** @var TwoFactor\Repository\TrustedBrowser */
protected $trustedBrowserRepo;
- public function __construct(TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, ICanCache $cache, Cookie $cookie, IHandleSessions $session, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->cache = $cache;
$this->cookie = $cookie;
$this->session = $session;
- $this->baseUrl = $baseUrl;
$this->trustedBrowserRepo = $trustedBrowserRepo;
}
/**
* Process logout requests
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$visitor_home = null;
if (remote_user()) {
*/
class OpenID extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
if (DI::config()->get('system', 'no_openid')) {
DI::baseUrl()->redirect();
use Friendica\Model\User;
use Friendica\Security\Authentication;
use Friendica\Security\TwoFactor\Model\RecoveryCode;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* // Page 1a: Recovery code verification
protected $session;
/** @var App */
protected $app;
- /** @var App\BaseURL */
- protected $baseUrl;
/** @var Authentication */
protected $auth;
- public function __construct(App $app, App\BaseURL $baseUrl, Authentication $auth, IHandleSessions $session, L10n $l10n, array $parameters = [])
+ public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Authentication $auth, IHandleSessions $session, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->app = $app;
- $this->baseUrl = $baseUrl;
$this->auth = $auth;
$this->session = $session;
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
$this->baseUrl->redirect();
{
private static $errors = [];
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
DI::baseUrl()->redirect();
*/
class Delegation extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
*/
class Display extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('settings/display');
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
class Index extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
DI::baseUrl()->redirect('settings/profile');
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
class Crop extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!Session::isAuthenticated()) {
return;
DI::baseUrl()->redirect($path);
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
class Index extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!Session::isAuthenticated()) {
return;
DI::baseUrl()->redirect('settings/profile/photo/crop/' . $resource_id);
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
namespace Friendica\Module\Settings\TwoFactor;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
use Friendica\Module\BaseSettings;
use Friendica\Module\Security\Login;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* // Page 5: 2FA enabled, app-specific password generation
/** @var IManagePersonalConfigValues */
protected $pConfig;
- /** @var BaseURL */
- protected $baseUrl;
-
- public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->pConfig = $pConfig;
- $this->baseUrl = $baseUrl;
if (!local_user()) {
return;
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form('settings/2fa/app_specific');
class Index extends BaseSettings
{
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form('settings/2fa');
namespace Friendica\Module\Settings\TwoFactor;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Security\TwoFactor\Model\RecoveryCode;
use Friendica\Module\BaseSettings;
use Friendica\Module\Security\Login;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
/**
* // Page 3: 2FA enabled but not verified, show recovery codes
{
/** @var IManagePersonalConfigValues */
protected $pConfig;
- /** @var BaseURL */
- protected $baseUrl;
- public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->pConfig = $pConfig;
- $this->baseUrl = $baseUrl;
if (!local_user()) {
return;
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form('settings/2fa/recovery');
namespace Friendica\Module\Settings\TwoFactor;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Module\BaseSettings;
use Friendica\Security\TwoFactor;
use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Profiler;
use Friendica\Util\Temporal;
+use Psr\Log\LoggerInterface;
use UAParser\Parser;
/**
{
/** @var IManagePersonalConfigValues */
protected $pConfig;
- /** @var BaseURL */
- protected $baseUrl;
/** @var TwoFactor\Repository\TrustedBrowser */
protected $trustedBrowserRepo;
- public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->pConfig = $pConfig;
- $this->baseUrl = $baseUrl;
$this->trustedBrowserRepo = $trustedBrowserRepo;
if (!local_user()) {
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
- public function content(): string
+ protected function content(array $request = []): string
{
parent::content();
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Module\BaseSettings;
use Friendica\Module\Security\Login;
+use Friendica\Util\Profiler;
use PragmaRX\Google2FA\Google2FA;
+use Psr\Log\LoggerInterface;
/**
* // Page 4: 2FA enabled but not verified, QR code and verification
{
/** @var IManagePersonalConfigValues */
protected $pConfig;
- /** @var BaseURL */
- protected $baseUrl;
- public function __construct(IManagePersonalConfigValues $pConfig, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManagePersonalConfigValues $pConfig, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->pConfig = $pConfig;
- $this->baseUrl = $baseUrl;
if (!local_user()) {
return;
}
}
- public function post()
+ protected function post(array $request = [], array $post = [])
{
if (!local_user()) {
return;
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
return Login::form('settings/2fa/verify');
* @throws HTTPException\ForbiddenException
* @throws HTTPException\InternalServerErrorException
*/
- public function content(): string
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*
* @throws HTTPException\ForbiddenException
*/
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Smilies extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!empty(DI::args()->getArgv()[1]) && (DI::args()->getArgv()[1] === "json")) {
$smilies = Content\Smilies::getList();
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$smilies = Content\Smilies::getList();
$count = count($smilies['texts'] ?? []);
namespace Friendica\Module;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Network\HTTPException\NotFoundException;
+use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
class Statistics extends BaseModule
{
/** @var IManageConfigValues */
protected $config;
- /** @var LoggerInterface */
- protected $logger;
- public function __construct(IManageConfigValues $config, LoggerInterface $logger, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
- $this->logger = $logger;
$this->config = $config;
if (!$this->config->get("system", "nodeinfo")) {
}
}
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$registration_open =
intval($this->config->get('config', 'register_policy')) !== Register::CLOSED
*/
class Theme extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
header('Content-Type: text/css');
*/
class ThemeDetails extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!empty($_REQUEST['theme'])) {
$theme = $_REQUEST['theme'];
*/
class ToggleMobile extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$a = DI::app();
namespace Friendica\Module;
-use Friendica\App\BaseURL;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Content\Text\BBCode;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
class Tos extends BaseModule
{
/** @var IManageConfigValues */
protected $config;
- /** @var BaseURL */
- protected $baseUrl;
/**
* constructor for the module, initializing the text variables
* be properties of the class, however cannot be set directly as the property
* cannot depend on a function result when declaring the variable.
**/
- public function __construct(IManageConfigValues $config, BaseURL $baseUrl, L10n $l10n, array $parameters = [])
+ public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, IManageConfigValues $config, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
$this->config = $config;
- $this->baseUrl = $baseUrl;
$this->privacy_operate = $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
$this->privacy_distribute = $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function content(): string
+ protected function content(array $request = []): string
{
if (strlen($this->config->get('system', 'singleuser'))) {
$this->baseUrl->redirect('profile/' . $this->config->get('system', 'singleuser'));
*/
class Community extends CommunityModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$this->parseRequest();
class Network extends NetworkModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
if (!isset($_GET['p']) || !isset($_GET['item'])) {
exit();
class Profile extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$a = DI::app();
);
if (!DBA::isResult($items_stmt)) {
- return '';
+ return;
}
// Set a time stamp for this page. We will make use of it when we
*/
class Welcome extends BaseModule
{
- public function content(): string
+ protected function content(array $request = []): string
{
$config = DI::config();
*/
class HostMeta extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
*/
class NodeInfo extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
self::printWellKnown();
}
*/
class SecurityTxt extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$name = 'security.txt';
$fp = fopen($name, 'rt');
*/
class XSocialRelay extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
$config = DI::config();
*/
class Xrd extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
// @TODO: Replace with parameter from router
if (DI::args()->getArgv()[0] == 'xrd') {