diff --git a/config/config.php b/config/config.php index 110ad31c65..c5a7014a2f 100644 --- a/config/config.php +++ b/config/config.php @@ -16,11 +16,12 @@ if(!class_exists('config')){class config{}} if(!function_exists('getWebRoot')){function getWebRoot(){}} /* 基本设置。Basic settings. */ -$config->version = '12.4.4'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it. -$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP. -$config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time. -$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php. -$config->webRoot = ''; // URL根目录。 The root path of the url. +$config->version = '12.4.4'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it. +$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP. +$config->cookieLife = time() + 2592000; // Cookie的生存时间。 The cookie life time. +$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php. +$config->webRoot = ''; // URL根目录。 The root path of the url. +$config->customSession = false; // 是否开启自定义session的存储路径。Whether custom the session save path. /* 框架路由相关设置。Routing settings. */ $config->requestType = 'PATH_INFO'; // 请求类型:PATH_INFO|PATHINFO2|GET。 The request type: PATH_INFO|PATH_INFO2|GET. diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 5518f9dfd8..2cdf1f303b 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -830,6 +830,7 @@ class baseRouter { $sessionName = $this->config->sessionVar; session_name($sessionName); + if($this->config->customSession) session_save_path($this->getTmpRoot() . 'session'); session_start(); $this->sessionID = session_id(); diff --git a/module/bug/model.php b/module/bug/model.php index 59543f9f1a..9f6c64d0a5 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2503,7 +2503,7 @@ class bugModel extends model public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array(), $mode = 'datatable') { /* Check the product is closed. */ - $isClosedProject = common::checkParentObjectClosed('bug', $bug); + $changeAllowed = common::checkObjectChangeAllowed('bug', $bug); $canBatchEdit = common::hasPriv('bug', 'batchEdit'); $canBatchConfirm = common::hasPriv('bug', 'batchConfirm'); @@ -2574,7 +2574,7 @@ class bugModel extends model case 'id': if($canBatchAction) { - $disabled = $isClosedProject ? 'disabled' : ''; + $disabled = $changeAllowed ? '' : 'disabled'; echo html::checkbox('bugIDList', array($bug->id => ''), '', $disabled) . html::a(helper::createLink('bug', 'view', "bugID=$bug->id"), sprintf('%03d', $bug->id)); } else @@ -2726,7 +2726,7 @@ class bugModel extends model echo substr($bug->lastEditedDate, 5, 11); break; case 'actions': - if(!$isClosedProject) + if($changeAllowed) { $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true); diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 3cee72fc05..a79713b707 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -58,7 +58,7 @@ fetch('file', 'printFiles', array('files' => $bug->files, 'fieldset' => 'true', 'object' => $bug));?> - createLink('action', 'comment', "objectType=bug&objectID=$bug->id");?> + createLink('action', 'comment', "objectType=bug&objectID=$bug->id");?> printExtendFields($bug, 'div', "position=left&inForm=0&inCell=1");?>
diff --git a/module/build/control.php b/module/build/control.php index 36f4ea9d61..ee60eb135f 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -213,7 +213,7 @@ class build extends control if(!$build) die(js::error($this->lang->notFound) . js::locate('back')); /* Determines whether an object is editable. */ - $changeAllowed = !common::checkParentObjectClosed('build', $build); + $changeAllowed = common::checkObjectChangeAllowed('build', $build); $product = $this->loadModel('product')->getById($build->product); if($product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); diff --git a/module/common/model.php b/module/common/model.php index 1c3f7efca3..9f4897a508 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1490,7 +1490,7 @@ EOD; global $app, $lang; /* Check the parent object is closed. */ - if(commonModel::checkParentObjectClosed($module, $object)) return false; + if(!commonModel::checkObjectChangeAllowed($module, $object)) return false; /* Check is the super admin or not. */ if(!empty($app->user->admin) || strpos($app->company->admins, ",{$app->user->account},") !== false) return true; @@ -1850,7 +1850,7 @@ EOD; * @access public * @return bool */ - public static function checkParentObjectClosed($module, $object = null) + public static function checkObjectChangeAllowed($module, $object = null) { global $app, $config; @@ -1859,7 +1859,7 @@ EOD; { $productID = trim($object->product, ','); $product = $app->control->loadModel('product')->getByID($productID); - if($product->status == 'closed') return true; + if($product->status == 'closed') return false; /* Get the projects associated with the story. */ if($module == 'story' and empty($object->project)) @@ -1879,11 +1879,11 @@ EOD; $projects = $app->control->loadModel('project')->getByIDList($projectIDList); foreach($projects as $project) { - if($project->status == 'closed') return true; + if($project->status == 'closed') return false; } } - return false; + return true; } /** diff --git a/module/doc/control.php b/module/doc/control.php index 17242bec45..3947ea8fcb 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -853,8 +853,14 @@ class doc extends control setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true); $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; - $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); + $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); if(empty($object)) $this->locate($this->createLink($type, 'create')); + + /* Determines whether an object is editable. */ + $changeAllowed = true; + if($type == 'product' and !empty($this->config->global->closedProductStatus) and $object->status == 'closed') $changeAllowed = false; + if($type == 'project' and !empty($this->config->global->closedProjectStatus) and $object->status == 'closed') $changeAllowed = false; + if($from == 'product') { $this->lang->doc->menu = $this->lang->product->menu; @@ -891,10 +897,11 @@ class doc extends control $this->view->title = $object->name; $this->view->position[] = $object->name; - $this->view->type = $type; - $this->view->object = $object; - $this->view->from = $from; - $this->view->libs = $this->doc->getLibsByObject($type, $objectID); + $this->view->type = $type; + $this->view->object = $object; + $this->view->from = $from; + $this->view->libs = $this->doc->getLibsByObject($type, $objectID); + $this->view->changeAllowed = $changeAllowed; $this->display(); } } diff --git a/module/doc/model.php b/module/doc/model.php index e08db05a43..a399234707 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -107,8 +107,15 @@ class docModel extends model } } + /* Determines whether the doc lib is editable. */ + $docLib = new stdClass(); + $docLib->product = $productID; + $docLib->project = $projectID; + $changeAllowed = common::checkObjectChangeAllowed('doc', $docLib); + + $lib = isset($lib) ? $lib : new stdClass(); $actions = $this->setFastMenu($fastLib); - $actions .= common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib', "type={$type}&objectID={$currentLib}"), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe'") : ''; + $actions .= ($changeAllowed and common::hasPriv('doc', 'createLib', $lib)) ? html::a(helper::createLink('doc', 'createLib', "type={$type}&objectID={$currentLib}"), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe'") : ''; $this->lang->TRActions = $actions; } diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index 599d5c4418..67417d0e2e 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -42,7 +42,7 @@ var browseType = ''; ", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon'");?> ", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon text-primary'");?> - +