6.0到6.1.0版简单修改完美解决“游客可以查看但不能下载附件”难题
修改 viewthread.php 取消对查看权限的限制。1.对于6.0.0版的修改:
查找:
if($post['attachment']) {
if($allowgetattach) {
$attachpids .= ",$post";
$post['attachment'] = 0;
if(preg_match_all("/\(\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachtags[$post['pid']] = $matchaids;
}
} else {
$post['message'] = preg_replace("/\(\d+)\[\/attach\]/i", '', $post['message']);
}
}改为:
if($post['attachment']) {
// if($allowgetattach) {
$attachpids .= ",$post";
$post['attachment'] = 0;
if(preg_match_all("/\(\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachtags[$post['pid']] = $matchaids;
}
// } else {
// $post['message'] = preg_replace("/\(\d+)\[\/attach\]/i", '', $post['message']);
// }
}2. 针对6.1.0版的修改:
查找:
if($post['attachment']) {
if($allowgetattach && !$threadpay) {
$attachpids .= ",$post";
$post['attachment'] = 0;
if(preg_match_all("/\(\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachtags[$post['pid']] = $matchaids;
}
} else {
$post['message'] = preg_replace("/\(\d+)\[\/attach\]/i", '', $post['message']);
}
}改为:
if($post['attachment']) {
if(!$threadpay) {
$attachpids .= ",$post";
$post['attachment'] = 0;
if(preg_match_all("/\(\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
$attachtags[$post['pid']] = $matchaids;
}
}
}
这里保留了“付费浏览状态下附件仍然不可见”的功能。
* 以上均经过各版本默认风格下运行测试。如果出现“可以查看也可以下载”的情况,请检查论坛版块和用户组权限中“是否允许下查看/下载附件”的设置。游客和版块的默认设置是没有这两项权限的
原文转自: http://www.discuz.net/thread-645342-1-1.html 看不懂 很好的修改 支持:victory: 呵呵体力增加 .......
页:
[1]