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->setNamespace('actionErrors');
$flashMessenger->addMessage($message); $flashMessenger->addMessage($message);
$this->_redirect('/account/login'); $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 { } else {
//$formData['redirect'] = $redirect; //$formData['redirect'] = $redirect;
//$form->populate($formData); //$form->populate($formData);
@ -205,7 +215,7 @@ class AccountController extends Zend_Controller_Action
$db=$ut->getAdapter(); $db=$ut->getAdapter();
$form = new LostpwdForm(); $form = new LostpwdForm();
$key=$this->_request->getParam('key'); $key=$this->_request->getParam('key');
$login=$this->_request->getParam('login'); $login=$this->_request->getParam('login');
if (empty($key) && empty($login)) { if (empty($key) && empty($login)) {
$this->view->form = $form; $this->view->form = $form;
if ($this->_request->isPost()) { if ($this->_request->isPost()) {

View File

@ -707,11 +707,28 @@ class DataController extends Zend_Controller_Action
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$uuid = $this->_request->getParam('uuid'); $uuid = $this->_request->getParam('uuid');
$ft = $this->_request->getParam('ft'); $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(); $datas = array();
$submited = $this->_request->getParam('submited'); $submited = $this->_request->getParam('submited');
@ -723,7 +740,7 @@ class DataController extends Zend_Controller_Action
$datas['email'] = $this->_request->getParam('email'); $datas['email'] = $this->_request->getParam('email');
$datas['project'] = $this->_request->getParam('project'); $datas['project'] = $this->_request->getParam('project');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
$form=$this->creatform($datas); $form=$this->creatform($datas);
@ -822,18 +839,13 @@ class DataController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
if (empty($uuid)) $this->_redirect('/data'); if (empty($uuid)) $this->_redirect('/data');
$userid=Zend_Auth::getInstance()->getIdentity()->id; $userid=Zend_Auth::getInstance()->getIdentity()->id;
/* $testsql="select id from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
* 判断用户是否浑水摸鱼的去下载 $result=$this->db->query($testsql);
$testsql="select id from onlineapp where userid='$userid' and uuid='$uuid'";
$result=$this->db->query($sql,$id);
$rows = $result->fetch(); $rows = $result->fetch();
if (empty($rows['id'])) if (empty($rows['id']))
{ {
$this->_redirect('/data/'.$uuid); $this->_redirect('/data/'.$uuid);
} }
*/
// block end!
$this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id; $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); $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); $rows=$this->db->fetchAll($sql);