1
0
Fork 0

Replace $parameters argument per method with static::$parameters

This commit is contained in:
Philipp Holzer 2021-11-14 20:46:25 +01:00
commit 714f0febc4
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
249 changed files with 710 additions and 775 deletions

View file

@ -297,32 +297,32 @@ class Module
Core\Hook::callAll($this->module . '_mod_init', $placeholder); Core\Hook::callAll($this->module . '_mod_init', $placeholder);
$this->module_class::init($this->module_class::getParameters()); $this->module_class::init();
$profiler->set(microtime(true) - $timestamp, 'init'); $profiler->set(microtime(true) - $timestamp, 'init');
if ($server['REQUEST_METHOD'] === Router::DELETE) { if ($server['REQUEST_METHOD'] === Router::DELETE) {
$this->module_class::delete($this->module_class::getParameters()); $this->module_class::delete();
} }
if ($server['REQUEST_METHOD'] === Router::PATCH) { if ($server['REQUEST_METHOD'] === Router::PATCH) {
$this->module_class::patch($this->module_class::getParameters()); $this->module_class::patch();
} }
if ($server['REQUEST_METHOD'] === Router::POST) { if ($server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($this->module . '_mod_post', $post); Core\Hook::callAll($this->module . '_mod_post', $post);
$this->module_class::post($this->module_class::getParameters()); $this->module_class::post();
} }
if ($server['REQUEST_METHOD'] === Router::PUT) { if ($server['REQUEST_METHOD'] === Router::PUT) {
$this->module_class::put($this->module_class::getParameters()); $this->module_class::put();
} }
Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder); Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder);
$this->module_class::afterpost($this->module_class::getParameters()); $this->module_class::afterpost();
// "rawContent" is especially meant for technical endpoints. // "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff. // This endpoint doesn't need any theme initialization or other comparable stuff.
$this->module_class::rawContent($this->module_class::getParameters()); $this->module_class::rawContent();
} }
} }

View file

