Make `BaseModule` a real entity

- Add all dependencies, necessary to run the content (baseUrl, Arguments)
- Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule
- Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
This commit is contained in:
Philipp Holzer 2021-11-20 15:38:03 +01:00
parent 238613fd01
commit 8bdd90066f
Signed by: nupplaPhil
GPG Key ID: 24A7501396EB5432
252 changed files with 615 additions and 623 deletions

View File

@ -116,11 +116,6 @@ class App
*/
private $args;
/**
* @var Core\System The system methods
*/
private $system;
/**
* @var IManagePersonalConfigValues
*/
@ -326,10 +321,9 @@ class App
* @param Profiler $profiler The profiler of this application
* @param L10n $l10n The translator instance
* @param App\Arguments $args The Friendica Arguments of the call
* @param Core\System $system The system methods
* @param IManagePersonalConfigValues $pConfig Personal configuration
*/
public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\System $system, IManagePersonalConfigValues $pConfig)
public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig)
{
$this->database = $database;
$this->config = $config;
@ -339,7 +333,6 @@ class App
$this->logger = $logger;
$this->l10n = $l10n;
$this->args = $args;
$this->system = $system;
$this->pConfig = $pConfig;
$this->load();
@ -608,7 +601,7 @@ class App
// Only continue when the given profile link seems valid
// Valid profile links contain a path with "/profile/" and no query parameters
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") &&
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
Core\Session::set('my_url', $_GET['zrl']);
Core\Session::set('authenticated', 0);
@ -700,7 +693,7 @@ class App
$page['page_title'] = $moduleName;
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
$module = new Maintenance($this->l10n);
$module = $router->getModule(Maintenance::class);
} else {
// determine the module class and save it to the module instance
// @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
@ -708,12 +701,11 @@ class App
}
// Let the module run it's internal process (init, get, post, ...)
$module->run($this->baseURL, $this->args, $this->logger, $this->profiler, $_SERVER, $_POST);
$content = $module->run($_POST, $_REQUEST);
$page->run($this, $this->baseURL, $this->args, $this->mode, $content, $this->l10n, $this->profiler, $this->config, $pconfig);
} catch (HTTPException $e) {
(new ModuleHTTPException())->rawContent($e);
}
$page->run($this, $this->baseURL, $this->args, $this->mode, $module, $this->l10n, $this->profiler, $this->config, $pconfig);
}
/**

View File

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

View File

@ -39,6 +39,7 @@ use Friendica\Module\HTTPException\MethodNotAllowed;
use Friendica\Module\HTTPException\PageNotFound;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\MethodNotAllowedException;
use Friendica\Network\HTTPException\NoContentException;
use Friendica\Network\HTTPException\NotFoundException;
/**
@ -103,6 +104,9 @@ class Router
/** @var string */
private $baseRoutesFilepath;
/** @var array */
private $server;
/**
* @param array $server The $_SERVER variable
* @param string $baseRoutesFilepath The path to a base routes file to leverage cache, can be empty
@ -123,8 +127,17 @@ class Router
$this->args = $args;
$this->config = $config;
$this->dice = $dice;
$this->server = $server;
$httpMethod = $this->server['REQUEST_METHOD'] ?? self::GET;
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
// @todo Check allowed methods per requested path
if ($httpMethod === static::OPTIONS) {
header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
throw new NoContentException();
}
$httpMethod = $server['REQUEST_METHOD'] ?? self::GET;
$this->httpMethod = in_array($httpMethod, self::ALLOWED_METHODS) ? $httpMethod : self::GET;
$this->routeCollector = isset($routeCollector) ?
@ -268,10 +281,9 @@ class Router
return $moduleClass;
}
public function getModule(): ICanHandleRequests
public function getModule(?string $module_class = null): ICanHandleRequests
{
$module_class = null;
$module_parameters = [];
$module_parameters = [$this->server];
/**
* ROUTING
*
@ -279,7 +291,7 @@ class Router
* post() and/or content() static methods can be respectively called to produce a data change or an output.
**/
try {
$module_class = $this->getModuleClass();
$module_class = $module_class ?? $this->getModuleClass();
$module_parameters[] = $this->parameters;
} catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class;

