forked from Player626/CommentPush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Action.php
36 lines (30 loc) · 861 Bytes
/
Action.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
<?php
/**
* @author gaobinzhan <[email protected]>
* @link https://blog.gaobinzhan.com
*/
class CommentPush_Action extends Typecho_Widget implements Widget_Interface_Do
{
public function action()
{
// TODO: Implement action() method.
}
public static function officialAccount()
{
$options = Helper::options();
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$echostr = $_GET["echostr"];
$token = $options->plugin('CommentPush')->officialAccountToken;
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode($tmpArr);
$tmpStr = sha1($tmpStr);
if ($tmpStr == $signature) {
echo $echostr;
} else {
echo false;
}
}
}