⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions_filters.asp

📁 快速、可设定管理权限等级的论坛程序
💻 ASP
📖 第 1 页 / 共 3 页
字号:
	strTempOutputMessage = strMessageInput



	'****** Remove flash forum code so it's not changed *******
	
	'Loop through all the codes in the message and convert them to formated flash links
	Do While InStr(1, strTempMessageText, "[FLASH", 1) > 0 AND InStr(1, strTempMessageText, "[/FLASH]", 1) > 0

		'Get the Flash BBcode from the message
		lngStartPos = InStr(1, strTempMessageText, "[FLASH", 1)
		lngEndPos = InStr(lngStartPos, strTempMessageText, "[/FLASH]", 1) + 8

		'Make sure the end position is not in error
		If lngEndPos < lngStartPos Then lngEndPos = lngStartPos + 6

		'Get the original Flash BBcode from the message
		strTempFlashMsg = Trim(Mid(strTempMessageText, lngStartPos, lngEndPos-lngStartPos))
		
		'Add 1 to the loop counter
		lngLoopCounter = lngLoopCounter + 1
				
		'Redim the array, use preserve to keep the old array parts
		ReDim Preserve saryHTMLlinks(2,lngLoopCounter)
				
		'Create a code to replace the link with in original string
		strHTMLlinksCode = " **/**WWFflash00" & lngLoopCounter & "**\** "
				
		'Place the code and the original link into the array
		saryHTMLlinks(1,lngLoopCounter) = strHTMLlinksCode
		saryHTMLlinks(2,lngLoopCounter) = strHTMLMessage
		
		'Rpleace the HTML tag with the new code that is saved in array
		strTempMessageText = Replace(strTempMessageText, strTempFlashMsg, strHTMLlinksCode, 1, -1, 0)
			
		'A link is found so set the link found variable to true
		blnHTMLlink = True
		
		strTempMessageText = Replace(strTempMessageText, strTempFlashMsg, Replace(strTempFlashMsg, "[", "&#91;", 1, -1, 1), 1, -1, 1)
	Loop




	'****** Strip HTML from message *******
	
	'Loop through each character in the post message
	For lngMessagePosition = 1 to CLng(Len(strMessageInput))

		'If this is the end of the message then save some process time and jump out the loop
		If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
		
		'If an HTML tag is found then jump to the end so we can strip it
		If Mid(strMessageInput, lngMessagePosition, 1) = "<" Then

			'Get the length of the HTML tag
			intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, ">", 1) - lngMessagePosition)
			
			'If the end of the HTML string is in error then set it to the number of characters being passed
			If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageText))

			'Place the HTML tag back into the temporary message store
			strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
			
			
			'****** Remove links so they aren't changed *******
			
			'See if the HTML tag is a link, if so replace with a code so it is not changed when spliting long chars
			If InStr(1, strHTMLMessage, "href", 1) Then
				
				'Add 1 to the loop counter
				lngLoopCounter = lngLoopCounter + 1
				
				'Redim the array, use preserve to keep the old array values
				ReDim Preserve saryHTMLlinks(2,lngLoopCounter)
				
				'Create a code to replace the link with in original string
				strHTMLlinksCode = " **/**WWFlink00" & lngLoopCounter & "**\** "
				
				'Place the code and the original link into the array
				saryHTMLlinks(1,lngLoopCounter) = strHTMLlinksCode
				saryHTMLlinks(2,lngLoopCounter) = strHTMLMessage
				
				'Rpleace the HTML tag with the new code that is saved in array
				strTempOutputMessage = Replace(strTempOutputMessage, strHTMLMessage, strHTMLlinksCode, 1, -1, 0)
			
				'A link is found so set the link found variable to true
				blnHTMLlink = True
			End If
			'***************************************************
	
			'Strip the HTML
			strTempMessageText = Replace(strTempMessageText, strHTMLMessage, " ", 1, -1, 0)
		End If
	Next
	
	
	
	'****** Strip Forum Codes from message *******
	
	'Loop through each character in the post message
	For lngMessagePosition = 1 to CLng(Len(strMessageInput))

		'If this is the end of the message then save some process time and jump out the loop
		If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
		
		'If an BBCode tag is found then jump to the end so we can strip it
		If Mid(strMessageInput, lngMessagePosition, 1) = "[" Then

			'Get the length of the BBCode tag
			intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, "]", 1) - lngMessagePosition)
			
			'If the end of the BBCode string is in error then set it to the number of characters being passed
			If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageText))

			'Place the BBCode tag back into the temporary message store
			strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
	
			'Strip the BBCode
			strTempMessageText = Replace(strTempMessageText, strHTMLMessage, " ", 1, -1, 0)
		End If
	Next
	


	'****** Check for and remove long strings *******
	
	'Now we have just the text (no HTML) in plain text variable see if any of the text strings in it are over 30 chars in length
	saryPlainTextWord = Split(Trim(strTempMessageText), " ")
	
	'Loop through all the words till they are shortened
	For lngLoopCounter = 0 To UBound(saryPlainTextWord)
		
		'If the text string length is more than the max word length then place spaces in the text string
		If Len(saryPlainTextWord(lngLoopCounter)) > intMaxWordLength Then
			
			'Redim the array (don't use preserve as we want to loose the last data in the array)
			Redim sarySplitTextWord(CInt(Len(saryPlainTextWord(lngLoopCounter))/intMaxWordLength+1))
			
			'Initiliase variable
			intWordSartPos = 1
			
			'Loop through all the splits in the word
			For lngSplitPlainTextWordLoop = 1 To UBound(sarySplitTextWord)
			
				'Place the split word into the array
				sarySplitTextWord(lngSplitPlainTextWordLoop) = Mid(saryPlainTextWord(lngLoopCounter), intWordSartPos, intMaxWordLength)

				'Add max word length to the start position
				intWordSartPos = intWordSartPos + intMaxWordLength
			Next
			
			'Place the split up long text string back together in one variable with spaces at the max word length
			strTempPlainTextWord = Join(sarySplitTextWord, " ")
			
			'Place the split up word back into the orginal message
			strTempOutputMessage = Replace(strTempOutputMessage, saryPlainTextWord(lngLoopCounter), strTempPlainTextWord, 1, -1, 0)
		End If
	Next
	
	
	
	'****** Replace links so they aren't changed ******
	
	'Place back all the links into the message in place of the codes placed in for them
	If blnHTMLlink Then
		'Loop through each of the changed links
		For lngLoopCounter = 1 To Ubound(saryHTMLlinks,2)
		
			'Strip line carridge returns for MAC users
			saryHTMLlinks(2,lngLoopCounter) = Replace(saryHTMLlinks(2,lngLoopCounter), vbCrLf, "", 1, -1, 0) 
		
			'Replace the code with the link
			strTempOutputMessage = Replace(strTempOutputMessage, saryHTMLlinks(1,lngLoopCounter), saryHTMLlinks(2,lngLoopCounter), 1, -1, 0)
		
		Next
	End If
	

	'Return the function
	removeLongText = strTempOutputMessage