View File

@ -23,11 +23,12 @@ namespace Friendica;
use Friendica\App\Router;
use Friendica\Capabilities\ICanHandleRequests;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Model\User;
use Friendica\Module\HTTPException\PageNotFound;
use Friendica\Network\HTTPException\NoContentException;
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
@ -44,14 +45,28 @@ abstract class BaseModule implements ICanHandleRequests
{
/** @var array */
protected $parameters = [];
/** @var L10n */
protected $l10n;
/** @var App\BaseURL */
protected $baseUrl;
/** @var App\Arguments */
protected $args;
/** @var LoggerInterface */
protected $logger;
/** @var Profiler */
protected $profiler;
/** @var array */
protected $server;
public function __construct(L10n $l10n, array $parameters = [])
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $parameters = [])
{
$this->parameters = $parameters;
$this->l10n = $l10n;
$this->baseUrl = $baseUrl;
$this->args = $args;
$this->logger = $logger;
$this->profiler = $profiler;
$this->server = $server;
}
/**
@ -75,48 +90,75 @@ abstract class BaseModule implements ICanHandleRequests
}
/**
* {@inheritDoc}
* Module GET method to display raw content from technical endpoints
*
* Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations.
*
* @param string[] $request The $_REQUEST content
*/
public function rawContent()
protected function rawContent(array $request = [])
{
// echo '';
// exit;
}
/**
* {@inheritDoc}
* Module GET method to display any content
*
* Extend this method if the module is supposed to return any display
* through a GET request. It can be an HTML page through templating or a
* XML feed or a JSON output.
*
* @param string[] $request The $_REQUEST content
*/
public function content(): string
protected function content(array $request = []): string
{
return '';
}
/**
* {@inheritDoc}
* Module DELETE method to process submitted data
*
* Extend this method if the module is supposed to process DELETE requests.
* Doesn't display any content
*/
public function delete()
protected function delete()
{
}
/**
* {@inheritDoc}
* Module PATCH method to process submitted data
*
* Extend this method if the module is supposed to process PATCH requests.
* Doesn't display any content
*/
public function patch()
protected function patch()
{
}
/**
* {@inheritDoc}
* Module POST method to process submitted data
*
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*
* @param string[] $request The $_REQUEST content
* @param string[] $post The $_POST content
*
*/
public function post()
protected function post(array $request = [], array $post = [])
{
// DI::baseurl()->redirect('module');
// $this->baseUrl->redirect('module');
}
/**
* {@inheritDoc}
* Module PUT method to process submitted data
*
* Extend this method if the module is supposed to process PUT requests.
* Doesn't display any content
*/
public function put()
protected function put()
{
}
@ -126,92 +168,73 @@ abstract class BaseModule implements ICanHandleRequests
return static::class;
}
public function run(App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, array $server, array $post)
/**
* {@inheritDoc}
*/
public function run(array $post = [], array $request = []): string
{
/* The URL provided does not resolve to a valid module.
*
* On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'.
* We don't like doing this, but as it occasionally accounts for 10-20% or more of all site traffic -
* we are going to trap this and redirect back to the requested page. As long as you don't have a critical error on your page
* this will often succeed and eventually do the right thing.
*
* Otherwise we are going to emit a 404 not found.
*/
if (static::class === PageNotFound::class) {
$queryString = $server['QUERY_STRING'];
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
if (!empty($queryString) && preg_match('/{[0-9]}/', $queryString) !== 0) {
exit();
}
if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
$logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $server['REQUEST_URI']]);
$baseUrl->redirect($server['REQUEST_URI']);
}
$logger->debug('index.php: page not found.', ['request_uri' => $server['REQUEST_URI'], 'address' => $server['REMOTE_ADDR'], 'query' => $server['QUERY_STRING']]);
}
// @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
if (substr($_REQUEST['pagename'] ?? '', 0, 12) == '.well-known/') {
if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false');
} elseif (substr($_REQUEST['pagename'] ?? '', 0, 8) == 'profile/') {
} elseif (substr($request['pagename'] ?? '', 0, 8) == 'profile/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::GET);
header('Access-Control-Allow-Credentials: false');
} elseif (substr($_REQUEST['pagename'] ?? '', 0, 4) == 'api/') {
} elseif (substr($request['pagename'] ?? '', 0, 4) == 'api/') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS));
header('Access-Control-Allow-Credentials: false');
header('Access-Control-Expose-Headers: Link');
} elseif (substr($_REQUEST['pagename'] ?? '', 0, 11) == 'oauth/token') {
} elseif (substr($request['pagename'] ?? '', 0, 11) == 'oauth/token') {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Methods: ' . Router::POST);
header('Access-Control-Allow-Credentials: false');
}
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
// @todo Check allowed methods per requested path
if ($server['REQUEST_METHOD'] === Router::OPTIONS) {
header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
throw new NoContentException();
}
$placeholder = '';
$profiler->set(microtime(true), 'ready');
$this->profiler->set(microtime(true), 'ready');
$timestamp = microtime(true);
Core\Hook::callAll($args->getModuleName() . '_mod_init', $placeholder);
Core\Hook::callAll($this->args->getModuleName() . '_mod_init', $placeholder);
$profiler->set(microtime(true) - $timestamp, 'init');
$this->profiler->set(microtime(true) - $timestamp, 'init');
if ($server['REQUEST_METHOD'] === Router::DELETE) {
if ($this->server['REQUEST_METHOD'] === Router::DELETE) {
$this->delete();
}
if ($server['REQUEST_METHOD'] === Router::PATCH) {
if ($this->server['REQUEST_METHOD'] === Router::PATCH) {
$this->patch();
}
if ($server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($args->getModuleName() . '_mod_post', $post);
$this->post();
if ($this->server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($this->args->getModuleName() . '_mod_post', $post);
$this->post($request, $post);
}
if ($server['REQUEST_METHOD'] === Router::PUT) {
if ($this->server['REQUEST_METHOD'] === Router::PUT) {
$this->put();
}
// "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff.
$this->rawContent();
$this->rawContent($request);
try {
$arr = ['content' => ''];
Hook::callAll(static::class . '_mod_content', $arr);
$content = $arr['content'];
return $content . $this->content($_REQUEST);
} catch (HTTPException $e) {
return (new ModuleHTTPException())->content($e);
}
}
/*

View File

@ -2,59 +2,20 @@
namespace Friendica\Capabilities;
use Friendica\Network\HTTPException;
/**
* This interface provides the capability to handle requests from clients and returns the desired outcome
*/
interface ICanHandleRequests
{
/**
* Module GET method to display raw content from technical endpoints
* @param array $post The $_POST content (in case of POST)
* @param array $request The $_REQUEST content (in case of GET, POST)
*
* Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations.
*/
public function rawContent();
/**
* Module GET method to display any content
* @return string Returns the content of the module as string
*
* Extend this method if the module is supposed to return any display
* through a GET request. It can be an HTML page through templating or a
* XML feed or a JSON output.
* @throws HTTPException\InternalServerErrorException
*/
public function content(): string;
/**
* Module DELETE method to process submitted data
*
* Extend this method if the module is supposed to process DELETE requests.
* Doesn't display any content
*/
public function delete();
/**
* Module PATCH method to process submitted data
*
* Extend this method if the module is supposed to process PATCH requests.
* Doesn't display any content
*/
public function patch();
/**
* Module POST method to process submitted data
*
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
public function post();
/**
* Module PUT method to process submitted data
*
* Extend this method if the module is supposed to process PUT requests.
* Doesn't display any content
*/
public function put();
public function getClassName(): string;
public function run(array $post = [], array $request = []): string;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ class CustomEmojis extends BaseApi
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows
*/
public function rawContent()
protected function rawContent(array $request = [])
{
$emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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