query("SELECT count(*) as total FROM {$tablepre}threads WHERE fid=$fid AND displayorder IN (0)"); $tmp = $db->fetch_array($query); $threadcount = $tmp['total']; $multipage = multi($threadcount, $spp, $page, $mpurl); $Sql = "SELECT t.*, p.message FROM {$tablepre}threads t LEFT JOIN {$tablepre}posts p ON t.tid = p.tid WHERE t.fid=$fid AND t.displayorder = 0 AND p.first=1"; if($typeid<>0){ $Sql .= " And t.typeid = $typeid"; } $Sql .= " ORDER BY dateline DESC LIMIT $start, $spp"; $query = $db->query($Sql); while($thread = $db->fetch_array($query)) { $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600); $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $thread['message'] = cutstr($thread['message'], $cutnum); $query1 = $db->query("SELECT * FROM {$tablepre}attachments WHERE tid=$thread[tid] AND isimage=1 LIMIT 0,1"); $at = $db->fetch_array($query1); if($at){ $thread['thumb'] = 'attachments/'.$at['attachment']; } $query1 = $db->query("SELECT subject FROM {$tablepre}posts WHERE tid=$thread[tid] ORDER BY dateline DESC LIMIT 0,1"); $at = $db->fetch_array($query1); $thread['lastupdate'] = $at['subject']; #--書籤 $query1 = $db->query("SELECT * FROM {$tablepre}dnovel_bm WHERE tid=$thread[tid] AND uid=$discuz_uid LIMIT 0,1"); $at = $db->fetch_array($query1); $thread['bm'] = $at; $threadlist[] = $thread; } function typelist($curtypeid = 0, $special = '', $onchange = '', $modelid = 0) { global $fid, $sid, $extra; $onchange = $onchange ? $onchange : "onchange=\"ajaxget('post.php?action=threadtypes&typeid='+this.options[this.selectedIndex].value+'&fid=$fid&sid=$sid', 'threadtypes', 'threadtypeswait')\""; if($threadtypes = $GLOBALS['forum']['threadtypes']) { $html = ''; return $html; } else { return ''; } } $typeselect = typelist($typeid, '', ''); include template('dnovel_index'); ?>