From cd918d09fd33f81eceeb16b925df3e272d2fddf8 Mon Sep 17 00:00:00 2001 From: wumo Date: Tue, 20 Mar 2018 10:00:30 +0800 Subject: [PATCH] * Check the key of user when setting. --- module/company/view/browse.html.php | 2 +- module/custom/control.php | 3 ++- module/custom/lang/en.php | 2 +- module/custom/lang/zh-cn.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index bf046fbd46..50df24cf39 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -66,7 +66,7 @@ js::set('confirmDelete', $lang->user->confirmDelete); account", $user->realname, '', "title='$user->realname'")) echo $user->realname;?> account;?> - user->roleList[$user->role];?> + role) ? $lang->user->roleList[$user->role] : '';?> email);?> user->genderList[$user->gender])) echo $lang->user->genderList[$user->gender];?> phone;?> diff --git a/module/custom/control.php b/module/custom/control.php index a37ea88342..b67005eb9e 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -116,9 +116,10 @@ class custom extends control foreach($_POST['keys'] as $index => $key) { /* Fix bug #942. */ + if(!empty($key)) $key = trim($key); if($field == 'priList' and !is_numeric($key)) die(js::alert($this->lang->custom->notice->priListKey)); if($module == 'bug' and $field == 'severityList' and !is_numeric($key)) die(js::alert($this->lang->custom->notice->severityListKey)); - if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-zA-Z_0-9]+$/')) die(js::alert($this->lang->custom->notice->keyList)); + if(!empty($key) and $key != 'n/a' and !validater::checkREG($key, '/^[a-z_0-9]+$/')) die(js::alert($this->lang->custom->notice->keyList)); /* the length of role is 20, check it when save. */ if($module == 'user' and $field == 'roleList' and strlen($key) > 10) die(js::alert($this->lang->custom->notice->userRole)); diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 86598248e3..1a7aed64ab 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -89,7 +89,7 @@ $lang->custom->notice->forceReview = '%s Review is required for certain $lang->custom->notice->forceNotReview = "%s Review is NOT required for certain submitters."; $lang->custom->notice->longlife = 'Define shelved bugs.'; $lang->custom->notice->priListKey = 'Priority list key should be numbers!'; -$lang->custom->notice->keyList = 'key should be English or digital!'; +$lang->custom->notice->keyList = 'The key should be a combination of lowercase English letters, numbers or underscores'; $lang->custom->notice->severityListKey = 'Bug severity list key should be numbers.'; $lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Homepage. Do you want to go to Product Homepage?"; $lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Homepage. Do you want to go to Project Homepage?"; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 92c0252f81..ffaa5848b0 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -89,7 +89,7 @@ $lang->custom->notice->forceReview = "指定人提交的%s必须评审 $lang->custom->notice->forceNotReview = "指定人提交的%s不需要评审。"; $lang->custom->notice->longlife = 'Bug列表页面的久未处理标签中,列出设置天数之前未处理的Bug。'; $lang->custom->notice->priListKey = '优先级的键应当为数字!'; -$lang->custom->notice->keyList = '键值应当为英文或数字'; +$lang->custom->notice->keyList = '键值应当为小写英文字母、数字或下划线的组合'; $lang->custom->notice->severityListKey = 'Bug严重程度的键应当为数字!'; $lang->custom->notice->indexPage['product'] = "从8.2版本起增加了产品主页视图,是否默认进入产品主页?"; $lang->custom->notice->indexPage['project'] = "从8.2版本起增加了项目主页视图,是否默认进入项目主页?";