mirror of
https://github.com/friendica/friendica
synced 2025-04-22 13:50:12 +00:00
Switch static::$parameters
to $this->parameters
This commit is contained in:
parent
489cd0884a
commit
5879535822
116 changed files with 321 additions and 314 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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([]);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 : '.'));
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']]);
|
||||
|
|
|
@ -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`)"]);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue