插件原作者:33201
数据库升级:有
安装难度:中
插件演示地址http://www.leyy.net/bbs
首页四格cache版,可以在后台开启关闭相关版面。
安装步骤以原作者为准,本文仅针对DZ5做部分内容的修改
插件安装步骤:
如果不想要后台控制的话,可以跳过1-3步
1.后台升级数据库(在cdb_settings添加一个show_poststar一个值)
- INSERT INTO `cdb_settings` VALUES ('show_poststar', '1');
复制代码
2.编辑文件admin/setting.inc.php(后台显示功能设置内添加开关)
查找:
- showsetting('settings_nocacheheaders', 'settingsnew[nocacheheaders]', $settings['nocacheheaders'], 'radio');
复制代码
下面添加:
- showsetting('settings_show_poststar', 'settingsnew[show_poststar]', $settings['show_poststar'], 'radio');
复制代码
3,编辑语言包admincp.lang.php(后台管理页面显示的文字)
查找:
- 'settings_forumjump_comment' => '选择“是”将在列表页面下部显示快捷跳转菜单。注意: 当分论坛很多时,本功能会严重加重服务器负担',
复制代码
下面添加:
- 'settings_show_poststar' => '显示发帖冠军',
- 'settings_show_poststar_comment' => '选则“是”将在首页显示发帖冠军',
复制代码
4.上传附件!
5.编辑文件include/cache.func.php
5.1查找:
- 'medals' => array('medals')
复制代码
在其上面加
- 'poststar' => array('daystar', 'yestodaystar','weekstar', 'monthstar', 'yearstar'),
复制代码
5.2查找:
- case 'medals':
- $table = 'medals';
- $cols = 'medalid, name, image';
- $conditions = "WHERE available='1'";
- break;
复制代码
在其上面加
- //===============社区明星BY 33201 开始
- case 'daystar':
- $month=date(n);
- $date=date(j);
- $year=date(Y);
- $time=mktime(0,0,0,$month,$date,$year);
- $table = 'posts p';
- $cols = 'count(p.pid) as num,p.author,p.authorid,m.uid,m.credits,m.posts,m.digestposts ,me.avatar,m.oltime,me.avatarwidth,me.avatarheight';
- $conditions = "left join {$tablepre}members m on p.authorid=m.uid left join {$tablepre}memberfields me on p.authorid=me.uid where p.dateline>$time group by p.authorid order by num desc limit 0,10";
- break;
- case 'yestodaystar':
- $month=date(n);
- $date=date(j);
- $year=date(Y);
- $time=mktime(0,0,0,$month,$date,$year);
- $ytime=mktime(0,0,0,$month,$date-1,$year);
- $table = 'posts p';
- $cols = 'count(p.pid) as num,p.author,p.authorid,m.uid,m.credits,m.posts,m.digestposts ,me.avatar,m.oltime,me.avatarwidth,me.avatarheight';
- $conditions = "left join {$tablepre}members m on p.authorid=m.uid left join {$tablepre}memberfields me on p.authorid=me.uid where p.dateline<=$time and p.dateline>$ytime group by p.authorid order by num desc limit 0,10";
- break;
- case 'weekstar':
- $month=date(n);
- $date=date(j);
- $year=date(Y);
- $week=date(w);
- $time=mktime(0,0,0,$month,$date,$year);
- $weektime=mktime(0,0,0,$month,$date-$week,$year);
- $table = 'posts p';
- $cols = 'count(p.pid) as num,p.author,p.authorid,m.uid,m.credits,m.posts,m.digestposts ,me.avatar,m.oltime,me.avatarwidth,me.avatarheight';
- $conditions = "left join {$tablepre}members m on p.authorid=m.uid left join {$tablepre}memberfields me on p.authorid=me.uid where p.dateline>=$weektime group by p.authorid order by num desc limit 0,10";
- break;
- case 'monthstar':
- $month=date(n);
- $year=date(Y);
- $monthtime=mktime(0,0,0,$month,1,$year);
- $table = 'posts p';
- $cols = 'count(p.pid) as num,p.author,p.authorid,m.uid,m.credits,m.posts,m.digestposts ,me.avatar,m.oltime,me.avatarwidth,me.avatarheight';
- $conditions = "left join {$tablepre}members m on p.authorid=m.uid left join {$tablepre}memberfields me on p.authorid=me.uid where p.dateline>=$monthtime group by p.authorid order by num desc limit 0,10";
- break;
-
- case 'yearstar':
- $year=date(Y);
- $yeartime=mktime(0,0,0,1,1,$year);
- $table = 'posts p';
- $cols = 'count(p.pid) as num,p.author,p.authorid,m.uid,m.credits,m.posts,m.digestposts ,me.avatar,m.oltime,me.avatarwidth,me.avatarheight';
- $conditions = "left join {$tablepre}members m on p.authorid=m.uid left join {$tablepre}memberfields me on p.authorid=me.uid where p.dateline>=$yeartime group by p.authorid order by num desc limit 0,10";
- break;
- //===================社区明星BY 33201 结束
复制代码
5.3 查找:
- case 'settings':
- $data['qihoo_links'] = array();
- while($setting = $db->fetch_array($query))
复制代码
在其上面加
- //===================社区明星BY 33201 开始
- case 'daystar':
- while($toppost = $db->fetch_array($query)) {
- $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
- $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
- $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
- $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
- $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
- $data[] = $toppost;
- }
- break;
- case 'yestodaystar':
- while($toppost = $db->fetch_array($query)) {
- $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
- $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
- $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
- $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
- $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
- $data[] = $toppost;
- }
- break;
- case 'weekstar':
- while($toppost = $db->fetch_array($query)) {
- $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
- $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
- $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
- $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
- $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
- $data[] = $toppost;
- }
- break;
- case 'monthstar':
- while($toppost = $db->fetch_array($query)) {
- $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
- $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
- $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
- $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
- $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
- $data[] = $toppost;
- }
- break;
- case 'yearstar':
- while($toppost = $db->fetch_array($query)) {
- $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
- $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
- $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
- $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
- $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
- $data[] = $toppost;
- }
- break;
- //=====================社区明星BY 33201 结束
复制代码
6.编辑文件include/newthread.inc.php
查找
- updatepostcredits('+', $discuz_uid, $postcredits);
复制代码
在其下面加
- require_once DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('daystar');
复制代码
7.编辑文件include/newreply.inc.php
查找
- updatepostcredits('+', $discuz_uid, $replycredits);
复制代码
在其下面加
- require_once DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('daystar');
复制代码
8.编辑文件topicadmin.php
查找
- showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'),
复制代码
在其上面加
- require_once DISCUZ_ROOT.'./include/cache.func.php';
- updatecache('daystar');
复制代码
9.编辑文件index.php
9.1查找:
- require_once DISCUZ_ROOT.'./include/forum.func.php';
复制代码
下面添加:
- require_once DISCUZ_ROOT.'./forumdata/cache/cache_poststar.php';
- $month=date(n);
- $year=date(Y);
复制代码
9.2查找:
- unset($_DCACHE['announcements']);
复制代码
下面添加:
- //========== 社区明星BY 33201 开始
- $nopoststar ='<td width=17%>姓名:<font color=red><b> 虚位以待!</b></font> <br>UID :<b>空</b> <br>积分:空 <br>精华:空<br>今日发帖:空<br>总发帖量:空<br> 在线时间:空 <br> </td><td width=16% align=center class=altbg1><img src=images/nopic.gif width=80 height=80 align=center></td>';
- if($_DCACHE['daystar']) {
- foreach($_DCACHE['daystar'] as $key => $dstar) {
- if ($key<3){
- $daystars .="<td width=17%>姓名:<b>".$dstar[author]."</b> <br>UID :<b>".$dstar[authorid]."</b> <br>积分:".$dstar[credits]." <br>精华:".$dstar[digestposts]." 篇<br><font color=red><b>今日</b></font>发帖:<font color=red><b>".$dstar[num]."</b></font> 篇<br>总发帖量:".$dstar[posts]." 篇<br> 在线时间:".$dstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$dstar[avatar]." width=".$dstar[avatarwidth]." height=".$dstar[avatarheight]." align=center></td>";$n=$key;
- }
- }
- if($n==0){$nostar .=$nopoststar.$nopoststar;}elseif($n==1){$nostar .=$nopoststar;}
- }
- if($_DCACHE['weekstar']) {
- foreach($_DCACHE['weekstar'] as $key => $wstar) {
- if ($key<3){
- $weekstars .="<td width=17%>姓名:<b>".$wstar[author]."</b> <br>UID :<b>".$wstar[authorid]."</b> <br>积分:".$wstar[credits]." <br>精华:".$wstar[digestposts]." 篇<br><font color=red><b>本周</b></font>发帖:<font color=red><b>".$wstar[num]."</b></font> 篇<br>总发帖量:".$wstar[posts]." 篇<br> 在线时间:".$wstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$wstar[avatar]." width=".$wstar[avatarwidth]." height=".$wstar[avatarheight]." align=center></td>";$weeknum=$key;
- }
- }
- if($weeknum==0){$noweekstar .=$nopoststar.$nopoststar;}elseif($weeknum==1){$noweekstar .=$nopoststar;}
- }
- if($_DCACHE['monthstar']) {
- foreach($_DCACHE['monthstar'] as $key => $mstar) {
- if ($key<3){
- $monthstars .="<td width=17%>姓名:<b>".$mstar[author]."</b> <br>UID :<b>".$mstar[authorid]."</b> <br>积分:".$mstar[credits]." <br>精华:".$mstar[digestposts]." 篇<br><font color=red><b>".$month."月</b></font>发帖:<font color=red><b>".$mstar[num]."</b></font> 篇<br>总发帖量:".$mstar[posts]." 篇<br> 在线时间:".$mstar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$mstar[avatar]." width=".$mstar[avatarwidth]." height=".$mstar[avatarheight]." align=center></td>";
- }
- }
- }
- if($_DCACHE['yearstar']) {
- foreach($_DCACHE['yearstar'] as $key => $ystar) {
- if ($key<3){
- $yearstars .="<td width=17%>姓名:<b>".$ystar[author]."</b> <br>UID :<b>".$ystar[authorid]."</b> <br>积分:".$ystar[credits]." <br>精华:".$ystar[digestposts]." 篇<br><font color=red><b>".$year."年</b></font>发帖:<font color=red><b>".$ystar[num]."</b></font> 篇<br>总发帖量:".$ystar[posts]." 篇<br> 在线时间:".$ystar[oltime]." 小时<br> </td><td width=16% align=center class=altbg1><img src=".$ystar[avatar]." width=".$ystar[avatarwidth]." height=".$ystar[avatarheight]." align=center></td>";
- }
- }
- }
- //==========社区明星BY 33201 结束
复制代码
10.编辑模板discuz.htm
查找:- <!--{loop $catlist $key $cat}-->
复制代码
上面加(注意是上面):
- <!--{if $show_poststar}-->
- {template show_poststar}
- <!--{/if}-->
复制代码
如果不想安装后台控制,请添加以下代码
注:5楼问题解决(由于是COPY的内容,忘记改地址了)
[ 本帖最后由 jnow 于 2006-9-4 05:00 编辑 ] |