diff --git a/config/config.php b/config/config.php index 68f4151936..856f8ed5e3 100644 --- a/config/config.php +++ b/config/config.php @@ -106,6 +106,7 @@ $config->framework->logDays = 14; // 日志文件保存的天数。 $config->framework->autoRepairTable = true; $config->framework->autoLang = false; $config->framework->filterCSRF = false; +$config->framework->setCookieSecure = true; $config->framework->detectDevice['zh-cn'] = true; // 在zh-cn语言情况下,是否启用设备检测功能。 Whether enable device detect or not. $config->framework->detectDevice['zh-tw'] = true; // 在zh-tw语言情况下,是否启用设备检测功能。 Whether enable device detect or not. @@ -150,6 +151,10 @@ if(file_exists($filterConfig)) include $filterConfig; $dbConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'db.php'; if(file_exists($dbConfig)) include $dbConfig; +/* 引用自定义的配置。 Include the custom config file. */ +$myConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'my.php'; +if(file_exists($myConfig)) include $myConfig; + /* 禅道配置文件。zentaopms settings. */ $zentaopmsConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'zentaopms.php'; if(file_exists($zentaopmsConfig)) include $zentaopmsConfig; @@ -157,7 +162,3 @@ if(file_exists($zentaopmsConfig)) include $zentaopmsConfig; /* Include extension config files. */ $extConfigFiles = glob(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ext/*.php'); if($extConfigFiles) foreach($extConfigFiles as $extConfigFile) include $extConfigFile; - -/* 引用自定义的配置。 Include the custom config file. */ -$myConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'my.php'; -if(file_exists($myConfig)) include $myConfig; diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 3b7b9c3f7f..423ef4834c 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -868,3 +868,17 @@ function zget($var, $key, $valueWhenNone = false, $valueWhenExists = false) if($valueWhenNone !== false) return $valueWhenNone; return $key; } + +/** + * Is https. + * + * @access public + * @return bool + */ +function isHttps() +{ + if(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') return true; + if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') return true; + if(!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') return true; + return false; +} diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 09bba36b39..cda4a34f63 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -376,6 +376,7 @@ class baseRouter $this->loadClass('dao', $static = true); $this->loadClass('mobile', $static = true); + $this->setCookieSecure(); $this->setSuperVars(); $this->setDebug(); $this->setErrorHandler(); @@ -617,6 +618,18 @@ class baseRouter $_COOKIE = validater::filterSuper($_COOKIE); } + /** + * Set cookieSecure config. + * + * @access public + * @return void + */ + public function setCookieSecure() + { + $this->config->cookieSecure = false; + if($this->config->framework->setCookieSecure and isHttps()) $this->config->cookieSecure = true; + } + /** * 设置Debug模式。 * set Debug. @@ -839,7 +852,7 @@ class baseRouter { $sessionName = $this->config->sessionVar; session_name($sessionName); - session_set_cookie_params(0, $this->config->webRoot); + session_set_cookie_params(0, $this->config->webRoot, '', $this->config->cookieSecure, true); if($this->config->customSession) session_save_path($this->getTmpRoot() . 'session'); session_start(); @@ -916,7 +929,7 @@ class baseRouter $this->clientLang = $this->config->default->lang; } - setcookie('lang', $this->clientLang, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('lang', $this->clientLang, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); if(!isset($_COOKIE['lang'])) $_COOKIE['lang'] = $this->clientLang; return true; @@ -970,7 +983,7 @@ class baseRouter $this->clientTheme = $this->config->default->theme; } - setcookie('theme', $this->clientTheme, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('theme', $this->clientTheme, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); if(!isset($_COOKIE['theme'])) $_COOKIE['theme'] = $this->clientTheme; return true; @@ -996,7 +1009,7 @@ class baseRouter $this->clientDevice = ($mobile->isMobile() and !$mobile->isTablet()) ? 'mobile' : 'desktop'; } - setcookie('device', $this->clientDevice, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('device', $this->clientDevice, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if(!isset($_COOKIE['device'])) $_COOKIE['device'] = $this->clientDevice; return $this->clientDevice; diff --git a/module/bug/control.php b/module/bug/control.php index d79aaa14b5..2ec9e5621a 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -108,22 +108,22 @@ class bug extends control /* Set productID, moduleID, queryID and branch. */ if(!$this->projectID) $productID = $this->product->saveState($productID, $this->products); $branch = ($branch == '') ? (int)$this->cookie->preBranch : (int)$branch; - setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); - setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch or $browseType == 'bybranch') { $_COOKIE['bugModule'] = 0; - setcookie('bugModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); } if($browseType == 'bymodule' or $browseType == '') { - setcookie('bugModule', (int)$param, 0, $this->config->webRoot, '', false, false); + setcookie('bugModule', (int)$param, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $_COOKIE['bugBranch'] = 0; - setcookie('bugBranch', 0, 0, $this->config->webRoot, '', false, false); - if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + setcookie('bugBranch', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); + if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); } - if($browseType == 'bybranch') setcookie('bugBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + if($browseType == 'bybranch') setcookie('bugBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); if($browseType != 'bymodule' and $browseType != 'bybranch') $this->session->set('bugBrowseType', $browseType); $moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bybranch') ? 0 : ($this->cookie->bugModule ? $this->cookie->bugModule : 0)); @@ -135,7 +135,7 @@ class bug extends control /* Set moduleTree. */ if($browseType == '') { - setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $browseType = 'unclosed'; } @@ -153,7 +153,7 @@ class bug extends control /* Process the order by field. */ if(!$orderBy) $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc'; - setcookie('qaBugOrder', $orderBy, 0, $this->config->webRoot, '', false, true); + setcookie('qaBugOrder', $orderBy, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); /* Append id for secend sort. */ $sort = $this->loadModel('common')->appendOrder($orderBy); @@ -341,7 +341,7 @@ class bug extends control $response['message'] = $this->lang->saveSuccess; /* Set from param if there is a object to transfer bug. */ - setcookie('lastBugModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('lastBugModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); $bugResult = $this->bug->create($from = isset($fromObjectIDKey) ? $fromObjectIDKey : ''); if(!$bugResult or dao::isError()) { @@ -383,17 +383,17 @@ class bug extends control if(defined('RUN_MODE') && RUN_MODE == 'api') $this->send(array('status' => 'success', 'data' => $bugID)); - if(isset($output['executionID'])) + if(!empty($output['executionID'])) { $location = $this->createLink('execution', 'bug', "executionID={$output['executionID']}"); } - elseif(isset($output['projectID'])) + elseif(!empty($output['projectID'])) { $location = $this->createLink('project', 'bug', "projectID={$output['projectID']}"); } else { - setcookie('bugModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $location = $this->createLink('bug', 'browse', "productID={$this->post->product}&branch=$branch&browseType=unclosed¶m=0&orderBy=id_desc"); } if($this->app->getViewType() == 'xhtml') $location = $this->createLink('bug', 'view', "bugID=$bugID"); @@ -608,7 +608,7 @@ class bug extends control { $actions = $this->bug->batchCreate($productID, $branch); - setcookie('bugModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); die(js::locate($this->createLink('bug', 'browse', "productID={$productID}&branch=$branch&browseType=unclosed¶m=0&orderBy=id_desc"), 'parent')); } diff --git a/module/caselib/control.php b/module/caselib/control.php index 44abe6bbe5..f2e28ecbd8 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -170,14 +170,14 @@ class caselib extends control /* Set menu. */ $libID = $this->caselib->saveLibState($libID, $libraries); - setcookie('preCaseLibID', $libID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('preCaseLibID', $libID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if($this->cookie->preCaseLibID != $libID) { $_COOKIE['libCaseModule'] = 0; - setcookie('libCaseModule', 0, 0, $this->config->webRoot, '', false, true); + setcookie('libCaseModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); } - if($browseType == 'bymodule') setcookie('libCaseModule', (int)$param, 0, $this->config->webRoot, '', false, true); + if($browseType == 'bymodule') setcookie('libCaseModule', (int)$param, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); if($browseType != 'bymodule') $this->session->set('libBrowseType', $browseType); $moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->libCaseModule ? $this->cookie->libCaseModule : 0)); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; @@ -241,7 +241,7 @@ class caselib extends control { $this->loadModel('testcase'); $this->config->testcase->create->requiredFields = $this->config->caselib->createcase->requiredFields; - setcookie('lastLibCaseModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('lastLibCaseModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); $caseResult = $this->testcase->create($bugID = 0); if(!$caseResult or dao::isError()) die(js::error(dao::getError())); diff --git a/module/doc/control.php b/module/doc/control.php index d632d7b599..f529e24de1 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -41,7 +41,7 @@ class doc extends control public function index() { $this->from = 'doc'; - setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); $this->session->set('docList', $this->app->getURI(true), 'doc'); $this->app->loadClass('pager', $static = true); @@ -79,7 +79,7 @@ class doc extends control public function browse($libID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $from = 'doc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->from = $from; - setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); $this->loadModel('search'); @@ -321,7 +321,7 @@ class doc extends control { if(!empty($_POST)) { - setcookie('lastDocModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('lastDocModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); $docResult = $this->doc->create(); if(!$docResult or dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); @@ -802,7 +802,7 @@ class doc extends control */ public function allLibs($type, $product = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { - setcookie('product', $product, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('product', $product, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); $libName = $this->lang->doc->libTypeList[$type]; $crumb = html::a(inlink('allLibs', "type=$type&product=$product"), $libName); @@ -858,7 +858,7 @@ class doc extends control $this->app->session->set('docList', $uri, 'doc'); if(empty($viewType)) $viewType = !empty($_COOKIE['docFilesViewType']) ? $this->cookie->docFilesViewType : 'card'; - setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); diff --git a/module/doc/model.php b/module/doc/model.php index ed50765b97..b9b2aea351 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1553,7 +1553,7 @@ class docModel extends model $executionProduct = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->andWhere('project')->eq($executionID)->fetch(); if(empty($executionProduct)) { - setcookie('product', 0, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('product', 0, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); return html::a(helper::createLink('doc', 'allLibs', "type=execution"), $this->lang->executionCommon) . $this->lang->doc->separator; } } diff --git a/module/file/model.php b/module/file/model.php index 5ee571358a..b249e3d67c 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -933,7 +933,7 @@ class fileModel extends model for($i = 0; $i < $obLevel; $i++) ob_end_clean(); /* Set the downloading cookie, thus the export form page can use it to judge whether to close the window or not. */ - setcookie('downloading', 1, 0, $this->config->webRoot, '', false, false); + setcookie('downloading', 1, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); /* Only download upload file that is in zentao. */ if($type == 'file' and stripos($content, $this->savePath) !== 0) die(); diff --git a/module/product/control.php b/module/product/control.php index 8ea6d1bd02..57f9d33041 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -137,23 +137,23 @@ class product extends control /* Set product, module and query. */ $branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch; - setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); - setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch or $browseType == 'bybranch') { $_COOKIE['storyModule'] = 0; - setcookie('storyModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('storyModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); } if($browseType == 'bymodule' or $browseType == '') { - setcookie('storyModule', (int)$param, 0, $this->config->webRoot, '', false, false); + setcookie('storyModule', (int)$param, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $_COOKIE['storyBranch'] = 0; - setcookie('storyBranch', 0, 0, $this->config->webRoot, '', false, false); - if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + setcookie('storyBranch', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); + if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); } - if($browseType == 'bybranch') setcookie('storyBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + if($browseType == 'bybranch') setcookie('storyBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bybranch') ? 0 : ($this->cookie->storyModule ? $this->cookie->storyModule : 0)); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; @@ -172,7 +172,7 @@ class product extends control $createModuleLink = $storyType == 'story' ? 'createStoryLink' : 'createRequirementLink'; if($browseType == '') { - setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $browseType = 'unclosed'; } else @@ -195,7 +195,7 @@ class product extends control /* Process the order by field. */ if(!$orderBy) $orderBy = $this->cookie->productStoryOrder ? $this->cookie->productStoryOrder : 'id_desc'; - setcookie('productStoryOrder', $orderBy, 0, $this->config->webRoot, '', false, true); + setcookie('productStoryOrder', $orderBy, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); /* Append id for secend sort. */ $sort = $this->loadModel('common')->appendOrder($orderBy); diff --git a/module/product/model.php b/module/product/model.php index e241d13217..a6c08334d6 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -80,7 +80,7 @@ class productModel extends model } $isMobile = $this->app->viewType == 'mhtml'; - setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); if($productID) $currentProduct = $this->getById($productID); if($isProject) $extra = $this->session->project; @@ -149,7 +149,7 @@ class productModel extends model if($this->cookie->preProductID != $productID) { $this->cookie->set('preBranch', 0); - setcookie('preBranch', 0, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('preBranch', 0, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); } return $this->session->product; diff --git a/module/repo/control.php b/module/repo/control.php index 28fd5cc29a..bb4bd31877 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -411,7 +411,7 @@ class repo extends control { $infos = unserialize(file_get_contents($cacheFile)); } - if($this->cookie->repoRefresh) setcookie('repoRefresh', 0, 0, $this->config->webRoot); + if($this->cookie->repoRefresh) setcookie('repoRefresh', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); /* Set logType and revisions. */ $logType = 'dir'; @@ -885,7 +885,7 @@ class repo extends control } $this->repo->setRepoBranch($branchID); - setcookie("syncBranch", $branchID, 0, $this->config->webRoot); + setcookie("syncBranch", $branchID, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); } } @@ -919,7 +919,7 @@ class repo extends control if($branchID) $this->repo->saveExistCommits4Branch($repo->id, $branchID); $branchID = reset($branches); - setcookie("syncBranch", $branchID, 0, $this->config->webRoot); + setcookie("syncBranch", $branchID, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); if($branchID) $this->repo->fixCommit($repoID); } @@ -955,7 +955,7 @@ class repo extends control $this->scm->setEngine($repo); $this->repo->setRepoBranch($branch); - setcookie("syncBranch", $branch, 0, $this->config->webRoot); + setcookie("syncBranch", $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); $latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1') ->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision') @@ -975,7 +975,7 @@ class repo extends control { if($branch) $this->repo->saveExistCommits4Branch($repo->id, $branch); - setcookie("syncBranch", $branch, 0, $this->config->webRoot); + setcookie("syncBranch", $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); $this->repo->markSynced($repoID); die('finish'); } diff --git a/module/repo/model.php b/module/repo/model.php index 1bdf850feb..41ebe4f62d 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -941,7 +941,7 @@ class repoModel extends model */ public function setRepoBranch($branch) { - setcookie("repoBranch", $branch, 0, $this->config->webRoot); + setcookie("repoBranch", $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); $_COOKIE['repoBranch'] = $branch; } diff --git a/module/story/control.php b/module/story/control.php index 8503465fe6..32a5e1f96a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -94,7 +94,7 @@ class story extends control $response['result'] = 'success'; $response['message'] = $this->lang->saveSuccess; - setcookie('lastStoryModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', false, false); + setcookie('lastStoryModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); $storyResult = $this->story->create($objectID, $bugID, $from = isset($fromObjectIDKey) ? $fromObjectIDKey : ''); if(!$storyResult or dao::isError()) { @@ -159,14 +159,14 @@ class story extends control $moduleID = $this->post->module ? $this->post->module : 0; if($objectID == 0) { - setcookie('storyModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('storyModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $branchID = $this->post->branch ? $this->post->branch : $branch; $response['locate'] = $this->createLink('product', 'browse', "productID=$productID&branch=$branchID&browseType=unclosed¶m=0&type=$type&orderBy=id_desc"); if($this->session->storyList) $response['locate'] = $this->session->storyList; } else { - setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, true); + setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed"; @@ -364,7 +364,7 @@ class story extends control /* Clear title when switching products and set the session for the current product. */ if($productID != $this->cookie->preProductID) unset($_SESSION['storyImagesFile']); - setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); $this->story->replaceURLang($type); @@ -407,7 +407,7 @@ class story extends control } elseif($executionID) { - setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, false); + setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; $param = $execution->type == 'project' ? "projectID=$executionID&productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed"; $link = $this->createLink($moduleName, 'story', $param); @@ -415,7 +415,7 @@ class story extends control } else { - setcookie('storyModule', 0, 0, $this->config->webRoot, '', false, false); + setcookie('storyModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); $locateLink = $this->session->storyList ? $this->session->storyList : $this->createLink('product', 'browse', "productID=$productID&branch=$branch&browseType=unclosed&queryID=0&type=$type"); die(js::locate($locateLink, 'parent')); } diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 7bb3a5c8a6..553eed6ecd 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -11,6 +11,10 @@ */ ?> + story->placeholder); ?> @@ -37,15 +41,11 @@