From 4f4dfe068cac7a1c4478fb27560d35ec6e8fc6a3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 11 Jan 2017 14:55:27 +0800 Subject: [PATCH] * finish task #2871. --- module/bug/control.php | 2 ++ module/product/model.php | 14 +++++++++++++- module/project/model.php | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/module/bug/control.php b/module/bug/control.php index 2bc1ac2de4..da481a996c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -445,6 +445,8 @@ class bug extends control if($bug->project and !$this->loadModel('project')->checkPriv($this->project->getByID($bug->project))) { echo(js::alert($this->lang->project->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); die(js::locate('back')); } diff --git a/module/product/model.php b/module/product/model.php index 44ac2c7d30..6916f224c8 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -28,6 +28,8 @@ class productModel extends model if($products and !isset($products[$productID]) and !$this->checkPriv($this->getById($productID))) { echo(js::alert($this->lang->product->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); die(js::locate('back')); } @@ -95,7 +97,17 @@ class productModel extends model if($productID > 0) $this->session->set('product', (int)$productID); if($productID == 0 and $this->cookie->lastProduct) $this->session->set('product', (int)$this->cookie->lastProduct); if($productID == 0 and $this->session->product == '') $this->session->set('product', key($products)); - if(!isset($products[$this->session->product])) $this->session->set('product', key($products)); + if(!isset($products[$this->session->product])) + { + $this->session->set('product', key($products)); + if($productID > 0) + { + echo(js::alert($this->lang->product->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); + die(js::locate('back')); + } + } if($this->cookie->preProductID != $productID) { $this->cookie->set('preBranch', 0); diff --git a/module/project/model.php b/module/project/model.php index 5edf5a4fcc..2971146bfa 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -86,6 +86,8 @@ class projectModel extends model if($projects and !isset($projects[$projectID]) and !$this->checkPriv($project)) { echo(js::alert($this->lang->project->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); die(js::locate('back')); } @@ -204,6 +206,8 @@ class projectModel extends model if($projectID > 0) { echo(js::alert($this->lang->project->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index'))); die(js::locate('back')); } }