Skip to content

Commit

Permalink
Emoji 转为 char 发给 Disqus,邮件小问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fooleap committed Aug 5, 2017
1 parent 8f7f21d commit 4b9ab66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/postcomment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @param url 访客网址,可为空
*
* @author fooleap <fooleap@gmail.com>
* @version 2017-08-01 07:30:43
* @version 2017-08-05 06:33:21
* @link https://github.com/fooleap/disqus-php-api
*
*/
Expand All @@ -31,7 +31,7 @@
}
}

$post_message = $client->shortnameToUnicode($_POST['message']);
$post_message = html_entity_decode($client->shortnameToUnicode($_POST['message']));
//$post_message = $client->unifyUnicode($_POST['message']);

$post_data = array(
Expand Down
9 changes: 4 additions & 5 deletions api/sendemail.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @param id 该评论 ID
*
* @author fooleap <fooleap@gmail.com>
* @version 2017-08-01 07:33:45
* @version 2017-08-05 06:23:17
* @link https://github.com/fooleap/disqus-php-api
*
*/
Expand All @@ -30,8 +30,7 @@
$curl_url = '/api/3.0/posts/details.json?'.http_build_query($fields_data);
$data = curl_get($curl_url);
$post = post_format($data->response);
//$parent_isanon = $data->response->author->isAnonymous; //是否为访客
$parent_isMod = $post['isMod'];
$parent_isanon = $data->response->author->isAnonymous; //是否为访客
$parent_email = $data->response->author->email; //被回复邮箱
$parent_name = $post['name']; //被回复人名
$parent_message = $post['message']; //被回复留言
Expand All @@ -53,9 +52,9 @@
$content .= $reply_message;
$content .= '<p>查看详情及回复请点击:<a target="_blank" href="'.$website. $_POST['link'] . '#comment-' . $_POST['parent'] . '">' . $_POST['title'] . '</a></p>';

if( !$parent_isMod ){
use PHPMailer;
use PHPMailer;

if( $parent_isanon ){
// 发送邮件
require_once('PHPMailer/class.phpmailer.php');
require_once('PHPMailer/class.smtp.php');
Expand Down
6 changes: 4 additions & 2 deletions api/updatecomment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param message 评论内容
*
* @author fooleap <fooleap@gmail.com>
* @version 2017-08-01 06:10:46
* @version 2017-08-05 06:33:56
* @link https://github.com/fooleap/disqus-php-api
*
*/
Expand All @@ -22,6 +22,8 @@
$data = curl_get($curl_url);
$duration = time() - strtotime($data->response->createdAt);

$post_message = html_entity_decode($client->shortnameToUnicode($_POST['message']));

$output = array();

if($data->code !== 0){
Expand All @@ -38,7 +40,7 @@
$post_data = array(
'api_key' => DISQUS_PUBKEY,
'post' => $_POST['id'],
'message' => $_POST['message']
'message' => $post_message
);
$curl_url = '/api/3.0/posts/update.json';
$data = curl_post($curl_url, $post_data);
Expand Down

0 comments on commit 4b9ab66

Please sign in to comment.