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

View file

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

View file

@ -35,7 +35,14 @@ class LegacyModule extends BaseModule
*
* @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.
@ -43,35 +50,35 @@ class LegacyModule extends BaseModule
* @param string $file_path
* @throws \Exception
*/
public static function setModuleFile($file_path)
private function setModuleFile($file_path)
{
if (!is_readable($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;
}
public function init()
{
self::runModuleFunction('init', static::$parameters);
$this->runModuleFunction('init');
}
public function content(): string
{
return self::runModuleFunction('content', static::$parameters);
return $this->runModuleFunction('content');
}
public function post()
{
self::runModuleFunction('post', static::$parameters);
$this->runModuleFunction('post');
}
public function afterpost()
{
self::runModuleFunction('afterpost', static::$parameters);
$this->runModuleFunction('afterpost');
}
/**
@ -81,15 +88,15 @@ class LegacyModule extends BaseModule
* @return string
* @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)) {
$a = DI::app();
return $function_name($a);
} 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()
{
if (empty(static::$parameters['nickname'])) {
if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
// @TODO: Replace with parameter from router
$owner = User::getOwnerDataByNick(static::$parameters['nickname']);
$owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}

View file

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

View file

@ -50,12 +50,12 @@ class Inbox extends BaseModule
$filename = 'failed-activitypub';
}
$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]);
}
if (!empty(static::$parameters['nickname'])) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
if (!empty($this->parameters['nickname'])) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
if (!DBA::isResult($user)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}

View file

@ -43,7 +43,7 @@ class Objects extends BaseModule
{
public function rawContent()
{
if (empty(static::$parameters['guid'])) {
if (empty($this->parameters['guid'])) {
throw new HTTPException\BadRequestException();
}
@ -51,10 +51,10 @@ class Objects extends BaseModule
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)) {
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 {
// 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();
@ -104,11 +104,11 @@ class Objects extends BaseModule
throw new HTTPException\NotFoundException();
}
$etag = md5(static::$parameters['guid'] . '-' . $item['changed']);
$etag = md5($this->parameters['guid'] . '-' . $item['changed']);
$last_modified = $item['changed'];
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);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
@ -123,16 +123,16 @@ class Objects extends BaseModule
$data = ['@context' => ActivityPub::CONTEXT];
$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',
'TentativeAccept', 'Follow', 'Add'])) {
$data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
if (!empty(static::$parameters['activity']) && (static::$parameters['activity'] != 'Create')) {
$data['type'] = static::$parameters['activity'];
$data['id'] = str_replace('/Create', '/' . static::$parameters['activity'], $data['id']);
if (!empty($this->parameters['activity']) && ($this->parameters['activity'] != 'Create')) {
$data['type'] = $this->parameters['activity'];
$data['id'] = str_replace('/Create', '/' . $this->parameters['activity'], $data['id']);
}
} else {
throw new HTTPException\NotFoundException();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,17 +49,17 @@ class Activity extends BaseApi
'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 (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true';
} else {
$ok = 'ok';
}
DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
DI::apiResponse()->exit('ok', ['ok' => $ok], $this->parameters['extension'] ?? null);
} 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
if (empty($request['id'])) {
$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
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], static::$parameters['extension'] ?? null);
DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
}
// update seen indicator
@ -58,6 +58,6 @@ class Setseen extends BaseApi
$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);
}
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$xmlnotes = [];
foreach ($notifications as $notification) {
$xmlnotes[] = ['@attributes' => $notification->toArray()];
@ -56,6 +56,6 @@ class Notification extends BaseApi
$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);
$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 {
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
if ($result) {
$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 {
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
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], static::$parameters['extension'] ?? null);
DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else {
throw new InternalServerErrorException("unknown error - updating in database failed");
}

View file

@ -49,7 +49,7 @@ class Show extends BaseApi
$profile = self::formatProfile($profile, $profileFields);
$profiles = [];
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$profiles['0:profile'] = $profile;
} else {
$profiles[] = $profile;
@ -65,7 +65,7 @@ class Show extends BaseApi
'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()
{
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()
{
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true';
} else {
$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();
if (empty(static::$parameters['id']) && empty(static::$parameters['name'])) {
if (empty($this->parameters['id']) && empty($this->parameters['name'])) {
DI::mstdnError()->UnprocessableEntity();
}
if (!empty(static::$parameters['id'])) {
$id = static::$parameters['id'];
if (!empty($this->parameters['id'])) {
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
} 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'])) {
$id = $contact['id'];
} elseif (!($id = Contact::getIdForURL(static::$parameters['name'], 0, false))) {
} elseif (!($id = Contact::getIdForURL($this->parameters['name'], 0, false))) {
DI::mstdnError()->RecordNotFound();
}
}

View file

@ -37,7 +37,7 @@ class Block extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
@ -46,7 +46,7 @@ class Block extends BaseApi
DI::mstdnError()->Forbidden();
}
$cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
@ -62,6 +62,6 @@ class Block extends BaseApi
Contact::terminateFriendship($owner, $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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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());
}

View file

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

View file

@ -39,11 +39,11 @@ class Following extends BaseApi
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
@ -72,7 +72,7 @@ class Following extends BaseApi
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

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

View file

@ -36,12 +36,12 @@ class Mute extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
@ -45,13 +45,13 @@ class Note extends BaseApi
'comment' => '',
]);
$cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
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();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}

View file

@ -36,12 +36,12 @@ class Unblock extends BaseApi
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
@ -72,7 +72,7 @@ class Blocks extends BaseApi
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

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

View file

@ -36,12 +36,12 @@ class Read extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (!empty(static::$parameters['id'])) {
if (!empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
$introduction = DI::intro()->selectOneById(static::$parameters['id'], $uid);
$introduction = DI::intro()->selectOneById($this->parameters['id'], $uid);
$contactId = $introduction->cid;
switch (static::$parameters['action']) {
switch ($this->parameters['action']) {
case 'authorize':
Contact\Introduction::confirm($introduction);
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);

View file

@ -36,15 +36,15 @@ class Lists extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
if (!Group::exists(static::$parameters['id'], $uid)) {
if (!Group::exists($this->parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound();
}
if (!Group::remove(static::$parameters['id'])) {
if (!Group::remove($this->parameters['id'])) {
DI::mstdnError()->InternalError();
}
@ -81,11 +81,11 @@ class Lists extends BaseApi
'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();
}
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
$lists = [];
$groups = Group::getByUserId($uid);
@ -105,7 +105,7 @@ class Lists extends BaseApi
$lists[] = DI::mstdnList()->createFromGroupId($group['id']);
}
} else {
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound();

View file

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

View file

@ -39,11 +39,11 @@ class Mutes extends BaseApi
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
@ -72,7 +72,7 @@ class Mutes extends BaseApi
$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)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);

View file

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

View file

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

View file

@ -47,15 +47,15 @@ class ScheduledStatuses extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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();
}
Post\Delayed::deleteById(static::$parameters['id']);
Post\Delayed::deleteById($this->parameters['id']);
System::jsonExit([]);
}
@ -68,8 +68,8 @@ class ScheduledStatuses extends BaseApi
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
if (isset(static::$parameters['id'])) {
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId(static::$parameters['id'], $uid)->toArray());
if (isset($this->parameters['id'])) {
System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray());
}
$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']);
}
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);

View file

@ -212,11 +212,11 @@ class Statuses extends BaseApi
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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'])) {
DI::mstdnError()->RecordNotFound();
}
@ -235,10 +235,10 @@ class Statuses extends BaseApi
{
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -53,6 +53,6 @@ class Bookmark extends BaseApi
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();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->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 : '.'));

View file

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

View file

@ -38,17 +38,17 @@ class Favourite extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}

View file

@ -37,11 +37,11 @@ class Mute extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -50,8 +50,8 @@ class Mute extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -50,8 +50,8 @@ class Pin extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -55,6 +55,6 @@ class Reblog extends BaseApi
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();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$id = static::$parameters['id'];
$id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}

View file

@ -38,11 +38,11 @@ class Unbookmark extends BaseApi
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -53,6 +53,6 @@ class Unbookmark extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -50,8 +50,8 @@ class Unmute extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -50,8 +50,8 @@ class Unpin extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
DI::mstdnError()->RecordNotFound();
}
@ -55,6 +55,6 @@ class Unreblog extends BaseApi
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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
@ -60,7 +60,7 @@ class ListTimeline extends BaseApi
$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, static::$parameters['id']];
$uid, GRAVITY_PARENT, GRAVITY_COMMENT, $this->parameters['id']];
if (!empty($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);
$uid = self::getCurrentUserID();
if (empty(static::$parameters['hashtag'])) {
if (empty($this->parameters['hashtag'])) {
DI::mstdnError()->UnprocessableEntity();
}
@ -69,7 +69,7 @@ class Tag extends BaseApi
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
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']) {
$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()
{
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$hash = [
'remaining-hits' => '150',
'@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);
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()
{
$a = DI::app();
if (empty(static::$parameters['item'])) {
if (empty($this->parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
$item_id = intval(static::$parameters['item']);
$item_id = intval($this->parameters['item']);
// Check for existence
$item = MAttach::exists(['id' => $item_id]);

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@ class Poke extends BaseModule
{
public function post()
{
if (!local_user() || empty(static::$parameters['id'])) {
if (!local_user() || empty($this->parameters['id'])) {
return self::postReturn(false);
}
@ -39,14 +39,14 @@ class Poke extends BaseModule
$activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]);
$contact_id = intval(static::$parameters['id']);
$contact_id = intval($this->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' => 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)) {
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.'));
}
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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)) {
throw new HTTPException\NotFoundException();
}

View file

@ -43,7 +43,7 @@ class Revoke extends BaseModule
return;
}
$data = Model\Contact::getPublicAndUserContactID(static::$parameters['id'], local_user());
$data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], local_user());
if (!DBA::isResult($data)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.'));
}
@ -69,7 +69,7 @@ class Revoke extends BaseModule
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);
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.'));
}
DI::baseUrl()->redirect('contact/' . static::$parameters['id']);
DI::baseUrl()->redirect('contact/' . $this->parameters['id']);
}
public function content(): string

View file

@ -51,7 +51,7 @@ class Community extends BaseModule
public function content(): string
{
self::parseRequest();
$this->parseRequest();
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$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')) {
$path = self::$content;
if (!empty(static::$parameters['accounttype'])) {
$path .= '/' . static::$parameters['accounttype'];
if (!empty($this->parameters['accounttype'])) {
$path .= '/' . $this->parameters['accounttype'];
}
$query_parameters = [];
@ -169,7 +169,7 @@ class Community extends BaseModule
* @throws HTTPException\BadRequestException
* @throws HTTPException\ForbiddenException
*/
protected static function parseRequest()
protected function parseRequest()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
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.'));
}
self::$accountTypeString = $_GET['accounttype'] ?? static::$parameters['accounttype'] ?? '';
self::$accountTypeString = $_GET['accounttype'] ?? $this->parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
self::$content = static::$parameters['content'] ?? '';
self::$content = $this->parameters['content'] ?? '';
if (!self::$content) {
if (!empty(DI::config()->get('system', 'singleuser'))) {
// On single user systems only the global page does make sense

View file

@ -63,7 +63,7 @@ class Network extends BaseModule
return Login::form();
}
self::parseRequest($_GET);
$this->parseRequest($_GET);
$module = 'network';
@ -272,11 +272,11 @@ class Network extends BaseModule
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', ''));
@ -317,13 +317,13 @@ class Network extends BaseModule
Session::set('network-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::$network = $get['nets'] ?? '';
self::$dateFrom = static::$parameters['from'] ?? '';
self::$dateTo = static::$parameters['to'] ?? '';
self::$dateFrom = $this->parameters['from'] ?? '';
self::$dateTo = $this->parameters['to'] ?? '';
if (DI::mode()->isMobile()) {
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);
if (is_object($data) && !empty(static::$parameters['nickname'])) {
$user = User::getByNickname(static::$parameters['nickname']);
if (is_object($data) && !empty($this->parameters['nickname'])) {
$user = User::getByNickname($this->parameters['nickname']);
if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}

View file

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

View file

@ -37,11 +37,11 @@ class ItemBody extends BaseModule
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.'));
}
$itemId = intval(static::$parameters['item']);
$itemId = intval($this->parameters['item']);
$item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);

View file

@ -40,11 +40,11 @@ class Fetch extends BaseModule
{
public function rawContent()
{
if (empty(static::$parameters['guid'])) {
if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException();
}
$guid = static::$parameters['guid'];
$guid = $this->parameters['guid'];
// Fetch the item
$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.'));
}
if (static::$parameters['type'] === 'public') {
if ($this->parameters['type'] === 'public') {
self::receivePublic();
} else if (static::$parameters['type'] === 'users') {
self::receiveUser(static::$parameters['guid']);
} else if ($this->parameters['type'] === 'users') {
self::receiveUser($this->parameters['guid']);
}
}

View file

@ -68,7 +68,7 @@ class Feed extends BaseModule
}
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();
}
}

