code review

This commit is contained in:
wlx 2012-03-21 02:56:50 +00:00
parent b85bb408d6
commit fae5aed295
1 changed files with 20 additions and 55 deletions

View File

@ -333,7 +333,7 @@ class AuthorController extends Zend_Controller_Action
if(empty($ac) || $ac=='list'){
$sql = "SELECT a.*,m.title,m.description FROM mdauthor a
LEFT JOIN metadata m ON m.uuid=a.uuid
LEFT JOIN normalmetadata m ON m.uuid=a.uuid
WHERE a.userid=?
";
@ -411,7 +411,7 @@ class AuthorController extends Zend_Controller_Action
include_once("EmailText.php");
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mailtp=new EmailText($this->db,"author-newmember",array(
$mailtp=new EmailText($this->db,"author-new",array(
'user' => $row['realname'],
'uuid' => $row['uuid'],
'title'=> $row['title'],
@ -422,14 +422,14 @@ class AuthorController extends Zend_Controller_Action
if($this->debug==0)
{
//获得元数据作者email
/* 不需要给这些人发通知邮件
$info = $this->getEmail($uuid,1);
$address = $info['addrs'];
foreach($address as $v)
{
$mail->addTo($v);
}
}*/
$mail->addTo($row['email']);
$mail->addCc($this->view->config->service->email); //管理员
}else{
@ -498,19 +498,12 @@ class AuthorController extends Zend_Controller_Action
'title'=> $row['title'],
'email'=> $row['email'],
));
/*
mail=>元数据有新作者加入
id=>author-newmember
body=>
您好:
  您申请成为数据《{title}》遭到数据拥有者的否认,如果有疑问请联系数据中心
                    中国西部环境与生态科学数据中心
*/
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
if($this->debug==0)
{
$mail->addTo($row['email']);
$mail->addTo($row['email']);
$mail->addCc($this->view->config->service->email);
}else{
$mail->addTo($this->debug_email);
}
@ -562,7 +555,7 @@ body=>
$addrs['author'] = array();
$addrs["publisher"] = array();
$sql = 'select r.uuid,p.email,md.title,r.role from metadata md
$sql = 'select r.uuid,p.email,md.title,r.role from normalmetadata md
LEFT JOIN role r ON md.uuid=r.uuid
left join responsible p on r.resid=p.id
WHERE r.uuid=? AND p.email IS NOT NULL AND p.email!=?
@ -605,7 +598,7 @@ body=>
}
}
//输出所email (多维数组)
//输出所email (多维数组)
/*
$addrs['resourceProvider']
$addrs['owner']
@ -851,7 +844,7 @@ body=>
include_once("EmailText.php");
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mailtp=new EmailText($this->db,"author-newmember",array(
$mailtp=new EmailText($this->db,"author-new",array(
'user' => $user->realname,
'uuid' => $uuid,
'title'=> $mdtitle,
@ -859,14 +852,7 @@ body=>
));
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
/*
mail=>元数据有新作者加入
id=>author-newmember
body=>
您好:
  {user} ({email}) 已经申请成为元数据《{title}》的作者,如果有疑问请联系该作者或者数据中心服务组
                    中国西部环境与生态科学数据中心
*/
if($this->debug==0)
{
foreach ($address as $dist)
@ -894,7 +880,7 @@ body=>
//激活链接
// /author/accept/?ac=active&vdcode=$vdcode
if(empty($m))
if(empty($m))
{
$sql = "INSERT INTO mdauthor (uuid,userid,activation) VALUES (?,?,?)";
$sth = $this->db->prepare($sql);
@ -907,27 +893,18 @@ body=>
if($ex)
{
//给拥有者发送邮件
//给申请者发送邮件
include_once("EmailText.php");
@$mail=new WestdcMailer($this->view->config->smtp);
@$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
@$mailtp=new EmailText($this->db,"author-apply",array(
'user' => $user->username,
'uuid' => $uuid,
'uuid' => $uuid,
'email'=> $user->email,
//元数据标题
'title'=> $mdtitle,
));
@$mail->setBodyText($mailtp->getBody());
/*
mail=>申请成为数据作者
id=>author-apply
body=>
您好:
  您申请成为元数据《{title}》的作者,目前已经提交申请,请等待专家审核
                    中国西部环境与生态科学数据中心 
*/
@$mail->setSubject($mailtp->getSubject());
if($this->debug==0)
{
@ -940,7 +917,7 @@ body=>
unset($mail);
unset($mailtp);
//给原来的元数据作者以及管理员发送邮件
//给元数据作者以及管理员发送邮件
@$mail=new WestdcMailer($this->view->config->smtp);
@$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
@$mailtp=new EmailText($this->db,"author-apply-confirm",array(
@ -961,26 +938,14 @@ body=>
));
@$mail->setBodyText($mailtp->getBody());
@$mail->setSubject($mailtp->getSubject());
/*
mail=>元数据作者激活
id=>author-apply-confirm
body=>
您好:
  元数据《{title}》有新用户 {user} (Email:{email})申请成为作者。
如果同意该申请,请点击这条链接
{active}
如果不同意该申请,请点击这条链接
{lock}
元数据访问地址:{link}
                    中国西部环境与生态科学数据中心 
*/
if($this->debug==0)
{
{
//此处应进行判断,数据是否已经有管理者,若有管理者,则只给管理者发送确认邮件即可!
//todo
foreach ($address as $dist)
{$mail->addTo($dist);} //元数据作者
//$mail->addCc($this->view->config->service->email); //管理员
$mail->addCc($this->view->config->service->email); //管理员
}else{
@$mail->addTo($this->debug_email);
}