Switch `static::$parameters` to `$this->parameters`

This commit is contained in:
Philipp Holzer 2021-11-14 23:19:25 +01:00
parent 489cd0884a
commit 5879535822
Signed by: nupplaPhil
GPG Key ID: 24A7501396EB5432
116 changed files with 321 additions and 314 deletions

View File

@ -182,7 +182,7 @@ class Module
**/ **/
try { try {
$module_class = $router->getModuleClass($args->getCommand()); $module_class = $router->getModuleClass($args->getCommand());
$module_parameters = $router->getModuleParameters(); $module_parameters[] = $router->getModuleParameters();
} catch (MethodNotAllowedException $e) { } catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class; $module_class = MethodNotAllowed::class;
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
@ -195,8 +195,8 @@ class Module
} else { } else {
include_once "addon/{$this->module}/{$this->module}.php"; include_once "addon/{$this->module}/{$this->module}.php";
if (function_exists($this->module . '_module')) { if (function_exists($this->module . '_module')) {
LegacyModule::setModuleFile("addon/{$this->module}/{$this->module}.php"); $module_parameters[] = "addon/{$this->module}/{$this->module}.php";
$module_class = LegacyModule::class; $module_class = LegacyModule::class;
} }
} }
} }
@ -205,15 +205,15 @@ class Module
* We emulate a Module class through the LegacyModule class * We emulate a Module class through the LegacyModule class
*/ */
if (!$module_class && file_exists("mod/{$this->module}.php")) { if (!$module_class && file_exists("mod/{$this->module}.php")) {
LegacyModule::setModuleFile("mod/{$this->module}.php"); $module_parameters[] = "mod/{$this->module}.php";
$module_class = LegacyModule::class; $module_class = LegacyModule::class;
} }
$module_class = $module_class ?: PageNotFound::class; $module_class = $module_class ?: PageNotFound::class;
} }
/** @var ICanHandleRequests $module */ /** @var ICanHandleRequests $module */
$module = $dice->create($module_class, [$module_parameters]); $module = $dice->create($module_class, $module_parameters);
return new Module($this->module, $module, $this->isBackend, $printNotAllowedAddon); return new Module($this->module, $module, $this->isBackend, $printNotAllowedAddon);
} }

View File

@ -37,11 +37,11 @@ use Friendica\Model\User;
abstract class BaseModule implements ICanHandleRequests abstract class BaseModule implements ICanHandleRequests
{ {
/** @var array */ /** @var array */
protected static $parameters = []; protected $parameters = [];
public function __construct(array $parameters = []) public function __construct(array $parameters = [])
{ {
static::$parameters = $parameters; $this->parameters = $parameters;
} }
/** /**

View File

@ -35,7 +35,14 @@ class LegacyModule extends BaseModule
* *
* @var string * @var string
*/ */
private static $moduleName = ''; private $moduleName = '';
public function __construct(string $file_path = '', array $parameters = [])
{
parent::__construct($parameters);
$this->setModuleFile($file_path);
}
/** /**
* The only method that needs to be called, with the module/addon file name. * The only method that needs to be called, with the module/addon file name.
@ -43,35 +50,35 @@ class LegacyModule extends BaseModule
* @param string $file_path * @param string $file_path
* @throws \Exception * @throws \Exception
*/ */
public static function setModuleFile($file_path) private function setModuleFile($file_path)
{ {
if (!is_readable($file_path)) { if (!is_readable($file_path)) {
throw new \Exception(DI::l10n()->t('Legacy module file not found: %s', $file_path)); throw new \Exception(DI::l10n()->t('Legacy module file not found: %s', $file_path));
} }
self::$moduleName = basename($file_path, '.php'); $this->moduleName = basename($file_path, '.php');
require_once $file_path; require_once $file_path;
} }
public function init() public function init()
{ {
self::runModuleFunction('init', static::$parameters); $this->runModuleFunction('init');
} }
public function content(): string public function content(): string
{ {
return self::runModuleFunction('content', static::$parameters); return $this->runModuleFunction('content');
} }
public function post() public function post()
{ {
self::runModuleFunction('post', static::$parameters); $this->runModuleFunction('post');
} }
public function afterpost() public function afterpost()
{ {
self::runModuleFunction('afterpost', static::$parameters); $this->runModuleFunction('afterpost');
} }
/** /**
@ -81,15 +88,15 @@ class LegacyModule extends BaseModule
* @return string * @return string
* @throws \Exception * @throws \Exception
*/ */
private static function runModuleFunction($function_suffix, array $parameters = []) private function runModuleFunction(string $function_suffix)
{ {
$function_name = static::$moduleName . '_' . $function_suffix; $function_name = $this->moduleName . '_' . $function_suffix;
if (\function_exists($function_name)) { if (\function_exists($function_name)) {
$a = DI::app(); $a = DI::app();
return $function_name($a); return $function_name($a);
} else { } else {
return parent::{$function_suffix}($parameters); return parent::{$function_suffix}($this->parameters);
} }
} }
} }