@ -352,7 +352,7 @@ class Page implements ArrayAccess
$arr = ['content' => $content]; $arr = ['content' => $content];
Hook::callAll( $moduleClass::getClassName() . '_mod_content', $arr); Hook::callAll( $moduleClass::getClassName() . '_mod_content', $arr);
$content = $arr['content']; $content = $arr['content'];
$arr = ['content' => $moduleClass::content($moduleClass::getParameters())]; $arr = ['content' => $moduleClass::content()];
Hook::callAll($moduleClass::getClassName() . '_mod_aftercontent', $arr); Hook::callAll($moduleClass::getClassName() . '_mod_aftercontent', $arr);
$content .= $arr['content']; $content .= $arr['content'];
} catch (HTTPException $e) { } catch (HTTPException $e) {

View file

@ -44,25 +44,17 @@ abstract class BaseModule implements ICanHandleRequests
static::$parameters = $parameters; static::$parameters = $parameters;
} }
/**
* @return array
*/
public static function getParameters(): array
{
return self::$parameters;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function init(array $parameters = []) public static function init()
{ {
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// echo ''; // echo '';
// exit; // exit;
@ -71,7 +63,7 @@ abstract class BaseModule implements ICanHandleRequests
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function content(array $parameters = []) public static function content()
{ {
return ''; return '';
} }
@ -79,21 +71,21 @@ abstract class BaseModule implements ICanHandleRequests
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function delete(array $parameters = []) public static function delete()
{ {
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function patch(array $parameters = []) public static function patch()
{ {
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function post(array $parameters = []) public static function post()
{ {
// DI::baseurl()->redirect('module'); // DI::baseurl()->redirect('module');
} }
@ -101,14 +93,14 @@ abstract class BaseModule implements ICanHandleRequests
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function afterpost(array $parameters = []) public static function afterpost()
{ {
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public static function put(array $parameters = []) public static function put()
{ {
} }

View file

@ -13,7 +13,7 @@ interface ICanHandleRequests
* Extend this method if you need to do any shared processing before both * Extend this method if you need to do any shared processing before both
* content() or post() * content() or post()
*/ */
public static function init(array $parameters = []); public static function init();
/** /**
* Module GET method to display raw content from technical endpoints * Module GET method to display raw content from technical endpoints
@ -21,7 +21,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to return communication data, * Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations. * e.g. from protocol implementations.
*/ */
public static function rawContent(array $parameters = []); public static function rawContent();
/** /**
* Module GET method to display any content * Module GET method to display any content
@ -32,7 +32,7 @@ interface ICanHandleRequests
* *
* @return string * @return string
*/ */
public static function content(array $parameters = []); public static function content();
/** /**
* Module DELETE method to process submitted data * Module DELETE method to process submitted data
@ -40,7 +40,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process DELETE requests. * Extend this method if the module is supposed to process DELETE requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function delete(array $parameters = []); public static function delete();
/** /**
* Module PATCH method to process submitted data * Module PATCH method to process submitted data
@ -48,7 +48,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process PATCH requests. * Extend this method if the module is supposed to process PATCH requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function patch(array $parameters = []); public static function patch();
/** /**
* Module POST method to process submitted data * Module POST method to process submitted data
@ -56,14 +56,14 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process POST requests. * Extend this method if the module is supposed to process POST requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function post(array $parameters = []); public static function post();
/** /**
* Called after post() * Called after post()
* *
* Unknown purpose * Unknown purpose
*/ */
public static function afterpost(array $parameters = []); public static function afterpost();
/** /**
* Module PUT method to process submitted data * Module PUT method to process submitted data
@ -71,9 +71,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process PUT requests. * Extend this method if the module is supposed to process PUT requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function put(array $parameters = []); public static function put();
public static function getClassName(): string; public static function getClassName(): string;
public static function getParameters(): array;
} }

View file

@ -54,24 +54,24 @@ class LegacyModule extends BaseModule
require_once $file_path; require_once $file_path;
} }
public static function init(array $parameters = []) public static function init()
{ {
self::runModuleFunction('init', $parameters); self::runModuleFunction('init', static::$parameters);
} }
public static function content(array $parameters = []) public static function content()
{ {
return self::runModuleFunction('content', $parameters); return self::runModuleFunction('content', static::$parameters);
} }
public static function post(array $parameters = []) public static function post()
{ {
self::runModuleFunction('post', $parameters); self::runModuleFunction('post', static::$parameters);
} }
public static function afterpost(array $parameters = []) public static function afterpost()
{ {
self::runModuleFunction('afterpost', $parameters); self::runModuleFunction('afterpost', static::$parameters);
} }
/** /**

View file

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

View file

@ -30,7 +30,7 @@ use Friendica\Model\Contact;
*/ */
class Acctlink extends BaseModule class Acctlink extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
$addr = trim($_GET['addr'] ?? ''); $addr = trim($_GET['addr'] ?? '');

View file

@ -31,14 +31,14 @@ use Friendica\Protocol\ActivityPub;
*/ */
class Followers extends BaseModule class Followers extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (empty($parameters['nickname'])) { if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router
$owner = User::getOwnerDataByNick($parameters['nickname']); $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) { if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View file

@ -31,13 +31,13 @@ use Friendica\Protocol\ActivityPub;
*/ */
class Following extends BaseModule class Following extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (empty($parameters['nickname'])) { if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
$owner = User::getOwnerDataByNick($parameters['nickname']); $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) { if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View file

@ -35,7 +35,7 @@ use Friendica\Util\Network;
*/ */
class Inbox extends BaseModule class Inbox extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$postdata = Network::postdata(); $postdata = Network::postdata();
@ -50,12 +50,12 @@ class Inbox extends BaseModule
$filename = 'failed-activitypub'; $filename = 'failed-activitypub';
} }
$tempfile = tempnam(System::getTempPath(), $filename); $tempfile = tempnam(System::getTempPath(), $filename);
file_put_contents($tempfile, json_encode(['parameters' => $parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); file_put_contents($tempfile, json_encode(['parameters' => static::$parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
Logger::notice('Incoming message stored', ['file' => $tempfile]); Logger::notice('Incoming message stored', ['file' => $tempfile]);
} }
if (!empty($parameters['nickname'])) { if (!empty(static::$parameters['nickname'])) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View file

@ -41,9 +41,9 @@ use Friendica\Util\Strings;
*/ */
class Objects extends BaseModule class Objects extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (empty($parameters['guid'])) { if (empty(static::$parameters['guid'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
@ -51,10 +51,10 @@ class Objects extends BaseModule
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString())); DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
} }
$itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $parameters['guid']]); $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => static::$parameters['guid']]);
if (DBA::isResult($itemuri)) { if (DBA::isResult($itemuri)) {
Logger::info('Provided GUID found.', ['guid' => $parameters['guid'], 'uri-id' => $itemuri['id']]); Logger::info('Provided GUID found.', ['guid' => static::$parameters['guid'], 'uri-id' => $itemuri['id']]);
} else { } else {
// The item URI does not always contain the GUID. This means that we have to search the URL instead // The item URI does not always contain the GUID. This means that we have to search the URL instead
$url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString(); $url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString();
@ -104,11 +104,11 @@ class Objects extends BaseModule
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
} }
$etag = md5($parameters['guid'] . '-' . $item['changed']); $etag = md5(static::$parameters['guid'] . '-' . $item['changed']);
$last_modified = $item['changed']; $last_modified = $item['changed'];
Network::checkEtagModified($etag, $last_modified); Network::checkEtagModified($etag, $last_modified);
if (empty($parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) { if (empty(static::$parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
$activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true); $activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true);
if (empty($activity['type'])) { if (empty($activity['type'])) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
@ -123,16 +123,16 @@ class Objects extends BaseModule
$data = ['@context' => ActivityPub::CONTEXT]; $data = ['@context' => ActivityPub::CONTEXT];
$data = array_merge($data, $activity['object']); $data = array_merge($data, $activity['object']);
} elseif (empty($parameters['activity']) || in_array($parameters['activity'], } elseif (empty(static::$parameters['activity']) || in_array(static::$parameters['activity'],
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject', ['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
'TentativeAccept', 'Follow', 'Add'])) { 'TentativeAccept', 'Follow', 'Add'])) {
$data = ActivityPub\Transmitter::createActivityFromItem($item['id']); $data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
if (empty($data)) { if (empty($data)) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
} }
if (!empty($parameters['activity']) && ($parameters['activity'] != 'Create')) { if (!empty(static::$parameters['activity']) && (static::$parameters['activity'] != 'Create')) {
$data['type'] = $parameters['activity']; $data['type'] = static::$parameters['activity'];
$data['id'] = str_replace('/Create', '/' . $parameters['activity'], $data['id']); $data['id'] = str_replace('/Create', '/' . static::$parameters['activity'], $data['id']);
} }
} else { } else {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();

View file

@ -31,13 +31,13 @@ use Friendica\Util\HTTPSignature;
*/ */
class Outbox extends BaseModule class Outbox extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (empty($parameters['nickname'])) { if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
$owner = User::getOwnerDataByNick($parameters['nickname']); $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) { if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View file

@ -30,11 +30,11 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin class Details extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
$addon = Strings::sanitizeFilePathItem($parameters['addon']); $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
$redirect = 'admin/addons/' . $addon; $redirect = 'admin/addons/' . $addon;
@ -52,15 +52,15 @@ class Details extends BaseAdmin
DI::baseUrl()->redirect($redirect); DI::baseUrl()->redirect($redirect);
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$a = DI::app(); $a = DI::app();
$addons_admin = Addon::getAdminList(); $addons_admin = Addon::getAdminList();
$addon = Strings::sanitizeFilePathItem($parameters['addon']); $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) { if (!is_file("addon/$addon/$addon.php")) {
notice(DI::l10n()->t('Addon not found.')); notice(DI::l10n()->t('Addon not found.'));
Addon::uninstall($addon); Addon::uninstall($addon);

View file

@ -28,9 +28,9 @@ use Friendica\Module\BaseAdmin;
class Index extends BaseAdmin class Index extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
// reload active themes // reload active themes
if (!empty($_GET['action'])) { if (!empty($_GET['action'])) {

View file

@ -32,7 +32,7 @@ use Friendica\Util\Network;
class Contact extends BaseAdmin class Contact extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -76,9 +76,9 @@ class Contact extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/contact'); DI::baseUrl()->redirect('admin/blocklist/contact');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$condition = ['uid' => 0, 'blocked' => true]; $condition = ['uid' => 0, 'blocked' => true];

View file

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

View file

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

View file

@ -30,14 +30,14 @@ use Friendica\Module\BaseAdmin;
class DBSync extends BaseAdmin class DBSync extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$a = DI::app(); $a = DI::app();
$action = $parameters['action'] ?? ''; $action = static::$parameters['action'] ?? '';
$update = $parameters['update'] ?? 0; $update = static::$parameters['update'] ?? 0;
switch ($action) { switch ($action) {
case 'mark': case 'mark':

View file

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

View file

@ -28,9 +28,9 @@ use Friendica\Module\BaseAdmin;
class Federation extends BaseAdmin class Federation extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
// get counts on active federation systems this node is knowing // get counts on active federation systems this node is knowing
// We list the more common systems by name. The rest is counted as "other" // We list the more common systems by name. The rest is counted as "other"

View file

@ -29,7 +29,7 @@ use Friendica\Util\Strings;
class Delete extends BaseAdmin class Delete extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -55,9 +55,9 @@ class Delete extends BaseAdmin
DI::baseUrl()->redirect('admin/item/delete'); DI::baseUrl()->redirect('admin/item/delete');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$t = Renderer::getMarkupTemplate('admin/item/delete.tpl'); $t = Renderer::getMarkupTemplate('admin/item/delete.tpl');

View file

@ -29,11 +29,11 @@ use Friendica\Module\BaseAdmin;
class Source extends BaseAdmin class Source extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$guid = basename($_REQUEST['guid'] ?? $parameters['guid'] ?? ''); $guid = basename($_REQUEST['guid'] ?? static::$parameters['guid'] ?? '');
$source = ''; $source = '';
$item_uri = ''; $item_uri = '';

View file

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

View file

@ -31,9 +31,9 @@ class View extends BaseAdmin
{ {
const LIMIT = 500; const LIMIT = 500;
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$t = Renderer::getMarkupTemplate('admin/logs/view.tpl'); $t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
DI::page()->registerFooterScript(Theme::getPathForFile('js/module/admin/logs/view.js')); DI::page()->registerFooterScript(Theme::getPathForFile('js/module/admin/logs/view.js'));
@ -75,7 +75,7 @@ class View extends BaseAdmin
->withLimit(self::LIMIT) ->withLimit(self::LIMIT)
->withFilters($filters) ->withFilters($filters)
->withSearch($search); ->withSearch($search);
} catch (Exception $e) { } catch (\Exception $e) {
$error = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.<br/>Check to see if file %1$s is readable.', $f); $error = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.<br/>Check to see if file %1$s is readable.', $f);
} }
} }

View file

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

View file

@ -38,11 +38,11 @@ use Friendica\Util\DateTimeFormat;
*/ */
class Queue extends BaseAdmin class Queue extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$status = $parameters['status'] ?? ''; $status = static::$parameters['status'] ?? '';
// get jobs from the workerqueue table // get jobs from the workerqueue table
if ($status == 'deferred') { if ($status == 'deferred') {

View file

@ -43,7 +43,7 @@ require_once __DIR__ . '/../../../boot.php';
class Site extends BaseAdmin class Site extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -384,9 +384,9 @@ class Site extends BaseAdmin
DI::baseUrl()->redirect('admin/site' . $active_panel); DI::baseUrl()->redirect('admin/site' . $active_panel);
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
/* Installed langs */ /* Installed langs */
$lang_choices = DI::l10n()->getAvailableLanguages(); $lang_choices = DI::l10n()->getAvailableLanguages();

View file

@ -31,13 +31,13 @@ use Friendica\Util\Strings;
class Storage extends BaseAdmin class Storage extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage'); self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage');
$storagebackend = trim($parameters['name'] ?? ''); $storagebackend = trim(static::$parameters['name'] ?? '');
try { try {
/** @var ICanConfigureStorage|false $newStorageConfig */ /** @var ICanConfigureStorage|false $newStorageConfig */
@ -91,9 +91,9 @@ class Storage extends BaseAdmin
DI::baseUrl()->redirect('admin/storage'); DI::baseUrl()->redirect('admin/storage');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$current_storage_backend = DI::storage(); $current_storage_backend = DI::storage();
$available_storage_forms = []; $available_storage_forms = [];

View file

@ -37,9 +37,9 @@ use Friendica\Util\DateTimeFormat;
class Summary extends BaseAdmin class Summary extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$a = DI::app(); $a = DI::app();

View file

@ -30,11 +30,11 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin class Details extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$theme = Strings::sanitizeFilePathItem($parameters['theme']); $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (!is_dir("view/theme/$theme")) { if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t("Item not found.")); notice(DI::l10n()->t("Item not found."));
return ''; return '';

View file

@ -28,19 +28,19 @@ use Friendica\Util\Strings;
class Embed extends BaseAdmin class Embed extends BaseAdmin
{ {
public static function init(array $parameters = []) public static function init()
{ {
$theme = Strings::sanitizeFilePathItem($parameters['theme']); $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (is_file("view/theme/$theme/config.php")) { if (is_file("view/theme/$theme/config.php")) {
DI::app()->setCurrentTheme($theme); DI::app()->setCurrentTheme($theme);
} }
} }
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
$theme = Strings::sanitizeFilePathItem($parameters['theme']); $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (is_file("view/theme/$theme/config.php")) { if (is_file("view/theme/$theme/config.php")) {
require_once "view/theme/$theme/config.php"; require_once "view/theme/$theme/config.php";
if (function_exists('theme_admin_post')) { if (function_exists('theme_admin_post')) {
@ -56,11 +56,11 @@ class Embed extends BaseAdmin
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal'); DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$theme = Strings::sanitizeFilePathItem($parameters['theme']); $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (!is_dir("view/theme/$theme")) { if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t('Unknown theme.')); notice(DI::l10n()->t('Unknown theme.'));
return ''; return '';

View file

@ -29,9 +29,9 @@ use Friendica\Util\Strings;
class Index extends BaseAdmin class Index extends BaseAdmin
{ {
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$allowed_themes = Theme::getAllowedList(); $allowed_themes = Theme::getAllowedList();

View file

@ -27,7 +27,7 @@ use Friendica\Module\BaseAdmin;
class Tos extends BaseAdmin class Tos extends BaseAdmin
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -48,11 +48,11 @@ class Tos extends BaseAdmin
DI::baseUrl()->redirect('admin/tos'); DI::baseUrl()->redirect('admin/tos');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$tos = new \Friendica\Module\Tos(); $tos = new \Friendica\Module\Tos(static::$parameters);
$t = Renderer::getMarkupTemplate('admin/tos.tpl'); $t = Renderer::getMarkupTemplate('admin/tos.tpl');
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'), '$title' => DI::l10n()->t('Administration'),

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Active extends BaseUsers class Active extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -60,12 +60,12 @@ class Active extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString()); DI::baseUrl()->redirect(DI::args()->getQueryString());
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$action = $parameters['action'] ?? ''; $action = static::$parameters['action'] ?? '';
$uid = $parameters['uid'] ?? 0; $uid = static::$parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View file

@ -31,7 +31,7 @@ use Friendica\Util\Temporal;
class Blocked extends BaseUsers class Blocked extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -61,12 +61,12 @@ class Blocked extends BaseUsers
DI::baseUrl()->redirect('admin/users/blocked'); DI::baseUrl()->redirect('admin/users/blocked');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$action = $parameters['action'] ?? ''; $action = static::$parameters['action'] ?? '';
$uid = $parameters['uid'] ?? 0; $uid = static::$parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View file

@ -28,7 +28,7 @@ use Friendica\Module\Admin\BaseUsers;
class Create extends BaseUsers class Create extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -51,9 +51,9 @@ class Create extends BaseUsers
DI::baseUrl()->redirect('admin/users/create'); DI::baseUrl()->redirect('admin/users/create');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$t = Renderer::getMarkupTemplate('admin/users/create.tpl'); $t = Renderer::getMarkupTemplate('admin/users/create.tpl');
return self::getTabsHTML('all') . Renderer::replaceMacros($t, [ return self::getTabsHTML('all') . Renderer::replaceMacros($t, [

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Deleted extends BaseUsers class Deleted extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -44,9 +44,9 @@ class Deleted extends BaseUsers
DI::baseUrl()->redirect('admin/users/deleted'); DI::baseUrl()->redirect('admin/users/deleted');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 100); $pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 100);

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Index extends BaseUsers class Index extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -67,12 +67,12 @@ class Index extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString()); DI::baseUrl()->redirect(DI::args()->getQueryString());
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$action = $parameters['action'] ?? ''; $action = static::$parameters['action'] ?? '';
$uid = $parameters['uid'] ?? 0; $uid = static::$parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Pending extends BaseUsers class Pending extends BaseUsers
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAdminAccess(); self::checkAdminAccess();
@ -58,12 +58,12 @@ class Pending extends BaseUsers
DI::baseUrl()->redirect('admin/users/pending'); DI::baseUrl()->redirect('admin/users/pending');
} }
public static function content(array $parameters = []) public static function content()
{ {
parent::content($parameters); parent::content();
$action = $parameters['action'] ?? ''; $action = static::$parameters['action'] ?? '';
$uid = $parameters['uid'] ?? 0; $uid = static::$parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View file

@ -40,7 +40,7 @@ use Friendica\Module\BaseApi;
*/ */
class Activity extends BaseApi class Activity extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -49,17 +49,17 @@ class Activity extends BaseApi
'id' => 0, // Id of the post 'id' => 0, // Id of the post
]); ]);
$res = Item::performActivity($request['id'], $parameters['verb'], $uid); $res = Item::performActivity($request['id'], static::$parameters['verb'], $uid);
if ($res) { if ($res) {
if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) { if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$ok = 'true'; $ok = 'true';
} else { } else {
$ok = 'ok'; $ok = 'ok';
} }
DI::apiResponse()->exit('ok', ['ok' => $ok], $parameters['extension'] ?? null); DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
} else { } else {
DI::apiResponse()->error(500, 'Error adding activity', '', $parameters['extension'] ?? null); DI::apiResponse()->error(500, 'Error adding activity', '', static::$parameters['extension'] ?? null);
} }
} }
} }

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/ */
class Setseen extends BaseApi class Setseen extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -42,13 +42,13 @@ class Setseen extends BaseApi
// return error if id is zero // return error if id is zero
if (empty($request['id'])) { if (empty($request['id'])) {
$answer = ['result' => 'error', 'message' => 'message id not specified']; $answer = ['result' => 'error', 'message' => 'message id not specified'];
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
} }
// error message if specified id is not in database // error message if specified id is not in database
if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) { if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) {
$answer = ['result' => 'error', 'message' => 'message id not in database']; $answer = ['result' => 'error', 'message' => 'message id not in database'];
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
} }
// update seen indicator // update seen indicator
@ -58,6 +58,6 @@ class Setseen extends BaseApi
$answer = ['result' => 'error', 'message' => 'unknown error']; $answer = ['result' => 'error', 'message' => 'unknown error'];
} }
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/ */
class Index extends BaseApi class Index extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -70,6 +70,6 @@ class Index extends BaseApi
]; ];
} }
DI::apiResponse()->exit('events', ['events' => $items], $parameters['extension'] ?? null); DI::apiResponse()->exit('events', ['events' => $items], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Index extends BaseApi class Index extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
} }
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
} }
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
echo api_call(DI::app()); echo api_call(DI::app());
exit(); exit();

View file

@ -31,7 +31,7 @@ use Friendica\Object\Api\Friendica\Notification as ApiNotification;
*/ */
class Notification extends BaseApi class Notification extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -43,7 +43,7 @@ class Notification extends BaseApi
$notifications[] = new ApiNotification($Notify); $notifications[] = new ApiNotification($Notify);
} }
if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) { if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$xmlnotes = []; $xmlnotes = [];
foreach ($notifications as $notification) { foreach ($notifications as $notification) {
$xmlnotes[] = ['@attributes' => $notification->toArray()]; $xmlnotes[] = ['@attributes' => $notification->toArray()];
@ -56,6 +56,6 @@ class Notification extends BaseApi
$result = false; $result = false;
} }
DI::apiResponse()->exit('notes', ['note' => $result], $parameters['extension'] ?? null); DI::apiResponse()->exit('notes', ['note' => $result], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Delete extends BaseApi class Delete extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -64,7 +64,7 @@ class Delete extends BaseApi
Item::deleteForUser($condition, $uid); Item::deleteForUser($condition, $uid);
$result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.']; $result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.'];
DI::apiResponse()->exit('photo_delete', ['$result' => $result], $parameters['extension'] ?? null); DI::apiResponse()->exit('photo_delete', ['$result' => $result], static::$parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error on deleting photo from database table"); throw new InternalServerErrorException("unknown error on deleting photo from database table");
} }

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Delete extends BaseApi class Delete extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -67,7 +67,7 @@ class Delete extends BaseApi
// return success of deletion or error message // return success of deletion or error message
if ($result) { if ($result) {
$answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.']; $answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], $parameters['extension'] ?? null); DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], static::$parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error - deleting from database failed"); throw new InternalServerErrorException("unknown error - deleting from database failed");
} }

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/ */
class Update extends BaseApi class Update extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -59,7 +59,7 @@ class Update extends BaseApi
// return success of updating or error message // return success of updating or error message
if ($result) { if ($result) {
$answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.']; $answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.'];
DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], $parameters['extension'] ?? null); DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], static::$parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error - updating in database failed"); throw new InternalServerErrorException("unknown error - updating in database failed");
} }

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class Show extends BaseApi class Show extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -49,7 +49,7 @@ class Show extends BaseApi
$profile = self::formatProfile($profile, $profileFields); $profile = self::formatProfile($profile, $profileFields);
$profiles = []; $profiles = [];
if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) { if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$profiles['0:profile'] = $profile; $profiles['0:profile'] = $profile;
} else { } else {
$profiles[] = $profile; $profiles[] = $profile;
@ -65,7 +65,7 @@ class Show extends BaseApi
'profiles' => $profiles 'profiles' => $profiles
]; ];
DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], $parameters['extension'] ?? null); DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], static::$parameters['extension'] ?? null);
} }
/** /**

View file

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

View file

@ -29,14 +29,14 @@ use Friendica\DI;
*/ */
class Test extends BaseApi class Test extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) { if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$ok = 'true'; $ok = 'true';
} else { } else {
$ok = 'ok'; $ok = 'ok';
} }
DI::apiResponse()->exit('ok', ['ok' => $ok], $parameters['extension'] ?? null); DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -33,27 +33,26 @@ use Friendica\Module\BaseApi;
class Accounts extends BaseApi class Accounts extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id']) && empty($parameters['name'])) { if (empty(static::$parameters['id']) && empty(static::$parameters['name'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!empty($parameters['id'])) { if (!empty(static::$parameters['id'])) {
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
} else { } else {
$contact = Contact::selectFirst(['id'], ['nick' => $parameters['name'], 'uid' => 0]); $contact = Contact::selectFirst(['id'], ['nick' => static::$parameters['name'], 'uid' => 0]);
if (!empty($contact['id'])) { if (!empty($contact['id'])) {
$id = $contact['id']; $id = $contact['id'];
} elseif (!($id = Contact::getIdForURL($parameters['name'], 0, false))) { } elseif (!($id = Contact::getIdForURL(static::$parameters['name'], 0, false))) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
} }

View file

@ -32,12 +32,12 @@ use Friendica\Module\BaseApi;
*/ */
class Block extends BaseApi class Block extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -46,7 +46,7 @@ class Block extends BaseApi
DI::mstdnError()->Forbidden(); DI::mstdnError()->Forbidden();
} }
$cdata = Contact::getPublicAndUserContactID($parameters['id'], $uid); $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
if (empty($cdata['user'])) { if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -62,6 +62,6 @@ class Block extends BaseApi
Contact::terminateFriendship($owner, $contact); Contact::terminateFriendship($owner, $contact);
Contact::revokeFollow($contact); Contact::revokeFollow($contact);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -30,10 +30,9 @@ use Friendica\Module\BaseApi;
class FeaturedTags extends BaseApi class FeaturedTags extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -31,16 +31,16 @@ use Friendica\Module\BaseApi;
*/ */
class Follow extends BaseApi class Follow extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$cid = Contact::follow($parameters['id'], $uid); $cid = Contact::follow(static::$parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
} }

View file

@ -32,19 +32,18 @@ use Friendica\Module\BaseApi;
class Followers extends BaseApi class Followers extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -73,7 +72,7 @@ class Followers extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('contact-relation', ['relation-cid'], $condition, $parameters); $followers = DBA::select('contact-relation', ['relation-cid'], $condition, static::$parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['relation-cid']); self::setBoundaries($follower['relation-cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid);

View file

@ -32,19 +32,18 @@ use Friendica\Module\BaseApi;
class Following extends BaseApi class Following extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -73,7 +72,7 @@ class Following extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('contact-relation', ['cid'], $condition, $parameters); $followers = DBA::select('contact-relation', ['cid'], $condition, static::$parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

@ -30,10 +30,9 @@ use Friendica\Module\BaseApi;
class IdentityProofs extends BaseApi class IdentityProofs extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -33,19 +33,18 @@ use Friendica\Module\BaseApi;
class Lists extends BaseApi class Lists extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Mute extends BaseApi class Mute extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setIgnored($parameters['id'], $uid, true); Contact\User::setIgnored(static::$parameters['id'], $uid, true);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,12 +32,12 @@ use Friendica\Module\BaseApi;
*/ */
class Note extends BaseApi class Note extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -45,13 +45,13 @@ class Note extends BaseApi
'comment' => '', 'comment' => '',
]); ]);
$cdata = Contact::getPublicAndUserContactID($parameters['id'], $uid); $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
if (empty($cdata['user'])) { if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]); Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,10 +32,9 @@ use Friendica\Module\BaseApi;
class Relationships extends BaseApi class Relationships extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,10 +35,9 @@ use Friendica\Object\Search\ContactResult;
class Search extends BaseApi class Search extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -37,18 +37,17 @@ use Friendica\Protocol\Activity;
class Statuses extends BaseApi class Statuses extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Unblock extends BaseApi class Unblock extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setBlocked($parameters['id'], $uid, false); Contact\User::setBlocked(static::$parameters['id'], $uid, false);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Unfollow extends BaseApi class Unfollow extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact::unfollow($parameters['id'], $uid); Contact::unfollow(static::$parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Unmute extends BaseApi class Unmute extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setIgnored($parameters['id'], $uid, false); Contact\User::setIgnored(static::$parameters['id'], $uid, false);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

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

View file

@ -33,10 +33,9 @@ use Friendica\Module\BaseApi;
class VerifyCredentials extends BaseApi class VerifyCredentials extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -30,10 +30,9 @@ use Friendica\Module\BaseApi;
class Announcements extends BaseApi class Announcements extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -33,10 +33,9 @@ use Friendica\Util\Network;
class Apps extends BaseApi class Apps extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function post(array $parameters = []) public static function post()
{ {
$request = self::getRequest([ $request = self::getRequest([
'client_name' => '', 'client_name' => '',

View file

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

View file

@ -32,19 +32,18 @@ use Friendica\Module\BaseApi;
class Blocks extends BaseApi class Blocks extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -73,7 +72,7 @@ class Blocks extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('user-contact', ['cid'], $condition, $parameters); $followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

@ -34,10 +34,9 @@ use Friendica\Network\HTTPException;
class Bookmarks extends BaseApi class Bookmarks extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,26 +31,25 @@ use Friendica\Module\BaseApi;
*/ */
class Conversations extends BaseApi class Conversations extends BaseApi
{ {
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty($parameters['id'])) { if (!empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
DBA::delete('conv', ['id' => $parameters['id'], 'uid' => $uid]); DBA::delete('conv', ['id' => static::$parameters['id'], 'uid' => $uid]);
DBA::delete('mail', ['convid' => $parameters['id'], 'uid' => $uid]); DBA::delete('mail', ['convid' => static::$parameters['id'], 'uid' => $uid]);
System::jsonExit([]); System::jsonExit([]);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/ */
class Read extends BaseApi class Read extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty($parameters['id'])) { if (!empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
DBA::update('mail', ['seen' => true], ['convid' => $parameters['id'], 'uid' => $uid]); DBA::update('mail', ['seen' => true], ['convid' => static::$parameters['id'], 'uid' => $uid]);
System::jsonExit(DI::mstdnConversation()->CreateFromConvId($parameters['id'])->toArray()); System::jsonExit(DI::mstdnConversation()->CreateFromConvId(static::$parameters['id'])->toArray());
} }
} }

View file

@ -33,12 +33,11 @@ use Friendica\Network\HTTPException;
class CustomEmojis extends BaseApi class CustomEmojis extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList()); $emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());

View file

@ -35,12 +35,11 @@ use Friendica\Network\HTTPException;
class Directory extends BaseApi class Directory extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/instance/directory/ * @see https://docs.joinmastodon.org/methods/instance/directory/
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$request = self::getRequest([ $request = self::getRequest([
'offset' => 0, // How many accounts to skip before returning results. Default 0. 'offset' => 0, // How many accounts to skip before returning results. Default 0.

View file

@ -30,10 +30,9 @@ use Friendica\Module\BaseApi;
class Endorsements extends BaseApi class Endorsements extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
System::jsonExit([]); System::jsonExit([]);
} }

View file

@ -35,10 +35,9 @@ use Friendica\Protocol\Activity;
class Favourited extends BaseApi class Favourited extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Filters extends BaseApi class Filters extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -39,10 +39,9 @@ class Filters extends BaseApi
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -33,7 +33,6 @@ use Friendica\Network\HTTPException;
class FollowRequests extends BaseApi class FollowRequests extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\BadRequestException * @throws HTTPException\BadRequestException
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws HTTPException\NotFoundException * @throws HTTPException\NotFoundException
@ -43,16 +42,16 @@ class FollowRequests extends BaseApi
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-follow * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-follow
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-follow * @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-follow
*/ */
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
$introduction = DI::intro()->selectOneById($parameters['id'], $uid); $introduction = DI::intro()->selectOneById(static::$parameters['id'], $uid);
$contactId = $introduction->cid; $contactId = $introduction->cid;
switch ($parameters['action']) { switch (static::$parameters['action']) {
case 'authorize': case 'authorize':
Contact\Introduction::confirm($introduction); Contact\Introduction::confirm($introduction);
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid); $relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
@ -79,12 +78,11 @@ class FollowRequests extends BaseApi
} }
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests/ * @see https://docs.joinmastodon.org/methods/accounts/follow_requests/
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -31,10 +31,9 @@ use Friendica\Object\Api\Mastodon\Instance as InstanceEntity;
class Instance extends BaseApi class Instance extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
System::jsonExit(InstanceEntity::get()); System::jsonExit(InstanceEntity::get());
} }

View file

@ -34,10 +34,9 @@ use Friendica\Util\Network;
class Peers extends BaseApi class Peers extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$return = []; $return = [];

View file

@ -34,10 +34,9 @@ use Friendica\Network\HTTPException;
class Rules extends BaseApi class Rules extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$rules = []; $rules = [];
$id = 0; $id = 0;

View file

@ -31,27 +31,27 @@ use Friendica\Model\Group;
*/ */
class Lists extends BaseApi class Lists extends BaseApi
{ {
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!Group::exists($parameters['id'], $uid)) { if (!Group::exists(static::$parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
if (!Group::remove($parameters['id'])) { if (!Group::remove(static::$parameters['id'])) {
DI::mstdnError()->InternalError(); DI::mstdnError()->InternalError();
} }
System::jsonExit([]); System::jsonExit([]);
} }
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -74,30 +74,29 @@ class Lists extends BaseApi
System::jsonExit(DI::mstdnList()->createFromGroupId($id)); System::jsonExit(DI::mstdnList()->createFromGroupId($id));
} }
public static function put(array $parameters = []) public static function put()
{ {
$request = self::getRequest([ $request = self::getRequest([
'title' => '', // The title of the list to be updated. 'title' => '', // The title of the list to be updated.
'replies_policy' => '', // One of: "followed", "list", or "none". 'replies_policy' => '', // One of: "followed", "list", or "none".
]); ]);
if (empty($request['title']) || empty($parameters['id'])) { if (empty($request['title']) || empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Group::update($parameters['id'], $request['title']); Group::update(static::$parameters['id'], $request['title']);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
$lists = []; $lists = [];
$groups = Group::getByUserId($uid); $groups = Group::getByUserId($uid);
@ -106,7 +105,7 @@ class Lists extends BaseApi
$lists[] = DI::mstdnList()->createFromGroupId($group['id']); $lists[] = DI::mstdnList()->createFromGroupId($group['id']);
} }
} else { } else {
$id = $parameters['id']; $id = static::$parameters['id'];
if (!Group::exists($id, $uid)) { if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();

View file

@ -35,30 +35,29 @@ use Friendica\Module\BaseApi;
*/ */
class Accounts extends BaseApi class Accounts extends BaseApi
{ {
public static function delete(array $parameters = []) public static function delete()
{ {
DI::apiResponse()->unsupported(Router::DELETE); DI::apiResponse()->unsupported(Router::DELETE);
} }
public static function post(array $parameters = []) public static function post()
{ {
DI::apiResponse()->unsupported(Router::POST); DI::apiResponse()->unsupported(Router::POST);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) { if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class Markers extends BaseApi class Markers extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -39,10 +39,9 @@ class Markers extends BaseApi
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/ */
class Media extends BaseApi class Media extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -53,7 +53,7 @@ class Media extends BaseApi
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id'])); System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
} }
public static function put(array $parameters = []) public static function put()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -65,34 +65,33 @@ class Media extends BaseApi
'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0 'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0
]); ]);
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$photo = Photo::selectFirst(['resource-id'], ['id' => $parameters['id'], 'uid' => $uid]); $photo = Photo::selectFirst(['resource-id'], ['id' => static::$parameters['id'], 'uid' => $uid]);
if (empty($photo['resource-id'])) { if (empty($photo['resource-id'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]); Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]);
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($parameters['id'])); System::jsonExit(DI::mstdnAttachment()->createFromPhoto(static::$parameters['id']));
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) { if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -32,19 +32,18 @@ use Friendica\Module\BaseApi;
class Mutes extends BaseApi class Mutes extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -73,7 +72,7 @@ class Mutes extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('user-contact', ['cid'], $condition, $parameters); $followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

@ -38,16 +38,15 @@ use Friendica\Protocol\Activity;
class Notifications extends BaseApi class Notifications extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty($parameters['id'])) { if (!empty(static::$parameters['id'])) {
$id = $parameters['id']; $id = static::$parameters['id'];
try { try {
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]); $notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification)); System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));

View file

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

View file

@ -32,16 +32,16 @@ use Friendica\Network\HTTPException\ForbiddenException;
*/ */
class Dismiss extends BaseApi class Dismiss extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$Notification = DI::notification()->selectOneForUser($uid, $parameters['id']); $Notification = DI::notification()->selectOneForUser($uid, static::$parameters['id']);
$Notification->setSeen(); $Notification->setSeen();
DI::notification()->save($Notification); DI::notification()->save($Notification);

View file

@ -32,10 +32,9 @@ use Friendica\Module\BaseApi;
class Preferences extends BaseApi class Preferences extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -30,10 +30,9 @@ use Friendica\Module\BaseApi;
class Proofs extends BaseApi class Proofs extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
System::jsonError(404, ['error' => 'Record not found']); System::jsonError(404, ['error' => 'Record not found']);
} }

View file

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

View file

@ -34,7 +34,7 @@ use Friendica\Module\BaseApi;
*/ */
class ScheduledStatuses extends BaseApi class ScheduledStatuses extends BaseApi
{ {
public static function put(array $parameters = []) public static function put()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -42,35 +42,34 @@ class ScheduledStatuses extends BaseApi
DI::apiResponse()->unsupported(Router::PUT); DI::apiResponse()->unsupported(Router::PUT);
} }
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!DBA::exists('delayed-post', ['id' => $parameters['id'], 'uid' => $uid])) { if (!DBA::exists('delayed-post', ['id' => static::$parameters['id'], 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Post\Delayed::deleteById($parameters['id']); Post\Delayed::deleteById(static::$parameters['id']);
System::jsonExit([]); System::jsonExit([]);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (isset($parameters['id'])) { if (isset(static::$parameters['id'])) {
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId(static::$parameters['id'], $uid)->toArray());
} }
$request = self::getRequest([ $request = self::getRequest([

View file

@ -38,10 +38,9 @@ use Friendica\Object\Search\ContactResult;
class Search extends BaseApi class Search extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -74,7 +73,7 @@ class Search extends BaseApi
$result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']); $result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
} }
if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) { if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) {
$result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $parameters['version']); $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], static::$parameters['version']);
} }
System::jsonExit($result); System::jsonExit($result);