End Function





'*********************************************
'***  	   Decode HTML encoding		 *****
'*********************************************

'Decode encoded strings
Private Function decodeString(ByVal strInputEntry)

	'Decode HTML character entities

	strInputEntry = Replace(strInputEntry, "&#097;", "a", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#098;", "b", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#099;", "c", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#100;", "d", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#101;", "e", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#102;", "f", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#103;", "g", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#104;", "h", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#105;", "i", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#106;", "j", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#107;", "k", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#108;", "l", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#109;", "m", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#110;", "n", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#111;", "o", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#112;", "p", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#113;", "q", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#114;", "r", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#115;", "s", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#116;", "t", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#117;", "u", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#118;", "v", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#119;", "w", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#120;", "x", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#121;", "y", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#122;", "z", 1, -1, 0)

	strInputEntry = Replace(strInputEntry, "&#065;", "A", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#066;", "B", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#067;", "C", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#068;", "D", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#069;", "E", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#070;", "F", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#071;", "G", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#072;", "H", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#073;", "I", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#074;", "J", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#075;", "K", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#076;", "L", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#077;", "M", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#078;", "N", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#079;", "O", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#080;", "P", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#081;", "Q", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#082;", "R", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#083;", "S", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#084;", "T", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#085;", "U", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#086;", "V", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#087;", "W", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#088;", "X", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#089;", "Y", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#090;", "Z", 1, -1, 0)
	

	strInputEntry = Replace(strInputEntry, "&#048;", "0", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#049;", "1", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#050;", "2", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#051;", "3", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#052;", "4", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#053;", "5", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#054;", "6", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#055;", "7", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#056;", "8", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#057;", "9", 1, -1, 0)
	
	
	strInputEntry = Replace(strInputEntry, "&#061;", "=", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&lt;", "<", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&gt;", ">", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&amp;", "&", 1, -1, 0)
	strInputEntry = Replace(strInputEntry, "&#146;", "'", 1, -1, 1)

	'Return
	decodeString = strInputEntry
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -