%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_functions.asp
' Description: function for TableEditor
' Initiated By Rami Kattan on May 31, 2002
'--------------------------------------------------------------
' Copyright (c) 2002, 2eNetWorX/dev.
'
' TableEditoR is distributed with General Public License.
' Any derivatives of this software must remain OpenSource and
' must be distributed at no charge.
' (See license.txt for additional information)
'
' See Credits.txt for the list of contributors.
'
' Change Log:
'--------------------------------------------------------------
'==============================================================
sub allTablesCombo() 'Database Selector
if bComboTables and bJSEnable then
iCID = cint(request("cid"))
response.write ""
else
response.write "" & arrDesc(request("cid")) & ""
end if
end sub
sub allTablesCombo2(lConnID) 'Table Selector
if bComboTables and bJSEnable then
conn.Open arrConn(lConnID)
set rs = conn.OpenSchema(adSchemaTables)
response.write ""
rs.close
conn.close
else
response.write sTableName
end if
end sub
Sub isPerPage(InValue, ThisValue)
if cint(InValue) = cint(ThisValue) then Response.Write " Selected"
End sub
function isSelected(InValue, ThisValue)
if cint(InValue) = cint(ThisValue) then isSelected = " Selected"
end function
function MakeURL(Data)
UrlData = Data
if ConvertURL then
UrlData = edit_hrefs(UrlData, 1)
UrlData = edit_hrefs(UrlData, 2)
'UrlData = edit_hrefs(UrlData, 3)
UrlData = edit_hrefs(UrlData, 4)
UrlData = edit_hrefs(UrlData, 5)
UrlData = edit_hrefs(UrlData, 6)
end if
MakeURL = UrlData
end function
function SQLEncode(strTheText)
SQLEncode = "'" & Replace (strTheText, "'", "''" ) & "'"
end function
function GetRandomChars(width)
Randomize
data = ""
while len(data) < width
data = data & chr(Int((80 * Rnd) + 47))
wend
GetRandomChars = data
end function
function GetSecurityID(ForAction)
session("TableEditor_" & ForAction) = GetRandomChars(6) & right(Session.SessionID,4) & GetRandomChars(6)
GetSecurityID = session("TableEditor_" & ForAction)
end function
function ValidSecurityID(ForAction, SecID)
if session("TableEditor_" & ForAction) = SecID then
ValidSecurityID = true
else
ValidSecurityID = false
end if
end function
function FormatXML(data)
if isNumeric(left(data,1)) then
data = FormatNumericXML(data)
end if
data = replace(data, "?", "_x003F_")
data = replace(data, " ", "_x0020_")
data = replace(data, "/", "_x002F_")
data = replace(data, "=", "_x003D_")
data = replace(data, "%", "_x0025_")
slash = "\"
data = replace(data, slash, "_x005C_")
data = replace(data, "~", "_x007E_")
data = replace(data, "@", "_x0040_")
data = replace(data, "#", "_x0023_")
data = replace(data, "$", "_x0024_")
data = replace(data, "%", "_x0025_")
data = replace(data, "^", "_x005E_")
data = replace(data, "&", "_x0026_")
data = replace(data, "*", "_x002A_")
data = replace(data, "(", "_x0028_")
data = replace(data, ")", "_x0029_")
data = replace(data, "+", "_x002B_")
data = replace(data, "{", "_x007B_")
data = replace(data, "}", "_x007D_")
data = replace(data, "|", "_x007C_")
data = replace(data, "'", "_x0027_")
data = replace(data, "<", "_x003C_")
data = replace(data, ">", "_x003E_")
data = replace(data, ",", "_x002C_")
data = replace(data, ";", "_x003B_")
FormatXML = data
end function
function FormatNumericXML(data)
StrLeft = Left(data, 1)
StrRight = Right(data, (len(data) - 1))
ReturnValue = "_x003" & StrLeft & "_" & StrRight
FormatNumericXML = ReturnValue
end function
function FormatXMLRev(data)
if left(data,5) = "_x003" then
if isNumeric(mid(data,6,1)) then
data = mid(data,6,1) & right(data, len(data)-7)
end if
end if
data = replace(data, "_x003F_", "?")
data = replace(data, "_x0020_", " ")
data = replace(data, "_x002F_", "/")
data = replace(data, "_x003D_", "=")
data = replace(data, "_x0025_", "%")
slash = "\"
data = replace(data, "_x005C_", slash)
data = replace(data, "_x007E_", "~")
data = replace(data, "_x0040_", "@")
data = replace(data, "_x0023_", "#")
data = replace(data, "_x0024_", "$")
data = replace(data, "_x0025_", "%")
data = replace(data, "_x005E_", "^")
data = replace(data, "_x0026_", "&")
data = replace(data, "_x002A_", "*")
data = replace(data, "_x0028_", "(")
data = replace(data, "_x0029_", ")")
data = replace(data, "_x002B_", "+")
data = replace(data, "_x007B_", "{")
data = replace(data, "_x007D_", "}")
data = replace(data, "_x007C_", "|")
data = replace(data, "_x0027_", "'")
data = replace(data, "_x003C_", "<")
data = replace(data, "_x003E_", ">")
data = replace(data, "_x002C_", ",")
data = replace(data, "_x003B_", ";")
FormatXMLRev = data
end function
function DataNeedCDATA(data)
need = false
if instr(data, "<") then need = true
if instr(data, "&") then need = true
DataNeedCDATA = need
end function
function LeadingZero(data, numdigits)
while len(data) < numdigits
data = "0" & data
wend
LeadingZero = data
end function
function IsObjInstalled(strClassString)
Err.clear
set oTest2 = Server.CreateObject(strClassString)
if err = 0 then
IsObjectInstalled = true
else
err.Clear
IsObjectInstalled = false
end if
set oTest2 = nothing
IsObjInstalled = IsObjectInstalled
end function
%>