Skip to content

Commit 2996ce3

Browse files
committed
fix:修复菜单规则管理中 Iframe 的 URL 可能被转义的问题 close #ICFZ20
1 parent ab5b6b0 commit 2996ce3

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

app/admin/controller/auth/Rule.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ class Rule extends Backend
5454
public function initialize(): void
5555
{
5656
parent::initialize();
57-
$this->model = new AdminRule();
58-
$this->tree = Tree::instance();
5957

60-
$isTree = $this->request->param('isTree', true);
61-
$this->initValue = $this->request->get('initValue/a', []);
62-
$this->initValue = array_filter($this->initValue);
63-
$this->keyword = $this->request->request('quickSearch', '');
58+
// 防止 URL 中的特殊符号被默认的 filter 函数转义
59+
$this->request->filter('clean_xss');
6460

65-
// 有初始化值时不组装树状(初始化出来的值更好看)
66-
$this->assembleTree = $isTree && !$this->initValue;
61+
$this->model = new AdminRule();
62+
$this->tree = Tree::instance();
63+
$isTree = $this->request->param('isTree', true);
64+
$this->initValue = $this->request->get('initValue/a', []);
65+
$this->initValue = array_filter($this->initValue);
66+
$this->keyword = $this->request->request('quickSearch', '');
67+
$this->assembleTree = $isTree && !$this->initValue; // 有初始化值时不组装树状(初始化出来的值更好看)
6768
}
6869

6970
public function index(): void

app/admin/controller/user/Rule.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,17 @@ class Rule extends Backend
4848
public function initialize(): void
4949
{
5050
parent::initialize();
51-
$this->model = new UserRule();
52-
$this->tree = Tree::instance();
5351

54-
$isTree = $this->request->param('isTree', true);
55-
$this->initValue = $this->request->get("initValue/a", []);
56-
$this->initValue = array_filter($this->initValue);
57-
$this->keyword = $this->request->request('quickSearch', '');
52+
// 防止 URL 中的特殊符号被默认的 filter 函数转义
53+
$this->request->filter('clean_xss');
5854

59-
// 有初始化值时不组装树状(初始化出来的值更好看)
60-
$this->assembleTree = $isTree && !$this->initValue;
55+
$this->model = new UserRule();
56+
$this->tree = Tree::instance();
57+
$isTree = $this->request->param('isTree', true);
58+
$this->initValue = $this->request->get("initValue/a", []);
59+
$this->initValue = array_filter($this->initValue);
60+
$this->keyword = $this->request->request('quickSearch', '');
61+
$this->assembleTree = $isTree && !$this->initValue; // 有初始化值时不组装树状(初始化出来的值更好看)
6162
}
6263

6364
public function index(): void

0 commit comments

Comments
 (0)