<% 'Copyright (C) 2004-2007 Canol Gökel ' 'This program is free software; you can redistribute it and/or 'modify it under the terms of the GNU General Public License 'as published by the Free Software Foundation; either version 2 'of the License, or (at your option) any later version. ' 'All copyright notices regarding iyzi Forum must remain intact in 'the scripts and in the outputted HTML. ' 'The "iyzi Forum" text with a link back to http://www.iyziforum.com 'in the footer of the pages MUST remain visible when the pages 'are viewed on the internet or intranet. ' 'This program is distributed in the hope that it will be useful, 'but WITHOUT ANY WARRANTY; without even the implied warranty of 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 'GNU General Public License for more details. ' 'You should have received a copy of the GNU General Public License 'along with this program; if not, write to the Free Software 'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ' 'Support can be obtained from my web site at: 'http://www.iyziforum.com ' 'E-Mail: canol@canol.info Function AutoCode(PostID, Text, HTMLEnabled, iyziCodeEnabled, AutoLink, SmiliesEnabled) NewText = " " & Text If HTMLEnabled = "0" Then NewText = Replace(NewText, "&", "&") NewText = Replace(NewText, "<", "<") NewText = Replace(NewText, ">", ">") End If If AutoLink = "1" Then Dim LinkTags(2) LinkTags(0) = "http://" LinkTags(1) = "https://" LinkTags(2) = "ftp://" For i = 0 to UBound(LinkTags) If InStr(NewText, " " & LinkTags(i)) <> 0 or InStr(NewText, vbcrlf & LinkTags(i)) <> 0 Then Do While Not InStr(NewText, " " & LinkTags(i)) = 0 or Not InStr(NewText, vbcrlf & LinkTags(i)) = 0 If InStr(NewText, " " & LinkTags(i)) <> 0 Then NewTextPart1 = Mid(NewText, 1, InStr(NewText, " " & LinkTags(i))) NewTextPart2 = Mid(NewText, InStr(NewText, " " & LinkTags(i)) + 1, Len(NewText) - (InStr(NewText, " " & LinkTags(i)))) TagEndOfLink = InStr(NewTextPart2," ") If (InStr(NewTextPart2,vbcrlf) < TagEndOfLink and Not InStr(NewTextPart2, vbcrlf) = 0) or TagEndOfLink = 0 Then TagEndOfLink = InStr(NewTextPart2, vbcrlf) End If If TagEndOfLink = 0 Then TagEndOfLink = Len(NewTextPart2) + 1 End If NewTextPart3 = Mid(NewTextPart2, TagEndOfLink, Len(NewTextPart2) - (TagEndOfLink - 1)) Address = Left(NewTextPart2, TagEndOfLink - 1) VisiblePart = Address If Len(Address) > 60 Then VisiblePart = Left(Address, 40) & "....." & Right(Address, 13) End If NewText = NewTextPart1&"" & VisiblePart & "" & NewTextPart3 ElseIf InStr(NewText, vbcrlf & LinkTags(i)) <> 0 Then NewTextPart1 = Mid(NewText, 1, InStr(NewText, vbcrlf & LinkTags(i)) + 1) NewTextPart2 = Mid(NewText, InStr(NewText, vbcrlf & LinkTags(i)) + 2, Len(NewText) - (InStr(NewText, vbcrlf & LinkTags(i)))) TagEndOfLink = InStr(NewTextPart2, " ") If (InStr(NewTextPart2, vbcrlf) < TagEndOfLink and Not InStr(NewTextPart2, vbcrlf) = 0) or TagEndOfLink = 0 Then TagEndOfLink = InStr(NewTextPart2, vbcrlf) End If If TagEndOfLink = 0 Then TagEndOfLink = Len(NewTextPart2) + 1 End If NewTextPart3 = Mid(NewTextPart2, TagEndOfLink, Len(NewTextPart2) - (TagEndOfLink - 1)) Address = Left(NewTextPart2, TagEndOfLink - 1) VisiblePart = Address If Len(Address) > 60 Then VisiblePart = Left(Address, 40) & "....." & Right(Address, 13) End If NewText = NewTextPart1 & "" & VisiblePart & "" & NewTextPart3 End If Loop End If Next End If If iyziCodeEnabled = "1" Then Do While InStr(NewText, "[code]") <> 0 NewTextPart1 = Left(NewText, InStr(NewText, "[code]") - 1) NewTextPart2 = Right(NewText, Len(NewText) - (Len(NewTextPart1) + 6)) TagEnd = InStr(NewTextPart2, "[/code]") Code = Left(NewTextPart2, TagEnd - 1) If HTMLEnabled = "1" Then Code = Replace(Code, "&", "&") Code = Replace(Code, "<", "<") Code = Replace(Code, ">", ">") End If Code = Replace(Code, "(", "(") Code = Replace(Code, ")", ")") Code = Replace(Code, "[", "[") Code = Replace(Code, "]", "]") NewTextPart3 = Right(NewTextPart2, Len(NewTextPart2) - TagEnd - 6) LineCount = UBound(Split(Code, vbcrlf)) + 1 If LineCount > 25 Then NewText = NewTextPart1 & "
" & Code & "
" & NewTextPart3 Else NewText = NewTextPart1 & "
" & Code & "
" & NewTextPart3 End If Loop MainCode = "[url={ValuePart}]{VisiblePart}[/url]" Pattern = "{VisiblePart}" BeforeValuePart = "[url=" MiddleTagEnd = "]" AfterVisiblePart = "[/url]" Do While InStr(NewText, BeforeValuePart) <> 0 and InStr(NewText, MiddleTagEnd) <> 0 and InStr(NewText, AfterVisiblePart) <> 0 Value = "" VisiblePart = "" TextAfterVisiblePart = InStr(NewText, AfterVisiblePart) TextPart3 = Right(NewText, Len(NewText) - (TextAfterVisiblePart + (Len(AfterVisiblePart) - 1))) TextPart2 = Left(NewText, Len(NewText) - Len(TextPart3)) TextBeforeValuePart = InStrRev(TextPart2, BeforeValuePart) TextPart1 = Left(TextPart2, TextBeforeValuePart - 1) TextPart2 = Right(TextPart2, Len(TextPart2) - Len(TextPart1)) TextPart2 = Replace(TextPart2, AfterVisiblePart, "") If InStr(TextPart2, BeforeValuePart & """") <> 0 and InStr(TextPart2, """" & MiddleTagEnd) <> 0 Then TextPart2 = Replace(TextPart2, BeforeValuePart & """", "") Seperate = Split(TextPart2, """" & MiddleTagEnd) Value = Seperate(0) For t = 1 to UBound(Seperate) VisiblePart = VisiblePart & Seperate(t) If t < UBound(Seperate) Then VisiblePart = VisiblePart & """" & MiddleTagEnd End If Next Else TextPart2 = Replace(TextPart2, BeforeValuePart, "") Seperate = Split(TextPart2, MiddleTagEnd) Value = Seperate(0) For t = 1 to UBound(Seperate) VisiblePart = VisiblePart & Seperate(t) If t < UBound(Seperate) Then VisiblePart = VisiblePart & MiddleTagEnd End If Next End If FinalPattern = Replace(Pattern, "{ValuePart}", Value) FinalPattern = Replace(FinalPattern, "{VisiblePart}", VisiblePart) NewText = TextPart1 & FinalPattern & TextPart3 Loop MainCode = "[image]{ValuePart}[/image]" Pattern = "" BeforeValuePart = "[image]" AfterValuePart = "[/image]" Do While InStr(NewText, BeforeValuePart) <> 0 and InStr(NewText, AfterValuePart) <> 0 Value = "" TextAfterValuePart = InStr(NewText, AfterValuePart) TextPart2 = Right(NewText, Len(NewText) - (TextAfterValuePart + (Len(AfterValuePart) - 1))) TextBeforeValuePart = InStr(NewText, BeforeValuePart) TextPart1 = Left(NewText, TextBeforeValuePart - 1) Value = Mid(NewText, TextBeforeValuePart + Len(BeforeValuePart), Len(NewText) - Len(TextPart1) - Len(TextPart2) - Len(BeforeValuePart) - Len(AfterValuePart)) FinalPattern = Replace(Pattern, "{ValuePart}", Value) NewText = TextPart1 & FinalPattern & TextPart2 Loop 'MainCode = "[sample_code]{ValuePart}[/sample_code]" 'Pattern = "" 'BeforeValuePart = "[sample_code]" 'AfterValuePart = "[/sample_code]" 'Do While InStr(NewText, BeforeValuePart) <> 0 and InStr(NewText, AfterValuePart) <> 0 ' Value = "" ' TextAfterValuePart = InStr(NewText, AfterValuePart) ' TextPart2 = Right(NewText, Len(NewText) - (TextAfterValuePart + (Len(AfterValuePart) - 1))) ' TextBeforeValuePart = InStr(NewText, BeforeValuePart) ' TextPart1 = Left(NewText, TextBeforeValuePart - 1) ' Value = Mid(NewText, TextBeforeValuePart + Len(BeforeValuePart), Len(NewText) - Len(TextPart1) - Len(TextPart2) - Len(BeforeValuePart) - Len(AfterValuePart)) ' FinalPattern = Replace(Pattern, "{ValuePart}", Value) ' NewText = TextPart1 & FinalPattern & TextPart2 'Loop NewText = Replace(NewText, "[b]", "") NewText = Replace(NewText, "[/b]", "") NewText = Replace(NewText, "[i]", "") NewText = Replace(NewText, "[/i]", "") NewText = Replace(NewText, "[u]", "") NewText = Replace(NewText, "[/u]", "") NewText = Replace(NewText, "[center]", "
") NewText = Replace(NewText, "[/center]", "
") End If If SmiliesEnabled = "1" Then SQL = "Select * From iyzi_" & AdditionalTableWord & "Smilies" Set Smilies = Connection.Execute(SQL) Do While Not Smilies.Eof SmileyCodes = Split(Smilies("Code"),"||") For Each Code in SmileyCodes NewText = Replace(NewText, Code, "") Next Smilies.MoveNext Loop Smilies.Close Set Smilies = Nothing End If NewText = Replace(NewText, vbcrlf, "
") AutoCode = NewText End Function %>