From 7952e9188bb3eef34f70af2182009106a4811494 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 7 Mar 2022 12:40:45 -0800 Subject: [PATCH] Notify admins when script access is disabled. --- e107_handlers/e_parse_class.php | 10 ++++++++++ e107_languages/English/admin/lan_admin.php | 3 +++ 2 files changed, 13 insertions(+) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 2aba8bf6b..0e7176e43 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -5172,6 +5172,16 @@ class e_parse { $this->grantScriptAccess(); } + elseif(ADMIN && (strpos($html, '') !== false)) + { + $lan1 = defset('LAN_NO_SCRIPT_ACCESS', "You don't have permission to use [script] tags."); + $lan2 = defset('', "If you believe this is an error, please ask the main administrator to grant you script access via [b]Preferences > Content Filters[/b]"); + $srch = ['[', ']']; + $repl = ['<', '>']; + + e107::getMessage()->addWarning(str_replace($srch,$repl,$lan1)); + e107::getMessage()->addWarning(e107::getParser()->toHTML($lan2,true)); + } // Set it up for processing. diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 84b9669b4..9db6a18b1 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -586,3 +586,6 @@ define("LAN_X_CHARS_REMAINING", "[x] chars. remaining"); define("LAN_UI_BATCH_NOW", "Current Date/Time"); define("LAN_RELATIONSHIP", "Relationship"); define("LAN_RELATIONSHIP_HELP", "Optional 'rel' attribute. Comma separated."); + +define("LAN_NO_SCRIPT_ACCESS", "You don't have permission to use [script] tags."); +define("LAN_NO_SCRIPT_ACCESS_ASK", "If you believe this is an error, please ask the main administrator to grant you script access via [b]Preferences > Content Filters[/b]");