<%
class clTextFuncs
public function FolderName(byval p_sValue)
dim l_sFolderName : l_sFolderName = p_sValue
if l_sFolderName > "" then
dim RegEx
set RegEx = New RegExp
RegEx.Pattern = "[=\/:;*<>|_" & chr(20) & chr(34) & "]"
RegEx.Global = True
l_sFolderName = Replace(l_sFolderName,"-","~")
l_sFolderName = RegEx.replace(lcase(l_sFolderName), "-")
l_sFolderName = Replace(l_sFolderName,"'","")
l_sFolderName = Replace(l_sFolderName,"?","")
l_sFolderName = Replace(l_sFolderName," ","-")
l_sFolderName = Replace(l_sFolderName,"_","-")
l_sFolderName = replace(l_sFolderName,"&","and")
set regEx = nothing
FolderName = l_sFolderName
else
FolderName = ""
end if
end function
public function CheckFile(p_sFileName)
' Check that a file exists first
Dim objFSO, objTextFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
CheckFile = objFSO.FileExists(server.mappath(p_sFileName))
Set objFSO = Nothing
End function
public Sub StreamText(p_sFileName)
' read in a file and stream it out to the browser
Dim l_oFSO, l_oFSFile
Set l_oFSO = CreateObject("Scripting.FileSystemObject")
Set l_oFSFile = l_oFSO.OpenTextFile(Server.MapPath(p_sFileName))
do until l_oFSFile.AtEndOfStream
response.write (l_oFSFile.ReadLine) & vbCrLf
Loop
l_oFSFile.close
Set l_oFSFile = Nothing
Set l_oFSO = Nothing
End Sub
public function ReadTextFile(ByVal p_sFileName)
' read in a text file
' response.write p_sFileName
Dim l_oFSO, l_oFSFile
Set l_oFSO = CreateObject("Scripting.FileSystemObject")
Set l_oFSFile = l_oFSO.OpenTextFile(Server.MapPath(p_sFileName))
ReadTextFile = l_oFSFile.ReadAll
l_oFSFile.close
Set l_oFSFile = Nothing
Set l_oFSO = Nothing
End function
public function stripQuotes(ByVal p_sIn)
stripQuotes = replace(p_sIn, "'", "''")
'stripQuotes = StripChars(stripQuotes)
end function
'***********************************
public function StripChars(ByVal p_sIn)
dim l_asBlock
dim i
l_asBlock = array("select", "drop", ";", "--", "insert","delete", "xp_")
for i = lBound(l_asBlock) to uBound(l_asBlock)
p_sIn = replace(p_sIn, l_asBlock(i), "")
next
StripChars = p_sIn
end function
'*************************************
function CodeWrap(strIn, intWrapLen)
dim strOut
dim intLenStrIn
dim intCurrPos
dim intLineStart
dim intWrapPos
intLenStrIn = Len(strIn)
intCurrPos = 1
intLineStart = 1
do while intCurrPos < intLenStrIn
if mid(strIn, intCurrPos, 1) = " " then
intWrapPos = intCurrPos
end if
if intCurrPos = intLineStart + intWrapLen then
strOut = strOut & trim(mid(strIn,intLineStart,intWrapPos - intLineStart + 1)) & " _ " & vbCrLf & vbTab
intLineStart = intWrapPos + 1
do while mid(strIn, intLineStart, 1) = " "
intLineStart = intLineStart + 1
loop
end if
intCurrPos = intCurrPos + 1
loop
strOut = strOut & trim(mid(strIn,intLineStart)) & vbCrLf
CodeWrap = strOut
end function
public sub Class_Initialize()
end sub
private sub class_terminate()
end sub
end class
%>