字体:  

密码及定员帖限制功能加强 For 4.1

sw08 发表于: 2006-5-03 14:36 来源: SupeSite/X-Space官方站

这个是我把魔焰男孩原来的密码和定员帖改进而成的:
http://www.discuz.net/viewthread.php?tid=236182
http://www.discuz.net/viewthread.php?tid=243891
图片就不给了,因为大家都知道是什么样子了。


相对魔焰男孩的版本改进的是:
1、可以按照用户组限制会员设置密码或者定员帖的权限
2、可以对每个用户组的密码设置权限在现有基础上,增加对密码长度限制的控制。
3、增强Archiver功能,防止Archiver泄密。这个很重要的,要不然前面都是白费了~


预告:鉴于有人说限制功能如果一下子开的太多,会导致发表新帖时候的窗口拉的非常长。我会在十几分钟后再发表一个发帖页面横版美化和后台美化的修改建议。
已出,这个是可选的:http://www.discuz.net/thread-286616-1-1.html
推荐主题:
1、最强!总积分、发帖数及拓展积分限制帖子浏览 For 4.1!
http://www.discuz.net/viewthread.php?tid=285910

2、限制会员设置阅读权限过高with后台设置 For 4.1
http://www.discuz.net/viewthread.php?tid=284750

3、后台管理帖子浏览权限补丁 For 4.1
http://www.discuz.net/viewthread.php?tid=286651

这个插件4.0是肯定用不了的,~当时修改程序时候,好多地方都不一样。

升级数据库:

CODE:

ALTER TABLE cdb_threads ADD `password` Varchar(32) NOT NULL DEFAULT '';
ALTER TABLE cdb_usergroups ADD `allowpassword` Tinyint(1) NOT NULL DEFAULT '1';
ALTER TABLE cdb_usergroups ADD `longthpw` Tinyint(3) NOT NULL DEFAULT '1';
ALTER TABLE cdb_usergroups ADD `allowreaduser` Tinyint(1) NOT NULL DEFAULT '1';
ALTER TABLE cdb_threads ADD readuser Varchar(255) NOT NULL DEFAULT '';
打开groups.inc.php:
找到:

CODE:

showsetting('usergroups_edit_anonymous', 'allowanonymousnew', $group['allowanonymous'], 'radio');在下面加:

CODE:

showsetting('允许使用密码限制', 'allowpasswordnew', $group['allowpassword'], 'radio');
showsetting('密码最大长度', 'longthpwnew', $group['longthpw'], 'text');
showsetting('允许使用指定用户限制', 'allowreadusernew', $group['allowreaduser'], 'radio');
找到:

CODE:

allowsetreadperm='$allowsetreadpermnew',在后面加:

CODE:

allowpassword='$allowpasswordnew',longthpw='$longthpwnew',allowreaduser='$allowreadusernew',打开./include/newthread.inc.php
找到:

CODE:

        if(!$typeid && $forum['threadtypes']['required']) {在上面加:

CODE:

        $readuser = isset($readuser) ? $readuser : '';
        if(strlen($readuser) > 255) {
                showmessage('您设置的指定阅读用户超过 255 个字符, 请返回修改。');
        }
找到:

CODE:

$price = $maxprice ? ($price <= $maxprice ? $price : $maxprice) : 0;在下面加:

CODE:

        $password = $password ? $password : '';

        if(strlen($password) > $longthpw) {
                showmessage('您设置的密码过长,请返回修改。');
        }
        if($password) $password = md5($password);
找到:

CODE:

        $db->query("INSERT INTO {$tablepre}threads (fid, readperm,在后面加:

CODE:

password,readuser,再找到:

CODE:

VALUES ('$fid', '$readperm',在后面加:

CODE:

'$password','$readuser',打开文件 ./include/editpost.inc.php
找到:

CODE:

$readperm = $allowsetreadperm ? $readperm : ($isorigauthor ? 0 : 'readperm');在上面加:

CODE:

                             $password = $password ? $password : '';
                        if(($password != $thread['password']) && (strlen($password) > $longthpw)) {
                                showmessage('您设置的密码过长,请返回修改。');
                        }
                        if(!empty($password) && (strlen($password) != 32)) $password = md5($password);
找到:

CODE:

                        if(!$typeid && $forum['threadtypes']['required']) {在上面加:

CODE:

                        $readuser = isset($readuser) ? $readuser : '';
                        if(strlen($readuser) > 255) {
                                showmessage('您设置的指定阅读用户超过 255 个字符, 请返回修改。');
                        }
找到:

CODE:

readperm='$readperm',在后面加:

CODE:

readuser='$readuser',password='$password',打开文件 ./viewthread.php
找到:

CODE:

if($thread['price'] > 0) {在上面加:

CODE:

if($thread['password'] && $action == 'pwverify') {
        if(md5($pw) != $thread['password']) {
                showmessage('密码错误,请返回重新输入。', NULL, 'HALTED');
        } else {
                dsetcookie('tidpw'.$thread['tid'], $pw);
                showmessage('密码验证成功,现在将转入帖子。', "viewthread.php?tid={$thread['tid']}");
        }
}
if($thread['author'] != $discuz_user && !empty($thread['password']) && ($adminid != 1) && $thread['password'] != md5($_DCOOKIE['tidpw'.$thread['tid']])) {
        include template('viewthread_passwd');
        exit();
}
找到:

CODE:

$allowpaytoauthor = substr(sprintf('%02b', $forum['allowtrade']), -2, 1);在上面加:

CODE:

$readuser = explode(',', $thread['readuser']);
$readchk = false;
foreach($readuser as $chk_name => $chk_user) {
        if($discuz_user == $chk_user) {
                $readchk = true;
                break;
        }
}
unset($readuser, $chk_name, $chk_user);
if($thread['readuser'] && !$readchk && ($adminid != 1) && ($thread['author'] != $discuz_user)) showmessage('对不起, 本帖只有指定人员才能阅读, 您不在指定列表中, 因此无权阅读本帖。');
打开:
forumdisplay.htm

找到:

CODE:

                <!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->在下面加:

CODE:

                <!--{if $thread['readuser']}--> - [认证帖子]<!--{/if}-->
<!--{if $thread['password']}--> - [密码]<!--{/if}-->
打开:viewthread.htm
找到:

CODE:

$thread['blog']在后面加(前面有空格):

CODE:

|| $thread['readuser'] || $thread['password']找到:

CODE:

<!--{if $thread['readperm']}-->  {lang readperm_thread} <span class=\"bold\">$thread[readperm]</span>  <!--{/if}-->在下面加:

CODE:

        <!--{if $thread['password']}-->  阅读本帖需要密码  <!--{/if}-->
<!--{if $thread['readuser']}-->  本帖只有指定人员才能阅读  <!--{/if}-->
打开:post_newthread.htm
找到:

CODE:

<!--{if $maxprice}-->在上面加:

CODE:

<!--{if $allowpassword == 1 && !empty($longthpw)}-->
       <tr>
        <td class="altbg1">阅读密码:</td>
        <td class="altbg2"><input type="text" name="password" size="15" value=""> <span class="smalltxt">(浏览帖子需要输入的密码,$longthpw 个字符以内,留空为不使用)</span></td>
        </tr>
<!--{/if}-->
<!--{if $allowreaduser == 1}-->
        <tr>
        <td class="altbg1">本帖阅读用户:</td>
        <td class="altbg2"><input type="text" name="readuser" size="20" value=""> <span class="smalltxt">(允许浏览本帖的用户,多个用户请用半角 ',' 分隔,留空为所有用户都能阅读)</span></td>
        </tr>
<!--{/if}-->
打开post_editpost.htm :
找到:

CODE:

<!--{if $maxprice}-->在上面加:

CODE:

<!--{if $allowpassword == 1 && !empty($longthpw)}-->
       <tr>
        <td class="altbg1">阅读密码:</td>
        <td class="altbg2"><input type="text" name="password" size="15" value=""> <span class="smalltxt">(浏览帖子需要输入的密码,$longthpw 个字符以内,留空为不使用)</span></td>
        </tr>
<!--{/if}-->
<!--{if $allowreaduser == 1}-->
        <tr>
        <td class="altbg1">本帖阅读用户:</td>
        <td class="altbg2"><input type="text" name="readuser" size="20" value=""> <span class="smalltxt">(允许浏览本帖的用户,多个用户请用半角 ',' 分隔,留空为所有用户都能阅读)</span></td>
        </tr>
<!--{/if}-->
防止Archiver泄密的修改(重要!):
打开Archiver\include\thread.inc.php

找到:

CODE:

WHERE t.tid='$tid' AND t.readperm='0' AND t.price<='0' AND t.displayorder>='0'在后面加:

CODE:

AND t.password='' AND t.readuser=''下载附件,把压缩包里面的 viewthread_passwd.htm 上传到论坛的 ./templates/default/ 目录里。

[ 本帖最后由 sw08 于 2006-5-4 09:44 编辑 ]

viewthread_passwd.rar
(2006-05-03 15:31:32, Size: 776 B , Downloads: 768)

最新回复

小样贼绝 at 2006-5-03 14:36:58
w ye lai ge shafa
『狂』 at 2006-5-03 14:37:09
黃金廣告位@v@
泡海椒 at 2006-5-03 14:41:56
占位ing。。。。。。。。。。
xjbl at 2006-5-03 14:42:20
哦..
njf911 at 2006-5-03 14:58:26
支持一下
孤情一刀 at 2006-5-03 15:01:53
支持
fbise at 2006-5-03 15:03:51
功能???
madly at 2006-5-03 15:18:50
顶了,好多 复杂的功能。。
sw08 at 2006-5-03 15:32:04
刚刚漏了附件,已经上传。
81jun at 2006-5-03 15:46:36
顶一下!路过!
amoshuang at 2006-5-03 16:24:17
支持
月无痕 at 2006-5-03 17:15:55
哭啊,为什么不发个4.0的啊
sw08 at 2006-5-03 17:18:27
魔焰男孩的那个版本就是4.0的
3481 at 2006-5-03 17:33:11
谢谢您,精益求精

不知能否,加入分板块控制的功能,可以指定那个版面可使用此功能.再次谢谢您

http://www.discuz.net/thread-265639-1-1.html
ppll0001 at 2006-5-03 17:40:22
能加个分板块控制的功能吗?这个很有用的
还有能不把加个指定用户组浏览的定员帖?
也就是说不是指定一个会员,而是指定管理组或者是自定义的用户组的会员浏览?

谢谢楼主~你的插件我都很喜欢~~呵呵~~安装中!!!!
sw08 at 2006-5-03 17:44:53
我再看看~
sw08 at 2006-5-03 17:45:28
比较麻烦,我一般比较避免板块编辑的修改。

有时间我再发下吧。
bhqtcn at 2006-5-03 18:01:24
支持一下
离恨天 at 2006-5-03 18:02:40
支持啊
月无痕 at 2006-5-03 18:56:13

QUOTE:

原帖由 sw08 于 2006-5-3 17:18 发表
魔焰男孩的那个版本就是4.0的
我要用楼主的加强版
at