View File

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

View File

@ -33,11 +33,11 @@ class Following extends BaseModule
{ {
public function rawContent() public function rawContent()
{ {
if (empty(static::$parameters['nickname'])) { if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
$owner = User::getOwnerDataByNick(static::$parameters['nickname']); $owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) { if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View File

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

View File

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

View File

@ -33,11 +33,11 @@ class Outbox extends BaseModule
{ {
public function rawContent() public function rawContent()
{ {
if (empty(static::$parameters['nickname'])) { if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
$owner = User::getOwnerDataByNick(static::$parameters['nickname']); $owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) { if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }

View File

@ -34,7 +34,7 @@ class Details extends BaseAdmin
{ {
self::checkAdminAccess(); self::checkAdminAccess();
$addon = Strings::sanitizeFilePathItem(static::$parameters['addon']); $addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
$redirect = 'admin/addons/' . $addon; $redirect = 'admin/addons/' . $addon;
@ -60,7 +60,7 @@ class Details extends BaseAdmin
$addons_admin = Addon::getAdminList(); $addons_admin = Addon::getAdminList();
$addon = Strings::sanitizeFilePathItem(static::$parameters['addon']); $addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) { if (!is_file("addon/$addon/$addon.php")) {
notice(DI::l10n()->t('Addon not found.')); notice(DI::l10n()->t('Addon not found.'));
Addon::uninstall($addon); Addon::uninstall($addon);

View File

@ -36,8 +36,8 @@ class DBSync extends BaseAdmin
$a = DI::app(); $a = DI::app();
$action = static::$parameters['action'] ?? ''; $action = $this->parameters['action'] ?? '';
$update = static::$parameters['update'] ?? 0; $update = $this->parameters['update'] ?? 0;
switch ($action) { switch ($action) {
case 'mark': case 'mark':

View File

@ -33,7 +33,7 @@ class Source extends BaseAdmin
{ {
parent::content(); parent::content();
$guid = basename($_REQUEST['guid'] ?? static::$parameters['guid'] ?? ''); $guid = basename($_REQUEST['guid'] ?? $this->parameters['guid'] ?? '');
$source = ''; $source = '';
$item_uri = ''; $item_uri = '';

View File

@ -42,7 +42,7 @@ class Queue extends BaseAdmin
{ {
parent::content(); parent::content();
$status = static::$parameters['status'] ?? ''; $status = $this->parameters['status'] ?? '';
// get jobs from the workerqueue table // get jobs from the workerqueue table
if ($status == 'deferred') { if ($status == 'deferred') {

View File

@ -37,7 +37,7 @@ class Storage extends BaseAdmin
self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage'); self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage');
$storagebackend = trim(static::$parameters['name'] ?? ''); $storagebackend = trim($this->parameters['name'] ?? '');
try { try {
/** @var ICanConfigureStorage|false $newStorageConfig */ /** @var ICanConfigureStorage|false $newStorageConfig */

View File

@ -34,7 +34,7 @@ class Details extends BaseAdmin
{ {
parent::content(); parent::content();
$theme = Strings::sanitizeFilePathItem(static::$parameters['theme']); $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) { if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t("Item not found.")); notice(DI::l10n()->t("Item not found."));
return ''; return '';

View File

@ -30,7 +30,7 @@ class Embed extends BaseAdmin
{ {
public function init() public function init()
{ {
$theme = Strings::sanitizeFilePathItem(static::$parameters['theme']); $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) { if (is_file("view/theme/$theme/config.php")) {
DI::app()->setCurrentTheme($theme); DI::app()->setCurrentTheme($theme);
} }
@ -40,7 +40,7 @@ class Embed extends BaseAdmin
{ {
self::checkAdminAccess(); self::checkAdminAccess();
$theme = Strings::sanitizeFilePathItem(static::$parameters['theme']); $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) { if (is_file("view/theme/$theme/config.php")) {
require_once "view/theme/$theme/config.php"; require_once "view/theme/$theme/config.php";
if (function_exists('theme_admin_post')) { if (function_exists('theme_admin_post')) {
@ -60,7 +60,7 @@ class Embed extends BaseAdmin
{ {
parent::content(); parent::content();
$theme = Strings::sanitizeFilePathItem(static::$parameters['theme']); $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) { if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t('Unknown theme.')); notice(DI::l10n()->t('Unknown theme.'));
return ''; return '';

View File

@ -52,7 +52,7 @@ class Tos extends BaseAdmin
{ {
parent::content(); parent::content();
$tos = new \Friendica\Module\Tos(static::$parameters); $tos = new \Friendica\Module\Tos($this->parameters);
$t = Renderer::getMarkupTemplate('admin/tos.tpl'); $t = Renderer::getMarkupTemplate('admin/tos.tpl');
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'), '$title' => DI::l10n()->t('Administration'),

View File

@ -64,8 +64,8 @@ class Active extends BaseUsers
{ {
parent::content(); parent::content();
$action = static::$parameters['action'] ?? ''; $action = $this->parameters['action'] ?? '';
$uid = static::$parameters['uid'] ?? 0; $uid = $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View File

@ -65,8 +65,8 @@ class Blocked extends BaseUsers
{ {
parent::content(); parent::content();
$action = static::$parameters['action'] ?? ''; $action = $this->parameters['action'] ?? '';
$uid = static::$parameters['uid'] ?? 0; $uid = $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View File

@ -71,8 +71,8 @@ class Index extends BaseUsers
{ {
parent::content(); parent::content();
$action = static::$parameters['action'] ?? ''; $action = $this->parameters['action'] ?? '';
$uid = static::$parameters['uid'] ?? 0; $uid = $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View File

@ -62,8 +62,8 @@ class Pending extends BaseUsers
{ {
parent::content(); parent::content();
$action = static::$parameters['action'] ?? ''; $action = $this->parameters['action'] ?? '';
$uid = static::$parameters['uid'] ?? 0; $uid = $this->parameters['uid'] ?? 0;
if ($uid) { if ($uid) {
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);

View File

@ -49,17 +49,17 @@ class Activity extends BaseApi
'id' => 0, // Id of the post 'id' => 0, // Id of the post
]); ]);
$res = Item::performActivity($request['id'], static::$parameters['verb'], $uid); $res = Item::performActivity($request['id'], $this->parameters['verb'], $uid);
if ($res) { if ($res) {
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true'; $ok = 'true';
} else { } else {
$ok = 'ok'; $ok = 'ok';
} }
DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('ok', ['ok' => $ok], $this->parameters['extension'] ?? null);
} else { } else {
DI::apiResponse()->error(500, 'Error adding activity', '', static::$parameters['extension'] ?? null); DI::apiResponse()->error(500, 'Error adding activity', '', $this->parameters['extension'] ?? null);
} }
} }
} }

View File

@ -42,13 +42,13 @@ class Setseen extends BaseApi
// return error if id is zero // return error if id is zero
if (empty($request['id'])) { if (empty($request['id'])) {
$answer = ['result' => 'error', 'message' => 'message id not specified']; $answer = ['result' => 'error', 'message' => 'message id not specified'];
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
} }
// error message if specified id is not in database // error message if specified id is not in database
if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) { if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) {
$answer = ['result' => 'error', 'message' => 'message id not in database']; $answer = ['result' => 'error', 'message' => 'message id not in database'];
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
} }
// update seen indicator // update seen indicator
@ -58,6 +58,6 @@ class Setseen extends BaseApi
$answer = ['result' => 'error', 'message' => 'unknown error']; $answer = ['result' => 'error', 'message' => 'unknown error'];
} }
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -70,6 +70,6 @@ class Index extends BaseApi
]; ];
} }
DI::apiResponse()->exit('events', ['events' => $items], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('events', ['events' => $items], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -43,7 +43,7 @@ class Notification extends BaseApi
$notifications[] = new ApiNotification($Notify); $notifications[] = new ApiNotification($Notify);
} }
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$xmlnotes = []; $xmlnotes = [];
foreach ($notifications as $notification) { foreach ($notifications as $notification) {
$xmlnotes[] = ['@attributes' => $notification->toArray()]; $xmlnotes[] = ['@attributes' => $notification->toArray()];
@ -56,6 +56,6 @@ class Notification extends BaseApi
$result = false; $result = false;
} }
DI::apiResponse()->exit('notes', ['note' => $result], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('notes', ['note' => $result], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -64,7 +64,7 @@ class Delete extends BaseApi
Item::deleteForUser($condition, $uid); Item::deleteForUser($condition, $uid);
$result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.']; $result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.'];
DI::apiResponse()->exit('photo_delete', ['$result' => $result], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('photo_delete', ['$result' => $result], $this->parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error on deleting photo from database table"); throw new InternalServerErrorException("unknown error on deleting photo from database table");
} }

View File

@ -67,7 +67,7 @@ class Delete extends BaseApi
// return success of deletion or error message // return success of deletion or error message
if ($result) { if ($result) {
$answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.']; $answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error - deleting from database failed"); throw new InternalServerErrorException("unknown error - deleting from database failed");
} }

View File

@ -59,7 +59,7 @@ class Update extends BaseApi
// return success of updating or error message // return success of updating or error message
if ($result) { if ($result) {
$answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.']; $answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.'];
DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else { } else {
throw new InternalServerErrorException("unknown error - updating in database failed"); throw new InternalServerErrorException("unknown error - updating in database failed");
} }

View File

@ -49,7 +49,7 @@ class Show extends BaseApi
$profile = self::formatProfile($profile, $profileFields); $profile = self::formatProfile($profile, $profileFields);
$profiles = []; $profiles = [];
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$profiles['0:profile'] = $profile; $profiles['0:profile'] = $profile;
} else { } else {
$profiles[] = $profile; $profiles[] = $profile;
@ -65,7 +65,7 @@ class Show extends BaseApi
'profiles' => $profiles 'profiles' => $profiles
]; ];
DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], $this->parameters['extension'] ?? null);
} }
/** /**

View File

@ -31,6 +31,6 @@ class Version extends BaseApi
{ {
public function rawContent() public function rawContent()
{ {
DI::apiResponse()->exit('version', ['version' => '0.9.7'], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -31,12 +31,12 @@ class Test extends BaseApi
{ {
public function rawContent() public function rawContent()
{ {
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true'; $ok = 'true';
} else { } else {
$ok = 'ok'; $ok = 'ok';
} }
DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('ok', ['ok' => $ok], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -39,20 +39,20 @@ class Accounts extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id']) && empty(static::$parameters['name'])) { if (empty($this->parameters['id']) && empty($this->parameters['name'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!empty(static::$parameters['id'])) { if (!empty($this->parameters['id'])) {
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
} else { } else {
$contact = Contact::selectFirst(['id'], ['nick' => static::$parameters['name'], 'uid' => 0]); $contact = Contact::selectFirst(['id'], ['nick' => $this->parameters['name'], 'uid' => 0]);
if (!empty($contact['id'])) { if (!empty($contact['id'])) {
$id = $contact['id']; $id = $contact['id'];
} elseif (!($id = Contact::getIdForURL(static::$parameters['name'], 0, false))) { } elseif (!($id = Contact::getIdForURL($this->parameters['name'], 0, false))) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
} }

View File

@ -37,7 +37,7 @@ class Block extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -46,7 +46,7 @@ class Block extends BaseApi
DI::mstdnError()->Forbidden(); DI::mstdnError()->Forbidden();
} }
$cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid); $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) { if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -62,6 +62,6 @@ class Block extends BaseApi
Contact::terminateFriendship($owner, $contact); Contact::terminateFriendship($owner, $contact);
Contact::revokeFollow($contact); Contact::revokeFollow($contact);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -36,11 +36,11 @@ class Follow extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$cid = Contact::follow(static::$parameters['id'], $uid); $cid = Contact::follow($this->parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
} }

View File

@ -39,11 +39,11 @@ class Followers extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -72,7 +72,7 @@ class Followers extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('contact-relation', ['relation-cid'], $condition, static::$parameters); $followers = DBA::select('contact-relation', ['relation-cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['relation-cid']); self::setBoundaries($follower['relation-cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid);

View File

@ -39,11 +39,11 @@ class Following extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -72,7 +72,7 @@ class Following extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('contact-relation', ['cid'], $condition, static::$parameters); $followers = DBA::select('contact-relation', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View File

@ -40,11 +40,11 @@ class Lists extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

@ -36,12 +36,12 @@ class Mute extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setIgnored(static::$parameters['id'], $uid, true); Contact\User::setIgnored($this->parameters['id'], $uid, true);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -37,7 +37,7 @@ class Note extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -45,13 +45,13 @@ class Note extends BaseApi
'comment' => '', 'comment' => '',
]); ]);
$cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid); $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) { if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]); Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -43,11 +43,11 @@ class Statuses extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

@ -36,12 +36,12 @@ class Unblock extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setBlocked(static::$parameters['id'], $uid, false); Contact\User::setBlocked($this->parameters['id'], $uid, false);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -36,12 +36,12 @@ class Unfollow extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact::unfollow(static::$parameters['id'], $uid); Contact::unfollow($this->parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -36,12 +36,12 @@ class Unmute extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Contact\User::setIgnored(static::$parameters['id'], $uid, false); Contact\User::setIgnored($this->parameters['id'], $uid, false);
System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -39,11 +39,11 @@ class Blocks extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -72,7 +72,7 @@ class Blocks extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters); $followers = DBA::select('user-contact', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View File

@ -36,12 +36,12 @@ class Conversations extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty(static::$parameters['id'])) { if (!empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
DBA::delete('conv', ['id' => static::$parameters['id'], 'uid' => $uid]); DBA::delete('conv', ['id' => $this->parameters['id'], 'uid' => $uid]);
DBA::delete('mail', ['convid' => static::$parameters['id'], 'uid' => $uid]); DBA::delete('mail', ['convid' => $this->parameters['id'], 'uid' => $uid]);
System::jsonExit([]); System::jsonExit([]);
} }

View File

@ -36,12 +36,12 @@ class Read extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty(static::$parameters['id'])) { if (!empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
DBA::update('mail', ['seen' => true], ['convid' => static::$parameters['id'], 'uid' => $uid]); DBA::update('mail', ['seen' => true], ['convid' => $this->parameters['id'], 'uid' => $uid]);
System::jsonExit(DI::mstdnConversation()->CreateFromConvId(static::$parameters['id'])->toArray()); System::jsonExit(DI::mstdnConversation()->CreateFromConvId($this->parameters['id'])->toArray());
} }
} }

View File

@ -47,11 +47,11 @@ class FollowRequests extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW); self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
$introduction = DI::intro()->selectOneById(static::$parameters['id'], $uid); $introduction = DI::intro()->selectOneById($this->parameters['id'], $uid);
$contactId = $introduction->cid; $contactId = $introduction->cid;
switch (static::$parameters['action']) { switch ($this->parameters['action']) {
case 'authorize': case 'authorize':
Contact\Introduction::confirm($introduction); Contact\Introduction::confirm($introduction);
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid); $relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);

View File

@ -36,15 +36,15 @@ class Lists extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!Group::exists(static::$parameters['id'], $uid)) { if (!Group::exists($this->parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
if (!Group::remove(static::$parameters['id'])) { if (!Group::remove($this->parameters['id'])) {
DI::mstdnError()->InternalError(); DI::mstdnError()->InternalError();
} }
@ -81,11 +81,11 @@ class Lists extends BaseApi
'replies_policy' => '', // One of: "followed", "list", or "none". 'replies_policy' => '', // One of: "followed", "list", or "none".
]); ]);
if (empty($request['title']) || empty(static::$parameters['id'])) { if (empty($request['title']) || empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
Group::update(static::$parameters['id'], $request['title']); Group::update($this->parameters['id'], $request['title']);
} }
/** /**
@ -96,7 +96,7 @@ class Lists extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
$lists = []; $lists = [];
$groups = Group::getByUserId($uid); $groups = Group::getByUserId($uid);
@ -105,7 +105,7 @@ class Lists extends BaseApi
$lists[] = DI::mstdnList()->createFromGroupId($group['id']); $lists[] = DI::mstdnList()->createFromGroupId($group['id']);
} }
} else { } else {
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!Group::exists($id, $uid)) { if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();

View File

@ -53,11 +53,11 @@ class Accounts extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) { if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

@ -65,18 +65,18 @@ class Media extends BaseApi
'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0 'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0
]); ]);
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$photo = Photo::selectFirst(['resource-id'], ['id' => static::$parameters['id'], 'uid' => $uid]); $photo = Photo::selectFirst(['resource-id'], ['id' => $this->parameters['id'], 'uid' => $uid]);
if (empty($photo['resource-id'])) { if (empty($photo['resource-id'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]); Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]);
System::jsonExit(DI::mstdnAttachment()->createFromPhoto(static::$parameters['id'])); System::jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id']));
} }
/** /**
@ -87,11 +87,11 @@ class Media extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) { if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

@ -39,11 +39,11 @@ class Mutes extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -72,7 +72,7 @@ class Mutes extends BaseApi
$params['order'] = ['cid']; $params['order'] = ['cid'];
} }
$followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters); $followers = DBA::select('user-contact', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) { while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']); self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View File

@ -45,8 +45,8 @@ class Notifications extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (!empty(static::$parameters['id'])) { if (!empty($this->parameters['id'])) {
$id = static::$parameters['id']; $id = $this->parameters['id'];
try { try {
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]); $notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification)); System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));

View File

@ -37,11 +37,11 @@ class Dismiss extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$Notification = DI::notification()->selectOneForUser($uid, static::$parameters['id']); $Notification = DI::notification()->selectOneForUser($uid, $this->parameters['id']);
$Notification->setSeen(); $Notification->setSeen();
DI::notification()->save($Notification); DI::notification()->save($Notification);

View File

@ -47,15 +47,15 @@ class ScheduledStatuses extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
if (!DBA::exists('delayed-post', ['id' => static::$parameters['id'], 'uid' => $uid])) { if (!DBA::exists('delayed-post', ['id' => $this->parameters['id'], 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Post\Delayed::deleteById(static::$parameters['id']); Post\Delayed::deleteById($this->parameters['id']);
System::jsonExit([]); System::jsonExit([]);
} }
@ -68,8 +68,8 @@ class ScheduledStatuses extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (isset(static::$parameters['id'])) { if (isset($this->parameters['id'])) {
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray());
} }
$request = self::getRequest([ $request = self::getRequest([

View File

@ -73,7 +73,7 @@ class Search extends BaseApi
$result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']); $result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
} }
if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) { if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) {
$result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], static::$parameters['version']); $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']);
} }
System::jsonExit($result); System::jsonExit($result);

View File

@ -212,11 +212,11 @@ class Statuses extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => $uid]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => $uid]);
if (empty($item['id'])) { if (empty($item['id'])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -235,10 +235,10 @@ class Statuses extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid));
} }
} }

View File

@ -38,11 +38,11 @@ class Bookmark extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -53,6 +53,6 @@ class Bookmark extends BaseApi
Item::update(['starred' => true], ['id' => $item['id']]); Item::update(['starred' => true], ['id' => $item['id']]);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -39,11 +39,11 @@ class Card extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.')); throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.'));

View File

@ -39,7 +39,7 @@ class Context extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -47,7 +47,7 @@ class Context extends BaseApi
'limit' => 40, // Maximum number of results to return. Defaults to 40. 'limit' => 40, // Maximum number of results to return. Defaults to 40.
]); ]);
$id = static::$parameters['id']; $id = $this->parameters['id'];
$parents = []; $parents = [];
$children = []; $children = [];

View File

@ -38,17 +38,17 @@ class Favourite extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Item::performActivity($item['id'], 'like', $uid); Item::performActivity($item['id'], 'like', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -39,11 +39,11 @@ class FavouritedBy extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

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

View File

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

View File

@ -40,11 +40,11 @@ class Reblog extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -55,6 +55,6 @@ class Reblog extends BaseApi
Item::performActivity($item['id'], 'announce', $uid); Item::performActivity($item['id'], 'announce', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -39,11 +39,11 @@ class RebloggedBy extends BaseApi
{ {
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$id = static::$parameters['id']; $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) { if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }

View File

@ -38,11 +38,11 @@ class Unbookmark extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -53,6 +53,6 @@ class Unbookmark extends BaseApi
Item::update(['starred' => false], ['id' => $item['id']]); Item::update(['starred' => false], ['id' => $item['id']]);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -38,17 +38,17 @@ class Unfavourite extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
Item::performActivity($item['id'], 'unlike', $uid); Item::performActivity($item['id'], 'unlike', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

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

View File

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

View File

@ -40,11 +40,11 @@ class Unreblog extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
$item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]); $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
@ -55,6 +55,6 @@ class Unreblog extends BaseApi
Item::performActivity($item['id'], 'unannounce', $uid); Item::performActivity($item['id'], 'unannounce', $uid);
System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray()); System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
} }
} }

View File

@ -41,7 +41,7 @@ class ListTimeline extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -60,7 +60,7 @@ class ListTimeline extends BaseApi
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']]; $params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", $condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)",
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, static::$parameters['id']]; $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $this->parameters['id']];
if (!empty($request['max_id'])) { if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]); $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);

View File

@ -42,7 +42,7 @@ class Tag extends BaseApi
self::checkAllowedScope(self::SCOPE_READ); self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID(); $uid = self::getCurrentUserID();
if (empty(static::$parameters['hashtag'])) { if (empty($this->parameters['hashtag'])) {
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
@ -69,7 +69,7 @@ class Tag extends BaseApi
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`)) $condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
static::$parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; $this->parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
if ($request['local']) { if ($request['local']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);

View File

@ -32,7 +32,7 @@ class RateLimitStatus extends BaseApi
{ {
public function rawContent() public function rawContent()
{ {
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) { if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$hash = [ $hash = [
'remaining-hits' => '150', 'remaining-hits' => '150',
'@attributes' => ["type" => "integer"], '@attributes' => ["type" => "integer"],
@ -52,6 +52,6 @@ class RateLimitStatus extends BaseApi
]; ];
} }
DI::apiResponse()->exit('hash', ['hash' => $hash], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('hash', ['hash' => $hash], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -45,6 +45,6 @@ class SavedSearches extends BaseApi
DBA::close($terms); DBA::close($terms);
DI::apiResponse()->exit('terms', ['terms' => $result], static::$parameters['extension'] ?? null); DI::apiResponse()->exit('terms', ['terms' => $result], $this->parameters['extension'] ?? null);
} }
} }

View File

@ -37,11 +37,11 @@ class Attach extends BaseModule
public function rawContent() public function rawContent()
{ {
$a = DI::app(); $a = DI::app();
if (empty(static::$parameters['item'])) { if (empty($this->parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException(); throw new \Friendica\Network\HTTPException\BadRequestException();
} }
$item_id = intval(static::$parameters['item']); $item_id = intval($this->parameters['item']);
// Check for existence // Check for existence
$item = MAttach::exists(['id' => $item_id]); $item = MAttach::exists(['id' => $item_id]);

View File

@ -47,7 +47,7 @@ class Advanced extends BaseModule
public function post() public function post()
{ {
$cid = static::$parameters['id']; $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {
@ -98,7 +98,7 @@ class Advanced extends BaseModule
public function content(): string public function content(): string
{ {
$cid = static::$parameters['id']; $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {

View File

@ -22,8 +22,8 @@ class Contacts extends BaseModule
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
$cid = static::$parameters['id']; $cid = $this->parameters['id'];
$type = static::$parameters['type'] ?? 'all'; $type = $this->parameters['type'] ?? 'all';
$accounttype = $_GET['accounttype'] ?? ''; $accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype); $accounttypeid = User::getAccountTypeByString($accounttype);

View File

@ -36,7 +36,7 @@ class Media extends BaseModule
{ {
public function content(): string public function content(): string
{ {
$cid = static::$parameters['id']; $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid]); $contact = Model\Contact::selectFirst([], ['id' => $cid]);
if (empty($contact)) { if (empty($contact)) {

View File

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

View File

@ -43,7 +43,7 @@ class Revoke extends BaseModule
return; return;
} }
$data = Model\Contact::getPublicAndUserContactID(static::$parameters['id'], local_user()); $data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], local_user());
if (!DBA::isResult($data)) { if (!DBA::isResult($data)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.')); throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.'));
} }
@ -69,7 +69,7 @@ class Revoke extends BaseModule
throw new HTTPException\UnauthorizedException(); throw new HTTPException\UnauthorizedException();
} }
self::checkFormSecurityTokenRedirectOnError('contact/' . static::$parameters['id'], 'contact_revoke'); self::checkFormSecurityTokenRedirectOnError('contact/' . $this->parameters['id'], 'contact_revoke');
$result = Model\Contact::revokeFollow(self::$contact); $result = Model\Contact::revokeFollow(self::$contact);
if ($result === true) { if ($result === true) {
@ -80,7 +80,7 @@ class Revoke extends BaseModule
notice(DI::l10n()->t('Unable to revoke follow, please try again later or contact the administrator.')); notice(DI::l10n()->t('Unable to revoke follow, please try again later or contact the administrator.'));
} }
DI::baseUrl()->redirect('contact/' . static::$parameters['id']); DI::baseUrl()->redirect('contact/' . $this->parameters['id']);
} }
public function content(): string public function content(): string

View File

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

View File

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

View File

@ -47,8 +47,8 @@ class Notify extends BaseModule
} }
$data = json_decode($postdata); $data = json_decode($postdata);
if (is_object($data) && !empty(static::$parameters['nickname'])) { if (is_object($data) && !empty($this->parameters['nickname'])) {
$user = User::getByNickname(static::$parameters['nickname']); $user = User::getByNickname($this->parameters['nickname']);
if (empty($user)) { if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException(); throw new \Friendica\Network\HTTPException\InternalServerErrorException();
} }

View File

@ -33,7 +33,7 @@ class Poll extends BaseModule
{ {
header("Content-type: application/atom+xml"); header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? ''; $last_update = $_GET['last_update'] ?? '';
echo OStatus::feed(static::$parameters['nickname'], $last_update, 10); echo OStatus::feed($this->parameters['nickname'], $last_update, 10);
exit(); exit();
} }
} }

View File

@ -37,11 +37,11 @@ class ItemBody extends BaseModule
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));
} }
if (empty(static::$parameters['item'])) { if (empty($this->parameters['item'])) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.'));
} }
$itemId = intval(static::$parameters['item']); $itemId = intval($this->parameters['item']);
$item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]); $item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);

View File

@ -40,11 +40,11 @@ class Fetch extends BaseModule
{ {
public function rawContent() public function rawContent()
{ {
if (empty(static::$parameters['guid'])) { if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException(); throw new HTTPException\NotFoundException();
} }
$guid = static::$parameters['guid']; $guid = $this->parameters['guid'];
// Fetch the item // Fetch the item
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid, $condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,

View File

@ -51,10 +51,10 @@ class Receive extends BaseModule
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
} }
if (static::$parameters['type'] === 'public') { if ($this->parameters['type'] === 'public') {
self::receivePublic(); self::receivePublic();
} else if (static::$parameters['type'] === 'users') { } else if ($this->parameters['type'] === 'users') {
self::receiveUser(static::$parameters['guid']); self::receiveUser($this->parameters['guid']);
} }
} }

View File

@ -68,7 +68,7 @@ class Feed extends BaseModule
} }
header("Content-type: application/atom+xml; charset=utf-8"); header("Content-type: application/atom+xml; charset=utf-8");
echo ProtocolFeed::atom(static::$parameters['nickname'], $last_update, 10, $type, $nocache, true); echo ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true);
exit(); exit();
} }
} }

View File

@ -41,7 +41,7 @@ class RemoveTag extends BaseModule
$logger = DI::logger(); $logger = DI::logger();
$item_id = static::$parameters['id'] ?? 0; $item_id = $this->parameters['id'] ?? 0;
$term = XML::unescape(trim($_GET['term'] ?? '')); $term = XML::unescape(trim($_GET['term'] ?? ''));
$cat = XML::unescape(trim($_GET['cat'] ?? '')); $cat = XML::unescape(trim($_GET['cat'] ?? ''));

View File

@ -48,7 +48,7 @@ class SaveTag extends BaseModule
$term = XML::unescape(trim($_GET['term'] ?? '')); $term = XML::unescape(trim($_GET['term'] ?? ''));
$item_id = static::$parameters['id'] ?? 0; $item_id = $this->parameters['id'] ?? 0;
$logger->info('filer', ['tag' => $term, 'item' => $item_id]); $logger->info('filer', ['tag' => $term, 'item' => $item_id]);

View File

@ -47,7 +47,7 @@ class FriendSuggest extends BaseModule
public function post() public function post()
{ {
$cid = intval(static::$parameters['contact']); $cid = intval($this->parameters['contact']);
// We do query the "uid" as well to ensure that it is our contact // We do query the "uid" as well to ensure that it is our contact
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) { if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
@ -85,7 +85,7 @@ class FriendSuggest extends BaseModule
public function content(): string public function content(): string
{ {
$cid = intval(static::$parameters['contact']); $cid = intval($this->parameters['contact']);
$contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]); $contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) { if (empty($contact)) {

View File

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

View File

@ -44,12 +44,12 @@ class Activity extends BaseModule
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
if (empty(static::$parameters['id']) || empty(static::$parameters['verb'])) { if (empty($this->parameters['id']) || empty($this->parameters['verb'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$verb = static::$parameters['verb']; $verb = $this->parameters['verb'];
$itemId = static::$parameters['id']; $itemId = $this->parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) { if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]); $item = Post::selectFirst(['network'], ['id' => $itemId]);

View File

@ -64,7 +64,7 @@ class Compose extends BaseModule
} }
/// @TODO Retrieve parameter from router /// @TODO Retrieve parameter from router
$posttype = static::$parameters['type'] ?? Item::PT_ARTICLE; $posttype = $this->parameters['type'] ?? Item::PT_ARTICLE;
if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) { if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) {
switch ($posttype) { switch ($posttype) {
case 'note': case 'note':

View File

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

View File

@ -41,11 +41,11 @@ class Ignore extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval(static::$parameters['id']); $itemId = intval($this->parameters['id']);
$dba = DI::dba(); $dba = DI::dba();

View File

@ -42,11 +42,11 @@ class Pin extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval(static::$parameters['id']); $itemId = intval($this->parameters['id']);
$item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]); $item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {

View File

@ -43,11 +43,11 @@ class Star extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.')); throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
} }
if (empty(static::$parameters['id'])) { if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }
$itemId = intval(static::$parameters['id']); $itemId = intval($this->parameters['id']);
$item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]); $item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]);

View File

@ -39,10 +39,10 @@ class NoScrape extends BaseModule
{ {
$a = DI::app(); $a = DI::app();
if (isset(static::$parameters['nick'])) { if (isset($this->parameters['nick'])) {
// Get infos about a specific nick (public) // Get infos about a specific nick (public)
$which = static::$parameters['nick']; $which = $this->parameters['nick'];
} elseif (local_user() && isset(static::$parameters['profile']) && DI::args()->get(2) == 'view') { } elseif (local_user() && isset($this->parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login) // view infos about a known profile (needs a login)
$which = $a->getLoggedInUserNickname(); $which = $a->getLoggedInUserNickname();
} else { } else {

View File

@ -48,7 +48,7 @@ class Notification extends BaseModule
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
} }
$request_id = static::$parameters['id'] ?? false; $request_id = $this->parameters['id'] ?? false;
if ($request_id) { if ($request_id) {
$intro = DI::intro()->selectOneById($request_id, local_user()); $intro = DI::intro()->selectOneById($request_id, local_user());
@ -108,7 +108,7 @@ class Notification extends BaseModule
return Login::form(); return Login::form();
} }
$request_id = static::$parameters['id'] ?? false; $request_id = $this->parameters['id'] ?? false;
if ($request_id) { if ($request_id) {
$Notify = DI::notify()->selectOneById($request_id); $Notify = DI::notify()->selectOneById($request_id);

View File

@ -17,8 +17,8 @@ class PermissionTooltip extends \Friendica\BaseModule
{ {
public function rawContent() public function rawContent()
{ {
$type = static::$parameters['type']; $type = $this->parameters['type'];
$referenceId = static::$parameters['id']; $referenceId = $this->parameters['id'];
$expectedTypes = ['item', 'photo', 'event']; $expectedTypes = ['item', 'photo', 'event'];
if (!in_array($type, $expectedTypes)) { if (!in_array($type, $expectedTypes)) {

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