review中修改了下载时的用户判断和输出下载的目标窗口
This commit is contained in:
parent
32b30a6126
commit
5684a7ca1c
|
@ -410,7 +410,7 @@ class ReviewController extends Zend_Controller_Action
|
|||
}
|
||||
$list[] = '
|
||||
<li>'.$v['realname'].' ('.$v['filesize'].')
|
||||
<span><a href="/review/downatt/id/'.$v['id'].'">下载</a></span>
|
||||
<span><a href="/review/downatt/id/'.$v['id'].'" target="_blank">下载</a></span>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
|
@ -432,6 +432,10 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
$id = $this->_request->getParam('id');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
try{
|
||||
$sql = "select * from attachments where id='$id'";
|
||||
|
||||
$re = $this->db->query($sql);
|
||||
|
@ -462,7 +466,7 @@ class ReviewController extends Zend_Controller_Action
|
|||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
|
||||
->setHeader('Content-Disposition','attachment; filename="'.basename($fullPath).'"')
|
||||
->setHeader('Content-Disposition','attachment; filename="'.$row['realname'].'"')
|
||||
->setHeader('Content-Length', $fsize)
|
||||
->setHeader('Content-Type','application/force-download')
|
||||
->setHeader('Content-Type','application/download')
|
||||
|
@ -473,6 +477,16 @@ class ReviewController extends Zend_Controller_Action
|
|||
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
|
||||
->setHeader('Pragma','public')
|
||||
->setBody($content);
|
||||
$sql = "update attachments set downtimes=downtimes+1 where id = $id";
|
||||
@$this->db->exec($sql);
|
||||
}catch(Exception $e){
|
||||
echo '文件读取出错,请稍后重试';
|
||||
}
|
||||
}else{
|
||||
echo '读取用户信息出错,请先登录再下载附件';
|
||||
}
|
||||
|
||||
|
||||
}// downattAction 下载附件
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue