65 0 0

回复可见插件优化教程

白小纯 站长 V
2025-03-24 220

原帖地址: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 个经验,经验可通过 /发布主题/签到/回帖/获得!
拥有经验  :排行
拥有金币  :
兑换
拥有现金  :  0充值
关闭
最新回复 (65)
  • 矣我的兔兔 Lv.1 练气
    2025-04-09
    66

    每一次妥协,都是杀死自己一点点。

    签名:CSWl官方博客!
    0 引用
  • 街角 Lv.1 练气
    2025-04-09
    65

    世上所有巧合,都是蓄谋已久。

    签名:CSWl官方博客!
    0 引用
  • 傲雪清 Lv.1 练气
    2025-04-09
    64

    生存还是毁灭,这是个问题

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

请先登录后发表评论!

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