View file

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

View file

@ -48,7 +48,7 @@ class SaveTag extends BaseModule
$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]);

View file

@ -47,7 +47,7 @@ class FriendSuggest extends BaseModule
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
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
@ -85,7 +85,7 @@ class FriendSuggest extends BaseModule
public function content(): string
{
$cid = intval(static::$parameters['contact']);
$cid = intval($this->parameters['contact']);
$contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {

View file

@ -36,12 +36,12 @@ class HCard extends BaseModule
{
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
$nickname = DI::app()->getLoggedInUserNickname();
} elseif (empty(static::$parameters['action'])) {
} elseif (empty($this->parameters['action'])) {
// Show the profile hCard
$nickname = static::$parameters['profile'];
$nickname = $this->parameters['profile'];
} else {
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
}

View file

@ -44,12 +44,12 @@ class Activity extends BaseModule
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();
}
$verb = static::$parameters['verb'];
$itemId = static::$parameters['id'];
$verb = $this->parameters['verb'];
$itemId = $this->parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]);

View file

@ -64,7 +64,7 @@ class Compose extends BaseModule
}
/// @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])) {
switch ($posttype) {
case 'note':

View file

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

View file

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

View file

@ -43,11 +43,11 @@ class Star extends BaseModule
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
if (empty(static::$parameters['id'])) {
if (empty($this->parameters['id'])) {
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]);

View file

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

View file

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

View file

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

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