-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
13,534 additions
and
3,149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* 配置文件 | ||
* | ||
* @author fooleap <[email protected]> | ||
* @version 2017-07-27 20:33:28 | ||
* @version 2018-03-10 13:19:05 | ||
* @link https://github.com/fooleap/disqus-php-api | ||
* | ||
*/ | ||
|
@@ -13,6 +13,8 @@ | |
* Disqus 设置 | ||
* | ||
* DISQUS_PUBKEY Disqus 公钥,无需修改 | ||
* PUBLIC_KEY Disqus APP 公钥,在 https://disqus.com/api/applications/ 申请注册后获得 | ||
* SECRET_KEY Disqus APP 私钥,在 https://disqus.com/api/applications/ 申请注册后获得 | ||
* DISQUS_USERNAME Disqus 用户名 | ||
* DISQUS_EMAIL Disqus 注册邮箱,重要 | ||
* DISQUS_PASSWORD Disqus 密码,重要 | ||
|
@@ -27,6 +29,8 @@ | |
*/ | ||
|
||
define('DISQUS_PUBKEY', 'E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F'); | ||
define('PUBLIC_KEY', ''); | ||
define('SECRET_KEY', ''); | ||
define('DISQUS_USERNAME', ''); | ||
define('DISQUS_EMAIL', ''); | ||
define('DISQUS_PASSWORD', ''); | ||
|
@@ -51,13 +55,11 @@ | |
* 图片设置 | ||
* | ||
* GRAVATAR_CDN Gravatar 头像 CDN | ||
* GRAVATAR_DEFAULT 默认头像 URL | ||
* EMOJI_PATH Emoji 表情 PNG 资源路径 | ||
* | ||
*/ | ||
|
||
define('GRAVATAR_CDN', '//cn.gravatar.com/avatar/'); | ||
define('GRAVATAR_DEFAULT', 'https://a.disquscdn.com/images/noavatar92.png'); | ||
define('EMOJI_PATH', 'https://assets-cdn.github.com/images/icons/emoji/unicode/'); | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,14 @@ | |
* @param identifier identifier | ||
* | ||
* @author fooleap <[email protected]> | ||
* @version 2017-07-01 16:13:50 | ||
* @version 2018-03-10 13:59:51 | ||
* @link https://github.com/fooleap/disqus-php-api | ||
* | ||
*/ | ||
namespace Emojione; | ||
require_once('init.php'); | ||
$curl_url = '/api/3.0/threads/create.json'; | ||
$post_data = array( | ||
'api_key' => DISQUS_PUBKEY, | ||
$post_data = (object) array( | ||
'forum' => DISQUS_SHORTNAME, | ||
'identifier' => $_POST['identifier'], | ||
'message' => $_POST['message'], | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,14 @@ | |
* @param cursor 当前评论位置 | ||
* | ||
* @author fooleap <[email protected]> | ||
* @version 2017-11-13 17:03:14 | ||
* @version 2018-03-10 14:00:54 | ||
* @link https://github.com/fooleap/disqus-php-api | ||
* | ||
*/ | ||
namespace Emojione; | ||
require_once('init.php'); | ||
|
||
$fields_data = array( | ||
$fields_data = (object) array( | ||
'api_key' => DISQUS_PUBKEY, | ||
'cursor' => $_GET['cursor'], | ||
'limit' => 50, | ||
|
@@ -25,7 +25,7 @@ | |
$curl_url = '/api/3.0/threads/listPostsThreaded?'.http_build_query($fields_data); | ||
$data = curl_get($curl_url); | ||
|
||
$fields_data = array( | ||
$fields_data = (object) array( | ||
'api_key' => DISQUS_PUBKEY, | ||
'forum' => DISQUS_SHORTNAME, | ||
'thread' => 'link:'.$website.$_GET['link'] | ||
|
@@ -40,26 +40,14 @@ | |
} | ||
} | ||
|
||
//if( isset($detail -> response -> ipAddress)){ | ||
if( strpos($session, 'session') !== false ){ | ||
$isAuth = true; | ||
} else { | ||
$isAuth = false; | ||
} | ||
|
||
if($data -> code == 0 ){ | ||
$output = array( | ||
'auth' => $isAuth, | ||
'code' => $detail -> code, | ||
'cursor' => $data -> cursor, | ||
'link' => 'https://disqus.com/home/discussion/'.DISQUS_SHORTNAME.'/'.$detail -> response -> slug.'/?l=zh', | ||
'posts' => $detail -> response -> posts, | ||
'response' => $posts, | ||
'thread' => $detail -> response -> id | ||
); | ||
} else { | ||
$output = $data; | ||
$output -> auth = $isAuth; | ||
} | ||
$output = $data -> code == 0 ? (object) array( | ||
'code' => $detail -> code, | ||
'cursor' => $data -> cursor, | ||
'forum' => $forum_data -> forum, | ||
'link' => 'https://disqus.com/home/discussion/'.DISQUS_SHORTNAME.'/'.$detail -> response -> slug.'/?l=zh', | ||
'posts' => $detail -> response -> posts, | ||
'response' => $posts, | ||
'thread' => $detail -> response -> id | ||
) : $data; | ||
|
||
print_r(json_encode($output)); |
Oops, something went wrong.