1
0
Fork 0

Make BaseModule methods dynamic

This commit is contained in:
Philipp Holzer 2021-11-14 23:13:47 +01:00
commit 489cd0884a
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
253 changed files with 397 additions and 385 deletions

View file

@ -40,7 +40,7 @@ use Friendica\Protocol\DFRN;
function display_init(App $a)
{
if (ActivityPub::isRequest()) {
Objects::rawContent(['guid' => DI::args()->getArgv()[1] ?? null]);
(new Objects(['guid' => DI::args()->getArgv()[1] ?? null]))->rawContent();
}
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {

View file

@ -122,7 +122,7 @@ function unfollow_process(string $url)
$owner = User::getOwnerDataById($uid);
if (!$owner) {
\Friendica\Module\Security\Logout::init();
(new \Friendica\Module\Security\Logout())->init();
// NOTREACHED
}

View file

@ -297,32 +297,32 @@ class Module
Core\Hook::callAll($this->module . '_mod_init', $placeholder);
$this->module_class::init();
$this->module_class->init();
$profiler->set(microtime(true) - $timestamp, 'init');
if ($server['REQUEST_METHOD'] === Router::DELETE) {
$this->module_class::delete();
$this->module_class->delete();
}
if ($server['REQUEST_METHOD'] === Router::PATCH) {
$this->module_class::patch();
$this->module_class->patch();
}
if ($server['REQUEST_METHOD'] === Router::POST) {
Core\Hook::callAll($this->module . '_mod_post', $post);
$this->module_class::post();
$this->module_class->post();
}
if ($server['REQUEST_METHOD'] === Router::PUT) {
$this->module_class::put();
$this->module_class->put();
}
Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder);
$this->module_class::afterpost();
$this->module_class->afterpost();
// "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff.
$this->module_class::rawContent();
$this->module_class->rawContent();
}
}

View file

@ -350,13 +350,13 @@ class Page implements ArrayAccess
$moduleClass = $module->getClass();
$arr = ['content' => $content];
Hook::callAll( $moduleClass::getClassName() . '_mod_content', $arr);
Hook::callAll( $moduleClass->getClassName() . '_mod_content', $arr);
$content = $arr['content'];
$arr = ['content' => $moduleClass::content()];
Hook::callAll($moduleClass::getClassName() . '_mod_aftercontent', $arr);
$arr = ['content' => $moduleClass->content()];
Hook::callAll($moduleClass->getClassName() . '_mod_aftercontent', $arr);
$content .= $arr['content'];
} catch (HTTPException $e) {
$content = ModuleHTTPException::content($e);
$content = (new ModuleHTTPException())->content($e);
}
// initialise content region

View file

@ -47,14 +47,14 @@ abstract class BaseModule implements ICanHandleRequests
/**
* {@inheritDoc}
*/
public static function init()
public function init()
{
}
/**
* {@inheritDoc}
*/
public static function rawContent()
public function rawContent()
{
// echo '';
// exit;
@ -63,7 +63,7 @@ abstract class BaseModule implements ICanHandleRequests
/**
* {@inheritDoc}
*/
public static function content()
public function content(): string
{
return '';
}
@ -71,21 +71,21 @@ abstract class BaseModule implements ICanHandleRequests
/**
* {@inheritDoc}
*/
public static function delete()
public function delete()
{
}
/**
* {@inheritDoc}
*/
public static function patch()
public function patch()
{
}
/**
* {@inheritDoc}
*/
public static function post()
public function post()
{
// DI::baseurl()->redirect('module');
}
@ -93,19 +93,19 @@ abstract class BaseModule implements ICanHandleRequests
/**
* {@inheritDoc}
*/
public static function afterpost()
public function afterpost()
{
}
/**
* {@inheritDoc}
*/
public static function put()
public function put()
{
}
/** Gets the name of the current class */
public static function getClassName(): string
public function getClassName(): string
{
return static::class;
}

View file

@ -13,7 +13,7 @@ interface ICanHandleRequests
* Extend this method if you need to do any shared processing before both
* content() or post()
*/
public static function init();
public function init();
/**
* Module GET method to display raw content from technical endpoints
@ -21,7 +21,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations.
*/
public static function rawContent();
public function rawContent();
/**
* Module GET method to display any content
@ -29,10 +29,8 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to return any display
* through a GET request. It can be an HTML page through templating or a
* XML feed or a JSON output.
*
* @return string
*/
public static function content();
public function content(): string;
/**
* Module DELETE method to process submitted data
@ -40,7 +38,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process DELETE requests.
* Doesn't display any content
*/
public static function delete();
public function delete();
/**
* Module PATCH method to process submitted data
@ -48,7 +46,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process PATCH requests.
* Doesn't display any content
*/
public static function patch();
public function patch();
/**
* Module POST method to process submitted data
@ -56,14 +54,14 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
public static function post();
public function post();
/**
* Called after post()
*
* Unknown purpose
*/
public static function afterpost();
public function afterpost();
/**
* Module PUT method to process submitted data
@ -71,7 +69,7 @@ interface ICanHandleRequests
* Extend this method if the module is supposed to process PUT requests.
* Doesn't display any content
*/
public static function put();
public function put();
public static function getClassName(): string;
public function getClassName(): string;
}

View file

@ -54,22 +54,22 @@ class LegacyModule extends BaseModule
require_once $file_path;
}
public static function init()
public function init()
{
self::runModuleFunction('init', static::$parameters);
}
public static function content()
public function content(): string
{
return self::runModuleFunction('content', static::$parameters);
}
public static function post()
public function post()
{
self::runModuleFunction('post', static::$parameters);
}
public static function afterpost()
public function afterpost()
{
self::runModuleFunction('afterpost', static::$parameters);
}

View file

@ -30,7 +30,7 @@ use Friendica\BaseModule;
*/
class AccountManagementControlDocument extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$output = [
'version' => 1,

View file

@ -30,7 +30,7 @@ use Friendica\Model\Contact;
*/
class Acctlink extends BaseModule
{
public static function content()
public function content(): string
{
$addr = trim($_GET['addr'] ?? '');
@ -41,5 +41,7 @@ class Acctlink extends BaseModule
exit();
}
}
return '';
}
}

View file

@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Followers extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -31,7 +31,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Following extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Network;
*/
class Inbox extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$postdata = Network::postdata();

View file

@ -41,7 +41,7 @@ use Friendica\Util\Strings;
*/
class Objects extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (empty(static::$parameters['guid'])) {
throw new HTTPException\BadRequestException();

View file

@ -31,7 +31,7 @@ use Friendica\Util\HTTPSignature;
*/
class Outbox extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (empty(static::$parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();

View file

@ -30,7 +30,7 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -52,7 +52,7 @@ class Details extends BaseAdmin
DI::baseUrl()->redirect($redirect);
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Index extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -32,7 +32,7 @@ use Friendica\Util\Network;
class Contact extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -76,7 +76,7 @@ class Contact extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/contact');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -32,7 +32,7 @@ use GuzzleHttp\Psr7\Uri;
class Add extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -66,7 +66,7 @@ class Add extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/server');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -27,7 +27,7 @@ use Friendica\Module\BaseAdmin;
class Index extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -56,7 +56,7 @@ class Index extends BaseAdmin
DI::baseUrl()->redirect('admin/blocklist/server');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseAdmin;
class DBSync extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Features extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -60,7 +60,7 @@ class Features extends BaseAdmin
DI::baseUrl()->redirect('admin/features');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\BaseAdmin;
class Federation extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Util\Strings;
class Delete extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -55,7 +55,7 @@ class Delete extends BaseAdmin
DI::baseUrl()->redirect('admin/item/delete');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Module\BaseAdmin;
class Source extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -29,7 +29,7 @@ use Psr\Log\LogLevel;
class Settings extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -56,7 +56,7 @@ class Settings extends BaseAdmin
DI::baseUrl()->redirect('admin/logs');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -31,7 +31,7 @@ class View extends BaseAdmin
{
const LIMIT = 500;
public static function content()
public function content(): string
{
parent::content();

View file

@ -25,7 +25,7 @@ use Friendica\Module\BaseAdmin;
class PhpInfo extends BaseAdmin
{
public static function rawContent()
public function rawContent()
{
self::checkAdminAccess();

View file

@ -38,7 +38,7 @@ use Friendica\Util\DateTimeFormat;
*/
class Queue extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -43,7 +43,7 @@ require_once __DIR__ . '/../../../boot.php';
class Site extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -384,7 +384,7 @@ class Site extends BaseAdmin
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -31,7 +31,7 @@ use Friendica\Util\Strings;
class Storage extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -91,7 +91,7 @@ class Storage extends BaseAdmin
DI::baseUrl()->redirect('admin/storage');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -37,7 +37,7 @@ use Friendica\Util\DateTimeFormat;
class Summary extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Util\Strings;
class Details extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Util\Strings;
class Embed extends BaseAdmin
{
public static function init()
public function init()
{
$theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
if (is_file("view/theme/$theme/config.php")) {
@ -36,7 +36,7 @@ class Embed extends BaseAdmin
}
}
public static function post()
public function post()
{
self::checkAdminAccess();
@ -56,7 +56,7 @@ class Embed extends BaseAdmin
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -29,7 +29,7 @@ use Friendica\Util\Strings;
class Index extends BaseAdmin
{
public static function content()
public function content(): string
{
parent::content();

View file

@ -27,7 +27,7 @@ use Friendica\Module\BaseAdmin;
class Tos extends BaseAdmin
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -48,7 +48,7 @@ class Tos extends BaseAdmin
DI::baseUrl()->redirect('admin/tos');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Active extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -60,7 +60,7 @@ class Active extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -31,7 +31,7 @@ use Friendica\Util\Temporal;
class Blocked extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -61,7 +61,7 @@ class Blocked extends BaseUsers
DI::baseUrl()->redirect('admin/users/blocked');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -28,7 +28,7 @@ use Friendica\Module\Admin\BaseUsers;
class Create extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -51,7 +51,7 @@ class Create extends BaseUsers
DI::baseUrl()->redirect('admin/users/create');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Deleted extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -44,7 +44,7 @@ class Deleted extends BaseUsers
DI::baseUrl()->redirect('admin/users/deleted');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -30,7 +30,7 @@ use Friendica\Module\Admin\BaseUsers;
class Index extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -67,7 +67,7 @@ class Index extends BaseUsers
DI::baseUrl()->redirect(DI::args()->getQueryString());
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -33,7 +33,7 @@ use Friendica\Util\Temporal;
class Pending extends BaseUsers
{
public static function post()
public function post()
{
self::checkAdminAccess();
@ -58,7 +58,7 @@ class Pending extends BaseUsers
DI::baseUrl()->redirect('admin/users/pending');
}
public static function content()
public function content(): string
{
parent::content();

View file

@ -40,7 +40,7 @@ use Friendica\Module\BaseApi;
*/
class Activity extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/
class Setseen extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/
class Index extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
*/
class Index extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
}
public static function rawContent()
public function rawContent()
{
echo api_call(DI::app());
exit();

View file

@ -31,7 +31,7 @@ use Friendica\Object\Api\Friendica\Notification as ApiNotification;
*/
class Notification extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/
class Delete extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/
class Delete extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
*/
class Update extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class Show extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -29,7 +29,7 @@ use Friendica\DI;
*/
class Version extends BaseApi
{
public static function rawContent()
public function rawContent()
{
DI::apiResponse()->exit('version', ['version' => '0.9.7'], static::$parameters['extension'] ?? null);
}

View file

@ -29,7 +29,7 @@ use Friendica\DI;
*/
class Test extends BaseApi
{
public static function rawContent()
public function rawContent()
{
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$ok = 'true';

View file

@ -35,7 +35,7 @@ class Accounts extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Block extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class FeaturedTags extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Follow extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Followers extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Following extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class IdentityProofs extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);

View file

@ -35,7 +35,7 @@ class Lists extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Mute extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Note extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Relationships extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class Search extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -39,7 +39,7 @@ class Statuses extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Unblock extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Unfollow extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Unmute extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Util\HTTPInputData;
*/
class UpdateCredentials extends BaseApi
{
public static function patch()
public function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class VerifyCredentials extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class Announcements extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);

View file

@ -35,7 +35,7 @@ class Apps extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function post()
public function post()
{
$request = self::getRequest([
'client_name' => '',

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/
class VerifyCredentials extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$application = self::getCurrentApplication();

View file

@ -34,7 +34,7 @@ class Blocks extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class Bookmarks extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Conversations extends BaseApi
{
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -49,7 +49,7 @@ class Conversations extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Read extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class CustomEmojis extends BaseApi
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests#pending-follows
*/
public static function rawContent()
public function rawContent()
{
$emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());

View file

@ -39,7 +39,7 @@ class Directory extends BaseApi
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/instance/directory/
*/
public static function rawContent()
public function rawContent()
{
$request = self::getRequest([
'offset' => 0, // How many accounts to skip before returning results. Default 0.

View file

@ -32,7 +32,7 @@ class Endorsements extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
System::jsonExit([]);
}

View file

@ -37,7 +37,7 @@ class Favourited extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Filters extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
@ -41,7 +41,7 @@ class Filters extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);

View file

@ -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
*/
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
@ -82,7 +82,7 @@ class FollowRequests extends BaseApi
* @throws \ImagickException
* @see https://docs.joinmastodon.org/methods/accounts/follow_requests/
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ class Instance extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
System::jsonExit(InstanceEntity::get());
}

View file

@ -36,7 +36,7 @@ class Peers extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$return = [];

View file

@ -36,7 +36,7 @@ class Rules extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$rules = [];
$id = 0;

View file

@ -31,7 +31,7 @@ use Friendica\Model\Group;
*/
class Lists extends BaseApi
{
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -51,7 +51,7 @@ class Lists extends BaseApi
System::jsonExit([]);
}
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -74,7 +74,7 @@ class Lists extends BaseApi
System::jsonExit(DI::mstdnList()->createFromGroupId($id));
}
public static function put()
public function put()
{
$request = self::getRequest([
'title' => '', // The title of the list to be updated.
@ -91,7 +91,7 @@ class Lists extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -35,12 +35,12 @@ use Friendica\Module\BaseApi;
*/
class Accounts extends BaseApi
{
public static function delete()
public function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
public static function post()
public function post()
{
DI::apiResponse()->unsupported(Router::POST);
}
@ -48,7 +48,7 @@ class Accounts extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class Markers extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
@ -41,7 +41,7 @@ class Markers extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Media extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -53,7 +53,7 @@ class Media extends BaseApi
System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
}
public static function put()
public function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -82,7 +82,7 @@ class Media extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Mutes extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -40,7 +40,7 @@ class Notifications extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -30,7 +30,7 @@ use Friendica\Module\BaseApi;
*/
class Clear extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException\ForbiddenException;
*/
class Dismiss extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Preferences extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ class Proofs extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
System::jsonError(404, ['error' => 'Record not found']);
}

View file

@ -33,7 +33,7 @@ use Friendica\Object\Api\Mastodon\Notification;
*/
class PushSubscription extends BaseApi
{
public static function post()
public function post()
{
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 static function put()
public function put()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
@ -99,7 +99,7 @@ class PushSubscription extends BaseApi
return DI::mstdnSubscription()->createForApplicationIdAndUserId($application['id'], $uid)->toArray();
}
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();
@ -112,7 +112,7 @@ class PushSubscription extends BaseApi
System::jsonExit([]);
}
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ use Friendica\Module\BaseApi;
*/
class ScheduledStatuses extends BaseApi
{
public static function put()
public function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -42,7 +42,7 @@ class ScheduledStatuses extends BaseApi
DI::apiResponse()->unsupported(Router::PUT);
}
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -63,7 +63,7 @@ class ScheduledStatuses extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -40,7 +40,7 @@ class Search extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -41,7 +41,7 @@ use Friendica\Util\Images;
*/
class Statuses extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
@ -207,7 +207,7 @@ class Statuses extends BaseApi
DI::mstdnError()->InternalError();
}
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
@ -231,7 +231,7 @@ class Statuses extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/
class Bookmark extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Card extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Context extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/
class Favourite extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class FavouritedBy extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Mute extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Pin extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
*/
class Reblog extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class RebloggedBy extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/
class Unbookmark extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -33,7 +33,7 @@ use Friendica\Module\BaseApi;
*/
class Unfavourite extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Unmute extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Unpin extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ use Friendica\Module\BaseApi;
*/
class Unreblog extends BaseApi
{
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Suggestions extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -35,7 +35,7 @@ class Direct extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class Home extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -36,7 +36,7 @@ class ListTimeline extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -39,7 +39,7 @@ class PublicTimeline extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$uid = self::getCurrentUserID();

View file

@ -37,7 +37,7 @@ class Tag extends BaseApi
/**
* @throws HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -34,7 +34,7 @@ class Trends extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$request = self::getRequest([
'limit' => 20, // Maximum number of results to return. Defaults to 10.

View file

@ -33,7 +33,7 @@ class Unimplemented extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function delete()
public function delete()
{
DI::apiResponse()->unsupported(Router::DELETE);
}
@ -41,7 +41,7 @@ class Unimplemented extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function patch()
public function patch()
{
DI::apiResponse()->unsupported(Router::PATCH);
}
@ -49,7 +49,7 @@ class Unimplemented extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function post()
public function post()
{
DI::apiResponse()->unsupported(Router::POST);
}
@ -57,7 +57,7 @@ class Unimplemented extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function put()
public function put()
{
DI::apiResponse()->unsupported(Router::PUT);
}
@ -65,7 +65,7 @@ class Unimplemented extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
DI::apiResponse()->unsupported(Router::GET);
}

View file

@ -30,7 +30,7 @@ use Friendica\Util\DateTimeFormat;
*/
class RateLimitStatus extends BaseApi
{
public static function rawContent()
public function rawContent()
{
if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
$hash = [

View file

@ -35,7 +35,7 @@ abstract class ContactEndpoint extends BaseApi
const DEFAULT_COUNT = 20;
const MAX_COUNT = 200;
public static function init()
public function init()
{
parent::init();

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/
class FollowersIds extends ContactEndpoint
{
public static function rawContent()
public function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/
class FollowersList extends ContactEndpoint
{
public static function rawContent()
public function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/
class FriendsIds extends ContactEndpoint
{
public static function rawContent()
public function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
*/
class FriendsList extends ContactEndpoint
{
public static function rawContent()
public function rawContent()
{
// Expected value for user_id parameter: public/user contact id
$contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);

View file

@ -31,7 +31,7 @@ use Friendica\Module\BaseApi;
*/
class SavedSearches extends BaseApi
{
public static function rawContent()
public function rawContent()
{
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -31,7 +31,7 @@ use Friendica\DI;
*/
class Apps extends BaseModule
{
public static function init()
public function init()
{
$privateaddons = DI::config()->get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
@ -39,7 +39,7 @@ class Apps extends BaseModule
}
}
public static function content()
public function content(): string
{
$apps = Nav::getAppMenu();

View file

@ -34,7 +34,7 @@ class Attach extends BaseModule
/**
* Return to user an attached file given the id
*/
public static function rawContent()
public function rawContent()
{
$a = DI::app();
if (empty(static::$parameters['item'])) {

View file

@ -68,7 +68,7 @@ abstract class BaseAdmin extends BaseModule
}
}
public static function content()
public function content(): string
{
self::checkAdminAccess(true);

View file

@ -53,7 +53,7 @@ class BaseApi extends BaseModule
*/
protected static $request = [];
public static function delete()
public function delete()
{
self::checkAllowedScope(self::SCOPE_WRITE);
@ -62,7 +62,7 @@ class BaseApi extends BaseModule
}
}
public static function patch()
public function patch()
{
self::checkAllowedScope(self::SCOPE_WRITE);
@ -71,7 +71,7 @@ class BaseApi extends BaseModule
}
}
public static function post()
public function post()
{
self::checkAllowedScope(self::SCOPE_WRITE);
@ -80,7 +80,7 @@ class BaseApi extends BaseModule
}
}
public static function put()
public function put()
{
self::checkAllowedScope(self::SCOPE_WRITE);

View file

@ -82,7 +82,7 @@ abstract class BaseNotifications extends BaseModule
*/
abstract public static function getNotifications();
public static function init()
public function init()
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -94,7 +94,7 @@ abstract class BaseNotifications extends BaseModule
self::$showAll = ($_REQUEST['show'] ?? '') === 'all';
}
public static function rawContent()
public function rawContent()
{
// If the last argument of the query is NOT json, return
if (DI::args()->get(DI::args()->getArgc() - 1) !== 'json') {

View file

@ -28,7 +28,7 @@ use Friendica\DI;
class BaseSettings extends BaseModule
{
public static function content()
public function content(): string
{
$a = DI::app();
@ -125,5 +125,7 @@ class BaseSettings extends BaseModule
'$class' => 'settings-widget',
'$items' => $tabs,
]);
return '';
}
}

View file

@ -34,7 +34,7 @@ use Friendica\Util\Strings;
*/
class Bookmarklet extends BaseModule
{
public static function content()
public function content(): string
{
$_GET['mode'] = 'minimal';

View file

@ -96,7 +96,7 @@ class Contact extends BaseModule
DI::baseUrl()->redirect($redirectUrl);
}
public static function post()
public function post()
{
if (!local_user()) {
return;
@ -226,7 +226,7 @@ class Contact extends BaseModule
Model\Contact\User::setIgnored($contact_id, local_user(), $ignored);
}
public static function content($update = 0)
public function content($update = 0): string
{
if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']);

View file

@ -38,14 +38,14 @@ use Friendica\Util\Strings;
*/
class Advanced extends BaseModule
{
public static function init()
public function init()
{
if (!Session::isAuthenticated()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
}
}
public static function post()
public function post()
{
$cid = static::$parameters['id'];
@ -96,7 +96,7 @@ class Advanced extends BaseModule
return;
}
public static function content()
public function content(): string
{
$cid = static::$parameters['id'];

View file

@ -14,7 +14,7 @@ use Friendica\Network\HTTPException;
class Contacts extends BaseModule
{
public static function content()
public function content(): string
{
$app = DI::app();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Strings;
*/
class Hovercard extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$contact_url = $_REQUEST['url'] ?? '';

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException\BadRequestException;
*/
class Media extends BaseModule
{
public static function content()
public function content(): string
{
$cid = static::$parameters['id'];

View file

@ -18,7 +18,7 @@ use Friendica\Util\XML;
class Poke extends BaseModule
{
public static function post()
public function post()
{
if (!local_user() || empty(static::$parameters['id'])) {
return self::postReturn(false);
@ -123,7 +123,7 @@ class Poke extends BaseModule
return $success;
}
public static function content()
public function content(): string
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));

View file

@ -37,7 +37,7 @@ class Revoke extends BaseModule
/** @var array */
private static $contact;
public static function init()
public function init()
{
if (!local_user()) {
return;
@ -63,7 +63,7 @@ class Revoke extends BaseModule
}
}
public static function post()
public function post()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException();
@ -83,7 +83,7 @@ class Revoke extends BaseModule
DI::baseUrl()->redirect('contact/' . static::$parameters['id']);
}
public static function content(): string
public function content(): string
{
if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']);

View file

@ -49,7 +49,7 @@ class Community extends BaseModule
protected static $max_id;
protected static $item_id;
public static function content()
public function content(): string
{
self::parseRequest();

View file

@ -57,7 +57,7 @@ class Network extends BaseModule
/** @var string */
protected static $order;
public static function content()
public function content(): string
{
if (!local_user()) {
return Login::form();

View file

@ -32,7 +32,7 @@ use Friendica\DI;
*/
class Credits extends BaseModule
{
public static function content()
public function content(): string
{
/* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt');

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/
class Notify extends BaseModule
{
public static function post()
public function post()
{
$postdata = Network::postdata();

View file

@ -29,7 +29,7 @@ use Friendica\Protocol\OStatus;
*/
class Poll extends BaseModule
{
public static function rawContent()
public function rawContent()
{
header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? '';

View file

@ -34,7 +34,7 @@ use Friendica\Util\XML;
class ActivityPubConversion extends BaseModule
{
public static function content()
public function content(): string
{
function visible_whitespace($s)
{

View file

@ -35,7 +35,7 @@ use Friendica\Util\XML;
*/
class Babel extends BaseModule
{
public static function content()
public function content(): string
{
function visible_whitespace($s)
{

View file

@ -32,7 +32,7 @@ use Friendica\Protocol;
*/
class Feed extends BaseModule
{
public static function init()
public function init()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
@ -40,7 +40,7 @@ class Feed extends BaseModule
}
}
public static function content()
public function content(): string
{
$result = [];
if (!empty($_REQUEST['url'])) {

View file

@ -31,7 +31,7 @@ use Friendica\Network\HTTPException;
*/
class ItemBody extends BaseModule
{
public static function content()
public function content(): string
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));

View file

@ -31,7 +31,7 @@ class Localtime extends BaseModule
{
static $mod_localtime = '';
public static function post()
public function post()
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
@ -42,7 +42,7 @@ class Localtime extends BaseModule
}
}
public static function content()
public function content(): string
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';

View file

@ -32,7 +32,7 @@ use Friendica\Network\Probe as NetworkProbe;
*/
class Probe extends BaseModule
{
public static function content()
public function content(): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));

View file

@ -31,7 +31,7 @@ use Friendica\Network\Probe;
*/
class WebFinger extends BaseModule
{
public static function content()
public function content(): string
{
if (!local_user()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));

View file

@ -37,7 +37,7 @@ use Friendica\Util\Proxy;
*/
class Delegation extends BaseModule
{
public static function post()
public function post()
{
if (!local_user()) {
return;
@ -112,7 +112,7 @@ class Delegation extends BaseModule
// NOTREACHED
}
public static function content()
public function content(): string
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -38,7 +38,7 @@ use Friendica\Util\Strings;
*/
class Fetch extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (empty(static::$parameters['guid'])) {
throw new HTTPException\NotFoundException();

View file

@ -38,12 +38,12 @@ class Receive extends BaseModule
/** @var LoggerInterface */
private static $logger;
public static function init()
public function init()
{
self::$logger = DI::logger();
}
public static function post()
public function post()
{
$enabled = DI::config()->get('system', 'diaspora_enabled', false);
if (!$enabled) {

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/
class Directory extends BaseModule
{
public static function content()
public function content(): string
{
$app = DI::app();
$config = DI::config();

View file

@ -13,7 +13,7 @@ use Friendica\Util\Temporal;
class Json extends \Friendica\BaseModule
{
public static function rawContent()
public function rawContent()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException();

View file

@ -41,7 +41,7 @@ use Friendica\Protocol\Feed as ProtocolFeed;
*/
class Feed extends BaseModule
{
public static function content()
public function content(): string
{
$a = DI::app();

View file

@ -33,7 +33,7 @@ use Friendica\Util\XML;
*/
class RemoveTag extends BaseModule
{
public static function content()
public function content(): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException();
@ -62,7 +62,7 @@ class RemoveTag extends BaseModule
if ($item_id && strlen($term)) {
$item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
if (!DBA::isResult($item)) {
return;
return '';
}
if (!Post\Category::deleteFileByURIId($item['uri-id'], local_user(), $type, $term)) {
notice(DI::l10n()->t('Item was not removed'));
@ -74,5 +74,7 @@ class RemoveTag extends BaseModule
if ($type == Post\Category::FILE) {
DI::baseUrl()->redirect('filed?file=' . rawurlencode($term));
}
return '';
}
}

View file

@ -34,7 +34,7 @@ use Friendica\Util\XML;
*/
class SaveTag extends BaseModule
{
public static function init()
public function init()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
@ -42,7 +42,7 @@ class SaveTag extends BaseModule
}
}
public static function rawContent()
public function rawContent()
{
$logger = DI::logger();

View file

@ -10,7 +10,7 @@ use Friendica\Model\Contact;
*/
class FollowConfirm extends BaseModule
{
public static function post()
public function post()
{
$uid = local_user();
if (!$uid) {

View file

@ -38,14 +38,14 @@ use Friendica\Worker\Delivery;
*/
class FriendSuggest extends BaseModule
{
public static function init()
public function init()
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
}
}
public static function post()
public function post()
{
$cid = intval(static::$parameters['contact']);
@ -83,7 +83,7 @@ class FriendSuggest extends BaseModule
info(DI::l10n()->t('Friend suggestion sent.'));
}
public static function content()
public function content(): string
{
$cid = intval(static::$parameters['contact']);

View file

@ -38,7 +38,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Friendica extends BaseModule
{
public static function content()
public function content(): string
{
$config = DI::config();
@ -110,7 +110,7 @@ class Friendica extends BaseModule
]);
}
public static function rawContent()
public function rawContent()
{
if (ActivityPub::isRequest()) {
try {

View file

@ -32,7 +32,7 @@ require_once 'boot.php';
class Group extends BaseModule
{
public static function post()
public function post()
{
$a = DI::app();
@ -138,7 +138,7 @@ class Group extends BaseModule
}
}
public static function content()
public function content(): string
{
$change = false;

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class HCard extends BaseModule
{
public static function content()
public function content(): string
{
if ((local_user()) && (static::$parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user

View file

@ -27,7 +27,7 @@ use Friendica\Network\HTTPException;
class MethodNotAllowed extends BaseModule
{
public static function content()
public function content(): string
{
throw new HTTPException\MethodNotAllowedException(DI::l10n()->t('Method Not Allowed.'));
}

View file

@ -27,7 +27,7 @@ use Friendica\Network\HTTPException;
class PageNotFound extends BaseModule
{
public static function content()
public function content(): string
{
throw new HTTPException\NotFoundException(DI::l10n()->t('Page not found.'));
}

View file

@ -31,7 +31,7 @@ use Friendica\Util\Strings;
*/
class Hashtag extends BaseModule
{
public static function content()
public function content(): string
{
$result = [];
@ -47,5 +47,7 @@ class Hashtag extends BaseModule
DBA::close($taglist);
System::jsonExit($result);
return '';
}
}

View file

@ -32,7 +32,7 @@ use Friendica\Network\HTTPException;
*/
class Help extends BaseModule
{
public static function content()
public function content(): string
{
Nav::setSelected('help');

View file

@ -32,7 +32,7 @@ use Friendica\Module\Security\Login;
*/
class Home extends BaseModule
{
public static function content()
public function content(): string
{
$app = DI::app();
$config = DI::config();

View file

@ -65,7 +65,7 @@ class Install extends BaseModule
*/
private static $installer;
public static function init()
public function init()
{
$a = DI::app();
@ -94,7 +94,7 @@ class Install extends BaseModule
self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
}
public static function post()
public function post()
{
$a = DI::app();
$configCache = $a->getConfigCache();
@ -177,7 +177,7 @@ class Install extends BaseModule
}
}
public static function content()
public function content(): string
{
$a = DI::app();
$configCache = $a->getConfigCache();

View file

@ -35,7 +35,7 @@ use Friendica\Util\Strings;
*/
class Invite extends BaseModule
{
public static function post()
public function post()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -124,7 +124,7 @@ class Invite extends BaseModule
info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
}
public static function content()
public function content(): string
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -38,7 +38,7 @@ use Friendica\Network\HTTPException;
*/
class Activity extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();

View file

@ -40,7 +40,7 @@ use Friendica\Util\Temporal;
class Compose extends BaseModule
{
public static function post()
public function post()
{
if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network';
@ -51,7 +51,7 @@ class Compose extends BaseModule
}
}
public static function content()
public function content(): string
{
if (!local_user()) {
return Login::form('compose', false);

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class Follow extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$l10n = DI::l10n();

View file

@ -33,7 +33,7 @@ use Friendica\Network\HTTPException;
*/
class Ignore extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$l10n = DI::l10n();

View file

@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
*/
class Pin extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$l10n = DI::l10n();

View file

@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
*/
class Star extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$l10n = DI::l10n();

View file

@ -39,7 +39,7 @@ use Friendica\Util\Strings;
*/
class Magic extends BaseModule
{
public static function init()
public function init()
{
$a = DI::app();
$ret = ['success' => false, 'url' => '', 'message' => ''];

View file

@ -34,7 +34,7 @@ use Friendica\Util\Strings;
*/
class Maintenance extends BaseModule
{
public static function content()
public function content(): string
{
$reason = DI::config()->get('system', 'maintenance_reason');

View file

@ -27,7 +27,7 @@ use Friendica\DI;
class Manifest extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$config = DI::config();

View file

@ -35,7 +35,7 @@ use Friendica\Model\User;
*/
class NoScrape extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$a = DI::app();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/
class NodeInfo110 extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$config = DI::config();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/
class NodeInfo120 extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$config = DI::config();

View file

@ -33,7 +33,7 @@ use Friendica\Model\Nodeinfo;
*/
class NodeInfo210 extends BaseModule
{
public static function rawContent()
public function rawContent()
{
$config = DI::config();

View file

@ -55,7 +55,7 @@ class Introductions extends BaseNotifications
];
}
public static function content()
public function content(): string
{
Nav::setSelected('introductions');

View file

@ -42,7 +42,7 @@ class Notification extends BaseModule
* @throws \ImagickException
* @throws \Exception
*/
public static function post()
public function post()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
@ -73,7 +73,7 @@ class Notification extends BaseModule
*
* @throws HTTPException\UnauthorizedException
*/
public static function rawContent()
public function rawContent()
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
@ -101,7 +101,7 @@ class Notification extends BaseModule
* @throws HTTPException\InternalServerErrorException
* @throws \Exception
*/
public static function content(): string
public function content(): string
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to show this page.'));

View file

@ -82,7 +82,7 @@ class Notifications extends BaseNotifications
];
}
public static function content()
public function content(): string
{
Nav::setSelected('notifications');

View file

@ -30,13 +30,13 @@ use Friendica\Module\BaseApi;
*/
class Acknowledge extends BaseApi
{
public static function post()
public function post()
{
DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path'));
}
public static function content()
public function content(): string
{
DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');

View file

@ -37,7 +37,7 @@ class Authorize extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent()
public function rawContent()
{
$request = self::getRequest([
'force_login' => '', // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
@ -97,7 +97,7 @@ class Authorize extends BaseApi
self::$oauth_code = $token['code'];
}
public static function content()
public function content(): string
{
if (empty(self::$oauth_code)) {
return '';

View file

@ -32,7 +32,7 @@ use Friendica\Module\BaseApi;
*/
class Revoke extends BaseApi
{
public static function post()
public function post()
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration

View file

@ -34,7 +34,7 @@ use Friendica\Security\OAuth;
*/
class Token extends BaseApi
{
public static function post()
public function post()
{
$request = self::getRequest([
'client_id' => '', // Client ID, obtained during app registration

View file

@ -37,7 +37,7 @@ use Friendica\Util\Strings;
*/
class Oembed extends BaseModule
{
public static function content()
public function content(): string
{
// Unused form: /oembed/b2h?url=...
if (DI::args()->getArgv()[1] == 'b2h') {

View file

@ -36,7 +36,7 @@ class OpenSearch extends BaseModule
/**
* @throws \Exception
*/
public static function rawContent()
public function rawContent()
{
header('Content-type: application/opensearchdescription+xml');

View file

@ -44,7 +44,7 @@ use Friendica\Util\Strings;
*/
class Owa extends BaseModule
{
public static function init()
public function init()
{
$ret = [ 'success' => false ];

View file

@ -31,7 +31,7 @@ use Friendica\Util;
class ParseUrl extends BaseModule
{
public static function rawContent()
public function rawContent()
{
if (!Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();

View file

@ -15,7 +15,7 @@ use Friendica\Network\HTTPException;
*/
class PermissionTooltip extends \Friendica\BaseModule
{
public static function rawContent()
public function rawContent()
{
$type = static::$parameters['type'];
$referenceId = static::$parameters['id'];

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