View file

@ -41,7 +41,7 @@ use Friendica\Util\Images;
*/ */
class Statuses extends BaseApi class Statuses extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -207,16 +207,16 @@ class Statuses extends BaseApi
DI::mstdnError()->InternalError(); DI::mstdnError()->InternalError();
} }
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $parameters['id'], 'uid' => $uid]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => $uid]);
if (empty($item['id'])) { if (empty($item['id'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -229,17 +229,16 @@ class Statuses extends BaseApi
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid));
} }
} }

View file

@ -33,16 +33,16 @@ use Friendica\Module\BaseApi;
*/ */
class Bookmark extends BaseApi class Bookmark extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -53,6 +53,6 @@ class Bookmark extends BaseApi
Item::update(['starred' => true], ['id' => $item['id']]); Item::update(['starred' => true], ['id' => $item['id']]);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -33,18 +33,17 @@ use Friendica\Network\HTTPException;
class Card extends BaseApi class Card extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.')); throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.'));

View file

@ -33,14 +33,13 @@ use Friendica\Module\BaseApi;
class Context extends BaseApi class Context extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -48,7 +47,7 @@ class Context extends BaseApi
'limit' => 40, // Maximum number of results to return. Defaults to 40. 'limit' => 40, // Maximum number of results to return. Defaults to 40.
]); ]);
$id = $parameters['id']; $id = static::$parameters['id'];
$parents = []; $parents = [];
$children = []; $children = [];

View file

@ -33,22 +33,22 @@ use Friendica\Module\BaseApi;
*/ */
class Favourite extends BaseApi class Favourite extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Item::performActivity($item['id'], 'like', $uid); Item::performActivity($item['id'], 'like', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -33,18 +33,17 @@ use Friendica\Protocol\Activity;
class FavouritedBy extends BaseApi class FavouritedBy extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -32,16 +32,16 @@ use Friendica\Module\BaseApi;
*/ */
class Mute extends BaseApi class Mute extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -50,8 +50,8 @@ class Mute extends BaseApi
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be muted')); DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be muted'));
} }
Post\ThreadUser::setIgnored($parameters['id'], $uid, true); Post\ThreadUser::setIgnored(static::$parameters['id'], $uid, true);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,16 +32,16 @@ use Friendica\Module\BaseApi;
*/ */
class Pin extends BaseApi class Pin extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -50,8 +50,8 @@ class Pin extends BaseApi
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned')); DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned'));
} }
Post\ThreadUser::setPinned($parameters['id'], $uid, true); Post\ThreadUser::setPinned(static::$parameters['id'], $uid, true);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -35,16 +35,16 @@ use Friendica\Module\BaseApi;
*/ */
class Reblog extends BaseApi class Reblog extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -55,6 +55,6 @@ class Reblog extends BaseApi
Item::performActivity($item['id'], 'announce', $uid); Item::performActivity($item['id'], 'announce', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -33,18 +33,17 @@ use Friendica\Protocol\Activity;
class RebloggedBy extends BaseApi class RebloggedBy extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = $parameters['id']; $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View file

@ -33,16 +33,16 @@ use Friendica\Module\BaseApi;
*/ */
class Unbookmark extends BaseApi class Unbookmark extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -53,6 +53,6 @@ class Unbookmark extends BaseApi
Item::update(['starred' => false], ['id' => $item['id']]); Item::update(['starred' => false], ['id' => $item['id']]);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -33,22 +33,22 @@ use Friendica\Module\BaseApi;
*/ */
class Unfavourite extends BaseApi class Unfavourite extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Item::performActivity($item['id'], 'unlike', $uid); Item::performActivity($item['id'], 'unlike', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,16 +32,16 @@ use Friendica\Module\BaseApi;
*/ */
class Unmute extends BaseApi class Unmute extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -50,8 +50,8 @@ class Unmute extends BaseApi
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be unmuted')); DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be unmuted'));
} }
Post\ThreadUser::setIgnored($parameters['id'], $uid, false); Post\ThreadUser::setIgnored(static::$parameters['id'], $uid, false);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,16 +32,16 @@ use Friendica\Module\BaseApi;
*/ */
class Unpin extends BaseApi class Unpin extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -50,8 +50,8 @@ class Unpin extends BaseApi
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned')); DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned'));
} }
Post\ThreadUser::setPinned($parameters['id'], $uid, false); Post\ThreadUser::setPinned(static::$parameters['id'], $uid, false);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -35,16 +35,16 @@ use Friendica\Module\BaseApi;
*/ */
class Unreblog extends BaseApi class Unreblog extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -55,6 +55,6 @@ class Unreblog extends BaseApi
Item::performActivity($item['id'], 'unannounce', $uid); Item::performActivity($item['id'], 'unannounce', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
} }
} }

View file

@ -32,10 +32,9 @@ use Friendica\Module\BaseApi;
class Suggestions extends BaseApi class Suggestions extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -33,10 +33,9 @@ use Friendica\Network\HTTPException;
class Direct extends BaseApi class Direct extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,10 +34,9 @@ use Friendica\Network\HTTPException;
class Home extends BaseApi class Home extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -34,15 +34,14 @@ use Friendica\Network\HTTPException;
class ListTimeline extends BaseApi class ListTimeline extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -61,7 +60,7 @@ class ListTimeline extends BaseApi
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']]; $params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", $condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)",
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $parameters['id']]; $uid, GRAVITY_PARENT, GRAVITY_COMMENT, static::$parameters['id']];
if (!empty($request['max_id'])) { if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]); $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);

View file

@ -37,10 +37,9 @@ use Friendica\Network\HTTPException;
class PublicTimeline extends BaseApi class PublicTimeline extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();

View file

