From cf3c318d075511dd7564d7b44e8781cecb1403d4 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Oct 2019 17:14:40 +0800 Subject: [PATCH] * adjust for find questions. --- lib/base/filter/filter.class.php | 28 +++++++++++++++++++++++++-- module/doc/lang/zh-cn.php | 2 ++ module/doc/model.php | 6 +++++- module/mail/lang/zh-cn.php | 2 +- module/search/view/buildform.html.php | 1 - module/setting/model.php | 2 +- module/tree/control.php | 2 +- module/tree/lang/zh-cn.php | 2 +- module/tree/view/browse.html.php | 4 ++-- module/tree/view/edit.html.php | 2 +- 10 files changed, 40 insertions(+), 11 deletions(-) diff --git a/lib/base/filter/filter.class.php b/lib/base/filter/filter.class.php index 357d32eff2..8182ed30da 100644 --- a/lib/base/filter/filter.class.php +++ b/lib/base/filter/filter.class.php @@ -643,7 +643,7 @@ class baseValidater $var = (string) $var; $evils = array('eval', 'exec', 'passthru', 'proc_open', 'shell_exec', 'system', '$$', 'include', 'require', 'assert'); - $replaces = array("e\177v\177a\177l", "e\177x\177e\177c", "p\177a\177s\177s\177t\177h\177r\177u", "p\177r\177o\177c\177_\177o\177p\177e\177n", "s\177h\177e\177l\177l\177_\177e\177x\177e\177c", "s\177y\177s\177t\177e\177m", "\$\177\$", "i\177n\177c\177l\177u\177d\177e", "r\177e\177q\177u\177i\177r\177e", "a\177s\177s\177e\177r\177t"); + $replaces = array('e v a l', 'e x e c', 'p a s s t h r u', 'p r o c _ o p e n', 's h e l l _ e x e c', 's y s t e m', '$ $', 'i n c l u d e', 'r e q u i r e', 'a s s e r t'); $var = str_ireplace($evils, $replaces, $var); return $var; @@ -666,7 +666,7 @@ class baseValidater { $var = (string) $var; $evils = array('appendchild(', 'createElement(', 'xss.re', 'onfocus', 'onclick', 'innerHTML', 'replaceChild(', 'html(', 'append(', 'appendTo(', 'prepend(', 'prependTo(', 'after(', 'insertBefore', 'before(', 'replaceWith('); - $replaces = array('a p p e n d c h i l d (', 'c r e a t e E l e m e n t (', 'x s s . r e', 'o n f o c u s', 'o n c l i c k', 'i n n e r H T M L', 'r e p l a c e C h i l d (', 'h t m l (', 'a p p e n d (', 'a p p e n d T o (', 'p r e p e n d (', 'p r e p e n d T o (', 'a f t e r (', 'i n s e r t B e f o r e (', 'b e f o r e (', 'r e p l a c e W i t h ('); + $replaces = array('a p p e n d c h i l d (', 'c r e a t e E l e m e n t (', 'x s s . r e', 'o n f o c u s', 'o n c l i c k', 'i n n e r H T M L', 'r e p l a c e C h i l d (', 'h t m l (', 'a p p e n d (', 'a p p e n d T o (', 'p r e p e n d (', 'p r e p e n d T o (', 'a f t e r (', 'i n s e r t B e f o r e (', 'b e f o r e (', 'r e p l a c e W i t h ('); $var = str_ireplace($evils, $replaces, $var); } @@ -721,6 +721,27 @@ class baseValidater return $var; } + /** + * Replace space to i tag. + * + * @param string $var + * @static + * @access public + * @return string + */ + public static function replaceSpace2Tag($var) + { + $replacedTrojan = array('e v a l', 'e x e c', 'p a s s t h r u', 'p r o c _ o p e n', 's h e l l _ e x e c', 's y s t e m', '$ $', 'i n c l u d e', 'r e q u i r e', 'a s s e r t'); + $replacedXSS = array('a p p e n d c h i l d (', 'c r e a t e E l e m e n t (', 'x s s . r e', 'o n f o c u s', 'o n c l i c k', 'i n n e r H T M L', 'r e p l a c e C h i l d (', 'h t m l (', 'a p p e n d (', 'a p p e n d T o (', 'p r e p e n d (', 'p r e p e n d T o (', 'a f t e r (', 'i n s e r t B e f o r e (', 'b e f o r e (', 'r e p l a c e W i t h ('); + + $replacsTrojan = array('eval', 'exec', 'passthru', 'proc_open', 'shell_exec', 'system', '$$', 'include', 'require', 'assert'); + $replacsXSS = array('appendchild(', 'createElement(', 'xss.re', 'onfocus', 'onclick', 'innerHTML', 'replaceChild(', 'html(', 'append(', 'appendTo(', 'prepend(', 'prependTo(', 'after(', 'insertBefore(', 'before(', 'replaceWith(', 'javascript:'); + + $var = str_ireplace($replacedTrojan, $replacsTrojan, $var); + $var = str_ireplace($replacedXSS, $replacsXSS, $var); + return $var; + } + /** * Check by rule. * @@ -1008,6 +1029,9 @@ class baseFixer if(!isset($this->stripedFields[$fieldName]) and (!defined('RUN_MODE') or RUN_MODE != 'admin')) { $this->data->$fieldName = self::dataStripTags($this->data->$fieldName); + + /* Code for bug #2721. */ + $this->data->$fieldName = baseValidater::replaceSpace2Tag($this->data->$fieldName); } $this->stripedFields[$fieldName] = $fieldName; } diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 43dbd5e246..0da031d70d 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -78,6 +78,8 @@ $lang->doc->editType = '编辑分类'; $lang->doc->deleteType = '删除分类'; $lang->doc->addType = '增加分类'; $lang->doc->childType = '子分类'; +$lang->doc->editType = '维护分类'; +$lang->doc->deleteType = '删除分类'; $lang->doc->collect = '收藏'; $lang->doc->cancelCollection = '取消收藏'; $lang->doc->deleteFile = '删除附件'; diff --git a/module/doc/model.php b/module/doc/model.php index 316d2f14c5..24c76422e7 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -364,7 +364,11 @@ class docModel extends model elseif($browseType == "bymodule") { $modules = 0; - if($moduleID) $modules = (strpos($this->config->doc->custom->showLibs, 'children') === false) ? array($moduleID => $moduleID) : $this->loadModel('tree')->getAllChildId($moduleID); + if($moduleID) + { + $modules = array($moduleID => $moduleID); + if(strpos($this->config->doc->custom->showLibs, 'children') === false) $modules = $this->loadModel('tree')->getAllChildId($moduleID); + } $docs = $this->getDocs($libID, $modules, $sort, $pager); } elseif($browseType == "bygrid") diff --git a/module/mail/lang/zh-cn.php b/module/mail/lang/zh-cn.php index 1d41121c40..d2bc8f2e77 100755 --- a/module/mail/lang/zh-cn.php +++ b/module/mail/lang/zh-cn.php @@ -55,7 +55,7 @@ $lang->mail->sendTime = '发送时间'; $lang->mail->status = '状态'; $lang->mail->failReason = '失败原因'; -$lang->mail->statusList['wait'] = '待发信'; +$lang->mail->statusList['wait'] = '待发送'; $lang->mail->statusList['sended'] = '成功'; $lang->mail->statusList['fail'] = '失败'; diff --git a/module/search/view/buildform.html.php b/module/search/view/buildform.html.php index 4c6568b406..a05cae21ce 100644 --- a/module/search/view/buildform.html.php +++ b/module/search/view/buildform.html.php @@ -412,7 +412,6 @@ $(function() if(typeof(params[fieldName]['class']) != undefined && params[fieldName]['class'] == 'date') { - console.log($searchForm.find("#value" + fieldNO)); setDateField($searchForm.find("#value" + fieldNO), fieldNO); $searchForm.find("#value" + fieldNO).addClass('date'); // Shortcut the width of the datepicker to make sure align with others. var maxNO = 2 * groupItems; diff --git a/module/setting/model.php b/module/setting/model.php index ea6dba56d7..00b9f0a0aa 100644 --- a/module/setting/model.php +++ b/module/setting/model.php @@ -58,7 +58,7 @@ class settingModel extends model $path = preg_replace("/^{$account}/", 'account', $path); } - $level = substr_count($path, '.'); + $level = substr_count($path, '.'); $section = ''; if($level <= 1) return false; diff --git a/module/tree/control.php b/module/tree/control.php index 059b5e3aee..ea1bb74b64 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -265,10 +265,10 @@ class tree extends control { $this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $branch); } + if($type == 'doc') $this->view->libs = $this->loadModel('doc')->getLibs('all', $extra = 'withObject'); $this->view->module = $module; $this->view->type = $type; - $this->view->libs = $this->loadModel('doc')->getLibs('all', $extra = 'withObject'); $this->view->branch = $branch; $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted', $module->owner); diff --git a/module/tree/lang/zh-cn.php b/module/tree/lang/zh-cn.php index 36f820d7ab..305fd8bb86 100644 --- a/module/tree/lang/zh-cn.php +++ b/module/tree/lang/zh-cn.php @@ -39,7 +39,7 @@ $lang->tree->addChild = "增加子模块"; $lang->tree->confirmDelete = '该模块及其子模块都会被删除,您确定删除吗?'; $lang->tree->confirmDeleteLine = "您确定删除该{$lang->productCommon}线吗?"; $lang->tree->confirmRoot = "模块的所属{$lang->productCommon}修改,会关联修改该模块下的需求、Bug、用例的所属{$lang->productCommon},以及{$lang->projectCommon}和{$lang->productCommon}的关联关系。该操作比较危险,请谨慎操作。是否确认修改?"; -$lang->tree->confirmRoot4Doc = "模块的所属文档库修改,会关联修改该模块下的文档的关联关系。该操作比较危险,请谨慎操作。是否确认修改?"; +$lang->tree->confirmRoot4Doc = "修改所属文档库,会关联修改该分类下文档的关联关系。该操作比较危险,请谨慎操作。是否确认修改?"; $lang->tree->successSave = '成功保存'; $lang->tree->successFixed = '成功修正数据!'; $lang->tree->repeatName = '模块名“%s”已经存在!'; diff --git a/module/tree/view/browse.html.php b/module/tree/view/browse.html.php index 9b849c2c0d..56ef2bf98d 100644 --- a/module/tree/view/browse.html.php +++ b/module/tree/view/browse.html.php @@ -211,13 +211,13 @@ $(function() edit: { linkTemplate: '', - title: 'tree->edit ?>', + title: 'doc->editType : $lang->tree->edit ?>', template: '' }, "delete": { linkTemplate: '', - title: 'tree->delete ?>', + title: 'doc->deleteType : $lang->tree->delete ?>', template: '' }, subModules: diff --git a/module/tree/view/edit.html.php b/module/tree/view/edit.html.php index 511cfdfa0e..eedba8d61e 100644 --- a/module/tree/view/edit.html.php +++ b/module/tree/view/edit.html.php @@ -19,7 +19,7 @@ if(isset($pageCSS)) css::internal($pageCSS);