Avoid the usage of `\hash()` in the template
authorAlexander Ebert <ebert@woltlab.com>
Fri, 11 Aug 2023 15:29:04 +0000 (17:29 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 11 Aug 2023 15:29:04 +0000 (17:29 +0200)
See #5512

wcfsetup/install/files/acp/templates/__optionRewriteTest.tpl
wcfsetup/install/files/lib/acp/form/OptionForm.class.php

index bdc557dfb883d954d9e660e16c11efdde338089c..8641770f8b737e7ee6dec459d012e7f3323c0316 100644 (file)
@@ -33,7 +33,7 @@
                        
                        const apps = new Map(Object.entries({
                                {* this bypasses the route system to force rewritten urls *}
-                               {implode from=$rewriteTestApplications item=$rewriteTestApplication}'{$rewriteTestApplication->getPackage()|encodeJS}': '{$__wcf->getPath($rewriteTestApplication->getAbbreviation())}core-rewrite-test/?uuidHash={'sha256'|hash:WCF_UUID}'{/implode}
+                               {implode from=$rewriteTestApplications item=$rewriteTestApplication}'{$rewriteTestApplication->getPackage()|encodeJS}': '{$__wcf->getPath($rewriteTestApplication->getAbbreviation())}core-rewrite-test/?uuidHash={$uuidHash}'{/implode}
                        }));
                        
                        AcpUiOptionRewriteTest.init(apps);
index 6c882abd188480d8806060c5e301ebb0540149a9..b13df8a5b8994db5121c4b5f3e911c8966dfd6ad 100644 (file)
@@ -104,6 +104,12 @@ class OptionForm extends AbstractOptionListForm
     {
         parent::assignVariables();
 
+        if ($this->category->categoryName === "general") {
+            WCF::getTPL()->assign([
+                'uuidHash' => \hash('sha256', \WCF_UUID),
+            ]);
+        }
+
         WCF::getTPL()->assign([
             'category' => $this->category,
             'optionTree' => $this->optionTree,