在删除评审附件时增加了用户判断,防止附件被其他用户误删

This commit is contained in:
Li Jianxuan 2011-11-09 08:03:01 +00:00
parent e0b5d8a252
commit 46260303a6
1 changed files with 3 additions and 3 deletions

View File

@ -79,7 +79,6 @@ class UploadController extends Zend_Controller_Action {
$basepath = $this->view->config->upload;
$info = $this->getFileinfo($id);
$filepath = $basepath.$info['filename'];
try{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
@ -87,11 +86,12 @@ class UploadController extends Zend_Controller_Action {
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "delete from attachments where id='$id' and userid='$userid'";
if($this->db->exec($sql))
if($this->db->exec($sql)>0)
{
@unlink($filepath);
}
}
}catch(Exception $e){}
//不输出任何错误
}//删除评审附件