From 1e2b7978f8b2d5cd6f3716a8237217e5848555fe Mon Sep 17 00:00:00 2001 From: haoouba <2323333339@qq.com> Date: Sun, 7 Mar 2021 20:55:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/function.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/function.php b/core/function.php index b00fe28..2942d84 100644 --- a/core/function.php +++ b/core/function.php @@ -3,7 +3,7 @@ /* 获取主题当前版本号 */ function _getVersion() { - return "5.6.3"; + return "5.6.4"; }; /* 判断是否是手机 */ @@ -249,16 +249,11 @@ function _getParentReply($parent) function _getAsideAuthorNav() { if (Helper::options()->JAside_Author_Nav && Helper::options()->JAside_Author_Nav !== "off") { + $limit = Helper::options()->JAside_Author_Nav; $db = Typecho_Db::get(); - $result = $db->fetchAll( - $db->select() - ->from('table.contents') - ->where('table.contents.status = ?', 'publish') - ->where('table.contents.type = ?', 'post') - ->where("table.contents.password IS NULL OR table.contents.password = ''") - ->where('table.contents.cid >= ?', '((SELECT MAX(cid) FROM table.contents)-(SELECT MIN(cid) FROM table.contents)) * RAND() + (SELECT MIN(cid) FROM table.contents)') - ->limit(Helper::options()->JAside_Author_Nav) - ); + $prefix = $db->getPrefix(); + $sql = "SELECT * FROM `{$prefix}contents` WHERE cid >= (SELECT floor( RAND() * ((SELECT MAX(cid) FROM `{$prefix}contents`)-(SELECT MIN(cid) FROM `{$prefix}contents`)) + (SELECT MIN(cid) FROM `{$prefix}contents`))) and type='post' and status='publish' and (password is NULL or password='') ORDER BY cid LIMIT $limit"; + $result = $db->query($sql); foreach ($result as $item) { $item = Typecho_Widget::widget('Widget_Abstract_Contents')->push($item); $title = htmlspecialchars($item['title']);