forked from friendica/friendica-addons
Merge pull request '[advancedcontentfilter] Stop using advancedcontentfilter_get_rules() outside of router context' (#1475) from MrPetovan/friendica-addons:bug/13950-advancedcontentfilter-wsod into 2024.03-rc
Reviewed-on: friendica/friendica-addons#1475
This commit is contained in:
commit
6e355979e8
|
@ -253,7 +253,7 @@ function advancedcontentfilter_content()
|
||||||
'cancel' => DI::l10n()->t('Cancel'),
|
'cancel' => DI::l10n()->t('Cancel'),
|
||||||
],
|
],
|
||||||
'$current_theme' => DI::app()->getCurrentTheme(),
|
'$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()
|
'$form_security_token' => BaseModule::getFormSecurityToken()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ function advancedcontentfilter_build_fields($data)
|
||||||
* API
|
* API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response)
|
function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
|
||||||
{
|
{
|
||||||
if (!DI::userSession()->getLocalUserId()) {
|
if (!DI::userSession()->getLocalUserId()) {
|
||||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method'));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div id="rules"></div>
|
<div id="rules"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var existingRules = {{$rules nofilter}};
|
var existingRules = {{$rules|json_encode nofilter}};
|
||||||
|
|
||||||
var messages = {
|
var messages = {
|
||||||
{{foreach $messages as $key => $value}}
|
{{foreach $messages as $key => $value}}
|
||||||
|
|
Loading…
Reference in a new issue