Replace $parameters argument per method with static::$parameters

This commit is contained in:
Philipp 2021-11-14 20:46:25 +01:00
parent 018275919c
commit 714f0febc4
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
249 changed files with 710 additions and 775 deletions

View file

@ -36,7 +36,7 @@ use Friendica\Util\Strings;
*/
class Delegation extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -62,9 +62,9 @@ class Delegation extends BaseSettings
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
}
public static function content(array $parameters = [])
public static function content()
{
parent::content($parameters);
parent::content();
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -36,7 +36,7 @@ use Friendica\Network\HTTPException;
*/
class Display extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -112,9 +112,9 @@ class Display extends BaseSettings
DI::baseUrl()->redirect('settings/display');
}
public static function content(array $parameters = [])
public static function content()
{
parent::content($parameters);
parent::content();
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -41,7 +41,7 @@ use Friendica\Util\Temporal;
class Index extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -135,7 +135,7 @@ class Index extends BaseSettings
DI::baseUrl()->redirect('settings/profile');
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));

View file

@ -33,13 +33,13 @@ use Friendica\Network\HTTPException;
class Crop extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!Session::isAuthenticated()) {
return;
}
$photo_prefix = $parameters['guid'];
$photo_prefix = static::$parameters['guid'];
$resource_id = $photo_prefix;
$scale = 0;
if (substr($photo_prefix, -2, 1) == '-') {
@ -160,7 +160,7 @@ class Crop extends BaseSettings
DI::baseUrl()->redirect($path);
}
public static function content(array $parameters = [])
public static function content()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
@ -168,7 +168,7 @@ class Crop extends BaseSettings
parent::content();
$resource_id = $parameters['guid'];
$resource_id = static::$parameters['guid'];
$photos = Photo::selectToArray([], ['resource-id' => $resource_id, 'uid' => local_user()], ['order' => ['scale' => false]]);
if (!DBA::isResult($photos)) {

View file

@ -34,7 +34,7 @@ use Friendica\Util\Strings;
class Index extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!Session::isAuthenticated()) {
return;
@ -106,7 +106,7 @@ class Index extends BaseSettings
DI::baseUrl()->redirect('settings/profile/photo/crop/' . $resource_id);
}
public static function content(array $parameters = [])
public static function content()
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));

View file

@ -36,7 +36,7 @@ class AppSpecific extends BaseSettings
{
private static $appSpecificPassword = null;
public static function init(array $parameters = [])
public static function init()
{
if (!local_user()) {
return;
@ -54,7 +54,7 @@ class AppSpecific extends BaseSettings
}
}
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -97,13 +97,13 @@ class AppSpecific extends BaseSettings
}
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/app_specific');
}
parent::content($parameters);
parent::content();
$appSpecificPasswords = AppSpecificPassword::getListForUser(local_user());

View file

@ -33,7 +33,7 @@ use PragmaRX\Google2FA\Google2FA;
class Index extends BaseSettings
{
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -94,13 +94,13 @@ class Index extends BaseSettings
}
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa');
}
parent::content($parameters);
parent::content();
$has_secret = (bool) DI::pConfig()->get(local_user(), '2fa', 'secret');
$verified = DI::pConfig()->get(local_user(), '2fa', 'verified');

View file

@ -34,7 +34,7 @@ use Friendica\Module\Security\Login;
*/
class Recovery extends BaseSettings
{
public static function init(array $parameters = [])
public static function init()
{
if (!local_user()) {
return;
@ -52,7 +52,7 @@ class Recovery extends BaseSettings
}
}
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -69,13 +69,13 @@ class Recovery extends BaseSettings
}
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/recovery');
}
parent::content($parameters);
parent::content();
if (!RecoveryCode::countValidForUser(local_user())) {
RecoveryCode::generateForUser(local_user());

View file

@ -14,7 +14,7 @@ use UAParser\Parser;
*/
class Trusted extends BaseSettings
{
public static function init(array $parameters = [])
public static function init()
{
if (!local_user()) {
return;
@ -32,7 +32,7 @@ class Trusted extends BaseSettings
}
}
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -64,9 +64,9 @@ class Trusted extends BaseSettings
}
public static function content(array $parameters = []): string
public static function content(): string
{
parent::content($parameters);
parent::content();
$trustedBrowserRepository = new TwoFactor\Repository\TrustedBrowser(DI::dba(), DI::logger());
$trustedBrowsers = $trustedBrowserRepository->selectAllByUid(local_user());

View file

@ -39,7 +39,7 @@ use PragmaRX\Google2FA\Google2FA;
*/
class Verify extends BaseSettings
{
public static function init(array $parameters = [])
public static function init()
{
if (!local_user()) {
return;
@ -58,7 +58,7 @@ class Verify extends BaseSettings
}
}
public static function post(array $parameters = [])
public static function post()
{
if (!local_user()) {
return;
@ -84,13 +84,13 @@ class Verify extends BaseSettings
}
}
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
return Login::form('settings/2fa/verify');
}
parent::content($parameters);
parent::content();
$company = 'Friendica';
$holder = Session::get('my_address');

View file

@ -47,18 +47,17 @@ class UserExport extends BaseSettings
* If there is an action required through the URL / path, react
* accordingly and export the requested data.
*
* @param array $parameters Router-supplied parameters
* @return string
* @throws HTTPException\ForbiddenException
* @throws HTTPException\InternalServerErrorException
*/
public static function content(array $parameters = [])
public static function content()
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
parent::content($parameters);
parent::content();
/**
* options shown on "Export personal data" page
@ -84,10 +83,9 @@ class UserExport extends BaseSettings
* to the browser which then offers a save / open dialog
* to the user.
*
* @param array $parameters Router-supplied parameters
* @throws HTTPException\ForbiddenException
*/
public static function rawContent(array $parameters = [])
public static function rawContent()
{
if (!DI::app()->isLoggedIn()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));