@ -35,15 +35,14 @@ use Friendica\Network\HTTPException;
class Tag extends BaseApi class Tag extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty($parameters['hashtag'])) { if (empty(static::$parameters['hashtag'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -70,7 +69,7 @@ class Tag extends BaseApi
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`)) $condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
$parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; static::$parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
if ($request['local']) { if ($request['local']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);

View file

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

View file

@ -31,46 +31,41 @@ use Friendica\Module\BaseApi;
class Unimplemented extends BaseApi class Unimplemented extends BaseApi
{ {
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function delete(array $parameters = []) public static function delete()
{ {
DI::apiResponse()->unsupported(Router::DELETE); DI::apiResponse()->unsupported(Router::DELETE);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function patch(array $parameters = []) public static function patch()
{ {
DI::apiResponse()->unsupported(Router::PATCH); DI::apiResponse()->unsupported(Router::PATCH);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function post(array $parameters = []) public static function post()
{ {
DI::apiResponse()->unsupported(Router::POST); DI::apiResponse()->unsupported(Router::POST);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function put(array $parameters = []) public static function put()
{ {
DI::apiResponse()->unsupported(Router::PUT); DI::apiResponse()->unsupported(Router::PUT);
} }
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
DI::apiResponse()->unsupported(Router::GET); DI::apiResponse()->unsupported(Router::GET);
} }

View file

@ -30,9 +30,9 @@ use Friendica\Util\DateTimeFormat;
*/ */
class RateLimitStatus extends BaseApi class RateLimitStatus extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) { if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$hash = [ $hash = [
'remaining-hits' => '150', 'remaining-hits' => '150',
'@attributes' => ["type" => "integer"], '@attributes' => ["type" => "integer"],
@ -52,6 +52,6 @@ class RateLimitStatus extends BaseApi
]; ];
} }
DI::apiResponse()->exit('hash', ['hash' => $hash], $parameters['extension'] ?? null); DI::apiResponse()->exit('hash', ['hash' => $hash], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -35,9 +35,9 @@ abstract class ContactEndpoint extends BaseApi
const DEFAULT_COUNT = 20; const DEFAULT_COUNT = 20;
const MAX_COUNT = 200; const MAX_COUNT = 200;
public static function init(array $parameters = []) public static function init()
{ {
parent::init($parameters); parent::init();
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
} }

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/ */
class FollowersIds extends ContactEndpoint class FollowersIds extends ContactEndpoint
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT); $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/ */
class FollowersList extends ContactEndpoint class FollowersList extends ContactEndpoint
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT); $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/ */
class FriendsIds extends ContactEndpoint class FriendsIds extends ContactEndpoint
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT); $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/ */
class FriendsList extends ContactEndpoint class FriendsList extends ContactEndpoint
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT); $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/ */
class SavedSearches extends BaseApi class SavedSearches extends BaseApi
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
@ -45,6 +45,6 @@ class SavedSearches extends BaseApi
DBA::close($terms); DBA::close($terms);
DI::apiResponse()->exit('terms', ['terms' => $result], $parameters['extension'] ?? null); DI::apiResponse()->exit('terms', ['terms' => $result], static::$parameters['extension'] ?? null);
} }
} }

View file

@ -31,7 +31,7 @@ use Friendica\DI;
*/ */
class Apps extends BaseModule class Apps extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
$privateaddons = DI::config()->get('config', 'private_addons'); $privateaddons = DI::config()->get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) { if ($privateaddons === "1" && !local_user()) {
@ -39,7 +39,7 @@ class Apps extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
$apps = Nav::getAppMenu(); $apps = Nav::getAppMenu();

View file

@ -34,14 +34,14 @@ class Attach extends BaseModule
/** /**
* Return to user an attached file given the id * Return to user an attached file given the id
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$a = DI::app(); $a = DI::app();
if (empty($parameters['item'])) { if (empty(static::$parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException(); throw new \Friendica\Network\HTTPException\BadRequestException();
} }
$item_id = intval($parameters['item']); $item_id = intval(static::$parameters['item']);
// Check for existence // Check for existence
$item = MAttach::exists(['id' => $item_id]); $item = MAttach::exists(['id' => $item_id]);

View file

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

View file

@ -53,7 +53,7 @@ class BaseApi extends BaseModule
*/ */
protected static $request = []; protected static $request = [];
public static function delete(array $parameters = []) public static function delete()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -62,7 +62,7 @@ class BaseApi extends BaseModule
} }
} }
public static function patch(array $parameters = []) public static function patch()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -71,7 +71,7 @@ class BaseApi extends BaseModule
} }
} }
public static function post(array $parameters = []) public static function post()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -80,7 +80,7 @@ class BaseApi extends BaseModule
} }
} }
public static function put(array $parameters = []) public static function put()
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
@ -139,7 +139,6 @@ class BaseApi extends BaseModule
* Set boundaries for the "link" header * Set boundaries for the "link" header
* @param array $boundaries * @param array $boundaries
* @param int $id * @param int $id
* @return array
*/ */
protected static function setBoundaries(int $id) protected static function setBoundaries(int $id)
{ {

View file

@ -82,7 +82,7 @@ abstract class BaseNotifications extends BaseModule
*/ */
abstract public static function getNotifications(); abstract public static function getNotifications();
public static function init(array $parameters = []) public static function init()
{ {
if (!local_user()) { if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.')); throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -94,7 +94,7 @@ abstract class BaseNotifications extends BaseModule
self::$showAll = ($_REQUEST['show'] ?? '') === 'all'; self::$showAll = ($_REQUEST['show'] ?? '') === 'all';
} }
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
// If the last argument of the query is NOT json, return // If the last argument of the query is NOT json, return
if (DI::args()->get(DI::args()->getArgc() - 1) !== 'json') { if (DI::args()->get(DI::args()->getArgc() - 1) !== 'json') {

View file

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

View file

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

View file

@ -96,7 +96,7 @@ class Contact extends BaseModule
DI::baseUrl()->redirect($redirectUrl); DI::baseUrl()->redirect($redirectUrl);
} }
public static function post(array $parameters = []) public static function post()
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -226,7 +226,7 @@ class Contact extends BaseModule
Model\Contact\User::setIgnored($contact_id, local_user(), $ignored); Model\Contact\User::setIgnored($contact_id, local_user(), $ignored);
} }
public static function content(array $parameters = [], $update = 0) public static function content($update = 0)
{ {
if (!local_user()) { if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']); return Login::form($_SERVER['REQUEST_URI']);

View file

@ -38,16 +38,16 @@ use Friendica\Util\Strings;
*/ */
class Advanced extends BaseModule class Advanced extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
if (!Session::isAuthenticated()) { if (!Session::isAuthenticated()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.')); throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
} }
} }
public static function post(array $parameters = []) public static function post()
{ {
$cid = $parameters['id']; $cid = static::$parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {
@ -96,9 +96,9 @@ class Advanced extends BaseModule
return; return;
} }
public static function content(array $parameters = []) public static function content()
{ {
$cid = $parameters['id']; $cid = static::$parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {

View file

@ -14,7 +14,7 @@ use Friendica\Network\HTTPException;
class Contacts extends BaseModule class Contacts extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
$app = DI::app(); $app = DI::app();
@ -22,8 +22,8 @@ class Contacts extends BaseModule
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
$cid = $parameters['id']; $cid = static::$parameters['id'];
$type = $parameters['type'] ?? 'all'; $type = static::$parameters['type'] ?? 'all';
$accounttype = $_GET['accounttype'] ?? ''; $accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype); $accounttypeid = User::getAccountTypeByString($accounttype);

View file

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

View file

@ -34,9 +34,9 @@ use Friendica\Network\HTTPException\BadRequestException;
*/ */
class Media extends BaseModule class Media extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
$cid = $parameters['id']; $cid = static::$parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid]); $contact = Model\Contact::selectFirst([], ['id' => $cid]);
if (empty($contact)) { if (empty($contact)) {

View file

@ -18,9 +18,9 @@ use Friendica\Util\XML;
class Poke extends BaseModule class Poke extends BaseModule
{ {
public static function post(array $parameters = []) public static function post()
{ {
if (!local_user() || empty($parameters['id'])) { if (!local_user() || empty(static::$parameters['id'])) {
return self::postReturn(false); return self::postReturn(false);
} }
@ -39,14 +39,14 @@ class Poke extends BaseModule
$activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]); $activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]);
$contact_id = intval($parameters['id']); $contact_id = intval(static::$parameters['id']);
if (!$contact_id) { if (!$contact_id) {
return self::postReturn(false); return self::postReturn(false);
} }
Logger::info('verb ' . $verb . ' contact ' . $contact_id); Logger::info('verb ' . $verb . ' contact ' . $contact_id);
$contact = DBA::selectFirst('contact', ['id', 'name', 'url', 'photo'], ['id' => $parameters['id'], 'uid' => local_user()]); $contact = DBA::selectFirst('contact', ['id', 'name', 'url', 'photo'], ['id' => static::$parameters['id'], 'uid' => local_user()]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
return self::postReturn(false); return self::postReturn(false);
} }
@ -123,17 +123,17 @@ class Poke extends BaseModule
return $success; return $success;
} }
public static function content(array $parameters = []) public static function content()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
} }
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$contact = DBA::selectFirst('contact', ['id', 'url', 'name'], ['id' => $parameters['id'], 'uid' => local_user()]); $contact = DBA::selectFirst('contact', ['id', 'url', 'name'], ['id' => static::$parameters['id'], 'uid' => local_user()]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
} }

View file

@ -37,13 +37,13 @@ class Revoke extends BaseModule
/** @var array */ /** @var array */
private static $contact; private static $contact;
public static function init(array $parameters = []) public static function init()
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$data = Model\Contact::getPublicAndUserContactID($parameters['id'], local_user()); $data = Model\Contact::getPublicAndUserContactID(static::$parameters['id'], local_user());
if (!DBA::isResult($data)) { if (!DBA::isResult($data)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.')); throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.'));
} }
@ -63,13 +63,13 @@ class Revoke extends BaseModule
} }
} }
public static function post(array $parameters = []) public static function post()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(); throw new HTTPException\UnauthorizedException();
} }
self::checkFormSecurityTokenRedirectOnError('contact/' . $parameters['id'], 'contact_revoke'); self::checkFormSecurityTokenRedirectOnError('contact/' . static::$parameters['id'], 'contact_revoke');
$result = Model\Contact::revokeFollow(self::$contact); $result = Model\Contact::revokeFollow(self::$contact);
if ($result === true) { if ($result === true) {
@ -80,10 +80,10 @@ class Revoke extends BaseModule
notice(DI::l10n()->t('Unable to revoke follow, please try again later or contact the administrator.')); notice(DI::l10n()->t('Unable to revoke follow, please try again later or contact the administrator.'));
} }
DI::baseUrl()->redirect('contact/' . $parameters['id']); DI::baseUrl()->redirect('contact/' . static::$parameters['id']);
} }
public static function content(array $parameters = []): string public static function content(): string
{ {
if (!local_user()) { if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']); return Login::form($_SERVER['REQUEST_URI']);

View file

@ -49,9 +49,9 @@ class Community extends BaseModule
protected static $max_id; protected static $max_id;
protected static $item_id; protected static $item_id;
public static function content(array $parameters = []) public static function content()
{ {
self::parseRequest($parameters); self::parseRequest();
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) { if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
@ -94,8 +94,8 @@ class Community extends BaseModule
if (local_user() && DI::config()->get('system', 'community_no_sharer')) { if (local_user() && DI::config()->get('system', 'community_no_sharer')) {
$path = self::$content; $path = self::$content;
if (!empty($parameters['accounttype'])) { if (!empty(static::$parameters['accounttype'])) {
$path .= '/' . $parameters['accounttype']; $path .= '/' . static::$parameters['accounttype'];
} }
$query_parameters = []; $query_parameters = [];
@ -166,11 +166,10 @@ class Community extends BaseModule
/** /**
* Computes module parameters from the request and local configuration * Computes module parameters from the request and local configuration
* *
* @param array $parameters
* @throws HTTPException\BadRequestException * @throws HTTPException\BadRequestException
* @throws HTTPException\ForbiddenException * @throws HTTPException\ForbiddenException
*/ */
protected static function parseRequest(array $parameters) protected static function parseRequest()
{ {
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
@ -182,10 +181,10 @@ class Community extends BaseModule
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
} }
self::$accountTypeString = $_GET['accounttype'] ?? $parameters['accounttype'] ?? ''; self::$accountTypeString = $_GET['accounttype'] ?? static::$parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString); self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
self::$content = $parameters['content'] ?? ''; self::$content = static::$parameters['content'] ?? '';
if (!self::$content) { if (!self::$content) {
if (!empty(DI::config()->get('system', 'singleuser'))) { if (!empty(DI::config()->get('system', 'singleuser'))) {
// On single user systems only the global page does make sense // On single user systems only the global page does make sense

View file

@ -57,13 +57,13 @@ class Network extends BaseModule
/** @var string */ /** @var string */
protected static $order; protected static $order;
public static function content(array $parameters = []) public static function content()
{ {
if (!local_user()) { if (!local_user()) {
return Login::form(); return Login::form();
} }
self::parseRequest($parameters, $_GET); self::parseRequest($_GET);
$module = 'network'; $module = 'network';
@ -272,11 +272,11 @@ class Network extends BaseModule
return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]); return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
} }
protected static function parseRequest(array $parameters, array $get) protected static function parseRequest(array $get)
{ {
self::$groupId = $parameters['group_id'] ?? 0; self::$groupId = static::$parameters['group_id'] ?? 0;
self::$forumContactId = $parameters['contact_id'] ?? 0; self::$forumContactId = static::$parameters['contact_id'] ?? 0;
self::$selectedTab = Session::get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', '')); self::$selectedTab = Session::get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', ''));
@ -317,13 +317,13 @@ class Network extends BaseModule
Session::set('network-tab', self::$selectedTab); Session::set('network-tab', self::$selectedTab);
DI::pConfig()->set(local_user(), 'network.view', 'selected_tab', self::$selectedTab); DI::pConfig()->set(local_user(), 'network.view', 'selected_tab', self::$selectedTab);
self::$accountTypeString = $get['accounttype'] ?? $parameters['accounttype'] ?? ''; self::$accountTypeString = $get['accounttype'] ?? static::$parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString); self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
self::$network = $get['nets'] ?? ''; self::$network = $get['nets'] ?? '';
self::$dateFrom = $parameters['from'] ?? ''; self::$dateFrom = static::$parameters['from'] ?? '';
self::$dateTo = $parameters['to'] ?? ''; self::$dateTo = static::$parameters['to'] ?? '';
if (DI::mode()->isMobile()) { if (DI::mode()->isMobile()) {
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',

View file

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

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/ */
class Notify extends BaseModule class Notify extends BaseModule
{ {
public static function post(array $parameters = []) public static function post()
{ {
$postdata = Network::postdata(); $postdata = Network::postdata();
@ -47,8 +47,8 @@ class Notify extends BaseModule
} }
$data = json_decode($postdata); $data = json_decode($postdata);
if (is_object($data) && !empty($parameters['nickname'])) { if (is_object($data) && !empty(static::$parameters['nickname'])) {
$user = User::getByNickname($parameters['nickname']); $user = User::getByNickname(static::$parameters['nickname']);
if (empty($user)) { if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException(); throw new \Friendica\Network\HTTPException\InternalServerErrorException();
} }

View file

@ -29,11 +29,11 @@ use Friendica\Protocol\OStatus;
*/ */
class Poll extends BaseModule class Poll extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
header("Content-type: application/atom+xml"); header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? ''; $last_update = $_GET['last_update'] ?? '';
echo OStatus::feed($parameters['nickname'], $last_update, 10); echo OStatus::feed(static::$parameters['nickname'], $last_update, 10);
exit(); exit();
} }
} }

View file

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

View file

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

View file

@ -32,7 +32,7 @@ use Friendica\Protocol;
*/ */
class Feed extends BaseModule class Feed extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module')); notice(DI::l10n()->t('You must be logged in to use this module'));
@ -40,7 +40,7 @@ class Feed extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
$result = []; $result = [];
if (!empty($_REQUEST['url'])) { if (!empty($_REQUEST['url'])) {

View file

@ -31,17 +31,17 @@ use Friendica\Network\HTTPException;
*/ */
class ItemBody extends BaseModule class ItemBody extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));
} }
if (empty($parameters['item'])) { if (empty(static::$parameters['item'])) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.'));
} }
$itemId = intval($parameters['item']); $itemId = intval(static::$parameters['item']);
$item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]); $item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);

View file

@ -31,7 +31,7 @@ class Localtime extends BaseModule
{ {
static $mod_localtime = ''; static $mod_localtime = '';
public static function post(array $parameters = []) public static function post()
{ {
$time = ($_REQUEST['time'] ?? '') ?: 'now'; $time = ($_REQUEST['time'] ?? '') ?: 'now';
@ -42,7 +42,7 @@ class Localtime extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
$time = ($_REQUEST['time'] ?? '') ?: 'now'; $time = ($_REQUEST['time'] ?? '') ?: 'now';

View file

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

View file

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

View file

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

View file

@ -38,13 +38,13 @@ use Friendica\Util\Strings;
*/ */
class Fetch extends BaseModule class Fetch extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (empty($parameters['guid'])) { if (empty(static::$parameters['guid'])) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
} }
$guid = $parameters['guid']; $guid = static::$parameters['guid'];
// Fetch the item // Fetch the item
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid, $condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,

View file

@ -38,12 +38,12 @@ class Receive extends BaseModule
/** @var LoggerInterface */ /** @var LoggerInterface */
private static $logger; private static $logger;
public static function init(array $parameters = []) public static function init()
{ {
self::$logger = DI::logger(); self::$logger = DI::logger();
} }
public static function post(array $parameters = []) public static function post()
{ {
$enabled = DI::config()->get('system', 'diaspora_enabled', false); $enabled = DI::config()->get('system', 'diaspora_enabled', false);
if (!$enabled) { if (!$enabled) {
@ -51,10 +51,10 @@ class Receive extends BaseModule
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
} }
if ($parameters['type'] === 'public') { if (static::$parameters['type'] === 'public') {
self::receivePublic(); self::receivePublic();
} else if ($parameters['type'] === 'users') { } else if (static::$parameters['type'] === 'users') {
self::receiveUser($parameters['guid']); self::receiveUser(static::$parameters['guid']);
} }
} }

View file

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

View file

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

View file

@ -41,7 +41,7 @@ use Friendica\Protocol\Feed as ProtocolFeed;
*/ */
class Feed extends BaseModule class Feed extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
$a = DI::app(); $a = DI::app();
@ -68,7 +68,7 @@ class Feed extends BaseModule
} }
header("Content-type: application/atom+xml; charset=utf-8"); header("Content-type: application/atom+xml; charset=utf-8");
echo ProtocolFeed::atom($parameters['nickname'], $last_update, 10, $type, $nocache, true); echo ProtocolFeed::atom(static::$parameters['nickname'], $last_update, 10, $type, $nocache, true);
exit(); exit();
} }
} }

View file

@ -33,7 +33,7 @@ use Friendica\Util\XML;
*/ */
class RemoveTag extends BaseModule class RemoveTag extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
@ -41,7 +41,7 @@ class RemoveTag extends BaseModule
$logger = DI::logger(); $logger = DI::logger();
$item_id = $parameters['id'] ?? 0; $item_id = static::$parameters['id'] ?? 0;
$term = XML::unescape(trim($_GET['term'] ?? '')); $term = XML::unescape(trim($_GET['term'] ?? ''));
$cat = XML::unescape(trim($_GET['cat'] ?? '')); $cat = XML::unescape(trim($_GET['cat'] ?? ''));

View file

@ -34,7 +34,7 @@ use Friendica\Util\XML;
*/ */
class SaveTag extends BaseModule class SaveTag extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module')); notice(DI::l10n()->t('You must be logged in to use this module'));
@ -42,13 +42,13 @@ class SaveTag extends BaseModule
} }
} }
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$logger = DI::logger(); $logger = DI::logger();
$term = XML::unescape(trim($_GET['term'] ?? '')); $term = XML::unescape(trim($_GET['term'] ?? ''));
$item_id = $parameters['id'] ?? 0; $item_id = static::$parameters['id'] ?? 0;
$logger->info('filer', ['tag' => $term, 'item' => $item_id]); $logger->info('filer', ['tag' => $term, 'item' => $item_id]);

View file

@ -10,7 +10,7 @@ use Friendica\Model\Contact;
*/ */
class FollowConfirm extends BaseModule class FollowConfirm extends BaseModule
{ {
public static function post(array $parameters = []) public static function post()
{ {
$uid = local_user(); $uid = local_user();
if (!$uid) { if (!$uid) {

View file

@ -38,16 +38,16 @@ use Friendica\Worker\Delivery;
*/ */
class FriendSuggest extends BaseModule class FriendSuggest extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
if (!local_user()) { if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.')); throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
} }
} }
public static function post(array $parameters = []) public static function post()
{ {
$cid = intval($parameters['contact']); $cid = intval(static::$parameters['contact']);
// We do query the "uid" as well to ensure that it is our contact // We do query the "uid" as well to ensure that it is our contact
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) { if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
@ -83,9 +83,9 @@ class FriendSuggest extends BaseModule
info(DI::l10n()->t('Friend suggestion sent.')); info(DI::l10n()->t('Friend suggestion sent.'));
} }
public static function content(array $parameters = []) public static function content()
{ {
$cid = intval($parameters['contact']); $cid = intval(static::$parameters['contact']);
$contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]); $contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {

View file

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

View file

@ -32,7 +32,7 @@ require_once 'boot.php';
class Group extends BaseModule class Group extends BaseModule
{ {
public static function post(array $parameters = []) public static function post()
{ {
$a = DI::app(); $a = DI::app();
@ -138,7 +138,7 @@ class Group extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
$change = false; $change = false;

View file

@ -34,14 +34,14 @@ use Friendica\Network\HTTPException;
*/ */
class HCard extends BaseModule class HCard extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
if ((local_user()) && ($parameters['action'] ?? '') === 'view') { if ((local_user()) && (static::$parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user // A logged in user views a profile of a user
$nickname = DI::app()->getLoggedInUserNickname(); $nickname = DI::app()->getLoggedInUserNickname();
} elseif (empty($parameters['action'])) { } elseif (empty(static::$parameters['action'])) {
// Show the profile hCard // Show the profile hCard
$nickname = $parameters['profile']; $nickname = static::$parameters['profile'];
} else { } else {
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile')); throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
} }

View file

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

View file

@ -27,7 +27,7 @@ use Friendica\Network\HTTPException;
class PageNotFound extends BaseModule class PageNotFound extends BaseModule
{ {
public static function content(array $parameters = []) public static function content()
{ {
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.'));
} }

View file

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

View file

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

View file

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

View file

@ -65,7 +65,7 @@ class Install extends BaseModule
*/ */
private static $installer; private static $installer;
public static function init(array $parameters = []) public static function init()
{ {
$a = DI::app(); $a = DI::app();
@ -94,7 +94,7 @@ class Install extends BaseModule
self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
} }
public static function post(array $parameters = []) public static function post()
{ {
$a = DI::app(); $a = DI::app();
$configCache = $a->getConfigCache(); $configCache = $a->getConfigCache();
@ -177,7 +177,7 @@ class Install extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
$a = DI::app(); $a = DI::app();
$configCache = $a->getConfigCache(); $configCache = $a->getConfigCache();

View file

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

View file

@ -38,18 +38,18 @@ use Friendica\Network\HTTPException;
*/ */
class Activity extends BaseModule class Activity extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (!Session::isAuthenticated()) { if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
if (empty($parameters['id']) || empty($parameters['verb'])) { if (empty(static::$parameters['id']) || empty(static::$parameters['verb'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$verb = $parameters['verb']; $verb = static::$parameters['verb'];
$itemId = $parameters['id']; $itemId = static::$parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) { if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]); $item = Post::selectFirst(['network'], ['id' => $itemId]);

View file

@ -40,7 +40,7 @@ use Friendica\Util\Temporal;
class Compose extends BaseModule class Compose extends BaseModule
{ {
public static function post(array $parameters = []) public static function post()
{ {
if (!empty($_REQUEST['body'])) { if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network'; $_REQUEST['return'] = 'network';
@ -51,7 +51,7 @@ class Compose extends BaseModule
} }
} }
public static function content(array $parameters = []) public static function content()
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('compose', false); return Login::form('compose', false);
@ -64,7 +64,7 @@ class Compose extends BaseModule
} }
/// @TODO Retrieve parameter from router /// @TODO Retrieve parameter from router
$posttype = $parameters['type'] ?? Item::PT_ARTICLE; $posttype = static::$parameters['type'] ?? Item::PT_ARTICLE;
if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) { if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) {
switch ($posttype) { switch ($posttype) {
case 'note': case 'note':

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class Follow extends BaseModule class Follow extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();
@ -42,11 +42,11 @@ class Follow extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval($parameters['id']); $itemId = intval(static::$parameters['id']);
if (!Item::performActivity($itemId, 'follow', local_user())) { if (!Item::performActivity($itemId, 'follow', local_user())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.')); throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException;
*/ */
class Ignore extends BaseModule class Ignore extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();
@ -41,11 +41,11 @@ class Ignore extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval($parameters['id']); $itemId = intval(static::$parameters['id']);
$dba = DI::dba(); $dba = DI::dba();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/ */
class Pin extends BaseModule class Pin extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();
@ -42,11 +42,11 @@ class Pin extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval($parameters['id']); $itemId = intval(static::$parameters['id']);
$item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]); $item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
*/ */
class Star extends BaseModule class Star extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$l10n = DI::l10n(); $l10n = DI::l10n();
@ -43,11 +43,11 @@ class Star extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty($parameters['id'])) { if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval($parameters['id']); $itemId = intval(static::$parameters['id']);
$item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]); $item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]);

View file

@ -39,7 +39,7 @@ use Friendica\Util\Strings;
*/ */
class Magic extends BaseModule class Magic extends BaseModule
{ {
public static function init(array $parameters = []) public static function init()
{ {
$a = DI::app(); $a = DI::app();
$ret = ['success' => false, 'url' => '', 'message' => '']; $ret = ['success' => false, 'url' => '', 'message' => ''];

View file

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

View file

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

View file

@ -35,14 +35,14 @@ use Friendica\Model\User;
*/ */
class NoScrape extends BaseModule class NoScrape extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$a = DI::app(); $a = DI::app();
if (isset($parameters['nick'])) { if (isset(static::$parameters['nick'])) {
// Get infos about a specific nick (public) // Get infos about a specific nick (public)
$which = $parameters['nick']; $which = static::$parameters['nick'];
} elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') { } elseif (local_user() && isset(static::$parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login) // view infos about a known profile (needs a login)
$which = $a->getLoggedInUserNickname(); $which = $a->getLoggedInUserNickname();
} else { } else {

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ class Introductions extends BaseNotifications
]; ];
} }
public static function content(array $parameters = []) public static function content()
{ {
Nav::setSelected('introductions'); Nav::setSelected('introductions');

View file

@ -42,13 +42,13 @@ class Notification extends BaseModule
* @throws \ImagickException * @throws \ImagickException
* @throws \Exception * @throws \Exception
*/ */
public static function post(array $parameters = []) public static function post()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
} }
$request_id = $parameters['id'] ?? false; $request_id = static::$parameters['id'] ?? false;
if ($request_id) { if ($request_id) {
$intro = DI::intro()->selectOneById($request_id, local_user()); $intro = DI::intro()->selectOneById($request_id, local_user());
@ -73,7 +73,7 @@ class Notification extends BaseModule
* *
* @throws HTTPException\UnauthorizedException * @throws HTTPException\UnauthorizedException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
@ -101,14 +101,14 @@ class Notification extends BaseModule
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \Exception * @throws \Exception
*/ */
public static function content(array $parameters = []): string public static function content(): string
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to show this page.')); notice(DI::l10n()->t('You must be logged in to show this page.'));
return Login::form(); return Login::form();
} }
$request_id = $parameters['id'] ?? false; $request_id = static::$parameters['id'] ?? false;
if ($request_id) { if ($request_id) {
$Notify = DI::notify()->selectOneById($request_id); $Notify = DI::notify()->selectOneById($request_id);

View file

@ -82,7 +82,7 @@ class Notifications extends BaseNotifications
]; ];
} }
public static function content(array $parameters = []) public static function content()
{ {
Nav::setSelected('notifications'); Nav::setSelected('notifications');

View file

@ -30,13 +30,13 @@ use Friendica\Module\BaseApi;
*/ */
class Acknowledge extends BaseApi class Acknowledge extends BaseApi
{ {
public static function post(array $parameters = []) public static function post()
{ {
DI::session()->set('oauth_acknowledge', true); DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path')); DI::app()->redirect(DI::session()->get('return_path'));
} }
public static function content(array $parameters = []) public static function content()
{ {
DI::session()->set('return_path', $_REQUEST['return_path'] ?? ''); DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');

View file

@ -35,10 +35,9 @@ class Authorize extends BaseApi
private static $oauth_code = ''; private static $oauth_code = '';
/** /**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$request = self::getRequest([ $request = self::getRequest([
'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance. 'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
@ -98,7 +97,7 @@ class Authorize extends BaseApi
self::$oauth_code = $token['code']; self::$oauth_code = $token['code'];
} }
public static function content(array $parameters = []) public static function content()
{ {
if (empty(self::$oauth_code)) { if (empty(self::$oauth_code)) {
return ''; return '';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,10 +15,10 @@ use Friendica\Network\HTTPException;
*/ */
class PermissionTooltip extends \Friendica\BaseModule class PermissionTooltip extends \Friendica\BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$type = $parameters['type']; $type = static::$parameters['type'];
$referenceId = $parameters['id']; $referenceId = static::$parameters['id'];
$expectedTypes = ['item', 'photo', 'event']; $expectedTypes = ['item', 'photo', 'event'];
if (!in_array($type, $expectedTypes)) { if (!in_array($type, $expectedTypes)) {

View file

@ -51,7 +51,7 @@ class Photo extends BaseModule
* Fetch a photo or an avatar, in optional size, check for permissions and * Fetch a photo or an avatar, in optional size, check for permissions and
* return the image * return the image
*/ */
public static function rawContent(array $parameters = []) public static function rawContent()
{ {
$totalstamp = microtime(true); $totalstamp = microtime(true);
@ -77,14 +77,14 @@ class Photo extends BaseModule
$scale = null; $scale = null;
$stamp = microtime(true); $stamp = microtime(true);
// User avatar // User avatar
if (!empty($parameters['type'])) { if (!empty(static::$parameters['type'])) {
if (!empty($parameters['customsize'])) { if (!empty(static::$parameters['customsize'])) {
$customsize = intval($parameters['customsize']); $customsize = intval(static::$parameters['customsize']);
$square_resize = !in_array($parameters['type'], ['media', 'preview']); $square_resize = !in_array(static::$parameters['type'], ['media', 'preview']);
} }
if (!empty($parameters['guid'])) { if (!empty(static::$parameters['guid'])) {
$guid = $parameters['guid']; $guid = static::$parameters['guid'];
$account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]); $account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]);
if (empty($account)) { if (empty($account)) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
@ -94,12 +94,12 @@ class Photo extends BaseModule
} }
// Contact Id Fallback, to remove after version 2021.12 // Contact Id Fallback, to remove after version 2021.12
if (isset($parameters['contact_id'])) { if (isset(static::$parameters['contact_id'])) {
$id = intval($parameters['contact_id']); $id = intval(static::$parameters['contact_id']);
} }
if (!empty($parameters['nickname_ext'])) { if (!empty(static::$parameters['nickname_ext'])) {
$nickname = pathinfo($parameters['nickname_ext'], PATHINFO_FILENAME); $nickname = pathinfo(static::$parameters['nickname_ext'], PATHINFO_FILENAME);
$user = User::getByNickname($nickname, ['uid']); $user = User::getByNickname($nickname, ['uid']);
if (empty($user)) { if (empty($user)) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
@ -109,23 +109,23 @@ class Photo extends BaseModule
} }
// User Id Fallback, to remove after version 2021.12 // User Id Fallback, to remove after version 2021.12
if (!empty($parameters['uid_ext'])) { if (!empty(static::$parameters['uid_ext'])) {
$id = intval(pathinfo($parameters['uid_ext'], PATHINFO_FILENAME)); $id = intval(pathinfo(static::$parameters['uid_ext'], PATHINFO_FILENAME));
} }
// Please refactor this for the love of everything that's good // Please refactor this for the love of everything that's good
if (isset($parameters['id'])) { if (isset(static::$parameters['id'])) {
$id = $parameters['id']; $id = static::$parameters['id'];
} }
if (empty($id)) { if (empty($id)) {
Logger::notice('No picture id was detected', ['parameters' => $parameters, 'query' => DI::args()->getQueryString()]); Logger::notice('No picture id was detected', ['parameters' => static::$parameters, 'query' => DI::args()->getQueryString()]);
throw new HTTPException\NotFoundException(DI::l10n()->t('The Photo is not available.')); throw new HTTPException\NotFoundException(DI::l10n()->t('The Photo is not available.'));
} }
$photo = self::getPhotoByid($id, $parameters['type'], $customsize ?: Proxy::PIXEL_SMALL); $photo = self::getPhotoByid($id, static::$parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
} else { } else {
$photoid = pathinfo($parameters['name'], PATHINFO_FILENAME); $photoid = pathinfo(static::$parameters['name'], PATHINFO_FILENAME);
$scale = 0; $scale = 0;
if (substr($photoid, -2, 1) == "-") { if (substr($photoid, -2, 1) == "-") {
$scale = intval(substr($photoid, -1, 1)); $scale = intval(substr($photoid, -1, 1));

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
class Common extends BaseProfile class Common extends BaseProfile
{ {
public static function content(array $parameters = []) public static function content()
{ {
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
@ -45,7 +45,7 @@ class Common extends BaseProfile
Nav::setSelected('home'); Nav::setSelected('home');
$nickname = $parameters['nickname']; $nickname = static::$parameters['nickname'];
$profile = Profile::load($a, $nickname); $profile = Profile::load($a, $nickname);
if (empty($profile)) { if (empty($profile)) {

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