mirror of
https://github.com/friendica/friendica
synced 2025-04-24 12:30:10 +00:00
Make $_REQUEST processing independent of sub-calls
- Move HTTPInputData::process() into App::runFrontend() - Pass $_REQUEST (including processed Input) to every Module method - Delete $_POST parameters at Module post() calls because of $_REQUEST
This commit is contained in:
parent
f580d8e5c0
commit
2e4d654c0a
96 changed files with 156 additions and 156 deletions
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Block extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Follow extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Mute extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Note extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unblock extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unfollow extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unmute extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -24,22 +24,19 @@ namespace Friendica\Module\Api\Mastodon\Accounts;
|
|||
use Friendica\App\Router;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Util\HTTPInputData;
|
||||
|
||||
/**
|
||||
* @see https://docs.joinmastodon.org/methods/accounts/
|
||||
*/
|
||||
class UpdateCredentials extends BaseApi
|
||||
{
|
||||
protected function patch()
|
||||
protected function patch(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$data = HTTPInputData::process();
|
||||
Logger::info('Patch data', ['data' => $request]);
|
||||
|
||||
Logger::info('Patch data', ['data' => $data]);
|
||||
|
||||
$this->response->unsupported(Router::PATCH);
|
||||
$this->response->unsupported(Router::PATCH, $request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class Apps extends BaseApi
|
|||
/**
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
$request = $this->getRequest([
|
||||
'client_name' => '',
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Conversations extends BaseApi
|
||||
{
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Read extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,11 +31,11 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Filters extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$this->response->unsupported(Router::POST);
|
||||
$this->response->unsupported(Router::POST, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ class FollowRequests extends BaseApi
|
|||
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#accept-follow
|
||||
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#reject-follow
|
||||
*/
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -31,7 +31,7 @@ use Friendica\Model\Group;
|
|||
*/
|
||||
class Lists extends BaseApi
|
||||
{
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -51,7 +51,7 @@ class Lists extends BaseApi
|
|||
System::jsonExit([]);
|
||||
}
|
||||
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -74,7 +74,7 @@ class Lists extends BaseApi
|
|||
System::jsonExit(DI::mstdnList()->createFromGroupId($id));
|
||||
}
|
||||
|
||||
public function put()
|
||||
public function put(array $request = [])
|
||||
{
|
||||
$request = $this->getRequest([
|
||||
'title' => '', // The title of the list to be updated.
|
||||
|
|
|
@ -34,14 +34,14 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Accounts extends BaseApi
|
||||
{
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::DELETE);
|
||||
$this->response->unsupported(Router::DELETE, $request);
|
||||
}
|
||||
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::POST);
|
||||
$this->response->unsupported(Router::POST, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,11 +31,11 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Markers extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
||||
$this->response->unsupported(Router::POST);
|
||||
$this->response->unsupported(Router::POST, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Media extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -53,7 +53,7 @@ class Media extends BaseApi
|
|||
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
|
||||
}
|
||||
|
||||
public function put()
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Clear extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\ForbiddenException;
|
|||
*/
|
||||
class Dismiss extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Object\Api\Mastodon\Notification;
|
|||
*/
|
||||
class PushSubscription extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -66,7 +66,7 @@ class PushSubscription extends BaseApi
|
|||
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
|
||||
}
|
||||
|
||||
public function put()
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -99,7 +99,7 @@ class PushSubscription extends BaseApi
|
|||
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
|
||||
}
|
||||
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_PUSH);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,15 +33,15 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class ScheduledStatuses extends BaseApi
|
||||
{
|
||||
public function put()
|
||||
public function put(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$this->response->unsupported(Router::PUT);
|
||||
$this->response->unsupported(Router::PUT, $request);
|
||||
}
|
||||
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -41,7 +41,7 @@ use Friendica\Util\Images;
|
|||
*/
|
||||
class Statuses extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
@ -207,7 +207,7 @@ class Statuses extends BaseApi
|
|||
DI::mstdnError()->InternalError();
|
||||
}
|
||||
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Bookmark extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Favourite extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Mute extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Pin extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Reblog extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unbookmark extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unfavourite extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unmute extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unpin extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
|
|||
*/
|
||||
class Unreblog extends BaseApi
|
||||
{
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
|
|
@ -32,33 +32,33 @@ class Unimplemented extends BaseApi
|
|||
/**
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
protected function delete()
|
||||
protected function delete(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::DELETE);
|
||||
$this->response->unsupported(Router::DELETE, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
protected function patch()
|
||||
protected function patch(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::PATCH);
|
||||
$this->response->unsupported(Router::PATCH, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
protected function post(array $request = [], array $post = [])
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::POST);
|
||||
$this->response->unsupported(Router::POST, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function put()
|
||||
public function put(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::PUT);
|
||||
$this->response->unsupported(Router::PUT, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,6 +66,6 @@ class Unimplemented extends BaseApi
|
|||
*/
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
$this->response->unsupported(Router::GET);
|
||||
$this->response->unsupported(Router::GET, $request);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue