mirror of
https://github.com/friendica/friendica
synced 2025-04-19 07:10:11 +00:00
Make BaseModule
a real entity
- Add all dependencies, necessary to run the content (baseUrl, Arguments) - Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule - Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
This commit is contained in:
parent
238613fd01
commit
8bdd90066f
252 changed files with 615 additions and 623 deletions
|
@ -35,7 +35,7 @@ use Friendica\Network\HTTPException;
|
|||
|
||||
class Common extends BaseProfile
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
|
|
|
@ -34,7 +34,7 @@ use Friendica\Network\HTTPException;
|
|||
|
||||
class Contacts extends Module\BaseProfile
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
|
|
|
@ -35,13 +35,13 @@ use Friendica\Core\L10n;
|
|||
*/
|
||||
class Index extends BaseModule
|
||||
{
|
||||
public function rawContent()
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
(new Profile($this->l10n, $this->parameters))->rawContent();
|
||||
(new Profile($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->rawContent();
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
return (new Status($this->l10n, $this->parameters))->content();
|
||||
return (new Status($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->server, $this->parameters))->content();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use Friendica\Network\HTTPException;
|
|||
|
||||
class Media extends BaseProfile
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ use Friendica\Util\Temporal;
|
|||
|
||||
class Profile extends BaseProfile
|
||||
{
|
||||
public function rawContent()
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
if (ActivityPub::isRequest()) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
|
||||
|
@ -73,7 +73,7 @@ class Profile extends BaseProfile
|
|||
}
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ use Friendica\Util\DateTimeFormat;
|
|||
|
||||
class Schedule extends BaseProfile
|
||||
{
|
||||
public function post()
|
||||
protected function post(array $request = [], array $post = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||
|
@ -50,7 +50,7 @@ class Schedule extends BaseProfile
|
|||
Post\Delayed::deleteById($_REQUEST['delete']);
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||
|
|
|
@ -46,7 +46,7 @@ use Friendica\Util\XML;
|
|||
|
||||
class Status extends BaseProfile
|
||||
{
|
||||
public function content(): string
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$args = DI::args();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue