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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 社区发贴之星(适合20080606版本)forDZ6.1正式版

[复制链接]
whiov 发表于 2008-6-24 13:06:33 | 显示全部楼层 |阅读模式
===============演示地址:http://bbs.szhit.net=======================



注意:修改文件中的discuz.htm index.php,include 我已经做了修改!
     假如你没有修改其他的文件就直接覆盖,其他的文件直接上传就可。
     修改前,强烈建议你在安装前备份文件!!


插件功能:
新增加的功能:
          1.首页显示今日+本周+本月+本年四类发帖状元、榜眼、探花,不分男女!可切换显示,有效增加会员的发贴 热情和参与度
          2.首页显示今日+本周+本月+本年发贴TOP10
          3.增加了一个单独的社区明星页面显示今日+昨日+本周+本月+本年五类发帖状元、榜眼、探花以及发贴TOP10
          4.修正了原来的状元、榜眼或探花不存在时的空白问题,在不存在时显示为虚位以待
          5.全部内容生成缓存cache,不增加任何查询,有效减轻服务器负担
原来的功能:
          1.首页显示当日发帖状元、榜眼、探花,不分男女!
          2.显示当日发帖最多的十位会员!
         
          3.加入收缩展开功能(默认发帖状元、榜眼、探花三栏隐藏的,当然你也可以修改为展开的)!
插件安装步骤:

1.上传附件!

插件安装步骤:

1.上传附件![附件分改好的部分和手动修改的附件]

2.编辑文件include/cache.func.php
     2.1查找:

          'medals'     => array('medals')
          在其上面加

         'poststar'        => array('daystar', 'yestodaystar','weekstar', 'monthstar', 'yearstar'),

      2.2查找:

case 'medals':
                        $table = 'medals';
                        $cols = 'medalid, name, image';
                        $conditions = "WHERE available='1'";
                        break;
             在其上

//===============社区明星========= 开始
                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 cdb_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;

//===================社区明星========= 结束


       2.3 查找:

case 'settings':
                        while($setting = $db->fetch_array($query))

              在其上面加

//===================社区明星 开始
                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;

//=====================社区明星========= 结束

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

updatepostcredits('+', $discuz_uid, $postcredits);

   在其下面加

require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('daystar');

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

updatepostcredits('+', $discuz_uid, $replycredits);

    在其下面加
require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('daystar');

5.编辑文件topicadmin.php
   查找

showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);

在其上面加

require_once DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('daystar');

6.编辑文件index.php

6.1查找:
require_once DISCUZ_ROOT.'./include/forum.func.php';
下面添加:

require_once DISCUZ_ROOT.'./forumdata/cache/cache_poststar.php';
$month=date(n);
$year=date(Y);

6.2查找:
unset($_DCACHE['announcements']);
下面添加:
//========== 社区明星========= 开始
$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='http://你的uc地址/avatar.php?uid=$dstar[authorid]'></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='http://你的uc地址/avatar.php?uid=$wstar[authorid]'></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='http://你的uc地址/avatar.php?uid=$mstar[authorid]'></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='http://你的uc地址/avatar.php?uid=$ystar[authorid]'></td>";
            }
  }
}
//==========社区明星======= 结束


7.编辑模板discuz.htm
查找:

最后一步我感觉把
{template show_poststar}

放到这个上面要好一些
<!--{if $_DCACHE['forumlinks']}-->
<div class="box">

大家可以看演示能看到图片了!切记:要在后台更新缓存

完毕!

注意:首页默认发帖状元、榜眼、探花三栏是展开的,如果你想默认改为隐藏的就将show_poststar.htm
中的
<tbody id="poststar" style="display:yes">

的 yes 修改为 none 即可!

[ 本帖最后由 whiov 于 2008-8-8 05:34 编辑 ]

本帖子中包含更多资源

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

x
 楼主| whiov 发表于 2008-6-24 23:32:02 | 显示全部楼层
下载了20次?没人顶?
回复

使用道具 举报

梦见姗 发表于 2008-6-25 04:20:17 | 显示全部楼层
哥们~我顶你~做人要厚道  哈哈  我找发帖之星 UTF8的呢   一直没找到
回复

使用道具 举报

宝儿2008 发表于 2008-6-25 07:05:03 | 显示全部楼层
装了你的论坛都打不开,如何不叫人失望!!!(::22::)
回复

使用道具 举报

arming5802 发表于 2008-6-25 07:55:32 | 显示全部楼层
呵呵...我也来顶一个!
回复

使用道具 举报

 楼主| whiov 发表于 2008-6-25 09:31:40 | 显示全部楼层
原帖由 宝儿2008 于 2008-6-25 07:05 发表
装了你的论坛都打不开,如何不叫人失望!!!(::22::)

切记:要在后台更新缓存

请看好我写的每句话.谢谢!
回复

使用道具 举报

 楼主| whiov 发表于 2008-6-25 09:32:56 | 显示全部楼层
竟然你们失望`那我也只好不共享免费了.

有钱就免吧!原来天下还是不能太好心.
回复

使用道具 举报

中原游民 发表于 2008-6-25 18:07:37 | 显示全部楼层
我顶你...搞个免费版本啊???
回复

使用道具 举报

leooe 发表于 2008-6-25 18:19:23 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

langdoo 发表于 2008-6-25 22:59:46 | 显示全部楼层
太复杂了,看到头都大了!
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-22 03:37 , Processed in 0.131758 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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