Okay, in short.
To the function FormatStr, add this line: fString = ReplaceSkyDriveTags(fString)
Old codeif strAllowForumCode = "1" then
fString = extratags(fString)
end if
New codeif strAllowForumCode = "1" then
fString = extratags(fString)
fString = ReplaceSkyDriveTags(fString)
end if
The function itself, also to be added to inc_func_common.asp:
Function ReplaceSkyDriveTags(fString)
Dim oTag, cTag
Dim roTag, rcTag
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 2
Dim CodeTags(2,2,2)
Dim strArray, strArray2
CodeTags(1,1,1) = "[skydrive]"
CodeTags(1,2,1) = "[/skydrive]"
'function EmbedFLV(URL, width, height, menu, quality, bg, bg2, nav, fcolor, bcolor, lcolor, autostart)
'only url is entered in the post, the rest is up to us
CodeTags(1,1,2) = "<div><iframe scrolling=""no"" marginheight=""0"" marginwidth=""0"" frameborder=""0"" style=""width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;"" src="""
CodeTags(1,2,2) = """></iframe></div>"
CodeTags(2,1,1) = "[SKYDRIVE]"
CodeTags(2,2,1) = "[/SKYDRIVE]"
CodeTags(2,1,2) = CodeTags(1,1,2)
CodeTags(2,2,2) = CodeTags(1,2,2)
strResultString = ""
strTempString = fString
for counter1 = 1 to TagCount
oTag = CodeTags(counter1,1,1)
roTag = CodeTags(counter1,1,2)
cTag = CodeTags(counter1,2,1)
rcTag = CodeTags(counter1,2,2)
oTagPos = InStr(1, strTempString, oTag, 1)
cTagPos = InStr(1, strTempString, cTag, 1)
if (oTagpos > 0) and (cTagPos > 0) then
strArray = Split(strTempString, oTag, -1)
for counter2 = 0 to Ubound(strArray)
if (Instr(1, strArray(counter2), cTag) > 0) then
strArray2 = split(strArray(counter2), cTag, -1)
strCodeText = trim(strArray2(0))
if lcase(left(strCodeText,7)) <> "http://" then 'embed code used
strCodeText= mid(strCodeText, instr(strCodeText,"http://"), (instr(strCodeText,"""></iframe")-instr(strCodeText,"http://")))
end if
strCodeText = replace(strCodeText, "/self.aspx/","/embedrowdetail.aspx/")
strCodeText = replace(strCodeText, "/embedgrid.aspx/","/embedrowdetail.aspx/")
if instr(strCodeText,"/embedrow.aspx/") > 0 then
roTag = Replace(roTag, "height:66px;","height:26px;")
end if
if instr(strCodeText,",") > 0 or _
instr(strCodeText,")") >0 or _
instr(strCodeText,"(") >0 or _
instr(strCodeText,";") >0 or _
instr(strCodeText,"""") >0 or _
instr(strCodeText,"<") >0 or _
instr(strCodeText,">") >0 or _
instr(strCodeText,"[") >0 or _
instr(strCodeText,"]") >0 or _
instr(strCodeText,",") >0 then
strCodeText = "illegal"
end if
strResultString = strResultString & roTag & strCodeText & rcTag & strArray2(1)
else
strResultString = strResultString & strArray(counter2)
end if
next
strTempString = strResultString
strResultString = ""
end if
next
ReplaceSkyDriveTags = strTempString
end function
The modification to the function ChkURLs in inc_func_common.asp, to prevent the urls between the tags from being handled:
old code:
(UCase(Right(strArray(Counter-1), 5)) <> "[IMG]") and _
(UCase(Right(strArray(Counter-1), 5)) <> "[URL]") and _
New code:
(UCase(Right(strArray(Counter-1), 5)) <> "[IMG]") and _
(UCase(Right(strArray(Counter-1), 10)) <> "[SKYDRIVE]") and _
(UCase(Right(strArray(Counter-1), 5)) <> "[URL]") and _
That should be it.
The function itself needs to have some checks in it to make sure only a valid Skydrive.live.com URL is entered.
I'll work on that this weekend.
<