Skip to content

Commit 9216342

Browse files
author
阳光
committed
Duoshuo更新到1.1.3
1 parent e1d275f commit 9216342

File tree

4 files changed

+14
-28
lines changed

4 files changed

+14
-28
lines changed

Duoshuo/Plugin.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@
44
*
55
* @package Duoshuo
66
* @author Rakiy
7-
* @version 1.1.0
8-
* @link http://www.ysido.com/duoshuo.htm
7+
* @version 1.1.2
8+
* @link http://ysido.com/duoshuo.htm
99
*
10-
* 历史版本
1110
*
12-
* version 1.1.0 -- 2013-12-04
13-
* 修正几处已知BUG
14-
* 增加初始化跳过功能,节约流量
15-
*
16-
* version 1.0.0 -- 2013-12-04
17-
* 实现多说评论的实时同步功能
18-
* 包括: 添加 删除
1911
*/
2012
class Duoshuo_Plugin implements Typecho_Plugin_Interface
2113
{

Duoshuo/libs/Client.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public function __construct($shortName = null, $secret = null, $jwt = null){
2525
$this->generator = Typecho_Widget::widget('Widget_Options')->generator;
2626
$this->http = Typecho_Http_Client::get();
2727
$this->userAgent = $this->generator . '|Duoshuo/'. Duoshuo_Typecho::VERSION;
28-
if(Duoshuo_Typecho::getPlugOption('end_point') !== NULL)
29-
$this->end_point = Duoshuo_Typecho::$PointMap[intval(Duoshuo_Typecho::getPlugOption('end_point'))];
28+
$this->plugin = Duoshuo_Typecho::getInstance();
29+
if($this->plugin->getPlugOption('end_point') !== NULL)
30+
$this->end_point = Duoshuo_Typecho::$PointMap[intval($this->plugin->getPlugOption('end_point'))];
3031
}
3132

3233
/**

Duoshuo/libs/Typecho.php

+8-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
class Duoshuo_Typecho extends Duoshuo_Abstract{
1111

12-
const VERSION = '1.1.0';
12+
const VERSION = '1.1.3';
1313

1414
public static $errorMessages = array();
1515

@@ -319,9 +319,9 @@ public function packageComment($comment){
319319
'author_email' => $comment['mail'] ? $comment['mail'] : '',
320320
'author_url' => $comment['url'],
321321
'created_at' => date('Y-m-d\TH:i:s+00:00',$comment['created']),
322-
'message' => $comment['text'],
322+
'message' => empty($comment['text']) ? '' : $comment['text'],
323323
'agent' => $comment['agent'],
324-
'type' => '',
324+
//'type' => '', //不能加,加了会有问题
325325
'ip' => $comment['ip'],
326326
'status' => $statusMap[$comment['status']],
327327
'parent_key' => $comment['parent'], // TODO 接收的地方要处理一下
@@ -375,22 +375,15 @@ public function export2json(){
375375
$params['threads'][] = $this->packageThread($post);
376376
}
377377
//导出评论
378-
$columns = array('coid', 'cid', 'parent', 'author', 'authorId', 'mail', 'url', 'agent', 'ip', 'text', 'status', 'type', 'created');
379-
$sql = $this->db->select(implode(',', $columns))->from('table.comments')->where('type = ?', 'comment');
378+
$columns = array('coid', 'cid', 'parent', 'author', 'authorId', 'mail', 'url', 'agent', 'ip', 'text', 'status', 'created');
379+
$sql = $this->db->select(implode(',', $columns))->from('table.comments');
380380
$comments = $this->db->fetchAll($sql);
381381
if(!$posts) return false;
382382
foreach ($comments as $index => $comment) {
383383
$params['posts'][] = $this->packageComment($comment);
384384
}
385-
$str = json_encode($params);
386-
$filename = 'Typecho-to-duoshuo-'.date("Y-m-d-h:i:s").'.txt';
387-
header("Content-type: text/plain");
388-
header("Accept-Ranges: bytes");
389-
header("Content-Disposition: attachment; filename=".$filename);
390-
header("Cache-Control: must-revalidate, post-check=0, pre-check=0" );
391-
header("Pragma: no-cache" );
392-
header("Expires: 0" );
393-
echo($str);
394-
return true;
385+
var_dump($params);
386+
die();
387+
395388
}
396389
}

Duoshuo/manage-duoshuo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133

134134
break;
135135
default:
136-
echo '<div id="duoshuo-remote-window" class="conbox"><p>多说实时同步插件 V1.1.0[基于多说官方SDK V0.3]</p><p>环境要求:PHP5.2+ typecho0.9</p><p>最新版本:<a href="http://ysido.com/duoshuo.html" target="_blank">点我查看一下</a></p><p>作  者:<a href="http://ysido.com/" target="_blank">阳光</a> [[email protected]]</p><p>最后更新:2013年12月22日</p><p>特别感谢:<a href="http://www.y2sky.com" target="_blank">燕儿</a><a href="http://www.binjoo.net/" target="_blank">冰剑</a><a href="http://mui.me" target="_blank">西西妹</a><a href="http://shang.qq.com/wpa/qunwpa?idkey=a5a8afedf099e18ddf9b530db9217251e39001d52aace42888bf470d9b6cb86a" target="_blank">Typecho机油群</a></p><p>其它说明:<ul class="tips"><li>1.有时候会出现不能实时更新的问题,请稍后片刻,多说的服务器回PING有延时,若着急同步,请至扩展页点击同步即可</li><li>2.所有bug及反馈建议,请至 <a href="http://ysido.com" target="_blank">http://ysido.com/duoshuo.html</a></li><li>3.如果comments.php用官方默认代码,则无法更换多说主题</li><li>4.如若方便,请尽量在本地导出数据,远程可能会使你的主机不堪重负而罢工</li><li>5.因为插件暂时不支持本地操作同步远程,请用多说界面管理</li><li>6.如果无聊,请点击上方TE机油群,一起吹吹水</li><li>7.作者只是在工作闲余时间做开发,有时候反应不及时敬请谅解.</li></ul></p></div>';
136+
echo '<div id="duoshuo-remote-window" class="conbox"><p>多说实时同步插件 V1.1.3[基于多说官方SDK V0.3]</p><p>环境要求:PHP5.2+ typecho0.9</p><p>最新版本:<a href="http://ysido.com/duoshuo.html" target="_blank">点我查看一下</a></p><p>作  者:<a href="http://ysido.com/" target="_blank">阳光</a> [[email protected]]</p><p>最后更新:2014年1月4日</p><p>特别感谢:<a href="http://www.y2sky.com" target="_blank">燕儿</a><a href="http://www.binjoo.net/" target="_blank">冰剑</a><a href="http://mui.me" target="_blank">西西妹</a><a href="http://shang.qq.com/wpa/qunwpa?idkey=a5a8afedf099e18ddf9b530db9217251e39001d52aace42888bf470d9b6cb86a" target="_blank">Typecho机油群</a></p><p>其它说明:<ul class="tips"><li>1.有时候会出现不能实时更新的问题,请稍后片刻,多说的服务器回PING有延时,若着急同步,请至扩展页点击同步即可</li><li>2.所有bug及反馈建议,请至 <a href="http://ysido.com" target="_blank">http://ysido.com/duoshuo.html</a></li><li>3.如果comments.php用官方默认代码,则无法更换多说主题</li><li>4.如若方便,请尽量在本地导出数据,远程可能会使你的主机不堪重负而罢工</li><li>5.因为插件暂时不支持本地操作同步远程,请用多说界面管理</li><li>6.如果无聊,请点击上方TE机油群,一起吹吹水</li><li>7.作者只是在工作闲余时间做开发,有时候反应不及时敬请谅解.</li></ul></p></div>';
137137
break;
138138
}
139139
?>

0 commit comments

Comments
 (0)