此插件在dz4.0时本人修改而来,其实boyzyf已经将其升级到5.0,此次在此发帖主要是修正了boyzyf升级中的一处bug以及对四格的显示做了一些美化!!!
演示:www.xm361.com
或见附件!
安装方法如下:
1、后台升级数据库
复制内容到剪贴板
代码:
INSERT INTO `cdb_settings` VALUES ('show_toplist', '1');2、编辑文件admin/setting.inc.php(后台显示功能设置内添加开关)
查找:
复制内容到剪贴板
代码:
showsetting('settings_nocacheheaders', 'settingsnew[nocacheheaders]', $settings['nocacheheaders'], 'radio');下面添加:
复制内容到剪贴板
代码:
showsetting('settings_show_toplist', 'settingsnew[show_toplist]', $settings['show_toplist'], 'radio');3、编辑语言包templates/default/admincp.lang.php(后台管理页面显示的文字)
查找:
复制内容到剪贴板
代码:
'settings_forumjump_comment' => '选择“是”将在列表页面下部显示快捷跳转菜单。注意: 当分论坛很多时,本功能会严重加重服务器负担',下面添加:
复制内容到剪贴板
代码:
'settings_show_toplist' => '显示首页四格',
'settings_show_toplist_comment' => '选则“是”将在首页显示首页四格',4、 include/cache.func.php
查找
复制内容到剪贴板
代码:
'medals' => array('medals')上面加
复制内容到剪贴板
代码:
'toplist' => array('newthread', 'newreply', 'topdigest', 'topviews'),//TOPLIST_首页四格_全Cache版_By oytktk继续查找
复制内容到剪贴板
代码:
case 'medals':
$table = 'medals';
$cols = 'medalid, name, image';
$conditions = "WHERE available='1'";
break;上面加
复制内容到剪贴板
代码:
//首页四格TOPLIST_CACHE版, By oytktk 代码首
case 'newthread':
$table = 'threads t';
$cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.dateline DESC LIMIT 0, 10";
break;
case 'newreply':
$table = 'threads t';
$cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.replies>0 and t.displayorder!='-1' ORDER BY t.lastpost DESC LIMIT 0, 10";
break;
case 'topdigest':
$table = 'threads t';
$cols = 't.tid, t.fid, t.author, t.subject, t.digest, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE digest>0 ORDER BY rand() LIMIT 0, 10";
break;
case 'topviews':
$table = 'threads t';
$view = rand(1,3)==1 ? 'views' : 'replies';
$cols = 't.tid, t.fid, t.author, t.subject, t.dateline, t.lastpost, t.lastposter, t.views, t.replies, t.highlight, f.name';
$conditions = "LEFT JOIN {$tablepre}forums f ON f.fid=t.fid WHERE t.displayorder!='-1' ORDER BY t.$view DESC LIMIT 0, 10";
break;
//首页四格TOPLIST_CACHE版, By oytktk 代码尾再找:
复制内容到剪贴板
代码:
case 'settings':
$data['qihoo_links'] = array();
while($setting = $db->fetch_array($query))上面加
复制内容到剪贴板
代码:
//首页四格TOPLIST_CACHE版, By oytktk 代码首
case 'newthread':
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($topthread = $db->fetch_array($query)) {
$threadcolor = sprintf('%02d', $topthread['highlight']);
$topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
$topthread['subjectc'] = cutstr($topthread['subject'], 28);
$topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
$topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
$topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
$topthread['name'] = AddSlashes(strip_tags(trim($topthread['name'])));
$data[] = $topthread;
}
break;
case 'newreply':
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($topthread = $db->fetch_array($query)) {
$threadcolor = sprintf('%02d', $topthread['highlight']);
$topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
$topthread['subjectc'] = cutstr($topthread['subject'], 26);
$topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
$topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
$topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
$topthread['name'] = AddSlashes(strip_tags(trim($topthread['name'])));
$data[] = $topthread;
}
break;
case 'topdigest':
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($topthread = $db->fetch_array($query)) {
$threadcolor = sprintf('%02d', $topthread['highlight']);
$digest = array('1'=>'[Ⅰ]','2'=>'[Ⅱ]','3'=>'[Ⅲ]');
$topthread['subjectc'] = $digest[$topthread['digest']]."-".cutstr($topthread['subject'], 23);
$topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
$topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
$topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
$topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
$topthread['name'] = AddSlashes(strip_tags(trim($topthread['name'])));
$data[] = $topthread;
}
break;
case 'topviews':
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
while($topthread = $db->fetch_array($query)) {
$threadcolor = sprintf('%02d', $topthread['highlight']);
$topthread['subjectc'] = cutstr($topthread['subject'], 32);
$topthread['threadcolor'] = $threadcolor[1] ? " style=\"color: ".$colorarray[$threadcolor[1]]."\"" : NULL;
$topthread['author'] = $topthread['author'] ? $topthread['author'] : '游客';
$topthread['dateline'] = gmdate("Y-m-d H:i", $topthread['dateline'] + $timeoffset * 3600);
$topthread['lastpost'] = gmdate("Y-m-d H:i", $topthread['lastpost'] + $timeoffset * 3600);
$topthread['name'] = AddSlashes(strip_tags(trim($topthread['name'])));
$data[] = $topthread;
}
break;
//首页四格TOPLIST_CACHE版, By oytktk 代码尾5、 include/newthread.inc.php
查找
复制内容到剪贴板
代码:
updatepostcredits('+', $discuz_uid, $postcredits);下面加
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newthread');6、 include/newreply.inc.php
查找
复制内容到剪贴板
代码:
updatepostcredits('+', $discuz_uid, $replycredits);下面加
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newthread');7、include/editpost.inc.php
查找
复制内容到剪贴板
代码:
updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits));下面加
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newthread');8、index.php
查找
复制内容到剪贴板
代码:
$catlist = $forumlist = $sublist = array();
$threads = $posts = $todayposts = $fids = 0;下面加
复制内容到剪贴板
代码:
//首页四格TOPLIST_CACHE版, By oytktk 代码首
if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'category_hk2 ') === FALSE) {
$categorys_hk2 = 'collapsed_no.gif';
$collapse['category_hk2'] = '';
} else {
$categorys_hk2 = 'collapsed_yes.gif';
$collapse['category_hk2'] = 'display: none';
}
if($categorys_hk2 == 'collapsed_no.gif'){
require_once DISCUZ_ROOT.'./forumdata/cache/cache_toplist.php';
$toplistloop = $_DCACHE['newthread'];
}
//首页四格TOPLIST_CACHE版, By oytktk 代码尾9、topicadmin.php
查找
复制内容到剪贴板
代码:
showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), 上面加
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./include/cache.func.php';
updatecache('newthread');10、templates/default/discuz.htm
查找
复制内容到剪贴板
代码:
<!--{if !empty($advlist['text'])}-->
<div style="clear: both; margin-top: 5px;">
<div class="spaceborder" style="width: {TABLEWIDTH}">
<table cellspacing="1" border="0" cellpadding="{TABLESPACE}" width="100%" style="background: {BGBORDER}">$advlist[text]</table>
</div><br></div>
<!--{/if}-->在下面加
复制内容到剪贴板
代码:
<!--{if empty($gid)}-->
<!--{if $show_toplist}-->
<div style="clear: both; margin-top: 5px">
{template toplist}
<br>
</div>
<!--{/if}-->
<!--{/if}-->11、下载附件toplist.rar上传至相应的目录内即可!其中topview文件夹上传至论坛跟目录,toplist.htm文件上传至templates/default
12、
到后台更新缓存(务必!!!)
[
本帖最后由 weaver2000 于 2006-10-28 22:45 编辑 ]