This commit is contained in:
杜恒 2021-05-10 10:48:42 +08:00
parent 4eef566a6a
commit 87b9be6b26
5 changed files with 23 additions and 6 deletions

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
function _getVersion()
{
return "6.8.9";
return "6.9.0";
};
/* 判断是否是手机 */

View File

@ -54,7 +54,7 @@ function _getPost($self)
if ($sticky_text && $page == 1) {
$sticky_arr = explode("||", $sticky_text);
foreach ($sticky_arr as $cid) {
$self->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item);
$self->widget('Widget_Contents_Post@' . $cid, 'cid=' . $cid)->to($item);
if ($item->next()) {
$result[] = array(
"mode" => $item->fields->mode ? $item->fields->mode : 'default',
@ -101,7 +101,7 @@ function _handleViews($self)
header("HTTP/1.1 200 OK");
header('Access-Control-Allow-Origin:*');
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
$cid = $self->request->cid;
$cid = $self->request->cid;
/* sql注入校验 */
if (!preg_match('/^\d+$/', $cid)) {
return $self->response->throwJson(array("code" => 0, "data" => "非法请求!已屏蔽!"));

View File

@ -40,3 +40,20 @@ class Widget_Contents_Sort extends Widget_Abstract_Contents
);
}
}
class Widget_Contents_Post extends Widget_Abstract_Contents
{
public function execute()
{
$select = $this->select();
$select->cleanAttribute('fields');
$this->db->fetchAll(
$select
->from('table.contents')
->where('table.contents.type = ?', 'post')
->where('table.contents.cid = ?', $this->parameter->cid)
->limit(1),
array($this, 'push')
);
}
}

View File

@ -72,7 +72,7 @@
<?php if (sizeof($recommend) === 2) : ?>
<div class="joe_index__banner-recommend <?php echo sizeof($carousel) === 0 ? 'noswiper' : '' ?>">
<?php foreach ($recommend as $cid) : ?>
<?php $this->widget('Widget_Archive@' . $cid, 'pageSize=1&type=post', 'cid=' . $cid)->to($item); ?>
<?php $this->widget('Widget_Contents_Post@' . $cid, 'cid=' . $cid)->to($item); ?>
<figure class="item">
<a class="thumbnail" href="<?php $item->permalink() ?>" title="<?php $item->title() ?>">
<img width="100%" height="100%" class="lazyload" src="<?php _getLazyload(); ?>" data-src="<?php echo _getThumbnails($item)[0]; ?>" alt="<?php $item->title() ?>" />

View File

@ -1,6 +1,6 @@
{
"name": "typecho-joe-next",
"version": "6.8.9",
"version": "6.9.0",
"description": "A Theme Of Typecho",
"main": "index.php",
"keywords": [