pjblog352版本ubb编辑器下code插入代码无法正常显示的解决方法

如题,pjblog352版本ubb编辑器下code插入代码无法正常显示,HTML标签会被解析。临时解决方法如下:(反正目前这个问题牵涉比较多,自己暂时就这样折中修改了)

编辑common/function.asp文件,查找如下函数代码:

Function UnCheckStr(ByVal Str)
    If IsNull(Str) Then
        UnCheckStr = ""
        Exit Function
    End If
    Str = Replace(Str, "'", "'")
    Str = Replace(Str, """, """")
    Str = Replace(Str, "<", "<")
    Str = Replace(Str, ">", ">")
    Dim re
    Set re = New RegExp
    re.IgnoreCase = True
    re.Global = True
    re.Pattern = "(w)(here)"
    Str = re.Replace(Str, "$1here")
    re.Pattern = "(s)(elect)"
    Str = re.Replace(Str, "$1elect")
    re.Pattern = "(i)(nsert)"
    Str = re.Replace(Str, "$1nsert")
    re.Pattern = "(c)(reate)"
    Str = re.Replace(Str, "$1reate")
    re.Pattern = "(d)(rop)"
    Str = re.Replace(Str, "$1rop")
    re.Pattern = "(a)(lter)"
    Str = re.Replace(Str, "$1lter")
    re.Pattern = "(d)(elete)"
    Str = re.Replace(Str, "$1elete")
    re.Pattern = "(u)(pdate)"
    Str = re.Replace(Str, "$1pdate")
    re.Pattern = "(s)(or)"
    Str = re.Replace(Str, "$1or")
    Set re = Nothing
    Str = Replace(Str, "&", "&")
    UnCheckStr = Str
End Function
</code>
在其下面添加如下函数代码:
<code>
Function UnCheckStr0(ByVal Str)
    If IsNull(Str) Then
        UnCheckStr0 = ""
        Exit Function
    End If
    Str = Replace(Str, "'", "'")
    Str = Replace(Str, """, """")
    Dim re
    Set re = New RegExp
    re.IgnoreCase = True
    re.Global = True
    re.Pattern = "(w)(here)"
    Str = re.Replace(Str, "$1here")
    re.Pattern = "(s)(elect)"
    Str = re.Replace(Str, "$1elect")
    re.Pattern = "(i)(nsert)"
    Str = re.Replace(Str, "$1nsert")
    re.Pattern = "(c)(reate)"
    Str = re.Replace(Str, "$1reate")
    re.Pattern = "(d)(rop)"
    Str = re.Replace(Str, "$1rop")
    re.Pattern = "(a)(lter)"
    Str = re.Replace(Str, "$1lter")
    re.Pattern = "(d)(elete)"
    Str = re.Replace(Str, "$1elete")
    re.Pattern = "(u)(pdate)"
    Str = re.Replace(Str, "$1pdate")
    re.Pattern = "(s)(or)"
    Str = re.Replace(Str, "$1or")
    Set re = Nothing
    Str = Replace(Str, "&", "&")
    UnCheckStr0 = Str
End Function

编辑文件class/cls_logAction.asp 查找以下代码:

查找如下代码:

       Temp1 = Replace(Temp1, "<$ArticleContent$>", UnCheckStr(UBBCode(HtmlEncode(log_View("log_Content")), Mid(log_View("log_ubbFlags"), 1, 1), Mid(log_View("log_ubbFlags"), 2, 1), Mid(log_View("log_ubbFlags"), 3, 1), Mid(log_View("log_ubbFlags"), 4, 1), Mid(log_View("log_ubbFlags"), 5, 1))))

修改为如下代码:(有两处)

Temp1 = Replace(Temp1, "<$ArticleContent$>", UnCheckStr0(UBBCode(HtmlEncode(log_View("log_Content")), Mid(log_View("log_ubbFlags"), 1, 1), Mid(log_View("log_ubbFlags"), 2, 1), Mid(log_View("log_ubbFlags"), 3, 1), Mid(log_View("log_ubbFlags"), 4, 1), Mid(log_View("log_ubbFlags"), 5, 1))))

查找:

Temp2 = Replace(Temp2, "<$log_Intro$>", UnCheckStr(UBBCode(log_View("log_Intro"), Mid(log_View("log_ubbFlags"), 1, 1), Mid(log_View("log_ubbFlags"), 2, 1), Mid(log_View("log_ubbFlags"), 3, 1), Mid(log_View("log_ubbFlags"), 4, 1), Mid(log_View("log_ubbFlags"), 5, 1))))

修改为:

Temp2 = Replace(Temp2, "<$log_Intro$>", UnCheckStr0(UBBCode(log_View("log_Intro"), Mid(log_View("log_ubbFlags"), 1, 1), Mid(log_View("log_ubbFlags"), 2, 1), Mid(log_View("log_ubbFlags"), 3, 1), Mid(log_View("log_ubbFlags"), 4, 1), Mid(log_View("log_ubbFlags"), 5, 1))))

在文件common/class.asp查找:

UnCheckStr

修改为:

UnCheckStr0

保存上传文件,后台更新缓存,静态重新生成

点赞 (0)
  1. 啊啊啊说道:

    这是什么啊...一点留言就换成这样了.楼主的BBLOG程序有问题....另外...你最后那个代码好像写错了,

    把UnCheckStr0

    改成UnCheckStr0

    ???我看不出来有什么变化呢.
    [reply=任侠,2011-12-14 10:04 AM]确实,笔误
    这里其实就是把对UnCheckStr函数的调用改为新添加的UnCheckStr0函数[/reply]

发表评论

电子邮件地址不会被公开。 必填项已用*标注