diff --git a/config/config.php b/config/config.php index 739901b4d9..93c376b005 100644 --- a/config/config.php +++ b/config/config.php @@ -82,8 +82,7 @@ $config->file->dangers = 'php,php3,php4,phtml,php5,jsp,py,rb,asp,asa,cer,cdx,asp $config->file->maxSize = 1024 * 1024; // Max size. /* IP white list settings.*/ -$config->ip = new stdclass(); -$config->ip->whiteList = '*'; +$config->ipWhiteList = '*'; /* View type settings. */ $config->devicePrefix['mhtml'] = 'm.'; diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 48e36bb83f..78ff63cea0 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -59,6 +59,7 @@ $lang->uploadImages = 'Upload images '; $lang->timeout = 'Timed out, please check the network, or retry!'; $lang->repairTable = 'The table may be damaged, please repair by phpmyadmin or myisamchk!'; $lang->duplicate = '%s has the same title'; +$lang->ipLimited = "Sorry, current IP is limited by Administrator. Please contact the Administrator to lift the restrictions."; $lang->unfold = '+'; $lang->fold = '-'; @@ -478,6 +479,7 @@ $lang->icons['close'] = 'off'; $lang->icons['activate'] = 'off'; $lang->icons['review'] = 'search'; $lang->icons['confirm'] = 'search'; +$lang->icons['confirmBug'] = 'search'; $lang->icons['putoff'] = 'calendar'; $lang->icons['suspend'] = 'pause'; $lang->icons['pause'] = 'pause'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 1654f4df67..b292501294 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -59,6 +59,7 @@ $lang->uploadImages = '多图上传 '; $lang->timeout = '连接超时,请检查网络环境,或重试!'; $lang->repairTable = '数据库表可能损坏,请用phpmyadmin或myisamchk检查修复。'; $lang->duplicate = '已有相同标题的%s'; +$lang->ipLimited = "抱歉,管理员限制当前IP登录,请联系管理员解除限制。"; $lang->unfold = '+'; $lang->fold = '-'; @@ -478,6 +479,7 @@ $lang->icons['close'] = 'off'; $lang->icons['activate'] = 'off'; $lang->icons['review'] = 'search'; $lang->icons['confirm'] = 'search'; +$lang->icons['confirmBug'] = 'search'; $lang->icons['putoff'] = 'calendar'; $lang->icons['suspend'] = 'pause'; $lang->icons['pause'] = 'pause'; diff --git a/module/common/model.php b/module/common/model.php index d392793607..96016ece75 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -28,6 +28,7 @@ class commonModel extends model $this->setUser(); $this->loadConfigFromDB(); $this->loadCustomFromDB(); + if(!$this->checkIP()) die($this->lang->ipLimited); if($this->app->getViewType() == 'mhtml') $this->setMobileMenu(); $this->app->loadLang('company'); define('FIRST_RUN', true); @@ -1173,6 +1174,47 @@ class commonModel extends model return false; } + /** + * Check whether IP in white list. + * + * @access public + * @return bool + */ + public function checkIP() + { + $ip = $this->server->remote_addr; + + $ipWhiteList = $this->config->ipWhiteList; + + /* If the ip white list is '*'. */ + if($ipWhiteList == '*') return true; + + /* The ip is same as ip in white list. */ + if($ip == $ipWhiteList) return true; + + /* If the ip in white list is like 192.168.1.1-192.168.1.10. */ + if(strpos($ipWhiteList, '-') !== false) + { + list($min, $max) = explode('-', $ipWhiteList); + $min = ip2long(trim($min)); + $max = ip2long(trim($max)); + $ip = ip2long(trim($ip)); + + return $ip >= $min and $ip <= $max; + } + + /* If the ip in white list is in IP/CIDR format eg 127.0.0.1/24. Thanks to zcat. */ + if(strpos($ipWhiteList, '/') == false) $ipWhiteList .= '/32'; + list($ipWhiteList, $netmask) = explode('/', $ipWhiteList, 2); + + $ip = ip2long($ip); + $ipWhiteList = ip2long($ipWhiteList); + $wildcard = pow(2, (32 - $netmask)) - 1; + $netmask = ~ $wildcard; + + return (($ip & $netmask) == ($ipWhiteList & $netmask)); + } + /** * Replace the %s of one key of a menu by $params. * diff --git a/module/task/control.php b/module/task/control.php index 09b3262dd4..de3c32f8d9 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -455,8 +455,8 @@ class task extends control else { $story = $this->story->getById($task->story); - $task->storySpec = empty($story) ? '' : $story->spec; - $task->storyComments = empty($story) ? array() : $this->task->getStoryComments($task->story); + $task->storySpec = empty($story) ? '' : $this->loadModel('file')->setImgSize($story->spec); + $task->storyVerify = empty($story) ? '' : $this->loadModel('file')->setImgSize($story->verify); $task->storyFiles = $this->loadModel('file')->getByObject('story', $task->story); } diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 1397a61924..72bb135fde 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -39,10 +39,9 @@ $lang->task->module = 'Module'; $lang->task->story = 'Story'; $lang->task->storySpec = 'Story desc'; $lang->task->storyFiles = 'Story Files'; -$lang->task->storyComment = 'Story comment'; +$lang->task->storyVerify = 'Story Verify'; $lang->task->name = 'Name'; $lang->task->type = 'Type'; -$lang->task->taskFiles = 'Task files'; $lang->task->pri = 'Pri'; $lang->task->mailto = 'Mailto'; $lang->task->estimate = 'Estimate'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 3673e09a39..08a57e6331 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -39,10 +39,9 @@ $lang->task->module = '所属模块'; $lang->task->story = '相关需求'; $lang->task->storySpec = '需求描述'; $lang->task->storyFiles = '需求附件'; -$lang->task->storyComment = '需求备注'; +$lang->task->storyVerify = '验收标准'; $lang->task->name = '任务名称'; $lang->task->type = '任务类型'; -$lang->task->taskFiles = '任务附件'; $lang->task->pri = '优先级'; $lang->task->mailto = '抄送给'; $lang->task->estimate = '最初预计'; diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index fa374801df..414a9de281 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -71,10 +71,7 @@ task->legendDesc;?>
desc;?>
-
- task->taskFiles;?> - fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'false'));?> -
+ fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true'));?> fromBug != 0):?>
bug->steps;?> @@ -82,27 +79,19 @@
- task->storySpec;?> -
storySpec;?>
-
-
- task->storyFiles;?> - fetch('file', 'printFiles', array('files' => $task->storyFiles, 'fieldset' => 'false'));?> -
-
- task->storyComment;?> - storyComments as $item => $commentAction) - { - if(isset($users[$commentAction->actor])) $commentAction->actor = $users[$commentAction->actor]; - if(strpos($commentAction->actor, ':') !== false) $commentAction->actor = substr($commentAction->actor, strpos($commentAction->actor, ':') + 1); - printf($lang->task->commentActions, $item + 1, $commentAction->date, $commentAction->actor); - - echo "
"; - echo strip_tags($commentAction->comment) == $commentAction->comment ? nl2br($commentAction->comment) : $commentAction->comment; - echo "
"; - } - ?> + task->story;?> +
+ task->storySpec;?> +
storySpec;?>
+
+
+ task->storyVerify;?> +
storyVerify;?>
+
+
+ task->storyFiles;?> + fetch('file', 'printFiles', array('files' => $task->storyFiles, 'fieldset' => 'false'));?> +
diff --git a/module/user/control.php b/module/user/control.php index 392e68e4fc..16932b025b 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -659,9 +659,6 @@ class user extends control die(js::error($failReason)); } - /* Check the login ip is in white list or not. */ - if(!$this->user->checkIP($this->server->remote_addr)) die(js::error($this->lang->user->ipLimited)); - $user = $this->user->identify($account, $password); if($user) diff --git a/module/user/model.php b/module/user/model.php index 7c052a2720..0ce4a3f881 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -530,46 +530,6 @@ class userModel extends model } return !dao::isError(); } - - /** - * Check if the ip is in white list. - * - * @access public - * @param string $ip - * @return bool - */ - public function checkIP($ip) - { - $allowIPs = $this->config->ip->whiteList; - - /* If the ip white list is '*'. */ - if($allowIPs == '*') return true; - - /* The ip is same as ip in white list. */ - if($ip == $allowIPs) return true; - - /* If the ip in white list is like 192.168.1.1-192.168.1.10. */ - if(strpos($allowIPs, '-') !== false) - { - list($min, $max) = explode('-', $allowIPs); - $min = ip2long(trim($min)); - $max = ip2long(trim($max)); - $ip = ip2long(trim($ip)); - - return $ip >= $min and $ip <= $max; - } - - /* If the ip in white list is in IP/CIDR format eg 127.0.0.1/24. Thanks to zcat. */ - if(strpos($allowIPs, '/') == false) $allowIPs .= '/32'; - list($allowIPs, $netmask) = explode('/', $allowIPs, 2); - - $allowIPs = ip2long($allowIPs); - $ip = ip2long($ip); - $wildcard = pow(2, (32 - $netmask)) - 1; - $netmask = ~ $wildcard; - - return (($ip & $netmask) == ($allowIPs & $netmask)); - } /** * Identify a user. diff --git a/www/theme/default/style.css b/www/theme/default/style.css index ee643eb147..fdfc5a7f4c 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -514,7 +514,7 @@ body {font-size: 13px; color:#141414;padding-bottom: 40px;} /* table in outer */ .outer .table {margin-bottom: 0; border: 1px solid #ddd;} -@-moz-document url-prefix(){.outer .table {box-shadow: 1px 0 0 #ddd, -1px 0 0 #ddd; border-left: none; border-right: none; border-bottom: none} .panel .table, #querybox .table, .outer > .container .table-form, .outer > .container .table-data, .outer .main-side .table {box-shadow: none}} +@-moz-document url-prefix(){.outer .table {box-shadow: 1px 1px 0 #ddd, -1px 0 0 #ddd; border-left: none; border-right: none; border-bottom: none} .panel .table, #querybox .table, .outer > .container .table-form, .outer > .container .table-data, .outer .main-side .table {box-shadow: none}} .outer .table thead tr th {text-align: center;} .outer .table thead tr th.text-left {text-align: left;} .outer .table tbody td {vertical-align: middle;}