From cd8cd0b43c5931af6c42e78c897b1470e8b29cd5 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 23 May 2016 09:22:03 +0800 Subject: [PATCH] * fix for get cookie branch. --- module/bug/control.php | 8 ++++---- module/product/control.php | 6 +++--- module/qa/control.php | 2 +- module/testcase/control.php | 10 +++++----- module/testtask/control.php | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index d2c6acea50..8d29c3c216 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -66,9 +66,9 @@ class bug extends control /* Set productID, moduleID, queryID and branch. */ $productID = $this->product->saveState($productID, $this->products); - $branch = ($branch == '') ? $this->cookie->preBranch : $branch; + $branch = ($branch == '') ? (int)$this->cookie->preBranch : (int)$branch; setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot); - setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot); + setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch) { @@ -230,7 +230,7 @@ class bug extends control /* Get product, then set menu. */ $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; $branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); $this->bug->setMenu($this->products, $productID, $branch); @@ -367,7 +367,7 @@ class bug extends control /* Get product, then set menu. */ $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; $this->bug->setMenu($this->products, $productID, $branch); /* If projectID is setted, get builds and stories of this project. */ diff --git a/module/product/control.php b/module/product/control.php index f8509fb961..a290c4bbad 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -64,7 +64,7 @@ class product extends control unset($this->lang->product->menu->index); $productID = $this->product->saveState($productID, $this->products); - $branch = $this->cookie->preBranch; + $branch = (int)$this->cookie->preBranch; $this->product->setMenu($this->products, $productID, $branch); $this->view->title = $this->lang->product->index; @@ -121,9 +121,9 @@ class product extends control /* Set product, module and query. */ $productID = $this->product->saveState($productID, $this->products); - $branch = ($branch === '') ? $this->cookie->preBranch : $branch; + $branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch; setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot); - setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot); + setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch) { diff --git a/module/qa/control.php b/module/qa/control.php index c4c9db729f..bab4ceb8b0 100644 --- a/module/qa/control.php +++ b/module/qa/control.php @@ -36,7 +36,7 @@ class qa extends control unset($this->lang->qa->menu->index); $productID = $this->product->saveState($productID, $this->products); - $branch = $this->cookie->preBranch; + $branch = (int)$this->cookie->preBranch; $this->qa->setMenu($this->products, $productID, $branch); $this->view->title = $this->lang->qa->index; diff --git a/module/testcase/control.php b/module/testcase/control.php index bc8bef37f3..7b8a7dacdd 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -62,9 +62,9 @@ class testcase extends control /* Set browseType, productID, moduleID and queryID. */ $productID = $this->product->saveState($productID, $this->products); - $branch = ($branch === '') ? $this->cookie->preBranch : $branch; + $branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch; setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot); - setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot); + setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch) { @@ -147,7 +147,7 @@ class testcase extends control { $groupBy = empty($groupBy) ? 'stroy' : $groupBy; $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; $this->app->loadLang('testtask'); @@ -228,7 +228,7 @@ class testcase extends control /* Set productID and currentModuleID. */ $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; if($storyID and empty($moduleID)) { $story = $this->loadModel('story')->getByID($storyID); @@ -351,7 +351,7 @@ class testcase extends control /* Set productID and currentModuleID. */ $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; if($storyID and empty($moduleID)) { $story = $this->loadModel('story')->getByID($storyID); diff --git a/module/testtask/control.php b/module/testtask/control.php index 8bcdefc5d4..909bc368d3 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -57,7 +57,7 @@ class testtask extends control /* Set menu. */ $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '') $branch = (int)$this->cookie->preBranch; $this->testtask->setMenu($this->products, $productID, $branch); /* Load pager. */