Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
@@ -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.';
|
||||
|
||||
@@ -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 = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body>Sorry, current IP is limited by Administrator. Please contact the Administrator to lift the restrictions.</body></html>";
|
||||
$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';
|
||||
|
||||
@@ -59,6 +59,7 @@ $lang->uploadImages = '多图上传 ';
|
||||
$lang->timeout = '连接超时,请检查网络环境,或重试!';
|
||||
$lang->repairTable = '数据库表可能损坏,请用phpmyadmin或myisamchk检查修复。';
|
||||
$lang->duplicate = '已有相同标题的%s';
|
||||
$lang->ipLimited = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body>抱歉,管理员限制当前IP登录,请联系管理员解除限制。</body></html>";
|
||||
$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';
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 = '最初预计';
|
||||
|
||||
@@ -71,10 +71,7 @@
|
||||
<legend><?php echo $lang->task->legendDesc;?></legend>
|
||||
<div class='article-content'><?php echo $task->desc;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->taskFiles;?></legend>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'false'));?>
|
||||
</fieldset>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true'));?>
|
||||
<?php if($task->fromBug != 0):?>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->bug->steps;?></legend>
|
||||
@@ -82,27 +79,19 @@
|
||||
</fieldset>
|
||||
<?php else:?>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->storySpec;?></legend>
|
||||
<div class='article-content'><?php echo $task->storySpec;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->storyFiles;?></legend>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $task->storyFiles, 'fieldset' => 'false'));?>
|
||||
</fieldset>
|
||||
<fieldset class='actionbox'>
|
||||
<legend><?php echo $lang->task->storyComment;?></legend>
|
||||
<?php
|
||||
foreach($task->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 "<div class='history article-content'>";
|
||||
echo strip_tags($commentAction->comment) == $commentAction->comment ? nl2br($commentAction->comment) : $commentAction->comment;
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
<legend><?php echo $lang->task->story;?></legend>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->storySpec;?></legend>
|
||||
<div class='article-content'><?php echo $task->storySpec;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->storyVerify;?></legend>
|
||||
<div class='article-content'><?php echo $task->storyVerify;?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->storyFiles;?></legend>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $task->storyFiles, 'fieldset' => 'false'));?>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
<?php endif;?>
|
||||
<?php include '../../common/view/action.html.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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;}
|
||||
|
||||
Reference in New Issue
Block a user