Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 社区发贴之星(今日+昨日+本周+本月+本年)后台控制全Cache版 FOR DZ5 正式版

[复制链接]
jnow 发表于 2006-9-3 02:23:33 | 显示全部楼层 |阅读模式
插件原作者:33201
数据库升级:有
安装难度:中

插件演示地址http://www.leyy.net/bbs
首页四格cache版,可以在后台开启关闭相关版面。


安装步骤以原作者为准,本文仅针对DZ5做部分内容的修改

插件安装步骤:
如果不想要后台控制的话,可以跳过1-3步
1.后台升级数据库(在cdb_settings添加一个show_poststar一个值)



  1. INSERT INTO `cdb_settings` VALUES ('show_poststar', '1');
复制代码


2.编辑文件admin/setting.inc.php(后台显示功能设置内添加开关)
查找:



  1. showsetting('settings_nocacheheaders', 'settingsnew[nocacheheaders]', $settings['nocacheheaders'], 'radio');
复制代码

下面添加:



  1. showsetting('settings_show_poststar', 'settingsnew[show_poststar]', $settings['show_poststar'], 'radio');
复制代码

3,编辑语言包admincp.lang.php(后台管理页面显示的文字)
查找:



  1. 'settings_forumjump_comment' => '选择“是”将在列表页面下部显示快捷跳转菜单。注意: 当分论坛很多时,本功能会严重加重服务器负担',
复制代码


下面添加:



  1. 'settings_show_poststar' => '显示发帖冠军',
  2. 'settings_show_poststar_comment' => '选则“是”将在首页显示发帖冠军',
复制代码


4.上传附件!
5.编辑文件include/cache.func.php
5.1查找:



  1. 'medals'        => array('medals')
复制代码


在其上面加



  1. 'poststar'        => array('daystar', 'yestodaystar','weekstar', 'monthstar', 'yearstar'),
复制代码

5.2查找:



  1. case 'medals':
  2.                         $table = 'medals';
  3.                         $cols = 'medalid, name, image';
  4.                         $conditions = "WHERE available='1'";
  5.                         break;
复制代码


在其上面加



  1. //===============社区明星BY 33201 开始
  2.                 case 'daystar':
  3.                         $month=date(n);
  4.                         $date=date(j);
  5.                         $year=date(Y);
  6.                         $time=mktime(0,0,0,$month,$date,$year);
  7.                         $table = 'posts p';
  8.                         $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';
  9.                         $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";
  10.                         break;
  11.                 case 'yestodaystar':
  12.                         $month=date(n);
  13.                         $date=date(j);
  14.                         $year=date(Y);
  15.                         $time=mktime(0,0,0,$month,$date,$year);
  16.                         $ytime=mktime(0,0,0,$month,$date-1,$year);
  17.                         $table = 'posts p';
  18.                         $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';
  19.                         $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";
  20.                         break;
  21.                 case 'weekstar':
  22.                         $month=date(n);
  23.                         $date=date(j);
  24.                         $year=date(Y);
  25.                         $week=date(w);
  26.                         $time=mktime(0,0,0,$month,$date,$year);
  27.                         $weektime=mktime(0,0,0,$month,$date-$week,$year);
  28.                         $table = 'posts p';
  29.                         $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';
  30.                         $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";
  31.                         break;
  32.                 case 'monthstar':
  33.                         $month=date(n);
  34.                         $year=date(Y);
  35.                         $monthtime=mktime(0,0,0,$month,1,$year);
  36.                         $table = 'posts p';
  37.                         $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';
  38.                         $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";
  39.                         break;
  40.                
  41.                 case 'yearstar':
  42.                         $year=date(Y);
  43.                         $yeartime=mktime(0,0,0,1,1,$year);
  44.                         $table = 'posts p';
  45.                         $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';
  46.                         $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";
  47.                         break;

  48. //===================社区明星BY 33201 结束
复制代码


5.3 查找:



  1. case 'settings':
  2.                         $data['qihoo_links'] = array();
  3.                         while($setting = $db->fetch_array($query))
复制代码


在其上面加



  1. //===================社区明星BY 33201 开始
  2.                 case 'daystar':
  3.                         while($toppost = $db->fetch_array($query)) {
  4.                                 $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
  5.                                 $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
  6.                                 $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
  7.                                 $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
  8.                                 $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
  9.                                 $data[] = $toppost;
  10.                         }
  11.                         break;
  12.                 case 'yestodaystar':
  13.                         while($toppost = $db->fetch_array($query)) {
  14.                                 $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
  15.                                 $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
  16.                                 $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
  17.                                 $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
  18.                                 $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
  19.                                 $data[] = $toppost;
  20.                         }
  21.                         break;
  22.                 case 'weekstar':
  23.                         while($toppost = $db->fetch_array($query)) {
  24.                                 $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
  25.                                 $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
  26.                                 $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
  27.                                 $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
  28.                                 $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
  29.                                 $data[] = $toppost;
  30.                         }
  31.                         break;
  32.                 case 'monthstar':
  33.                         while($toppost = $db->fetch_array($query)) {
  34.                                 $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
  35.                                 $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
  36.                                 $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
  37.                                 $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
  38.                                 $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
  39.                                 $data[] = $toppost;
  40.                         }
  41.                         break;
  42.                 case 'yearstar':
  43.                         while($toppost = $db->fetch_array($query)) {
  44.                                 $toppost['author'] = $toppost['author'] ? $toppost['author'] : '游客';
  45.                                 $toppost['authorid'] = $toppost['authorid'] ? $toppost['authorid'] : '游客';
  46.                                 $toppost['avatar'] = $toppost['avatar'] ? $toppost['avatar'] : 'images/nopic.gif';
  47.                                 $toppost['avatarwidth'] = $toppost['avatarwidth'] ? $toppost['avatarwidth'] : '80';
  48.                                 $toppost['avatarheight'] = $toppost['avatarheight'] ? $toppost['avatarheight'] : '80';
  49.                                 $data[] = $toppost;
  50.                         }
  51.                         break;

  52. //=====================社区明星BY 33201 结束
