Ticket #148 修复了未登陆下载,增加了登陆页面跳转功能。

This commit is contained in:
Li Jianxuan 2011-09-09 09:29:36 +00:00
parent 456508b993
commit 29751d37b6
2 changed files with 34 additions and 12 deletions

View File

@ -129,7 +129,17 @@ class AccountController extends Zend_Controller_Action
$flashMessenger->setNamespace('actionErrors');
$flashMessenger->addMessage($message);
$this->_redirect('/account/login');
} else $this->_redirect($this->_request->getParam('return'));
} else
{
$tohref = $this->_request->getParam('href');
if(!empty($tohref))
{
$this->_redirect($tohref);
}else{
$this->_redirect($this->_request->getParam('return'));
}
}
} else {
//$formData['redirect'] = $redirect;
//$form->populate($formData);

View File

@ -711,7 +711,24 @@ class DataController extends Zend_Controller_Action
$uuid = $this->_request->getParam('uuid');
$ft = $this->_request->getParam('ft');
if (empty($uuid)) $this->_redirect('/data');
if (empty($uuid))
{
echo "请按正确的下载步骤进行下载<br />
如果页面没有自动跳转,<a href='/data'>请点击这里</a>
<script>self.location='/data'</script>";
exit();
}
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity())
{
echo "您需要登录才能下载<br />
如果页面没有自动跳转,<a href='/account/login'>请点击这里进入登录页面</a>
<script>self.location='/account/login/?href='+location.href</script>";
exit();
}
$userid=Zend_Auth::getInstance()->getIdentity()->id;
$datas = array();
$submited = $this->_request->getParam('submited');
@ -723,7 +740,7 @@ class DataController extends Zend_Controller_Action
$datas['email'] = $this->_request->getParam('email');
$datas['project'] = $this->_request->getParam('project');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
$form=$this->creatform($datas);
@ -822,18 +839,13 @@ class DataController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid');
if (empty($uuid)) $this->_redirect('/data');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
/*
* 判断用户是否浑水摸鱼的去下载
$testsql="select id from onlineapp where userid='$userid' and uuid='$uuid'";
$result=$this->db->query($sql,$id);
$testsql="select id from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
$result=$this->db->query($testsql);
$rows = $result->fetch();
if (empty($rows['id']))
{
$this->_redirect('/data/'.$uuid);
}
*/
// block end!
$this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id;
$sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid);
$rows=$this->db->fetchAll($sql);