9
9
*/
10
10
class Duoshuo_Typecho extends Duoshuo_Abstract{
11
11
12
- const VERSION = '1.1.0 ' ;
12
+ const VERSION = '1.1.3 ' ;
13
13
14
14
public static $ errorMessages = array ();
15
15
@@ -319,9 +319,9 @@ public function packageComment($comment){
319
319
'author_email ' => $ comment ['mail ' ] ? $ comment ['mail ' ] : '' ,
320
320
'author_url ' => $ comment ['url ' ],
321
321
'created_at ' => date ('Y-m-d\TH:i:s+00:00 ' ,$ comment ['created ' ]),
322
- 'message ' => $ comment ['text ' ],
322
+ 'message ' => empty ( $ comment [ ' text ' ]) ? '' : $ comment ['text ' ],
323
323
'agent ' => $ comment ['agent ' ],
324
- 'type ' => '' ,
324
+ // 'type' => '', //不能加,加了会有问题
325
325
'ip ' => $ comment ['ip ' ],
326
326
'status ' => $ statusMap [$ comment ['status ' ]],
327
327
'parent_key ' => $ comment ['parent ' ], // TODO 接收的地方要处理一下
@@ -375,22 +375,15 @@ public function export2json(){
375
375
$ params ['threads ' ][] = $ this ->packageThread ($ post );
376
376
}
377
377
//导出评论
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 ' );
380
380
$ comments = $ this ->db ->fetchAll ($ sql );
381
381
if (!$ posts ) return false ;
382
382
foreach ($ comments as $ index => $ comment ) {
383
383
$ params ['posts ' ][] = $ this ->packageComment ($ comment );
384
384
}
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
+
395
388
}
396
389
}
0 commit comments