复制代码

6.编辑文件include/newthread.inc.php
查找



  1. updatepostcredits('+', $discuz_uid, $postcredits);
复制代码


在其下面加



  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('daystar');
复制代码


7.编辑文件include/newreply.inc.php
查找



  1. updatepostcredits('+', $discuz_uid, $replycredits);
复制代码


在其下面加



  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('daystar');
复制代码


8.编辑文件topicadmin.php
查找



  1. showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'),
复制代码


在其上面加



  1. require_once DISCUZ_ROOT.'./include/cache.func.php';
  2.                 updatecache('daystar');
复制代码


9.编辑文件index.php
9.1查找:



  1. require_once DISCUZ_ROOT.'./include/forum.func.php';
复制代码


下面添加:



  1. require_once DISCUZ_ROOT.'./forumdata/cache/cache_poststar.php';
  2. $month=date(n);
  3. $year=date(Y);
复制代码


9.2查找:



  1. unset($_DCACHE['announcements']);
复制代码


下面添加:



  1. //========== 社区明星BY 33201 开始
  2. $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>';
  3.     if($_DCACHE['daystar']) {
  4.                 foreach($_DCACHE['daystar'] as $key => $dstar) {
  5.             if ($key<3){
  6.                 $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;
  7. }
  8.                 }
  9. if($n==0){$nostar .=$nopoststar.$nopoststar;}elseif($n==1){$nostar .=$nopoststar;}
  10.         }
  11.     if($_DCACHE['weekstar']) {
  12.                 foreach($_DCACHE['weekstar'] as $key => $wstar) {
  13.             if ($key<3){
  14.                 $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;
  15.             }
  16.                 }
  17. if($weeknum==0){$noweekstar .=$nopoststar.$nopoststar;}elseif($weeknum==1){$noweekstar .=$nopoststar;}
  18.         }
  19.     if($_DCACHE['monthstar']) {
  20.                 foreach($_DCACHE['monthstar'] as $key => $mstar) {
  21.             if ($key<3){
  22.                 $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>";
  23.             }
  24.                 }
  25.         }
  26.     if($_DCACHE['yearstar']) {
  27.                 foreach($_DCACHE['yearstar'] as $key => $ystar) {
  28.             if ($key<3){
  29.                 $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>";
  30.             }
  31.                 }
  32.         }
  33. //==========社区明星BY 33201 结束
复制代码



10.编辑模板discuz.htm

查找:
  1. <!--{loop $catlist $key $cat}-->
复制代码

上面加(注意是上面):
  1. <!--{if $show_poststar}-->
  2. {template show_poststar}
  3. <!--{/if}-->
复制代码

如果不想安装后台控制,请添加以下代码
  1. {template show_poststar}
复制代码



注:5楼问题解决(由于是COPY的内容,忘记改地址了)

[ 本帖最后由 jnow 于 2006-9-4 05:00 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
aheng0629 发表于 2006-9-3 02:53:56 | 显示全部楼层
找不到附件啊  也没有安装步骤啊
小弟是新手  看不到以前的步骤 安装不起哈     神啊  救救我吧
回复

使用道具 举报

aheng0629 发表于 2006-9-3 02:54:27 | 显示全部楼层
晕  我惊叹  我竟然是沙发  爽哈
回复

使用道具 举报

ormiao 发表于 2006-9-3 03:01:27 | 显示全部楼层
沒下載的??? 有演示嗎??
回复

使用道具 举报

5801805 发表于 2006-9-3 03:06:03 | 显示全部楼层
https://discuz.dismall.com/viewthread.php?tid=247056 一共才8步  你的第十步是哪冒出来的?
回复

使用道具 举报

 楼主| jnow 发表于 2006-9-4 03:57:51 | 显示全部楼层

现在只能半夜上DZ,白天根本打不开
回复

使用道具 举报

赤脚晓涛 发表于 2006-9-4 08:02:43 | 显示全部楼层
谢谢已经安装成功~~!
http://bbs.waxw.cn/
回复

使用道具 举报

lierrer 发表于 2006-9-4 08:20:13 | 显示全部楼层
原帖由 5801805 于 2006-9-3 03:06 发表
https://discuz.dismall.com/viewthread.php?tid=247056 一共才8步  你的第十步是哪冒出来的?



呃……参照的难道不是这帖吗?
https://discuz.dismall.com/thread-277742-1-1.html
为啥会是四格……= =|||
回复

使用道具 举报

折翼の天使♂ 发表于 2006-9-4 08:26:04 | 显示全部楼层
看看...
回复

使用道具 举报

lierrer 发表于 2006-9-4 09:09:02 | 显示全部楼层
默……还是放在联盟论坛的上面好看些……= =|||
于是,偶把discuz.htm里面的修改放在了
  1. <!--{if empty($gid) && ($_DCACHE['forumlinks'] || $whosonlinestatus || $bdaystatus == 1 || $bdaystatus == 3)}-->
复制代码

这段代码的上面……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-3 14:25 , Processed in 0.112543 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表