游客可以查看附件图片但不能下载附件
要做到所有人都可以查看附件,但下载要根据论坛设定的权限决定,只需要修改两处:1.修改viewthread.php文件,取消对查看权限的限制。
查找以下代码:
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;
}
}
}
2.修改模板文件 viewthread_node.htm
查找以下代码:
**** Hidden Message *****
页:
[1]
2