- 最後登錄
- 2012-8-5
- 在線時間
- 978 小時
- UID
- 275
- 閱讀權限
- 140
- 精華
- 71
- 帖子
- 3799
- 日誌
- 0
- EXP
- 6040 點
- 金幣
- 4990 個
- 註冊時間
- 2008-3-27
- 帖子
- 3799
- EXP
- 6040 點
- 金幣
- 4990 個
- 好友
- 0
- 註冊時間
- 2008-3-27
|
作 者: teng
適用版本: Discuz 7.0
修改文件: index.php, logging.php, topicadmin.php, include/newthread.inc.php, include/newreply.inc.php, include/editpost.inc.php, include/counter.inc.php, include/cache.func.php, discuz 模板, css_append 模板
加入文件: foruminfo 模板 (附件 1)
演 示: http://70.dz-host.net/index.php
打開
include/cache.func.php
修改這部份後請更新緩存
找
- 'medals' => array('medals'),
- 'magics' => array('magics'),
複製代碼
改為
-
- 'medals' => array('medals'),
- 'magics' => array('magics'),
- 'newtopic' => array('newtopic'),
- 'newreply' => array('newreply'),
- 'todaynewmems' => array('todaynewmems'),
- 'todayvisit' => array('todayvisit'),
複製代碼
找
-
- case 'magics':
- $table = 'magics';
- $cols = 'magicid, available, identifier, name, description, weight, price';
- break;
複製代碼
下加
- case 'newtopic':
- $table = 'threads t, '.$tablepre.'forums f';
- $cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
- $fids="0";//填上不需要顯示發新帖區域的 fid 編號
- $conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid AND t.displayorder>='0' NOT IN ($fids) ORDER BY t.dateline DESC LIMIT 0, 11";
- break;
- case 'newreply':
- $table = 'threads t, '.$tablepre.'forums f';
- $cols = "t.tid, t.subject, t.author, t.dateline, t.views, t.replies, t.lastpost, t.lastposter, t.highlight, f.name";
- $fids="0";//填上不需要顯示回帖區域的 fid 編號";
- $conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) AND t.replies !=0 AND t.displayorder>='0' ORDER BY t.lastpost DESC LIMIT 0, 11";
- break;
- case 'todaynewmems':
- $table = 'members';
- $cols = 'COUNT(*)';
- $datecut = time() - (3600 * 24);
- $conditions = "WHERE regdate>='$datecut'";
- break;
- case 'todayvisit':
- $table = 'members';
- $cols = "COUNT(*)";
- $datecut = time() - (3600 * 24);
- $conditions = "WHERE lastactivity>='$datecut' ORDER BY lastvisit DESC";
- break;
複製代碼
找
-
- case 'magics':
- while($magic = $db->fetch_array($query)) {
- $data[$magic['magicid']]['identifier'] = $magic['identifier'];
- $data[$magic['magicid']]['available'] = $magic['available'];
- $data[$magic['magicid']]['name'] = $magic['name'];
- $data[$magic['magicid']]['description'] = $magic['description'];
- $data[$magic['magicid']]['weight'] = $magic['weight'];
- $data[$magic['magicid']]['price'] = $magic['price'];
- }
- break;
複製代碼
下加
-
- case 'newreply':
- $hack_cut_str = 26;
- $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'] = cutstr($rthread['subject'],$hack_cut_str);
- $rthread['subject'] = cutstr($rthread['subject'],46);
- $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;
- case 'newtopic':
- $hack_cut_str = 26;
- $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'] = cutstr($nthread['subject'],$hack_cut_str);
- $nthread['subject'] = cutstr($nthread['subject'],46);
- $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;
複製代碼
打開
include/newthread.inc.php
找
下加
-
- require DISCUZ_ROOT.'./include/cache.func.php';
複製代碼
找
-
- showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra";
複製代碼
上加
打開
include/newreply.inc.php
下加
-
- require DISCUZ_ROOT.'./include/cache.func.php';
複製代碼
找
-
- showmessage($replymessage, "viewthread.php?tid=$tid&pid=$pid&page=".(@ceil(($thread['special'] ? $thread['replies'] + 1 : $thread['replies'] + 2) / $ppp))."&extra=$extra#pid$pid";
複製代碼
上加
-
- updatecache(array('newreply','newtopic'));
複製代碼
打開
include/editpost.inc.php
找出
-
- require_once DISCUZ_ROOT.'./include/cache.func.php';
複製代碼
(大約只有一個如有其他一律刪除)
刪除
找
下加
-
- require_once DISCUZ_ROOT.'./include/cache.func.php';
複製代碼
找
-
- $db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'";
- $db->query("DELETE FROM {$tablepre}polloptions WHERE tid='$tid'";
複製代碼
下加
找
-
- $db->query("UPDATE {$tablepre}threads SET replies=replies-'1', attachment='$thread_attachment', lastposter='$lastpost[author]', lastpost='$lastpost[dateline]' WHERE tid='$tid'", 'UNBUFFERED');
複製代碼
下加
-
- updatecache(array('newreply','newtopic'));
複製代碼
打開
include/counter.inc.php
-
- if(!$sessionexists) {
- if(strpos($visitor['agent'], 'Netscape')) {
- $visitor['browser'] = 'Netscape';
- } elseif(strpos($visitor['agent'], 'Lynx')) {
- $visitor['browser'] = 'Lynx';
- } elseif(strpos($visitor['agent'], 'Opera')) {
- $visitor['browser'] = 'Opera';
- } elseif(strpos($visitor['agent'], 'Konqueror')) {
- $visitor['browser'] = 'Konqueror';
- } elseif(strpos($visitor['agent'], 'MSIE')) {
- $visitor['browser'] = 'MSIE';
- } elseif(substr($visitor['agent'], 0, 7) == 'Mozilla') {
- $visitor['browser'] = 'Mozilla';
- } else {
- $visitor['browser'] = 'Other';
- }
- if(strpos($visitor['agent'], 'Win')) {
- $visitor['os'] = 'Windows';
- } elseif(strpos($visitor['agent'], 'Mac')) {
- $visitor['os'] = 'Mac';
- } elseif(strpos($visitor['agent'], 'Linux')) {
- $visitor['os'] = 'Linux';
- } elseif(strpos($visitor['agent'], 'FreeBSD')) {
- $visitor['os'] = 'FreeBSD';
- } elseif(strpos($visitor['agent'], 'SunOS')) {
- $visitor['os'] = 'SunOS';
- } elseif(strpos($visitor['agent'], 'OS/2')) {
- $visitor['os'] = 'OS/2';
- } elseif(strpos($visitor['agent'], 'AIX')) {
- $visitor['os'] = 'AIX';
- } elseif(preg_match("/(Bot|Crawl|Spider)/i", $visitor['agent'])) {
- $visitor['os'] = 'Spiders';
- } else {
- $visitor['os'] = 'Other';
- }
複製代碼
改為
- if (!$sessionexists || $discuz_uid) {
- if (ereg("MSIE ([0-9.]+)", $visitor['agent'], $browser)) {
- $browser_ver = $browser[1];
- $visitor_browser = "Internet Explorer " . $browser_ver;
- $visitor['browser'] = 'MSIE';
- } elseif (ereg("Firefox/([0-9.]+)", $visitor['agent'], $browser)) {
- $browser_ver = $browser[1];
- $visitor_browser = "Mozilla Firefox " . $browser_ver;
- $visitor['browser'] = 'Mozilla';
- } elseif (ereg("Version/([0-9.]+) Safari/", $visitor['agent'], $browser)) {
- $browser_ver = $browser[1];
- $visitor_browser = "Apple Safari " . $browser_ver;
- $visitor['browser'] = 'Safari';
- } elseif (strpos($visitor['agent'], "Netscape") {
- $visitor_browser = "Netscape";
- $visitor['browser'] = 'Netscape';
- } elseif (strpos($visitor['agent'], "Lynx") {
- $visitor_browser = "Lynx";
- $visitor['browser'] = 'Lynx';
- } elseif (strpos($visitor['agent'], "Opera") {
- $visitor_browser = "Opera";
- $visitor['browser'] = 'Opera';
- } elseif (strpos($visitor['agent'], "Konqueror") {
- $visitor_browser = "Konqueror";
- $visitor['browser'] = 'Konqueror';
- } elseif (strpos($visitor['agent'], "Mozilla/5.0") {
- $visitor_browser = "Mozilla";
- $visitor['browser'] = 'Mozilla';
- } else {
- $visitor_browser = "其它";
- $visitor['browser'] = 'Other';
- }
- if (strpos($visitor['agent'], "NT 5.1") {
- if (strpos($visitor['agent'], "SV1"){
- $visitor_os = "Windows XP SP2";
- $visitor['os'] = 'Windows';
- } else {
- $visitor_os = "Windows XP";
- $visitor['os'] = 'Windows';
- }
- } elseif (strpos($visitor['agent'], "NT 6.0") {
- $visitor_os = "Windows Vista";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "NT 5.2") {
- $visitor_os = "Windows Server 2003";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "NT 5") {
- $visitor_os = "Windows 2000";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "4.9") {
- $visitor_os = "Windows ME";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "NT 4") {
- $visitor_os = "Windows NT 4.0";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "98") {
- $visitor_os = "Windows 98";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "95") {
- $visitor_os = "Windows 95";
- $visitor['os'] = 'Windows';
- } elseif (strpos($visitor['agent'], "Mac") {
- $visitor_os = "Mac";
- $visitor['os'] = 'Mac';
- } elseif (strpos($visitor['agent'], "Linux") {
- $visitor_os = "Linux";
- $visitor['os'] = 'Linux';
- } elseif (strpos($visitor['agent'], "Unix") {
- $visitor_os = "Unix";
- $visitor['os'] = 'Other';
- } elseif (strpos($visitor['agent'], "FreeBSD") {
- $visitor_os = "FreeBSD";
- $visitor['os'] = 'FreeBSD';
- } elseif (strpos($visitor['agent'], "SunOS") {
- $visitor_os = "SunOS";
- $visitor['os'] = 'SunOS';
- } elseif (strpos($visitor['agent'], "OS/2") {
- $visitor_os = "OS/2";
- $visitor['os'] = 'OS/2';
- } elseif (strpos($visitor['agent'], "AIX") {
- $visitor_os = "AIX";
- $visitor['os'] = 'AIX';
- } elseif (preg_match("/(Bot|Crawl|Spider)/i", $visitor['agent'])) {
- $visitor_os = "Spiders";
- $visitor['os'] = 'Spiders';
- } else {
- $visitor_os = "其他";
- $visitor['os'] = 'Other';
- }
複製代碼
打開 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(array('newreply','newtopic'));
複製代碼
logging.php
找
下加
- require_once DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('todayvisit');
複製代碼
index.php
找
-
- $catlist = $forumlist = $sublist = $forumname = $collapseimg = $collapse = array();
複製代碼
上加
-
- //-----------hack AL8 Info
- if(!$statstatus && $discuz_uid){
- require_once DISCUZ_ROOT.'./include/counter.inc.php';
- $unreadpmnum = $db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$discuz_uid' AND new=1";
- }
- require_once DISCUZ_ROOT.'./include/misc.func.php';
- $mem_home = convertip($onlineip, $datadir = "./";
- require_once DISCUZ_ROOT.'./forumdata/cache/cache_todayvisit.php';
- $todayvisit = $_DCACHE['todayvisit']['0']['COUNT(*)'];
- require_once DISCUZ_ROOT.'./forumdata/cache/cache_todaynewmems.php';
- $todaynewmems = $_DCACHE['todaynewmems']['0']['COUNT(*)'];
- @include './forumdata/cache/cache_newtopic.php';
- @include './forumdata/cache/cache_newreply.php';
- //-----------hack AL8 Info End
複製代碼
register.php
找
-
- $_DCACHE['settings']['totalmembers']++;
複製代碼
上加
-
- require_once DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('todaynewmems');
複製代碼
修改 discuz 模板
找
- <div id="nav"><a href="$indexname">$bbname</a> » {lang home}</div>
- <!--{if $admode && empty($insenz['hardadstatus']) && !empty($advlist['text'])}--><div class="ad_text" id="ad_text"><table summary="Text Ad" cellpadding="0" cellspacing="1">$advlist[text]</table></div><!--{else}--><div id="ad_text"></div><!--{/if}-->
- <div id="wrap"{if $infosidestatus['allow'] < 2} class="wrap s_clear"{else} class="wrap with_side s_clear"{/if}>
- <!--{if $infosidestatus[allow] == 2}-->
- <a id="sidebar_img" href="javascript:;" onclick="sidebar_collapse(['{lang sidebar_collapsed_yes}', '{lang sidebar_collapsed_no}']);" class="$collapseimg[sidebar]"><!--{if $collapseimg[sidebar] == 'collapsed_yes'}-->{lang sidebar_collapsed_yes}<!--{else}-->{lang sidebar_collapsed_no}<!--{/if}--></a>
- <!--{elseif $infosidestatus[allow] == 1}-->
- <a id="sidebar_img" href="javascript:;" onclick="sidebar_collapse(['', '{lang sidebar_collapsed_no}']);" class="collapsed_yes">{lang sidebar_collapsed_yes}</a>
- <!--{/if}-->
- <div class="main"><div class="content">
- <div class="pages_btns s_clear">
- <span class="postbtn"><a href="misc.php?action=nav" onclick="floatwin('open_nav', this.href, 600, 410);return false;">{lang send_posts}</a></span>
- <!--{if !$discuz_uid}-->
- {lang home_welcome_guest}
- <!--{else}-->
- {lang home_welcome} {$discuz_userss}, <!--{if $lastvisit > 0}-->{lang home_lastvisit} {$lastvisit}, <!--{/if}--><a href="search.php?srchfrom=$newthreads&searchsubmit=yes" class="lightlink">{lang show_newthreads}</a>, <a href="member.php?action=markread" id="ajax_markread" onclick="ajaxmenu(event, this.id)" class="lightlink">{lang mark_read}</a>
- <!--{/if}-->
- </div>
- <div class="foruminfo s_clear">
- <p class="right forumcount">
- {lang index_today}: <em>$todayposts</em>, {lang index_yesterday}: <em>$postdata[0]</em>, {lang index_members}: <em>$totalmembers</em>
- </p>
- <!--{if empty($gid) && $announcements}-->
- <div id="ann" onmouseover="annstop = 1" onmouseout="annstop = 0">
- <dl>
- <dt>{lang announcements}:</dt>
- <dd>
- <div id="annbody"><ul id="annbodylis">$announcements</ul></div>
- </dd>
- </dl>
- </div>
- <script type="text/javascript">
- var anndelay = 3000;
- var annst = 0;
- var annstop = 0;
- var annrowcount = 0;
- var anncount = 0;
- var annlis = $('annbody').getElementsByTagName("LI";
- var annrows = new Array();
- var annstatus;
- function announcementScroll() {
- if(annstop) {
- annst = setTimeout('announcementScroll()', anndelay);
- return;
- }
- if(!annst) {
- var lasttop = -1;
- for(i = 0;i < annlis.length;i++) {
- if(lasttop != annlis.offsetTop) {
- if(lasttop == -1) {
- lasttop = 0;
- }
- annrows[annrowcount] = annlis.offsetTop - lasttop;
- annrowcount++;
- }
- lasttop = annlis.offsetTop;
- }
- if(annrows.length == 1) {
- $('ann').onmouseover = $('ann').onmouseout = null;
- } else {
- annrows[annrowcount] = annrows[1];
- $('annbodylis').innerHTML += $('annbodylis').innerHTML;
- annst = setTimeout('announcementScroll()', anndelay);
- }
- annrowcount = 1;
- return;
- }
- if(annrowcount >= annrows.length) {
- $('annbody').scrollTop = 0;
- annrowcount = 1;
- annst = setTimeout('announcementScroll()', anndelay);
- } else {
- anncount = 0;
- announcementScrollnext(annrows[annrowcount]);
- }
- }
- function announcementScrollnext(time) {
- $('annbody').scrollTop++;
- anncount++;
- if(anncount != time) {
- annst = setTimeout('announcementScrollnext(' + time + ')', 10);
- } else {
- annrowcount++;
- annst = setTimeout('announcementScroll()', anndelay);
- }
- }
- </script>
- <!--{/if}-->
- </div>
複製代碼
改為
-
- <div id="nav"><a href="$indexname">$bbname</a> » {lang home}</div>
- <!--{if $admode && empty($insenz['hardadstatus']) && !empty($advlist['text'])}-->
- <div class="ad_text" id="ad_text">
- <table summary="Text Ad" cellpadding="0" cellspacing="1">
- $advlist[text]
- </table>
- </div>
- <!--{else}-->
- <div id="ad_text"></div>
- <!--{/if}-->
- <div id="wrap"{if $infosidestatus['allow'] < 2} class="wrap s_clear"{else} class="wrap with_side s_clear"{/if}>
- <!--{if $infosidestatus[allow] == 2}-->
- <a id="sidebar_img" href="javascript:;" onclick="sidebar_collapse(['{lang sidebar_collapsed_yes}', '{lang sidebar_collapsed_no}']);" class="$collapseimg[sidebar]"><!--{if $collapseimg[sidebar] == 'collapsed_yes'}-->{lang sidebar_collapsed_yes}<!--{else}-->{lang sidebar_collapsed_no}<!--{/if}--></a>
- <!--{elseif $infosidestatus[allow] == 1}-->
- <a id="sidebar_img" href="javascript:;" onclick="sidebar_collapse(['', '{lang sidebar_collapsed_no}']);" class="collapsed_yes">{lang sidebar_collapsed_yes}</a>
- <!--{/if}-->
- <div class="main"><div class="content">
- <!--{if empty($gid)}-->
- {template foruminfo}
- <!--{/if}-->
複製代碼 |
|