From a520a496c404cad80a0e14a7abe6ec4dd63b8ebc Mon Sep 17 00:00:00 2001 From: Kruzya Date: Fri, 15 Oct 2021 01:13:43 +0400 Subject: [PATCH] Add backend checks for accept rules checkbox --- XF/Pub/Controller/Forum.php | 28 +++++++++++++++++++ ...umRulesAccept-XF-Pub-Controller-Forum.json | 6 ++++ _output/class_extensions/_metadata.json | 3 ++ _output/extension_hint.php | 5 ++++ _output/phrases/_metadata.json | 6 ++++ ...rum_rules_accept.you_must_accept_rules.txt | 1 + _output/templates/_metadata.json | 2 +- .../hlmod_forum_rules_accept_macros.html | 3 +- 8 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 XF/Pub/Controller/Forum.php create mode 100644 _output/class_extensions/XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json create mode 100644 _output/phrases/hlmod_forum_rules_accept.you_must_accept_rules.txt diff --git a/XF/Pub/Controller/Forum.php b/XF/Pub/Controller/Forum.php new file mode 100644 index 0000000..4953545 --- /dev/null +++ b/XF/Pub/Controller/Forum.php @@ -0,0 +1,28 @@ +hlmod_rules_url; + if (!empty($rulesUrl) && $rulesUrl !== $this->filter('hlmod_rules_url_accept', 'str,no-trim')) + { + throw $this->errorException(\XF::phrase('hlmod_forum_rules_accept.you_must_accept_rules'), 400); + } + + return parent::setupThreadCreate($forum); + } +} diff --git a/_output/class_extensions/XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json b/_output/class_extensions/XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json new file mode 100644 index 0000000..e9a2f83 --- /dev/null +++ b/_output/class_extensions/XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json @@ -0,0 +1,6 @@ +{ + "from_class": "XF\\Pub\\Controller\\Forum", + "to_class": "HLModerators\\ForumRulesAccept\\XF\\Pub\\Controller\\Forum", + "execute_order": 25, + "active": true +} \ No newline at end of file diff --git a/_output/class_extensions/_metadata.json b/_output/class_extensions/_metadata.json index de7f6c0..e9247fb 100644 --- a/_output/class_extensions/_metadata.json +++ b/_output/class_extensions/_metadata.json @@ -1,5 +1,8 @@ { "XF-Admin-Controller-Forum_HLModerators-ForumRulesAccept-XF-Admin-Controller-Forum.json": { "hash": "004a41870794b2d257393ab2d0fcce61" + }, + "XF-Pub-Controller-Forum_HLModerators-ForumRulesAccept-XF-Pub-Controller-Forum.json": { + "hash": "05b5337ac132d7abb87afd8b5d912d2c" } } \ No newline at end of file diff --git a/_output/extension_hint.php b/_output/extension_hint.php index 59e6868..2fd7989 100644 --- a/_output/extension_hint.php +++ b/_output/extension_hint.php @@ -6,4 +6,9 @@ namespace HLModerators\ForumRulesAccept\XF\Admin\Controller { class XFCP_Forum extends \XF\Admin\Controller\Forum {} +} + +namespace HLModerators\ForumRulesAccept\XF\Pub\Controller +{ + class XFCP_Forum extends \XF\Pub\Controller\Forum {} } \ No newline at end of file diff --git a/_output/phrases/_metadata.json b/_output/phrases/_metadata.json index 9f0a6c4..032fdda 100644 --- a/_output/phrases/_metadata.json +++ b/_output/phrases/_metadata.json @@ -16,5 +16,11 @@ "version_id": 1000011, "version_string": "1.0.0 Alpha 1", "hash": "bbee0d653e71dd07760ae09aa5575d25" + }, + "hlmod_forum_rules_accept.you_must_accept_rules.txt": { + "global_cache": false, + "version_id": 1000170, + "version_string": "1.0.1", + "hash": "d78b151c7217bd689d2cdbafdcaee797" } } \ No newline at end of file diff --git a/_output/phrases/hlmod_forum_rules_accept.you_must_accept_rules.txt b/_output/phrases/hlmod_forum_rules_accept.you_must_accept_rules.txt new file mode 100644 index 0000000..52dee7d --- /dev/null +++ b/_output/phrases/hlmod_forum_rules_accept.you_must_accept_rules.txt @@ -0,0 +1 @@ +You must accept the rules for creating a thread \ No newline at end of file diff --git a/_output/templates/_metadata.json b/_output/templates/_metadata.json index e7dd15e..f84d6db 100644 --- a/_output/templates/_metadata.json +++ b/_output/templates/_metadata.json @@ -2,6 +2,6 @@ "public/hlmod_forum_rules_accept_macros.html": { "version_id": 1000170, "version_string": "1.0.1", - "hash": "ab0db537fe5313ae97e6327c87dca7c3" + "hash": "4b06cda6bf7273646b0229d64bfa844f" } } \ No newline at end of file diff --git a/_output/templates/public/hlmod_forum_rules_accept_macros.html b/_output/templates/public/hlmod_forum_rules_accept_macros.html index 0fab00f..e1123c5 100644 --- a/_output/templates/public/hlmod_forum_rules_accept_macros.html +++ b/_output/templates/public/hlmod_forum_rules_accept_macros.html @@ -2,7 +2,8 @@ arg-rowType=""> - + {{ phrase('hlmod_forum_rules_accept.i_read_and_accept_forum_rules', {'url': $forum.hlmod_rules_url}) }}