-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwxtx-master.php
More file actions
52 lines (49 loc) · 1.56 KB
/
wxtx-master.php
File metadata and controls
52 lines (49 loc) · 1.56 KB
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
<?php
/*
Plugin Name: 评论微信提醒
Version: 1.1
Plugin URL: http://www.youngxj.cn
Description: 有新的评论通过微信提醒
Author: 杨小杰
Author Email: [email protected]
Author URL: http://www.youngxj.cn
*/
!defined('EMLOG_ROOT') && exit('access deined!');
function wxd_wxtx_side(){
echo '<li><a href="./plugin.php?plugin=wxtx-master" id="wxd_wxtx">评论微信提醒</a></li>';
}
function wxd_wxtx_msg(){
require (EMLOG_ROOT . '/content/plugins/wxtx-master/wxtx-master_config.php');
if($config["SCKEY"]!=''){
$comname = isset($_POST['comname']) ? addslashes(trim($_POST['comname'])) : '';
$comment = isset($_POST['comment']) ? addslashes(trim($_POST['comment'])) : '';
if (ISLOGIN === true) {
$CACHE = Cache::getInstance();
$user_cache = $CACHE->readCache('user');
$comname = addslashes($user_cache[UID]['name_orig']);
}
if( ROLE != "admin"){
$text = "有人在您的博客发表了评论";
$desp = "**【".$comname."】** 在你的博客中评论:\n\n > ".$comment;
$postdata = http_build_query(
array(
'text' => $text,
'desp' => $desp
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://sc.ftqq.com/'.$config["SCKEY"].'.send', false, $context);
return;
}
}
}
addAction('adm_sidebar_ext', 'wxd_wxtx_side');
addAction('comment_saved', 'wxd_wxtx_msg');
?>