From 3c0f4e3926768131ac4c093dc9ab1444cee3cca8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 4 Mar 2024 01:16:49 -0500 Subject: [PATCH] [advancedcontentfilter] Stop using advancedcontentfilter_get_rules() outside of router context - This used to work with Slim v2, but the new requirements for module functions broke it --- advancedcontentfilter/advancedcontentfilter.php | 4 ++-- advancedcontentfilter/templates/settings.tpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 55bc5005..418b253e 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -253,7 +253,7 @@ function advancedcontentfilter_content() 'cancel' => DI::l10n()->t('Cancel'), ], '$current_theme' => DI::app()->getCurrentTheme(), - '$rules' => advancedcontentfilter_get_rules(), + '$rules' => DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])), '$form_security_token' => BaseModule::getFormSecurityToken() ]); } @@ -305,7 +305,7 @@ function advancedcontentfilter_build_fields($data) * API */ -function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response) +function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { if (!DI::userSession()->getLocalUserId()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method')); diff --git a/advancedcontentfilter/templates/settings.tpl b/advancedcontentfilter/templates/settings.tpl index c9dfbe3a..8b82e595 100644 --- a/advancedcontentfilter/templates/settings.tpl +++ b/advancedcontentfilter/templates/settings.tpl @@ -3,7 +3,7 @@