增加了元数据评论后发送邮件到管理员邮箱的功能

This commit is contained in:
Li Jianxuan 2011-10-27 07:36:10 +00:00
parent a983f5c52d
commit d517bcdee4
1 changed files with 52 additions and 32 deletions

View File

@ -627,7 +627,8 @@ class DataController extends Zend_Controller_Action
if ($this->_request->isPost()) { if ($this->_request->isPost()) {
include_once("bcspamblock.php"); include_once("bcspamblock.php");
$formdata=$this->_request->getPost(); $formdata=$this->_request->getPost();
if (bcspamblock_verify() && $commentForm->isValid($formdata)) { //if (bcspamblock_verify() && $commentForm->isValid($formdata)) {
if ( $commentForm->isValid($formdata)) {
$sql="insert into comments (userid,uuid,author,email,url,ip,content,agent,type) values(?,?,?,?,?,?,?,?,?)"; $sql="insert into comments (userid,uuid,author,email,url,ip,content,agent,type) values(?,?,?,?,?,?,?,?,?)";
$agent=$this->_request->getHeader('User-Agent'); $agent=$this->_request->getHeader('User-Agent');
$ip=$this->_request->getServer('REMOTE_ADDR'); $ip=$this->_request->getServer('REMOTE_ADDR');
@ -636,6 +637,25 @@ class DataController extends Zend_Controller_Action
$content=$stripper->filter($formdata['content']); $content=$stripper->filter($formdata['content']);
$author=$stripper->filter($formdata['author']); $author=$stripper->filter($formdata['author']);
$this->db->query($sql,array($formdata['uid'],$formdata['uuid'],$author,$formdata['email'],$formdata['url'],$ip,$content,$agent,$type)); $this->db->query($sql,array($formdata['uid'],$formdata['uuid'],$author,$formdata['email'],$formdata['url'],$ip,$content,$agent,$type));
$patt = array();
$patt['user'] = $author;
$patt['uuid'] = $formdata['uuid'];
$patt['title']= $this->view->metadata->title;
$patt['content']= $content;
/*
$patt = array(
'user' =>$author,
'uuid' =>$formdata['uuid'],
'title' =>$this->view->metadata['title'],
//'content' =>$content
);*/
$mailtp=new EmailText($this->db,"data-comments-posted",$patt);
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setBodyText($mailtp->getBody());
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($this->view->config->service->email);
$mail->setSubject($mailtp->getSubject());
@$mail->send();
$formdata['content']=''; $formdata['content']='';
} }
} elseif ($user) { } elseif ($user) {