AS 锡安ZionTechExchange 
» 游客:  注册 | 登录 | 冻结用户(激活)?sid=JmfqU6 | 会员

RSS 订阅当前论坛  

上一主题 下一主题
       
标题: [BBShack] 社区发贴之星(今日+昨日+本周+本月+本年)     
 
Phoenix001
妙语书生 Lv5




UID 181234
精华 2
积分 13
帖子 1490
金币 3003 块
阅读权限 10
注册 2019-5-27
状态 离线
社区发贴之星(今日+昨日+本周+本月+本年)

社区发贴之星(今日+昨日+本周+本月+本年)后台控制全Cache版 FOR DZ4.1正式版
https://discuz.dismall.com/thread-277742-1-1.html
(出处: Discuz免费开源建站系统)



...........................................................................................................................................



插件名称:社区发贴之星(今日+昨日+本周+本月+本年发贴排行)后台控制全Cache版 FOR DZ4.1正式版
插件作者:33201
数据库升级:有
安装难度:中
插件演示地址:首页http://bbs.33201.com/index.php
                     社区之星页面http://bbs.33201.com/star.php


    4.27日更新,应部分用户的强烈要求增加了昨日之星,并增加了单独的一个社区明星页面,新用户请全新安装,老用户想升级的方法见2楼,当然你也可以选择不升级,不会对插件造成任何影响

    4.24日更新,修正了虚位以待时变形的问题,具体修正请将9.2步重新进行一遍

    4.23日更新,修正了周社区之星在周日为空的问题,已经装过的修正方法见2楼

    由于修改部分较多,强烈建议你在安装前备份文件!!



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

原来的升级到现在版本的方法见2楼

插件安装步骤:
如果不想要后台控制的话,可以跳过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.编辑模板index.htm
查找:

    <!--{if empty($forumlist)}--><br><br><!--{else}--></table><br></div><div class="maintable"><!--{/if}-->

复制代码

下面加:


    <!--{if $show_poststar}-->
    {template show_poststar}
    <!--{/if}-->

复制代码

如果不想安装后台控制,请添加以下代码


    {template show_poststar}

复制代码


11.后台更新缓存,一定要更新,否则可能首页无法显示
完毕!
注意:默认首页发帖状元、榜眼、探花三栏是展开的,如果你想默认改为隐藏的就将show_poststar.htm
中的


    <tbody id="poststar" style="display:yes">

复制代码

的 yes 修改为 none 即可!


    由于时间仓促和本人水平有限,难免存在一些BUG,大家有什么意见和建议还望大家及时提出,谢谢!










[ 本帖最后由 33201 于 2006-5-30 09:05 编辑 ]
评分
2023-2-20 15:06#1
查看资料  发短消息  顶部
 
Phoenix001
妙语书生 Lv5




UID 181234
精华 2
积分 13
帖子 1490
金币 3003 块
阅读权限 10
注册 2019-5-27
状态 离线
老用户增加昨日社区之星的升级方法
    1.编辑include/cache.func.php文件
    1.1
    查找:

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

    复制代码

    替换为:

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

    复制代码

    1.2
    查找:

                        case 'weekstar':
                                $month=date(n);

    复制代码

    在其上面加上:

                        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;

    复制代码

    1.3
    查找:

                        case 'weekstar':
                                while($toppost = $db->fetch_array($query)) {

    复制代码

    在其上面加上:

                        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;

    复制代码

    2.将附件中的star.php和templates/default/star.htm文件上传.
    3.将附件中的templates/default/show_poststar.htm文件覆盖原来的文件.

    升级完成!!

    在星期日周社区明星显示为空的修正升级方法,全新安装的无须进行次步,文件已经更新

    编辑include/cache.func.php文件

    查找:

        $date+1-$week

    复制代码


    替换为:

        $date-$week

    复制代码


    即可

QUOTE:
原帖由 月无痕 于 2006-4-20 22:28 发表




走形修正方法:

编辑附件中的show_poststar.htm文件

查找:


    width="{TABLEWIDTH}"

复制代码



在后面加:


    align="center"

复制代码



一共有5处


QUOTE:
原帖由 big888 于 2006-4-21 01:27 发表



原来版本升级到现在版本:

一.跳过1-3步骤仅修改4~9步骤即可,和注意11.后台一定要先更新缓存
二.9.1步驟 index.php中
原來的這句要先刪掉


    require DISCUZ_ROOT.'/poststar.php';

复制代码
[ 本帖最后由 33201 于 2006-4-27 20:29 编辑 ]

[ 本帖最后由 Phoenix001 于 2023-2-20 15:10 编辑 ]
2023-2-20 15:08#2
查看资料  发短消息  顶部
       


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题  


 


所有时间为 GMT+8, 现在时间是 2024-5-16 13:52 清除 Cookies - 联系我们 - ZAKE萨尔克岛 - AbyssalSwamp深渊之沼