浏览代码

rev. 35 for HTMLCleaner

Visman 4 年之前
父节点
当前提交
e2e71ac03d
共有 4 个文件被更改,包括 47 次插入2 次删除
  1. 13 0
      app/Controllers/Update.php
  2. 28 1
      app/Models/Pages/Admin/Update.php
  3. 1 1
      app/bootstrap.php
  4. 5 0
      app/config/main.dist.php

+ 13 - 0
app/Controllers/Update.php

@@ -57,6 +57,19 @@ class Update
 
             $this->c->config($confChange);
         }
+        if ($this->c->config->i_fork_revision < 35) {
+            $confChange = [
+                'shared' => [
+                    'HTMLCleaner' => [
+                        'calss'  => \ForkBB\Core\HTMLCleaner::class,
+                        'config' => '%DIR_APP%/config/jevix.default.php',
+                    ],
+                    'VLhtml' => \ForkBB\Models\Validators\Html::class,
+                ],
+            ];
+
+            $this->c->config($confChange);
+        }
 
         $uri = $_SERVER['REQUEST_URI'];
         if (false !== ($pos = \strpos($uri, '?'))) {

+ 28 - 1
app/Models/Pages/Admin/Update.php

@@ -139,7 +139,7 @@ class Update extends Admin
                 ])->addRules([
                     'token'                 => 'token:AdminUpdate',
                     'dbpass'                => 'required|string:trim|check_pass',
-                    'o_maintenance_message' => 'required|string:trim|max:65000 bytes',
+                    'o_maintenance_message' => 'required|string:trim|max:65000 bytes|html',
                 ])->addAliases([
                     'dbpass'                => 'Database password',
                     'o_maintenance_message' => 'Maintenance message',
@@ -1306,4 +1306,31 @@ class Update extends Admin
 
         return null;
    }
+
+    /**
+     * rev.34 to rev.35
+     */
+    protected function stageNumber34(array $args): ?int
+    {
+        $coreConfig = new CoreConfig($this->configFile);
+
+        $coreConfig->add(
+            'shared=>HTMLCleaner',
+            [
+                'class'  => '\\ForkBB\\Core\\HTMLCleaner::class',
+                'config' => '\'%DIR_APP%/config/jevix.default.php\'',
+            ],
+            'LogViewer'
+        );
+
+        $coreConfig->add(
+            'shared=>VLhtml',
+            '\\ForkBB\\Models\\Validators\\Html::class',
+            'VLemail'
+        );
+
+        $coreConfig->save();
+
+        return null;
+    }
 }

+ 1 - 1
app/bootstrap.php

@@ -52,7 +52,7 @@ if (
 }
 $c->PUBLIC_URL = $c->BASE_URL . $forkPublicPrefix;
 
-$c->FORK_REVISION = 34;
+$c->FORK_REVISION = 35;
 $c->START         = $forkStart;
 $c->DIR_APP       = __DIR__;
 $c->DIR_PUBLIC    = \realpath(__DIR__ . '/../public');

+ 5 - 0
app/config/main.dist.php

@@ -129,6 +129,10 @@ return [
             ],
             'cache' => '%Cache%',
         ],
+        'HTMLCleaner' => [
+            'calss'  => \ForkBB\Core\HTMLCleaner::class,
+            'config' => '%DIR_APP%/config/jevix.default.php',
+        ],
 
         'config'        => '@ConfigModel:init',
         'bans'          => '@BanListModel:init',
@@ -176,6 +180,7 @@ return [
         'VLnoURL'    => \ForkBB\Models\Validators\NoURL::class,
         'VLusername' => \ForkBB\Models\Validators\Username::class,
         'VLemail'    => \ForkBB\Models\Validators\Email::class,
+        'VLhtml'     => \ForkBB\Models\Validators\Html::class,
 
         'ProfileRules' => \ForkBB\Models\Rules\Profile::class,
         'UsersRules'   => \ForkBB\Models\Rules\Users::class,