diff --git a/upload/source/class/table/table_forum_threadimage.php b/upload/source/class/table/table_forum_threadimage.php index c782e8264c6835caf12b2a0ecacb928fba34a9e2..49fe1d313f0d5a5a6da5b6b79e0f205060f27bee 100644 --- a/upload/source/class/table/table_forum_threadimage.php +++ b/upload/source/class/table/table_forum_threadimage.php @@ -39,7 +39,14 @@ class table_forum_threadimage extends discuz_table public function fetch_all_order_by_tid($start = 0, $limit = 0) { return DB::fetch_all('SELECT * FROM %t ORDER BY tid DESC '.DB::limit($start, $limit), array($this->_table), 'tid'); } - + public function fetch_all_order_by_tid_for_guide($start = 0, $limit = 0, $fids = 0) { + $tidsql = ''; + $fids = dintval($fids, true); + if($fids) { + $tidsql = is_array($fids) && $fids ? ' AND t.fid IN('.dimplode($fids).')' : ' AND t.fid='.$fids; + } + return DB::fetch_all('SELECT i.* FROM %t i LEFT JOIN %t t ON i.tid = t.tid WHERE 1 %i ORDER BY i.tid DESC '.DB::limit($start, $limit), array($this->_table, 'forum_thread', $tidsql), 'tid'); + } } ?> \ No newline at end of file diff --git a/upload/source/module/forum/forum_index.php b/upload/source/module/forum/forum_index.php index bfdf641028b01f491973a9e5b318a5fe51bd044f..672c3be2a299eb1dd80f9b0129510db158337719 100644 --- a/upload/source/module/forum/forum_index.php +++ b/upload/source/module/forum/forum_index.php @@ -156,7 +156,7 @@ if($_G['setting']['grid']['showgrid']) { if($_G['setting']['grid']['gridtype']) { $grids['digest'] = C::t('forum_thread')->fetch_all_for_guide('digest', 0, array(), 3, 0, 0, 10, $_G['setting']['grid']['fids']); } else { - $images = C::t('forum_threadimage')->fetch_all_order_by_tid(10); + $images = C::t('forum_threadimage')->fetch_all_order_by_tid_for_guide(10, 0, $_G['setting']['grid']['fids']); foreach($images as $key => $value) { $tids[$value['tid']] = $value['tid']; }