From 809c78a531fce6265f58a378440f99cdbb5fe822 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 13 Oct 2025 15:16:20 +0800 Subject: [PATCH] * [refac] Refactor purifier initialization to use app loadClass method. --- module/file/model.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/module/file/model.php b/module/file/model.php index 6277e1fbea..a20ff31450 100755 --- a/module/file/model.php +++ b/module/file/model.php @@ -283,10 +283,7 @@ class fileModel extends model return $_FILES[$htmlTagName]; } - $this->app->loadClass('purifier', true); - $config = HTMLPurifier_Config::createDefault(); - $config->set('Cache.DefinitionImpl', null); - $purifier = new HTMLPurifier($config); + $purifier = $this->app->loadClass('purifier'); /* If the file var name is an array. */ if(is_array($_FILES[$htmlTagName]['name'])) @@ -333,14 +330,11 @@ class fileModel extends model */ public function getChunkedFile(): array { - $this->app->loadClass('purifier', true); - $config = HTMLPurifier_Config::createDefault(); - $config->set('Cache.DefinitionImpl', null); - $purifier = new HTMLPurifier($config); - $name = urldecode(zget($_SERVER, 'HTTP_X_FILENAME', '')); if(!validater::checkFileName($name) or empty($name)) return array(); + $purifier = $this->app->loadClass('purifier'); + $file = array(); $file['id'] = 0; $file['extension'] = $this->getExtension($name);