AGAMES 討論區
標題:
AL8 首頁四格修改美化版 For Discuz 6.1[Cache版] 6月6日完整版
[打印本頁]
作者:
dlalden
時間:
2008-11-13 19:10:06
標題:
AL8 首頁四格修改美化版 For Discuz 6.1[Cache版] 6月6日完整版
已經修正6.1無法顯示頭像問題先前修改的請重新下載foruminfo.rar 或按以下方法修改
打開foruminfo.htm
找到
<img src="$member[avatar]" width="90" height="90" align="left">
複製代碼
替換成
<img src="{echo discuz_uc_avatar($discuz_uid)}" width="90" height="90" align="left">
複製代碼
本插件圖片存取是閣下論壇的上傳附件圖片檔(必須為 jpg 格式),並必須設施第10步驟
適合版本:Discuz 6.1
原作者: alan888
DZ 6.1修改整理:samspson
演示:
http://zone-28.com/bbs/
另附上6.0的修改文章
裡面有很多你可能會遇到的問題及解決方法,發問前先看一看喔,重複的問題我就不重複答了
數據庫升級:無
修改模板:1個
修改PHP:8個
加入文件:
images圖像檔
foruminfo.htm
pic.php <--提取自首頁四格連圖片
-----------------------
修改文件:
/index.php
/logging.php
/topicadmin.php
/register.php
/include/newthread.inc.php
/include/newreply.inc.php
/include/counter.inc.php
/include/cache.func.php
/templates/default/discuz.htm
---------------------------
注意:
『1』此版安裝程繁雜,安裝前請記得備份,初學者需再詳細確認步驟。
『2』此版本小弟自我測試無錯誤,若有因為過程上造成使用者的問題或其它損害,小弟並不負責任何責任
說明:
上傳所有附件
(已修改檔案則視乎雖要)
新用戶開始: 現有用戶請看最下
1. 修改 include/cache.func.php
修改完成此文件後請即時到後台→更新緩存
找
'medals' => array('medals')
複製代碼
更換為
'medals' => array('medals'),
'newtopic' => array('newtopic'),
'newreply' => array('newreply'),
'todayvisit' => array('todayvisit'),
複製代碼
再找
case 'medals':
$table = 'medals';
$cols = 'medalid, name, image';
$c;
break;
複製代碼
在下面加上 (注意填妥紅字部份)
填上不需要顯示帖子區域
由於使用快取檔型式, 故某些私密區不能判斷會員權限來顯示發帖及回帖, 所以要先修改及取代下紅字部份 "填上不需要顯示帖子區域的 fid 編號, 以逗號作分格, 最後一個不用加上逗號" 部份, 例如希望不顯示 fid 1,3,5 便填上 "$fids="1,3,5";"
如果希望全部顯示者, 請將下兩段的
NOT IN ($fids) (藍色字顯示部份)
刪除, 否則會出現數據錯誤的顯示
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="填寫不要顯示的版子區域";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid 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="填寫不要顯示的版子區域";//例如 "1,2,3";
$conditions = "WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid NOT IN ($fids) AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 11";
break;
case 'todayvisit':
$table = 'members';
$cols = "COUNT(*)";
$datecut = time() - (3600 * 24);
$conditions = "WHERE lastactivity>='$datecut' ORDER BY lastvisit DESC";
break;
複製代碼
找
$GLOBALS['totalmembers'] = $data['totalmembers'] = $db->result_first("SELECT COUNT(*) FROM {$tablepre}members");
複製代碼
在下面加上
$datecut = time() - (3600 * 24);
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}members WHERE regdate>='$datecut'");
$GLOBALS['todaynewmems'] = $data['todaynewmems'] = $db->result($query, 0);
複製代碼
找
case 'forumlinks':
global $forumlinkstatus;
複製代碼
上面加上
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;
複製代碼
*UTF-8人士請另存檔案為UTF-8編碼檔案
2. 修改 include/newthread.inc.php
找
showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra".(!empty($frombbs) ? "&frombbs=$frombbs" : ''));
複製代碼
在上面加上
require DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newtopic');
複製代碼
3. 修改 include/newreply.inc.php
找
$db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED');
}
複製代碼
下面加上
require DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newreply');
updatecache('newtopic');
複製代碼
4. 修改 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';
}
更換為
[code]
if(!$sessionexists || $discuz_uid) {
if(strpos($visitor['agent'], "MSIE 7.0")) {
$visitor_browser = "Internet Explorer 7.0";
$visitor['browser'] = 'MSIE';
} elseif(strpos($visitor['agent'], "MSIE 6.0")) {
$visitor_browser = "Internet Explorer 6.0";
$visitor['browser'] = 'MSIE';
} elseif(strpos($visitor['agent'], "MSIE 5.5")) {
$visitor_browser = "Internet Explorer 5.5";
$visitor['browser'] = 'MSIE';
} elseif(strpos($visitor['agent'], "MSIE 5.0")) {
$visitor_browser = "Internet Explorer 5.0";
$visitor['browser'] = 'MSIE';
} elseif(strpos($visitor['agent'], "MSIE 4.01")) {
$visitor_browser = "Internet Explorer 4.01";
$visitor['browser'] = 'MSIE';
} 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'], "Firefox")) {
$visitor_browser = "Firefox";
$visitor['browser'] = 'Mozilla';
} 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 = "Win 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';
}
複製代碼
5. 修改 topicadmin.php
找 (第一段約第 15 行那句)
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('newreply');
updatecache('newtopic');
updatecache('todayvisit');
複製代碼
6. 修改 logging.php
找
$sessionexists = 0;
複製代碼
在下面加上
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('todayvisit');
複製代碼
7. 修改 index.php
找
$customtopics = '';
複製代碼
上方加入
$member_query = $db->query("SELECT * FROM {$tablepre}members m, {$tablepre}memberfields mf
WHERE m.uid='$discuz_uid' AND mf.uid='$discuz_uid'");
$member = $db->fetch_array($member_query);
$member['lastvisit'] = gmdate("$dateformat $timeformat", $member['lastvisit'] + ($timeoffset * 3600));
$member['usernameenc'] = rawurlencode($member['username']);
$allowfriendcheck = array($member['allowfriend'] => 'checked');
$avatypecheck = array($member['avatype'] => 'checked');
if(!$member[avatar]){
$member[avatar]="images/avatars/noavatar.gif";
}
複製代碼
找
$catlist = $forumlist = $sublist = $forumname = $collapseimg = $collapse = array();
複製代碼
在上面加上
//-----------hack AL8 Info
if(!$statstatus && $discuz_uid){
require_once DISCUZ_ROOT.'./include/counter.inc.php';
}
require_once DISCUZ_ROOT.'./include/misc.func.php';
$mem_home = convertip($onlineip, $datadir = "./");
@include './forumdata/cache/cache_todayvisit.php';
$todayvisit = $_DCACHE['todayvisit']['0']['COUNT(*)'];
@include './forumdata/cache/cache_newtopic.php';
@include './forumdata/cache/cache_newreply.php';
//-----------hack AL8 Info End
複製代碼
找
'forumlinks', 'birthdays'
複製代碼
在後面插入
, 'foruminfo'
複製代碼
9. 修改 register.php
找
$styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];
複製代碼
在下面加上
$datecut = time() - (3600 * 24);
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}members WHERE regdate>='$datecut'");
$todaynewmems = $db->result($query, 0);
複製代碼
找
updatesettings();
複製代碼
在上面加上
$_DCACHE['settings']['todaynewmems'] = $todaynewmems;
複製代碼
8. 修改 discuz 模板
找到及刪除 (如需在上面加入搜尋功能請按8.1修改)
<!--{if $discuz_uid}-->
<!--{if $allowinvisible}-->{lang online_status}:
<span id="loginstatus"><!--{if !empty($invisible)}--><a href="member.php?action=switchstatus" onclick="ajaxget(this.href, 'loginstatus');doane(event);">{lang login_invisible_mode}</a><!--{else}--><a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}" onclick="ajaxget(this.href, 'loginstatus');doane(event);">{lang login_normal_mode}</a><!--{/if}--></span><br />
<!--{/if}-->
{lang your_lastvisit}: <em>$lastvisittime</em>
<!--{if !empty($google) && ($google & 1)}--><br /><!--{/if}-->
<a href="search.php?srchfrom=$newthreads&searchsubmit=yes">{lang show_newthreads}</a>
<a href="member.php?action=markread" id="ajax_markread" onclick="ajaxmenu(event, this.id)">{lang mark_read}</a>
<!--{elseif !empty($_DCOOKIE['loginuser'])}-->
<em>$_DCOOKIE['loginuser']</em>, <a href="logging.php?action=login">{lang index_activation}</a>
<!--{else}-->
<form id="loginform" method="post" name="login" action="logging.php?action=login&loginsubmit=true">
<input type="hidden" name="formhash" value="{FORMHASH}" />
<input type="hidden" name="cookietime" value="2592000" />
<input type="hidden" name="loginfield" value="username" />
<input type="text" id="username" name="username" size="15" maxlength="40" tabindex="1" value="{lang username}" onclick="this.value = ''" />
<input type="password" id="password" name="password" size="10" tabindex="2" onkeypress="if((event.keyCode ? event.keyCode : event.charCode) == 13) $('loginform').submit()" />
<button name="userlogin" type="submit" value="true">{lang login}</button>
</form>
<!--{/if}-->
複製代碼
8.1
在上面8.刪除後的位置即<p> 與/p>之間加入
<a class="bold">
搜索論壇文章</a>
<a class="smalltxt">
<input type="text" name="searchbox1" value="輸入關鍵字" size="20" class="altbg2" onfocus="this.value=''"> <input class="button" type="button" value="搜索" style="height: 1.8em" onclick="window.open('search.php?srchtxt='+$('searchbox1').value+'&searchsubmit=yes');"></a>
複製代碼
找到
<div id="announcement" onmouseover="annstop = 1" onmouseout="annstop = 0">
<div id="announcementbody"><ul>$announcements</ul></div>
</div>
<script type="text/javascript">
var anndelay = 3000;
var annst = 0;
var annstop = 0;
var annrowcount = 0;
var anncount = 0;
var annlis = $('announcementbody').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[i].offsetTop) {
if(lasttop == -1) {
lasttop = 0;
}
annrows[annrowcount] = annlis[i].offsetTop - lasttop;
annrowcount++;
}
lasttop = annlis[i].offsetTop;
}
if(annrows.length == 1) {
$('announcement').onmouseover = $('announcement').onmouseout = null;
} else {
annrows[annrowcount] = annrows[1];
$('announcementbody').innerHTML += '<br style="clear:both" />' + $('announcementbody').innerHTML;
annst = setTimeout('announcementScroll()', anndelay);
}
annrowcount = 1;
return;
}
if(annrowcount >= annrows.length) {
$('announcementbody').scrollTop = 0;
annrowcount = 1;
annst = setTimeout('announcementScroll()', anndelay);
} else {
anncount = 0;
announcementScrollnext(annrows[annrowcount]);
}
}
function announcementScrollnext(time) {
$('announcementbody').scrollTop++;
anncount++;
if(anncount != time) {
annst = setTimeout('announcementScrollnext(' + time + ')', 10);
} else {
annrowcount++;
annst = setTimeout('announcementScroll()', anndelay);
}
}
</script>
<!--{/if}-->
複製代碼
更換為
{template foruminfo}
複製代碼
9. 下載附件並執行
a. 根據自身討論區對下一段作出調整
b. 上載附件到論壇
10.安照需求修改pic.php
打開pic.php
//---設置---start
$shownums = 5;//演示個數 6以內
$searchnums = 40;//搜索總數.
$cachelife = 1800;//緩存時間,默認為1800秒.
$orderby = 'rand';//搜索順序.按照日期搜索輸入dateline.按照瀏覽次數輸入downloads.隨機搜索請輸入rand.
$cachename = 'showpic';//緩存名.若與何插件衝突請修改,只要不衝突不會影響使用.
$searchfid = '';//搜索fid範圍.不限制留空.請用逗號相隔,如'1,2,3'.
//---設置---end
複製代碼
11.現有al8四格用戶修改
把附件上傳
把官方的discuz.htm 覆蓋上\templates\default
再按照上面步驟8開始修改即成
無法顯示圖片請注意有否修改第10步驟
歡迎光臨 AGAMES 討論區 (http://61.244.113.49/)
Powered by Discuz! X2