- 註冊時間
- 2006-3-13
- 最後登錄
- 2025-1-10
- 在線時間
- 673 小時
- 閱讀權限
- 200
- 積分
- 417
- 帖子
- 1107
- 精華
- 0
- UID
- 2
  
|
適用版本: 5.5.0
1.) 修改 include/cache.func.php
尋找
- 'medals' => array('medals'),
複製代碼
在之後加入
- 'newtopic' => array('newtopic'),
- 'newreply' => array('newreply'),
複製代碼
尋找
- case 'medals':
- $table = 'medals';
- $cols = 'medalid, name, image';
- $conditions = "WHERE available='1'";
- break;
複製代碼
在之後加入(選擇兩者之一)
- //所有討論區都可以在最新(發文/回覆)列出
- case 'newtopic' :
- $table = 'threads t';
- $cols = 't.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname';
- $conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' ORDER BY t.dateline DESC LIMIT 0, 6";
- break;
- case 'newreply' :
- $table = 'threads t';
- $cols = 't.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname';
- $conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 6";
- break;
複製代碼- //特定討論區的主題不在最新(發文/回覆)列出
- case 'newtopic' :
- $table = 'threads t';
- $cols = 't.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname';
- $fids = '';//不需顯示的討論區ID,逗號分隔
- $conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' AND f.fid NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 6";
- break;
- case 'newreply' :
- $table = 'threads t';
- $cols = 't.tid, t.typeid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name, tt.name AS idname';
- $fids = '';//不需顯示的討論區ID,逗號分隔
- $conditions = "LEFT JOIN {$tablepre}threadtypes tt ON (tt.typeid=t.typeid) LEFT JOIN {$tablepre}forums f ON (f.fid=t.fid) WHERE t.fid<>'$fid' AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 6";
- break;
複製代碼
尋找
- case 'forumlinks':
- global $forumlinkstatus;
複製代碼
在之前加入
- case 'newtopic':
- $hack_cut_str = 36;
- $new_post_threadlist = array();
- $nthread = array();
- $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
- while($nthread = $db->fetch_array($query)) {
- $nthread['forumname'] = $nthread['name'];
- $nthread['view_subject'] = $nthread[idname] ? cutstr( "$nthread[idname] $nthread[subject]",$hack_cut_str) : cutstr($nthread['subject'],$hack_cut_str);
- $nthread['subject'] = $nthread['subject'];
- $nthread['date']= gmdate('Y-n-j G:i', $nthread['dateline'] + 8 * 3600);
- $nthread['lastreplytime']= gmdate('Y-n-j G:i', $nthread[lastpost] + 8 * 3600);
- if($nthread['highlight']) {
- $string = sprintf('%02d', $nthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $nthread['highlight'] = 'style="';
- $nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $nthread['highlight'] .= '"';
- } else {
- $nthread['highlight'] = '';
- }
- $new_post_threadlist = $nthread[replies] ? "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次 \r\n回覆: $nthread[replies] 次\r\n最後回覆: $nthread[lastreplytime]\r\n最後發表: $nthread[lastposter]\" $nthread[highlight] >$nthread[view_subject]</a><br>" : "<a href=\"redirect.php?tid=$nthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $nthread[forumname]\r\n標題: $nthread[subject]\r\n作者: $nthread[author]\r\n發表時間: $nthread[date]\r\n瀏覽次數: $nthread[views] 次\r\n回覆: 暫時沒有回覆\" $nthread[highlight] >$nthread[view_subject]</a><br>";
- $data[] = array('content' => $new_post_threadlist);
- }
- break;
- case 'newreply':
- $hack_cut_str = 36;
- $new_reply_threadlist = array();
- $rthread = array();
- $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
- while($rthread = $db->fetch_array($query)) {
- $rthread['forumname'] = $rthread['name'];
- $rthread['view_subject'] = $rthread[idname] ? cutstr( "$rthread[idname] $rthread[subject]",$hack_cut_str) : cutstr($rthread['subject'],$hack_cut_str);
- $rthread['subject'] = $rthread['subject'];
- $rthread['date']= gmdate('Y-n-j G:i', $rthread['dateline'] + 8 * 3600);
- $rthread['lastreplytime']= gmdate('Y-n-j G:i', $rthread['lastpost'] + 8 * 3600);
- if($rthread['highlight']) {
- $string = sprintf('%02d', $rthread['highlight']);
- $stylestr = sprintf('%03b', $string[0]);
- $rthread['highlight'] = 'style="';
- $rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
- $rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
- $rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
- $rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
- $rthread['highlight'] .= '"';
- } else {
- $rthread['highlight'] = '';
- }
- $new_reply_threadlist = "<a href=\"redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost\" title=\"論壇: $rthread[forumname]\r\n標題: $rthread[subject]\r\n作者: $rthread[author]\r\n發表時間: $rthread[date]\r\n瀏覽次數: $rthread[views] 次\r\n回覆: $rthread[replies] 次\r\n最後回覆: $rthread[lastreplytime]\r\n最後發表: $rthread[lastposter]\" $rthread[highlight]>$rthread[view_subject]</a><br>";
- $data[] = array('content' => $new_reply_threadlist);
- }
- break;
複製代碼
2.) 修改 include/newthread.inc.php
尋找
- showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra");
複製代碼
在之前加入
- require DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('newtopic');
複製代碼
3.) 修改 include/newreply.inc.php
尋找
- showmessage('post_reply_succeed', "viewthread.php?tid=$tid&pid=$pid&page=".(@ceil(($thread['replies'] + 2) / $ppp))."&extra=$extra#pid$pid");
複製代碼
在之前加入
- require DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('newreply');
- updatecache('newtopic');
複製代碼
4.) 修改 topicadmin.php
尋找
- require_once DISCUZ_ROOT.'./include/misc.func.php';
複製代碼
在之後加入
- require_once DISCUZ_ROOT.'./include/cache.func.php';
複製代碼
尋找
- showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
複製代碼
在之前加入
- updatecache('newtopic');
- updatecache('newreply');
複製代碼
5.) 修改 index.php
找到
- $catlist = $forumlist = $sublist = $pmlist = array();
複製代碼
在之前加入
- require_once DISCUZ_ROOT.'./include/misc.func.php';
- include './forumdata/cache/cache_newtopic.php';
- include './forumdata/cache/cache_newreply.php';
複製代碼
尋找
- foreach(array('forumlinks', 'birthdays', 'supe_updateusers') as $key) {
複製代碼
修改成
- foreach(array('forumlinks', 'birthdays', 'supe_updateusers', 'foruminfo') as $key) {
複製代碼
6.) 建立範本檔 templates/default/foruminfo.htm
內容輸入
- <div class='spaceborder spacebottom' style="width: {TABLEWIDTH}; clear: both; margin-top: 5px;">
- <table cellspacing="0" cellpadding="4" width='100%'>
- <tr class='header'><td>New Topic</td><td>New Reply</td></tr>
- <tr>
- <td class='smalltxt'>
- <!--{loop $_DCACHE['newtopic'] $newtopic}-->
- $newtopic[content]
- <!--{/loop}-->
- </td>
- <td class='smalltxt'>
- <!--{loop $_DCACHE['newreply'] $newreply}-->
- $newreply[content]
- <!--{/loop}-->
- </td>
- </tr>
- </table>
- </div>
複製代碼
7.) 修改範本檔 templates/default/discuz.htm
找到
- <!--{if !empty($announcements)}-->
- <div id="announcement">$announcements</div><script type="text/javascript">announcement();</script>
- <!--{/if}-->
複製代碼
在之後加入
8.) 然後進後台執行 [系統工具 > 更新緩存] |
|