-
Notifications
You must be signed in to change notification settings - Fork 23
/
comment.php
95 lines (88 loc) · 2.59 KB
/
comment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* 评论通知管理员或用户(邮件或短信)
* @作者 qinggan <[email protected]>
* @版权 深圳市锟铻科技有限公司
* @主页 http://www.phpok.com
* @版本 4.x
* @授权 http://www.phpok.com/lgpl.html 开源授权协议:GNU Lesser General Public License
* @时间 2018年03月10日
**/
/**
* 安全限制,防止直接访问
**/
if(!defined("PHPOK_SET")){
exit("<h1>Access Denied</h1>");
}
if(!$param['id']){
return false;
}
$id = $param['id'];
$rs = $this->model('reply')->get_one($id);
if(!$rs){
return false;
}
$this->assign('rs',$rs);
//用户信息
if($rs['uid']){
$user_rs = $this->model('user')->get_one($rs['uid']);
if($user_rs){
$this->assign('user_rs',$user_rs);
}
}
//主题信息
if($rs['tid']){
$title_rs = $this->model('content')->get_one($rs['tid'],false);
$this->assign('title_rs',$title_rs);
if($title_rs['user_id']){
$user_rs = $this->model('user')->get_one($title_rs['user_id']);
if($user_rs){
$this->assign('user_rs',$user_rs);
}
}
}
//订单信息
if($rs['order_id']){
$order = $this->model('order')->get_one($rs['order_id']);
$this->assign('order',$order);
}
if($title_rs){
$project = $this->model('project')->get_one($title_rs['project_id'],false);
if(!$project){
return false;
}
if($project['etpl_comment_admin']){
$this->gateway('type','email');
$this->gateway('param','default');
$tpl = $this->model('email')->tpl($project['etpl_comment_admin']);
$condition = "email!='' AND if_system=1 AND status=1";
$admin = $this->model('admin')->get_list($condition,0,1);
if($tpl && $admin){
$admin = current($admin);
$this->assign('admin',$admin);
$email = $admin['email'];
$fullname = $admin['fullname'] ? $admin['fullname'] : $admin['account'];
$this->assign('fullname',$fullname);
$title = $this->fetch($tpl['title'],'msg');
$content = $this->fetch($tpl['content'],'msg');
if($title && $email && $content){
$array = array('email'=>$email,'fullname'=>$fullname,'title'=>$title,'content'=>$content);
$this->gateway('exec',$array);
}
}
}
if($project['etpl_comment_user'] && $user_rs && $user_rs['email']){
$this->gateway('type','email');
$this->gateway('param','default');
$tpl = $this->model('email')->tpl($project['etpl_comment_user']);
if($tpl){
$fullname = $usre_rs['fullname'] ? $usre_rs['fullname'] : $usre_rs['user'];
$title = $this->fetch($tpl['title'],'msg');
$content = $this->fetch($tpl['content'],'msg');
if($title && $email && $content){
$array = array('email'=>$email,'fullname'=>$fullname,'title'=>$title,'content'=>$content);
$this->gateway('exec',$array);
}
}
}
}