172 0 0

回复可见插件优化教程

陈哥 (UID:1) 站长 创始人 V
2025-03-24 620

原帖地址:http://bbs.cswl.top/thread-197.htm

遇到的问题:只能隐藏文字和链接,遇到图片,则标签直接失效,展示明文

修复方法:

打开 /tt_read/hook/thread_info_end.php

核心修复点:正则代码 /i 改为 /is

其他部分无需任何修改

不懂代码一键替换,直接替换原有代码如下即可修复:

<?php exit;
    $gid=isset($user ['gid'])?$user ['gid']:'0'; $my_p=$group ['readp']; $target_p=$thread ['readp']; $need_refresh=0;
    // hook read_p_check_start.php
    if(($gid!=1)&& $my_p<$target_p ){ message(-1, jump(lang('dear_p'), http_referer(), 2));die();}
	$preg_login = preg_match_all('/\ [ttlogin\](.*?)\ [\/ttlogin\]/is', $first ['message_fmt'], $array);
    if($preg_login) {
        $array_count = count($array [0]);
        $html_hide='<div class="alert alert-warning" role="alert">'.lang('dear_guest2').'<a href ="/user-login.htm"><i class="icon-user"></i> '.lang('login').'</a> '.lang('or_').' <a href ="/user-create.htm"><i class="icon-flask"></i> '.lang('register').'</a></div>';
        for($i=0;$i<$array_count;$i++){
            $a = $array [0] [$i];
            $b = '<div class="alert alert-success" role="alert">'.$array [1] [$i].'</div>';
            if($uid)$first ['message_fmt'] = str_replace($a,$b,$first ['message_fmt']);
            else $first ['message_fmt'] = str_replace($a,$html_hide,$first ['message_fmt']);
        }
    }
    $preg_reply = preg_match_all('/\ [ttreply\](.*?)\ [\/ttreply\]/is', $first ['message_fmt'], $array);
    if($preg_reply) {
        $array_count = count($array [0]);
        $html_reply ='<div class="alert alert-warning" role="alert">'.lang('dear_reply').'</div>';
        if($uid) $replied=db_find_one('post',array('uid'=>$uid,'tid'=>$thread ['tid'])); else $replied=array();
        for($i=0;$i<$array_count;$i++){
            $a = $array [0] [$i];
            $b = '<div class="alert alert-success" role="alert">'.$array [1] [$i].'</div>';
            if($uid AND $replied)$first ['message_fmt'] = str_replace($a,$b,$first ['message_fmt']);
            if($uid AND isset($gid) AND $gid==1)$first ['message_fmt'] = str_replace($a,$b,$first ['message_fmt']);
            // hook read_p_reply_verify_end.php
            else {$first ['message_fmt'] = str_replace($a,$html_reply,$first ['message_fmt']);$need_refresh=1;}
        }
    }
$set = setting_get('tt_read');
if($set&& $set ['old']==1) {
    $preg_reply2 = preg_match_all('/\ [reply\](.*?)\ [\/reply\]/i',$first ['message_fmt'],$array2);
    if($preg_reply2) {
        $array2_count = count($array2 [0]);
        $html_reply ='<div class="alert alert-warning" role="alert">'.lang('dear_reply').'</div>';
        if($uid) $replied=db_find_one('post',array('uid'=>$uid,'tid'=>$thread ['tid'])); else $replied=array();
        for($i=0;$i<$array2_count;$i++){
            $a = $array2 [0] [$i];
            $b = '<div class="alert alert-success" role="alert">'.$array2 [1] [$i].'</div>';
            if($uid AND $replied)$first ['message_fmt'] = str_replace($a,$b,$first ['message_fmt']);
            // hook read_p_reply_verify_end.php
            else {$first ['message_fmt'] = str_replace($a,$html_reply,$first ['message_fmt']);$need_refresh=1;}
        }
    }
}
?>

下载声明

每次下载将扣除 1个元宝,VIP会员免费下载,元宝可通过 /发布主题/签到/回帖/获得!
拥有真气  :排行
拥有元宝  :
兑换
拥有灵石  :  0枚充值
关闭
温馨提示:转载本站资源,请备注本站链接,谢谢配合!
最新回复 (172)
  • 銫沐莓 (UID:10103) Lv.1 练气
    2025-07-10
    173

    速热的人也速冻,慢热的人最长情。

    签名:CSWl官方博客!
    0 引用
  • 傲雪清 (UID:10118) Lv.1 练气
    2025-07-10
    172

    速热的人也速冻,慢热的人最长情。

    签名:CSWl官方博客!
    0 引用
  • ╰脚踩棉花糖 (UID:10140) Lv.1 练气
    2025-07-10
    171

    你要墮落,谁也救不了;你要成长,绝处也能逢生。

    签名:CSWl官方博客!
    0 引用

请先登录后发表评论!

返回
请先登录后发表评论!