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');
if ($server['REQUEST_METHOD'] === Router::DELETE) {
- $this->module_class::delete($this->module_class::getParameters());
+ $this->module_class::delete();
}
if ($server['REQUEST_METHOD'] === Router::PATCH) {
- $this->module_class::patch($this->module_class::getParameters());
+ $this->module_class::patch();
}
if ($server['REQUEST_METHOD'] === Router::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) {
- $this->module_class::put($this->module_class::getParameters());
+ $this->module_class::put();
}
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.
// This endpoint doesn't need any theme initialization or other comparable stuff.
- $this->module_class::rawContent($this->module_class::getParameters());
+ $this->module_class::rawContent();
}
}
$arr = ['content' => $content];
Hook::callAll( $moduleClass::getClassName() . '_mod_content', $arr);
$content = $arr['content'];
- $arr = ['content' => $moduleClass::content($moduleClass::getParameters())];
+ $arr = ['content' => $moduleClass::content()];
Hook::callAll($moduleClass::getClassName() . '_mod_aftercontent', $arr);
$content .= $arr['content'];
} catch (HTTPException $e) {
static::$parameters = $parameters;
}
- /**
- * @return array
- */
- public static function getParameters(): array
- {
- return self::$parameters;
- }
-
/**
* {@inheritDoc}
*/
- public static function init(array $parameters = [])
+ public static function init()
{
}
/**
* {@inheritDoc}
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// echo '';
// exit;
/**
* {@inheritDoc}
*/
- public static function content(array $parameters = [])
+ public static function content()
{
return '';
}
/**
* {@inheritDoc}
*/
- public static function delete(array $parameters = [])
+ public static function delete()
{
}
/**
* {@inheritDoc}
*/
- public static function patch(array $parameters = [])
+ public static function patch()
{
}
/**
* {@inheritDoc}
*/
- public static function post(array $parameters = [])
+ public static function post()
{
// DI::baseurl()->redirect('module');
}
/**
* {@inheritDoc}
*/
- public static function afterpost(array $parameters = [])
+ public static function afterpost()
{
}
/**
* {@inheritDoc}
*/
- public static function put(array $parameters = [])
+ public static function put()
{
}
* Extend this method if you need to do any shared processing before both
* content() or post()
*/
- public static function init(array $parameters = []);
+ public static function init();
/**
* Module GET method to display raw content from technical endpoints
* Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations.
*/
- public static function rawContent(array $parameters = []);
+ public static function rawContent();
/**
* Module GET method to display any content
*
* @return string
*/
- public static function content(array $parameters = []);
+ public static function content();
/**
* Module DELETE method to process submitted data
* Extend this method if the module is supposed to process DELETE requests.
* Doesn't display any content
*/
- public static function delete(array $parameters = []);
+ public static function delete();
/**
* Module PATCH method to process submitted data
* Extend this method if the module is supposed to process PATCH requests.
* Doesn't display any content
*/
- public static function patch(array $parameters = []);
+ public static function patch();
/**
* Module POST method to process submitted data
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
- public static function post(array $parameters = []);
+ public static function post();
/**
* Called after post()
*
* Unknown purpose
*/
- public static function afterpost(array $parameters = []);
+ public static function afterpost();
/**
* Module PUT method to process submitted data
* Extend this method if the module is supposed to process PUT requests.
* Doesn't display any content
*/
- public static function put(array $parameters = []);
+ public static function put();
public static function getClassName(): string;
-
- public static function getParameters(): array;
}
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);
}
/**
*/
class AccountManagementControlDocument extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$output = [
'version' => 1,
*/
class Acctlink extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$addr = trim($_GET['addr'] ?? '');
*/
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();
}
// @TODO: Replace with parameter from router
- $owner = User::getOwnerDataByNick($parameters['nickname']);
+ $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
*/
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();
}
- $owner = User::getOwnerDataByNick($parameters['nickname']);
+ $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
*/
class Inbox extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$postdata = Network::postdata();
$filename = 'failed-activitypub';
}
$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]);
}
- if (!empty($parameters['nickname'])) {
- $user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
+ if (!empty(static::$parameters['nickname'])) {
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
if (!DBA::isResult($user)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
*/
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();
}
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)) {
- 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 {
// 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();
throw new HTTPException\NotFoundException();
}
- $etag = md5($parameters['guid'] . '-' . $item['changed']);
+ $etag = md5(static::$parameters['guid'] . '-' . $item['changed']);
$last_modified = $item['changed'];
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);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
$data = ['@context' => ActivityPub::CONTEXT];
$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',
'TentativeAccept', 'Follow', 'Add'])) {
$data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
- if (!empty($parameters['activity']) && ($parameters['activity'] != 'Create')) {
- $data['type'] = $parameters['activity'];
- $data['id'] = str_replace('/Create', '/' . $parameters['activity'], $data['id']);
+ if (!empty(static::$parameters['activity']) && (static::$parameters['activity'] != 'Create')) {
+ $data['type'] = static::$parameters['activity'];
+ $data['id'] = str_replace('/Create', '/' . static::$parameters['activity'], $data['id']);
}
} else {
throw new HTTPException\NotFoundException();
*/
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();
}
- $owner = User::getOwnerDataByNick($parameters['nickname']);
+ $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
class Details extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
- $addon = Strings::sanitizeFilePathItem($parameters['addon']);
+ $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
$redirect = 'admin/addons/' . $addon;
DI::baseUrl()->redirect($redirect);
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$a = DI::app();
$addons_admin = Addon::getAdminList();
- $addon = Strings::sanitizeFilePathItem($parameters['addon']);
+ $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) {
notice(DI::l10n()->t('Addon not found.'));
Addon::uninstall($addon);
class Index extends BaseAdmin
{
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
// reload active themes
if (!empty($_GET['action'])) {
class Contact extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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];
class Add extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/blocklist/server');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$gservers = [];
class Index extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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');
$blocklistform = [];
class DBSync extends BaseAdmin
{
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$a = DI::app();
- $action = $parameters['action'] ?? '';
- $update = $parameters['update'] ?? 0;
+ $action = static::$parameters['action'] ?? '';
+ $update = static::$parameters['update'] ?? 0;
switch ($action) {
case 'mark':
class Features extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/features');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$features = [];
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
// We list the more common systems by name. The rest is counted as "other"
class Delete extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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');
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 = '';
$item_uri = '';
class Settings extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/logs');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$log_choices = [
LogLevel::ERROR => 'Error',
{
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');
DI::page()->registerFooterScript(Theme::getPathForFile('js/module/admin/logs/view.js'));
->withLimit(self::LIMIT)
->withFilters($filters)
->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);
}
}
class PhpInfo extends BaseAdmin
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAdminAccess();
*/
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
if ($status == 'deferred') {
class Site extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
/* Installed langs */
$lang_choices = DI::l10n()->getAvailableLanguages();
class Storage extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage');
- $storagebackend = trim($parameters['name'] ?? '');
+ $storagebackend = trim(static::$parameters['name'] ?? '');
try {
/** @var ICanConfigureStorage|false $newStorageConfig */
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();
$available_storage_forms = [];
class Summary extends BaseAdmin
{
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$a = DI::app();
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")) {
notice(DI::l10n()->t("Item not found."));
return '';
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")) {
DI::app()->setCurrentTheme($theme);
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
- $theme = Strings::sanitizeFilePathItem($parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (is_file("view/theme/$theme/config.php")) {
require_once "view/theme/$theme/config.php";
if (function_exists('theme_admin_post')) {
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")) {
notice(DI::l10n()->t('Unknown theme.'));
return '';
class Index extends BaseAdmin
{
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
$allowed_themes = Theme::getAllowedList();
class Tos extends BaseAdmin
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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');
return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'),
class Active extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
- $action = $parameters['action'] ?? '';
- $uid = $parameters['uid'] ?? 0;
+ $action = static::$parameters['action'] ?? '';
+ $uid = static::$parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
class Blocked extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/blocked');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
- $action = $parameters['action'] ?? '';
- $uid = $parameters['uid'] ?? 0;
+ $action = static::$parameters['action'] ?? '';
+ $uid = static::$parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
class Create extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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');
return self::getTabsHTML('all') . Renderer::replaceMacros($t, [
class Deleted extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
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);
class Index extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
- $action = $parameters['action'] ?? '';
- $uid = $parameters['uid'] ?? 0;
+ $action = static::$parameters['action'] ?? '';
+ $uid = static::$parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
class Pending extends BaseUsers
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAdminAccess();
DI::baseUrl()->redirect('admin/users/pending');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
- $action = $parameters['action'] ?? '';
- $uid = $parameters['uid'] ?? 0;
+ $action = static::$parameters['action'] ?? '';
+ $uid = static::$parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
*/
class Activity extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
'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 (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) {
+ if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$ok = 'true';
} else {
$ok = 'ok';
}
- DI::apiResponse()->exit('ok', ['ok' => $ok], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
} else {
- DI::apiResponse()->error(500, 'Error adding activity', '', $parameters['extension'] ?? null);
+ DI::apiResponse()->error(500, 'Error adding activity', '', static::$parameters['extension'] ?? null);
}
}
}
*/
class Setseen extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
// return error if id is zero
if (empty($request['id'])) {
$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
if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) {
$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
$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);
}
}
*/
class Index extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
];
}
- DI::apiResponse()->exit('events', ['events' => $items], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('events', ['events' => $items], static::$parameters['extension'] ?? null);
}
}
*/
class Index extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
echo api_call(DI::app());
exit();
*/
class Notification extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
$notifications[] = new ApiNotification($Notify);
}
- if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) {
+ if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$xmlnotes = [];
foreach ($notifications as $notification) {
$xmlnotes[] = ['@attributes' => $notification->toArray()];
$result = false;
}
- DI::apiResponse()->exit('notes', ['note' => $result], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('notes', ['note' => $result], static::$parameters['extension'] ?? null);
}
}
*/
class Delete extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
Item::deleteForUser($condition, $uid);
$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 {
throw new InternalServerErrorException("unknown error on deleting photo from database table");
}
*/
class Delete extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
// return success of deletion or error message
if ($result) {
$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 {
throw new InternalServerErrorException("unknown error - deleting from database failed");
}
*/
class Update extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
// return success of updating or error message
if ($result) {
$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 {
throw new InternalServerErrorException("unknown error - updating in database failed");
}
*/
class Show extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
$profile = self::formatProfile($profile, $profileFields);
$profiles = [];
- if (!empty($parameters['extension']) && ($parameters['extension'] == 'xml')) {
+ if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$profiles['0:profile'] = $profile;
} else {
$profiles[] = $profile;
'profiles' => $profiles
];
- DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], static::$parameters['extension'] ?? null);
}
/**
*/
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);
}
}
*/
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';
} else {
$ok = 'ok';
}
- DI::apiResponse()->exit('ok', ['ok' => $ok], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
}
}
class Accounts extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id']) && empty($parameters['name'])) {
+ if (empty(static::$parameters['id']) && empty(static::$parameters['name'])) {
DI::mstdnError()->UnprocessableEntity();
}
- if (!empty($parameters['id'])) {
- $id = $parameters['id'];
+ if (!empty(static::$parameters['id'])) {
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
} else {
- $contact = Contact::selectFirst(['id'], ['nick' => $parameters['name'], 'uid' => 0]);
+ $contact = Contact::selectFirst(['id'], ['nick' => static::$parameters['name'], 'uid' => 0]);
if (!empty($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();
}
}
*/
class Block extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
DI::mstdnError()->Forbidden();
}
- $cdata = Contact::getPublicAndUserContactID($parameters['id'], $uid);
+ $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
Contact::terminateFriendship($owner, $contact);
Contact::revokeFollow($contact);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
}
}
class FeaturedTags extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
*/
class Follow extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $cid = Contact::follow($parameters['id'], $uid);
+ $cid = Contact::follow(static::$parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
}
class Followers extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$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)) {
self::setBoundaries($follower['relation-cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid);
class Following extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
class IdentityProofs extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
class Lists extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
*/
class Mute extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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());
}
}
*/
class Note extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
'comment' => '',
]);
- $cdata = Contact::getPublicAndUserContactID($parameters['id'], $uid);
+ $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
class Relationships extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Search extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Statuses extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
*/
class Unblock extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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());
}
}
*/
class Unfollow extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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());
}
}
*/
class Unmute extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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());
}
}
*/
class UpdateCredentials extends BaseApi
{
- public static function patch(array $parameters = [])
+ public static function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
class VerifyCredentials extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Announcements extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
class Apps extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function post(array $parameters = [])
+ public static function post()
{
$request = self::getRequest([
'client_name' => '',
*/
class VerifyCredentials extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$application = self::getCurrentApplication();
class Blocks extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
class Bookmarks extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Conversations extends BaseApi
{
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (!empty($parameters['id'])) {
+ if (!empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- DBA::delete('conv', ['id' => $parameters['id'], 'uid' => $uid]);
- DBA::delete('mail', ['convid' => $parameters['id'], 'uid' => $uid]);
+ DBA::delete('conv', ['id' => static::$parameters['id'], 'uid' => $uid]);
+ DBA::delete('mail', ['convid' => static::$parameters['id'], 'uid' => $uid]);
System::jsonExit([]);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Read extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (!empty($parameters['id'])) {
+ if (!empty(static::$parameters['id'])) {
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());
}
}
class CustomEmojis extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
* @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());
class Directory extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/instance/directory/
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$request = self::getRequest([
'offset' => 0, // How many accounts to skip before returning results. Default 0.
class Endorsements extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
System::jsonExit([]);
}
class Favourited extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
*/
class Filters extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
class FollowRequests extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\BadRequestException
* @throws HTTPException\InternalServerErrorException
* @throws HTTPException\NotFoundException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-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);
$uid = self::getCurrentUserID();
- $introduction = DI::intro()->selectOneById($parameters['id'], $uid);
+ $introduction = DI::intro()->selectOneById(static::$parameters['id'], $uid);
$contactId = $introduction->cid;
- switch ($parameters['action']) {
+ switch (static::$parameters['action']) {
case 'authorize':
Contact\Introduction::confirm($introduction);
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
}
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests/
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Instance extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
System::jsonExit(InstanceEntity::get());
}
class Peers extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$return = [];
class Rules extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$rules = [];
$id = 0;
*/
class Lists extends BaseApi
{
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- if (!Group::exists($parameters['id'], $uid)) {
+ if (!Group::exists(static::$parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound();
}
- if (!Group::remove($parameters['id'])) {
+ if (!Group::remove(static::$parameters['id'])) {
DI::mstdnError()->InternalError();
}
System::jsonExit([]);
}
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
System::jsonExit(DI::mstdnList()->createFromGroupId($id));
}
- public static function put(array $parameters = [])
+ public static function put()
{
$request = self::getRequest([
'title' => '', // The title of the list to be updated.
'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();
}
- Group::update($parameters['id'], $request['title']);
+ Group::update(static::$parameters['id'], $request['title']);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
$lists = [];
$groups = Group::getByUserId($uid);
$lists[] = DI::mstdnList()->createFromGroupId($group['id']);
}
} else {
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound();
*/
class Accounts extends BaseApi
{
- public static function delete(array $parameters = [])
+ public static function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
- public static function post(array $parameters = [])
+ public static function post()
{
DI::apiResponse()->unsupported(Router::POST);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}
*/
class Markers extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
*/
class Media extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
}
- public static function put(array $parameters = [])
+ public static function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
'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();
}
- $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'])) {
DI::mstdnError()->RecordNotFound();
}
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
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}
class Mutes extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
class Notifications extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (!empty($parameters['id'])) {
- $id = $parameters['id'];
+ if (!empty(static::$parameters['id'])) {
+ $id = static::$parameters['id'];
try {
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));
*/
class Clear extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
*/
class Dismiss extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $Notification = DI::notification()->selectOneForUser($uid, $parameters['id']);
+ $Notification = DI::notification()->selectOneForUser($uid, static::$parameters['id']);
$Notification->setSeen();
DI::notification()->save($Notification);
class Preferences extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Proofs extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
System::jsonError(404, ['error' => 'Record not found']);
}
*/
class PushSubscription extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
}
- public static function put(array $parameters = [])
+ public static function put()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
}
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
System::jsonExit([]);
}
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
*/
class ScheduledStatuses extends BaseApi
{
- public static function put(array $parameters = [])
+ public static function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
DI::apiResponse()->unsupported(Router::PUT);
}
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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();
}
- Post\Delayed::deleteById($parameters['id']);
+ Post\Delayed::deleteById(static::$parameters['id']);
System::jsonExit([]);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (isset($parameters['id'])) {
- System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($parameters['id'], $uid)->toArray());
+ if (isset(static::$parameters['id'])) {
+ System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId(static::$parameters['id'], $uid)->toArray());
}
$request = self::getRequest([
class Search extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
$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)) {
- $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);
*/
class Statuses extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
DI::mstdnError()->InternalError();
}
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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'])) {
DI::mstdnError()->RecordNotFound();
}
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], $uid));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid));
}
}
*/
class Bookmark extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
class Card extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.'));
class Context extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
'limit' => 40, // Maximum number of results to return. Defaults to 40.
]);
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
$parents = [];
$children = [];
*/
class Favourite extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
class FavouritedBy extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}
*/
class Mute extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Pin extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Reblog extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
class RebloggedBy extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = $parameters['id'];
+ $id = static::$parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}
*/
class Unbookmark extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Unfavourite extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Unmute extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Unpin extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
*/
class Unreblog extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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());
}
}
class Suggestions extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Direct extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class Home extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
class ListTimeline extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$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` = ?)",
- $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $parameters['id']];
+ $uid, GRAVITY_PARENT, GRAVITY_COMMENT, static::$parameters['id']];
if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);
class PublicTimeline extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$uid = self::getCurrentUserID();
class Tag extends BaseApi
{
/**
- * @param array $parameters
* @throws HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty($parameters['hashtag'])) {
+ if (empty(static::$parameters['hashtag'])) {
DI::mstdnError()->UnprocessableEntity();
}
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
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']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
class Trends extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$request = self::getRequest([
'limit' => 20, // Maximum number of results to return. Defaults to 10.
class Unimplemented extends BaseApi
{
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function delete(array $parameters = [])
+ public static function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function patch(array $parameters = [])
+ public static function patch()
{
DI::apiResponse()->unsupported(Router::PATCH);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function post(array $parameters = [])
+ public static function post()
{
DI::apiResponse()->unsupported(Router::POST);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function put(array $parameters = [])
+ public static function put()
{
DI::apiResponse()->unsupported(Router::PUT);
}
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
DI::apiResponse()->unsupported(Router::GET);
}
*/
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 = [
'remaining-hits' => '150',
'@attributes' => ["type" => "integer"],
];
}
- DI::apiResponse()->exit('hash', ['hash' => $hash], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('hash', ['hash' => $hash], static::$parameters['extension'] ?? null);
}
}
const DEFAULT_COUNT = 20;
const MAX_COUNT = 200;
- public static function init(array $parameters = [])
+ public static function init()
{
- parent::init($parameters);
+ parent::init();
self::checkAllowedScope(self::SCOPE_READ);
}
*/
class FollowersIds extends ContactEndpoint
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
*/
class FollowersList extends ContactEndpoint
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
*/
class FriendsIds extends ContactEndpoint
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
*/
class FriendsList extends ContactEndpoint
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
*/
class SavedSearches extends BaseApi
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
DBA::close($terms);
- DI::apiResponse()->exit('terms', ['terms' => $result], $parameters['extension'] ?? null);
+ DI::apiResponse()->exit('terms', ['terms' => $result], static::$parameters['extension'] ?? null);
}
}
*/
class Apps extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
$privateaddons = DI::config()->get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$apps = Nav::getAppMenu();
/**
* Return to user an attached file given the id
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$a = DI::app();
- if (empty($parameters['item'])) {
+ if (empty(static::$parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
- $item_id = intval($parameters['item']);
+ $item_id = intval(static::$parameters['item']);
// Check for existence
$item = MAttach::exists(['id' => $item_id]);
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
self::checkAdminAccess(true);
*/
protected static $request = [];
- public static function delete(array $parameters = [])
+ public static function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function patch(array $parameters = [])
+ public static function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
}
- public static function put(array $parameters = [])
+ public static function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
* Set boundaries for the "link" header
* @param array $boundaries
* @param int $id
- * @return array
*/
protected static function setBoundaries(int $id)
{
*/
abstract public static function getNotifications();
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
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 (DI::args()->get(DI::args()->getArgc() - 1) !== 'json') {
class BaseSettings extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
*/
class Bookmarklet extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$_GET['mode'] = 'minimal';
DI::baseUrl()->redirect($redirectUrl);
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
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()) {
return Login::form($_SERVER['REQUEST_URI']);
*/
class Advanced extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!Session::isAuthenticated()) {
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()]);
if (empty($contact)) {
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()]);
if (empty($contact)) {
class Contacts extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$app = DI::app();
throw new HTTPException\ForbiddenException();
}
- $cid = $parameters['id'];
- $type = $parameters['type'] ?? 'all';
+ $cid = static::$parameters['id'];
+ $type = static::$parameters['type'] ?? 'all';
$accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype);
*/
class Hovercard extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$contact_url = $_REQUEST['url'] ?? '';
*/
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]);
if (empty($contact)) {
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);
}
$activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]);
- $contact_id = intval($parameters['id']);
+ $contact_id = intval(static::$parameters['id']);
if (!$contact_id) {
return self::postReturn(false);
}
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)) {
return self::postReturn(false);
}
return $success;
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
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();
}
- $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)) {
throw new HTTPException\NotFoundException();
}
/** @var array */
private static $contact;
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
- $data = Model\Contact::getPublicAndUserContactID($parameters['id'], local_user());
+ $data = Model\Contact::getPublicAndUserContactID(static::$parameters['id'], local_user());
if (!DBA::isResult($data)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.'));
}
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
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);
if ($result === true) {
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()) {
return Login::form($_SERVER['REQUEST_URI']);
protected static $max_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')) {
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
if (local_user() && DI::config()->get('system', 'community_no_sharer')) {
$path = self::$content;
- if (!empty($parameters['accounttype'])) {
- $path .= '/' . $parameters['accounttype'];
+ if (!empty(static::$parameters['accounttype'])) {
+ $path .= '/' . static::$parameters['accounttype'];
}
$query_parameters = [];
/**
* Computes module parameters from the request and local configuration
*
- * @param array $parameters
* @throws HTTPException\BadRequestException
* @throws HTTPException\ForbiddenException
*/
- protected static function parseRequest(array $parameters)
+ protected static function parseRequest()
{
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('Access denied.'));
}
- self::$accountTypeString = $_GET['accounttype'] ?? $parameters['accounttype'] ?? '';
+ self::$accountTypeString = $_GET['accounttype'] ?? static::$parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
- self::$content = $parameters['content'] ?? '';
+ self::$content = static::$parameters['content'] ?? '';
if (!self::$content) {
if (!empty(DI::config()->get('system', 'singleuser'))) {
// On single user systems only the global page does make sense
/** @var string */
protected static $order;
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form();
}
- self::parseRequest($parameters, $_GET);
+ self::parseRequest($_GET);
$module = 'network';
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', ''));
Session::set('network-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::$network = $get['nets'] ?? '';
- self::$dateFrom = $parameters['from'] ?? '';
- self::$dateTo = $parameters['to'] ?? '';
+ self::$dateFrom = static::$parameters['from'] ?? '';
+ self::$dateTo = static::$parameters['to'] ?? '';
if (DI::mode()->isMobile()) {
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
*/
class Credits extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
/* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt');
*/
class Notify extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
$postdata = Network::postdata();
}
$data = json_decode($postdata);
- if (is_object($data) && !empty($parameters['nickname'])) {
- $user = User::getByNickname($parameters['nickname']);
+ if (is_object($data) && !empty(static::$parameters['nickname'])) {
+ $user = User::getByNickname(static::$parameters['nickname']);
if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}
*/
class Poll extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? '';
- echo OStatus::feed($parameters['nickname'], $last_update, 10);
+ echo OStatus::feed(static::$parameters['nickname'], $last_update, 10);
exit();
}
}
class ActivityPubConversion extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
function visible_whitespace($s)
{
*/
class Babel extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
function visible_whitespace($s)
{
*/
class Feed extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$result = [];
if (!empty($_REQUEST['url'])) {
*/
class ItemBody extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
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.'));
}
- $itemId = intval($parameters['item']);
+ $itemId = intval(static::$parameters['item']);
$item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);
{
static $mod_localtime = '';
- public static function post(array $parameters = [])
+ public static function post()
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
*/
class Probe extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
*/
class WebFinger extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
*/
class Delegation extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
// NOTREACHED
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
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();
}
- $guid = $parameters['guid'];
+ $guid = static::$parameters['guid'];
// Fetch the item
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,
/** @var LoggerInterface */
private static $logger;
- public static function init(array $parameters = [])
+ public static function init()
{
self::$logger = DI::logger();
}
- public static function post(array $parameters = [])
+ public static function post()
{
$enabled = DI::config()->get('system', 'diaspora_enabled', false);
if (!$enabled) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
- if ($parameters['type'] === 'public') {
+ if (static::$parameters['type'] === 'public') {
self::receivePublic();
- } else if ($parameters['type'] === 'users') {
- self::receiveUser($parameters['guid']);
+ } else if (static::$parameters['type'] === 'users') {
+ self::receiveUser(static::$parameters['guid']);
}
}
*/
class Directory extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$app = DI::app();
$config = DI::config();
class Json extends \Friendica\BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException();
*/
class Feed extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
}
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();
}
}
*/
class RemoveTag extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException();
$logger = DI::logger();
- $item_id = $parameters['id'] ?? 0;
+ $item_id = static::$parameters['id'] ?? 0;
$term = XML::unescape(trim($_GET['term'] ?? ''));
$cat = XML::unescape(trim($_GET['cat'] ?? ''));
*/
class SaveTag extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
}
}
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$logger = DI::logger();
$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]);
*/
class FollowConfirm extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
$uid = local_user();
if (!$uid) {
*/
class FriendSuggest extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
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
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
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()]);
if (empty($contact)) {
*/
class Friendica extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$config = DI::config();
]);
}
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (ActivityPub::isRequest()) {
try {
class Group extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
$a = DI::app();
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$change = false;
*/
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
$nickname = DI::app()->getLoggedInUserNickname();
- } elseif (empty($parameters['action'])) {
+ } elseif (empty(static::$parameters['action'])) {
// Show the profile hCard
- $nickname = $parameters['profile'];
+ $nickname = static::$parameters['profile'];
} else {
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
}
class MethodNotAllowed extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.'));
}
class PageNotFound extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.'));
}
*/
class Hashtag extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$result = [];
*/
class Help extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
Nav::setSelected('help');
*/
class Home extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$app = DI::app();
$config = DI::config();
*/
private static $installer;
- public static function init(array $parameters = [])
+ public static function init()
{
$a = DI::app();
self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
}
- public static function post(array $parameters = [])
+ public static function post()
{
$a = DI::app();
$configCache = $a->getConfigCache();
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
$configCache = $a->getConfigCache();
*/
class Invite extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Activity extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
}
- if (empty($parameters['id']) || empty($parameters['verb'])) {
+ if (empty(static::$parameters['id']) || empty(static::$parameters['verb'])) {
throw new HTTPException\BadRequestException();
}
- $verb = $parameters['verb'];
- $itemId = $parameters['id'];
+ $verb = static::$parameters['verb'];
+ $itemId = static::$parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]);
class Compose extends BaseModule
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network';
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form('compose', false);
}
/// @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])) {
switch ($posttype) {
case 'note':
*/
class Follow extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$l10n = DI::l10n();
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval($parameters['id']);
+ $itemId = intval(static::$parameters['id']);
if (!Item::performActivity($itemId, 'follow', local_user())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));
*/
class Ignore extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$l10n = DI::l10n();
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval($parameters['id']);
+ $itemId = intval(static::$parameters['id']);
$dba = DI::dba();
*/
class Pin extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$l10n = DI::l10n();
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval($parameters['id']);
+ $itemId = intval(static::$parameters['id']);
$item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]);
if (!DBA::isResult($item)) {
*/
class Star extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$l10n = DI::l10n();
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty($parameters['id'])) {
+ if (empty(static::$parameters['id'])) {
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]);
*/
class Magic extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
$a = DI::app();
$ret = ['success' => false, 'url' => '', 'message' => ''];
*/
class Maintenance extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$reason = DI::config()->get('system', 'maintenance_reason');
class Manifest extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
*/
class NoScrape extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$a = DI::app();
- if (isset($parameters['nick'])) {
+ if (isset(static::$parameters['nick'])) {
// Get infos about a specific nick (public)
- $which = $parameters['nick'];
- } elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') {
+ $which = static::$parameters['nick'];
+ } elseif (local_user() && isset(static::$parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login)
$which = $a->getLoggedInUserNickname();
} else {
*/
class NodeInfo110 extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
*/
class NodeInfo120 extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
*/
class NodeInfo210 extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
];
}
- public static function content(array $parameters = [])
+ public static function content()
{
Nav::setSelected('introductions');
* @throws \ImagickException
* @throws \Exception
*/
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
}
- $request_id = $parameters['id'] ?? false;
+ $request_id = static::$parameters['id'] ?? false;
if ($request_id) {
$intro = DI::intro()->selectOneById($request_id, local_user());
*
* @throws HTTPException\UnauthorizedException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
* @throws HTTPException\InternalServerErrorException
* @throws \Exception
*/
- public static function content(array $parameters = []): string
+ public static function content(): string
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to show this page.'));
return Login::form();
}
- $request_id = $parameters['id'] ?? false;
+ $request_id = static::$parameters['id'] ?? false;
if ($request_id) {
$Notify = DI::notify()->selectOneById($request_id);
];
}
- public static function content(array $parameters = [])
+ public static function content()
{
Nav::setSelected('notifications');
*/
class Acknowledge extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
DI::session()->set('oauth_acknowledge', true);
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'] ?? '');
private static $oauth_code = '';
/**
- * @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$request = self::getRequest([
'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
self::$oauth_code = $token['code'];
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (empty(self::$oauth_code)) {
return '';
*/
class Revoke extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration
*/
class Token extends BaseApi
{
- public static function post(array $parameters = [])
+ public static function post()
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration
*/
class Oembed extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
// Unused form: /oembed/b2h?url=...
if (DI::args()->getArgv()[1] == 'b2h') {
/**
* @throws \Exception
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
header('Content-type: application/opensearchdescription+xml');
*/
class Owa extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
$ret = [ 'success' => false ];
class ParseUrl extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();
*/
class PermissionTooltip extends \Friendica\BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
- $type = $parameters['type'];
- $referenceId = $parameters['id'];
+ $type = static::$parameters['type'];
+ $referenceId = static::$parameters['id'];
$expectedTypes = ['item', 'photo', 'event'];
if (!in_array($type, $expectedTypes)) {
* Fetch a photo or an avatar, in optional size, check for permissions and
* return the image
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$totalstamp = microtime(true);
$scale = null;
$stamp = microtime(true);
// User avatar
- if (!empty($parameters['type'])) {
- if (!empty($parameters['customsize'])) {
- $customsize = intval($parameters['customsize']);
- $square_resize = !in_array($parameters['type'], ['media', 'preview']);
+ if (!empty(static::$parameters['type'])) {
+ if (!empty(static::$parameters['customsize'])) {
+ $customsize = intval(static::$parameters['customsize']);
+ $square_resize = !in_array(static::$parameters['type'], ['media', 'preview']);
}
- if (!empty($parameters['guid'])) {
- $guid = $parameters['guid'];
+ if (!empty(static::$parameters['guid'])) {
+ $guid = static::$parameters['guid'];
$account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]);
if (empty($account)) {
throw new HTTPException\NotFoundException();
}
// Contact Id Fallback, to remove after version 2021.12
- if (isset($parameters['contact_id'])) {
- $id = intval($parameters['contact_id']);
+ if (isset(static::$parameters['contact_id'])) {
+ $id = intval(static::$parameters['contact_id']);
}
- if (!empty($parameters['nickname_ext'])) {
- $nickname = pathinfo($parameters['nickname_ext'], PATHINFO_FILENAME);
+ if (!empty(static::$parameters['nickname_ext'])) {
+ $nickname = pathinfo(static::$parameters['nickname_ext'], PATHINFO_FILENAME);
$user = User::getByNickname($nickname, ['uid']);
if (empty($user)) {
throw new HTTPException\NotFoundException();
}
// User Id Fallback, to remove after version 2021.12
- if (!empty($parameters['uid_ext'])) {
- $id = intval(pathinfo($parameters['uid_ext'], PATHINFO_FILENAME));
+ if (!empty(static::$parameters['uid_ext'])) {
+ $id = intval(pathinfo(static::$parameters['uid_ext'], PATHINFO_FILENAME));
}
// Please refactor this for the love of everything that's good
- if (isset($parameters['id'])) {
- $id = $parameters['id'];
+ if (isset(static::$parameters['id'])) {
+ $id = static::$parameters['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.'));
}
- $photo = self::getPhotoByid($id, $parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
+ $photo = self::getPhotoByid($id, static::$parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
} else {
- $photoid = pathinfo($parameters['name'], PATHINFO_FILENAME);
+ $photoid = pathinfo(static::$parameters['name'], PATHINFO_FILENAME);
$scale = 0;
if (substr($photoid, -2, 1) == "-") {
$scale = intval(substr($photoid, -1, 1));
class Common extends BaseProfile
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
Nav::setSelected('home');
- $nickname = $parameters['nickname'];
+ $nickname = static::$parameters['nickname'];
$profile = Profile::load($a, $nickname);
if (empty($profile)) {
class Contacts extends Module\BaseProfile
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
$a = DI::app();
- $nickname = $parameters['nickname'];
- $type = $parameters['type'] ?? 'all';
+ $nickname = static::$parameters['nickname'];
+ $type = static::$parameters['type'] ?? 'all';
$profile = Model\Profile::load($a, $nickname);
if (empty($profile)) {
*/
class Index extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
- Profile::rawContent($parameters);
+ Profile::rawContent();
}
- public static function content(array $parameters = [])
+ public static function content()
{
- return Status::content($parameters);
+ return Status::content();
}
}
class Media extends BaseProfile
{
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
- $profile = ProfileModel::load($a, $parameters['nickname']);
+ $profile = ProfileModel::load($a, static::$parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
class Profile extends BaseProfile
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (ActivityPub::isRequest()) {
- $user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
if (DBA::isResult($user)) {
try {
$data = ActivityPub\Transmitter::getProfile($user['uid']);
}
}
- if (DBA::exists('userd', ['username' => $parameters['nickname']])) {
+ if (DBA::exists('userd', ['username' => static::$parameters['nickname']])) {
// Known deleted user
- $data = ActivityPub\Transmitter::getDeletedUser($parameters['nickname']);
+ $data = ActivityPub\Transmitter::getDeletedUser(static::$parameters['nickname']);
System::jsonError(410, $data);
} else {
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
- $profile = ProfileModel::load($a, $parameters['nickname']);
+ $profile = ProfileModel::load($a, static::$parameters['nickname']);
if (!$profile) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Profile not found.'));
}
DI::page()['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
}
- DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $parameters['nickname'], $remote_contact_id);
+ DI::page()['htmlhead'] .= self::buildHtmlHead($profile, static::$parameters['nickname'], $remote_contact_id);
Nav::setSelected('home');
$view_as_contact_alert = DI::l10n()->t(
'You\'re currently viewing your profile as <b>%s</b> <a href="%s" class="btn btn-sm pull-right">Cancel</a>',
htmlentities($view_as_contacts[$key]['name'], ENT_COMPAT, 'UTF-8'),
- 'profile/' . $parameters['nickname'] . '/profile'
+ 'profile/' . static::$parameters['nickname'] . '/profile'
);
}
}
class Schedule extends BaseProfile
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
Post\Delayed::deleteById($_REQUEST['delete']);
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
'$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"),
'$baseurl' => DI::baseUrl()->get(true),
'$title' => DI::l10n()->t('Scheduled Posts'),
- '$nickname' => $parameters['nickname'] ?? '',
+ '$nickname' => static::$parameters['nickname'] ?? '',
'$scheduled_at' => DI::l10n()->t('Scheduled'),
'$content' => DI::l10n()->t('Content'),
'$delete' => DI::l10n()->t('Remove post'),
class Status extends BaseProfile
{
- public static function content(array $parameters = [])
+ public static function content()
{
$args = DI::args();
$a = DI::app();
- $profile = ProfileModel::load($a, $parameters['nickname']);
+ $profile = ProfileModel::load($a, static::$parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
}
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . $parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . static::$parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
$category = $datequery = $datequery2 = '';
/**
* Fetch remote image content
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
- $request = self::getRequestInfo($parameters);
+ $request = self::getRequestInfo();
if (!DI::config()->get('system', 'proxify_content')) {
Logger::notice('Proxy access is forbidden', ['request' => $request, 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'accept' => $_SERVER['HTTP_ACCEPT'] ?? '']);
* ]
* @throws \Exception
*/
- private static function getRequestInfo(array $parameters)
+ private static function getRequestInfo()
{
$size = ProxyUtils::PIXEL_LARGE;
$sizetype = '';
- if (!empty($parameters['url']) && empty($_REQUEST['url'])) {
- $url = $parameters['url'];
+ if (!empty(static::$parameters['url']) && empty($_REQUEST['url'])) {
+ $url = static::$parameters['url'];
// thumb, small, medium and large.
if (substr($url, -6) == ':micro') {
*/
class PublicRSAKey extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
- if (empty($parameters['nick'])) {
+ if (empty(static::$parameters['nick'])) {
throw new BadRequestException();
}
- $nick = $parameters['nick'];
+ $nick = static::$parameters['nick'];
$user = User::getByNickname($nick, ['spubkey']);
if (empty($user) || empty($user['spubkey'])) {
*/
class RandomProfile extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
*/
class ReallySimpleDiscovery extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
header('Content-Type: text/xml');
*
* @return string
*/
- public static function content(array $parameters = [])
+ public static function content()
{
// logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy.
$tpl = $arr['template'];
- $tos = new Tos();
+ $tos = new Tos(static::$parameters);
$o = Renderer::replaceMacros($tpl, [
'$invitations' => DI::config()->get('system', 'invitation_only'),
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
- public static function post(array $parameters = [])
+ public static function post()
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
{
static $owner;
- public static function init(array $parameters = [])
+ public static function init()
{
- self::$owner = User::getOwnerDataByNick($parameters['profile']);
+ self::$owner = User::getOwnerDataByNick(static::$parameters['profile']);
if (!self::$owner) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
DI::page()['aside'] = Widget\VCard::getHTML(self::$owner);
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!empty($_POST['cancel']) || empty($_POST['dfrn_url'])) {
DI::baseUrl()->redirect();
System::externalRedirect($follow_link);
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (empty(self::$owner)) {
return '';
'$submit' => DI::l10n()->t('Submit Request'),
'$cancel' => DI::l10n()->t('Cancel'),
- '$request' => 'remote_follow/' . $parameters['profile'],
+ '$request' => 'remote_follow/' . static::$parameters['profile'],
'$name' => self::$owner['name'],
'$myaddr' => Profile::getMyURL(),
]);
*/
class RobotsTxt extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$allDisalloweds = [
'/settings/',
const TYPE_PRIVATE_MESSAGE = 'm';
const TYPE_ANY_CONTACT = 'a';
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
*/
class Directory extends BaseSearch
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
class Filed extends BaseSearch
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form();
class Index extends BaseSearch
{
- public static function content(array $parameters = [])
+ public static function content()
{
$search = (!empty($_GET['q']) ? trim(rawurldecode($_GET['q'])) : '');
class Saved extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
$action = DI::args()->get(2, 'none');
$search = trim(rawurldecode($_GET['term'] ?? ''));
*/
class Login extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$return_path = $_REQUEST['return_path'] ?? '' ;
return self::form(Session::get('return_path'), intval(DI::config()->get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
}
- public static function post(array $parameters = [])
+ public static function post()
{
$return_path = Session::get('return_path');
Session::clear();
/**
* Process logout requests
*/
- public static function init(array $parameters = [])
+ public static function init()
{
$visitor_home = null;
if (remote_user()) {
*/
class OpenID extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
if (DI::config()->get('system', 'no_openid')) {
DI::baseUrl()->redirect();
*/
class Recovery extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
DI::baseUrl()->redirect();
{
private static $errors = [];
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
DI::baseUrl()->redirect();
*/
class Delegation extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Display extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('settings/display');
}
- public static function content(array $parameters = [])
+ public static function content()
{
- parent::content($parameters);
+ parent::content();
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
class Index extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
DI::baseUrl()->redirect('settings/profile');
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
class Crop extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!Session::isAuthenticated()) {
return;
}
- $photo_prefix = $parameters['guid'];
+ $photo_prefix = static::$parameters['guid'];
$resource_id = $photo_prefix;
$scale = 0;
if (substr($photo_prefix, -2, 1) == '-') {
DI::baseUrl()->redirect($path);
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
parent::content();
- $resource_id = $parameters['guid'];
+ $resource_id = static::$parameters['guid'];
$photos = Photo::selectToArray([], ['resource-id' => $resource_id, 'uid' => local_user()], ['order' => ['scale' => false]]);
if (!DBA::isResult($photos)) {
class Index extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!Session::isAuthenticated()) {
return;
DI::baseUrl()->redirect('settings/profile/photo/crop/' . $resource_id);
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
{
private static $appSpecificPassword = null;
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/app_specific');
}
- parent::content($parameters);
+ parent::content();
$appSpecificPasswords = AppSpecificPassword::getListForUser(local_user());
class Index extends BaseSettings
{
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa');
}
- parent::content($parameters);
+ parent::content();
$has_secret = (bool) DI::pConfig()->get(local_user(), '2fa', 'secret');
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
*/
class Recovery extends BaseSettings
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/recovery');
}
- parent::content($parameters);
+ parent::content();
if (!RecoveryCode::countValidForUser(local_user())) {
RecoveryCode::generateForUser(local_user());
*/
class Trusted extends BaseSettings
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
- public static function content(array $parameters = []): string
+ public static function content(): string
{
- parent::content($parameters);
+ parent::content();
$trustedBrowserRepository = new TwoFactor\Repository\TrustedBrowser(DI::dba(), DI::logger());
$trustedBrowsers = $trustedBrowserRepository->selectAllByUid(local_user());
*/
class Verify extends BaseSettings
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!local_user()) {
return;
}
}
- public static function post(array $parameters = [])
+ public static function post()
{
if (!local_user()) {
return;
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/verify');
}
- parent::content($parameters);
+ parent::content();
$company = 'Friendica';
$holder = Session::get('my_address');
* If there is an action required through the URL / path, react
* accordingly and export the requested data.
*
- * @param array $parameters Router-supplied parameters
* @return string
* @throws HTTPException\ForbiddenException
* @throws HTTPException\InternalServerErrorException
*/
- public static function content(array $parameters = [])
+ public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
- parent::content($parameters);
+ parent::content();
/**
* options shown on "Export personal data" page
* to the browser which then offers a save / open dialog
* to the user.
*
- * @param array $parameters Router-supplied parameters
* @throws HTTPException\ForbiddenException
*/
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
*/
class Smilies extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!empty(DI::args()->getArgv()[1]) && (DI::args()->getArgv()[1] === "json")) {
$smilies = Content\Smilies::getList();
}
}
- public static function content(array $parameters = [])
+ public static function content()
{
$smilies = Content\Smilies::getList();
$count = count($smilies['texts'] ?? []);
class Statistics extends BaseModule
{
- public static function init(array $parameters = [])
+ public static function init()
{
if (!DI::config()->get("system", "nodeinfo")) {
throw new NotFoundException();
}
}
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
$logger = DI::logger();
*/
class Theme extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
header('Content-Type: text/css');
- $theme = Strings::sanitizeFilePathItem($parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (file_exists("view/theme/$theme/theme.php")) {
require_once "view/theme/$theme/theme.php";
*/
class ThemeDetails extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!empty($_REQUEST['theme'])) {
$theme = $_REQUEST['theme'];
*/
class ToggleMobile extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$a = DI::app();
* be properties of the class, however cannot be set directly as the property
* cannot depend on a function result when declaring the variable.
**/
- public function __construct()
+ public function __construct(array $parameters = [])
{
+ parent::__construct($parameters);
+
$this->privacy_operate = DI::l10n()->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
$this->privacy_distribute = DI::l10n()->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
$this->privacy_delete = DI::l10n()->t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseUrl());
* dealings with their own node so a TOS is not necessary.
*
**/
- public static function init(array $parameters = [])
+ public static function init()
{
if (strlen(DI::config()->get('system','singleuser'))) {
DI::baseUrl()->redirect('profile/' . DI::config()->get('system','singleuser'));
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function content(array $parameters = []) {
+ public static function content() {
$tpl = Renderer::getMarkupTemplate('tos.tpl');
if (DI::config()->get('system', 'tosdisplay')) {
return Renderer::replaceMacros($tpl, [
'$privacy_delete' => DI::l10n()->t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseUrl())
]);
} else {
- return;
+ return '';
}
}
}
*/
class Community extends CommunityModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
- self::parseRequest($parameters);
+ self::parseRequest();
$o = '';
if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) {
class Network extends NetworkModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
if (!isset($_GET['p']) || !isset($_GET['item'])) {
exit();
}
- self::parseRequest($parameters, $_GET);
+ self::parseRequest($_GET);
$profile_uid = intval($_GET['p']);
class Profile extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$a = DI::app();
*/
class Welcome extends BaseModule
{
- public static function content(array $parameters = [])
+ public static function content()
{
$config = DI::config();
*/
class HostMeta extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
*/
class NodeInfo extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
self::printWellKnown();
}
*/
class SecurityTxt extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$name = 'security.txt';
$fp = fopen($name, 'rt');
*/
class XSocialRelay extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
$config = DI::config();
*/
class Xrd extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ public static function rawContent()
{
// @TODO: Replace with parameter from router
if (DI::args()->getArgv()[0] == 'xrd') {