-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathte_config.asp
303 lines (257 loc) · 10.2 KB
/
te_config.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!--#include file="te_includes.asp"-->
<%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_config.asp
' Description: Configuration File for TableEditoR
' Initiated By Hakan Eskici on Nov 01, 2000
'--------------------------------------------------------------
' 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:
'--------------------------------------------------------------
' # Nov 16, 2000 by Kevin Yochum
' Added switches for converting null values
' # Mar 31, 2001 by Hakan Eskici
' Changed defining connections
' Added support for SQL Server, DSN and DirectConnections
' # April 22, 2002 by Rami Kattan
' Configurations & Database defenition in the teadmin.mdb database
' this file loads all database definitions and configurations
' # May 11, 2002 by Hakan Eskici
' Modified recordcount calculation
' # May 14, 2002 by Rami Kattan
' Browser check if can execute javascipts
' # May 30, 2002 by Rami Kattan
' Added option for default Per Page value.
' Option for high security login
' Response.buffer enabled in some pages for better performance
' User permissions for databases using user/database leveling
' # Jun 3, 2002 by Rami Kattan
' Two new config options in database loaded here
'==============================================================
sScript = lcase(Request.ServerVariables("SCRIPT_NAME"))
if instr(sScript, "te_xml") or instr(sScript, "te_readdb") or instr(sScript, "te_excel") then
response.buffer = true
else
response.buffer = false
end if
Server.ScriptTimeout = 120
'--[»]--- Define Main Table Editor Connection ---------------------
' Table Editor Administration db.
' >>>>>>>>>>>>>>>>>>>>>> CHECK THIS NOTE <<<<<<<<<<<<<<<<<<<<<<<<<<<
' NOTE: teadmin.mdb Should be placed in a folder with WRITE permission.
' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
te_arrDBs = "teadmin.mdb;"
TempPath = "/public"
' -->> That's all, go to the application via web, login, and then
' make the other configuration.
' -->> Default login is: admin/admin
'------------------------------------------------------------------
'Different Connection Types
const tedbAccess = 1
const tedbSQLServer = 2
const tedbDsn = 3
const tedbConnStr = 4
aParams = split(te_arrDBs, ";")
sDBName = Server.MapPath(trim(aParams(0)))
if ubound(aParams) > 0 then
sPassword = trim(aParams(1))
end if
te_arrConn = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Persist Security Info=False;" &_
"Data Source=" & sDBName & ";" & _
"Jet OLEDB:Database Password=" & sPassword & ";"
OpenRS2 te_arrConn
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Under Experiments, not enabled till v0.8 is finished and 0.8.1 begins
' Permissions section: I added a new session variable, session("rConnectionViews").
' Default value is "0", which means users can view all of the connections.
' Admin sets the value for each user, the higher the value, the more
' restrictive (I.e., a user-session value of "2" only allows the user to view connections
' with a value greater than or equal to 2).
'
' It works opposite for the DB_view value assigned to each connection in the "Databases" table
' in teadmin.mdb. The lower the value, the more restrictive the connection
' (I.e., if arrConn(1)'s DB_view value is set to "0", then users
' with a session("rTableViews") of "1" or greater cannot view it.
if session("rConnectionViews") = "" then
rConnectionViews = "0"
else
rConnectionViews = session("rConnectionViews")
end if
' One more addition below.
PrivWhere = " WHERE DB_privileges >=" & rConnectionViews
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By Pete Stucke ~~~~~~~~~~~~~~~~~~
dim iTotalConnections
' Added by Hakan on May 11, 2002
' Get the count via sql in case the recordset cannot read recordcount
strSql = "SELECT COUNT(ID) AS Total FROM Databases" & PrivWhere
rs2.open strSql,,,adCmdTable
iTotalConnections = CDbl(rs2("Total"))
rs2.close
strSql = "SELECT * FROM Databases" & PrivWhere & " ORDER BY DB_Desc"
rs2.open strSql,,,adCmdTable
'Using Redim causes a performance degredation
'But it's OK since array size is small
redim arrDbs(iTotalConnections)
redim arrDesc(iTotalConnections)
redim arrType(iTotalConnections)
redim arrConn(iTotalConnections)
arrType(0) = tedbAccess
arrDBs(0) = te_arrDBs 'reget TableEditoR user administration db
arrDesc(0) = "Table Editor Administration"
aParams = split(arrDBs(0), ";")
sDBName = Server.MapPath(trim(aParams(0)))
if ubound(aParams) > 0 then
sPassword = trim(aParams(1))
end if
arrConn(0) = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Persist Security Info=False;" &_
"Data Source=" & sDBName & ";" & _
"Jet OLEDB:Database Password=" & sPassword & ";"
'Construct connection strings
for iConnection = 1 to iTotalConnections
arrType(iConnection) = rs2.Fields("DB_type")
arrDBs (iConnection) = rs2.Fields("DB_loc")
arrDesc(iConnection) = rs2.Fields("DB_Desc")
sDBName = ""
sComputerName = ""
sUserName = ""
sPassword = ""
select case arrType(iConnection)
case tedbAccess
'Access
aParams = split(arrDBs(iConnection), ";")
sDBName = Server.MapPath(trim(aParams(0)))
if ubound(aParams) > 0 then
sPassword = trim(aParams(1))
end if
arrConn(iConnection) = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Persist Security Info=False;" &_
"Data Source=" & sDBName & ";" & _
"Jet OLEDB:Database Password=" & sPassword & ";"
case tedbSQLServer
'SQL Server
aParams = split(arrDBs(iConnection), ";")
if isArray(aParams) then
sDBName = trim(aParams(0))
sComputerName = trim(aParams(1))
sUserName = trim(aParams(2))
sPassword = trim(aParams(3))
end if
arrConn(iConnection) = "Provider=SqlOLEDB;Network Library=DBMSSOCN;" & _
"Data Source=" & sComputerNAme & ";" &_
"Initial Catalog=" & sDBName & ";" & _
"User Id=" & sUserName & ";" &_
"Password=" & sPassword & ";"
case tedbDsn
'Data Source Name
arrConn(iConnection) = "dsn=" & arrDBs(iConnection)
case tedbConnStr
'Direct connection string
arrConn(iConnection) = arrDBs(iConnection)
end select
rs2.movenext
next
CloseRS2
OpenRS2 arrConn(0)
strSql = "SELECT * FROM config WHERE id = " & 1
rs2.open strSql,,,adCmdTable
'Encode HTML tags?
'Turn this on if you have problems with displaying
'records with html content.
dim bEncodeHTML
bEncodeHTML = rs2.Fields("EncodeHTML")
'Maximum number of chars to display in table view (0 : no limit)
'Warning: If you have HTML content in your fields;
'you should set bEncodeHTML to True if you specify a limit
dim lMaxShowLen
lMaxShowLen = rs2.Fields("MaxShowLen")
'Show Related Table Contents as ComboBoxes for foreign key fields?
dim Relation
Relation = rs2.Fields("Relation")
'Show connection details? (Number of tables, views and procs)
'This requires all connections to be opened, so te_admin.asp will run slow
dim bShowConnDetails
bShowConnDetails = rs2.Fields("ShowConnDetails")
'Should blank fields be converted to NULL when the field is nullable?
'Convert '' to null in non-numeric and non-date fields?
dim bConvertNull
bConvertNull = rs2.Fields("ConvertNull")
'Convert '' and 0 to null in numeric fields?
dim bConvertNumericNull
bConvertNumericNull = rs2.Fields("ConvertNumericNull")
'Convert '' and 0 to null in date fields?
dim bConvertDateNull
bConvertDateNull = rs2.Fields("ConvertDateNull")
'enable/disable the table highlight?
dim bTableHighlight
bTableHighlight = rs2.Fields("HighLight")
'enable/disable the MultiDelete buttons?
dim bBulkDelete
bBulkDelete = rs2.Fields("BulkDelete")
'enable/disable the export to Excel button?
dim bExportExcel
bExportExcel = rs2.Fields("ExportExcel")
'enable/disable the export to XML button?
dim bExportXML
bExportXML = rs2.Fields("ExportXML")
XMLExportSchema = true
'enable/disable the Bulk compact (admin only)?
dim bBulkCompact
bBulkCompact = rs2.Fields("BulkCompact")
'enable/disable Active Users Logging?
dim bActiveUsers
bActiveUsers = rs2.Fields("CountActiveUsers")
'enable/disable the Dynamic Page Selectors?
dim bPageSelector
bPageSelector = rs2.Fields("PageSelector")
iPageSelectorMax = 25
' values: 5, 10, 15, 20, 30, 40 or 0 for all
dim iDefaultPerPage
iDefaultPerPage = rs2.Fields("DefaultPerPage")
'enable/disable view databases-tables as combo?
dim bComboTables
bComboTables = rs2.Fields("ComboTables")
dim bPopUps
bPopUps = rs2.Fields("PopUps")
'enable/disable the new interface for IE4+ (only work with IE)?
dim bIEAdvancedMode
bIEAdvancedMode = rs2.Fields("IEAdvancedMode")
'enable/disable the Higher security login?
dim RequireSecurityID
RequireSecurityID = rs2.Fields("HighSecurityLogin")
CloseRS2
bJSEnable = session("JavaScriptEnabled")
' ----------- EXPERIMENTAL FEATURES ----------------
' No support still for them, not recommended to enable
bRequiredField = false ' enable/disable required field notice [*] (beta testing, wrong results sometimes)?
ConvertURL = false ' convert unclickable urls into clickable urls
bUserLogging = false ' Log logins.
bSQLBuilder = false ' SQL builder for queries
bAllowImport = false ' Allow XML import (Under Development)
te_debug = false 'leave false, true only for debugging
' --------------------------------------------------
if bPopUps and not bJSEnable then bPopUps = false
' BrowserCompat
sU = ucase(Request.ServerVariables("HTTP_USER_AGENT"))
isOp = instr(sU, "OPERA") > 0
isIE = instr(sU, "MSIE") > 0 AND not isOp
isNS = instr(sU, "NETSCAPE") > 0 AND not isOp
isKo = instr(sU, "KONQ") > 0
if isIE AND bIEAdvancedMode AND bJSEnable then
TableViewerCompat = "te_showtable.asp"
else
TableViewerCompat = "te_showtable2.asp"
end if
%>