fix: 更新
This commit is contained in:
parent
d328ed12d4
commit
f2e5c6cefa
@ -29,9 +29,10 @@ function themeInit($self)
|
|||||||
Helper::options()->commentsThreaded = true;
|
Helper::options()->commentsThreaded = true;
|
||||||
/* 强制回复楼层最高999层 */
|
/* 强制回复楼层最高999层 */
|
||||||
Helper::options()->commentsMaxNestingLevels = 999;
|
Helper::options()->commentsMaxNestingLevels = 999;
|
||||||
|
|
||||||
/* 主题开放API 路由规则 */
|
/* 主题开放API 路由规则 */
|
||||||
if (Typecho_Request::getInstance()->getPathinfo() == "/joe/api") {
|
if ($self->request->getPathInfo() == "/joe/api") {
|
||||||
switch (Typecho_Request::getInstance()->routeType) {
|
switch ($self->request->routeType) {
|
||||||
case 'publish_list':
|
case 'publish_list':
|
||||||
_getPost($self);
|
_getPost($self);
|
||||||
break;
|
break;
|
||||||
@ -71,10 +72,11 @@ function themeInit($self)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 增加自定义SiteMap功能 */
|
/* 增加自定义SiteMap功能 */
|
||||||
if (Helper::options()->JSiteMap && Helper::options()->JSiteMap !== 'off') {
|
if (Helper::options()->JSiteMap && Helper::options()->JSiteMap !== 'off') {
|
||||||
if (strpos(Typecho_Request::getInstance()->getRequestUri(), 'sitemap.xml') !== false) {
|
if (strpos($self->request->getRequestUri(), 'sitemap.xml') !== false) {
|
||||||
Typecho_Response::getInstance()->setStatus(200);
|
$self->response->setStatus(200);
|
||||||
$self->setThemeFile("library/sitemap.php");
|
$self->setThemeFile("library/sitemap.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ class Editor
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
||||||
<script src="<?php Helper::options()->themeUrl('typecho/write/parse/parse.min.js') ?>"></script>
|
<script src="<?php Helper::options()->themeUrl('typecho/write/parse/parse.min.js') ?>"></script>
|
||||||
<script src="<?php Helper::options()->themeUrl('typecho/write/dist/index.bundle.js?v=7.3.3') ?>"></script>
|
<script src="<?php Helper::options()->themeUrl('typecho/write/dist/index.bundle.js') ?>"></script>
|
||||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js') ?>"></script>
|
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js') ?>"></script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* 获取主题当前版本号 */
|
/* 获取主题当前版本号 */
|
||||||
function _getVersion()
|
function _getVersion()
|
||||||
{
|
{
|
||||||
return "7.3.3";
|
return "7.3.5";
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 判断是否是手机 */
|
/* 判断是否是手机 */
|
||||||
@ -157,7 +157,7 @@ function _endCountTime($precision = 3)
|
|||||||
/* 通过邮箱生成头像地址 */
|
/* 通过邮箱生成头像地址 */
|
||||||
function _getAvatarByMail($mail)
|
function _getAvatarByMail($mail)
|
||||||
{
|
{
|
||||||
$gravatarsUrl = Helper::options()->JCustomAvatarSource ? Helper::options()->JCustomAvatarSource : 'https://gravatar.ihuan.me/avatar/';
|
$gravatarsUrl = Helper::options()->JCustomAvatarSource ? Helper::options()->JCustomAvatarSource : 'https://gravatar.helingqi.com/wavatar/';
|
||||||
$mailLower = strtolower($mail);
|
$mailLower = strtolower($mail);
|
||||||
$md5MailLower = md5($mailLower);
|
$md5MailLower = md5($mailLower);
|
||||||
$qqMail = str_replace('@qq.com', '', $mailLower);
|
$qqMail = str_replace('@qq.com', '', $mailLower);
|
||||||
|
162
core/route.php
162
core/route.php
@ -3,24 +3,23 @@
|
|||||||
/* 获取文章列表 已测试 √ */
|
/* 获取文章列表 已测试 √ */
|
||||||
function _getPost($self)
|
function _getPost($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
|
|
||||||
$page = Typecho_Request::getInstance()->page;
|
$page = $self->request->page;
|
||||||
$pageSize = Typecho_Request::getInstance()->pageSize;
|
$pageSize = $self->request->pageSize;
|
||||||
$type = Typecho_Request::getInstance()->type;
|
$type = $self->request->type;
|
||||||
|
|
||||||
/* sql注入校验 */
|
/* sql注入校验 */
|
||||||
if (!preg_match('/^\d+$/', $page)) {
|
if (!preg_match('/^\d+$/', $page)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
if (!preg_match('/^\d+$/', $pageSize)) {
|
if (!preg_match('/^\d+$/', $pageSize)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
if (!preg_match('/^[created|views|commentsNum|agree]+$/', $type)) {
|
if (!preg_match('/^[created|views|commentsNum|agree]+$/', $type)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 如果传入0,强制赋值1 */
|
/* 如果传入0,强制赋值1 */
|
||||||
if ($page == 0) $page = 1;
|
if ($page == 0) $page = 1;
|
||||||
$result = [];
|
$result = [];
|
||||||
@ -67,48 +66,49 @@ function _getPost($self)
|
|||||||
"type" => "normal"
|
"type" => "normal"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Typecho_Response::getInstance()->throwJson(array("data" => $result));
|
|
||||||
|
$self->response->throwJson(array("data" => $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 增加浏览量 已测试 √ */
|
/* 增加浏览量 已测试 √ */
|
||||||
function _handleViews($self)
|
function _handleViews($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$cid = $self->request->cid;
|
||||||
$cid = Typecho_Request::getInstance()->cid;
|
|
||||||
/* sql注入校验 */
|
/* sql注入校验 */
|
||||||
if (!preg_match('/^\d+$/', $cid)) {
|
if (!preg_match('/^\d+$/', $cid)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
$db = Typecho_Db::get();
|
$db = Typecho_Db::get();
|
||||||
$row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid));
|
$row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid));
|
||||||
if (sizeof($row) > 0) {
|
if (sizeof($row) > 0) {
|
||||||
$db->query($db->update('table.contents')->rows(array('views' => (int)$row['views'] + 1))->where('cid = ?', $cid));
|
$db->query($db->update('table.contents')->rows(array('views' => (int)$row['views'] + 1))->where('cid = ?', $cid));
|
||||||
Typecho_Response::getInstance()->throwJson(array(
|
$self->response->throwJson(array(
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => array('views' => number_format($db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid))['views']))
|
"data" => array('views' => number_format($db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid))['views']))
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson(array("code" => 0, "data" => null));
|
$self->response->throwJson(array("code" => 0, "data" => null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 点赞和取消点赞 已测试 √ */
|
/* 点赞和取消点赞 已测试 √ */
|
||||||
function _handleAgree($self)
|
function _handleAgree($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$cid = $self->request->cid;
|
||||||
$cid = Typecho_Request::getInstance()->cid;
|
$type = $self->request->type;
|
||||||
$type = Typecho_Request::getInstance()->type;
|
|
||||||
/* sql注入校验 */
|
/* sql注入校验 */
|
||||||
if (!preg_match('/^\d+$/', $cid)) {
|
if (!preg_match('/^\d+$/', $cid)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
/* sql注入校验 */
|
/* sql注入校验 */
|
||||||
if (!preg_match('/^[agree|disagree]+$/', $type)) {
|
if (!preg_match('/^[agree|disagree]+$/', $type)) {
|
||||||
return Typecho_Response::getInstance()->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
return $self->response->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));
|
||||||
}
|
}
|
||||||
$db = Typecho_Db::get();
|
$db = Typecho_Db::get();
|
||||||
$row = $db->fetchRow($db->select('agree')->from('table.contents')->where('cid = ?', $cid));
|
$row = $db->fetchRow($db->select('agree')->from('table.contents')->where('cid = ?', $cid));
|
||||||
@ -118,22 +118,21 @@ function _handleAgree($self)
|
|||||||
} else {
|
} else {
|
||||||
$db->query($db->update('table.contents')->rows(array('agree' => (int)$row['agree'] - 1))->where('cid = ?', $cid));
|
$db->query($db->update('table.contents')->rows(array('agree' => (int)$row['agree'] - 1))->where('cid = ?', $cid));
|
||||||
}
|
}
|
||||||
Typecho_Response::getInstance()->throwJson(array(
|
$self->response->throwJson(array(
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => array('agree' => number_format($db->fetchRow($db->select('agree')->from('table.contents')->where('cid = ?', $cid))['agree']))
|
"data" => array('agree' => number_format($db->fetchRow($db->select('agree')->from('table.contents')->where('cid = ?', $cid))['agree']))
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson(array("code" => 0, "data" => null));
|
$self->response->throwJson(array("code" => 0, "data" => null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 查询是否收录 已测试 √ */
|
/* 查询是否收录 已测试 √ */
|
||||||
function _getRecord($self)
|
function _getRecord($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$site = $self->request->site;
|
||||||
$site = Typecho_Request::getInstance()->site;
|
|
||||||
$encryption = md5(mt_rand(1655, 100860065) . time());
|
$encryption = md5(mt_rand(1655, 100860065) . time());
|
||||||
$baiduSite = "https://www.baidu.com/s?ie=utf-8&newi=1&mod=1&isid={$encryption}&wd={$site}&rsv_spt=1&rsv_iqid={$encryption}&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&rsv_dl=ib&rsv_sug3=2&rsv_sug1=1&rsv_sug7=001&rsv_n=2&rsv_btype=i&inputT=3083&rsv_sug4=3220&rsv_sug=9&rsv_sid=32818_1460_33042_33060_31660_33099_33101_32961_26350_22159&_ss=1&clist=&hsug=&f4s=1&csor=38&_cr1=32951";
|
$baiduSite = "https://www.baidu.com/s?ie=utf-8&newi=1&mod=1&isid={$encryption}&wd={$site}&rsv_spt=1&rsv_iqid={$encryption}&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&rsv_dl=ib&rsv_sug3=2&rsv_sug1=1&rsv_sug7=001&rsv_n=2&rsv_btype=i&inputT=3083&rsv_sug4=3220&rsv_sug=9&rsv_sid=32818_1460_33042_33060_31660_33099_33101_32961_26350_22159&_ss=1&clist=&hsug=&f4s=1&csor=38&_cr1=32951";
|
||||||
$ip = mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255);
|
$ip = mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255) . '.' . mt_rand(0, 255);
|
||||||
@ -155,21 +154,20 @@ function _getRecord($self)
|
|||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
$res = str_replace([' ', "\n", "\r"], '', $output);
|
$res = str_replace([' ', "\n", "\r"], '', $output);
|
||||||
if (strpos($res, "抱歉,没有找到与") || strpos($res, "找到相关结果约0个") || strpos($res, "没有找到该URL") || strpos($res, "抱歉没有找到")) {
|
if (strpos($res, "抱歉,没有找到与") || strpos($res, "找到相关结果约0个") || strpos($res, "没有找到该URL") || strpos($res, "抱歉没有找到")) {
|
||||||
Typecho_Response::getInstance()->throwJson(array("data" => "未收录"));
|
$self->response->throwJson(array("data" => "未收录"));
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson(array("data" => "已收录"));
|
$self->response->throwJson(array("data" => "已收录"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 主动推送到百度收录 已测试 √ */
|
/* 主动推送到百度收录 已测试 √ */
|
||||||
function _pushRecord($self)
|
function _pushRecord($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
$token = Helper::options()->JBaiduToken;
|
$token = Helper::options()->JBaiduToken;
|
||||||
$domain = Typecho_Request::getInstance()->domain;
|
$domain = $self->request->domain;
|
||||||
$url = Typecho_Request::getInstance()->url;
|
$url = $self->request->url;
|
||||||
$urls = explode(",", $url);
|
$urls = explode(",", $url);
|
||||||
$api = "http://data.zz.baidu.com/urls?site={$domain}&token={$token}";
|
$api = "http://data.zz.baidu.com/urls?site={$domain}&token={$token}";
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
@ -183,7 +181,7 @@ function _pushRecord($self)
|
|||||||
curl_setopt_array($ch, $options);
|
curl_setopt_array($ch, $options);
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
Typecho_Response::getInstance()->throwJson(array(
|
$self->response->throwJson(array(
|
||||||
'domain' => $domain,
|
'domain' => $domain,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'data' => json_decode($result, TRUE)
|
'data' => json_decode($result, TRUE)
|
||||||
@ -193,18 +191,17 @@ function _pushRecord($self)
|
|||||||
/* 获取壁纸分类 已测试 √ */
|
/* 获取壁纸分类 已测试 √ */
|
||||||
function _getWallpaperType($self)
|
function _getWallpaperType($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
$json = _curl("http://cdn.apc.360.cn/index.php?c=WallPaper&a=getAllCategoriesV2&from=360chrome");
|
$json = _curl("http://cdn.apc.360.cn/index.php?c=WallPaper&a=getAllCategoriesV2&from=360chrome");
|
||||||
$res = json_decode($json, TRUE);
|
$res = json_decode($json, TRUE);
|
||||||
if ($res['errno'] == 0) {
|
if ($res['errno'] == 0) {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => $res['data']
|
"data" => $res['data']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => null
|
"data" => null
|
||||||
]);
|
]);
|
||||||
@ -214,22 +211,21 @@ function _getWallpaperType($self)
|
|||||||
/* 获取壁纸列表 已测试 √ */
|
/* 获取壁纸列表 已测试 √ */
|
||||||
function _getWallpaperList($self)
|
function _getWallpaperList($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$cid = $self->request->cid;
|
||||||
$cid = Typecho_Request::getInstance()->cid;
|
$start = $self->request->start;
|
||||||
$start = Typecho_Request::getInstance()->start;
|
$count = $self->request->count;
|
||||||
$count = Typecho_Request::getInstance()->count;
|
|
||||||
$json = _curl("http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid={$cid}&start={$start}&count={$count}&from=360chrome");
|
$json = _curl("http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid={$cid}&start={$start}&count={$count}&from=360chrome");
|
||||||
$res = json_decode($json, TRUE);
|
$res = json_decode($json, TRUE);
|
||||||
if ($res['errno'] == 0) {
|
if ($res['errno'] == 0) {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => $res['data'],
|
"data" => $res['data'],
|
||||||
"total" => $res['total']
|
"total" => $res['total']
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => null
|
"data" => null
|
||||||
]);
|
]);
|
||||||
@ -239,32 +235,30 @@ function _getWallpaperList($self)
|
|||||||
/* 抓取苹果CMS视频分类 已测试 √ */
|
/* 抓取苹果CMS视频分类 已测试 √ */
|
||||||
function _getMaccmsList($self)
|
function _getMaccmsList($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
header("HTTP/1.1 200 OK");
|
|
||||||
$cms_api = Helper::options()->JMaccmsAPI;
|
$cms_api = Helper::options()->JMaccmsAPI;
|
||||||
$ac = Typecho_Request::getInstance()->ac ? Typecho_Request::getInstance()->ac : '';
|
$ac = $self->request->ac ? $self->request->ac : '';
|
||||||
$ids = Typecho_Request::getInstance()->ids ? Typecho_Request::getInstance()->ids : '';
|
$ids = $self->request->ids ? $self->request->ids : '';
|
||||||
$t = Typecho_Request::getInstance()->t ? Typecho_Request::getInstance()->t : '';
|
$t = $self->request->t ? $self->request->t : '';
|
||||||
$pg = Typecho_Request::getInstance()->pg ? Typecho_Request::getInstance()->pg : '';
|
$pg = $self->request->pg ? $self->request->pg : '';
|
||||||
$wd = Typecho_Request::getInstance()->wd ? Typecho_Request::getInstance()->wd : '';
|
$wd = $self->request->wd ? $self->request->wd : '';
|
||||||
if ($cms_api) {
|
if ($cms_api) {
|
||||||
$json = _curl("{$cms_api}?ac={$ac}&ids={$ids}&t={$t}&pg={$pg}&wd={$wd}");
|
$json = _curl("{$cms_api}?ac={$ac}&ids={$ids}&t={$t}&pg={$pg}&wd={$wd}");
|
||||||
$res = json_decode($json, TRUE);
|
$res = json_decode($json, TRUE);
|
||||||
if ($res['code'] === 1) {
|
if ($res['code'] === 1) {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => $res,
|
"data" => $res,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => "抓取失败!请联系作者!"
|
"data" => "抓取失败!请联系作者!"
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => "后台苹果CMS API未填写!"
|
"data" => "后台苹果CMS API未填写!"
|
||||||
]);
|
]);
|
||||||
@ -274,20 +268,19 @@ function _getMaccmsList($self)
|
|||||||
/* 获取虎牙视频列表 已测试 √ */
|
/* 获取虎牙视频列表 已测试 √ */
|
||||||
function _getHuyaList($self)
|
function _getHuyaList($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$gameId = $self->request->gameId;
|
||||||
$gameId = Typecho_Request::getInstance()->gameId;
|
$page = $self->request->page;
|
||||||
$page = Typecho_Request::getInstance()->page;
|
|
||||||
$json = _curl("https://www.huya.com/cache.php?m=LiveList&do=getLiveListByPage&gameId={$gameId}&tagAll=0&page={$page}");
|
$json = _curl("https://www.huya.com/cache.php?m=LiveList&do=getLiveListByPage&gameId={$gameId}&tagAll=0&page={$page}");
|
||||||
$res = json_decode($json, TRUE);
|
$res = json_decode($json, TRUE);
|
||||||
if ($res['status'] === 200) {
|
if ($res['status'] === 200) {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"data" => $res['data'],
|
"data" => $res['data'],
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => "抓取失败!请联系作者!"
|
"data" => "抓取失败!请联系作者!"
|
||||||
]);
|
]);
|
||||||
@ -297,16 +290,15 @@ function _getHuyaList($self)
|
|||||||
/* 获取服务器状态 */
|
/* 获取服务器状态 */
|
||||||
function _getServerStatus($self)
|
function _getServerStatus($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
$api_panel = Helper::options()->JBTPanel;
|
$api_panel = Helper::options()->JBTPanel;
|
||||||
$api_sk = Helper::options()->JBTKey;
|
$api_sk = Helper::options()->JBTKey;
|
||||||
if (!$api_panel) return Typecho_Response::getInstance()->throwJson([
|
if (!$api_panel) return $self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => "宝塔面板地址未填写!"
|
"data" => "宝塔面板地址未填写!"
|
||||||
]);
|
]);
|
||||||
if (!$api_sk) return Typecho_Response::getInstance()->throwJson([
|
if (!$api_sk) return $self->response->throwJson([
|
||||||
"code" => 0,
|
"code" => 0,
|
||||||
"data" => "宝塔接口密钥未填写!"
|
"data" => "宝塔接口密钥未填写!"
|
||||||
]);
|
]);
|
||||||
@ -325,7 +317,7 @@ function _getServerStatus($self)
|
|||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
$response = json_decode(curl_exec($ch), true);
|
$response = json_decode(curl_exec($ch), true);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
Typecho_Response::getInstance()->throwJson(array(
|
$self->response->throwJson(array(
|
||||||
/* 状态 */
|
/* 状态 */
|
||||||
"status" => $response ? true : false,
|
"status" => $response ? true : false,
|
||||||
/* 信息提示 */
|
/* 信息提示 */
|
||||||
@ -350,9 +342,8 @@ function _getServerStatus($self)
|
|||||||
/* 获取最近评论 */
|
/* 获取最近评论 */
|
||||||
function _getCommentLately($self)
|
function _getCommentLately($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$num = 7;
|
$num = 7;
|
||||||
$categories = [];
|
$categories = [];
|
||||||
@ -366,7 +357,7 @@ function _getCommentLately($self)
|
|||||||
$categories[] = $date;
|
$categories[] = $date;
|
||||||
$series[] = $count;
|
$series[] = $count;
|
||||||
}
|
}
|
||||||
Typecho_Response::getInstance()->throwJson([
|
$self->response->throwJson([
|
||||||
"categories" => $categories,
|
"categories" => $categories,
|
||||||
"series" => $series,
|
"series" => $series,
|
||||||
]);
|
]);
|
||||||
@ -375,12 +366,11 @@ function _getCommentLately($self)
|
|||||||
/* 获取文章归档 */
|
/* 获取文章归档 */
|
||||||
function _getArticleFiling($self)
|
function _getArticleFiling($self)
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 200 OK");
|
$self->response->setStatus(200);
|
||||||
header('Access-Control-Allow-Origin:*');
|
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
$page = $self->request->page;
|
||||||
$page = Typecho_Request::getInstance()->page;
|
|
||||||
$pageSize = 8;
|
$pageSize = 8;
|
||||||
if (!preg_match('/^\d+$/', $page)) return Typecho_Response::getInstance()->throwJson(array("data" => "非法请求!已屏蔽!"));
|
if (!preg_match('/^\d+$/', $page)) return $self->response->throwJson(array("data" => "非法请求!已屏蔽!"));
|
||||||
if ($page == 0) $page = 1;
|
if ($page == 0) $page = 1;
|
||||||
$offset = $pageSize * ($page - 1);
|
$offset = $pageSize * ($page - 1);
|
||||||
$time = time();
|
$time = time();
|
||||||
@ -418,5 +408,5 @@ function _getArticleFiling($self)
|
|||||||
}
|
}
|
||||||
$result[] = array("date" => $date, "list" => $list);
|
$result[] = array("date" => $date, "list" => $list);
|
||||||
}
|
}
|
||||||
Typecho_Response::getInstance()->throwJson($result);
|
$self->response->throwJson($result);
|
||||||
}
|
}
|
||||||
|
@ -366,8 +366,8 @@ function themeConfig($form)
|
|||||||
NULL,
|
NULL,
|
||||||
'自定义头像源(非必填)',
|
'自定义头像源(非必填)',
|
||||||
'介绍:用于修改全站头像源地址 <br>
|
'介绍:用于修改全站头像源地址 <br>
|
||||||
例如:https://gravatar.helingqi.com/wavatar/ <br>
|
例如:https://gravatar.ihuan.me/avatar/ <br>
|
||||||
其他:非必填,默认头像源为gravatar.ihuan.me <br>
|
其他:非必填,默认头像源为https://gravatar.helingqi.com/wavatar/ <br>
|
||||||
注意:填写时,务必保证最后有一个/字符,否则不起作用!'
|
注意:填写时,务必保证最后有一个/字符,否则不起作用!'
|
||||||
);
|
);
|
||||||
$JCustomAvatarSource->setAttribute('class', 'joe_content joe_global');
|
$JCustomAvatarSource->setAttribute('class', 'joe_content joe_global');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "typecho-joe-next",
|
"name": "typecho-joe-next",
|
||||||
"version": "7.3.3",
|
"version": "7.3.5",
|
||||||
"description": "A Theme Of Typecho",
|
"description": "A Theme Of Typecho",
|
||||||
"main": "index.php",
|
"main": "index.php",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
Loading…
Reference in New Issue
Block a user