diff --git a/mod/update_contact.php b/mod/update_contact.php index 1f96dab25..bea33b484 100644 --- a/mod/update_contact.php +++ b/mod/update_contact.php @@ -14,7 +14,7 @@ function update_contact_content(App $a) echo "
"; if ($_GET["force"] == 1) { - $text = Contact::content(true); + $text = Contact::content([], true); } else { $text = ''; } diff --git a/mod/update_profile.php b/mod/update_profile.php index 720567039..85ca3d3c9 100644 --- a/mod/update_profile.php +++ b/mod/update_profile.php @@ -28,7 +28,7 @@ function update_profile_content(App $a) { * on the client side and then swap the image back. */ - $text = Profile::content($profile_uid); + $text = Profile::content([], $profile_uid); if (PConfig::get(local_user(), "system", "bandwidth_saver")) { $replace = "
".L10n::t("[Embedded content - reload page to view]")."
"; diff --git a/src/App/Page.php b/src/App/Page.php index ea94f9cfe..de75db32f 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -308,7 +308,7 @@ class Page implements ArrayAccess $arr = ['content' => $content]; Hook::callAll($moduleClass . '_mod_content', $arr); $content = $arr['content']; - $arr = ['content' => call_user_func([$moduleClass, 'content'])]; + $arr = ['content' => call_user_func([$moduleClass, 'content'], [])]; Hook::callAll($moduleClass . '_mod_aftercontent', $arr); $content .= $arr['content']; } catch (HTTPException $e) { diff --git a/src/BaseModule.php b/src/BaseModule.php index 5185771d1..be53289e5 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -22,7 +22,7 @@ abstract class BaseModule extends BaseObject * Extend this method if you need to do any shared processing before both * content() or post() */ - public static function init() + public static function init(array $parameters = []) { } @@ -32,7 +32,7 @@ abstract class BaseModule extends BaseObject * Extend this method if the module is supposed to return communication data, * e.g. from protocol implementations. */ - public static function rawContent() + public static function rawContent(array $parameters = []) { // echo ''; // exit; @@ -47,7 +47,7 @@ abstract class BaseModule extends BaseObject * * @return string */ - public static function content() + public static function content(array $parameters = []) { $o = ''; @@ -60,7 +60,7 @@ abstract class BaseModule extends BaseObject * Extend this method if the module is supposed to process POST requests. * Doesn't display any content */ - public static function post() + public static function post(array $parameters = []) { // $a = self::getApp(); // $a->internalRedirect('module'); @@ -71,9 +71,8 @@ abstract class BaseModule extends BaseObject * * Unknown purpose */ - public static function afterpost() + public static function afterpost(array $parameters = []) { - } /* diff --git a/src/LegacyModule.php b/src/LegacyModule.php index a0b23a541..950f8faad 100644 --- a/src/LegacyModule.php +++ b/src/LegacyModule.php @@ -35,24 +35,24 @@ class LegacyModule extends BaseModule require_once $file_path; } - public static function init() + public static function init(array $parameters = []) { - self::runModuleFunction('init'); + self::runModuleFunction('init', $parameters); } - public static function content() + public static function content(array $parameters = []) { - return self::runModuleFunction('content'); + return self::runModuleFunction('content', $parameters); } - public static function post() + public static function post(array $parameters = []) { - self::runModuleFunction('post'); + self::runModuleFunction('post', $parameters); } - public static function afterpost() + public static function afterpost(array $parameters = []) { - self::runModuleFunction('afterpost'); + self::runModuleFunction('afterpost', $parameters); } /** @@ -62,7 +62,7 @@ class LegacyModule extends BaseModule * @return string * @throws \Exception */ - private static function runModuleFunction($function_suffix) + private static function runModuleFunction($function_suffix, array $parameters = []) { $function_name = static::$moduleName . '_' . $function_suffix; @@ -70,7 +70,7 @@ class LegacyModule extends BaseModule $a = self::getApp(); return $function_name($a); } else { - return parent::{$function_suffix}(); + return parent::{$function_suffix}($parameters); } } } diff --git a/src/Module/AccountManagementControlDocument.php b/src/Module/AccountManagementControlDocument.php index 2e2a9e496..8e7ee0243 100644 --- a/src/Module/AccountManagementControlDocument.php +++ b/src/Module/AccountManagementControlDocument.php @@ -11,7 +11,7 @@ use Friendica\BaseModule; */ class AccountManagementControlDocument extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $output = [ 'version' => 1, diff --git a/src/Module/Acctlink.php b/src/Module/Acctlink.php index 1c2500a22..a3577da32 100644 --- a/src/Module/Acctlink.php +++ b/src/Module/Acctlink.php @@ -11,7 +11,7 @@ use Friendica\Core\System; */ class Acctlink extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $addr = trim($_GET['addr'] ?? ''); diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index 1965102f0..a196e7834 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -11,9 +11,9 @@ use Friendica\Util\Strings; class Details extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); $a = self::getApp(); @@ -35,9 +35,9 @@ class Details extends BaseAdminModule $a->internalRedirect('admin/addons'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php index eed47defb..f327f0dc9 100644 --- a/src/Module/Admin/Addons/Index.php +++ b/src/Module/Admin/Addons/Index.php @@ -9,9 +9,9 @@ use Friendica\Module\BaseAdminModule; class Index extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Blocklist/Contact.php b/src/Module/Admin/Blocklist/Contact.php index bf1c7bc08..38ae23371 100644 --- a/src/Module/Admin/Blocklist/Contact.php +++ b/src/Module/Admin/Blocklist/Contact.php @@ -11,9 +11,9 @@ use Friendica\Model; class Contact extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); $contact_url = $_POST['contact_url'] ?? ''; $block_reason = $_POST['contact_block_reason'] ?? ''; @@ -41,9 +41,9 @@ class Contact extends BaseAdminModule self::getApp()->internalRedirect('admin/blocklist/contact'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Blocklist/Server.php b/src/Module/Admin/Blocklist/Server.php index 384e346b0..53647e64e 100644 --- a/src/Module/Admin/Blocklist/Server.php +++ b/src/Module/Admin/Blocklist/Server.php @@ -10,9 +10,9 @@ use Friendica\Util\Strings; class Server extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); if (empty($_POST['page_blocklist_save']) && empty($_POST['page_blocklist_edit'])) { return; @@ -50,9 +50,9 @@ class Server extends BaseAdminModule self::getApp()->internalRedirect('admin/blocklist/server'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php index 4c29eea34..0d68a5648 100644 --- a/src/Module/Admin/DBSync.php +++ b/src/Module/Admin/DBSync.php @@ -12,9 +12,9 @@ use Friendica\Module\BaseAdminModule; class DBSync extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index 328e7e68b..85683d238 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -10,9 +10,9 @@ use Friendica\Module\BaseAdminModule; class Features extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features'); @@ -42,9 +42,9 @@ class Features extends BaseAdminModule self::getApp()->internalRedirect('admin/features'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $arr = []; $features = Feature::get(false); diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php index 8776f21e1..35afb2144 100644 --- a/src/Module/Admin/Federation.php +++ b/src/Module/Admin/Federation.php @@ -10,9 +10,9 @@ use Friendica\Module\BaseAdminModule; class Federation extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu // social and statusnet nodes this node is knowing diff --git a/src/Module/Admin/Item/Delete.php b/src/Module/Admin/Item/Delete.php index 766e65c9a..f5f4687ce 100644 --- a/src/Module/Admin/Item/Delete.php +++ b/src/Module/Admin/Item/Delete.php @@ -10,9 +10,9 @@ use Friendica\Util\Strings; class Delete extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); if (empty($_POST['page_deleteitem_submit'])) { return; @@ -36,9 +36,9 @@ class Delete extends BaseAdminModule self::getApp()->internalRedirect('admin/item/delete'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $t = Renderer::getMarkupTemplate('admin/item/delete.tpl'); diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php index 6da9eec6d..9c41e60f4 100644 --- a/src/Module/Admin/Item/Source.php +++ b/src/Module/Admin/Item/Source.php @@ -13,9 +13,9 @@ use Friendica\Module\BaseAdminModule; class Source extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index be060e053..42f3435f6 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -11,9 +11,9 @@ use Psr\Log\LogLevel; class Settings extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); if (!empty($_POST['page_logs'])) { parent::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs'); @@ -37,9 +37,9 @@ class Settings extends BaseAdminModule self::getApp()->internalRedirect('admin/logs'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Logs/View.php b/src/Module/Admin/Logs/View.php index b66a6781e..51e083473 100644 --- a/src/Module/Admin/Logs/View.php +++ b/src/Module/Admin/Logs/View.php @@ -10,9 +10,9 @@ use Friendica\Util\Strings; class View extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $t = Renderer::getMarkupTemplate('admin/logs/view.tpl'); $f = Config::get('system', 'logfile'); diff --git a/src/Module/Admin/PhpInfo.php b/src/Module/Admin/PhpInfo.php index b912117dc..3ac742181 100644 --- a/src/Module/Admin/PhpInfo.php +++ b/src/Module/Admin/PhpInfo.php @@ -6,9 +6,9 @@ use Friendica\Module\BaseAdminModule; class PhpInfo extends BaseAdminModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { - parent::rawContent(); + parent::rawContent($parameters); phpinfo(); exit(); diff --git a/src/Module/Admin/Queue.php b/src/Module/Admin/Queue.php index aadd5b768..9ce44ff15 100644 --- a/src/Module/Admin/Queue.php +++ b/src/Module/Admin/Queue.php @@ -19,9 +19,9 @@ use Friendica\Util\DateTimeFormat; */ class Queue extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 18a1cbf2a..4a02e98b8 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -21,9 +21,9 @@ require_once __DIR__ . '/../../../boot.php'; class Site extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site'); @@ -412,9 +412,9 @@ class Site extends BaseAdminModule $a->internalRedirect('admin/site' . $active_panel); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index cfd9aa984..e10533ee9 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -20,9 +20,9 @@ use Friendica\Util\Network; class Summary extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php index 3750e9607..912adc429 100644 --- a/src/Module/Admin/Themes/Details.php +++ b/src/Module/Admin/Themes/Details.php @@ -11,9 +11,9 @@ use Friendica\Util\Strings; class Details extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); $a = self::getApp(); @@ -39,9 +39,9 @@ class Details extends BaseAdminModule } } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 904d9eb46..70a12dadd 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -9,7 +9,7 @@ use Friendica\Util\Strings; class Embed extends BaseAdminModule { - public static function init() + public static function init(array $parameters = []) { $a = self::getApp(); @@ -23,9 +23,9 @@ class Embed extends BaseAdminModule } } - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); $a = self::getApp(); @@ -53,9 +53,9 @@ class Embed extends BaseAdminModule } } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php index af2d1f28e..8f7843e29 100644 --- a/src/Module/Admin/Themes/Index.php +++ b/src/Module/Admin/Themes/Index.php @@ -11,9 +11,9 @@ use Friendica\Util\Strings; class Index extends BaseAdminModule { - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php index 4eb6e3426..6fbdc21e8 100644 --- a/src/Module/Admin/Tos.php +++ b/src/Module/Admin/Tos.php @@ -9,9 +9,9 @@ use Friendica\Module\BaseAdminModule; class Tos extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos'); @@ -32,9 +32,9 @@ class Tos extends BaseAdminModule self::getApp()->internalRedirect('admin/tos'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $tos = new \Friendica\Module\Tos(); $t = Renderer::getMarkupTemplate('admin/tos.tpl'); diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php index a949c9331..84332c979 100644 --- a/src/Module/Admin/Users.php +++ b/src/Module/Admin/Users.php @@ -15,9 +15,9 @@ use Friendica\Util\Temporal; class Users extends BaseAdminModule { - public static function post() + public static function post(array $parameters = []) { - parent::post(); + parent::post($parameters); $a = self::getApp(); @@ -131,9 +131,9 @@ class Users extends BaseAdminModule $a->internalRedirect('admin/users'); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); $a = self::getApp(); diff --git a/src/Module/AllFriends.php b/src/Module/AllFriends.php index e5fbe6971..0d9bf5985 100644 --- a/src/Module/AllFriends.php +++ b/src/Module/AllFriends.php @@ -16,7 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils; */ class AllFriends extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/Apps.php b/src/Module/Apps.php index efba071aa..bc099ce8b 100644 --- a/src/Module/Apps.php +++ b/src/Module/Apps.php @@ -13,7 +13,7 @@ use Friendica\Core\Renderer; */ class Apps extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $privateaddons = Config::get('config', 'private_addons'); if ($privateaddons === "1" && !local_user()) { @@ -21,7 +21,7 @@ class Apps extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $apps = Nav::getAppMenu(); diff --git a/src/Module/Attach.php b/src/Module/Attach.php index e9af90fac..f67104015 100644 --- a/src/Module/Attach.php +++ b/src/Module/Attach.php @@ -20,7 +20,7 @@ class Attach extends BaseModule /** * @brief Return to user an attached file given the id */ - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); if ($a->argc != 2) { diff --git a/src/Module/BaseAdminModule.php b/src/Module/BaseAdminModule.php index 6802d09c1..01aa00d42 100644 --- a/src/Module/BaseAdminModule.php +++ b/src/Module/BaseAdminModule.php @@ -23,7 +23,7 @@ require_once 'boot.php'; */ abstract class BaseAdminModule extends BaseModule { - public static function post() + public static function post(array $parameters = []) { if (!is_site_admin()) { return; @@ -35,7 +35,7 @@ abstract class BaseAdminModule extends BaseModule } } - public static function rawContent() + public static function rawContent(array $parameters = []) { if (!is_site_admin()) { return ''; @@ -48,7 +48,7 @@ abstract class BaseAdminModule extends BaseModule return ''; } - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/BaseSettingsModule.php b/src/Module/BaseSettingsModule.php index 4b5e9bf91..4900de42e 100644 --- a/src/Module/BaseSettingsModule.php +++ b/src/Module/BaseSettingsModule.php @@ -9,7 +9,7 @@ use Friendica\Core\Renderer; class BaseSettingsModule extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php index 92130eeff..a50f23c25 100644 --- a/src/Module/Bookmarklet.php +++ b/src/Module/Bookmarklet.php @@ -14,7 +14,7 @@ use Friendica\Util\Strings; */ class Bookmarklet extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $_GET['mode'] = 'minimal'; diff --git a/src/Module/Contact.php b/src/Module/Contact.php index c8bbbfe2e..ded5ffbe2 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -75,7 +75,7 @@ class Contact extends BaseModule $a->internalRedirect('contact'); } - public static function post() + public static function post(array $parameters = []) { $a = self::getApp(); @@ -240,7 +240,7 @@ class Contact extends BaseModule Model\Contact::remove($orig_record['id']); } - public static function content($update = 0) + public static function content(array $parameters = [], $update = 0) { if (!local_user()) { return Login::form($_SERVER['REQUEST_URI']); diff --git a/src/Module/Contact/Hovercard.php b/src/Module/Contact/Hovercard.php index 20290e0ac..a72a7f0a2 100644 --- a/src/Module/Contact/Hovercard.php +++ b/src/Module/Contact/Hovercard.php @@ -18,7 +18,7 @@ use Friendica\Util\Proxy; */ class Hovercard extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $contact_url = $_REQUEST['url'] ?? ''; diff --git a/src/Module/Credits.php b/src/Module/Credits.php index b0a6545c3..c536dcaa5 100644 --- a/src/Module/Credits.php +++ b/src/Module/Credits.php @@ -13,7 +13,7 @@ use Friendica\Core\Renderer; */ class Credits extends BaseModule { - public static function content() + public static function content(array $parameters = []) { /* fill the page with credits */ $credits_string = file_get_contents('CREDITS.txt'); diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index cf1f86955..17187a37c 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -14,7 +14,7 @@ use Friendica\Util\XML; */ class Babel extends BaseModule { - public static function content() + public static function content(array $parameters = []) { function visible_whitespace($s) { diff --git a/src/Module/Debug/Feed.php b/src/Module/Debug/Feed.php index cc0be643b..c764c9000 100644 --- a/src/Module/Debug/Feed.php +++ b/src/Module/Debug/Feed.php @@ -14,7 +14,7 @@ use Friendica\Util\Network; */ class Feed extends BaseModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { info(L10n::t('You must be logged in to use this module')); @@ -22,7 +22,7 @@ class Feed extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $result = []; if (!empty($_REQUEST['url'])) { diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php index fead25535..f166fb0a2 100644 --- a/src/Module/Debug/ItemBody.php +++ b/src/Module/Debug/ItemBody.php @@ -12,7 +12,7 @@ use Friendica\Network\HTTPException; */ class ItemBody extends BaseModule { - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(L10n::t('Access denied.')); diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php index 197149837..0d78f08d7 100644 --- a/src/Module/Debug/Localtime.php +++ b/src/Module/Debug/Localtime.php @@ -10,7 +10,7 @@ use Friendica\Util\Temporal; class Localtime extends BaseModule { - public static function post() + public static function post(array $parameters = []) { $time = ($_REQUEST['time'] ?? '') ?: 'now'; @@ -21,7 +21,7 @@ class Localtime extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/Debug/Probe.php b/src/Module/Debug/Probe.php index 6762c5b82..85c5f900f 100644 --- a/src/Module/Debug/Probe.php +++ b/src/Module/Debug/Probe.php @@ -13,7 +13,7 @@ use Friendica\Network\Probe as NetworkProbe; */ class Probe extends BaseModule { - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { $e = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.')); diff --git a/src/Module/Debug/WebFinger.php b/src/Module/Debug/WebFinger.php index 18cf4bb2a..90da40bf0 100644 --- a/src/Module/Debug/WebFinger.php +++ b/src/Module/Debug/WebFinger.php @@ -12,7 +12,7 @@ use Friendica\Network\Probe; */ class WebFinger extends BaseModule { - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.')); diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index 77baefeaa..d2930317c 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -17,7 +17,7 @@ use Friendica\Network\HTTPException\ForbiddenException; */ class Delegation extends BaseModule { - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -92,7 +92,7 @@ class Delegation extends BaseModule // NOTREACHED } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { throw new ForbiddenException(L10n::t('Permission denied.')); diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index 467d64566..6e3469c29 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -17,7 +17,7 @@ use Friendica\Util\Strings; */ class Fetch extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/Diaspora/Receive.php b/src/Module/Diaspora/Receive.php index c787b5f97..72b060a84 100644 --- a/src/Module/Diaspora/Receive.php +++ b/src/Module/Diaspora/Receive.php @@ -21,13 +21,13 @@ class Receive extends BaseModule /** @var LoggerInterface */ private static $logger; - public static function init() + public static function init(array $parameters = []) { /** @var LoggerInterface $logger */ self::$logger = self::getClass(LoggerInterface::class); } - public static function post() + public static function post(array $parameters = []) { /** @var Configuration $config */ $config = self::getClass(Configuration::class); diff --git a/src/Module/Directory.php b/src/Module/Directory.php index 1cdd971e8..f24c06650 100644 --- a/src/Module/Directory.php +++ b/src/Module/Directory.php @@ -21,7 +21,7 @@ use Friendica\Util\Strings; */ class Directory extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); diff --git a/src/Module/Feed.php b/src/Module/Feed.php index 49ecfed96..ba2153762 100644 --- a/src/Module/Feed.php +++ b/src/Module/Feed.php @@ -23,7 +23,7 @@ use Friendica\Protocol\OStatus; */ class Feed extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Filer/RemoveTag.php b/src/Module/Filer/RemoveTag.php index 1dcc2e41e..0246f1db3 100644 --- a/src/Module/Filer/RemoveTag.php +++ b/src/Module/Filer/RemoveTag.php @@ -12,7 +12,7 @@ use Friendica\Util\XML; */ class RemoveTag extends BaseModule { - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { throw new HTTPException\ForbiddenException(); diff --git a/src/Module/Filer/SaveTag.php b/src/Module/Filer/SaveTag.php index e8e311268..7f0da83bc 100644 --- a/src/Module/Filer/SaveTag.php +++ b/src/Module/Filer/SaveTag.php @@ -14,7 +14,7 @@ use Friendica\Util\XML; */ class SaveTag extends BaseModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { info(L10n::t('You must be logged in to use this module')); @@ -22,7 +22,7 @@ class SaveTag extends BaseModule } } - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); $logger = $a->getLogger(); diff --git a/src/Module/FollowConfirm.php b/src/Module/FollowConfirm.php index f4f2a877c..d1a0a5dda 100644 --- a/src/Module/FollowConfirm.php +++ b/src/Module/FollowConfirm.php @@ -18,7 +18,7 @@ use Friendica\Util\DateTimeFormat; */ class FollowConfirm extends BaseModule { - public static function post() + public static function post(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Followers.php b/src/Module/Followers.php index 5bd3fe0ce..c2096cd05 100644 --- a/src/Module/Followers.php +++ b/src/Module/Followers.php @@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub; */ class Followers extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Following.php b/src/Module/Following.php index 5b5f4dc98..8eaa1835c 100644 --- a/src/Module/Following.php +++ b/src/Module/Following.php @@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub; */ class Following extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php index ae8ea1496..ee8b22061 100644 --- a/src/Module/Friendica.php +++ b/src/Module/Friendica.php @@ -15,7 +15,7 @@ use Friendica\Model\User; */ class Friendica extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); @@ -88,7 +88,7 @@ class Friendica extends BaseModule ]); } - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/Group.php b/src/Module/Group.php index d8d5fb1c5..4c7672c01 100644 --- a/src/Module/Group.php +++ b/src/Module/Group.php @@ -19,7 +19,7 @@ require_once 'boot.php'; class Group extends BaseModule { - public static function post() + public static function post(array $parameters = []) { $a = self::getApp(); @@ -132,7 +132,7 @@ class Group extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $change = false; diff --git a/src/Module/HTTPException/MethodNotAllowed.php b/src/Module/HTTPException/MethodNotAllowed.php index 8d2d280a5..b4f9e9766 100644 --- a/src/Module/HTTPException/MethodNotAllowed.php +++ b/src/Module/HTTPException/MethodNotAllowed.php @@ -8,7 +8,7 @@ use Friendica\Network\HTTPException; class MethodNotAllowed extends BaseModule { - public static function content() + public static function content(array $parameters = []) { throw new HTTPException\MethodNotAllowedException(L10n::t('Method Not Allowed.')); } diff --git a/src/Module/HTTPException/PageNotFound.php b/src/Module/HTTPException/PageNotFound.php index d848905c5..c79d9c277 100644 --- a/src/Module/HTTPException/PageNotFound.php +++ b/src/Module/HTTPException/PageNotFound.php @@ -8,7 +8,7 @@ use Friendica\Network\HTTPException; class PageNotFound extends BaseModule { - public static function content() + public static function content(array $parameters = []) { throw new HTTPException\NotFoundException(L10n::t('Page not found.')); } diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 411da5ce5..a460ae1d9 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -15,7 +15,7 @@ use Friendica\Util\Strings; class Hashtag extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $result = []; diff --git a/src/Module/Help.php b/src/Module/Help.php index ddf5b06d8..3b3ce5870 100644 --- a/src/Module/Help.php +++ b/src/Module/Help.php @@ -14,7 +14,7 @@ use Friendica\Util\Strings; */ class Help extends BaseModule { - public static function content() + public static function content(array $parameters = []) { Nav::setSelected('help'); diff --git a/src/Module/Home.php b/src/Module/Home.php index 5a1dccde2..e6fb8c349 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -12,7 +12,7 @@ use Friendica\Core\Renderer; */ class Home extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); diff --git a/src/Module/Inbox.php b/src/Module/Inbox.php index 2cc273b13..8ab169567 100644 --- a/src/Module/Inbox.php +++ b/src/Module/Inbox.php @@ -19,7 +19,7 @@ use Friendica\Util\Network; */ class Inbox extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Install.php b/src/Module/Install.php index 39d6a062a..71547ad51 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -46,7 +46,7 @@ class Install extends BaseModule */ private static $installer; - public static function init() + public static function init(array $parameters = []) { $a = self::getApp(); @@ -76,7 +76,7 @@ class Install extends BaseModule self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; } - public static function post() + public static function post(array $parameters = []) { $a = self::getApp(); $configCache = $a->getConfigCache(); @@ -149,7 +149,7 @@ class Install extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); $configCache = $a->getConfigCache(); diff --git a/src/Module/Invite.php b/src/Module/Invite.php index 7860c703c..cd616001b 100644 --- a/src/Module/Invite.php +++ b/src/Module/Invite.php @@ -16,7 +16,7 @@ use Friendica\Util\Strings; */ class Invite extends BaseModule { - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); @@ -104,7 +104,7 @@ class Invite extends BaseModule notice(L10n::tt('%d message sent.', '%d messages sent.', $total) . EOL); } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); diff --git a/src/Module/Item/Compose.php b/src/Module/Item/Compose.php index c44e4c61a..ad0a2d805 100644 --- a/src/Module/Item/Compose.php +++ b/src/Module/Item/Compose.php @@ -21,7 +21,7 @@ use Friendica\Util\Crypto; class Compose extends BaseModule { - public static function post() + public static function post(array $parameters = []) { if (!empty($_REQUEST['body'])) { $_REQUEST['return'] = 'network'; @@ -32,7 +32,7 @@ class Compose extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { return Login::form('compose', false); diff --git a/src/Module/Item/Ignore.php b/src/Module/Item/Ignore.php index 6a28310b4..4590bc8c8 100644 --- a/src/Module/Item/Ignore.php +++ b/src/Module/Item/Ignore.php @@ -16,7 +16,7 @@ use Friendica\Network\HTTPException; */ class Ignore extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { /** @var L10n $l10n */ $l10n = self::getClass(L10n::class); diff --git a/src/Module/Like.php b/src/Module/Like.php index cc450dd9d..1c98cbc38 100644 --- a/src/Module/Like.php +++ b/src/Module/Like.php @@ -13,7 +13,7 @@ use Friendica\Util\Strings; */ class Like extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { if (!Session::isAuthenticated()) { throw new HTTPException\ForbiddenException(); diff --git a/src/Module/Login.php b/src/Module/Login.php index 0048fefaa..c84af17cc 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -30,7 +30,7 @@ use LightOpenID; */ class Login extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); @@ -41,7 +41,7 @@ class Login extends BaseModule return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED); } - public static function post() + public static function post(array $parameters = []) { $openid_identity = Session::get('openid_identity'); $openid_server = Session::get('openid_server'); diff --git a/src/Module/Logout.php b/src/Module/Logout.php index bf6a39e19..49ede01a3 100644 --- a/src/Module/Logout.php +++ b/src/Module/Logout.php @@ -23,7 +23,7 @@ class Logout extends BaseModule /** * @brief Process logout requests */ - public static function init() + public static function init(array $parameters = []) { $visitor_home = null; if (remote_user()) { diff --git a/src/Module/Magic.php b/src/Module/Magic.php index b04ea80c0..0f610d123 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -20,7 +20,7 @@ use Friendica\Util\Strings; */ class Magic extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $a = self::getApp(); $ret = ['success' => false, 'url' => '', 'message' => '']; diff --git a/src/Module/Maintenance.php b/src/Module/Maintenance.php index 24140bb35..056bde732 100644 --- a/src/Module/Maintenance.php +++ b/src/Module/Maintenance.php @@ -14,7 +14,7 @@ use Friendica\Util\Strings; */ class Maintenance extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $config = self::getApp()->getConfig(); diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php index 9dadcf0f7..9e0974059 100644 --- a/src/Module/Manifest.php +++ b/src/Module/Manifest.php @@ -7,7 +7,7 @@ use Friendica\Core\Renderer; class Manifest extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); diff --git a/src/Module/NodeInfo.php b/src/Module/NodeInfo.php index 3261ef690..28f23196f 100644 --- a/src/Module/NodeInfo.php +++ b/src/Module/NodeInfo.php @@ -13,7 +13,7 @@ use Friendica\Core\System; */ class NodeInfo extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $config = self::getApp()->getConfig(); @@ -22,7 +22,7 @@ class NodeInfo extends BaseModule } } - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/Notifications/Notify.php b/src/Module/Notifications/Notify.php index bad0900ea..721a89a69 100644 --- a/src/Module/Notifications/Notify.php +++ b/src/Module/Notifications/Notify.php @@ -14,14 +14,14 @@ use Friendica\Network\HTTPException; */ class Notify extends BaseModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(L10n::t('Permission denied.')); } } - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); @@ -45,7 +45,7 @@ class Notify extends BaseModule * @return string|void * @throws HTTPException\InternalServerErrorException */ - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Objects.php b/src/Module/Objects.php index 2104e8042..5538be188 100644 --- a/src/Module/Objects.php +++ b/src/Module/Objects.php @@ -15,7 +15,7 @@ use Friendica\Protocol\ActivityPub; */ class Objects extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Oembed.php b/src/Module/Oembed.php index 010778212..f9d928428 100644 --- a/src/Module/Oembed.php +++ b/src/Module/Oembed.php @@ -17,7 +17,7 @@ use Friendica\Util\Strings; */ class Oembed extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/OpenSearch.php b/src/Module/OpenSearch.php index ff005bd56..309db6af9 100644 --- a/src/Module/OpenSearch.php +++ b/src/Module/OpenSearch.php @@ -16,7 +16,7 @@ class OpenSearch extends BaseModule /** * @throws \Exception */ - public static function rawContent() + public static function rawContent(array $parameters = []) { header('Content-type: application/opensearchdescription+xml'); diff --git a/src/Module/Outbox.php b/src/Module/Outbox.php index 4fc050763..c2024151e 100644 --- a/src/Module/Outbox.php +++ b/src/Module/Outbox.php @@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub; */ class Outbox extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Owa.php b/src/Module/Owa.php index 7243c1113..ca4eec47f 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -27,7 +27,7 @@ use Friendica\Util\Strings; */ class Owa extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $ret = [ 'success' => false ]; diff --git a/src/Module/Photo.php b/src/Module/Photo.php index 4ec4f204c..9987c38f5 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -23,7 +23,7 @@ class Photo extends BaseModule * Fetch a photo or an avatar, in optional size, check for permissions and * return the image */ - public static function init() + public static function init(array $parameters = []) { $a = self::getApp(); // @TODO: Replace with parameter from router diff --git a/src/Module/Profile.php b/src/Module/Profile.php index f38c77f2c..69db45acf 100644 --- a/src/Module/Profile.php +++ b/src/Module/Profile.php @@ -33,7 +33,7 @@ class Profile extends BaseModule public static $which = ''; public static $profile = 0; - public static function init() + public static function init(array $parameters = []) { $a = self::getApp(); @@ -51,7 +51,7 @@ class Profile extends BaseModule } } - public static function rawContent() + public static function rawContent(array $parameters = []) { if (ActivityPub::isRequest()) { $user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]); @@ -75,7 +75,7 @@ class Profile extends BaseModule } } - public static function content($update = 0) + public static function content(array $parameters = [], $update = 0) { $a = self::getApp(); diff --git a/src/Module/Profile/Contacts.php b/src/Module/Profile/Contacts.php index 1bf88d7c5..8069248f8 100644 --- a/src/Module/Profile/Contacts.php +++ b/src/Module/Profile/Contacts.php @@ -18,7 +18,7 @@ use Friendica\Util\Proxy as ProxyUtils; class Contacts extends BaseModule { - public static function content() + public static function content(array $parameters = []) { if (Config::get('system', 'block_public') && !Session::isAuthenticated()) { throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.')); diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php index 2b8ad01dd..fbf4b8bd5 100644 --- a/src/Module/Proxy.php +++ b/src/Module/Proxy.php @@ -30,7 +30,7 @@ class Proxy extends BaseModule * Sets application instance and checks if /proxy/ path is writable. * */ - public static function init() + public static function init(array $parameters = []) { // Set application instance here $a = self::getApp(); diff --git a/src/Module/PublicRSAKey.php b/src/Module/PublicRSAKey.php index ed099616a..f652811b5 100644 --- a/src/Module/PublicRSAKey.php +++ b/src/Module/PublicRSAKey.php @@ -12,7 +12,7 @@ use Friendica\Network\HTTPException\BadRequestException; */ class PublicRSAKey extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php index 3ecaa54b7..c5b31afee 100644 --- a/src/Module/RandomProfile.php +++ b/src/Module/RandomProfile.php @@ -11,7 +11,7 @@ use Friendica\Model\GContact; */ class RandomProfile extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/ReallySimpleDiscovery.php b/src/Module/ReallySimpleDiscovery.php index 515285dbf..7cf0db6c7 100644 --- a/src/Module/ReallySimpleDiscovery.php +++ b/src/Module/ReallySimpleDiscovery.php @@ -11,7 +11,7 @@ use Friendica\Util\XML; */ class ReallySimpleDiscovery extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { header('Content-Type: text/xml'); diff --git a/src/Module/Register.php b/src/Module/Register.php index 0837b5706..aaca8c02e 100644 --- a/src/Module/Register.php +++ b/src/Module/Register.php @@ -35,7 +35,7 @@ class Register extends BaseModule * * @return string */ - public static function content() + public static function content(array $parameters = []) { // logged in users can register others (people/pages/groups) // even with closed registrations, unless specifically prohibited by site policy. @@ -152,7 +152,7 @@ class Register extends BaseModule * Extend this method if the module is supposed to process POST requests. * Doesn't display any content */ - public static function post() + public static function post(array $parameters = []) { BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register'); diff --git a/src/Module/RobotsTxt.php b/src/Module/RobotsTxt.php index 635056a0a..db83777e8 100644 --- a/src/Module/RobotsTxt.php +++ b/src/Module/RobotsTxt.php @@ -9,7 +9,7 @@ use Friendica\BaseModule; */ class RobotsTxt extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $allDisalloweds = [ '/settings/', diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php index 101675600..74ce55fb5 100644 --- a/src/Module/Search/Acl.php +++ b/src/Module/Search/Acl.php @@ -31,7 +31,7 @@ class Acl extends BaseModule const TYPE_PRIVATE_MESSAGE = 'm'; const TYPE_ANY_CONTACT = 'a'; - public static function rawContent() + public static function rawContent(array $parameters = []) { if (!local_user()) { throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this module.')); diff --git a/src/Module/Search/Directory.php b/src/Module/Search/Directory.php index 405fb0cc8..b18847afe 100644 --- a/src/Module/Search/Directory.php +++ b/src/Module/Search/Directory.php @@ -13,7 +13,7 @@ use Friendica\Util\Strings; */ class Directory extends BaseSearchModule { - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { notice(L10n::t('Permission denied.')); diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 73de090a7..7c52c7e79 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -23,7 +23,7 @@ use Friendica\Util\Strings; class Index extends BaseSearchModule { - public static function content() + public static function content(array $parameters = []) { $search = (!empty($_GET['q']) ? Strings::escapeTags(trim(rawurldecode($_GET['q']))) : ''); diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index 9d8d84b55..88668272d 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -10,7 +10,7 @@ use Friendica\Util\Strings; class Saved extends BaseModule { - public static function init() + public static function init(array $parameters = []) { /** @var Arguments $args */ $args = self::getClass(Arguments::class); diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index f7edc72c9..e3c2b8d34 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -20,7 +20,7 @@ use Friendica\Util\Strings; */ class Delegation extends BaseSettingsModule { - public static function post() + public static function post(array $parameters = []) { if (!local_user() || !empty(self::getApp()->user['uid']) && self::getApp()->user['uid'] != local_user()) { throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); @@ -46,9 +46,9 @@ class Delegation extends BaseSettingsModule DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]); } - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); if (!local_user()) { throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); diff --git a/src/Module/Settings/TwoFactor/AppSpecific.php b/src/Module/Settings/TwoFactor/AppSpecific.php index c62b0bbff..72b233f42 100644 --- a/src/Module/Settings/TwoFactor/AppSpecific.php +++ b/src/Module/Settings/TwoFactor/AppSpecific.php @@ -20,7 +20,7 @@ class AppSpecific extends BaseSettingsModule { private static $appSpecificPassword = null; - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { return; @@ -38,7 +38,7 @@ class AppSpecific extends BaseSettingsModule } } - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -81,13 +81,13 @@ class AppSpecific extends BaseSettingsModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { return Login::form('settings/2fa/app_specific'); } - parent::content(); + parent::content($parameters); $appSpecificPasswords = AppSpecificPassword::getListForUser(local_user()); diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php index e7694225c..34d6f97b4 100644 --- a/src/Module/Settings/TwoFactor/Index.php +++ b/src/Module/Settings/TwoFactor/Index.php @@ -17,7 +17,7 @@ use PragmaRX\Google2FA\Google2FA; class Index extends BaseSettingsModule { - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -73,13 +73,13 @@ class Index extends BaseSettingsModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { return Login::form('settings/2fa'); } - parent::content(); + parent::content($parameters); $has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret'); $verified = PConfig::get(local_user(), '2fa', 'verified'); diff --git a/src/Module/Settings/TwoFactor/Recovery.php b/src/Module/Settings/TwoFactor/Recovery.php index 6937fa503..0d7de7d90 100644 --- a/src/Module/Settings/TwoFactor/Recovery.php +++ b/src/Module/Settings/TwoFactor/Recovery.php @@ -18,7 +18,7 @@ use Friendica\Module\Login; */ class Recovery extends BaseSettingsModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { return; @@ -36,7 +36,7 @@ class Recovery extends BaseSettingsModule } } - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -53,13 +53,13 @@ class Recovery extends BaseSettingsModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { return Login::form('settings/2fa/recovery'); } - parent::content(); + parent::content($parameters); if (!RecoveryCode::countValidForUser(local_user())) { RecoveryCode::generateForUser(local_user()); diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index b9205852d..63c186e3a 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -24,7 +24,7 @@ use PragmaRX\Google2FA\Google2FA; */ class Verify extends BaseSettingsModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { return; @@ -43,7 +43,7 @@ class Verify extends BaseSettingsModule } } - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -69,13 +69,13 @@ class Verify extends BaseSettingsModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { return Login::form('settings/2fa/verify'); } - parent::content(); + parent::content($parameters); $company = 'Friendica'; $holder = Session::get('my_address'); diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index d5b8f88ec..19722a18e 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -32,9 +32,9 @@ class UserExport extends BaseSettingsModule * If there is an action required through the URL / path, react * accordingly and export the requested data. **/ - public static function content() + public static function content(array $parameters = []) { - parent::content(); + parent::content($parameters); /** * options shown on "Export personal data" page @@ -59,7 +59,7 @@ class UserExport extends BaseSettingsModule * to the browser which then offers a save / open dialog * to the user. **/ - public static function rawContent() + public static function rawContent(array $parameters = []) { $args = self::getClass(Arguments::class); if ($args->getArgc() == 3) { diff --git a/src/Module/Smilies.php b/src/Module/Smilies.php index ded58768f..a808ce820 100644 --- a/src/Module/Smilies.php +++ b/src/Module/Smilies.php @@ -12,7 +12,7 @@ use Friendica\Core\System; */ class Smilies extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); @@ -26,7 +26,7 @@ class Smilies extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { $smilies = Content\Smilies::getList(); $count = count($smilies['texts'] ?? []); diff --git a/src/Module/Starred.php b/src/Module/Starred.php index 70cd39735..c1fa4c3b8 100644 --- a/src/Module/Starred.php +++ b/src/Module/Starred.php @@ -10,51 +10,36 @@ use Friendica\Model\Item; */ class Starred extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { - $a = self::getApp(); - $starred = 0; - $itemId = null; - if (!local_user()) { - exit(); + throw new \Friendica\Network\HTTPException\ForbiddenException(); } - // @TODO: Replace with parameter from router - if ($a->argc > 1) { - $itemId = intval($a->argv[1]); + if (empty($parameters['item'])) { + throw new \Friendica\Network\HTTPException\BadRequestException(); } - if (!$itemId) { - exit(); - } + $itemId = intval($parameters['item']); $item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]); if (empty($item)) { - exit(); + throw new \Friendica\Network\HTTPException\NotFoundException(); } - if (!intval($item['starred'])) { - $starred = 1; - } + $starred = !(bool)$item['starred']; Item::update(['starred' => $starred], ['id' => $itemId]); // See if we've been passed a return path to redirect to $returnPath = $_REQUEST['return'] ?? ''; - if ($returnPath) { - $rand = '_=' . time(); - if (strpos($returnPath, '?')) { - $rand = "&$rand"; - } else { - $rand = "?$rand"; - } - - $a->internalRedirect($returnPath . $rand); + if (!empty($returnPath)) { + $rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand'; + self::getApp()->internalRedirect($returnPath . $rand); } // the json doesn't really matter, it will either be 0 or 1 - echo json_encode($starred); + echo json_encode((int)$starred); exit(); } } diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php index 3e64828e7..6e599ac9b 100644 --- a/src/Module/Statistics.php +++ b/src/Module/Statistics.php @@ -8,7 +8,7 @@ use Friendica\Core\System; class Statistics extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $config = self::getApp()->getConfig(); @@ -17,7 +17,7 @@ class Statistics extends BaseModule } } - public static function rawContent() + public static function rawContent(array $parameters = []) { $config = self::getApp()->getConfig(); $logger = self::getApp()->getLogger(); diff --git a/src/Module/Theme.php b/src/Module/Theme.php index 0540267af..e9ce8d396 100644 --- a/src/Module/Theme.php +++ b/src/Module/Theme.php @@ -10,7 +10,7 @@ use Friendica\Util\Strings; */ class Theme extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { header("Content-Type: text/css"); diff --git a/src/Module/ThemeDetails.php b/src/Module/ThemeDetails.php index 9a2e913bc..40bfb7a87 100644 --- a/src/Module/ThemeDetails.php +++ b/src/Module/ThemeDetails.php @@ -10,7 +10,7 @@ use Friendica\Core\Theme; */ class ThemeDetails extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { if (!empty($_REQUEST['theme'])) { $theme = $_REQUEST['theme']; diff --git a/src/Module/ToggleMobile.php b/src/Module/ToggleMobile.php index 9788c0b5d..0efc2e54b 100644 --- a/src/Module/ToggleMobile.php +++ b/src/Module/ToggleMobile.php @@ -9,7 +9,7 @@ use Friendica\BaseModule; */ class ToggleMobile extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $a = self::getApp(); diff --git a/src/Module/Tos.php b/src/Module/Tos.php index c26085b48..ea29a5e07 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -47,7 +47,7 @@ class Tos extends BaseModule * dealings with their own node so a TOS is not necessary. * **/ - public static function init() + public static function init(array $parameters = []) { if (strlen(Config::get('system','singleuser'))) { self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser')); @@ -66,7 +66,7 @@ class Tos extends BaseModule * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function content() { + public static function content(array $parameters = []) { $tpl = Renderer::getMarkupTemplate('tos.tpl'); if (Config::get('system', 'tosdisplay')) { return Renderer::replaceMacros($tpl, [ diff --git a/src/Module/TwoFactor/Recovery.php b/src/Module/TwoFactor/Recovery.php index 7c17fdace..bd8783646 100644 --- a/src/Module/TwoFactor/Recovery.php +++ b/src/Module/TwoFactor/Recovery.php @@ -15,14 +15,14 @@ use Friendica\Model\TwoFactor\RecoveryCode; */ class Recovery extends BaseModule { - public static function init() + public static function init(array $parameters = []) { if (!local_user()) { return; } } - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -48,7 +48,7 @@ class Recovery extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { self::getApp()->internalRedirect(); diff --git a/src/Module/TwoFactor/Verify.php b/src/Module/TwoFactor/Verify.php index 4b1c974d8..f6f040f5a 100644 --- a/src/Module/TwoFactor/Verify.php +++ b/src/Module/TwoFactor/Verify.php @@ -18,7 +18,7 @@ class Verify extends BaseModule { private static $errors = []; - public static function post() + public static function post(array $parameters = []) { if (!local_user()) { return; @@ -45,7 +45,7 @@ class Verify extends BaseModule } } - public static function content() + public static function content(array $parameters = []) { if (!local_user()) { self::getApp()->internalRedirect(); diff --git a/src/Module/Welcome.php b/src/Module/Welcome.php index 9e1eace9b..f69991e49 100644 --- a/src/Module/Welcome.php +++ b/src/Module/Welcome.php @@ -11,7 +11,7 @@ use Friendica\Core\Renderer; */ class Welcome extends BaseModule { - public static function content() + public static function content(array $parameters = []) { $config = self::getApp()->getConfig(); diff --git a/src/Module/WellKnown/HostMeta.php b/src/Module/WellKnown/HostMeta.php index fd04467f7..cb344b695 100644 --- a/src/Module/WellKnown/HostMeta.php +++ b/src/Module/WellKnown/HostMeta.php @@ -13,7 +13,7 @@ use Friendica\Util\Crypto; */ class HostMeta extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php index a1bbeb78a..5d8f4e817 100644 --- a/src/Module/WellKnown/XSocialRelay.php +++ b/src/Module/WellKnown/XSocialRelay.php @@ -11,7 +11,7 @@ use Friendica\Model\Search; */ class XSocialRelay extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp(); $config = $app->getConfig(); diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 1028bfd53..79e0883a8 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -17,7 +17,7 @@ use Friendica\Util\Strings; */ class Xrd extends BaseModule { - public static function rawContent() + public static function rawContent(array $parameters = []) { $app = self::getApp();