<% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide ASP Discussion Forum '** '** Copyright 2001-2004 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** '****************************************** '*** HTML to Forum Codes Function ***** '****************************************** 'Edit Post Function to convert posts back to forum codes Private Function EditPostConvertion(ByVal strMessage) Dim strTempMessage 'Temporary word hold for e-mail and url words Dim strMessageLink 'Holds the new mesage link that needs converting back into code Dim lngStartPos 'Holds the start position for a link Dim lngEndPos 'Holds the end position for a word Dim intLoop 'Loop counter strMessage = Replace(strMessage, " target=""_blank""", "", 1, -1, 1) strMessage = Replace(strMessage, " border=""0""", "", 1, -1, 1) strMessage = Replace(strMessage, "", saryEmoticons(intLoop,2), 1, -1, 1) Next 'If the message has been edited remove who edited the post If InStr(1, strMessage, "", 1) Then strMessage = removeEditorAuthor(strMessage) 'Change the HTML codes back into my own codes for bold and italic strMessage = Replace(strMessage, "", "[B]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/B]", 1, -1, 1) strMessage = Replace(strMessage, "", "[I]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/I]", 1, -1, 1) strMessage = Replace(strMessage, "", "[U]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/U]", 1, -1, 1) strMessage = Replace(strMessage, "
", "[HR]", 1, -1, 1) strMessage = Replace(strMessage, "
", "[HR]", 1, -1, 1) strMessage = Replace(strMessage, "
", "[HR]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[LIST=1]", 1, -1, 1) strMessage = Replace(strMessage, "
", "[/LIST=1]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/LIST]", 1, -1, 1) strMessage = Replace(strMessage, "
  • ", "[LI]", 1, -1, 1) strMessage = Replace(strMessage, "
  • ", "[/LI]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[CENTER]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[/CENTER]", 1, -1, 1) strMessage = Replace(strMessage, "", "[B]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/B]", 1, -1, 1) strMessage = Replace(strMessage, "", "[I]", 1, -1, 1) strMessage = Replace(strMessage, "", "[/I]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[P]", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[/P]", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[P ALIGN=CENTER]", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[P ALIGN=LEFT]", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[P ALIGN=RIGHT]", 1, -1, 1) strMessage = Replace(strMessage, "

    ", "[DIV]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[/DIV]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=CENTER]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=LEFT]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=RIGHT]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=CENTER]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=LEFT]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[DIV ALIGN=RIGHT]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[BLOCKQUOTE]", 1, -1, 1) strMessage = Replace(strMessage, "
    ", "[/BLOCKQUOTE]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=1]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=2]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=3]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=4]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=5]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=6]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=6]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=1]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=2]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=3]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=4]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=5]", 1, -1, 1) strMessage = Replace(strMessage, "", "[SIZE=6]", 1, -1, 1) strMessage = Replace(strMessage, "", "[FONT=Arial]", 1, -1, 1) strMessage = Replace(strMessage, "", "[FONT=Courier]", 1, -1, 1) strMessage = Replace(strMessage, "", "[FONT=Times]", 1, -1, 1) strMessage = Replace(strMessage, "", "[FONT=Verdana]", 1, -1, 1) 'Loop through the message till all or any IMAGE links are converted back into codes Do While InStr(1, strMessage, " 0 'Find the start position in the image tag lngStartPos = InStr(1, strMessage, "", 1) + 3 'Make sure the end position is not in error If lngEndPos - lngStartPos =< 10 Then lngEndPos = lngStartPos + 10 'Read in the code to be converted back into the forum codes strMessageLink = Trim(Mid(strMessage, lngStartPos, (lngEndPos - lngStartPos))) 'Place the image tag into the tempoary message variable strTempMessage = strMessageLink 'Format the HTML image tag back into forum codes strTempMessage = Replace(strTempMessage, "src=""", "", 1, -1, 1) strTempMessage = Replace(strTempMessage, "", "[/IMG]", 1, -1, 1) 'Place the new fromatted codes into the message string body strMessage = Replace(strMessage, strMessageLink, strTempMessage, 1, -1, 1) Loop 'Loop through the message till all or any HTML email links are converted back into codes Do While InStr(1, strMessage, " 0 AND InStr(1, strMessage, "", 1) > 0 'Find the start position in the message of the HTML e-mail mailto tag lngStartPos = InStr(1, strMessage, " closing code lngEndPos = InStr(lngStartPos, strMessage, "", 1) + 4 'Make sure the end position is not in error If lngEndPos - lngStartPos =< 16 Then lngEndPos = lngStartPos + 16 'Read in the code to be converted back into the forum codes strMessageLink = Trim(Mid(strMessage, lngStartPos, (lngEndPos - lngStartPos))) 'Place the message link into the tempoary message variable strTempMessage = strMessageLink 'Format the HTML mailto link back into forum codes strTempMessage = Replace(strTempMessage, "", "[/EMAIL]", 1, -1, 1) strTempMessage = Replace(strTempMessage, """>", "]", 1, -1, 1) 'Place the new fromatted codes into the message string body strMessage = Replace(strMessage, strMessageLink, strTempMessage, 1, -1, 1) Loop 'Loop through the message till all or any hyperlinks are turned into back into froum codes Do While InStr(1, strMessage, " 0 AND InStr(1, strMessage, "", 1) > 0 'Find the start position in the message of the HTML hyperlink lngStartPos = InStr(1, strMessage, " closing code lngEndPos = InStr(lngStartPos, strMessage, "", 1) + 4 'Make sure the end position is not in error If lngEndPos - lngStartPos =< 9 Then lngEndPos = lngStartPos + 9 'Read in the code to be converted back into forum codes from the message strMessageLink = Trim(Mid(strMessage, lngStartPos, (lngEndPos - lngStartPos))) 'Place the message link into the tempoary message variable strTempMessage = strMessageLink 'Format the HTML hyperlink back into forum codes strTempMessage = Replace(strTempMessage, "", "[/URL]", 1, -1, 1) strTempMessage = Replace(strTempMessage, """>", "]", 1, -1, 1) 'Place the new fromatted codes into the message string body strMessage = Replace(strMessage, strMessageLink, strTempMessage, 1, -1, 1) Loop 'Loop through the message till all font colour tags are converted back to forum codes Do While InStr(1, strMessage, "", 1) > 0 'Find the start position in the message of the HTML colour tag lngStartPos = InStr(1, strMessage, "", 1) + 8 'Make sure the end position is not in error If lngEndPos - lngStartPos =< 12 Then lngEndPos = lngStartPos + 12 'Read in the code to be converted back into the forum codes strMessageLink = Trim(Mid(strMessage, lngStartPos, (lngEndPos - lngStartPos))) 'Place the message link into the tempoary message variable strTempMessage = strMessageLink 'Format the HTML colour tag back into forum codes strTempMessage = Replace(strTempMessage, "", "[/COLOR]", 1, -1, 1) strTempMessage = Replace(strTempMessage, ">", "]", 1, -1, 1) 'Place the new fromatted codes into the message string body strMessage = Replace(strMessage, strMessageLink, strTempMessage, 1, -1, 1) Loop 'Turn any left over font tages to forum codes strMessage = Replace(strMessage, "", "[/FONT]", 1, -1, 1) 'Turn the HTML back into the charcaters entred by the user strMessage = Replace(strMessage, "<", "<", 1, -1, 1) strMessage = Replace(strMessage, ">", ">", 1, -1, 1) strMessage = Replace(strMessage, "       ", " ", 1, -1, 1) strMessage = Replace(strMessage, "      ", " ", 1, -1, 1) strMessage = Replace(strMessage, "     ", " ", 1, -1, 1) strMessage = Replace(strMessage, "    ", " ", 1, -1, 1) strMessage = Replace(strMessage, "   ", " ", 1, -1, 1) strMessage = Replace(strMessage, "     ", vbTab, 1, -1, 1) strMessage = Replace(strMessage, Chr(10), "", 1, -1, 1) 'Return function EditPostConvertion = strMessage End Function '****************************************** '*** Remove Post Editor Text Function ***** '****************************************** 'Format Post Function to covert forum codes to HTML Private Function removeEditorAuthor(ByVal strMessage) Dim lngStartPos Dim lngEndPos 'Get the start and end position in the string of the XML to remove lngStartPos = InStr(1, strMessage, "", 1) lngEndPos = InStr(1, strMessage, "", 1) + 9 If lngEndPos - lngStartPos =< 8 Then lngEndPos = lngStartPos + 9 'If there is something returned strip the XML from the message removeEditorAuthor = Replace(strMessage, Trim(Mid(strMessage, lngStartPos, lngEndPos-lngStartPos)), "", 1, -1, 1) End Function %>