今天在商业区发现有用户在利用sql标签调用博文时,无法过滤ubb代码。特分享如下:
请打开ks_cls/kesion.commoncls.asp
找到
'取消HTML
Public Function LoseHtml(ByVal ContentStr)
On Error Resume Next
Dim TempLoseStr, regEx
If ContentStr="" Or ContentStr=Null Then Exit Function
TempLoseStr = HtmlCode(ContentStr)
Set regEx = New RegExp
regEx.Pattern = "<\/*[^<>]*>"
regEx.IgnoreCase = True
regEx.Global = True
TempLoseStr = regEx.Replace(TempLoseStr, "")
LoseHtml = TempLoseStr
End Function
并替换为
'取消HTML
Public Function LoseHtml(ByVal ContentStr)
On Error Resume Next
Dim TempLoseStr, regEx
If ContentStr="" Or ContentStr=Null Then Exit Function
TempLoseStr = HtmlCode(ContentStr)
Set regEx = New RegExp
regEx.Pattern = "<\/*[^<>]*>"
regEx.IgnoreCase = True
regEx.Global = True
RegEx.Pattern = "\[[^\]]*\]" '过滤ubbcode
TempLoseStr = regEx.Replace(TempLoseStr, "")
LoseHtml = TempLoseStr
End Function
这样在做sql标签时,选择过滤html,就会同时将ubb代码过滤掉了。