From 4b9ab66d68e868d5dda46a40a696a6eb7598cbff Mon Sep 17 00:00:00 2001 From: fooleap Date: Sat, 5 Aug 2017 06:35:23 +0800 Subject: [PATCH] =?UTF-8?q?Emoji=20=E8=BD=AC=E4=B8=BA=20char=20=E5=8F=91?= =?UTF-8?q?=E7=BB=99=20Disqus=EF=BC=8C=E9=82=AE=E4=BB=B6=E5=B0=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/postcomment.php | 4 ++-- api/sendemail.php | 9 ++++----- api/updatecomment.php | 6 ++++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/api/postcomment.php b/api/postcomment.php index f0a1d37..81149ab 100644 --- a/api/postcomment.php +++ b/api/postcomment.php @@ -10,7 +10,7 @@ * @param url 访客网址,可为空 * * @author fooleap - * @version 2017-08-01 07:30:43 + * @version 2017-08-05 06:33:21 * @link https://github.com/fooleap/disqus-php-api * */ @@ -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( diff --git a/api/sendemail.php b/api/sendemail.php index e4aad21..63ae749 100644 --- a/api/sendemail.php +++ b/api/sendemail.php @@ -10,7 +10,7 @@ * @param id 该评论 ID * * @author fooleap - * @version 2017-08-01 07:33:45 + * @version 2017-08-05 06:23:17 * @link https://github.com/fooleap/disqus-php-api * */ @@ -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']; //被回复留言 @@ -53,9 +52,9 @@ $content .= $reply_message; $content .= '

查看详情及回复请点击:' . $_POST['title'] . '

'; -if( !$parent_isMod ){ - use PHPMailer; +use PHPMailer; +if( $parent_isanon ){ // 发送邮件 require_once('PHPMailer/class.phpmailer.php'); require_once('PHPMailer/class.smtp.php'); diff --git a/api/updatecomment.php b/api/updatecomment.php index f00245d..a7f4e51 100644 --- a/api/updatecomment.php +++ b/api/updatecomment.php @@ -6,7 +6,7 @@ * @param message 评论内容 * * @author fooleap - * @version 2017-08-01 06:10:46 + * @version 2017-08-05 06:33:56 * @link https://github.com/fooleap/disqus-php-api * */ @@ -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){ @@ -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);