Subversion Repositories DevTools

Rev

Rev 5514 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5514 Rev 6671
Line 1... Line 1...
1
<% @LANGUAGE = VBScript %>
1
<% @LANGUAGE = VBScript %>
2
<%
2
<%
3
'+----------------------------------------------------------------------------+
3
'+----------------------------------------------------------------------------+
4
'| Description:                                                               |
4
'| Description:                                                               |
5
'|    WikiAsp is a derivative of AspWiki, a wiki program written in ASP.      |
5
'|    WikiAsp is a derivative of AspWiki, a wiki program written in ASP.      |
6
'|    WikiAsp will run on Windows with IIS, MDAC v2.5. WikiAsp will           |
6
'|    WikiAsp will run on Windows with IIS, MDAC v2.5. WikiAsp will           |
7
'|    automatically create MS Access DB on first time use.                    |
7
'|    automatically create MS Access DB on first time use.                    |
8
'|                                                                            |
8
'|                                                                            |
9
'|    The following are the dlls to make mdb creation work.                   |
9
'|    The following are the dlls to make mdb creation work.                   |
10
'|    1. Program Files\Common Files\System\ado\msadox.dll                     |
10
'|    1. Program Files\Common Files\System\ado\msadox.dll                     |
11
'|    2. WINDOWS\System32\scrrun.dll                                          |
11
'|    2. WINDOWS\System32\scrrun.dll                                          |
12
'|                                                                            |
12
'|                                                                            |
13
'| Credits:                                                                   |
13
'| Credits:                                                                   |
14
'|    Elrey Ronald Velicaria. - Author of WikiAsp. (lambda326@hotmail.com)    |
14
'|    Elrey Ronald Velicaria. - Author of WikiAsp. (lambda326@hotmail.com)    |
15
'|    Dino Chiesa - AspWiki author.                                           |
15
'|    Dino Chiesa - AspWiki author.                                           |
16
'|    Contributors: Bjarne D, Julian Tosh                                     |
16
'|    Contributors: Bjarne D, Julian Tosh                                     |
17
'|                                                                            |
17
'|                                                                            |
18
'| Websites:                                                                  |
18
'| Websites:                                                                  |
19
'|    http://www.c2.com/cgi/wiki,  http://www.c2.com/cgi/wiki?WikiAsp         |
19
'|    http://www.c2.com/cgi/wiki,  http://www.c2.com/cgi/wiki?WikiAsp         |
20
'+----------------------------------------------------------------------------+
20
'+----------------------------------------------------------------------------+
21
'| Please retain the above credits on any future versions of this program     |
21
'| Please retain the above credits on any future versions of this program     |
22
'+----------------------------------------------------------------------------+
22
'+----------------------------------------------------------------------------+
23
 
23
 
24
Option Explicit
24
Option Explicit
25
Response.CacheControl  = "no-cache"
25
Response.CacheControl  = "no-cache"
26
Response.Expires       = -1
26
Response.Expires       = -1
27
Response.AddHeader "Pragma", "no-cache"
27
Response.AddHeader "Pragma", "no-cache"
28
 
28
 
29
Dim gDefaultIcon, gDefaultHomePage, gAutoCreateMdb, gFavIcon
29
Dim gDefaultIcon, gDefaultHomePage, gAutoCreateMdb, gFavIcon
30
Dim gHttpDomain , gDebug, gEngineVersion, gDbTableName
30
Dim gHttpDomain , gDebug, gEngineVersion, gDbTableName
31
Dim gProvider, gDataConn, gDataSource, gDataSourceName
31
Dim gProvider, gDataConn, gDataSource, gDataSourceName
32
Dim gDocRootDir, gDataSourceDir, gDataSourceFile, gSpaceNames
32
Dim gDocRootDir, gDataSourceDir, gDataSourceFile, gSpaceNames
33
Dim gScript, gScriptURL, giEditAreaRows, giEditAreaCols, giNumRecentFiles
33
Dim gScript, gScriptURL, giEditAreaRows, giEditAreaCols, giNumRecentFiles
34
Dim gHomeTopic, gStyleSheet, gIconName
34
Dim gHomeTopic, gStyleSheet, gIconName
35
Dim glsTopic, glsMode  , gHideLastEditor,  gLoginFlag, gRemoveHtml,gBlackListedIps
35
Dim glsTopic, glsTopicClean, glsMode  , gHideLastEditor,  gLoginFlag, gRemoveHtml,gBlackListedIps
36
Dim gRE, gHighlightFlag, gHideWikiSource, gHideWikiFooter, gHideLogin, gHtmlHeadStr
36
Dim gRE, gHighlightFlag, gHideWikiSource, gHideWikiFooter, gHideLogin, gHtmlHeadStr
37
Dim gDisableSave,gTimeZoneOffset, gRssStyle, gRedirectURL
37
Dim gDisableSave,gTimeZoneOffset, gRssStyle, gRedirectURL
38
Dim gBannerTemplate, gWikiBodyPrefix, gHideTopSearch, gDisableScripting
38
Dim gBannerTemplate, gWikiBodyPrefix, gHideTopSearch, gDisableScripting
39
Dim gMdbExtension , gSearchLabel, gBlackListedIpsRE
39
Dim gMdbExtension , gSearchLabel, gBlackListedIpsRE
40
Dim gFooterHtml, gEnableEdit, gDevNotePrefix, gBulkDelete
40
Dim gFooterHtml, gEnableEdit, gDevNotePrefix, gBulkDelete
41
 
41
 
42
'+-----------------------------------------------------------------------------+
42
'+-----------------------------------------------------------------------------+
43
'| AN IMPORTANT NOTE:  !!!!!                                                   |
43
'| AN IMPORTANT NOTE:  !!!!!                                                   |
44
'| Enter your password below for creating new DB and for Delete.               |
44
'| Enter your password below for creating new DB and for Delete.               |
45
'| Enter your URL inside quotes below e.g. http://www28.brinkster.com/site     |
45
'| Enter your URL inside quotes below e.g. http://www28.brinkster.com/site     |
46
'| Modify gDefaultIcon, gDefaultHomePage here is FSO objects is not installed  |
46
'| Modify gDefaultIcon, gDefaultHomePage here is FSO objects is not installed  |
47
'+-----------------------------------------------------------------------------+
47
'+-----------------------------------------------------------------------------+
48
gAutoCreateMdb     =  true                            ' Create db automatically
48
gAutoCreateMdb     =  true                            ' Create db automatically
49
gDisableSave       =  false                           ' Set to true if you have to fully disable save.
49
gDisableSave       =  false                           ' Set to true if you have to fully disable save.
50
gBlackListedIps    =  ""                              ' List of IPs to reject. (Exact match 1st 3 digits of IP, delimit list by ~)
50
gBlackListedIps    =  ""                              ' List of IPs to reject. (Exact match 1st 3 digits of IP, delimit list by ~)
51
gBlackListedIpsRE  =  ""                              ' List of IPs to reject (Regular ExpressionMatch)
51
gBlackListedIpsRE  =  ""                              ' List of IPs to reject (Regular ExpressionMatch)
52
gRemoveHtml        =  false                           ' Set to true if  HTML input in wiki will be enabled.
52
gRemoveHtml        =  false                           ' Set to true if  HTML input in wiki will be enabled.
53
gLoginFlag         =  "log"                           ' The default enable login flag ( must be overriden by config.asp).
53
gLoginFlag         =  "log"                           ' The default enable login flag ( must be overriden by config.asp).
54
gHideWikiSource    =  false                           ' Allow viewing of unformatted wiki text when loggin in.
54
gHideWikiSource    =  false                           ' Allow viewing of unformatted wiki text when loggin in.
55
gHideWikiFooter    =  false                           ' Show or Hide the whole wiki footer
55
gHideWikiFooter    =  false                           ' Show or Hide the whole wiki footer
56
gHideLogin         =  false                           ' Enable/Disable double-click or Edit. This can be overriden by &log
56
gHideLogin         =  false                           ' Enable/Disable double-click or Edit. This can be overriden by &log
57
gHideLastEditor    =  false                           ' Show/Hide in  the footer the info about last edit
57
gHideLastEditor    =  false                           ' Show/Hide in  the footer the info about last edit
58
gHttpDomain        = "auto"                           ' URL for RSS links to work. Override in config.asp . Set to "" to remove rss footer links
58
gHttpDomain        = "auto"                           ' URL for RSS links to work. Override in config.asp . Set to "" to remove rss footer links
59
gDefaultIcon       = "icon"                           ' This default. Maybe overridden if your site has icon.gif, icon.jpg or xxxx.gif and if FSO is working.
59
gDefaultIcon       = "icon"                           ' This default. Maybe overridden if your site has icon.gif, icon.jpg or xxxx.gif and if FSO is working.
60
gDefaultHomePage   = "WikiAsp"                        ' modify your start page here. this may be overridden by .ini file. The .ini file is same dir as mdb file
60
gDefaultHomePage   = "WikiAsp"                        ' modify your start page here. this may be overridden by .ini file. The .ini file is same dir as mdb file
61
gDataSourceDir     = "db"                             ' MSAccess folder. this is normally `db`
61
gDataSourceDir     = "db"                             ' MSAccess folder. this is normally `db`
62
gDocRootDir        = ""                               ' physical absolute path of root (e.g. c:/dc2/mysite.com)  make it blank if `gDataSourceDir` is relative to wiki.asp
62
gDocRootDir        = ""                               ' physical absolute path of root (e.g. c:/dc2/mysite.com)  make it blank if `gDataSourceDir` is relative to wiki.asp
63
gTimeZoneOffset    = "-0400"                          ' Put your serverTimezone offset here. East Coast is -0400 .
63
gTimeZoneOffset    = "-0400"                          ' Put your serverTimezone offset here. East Coast is -0400 .
64
gRssStyle          = ""                               ' Example:  "<?xml-stylesheet type=""text/xsl"" href=""rss.xsl"" ?>"
64
gRssStyle          = ""                               ' Example:  "<?xml-stylesheet type=""text/xsl"" href=""rss.xsl"" ?>"
65
gRedirectURL       = ""
65
gRedirectURL       = ""
66
gMdbExtension      = ".mdb"
66
gMdbExtension      = ".mdb"
67
gBannerTemplate    = ""                               ' Banner html is now replaceable you need to remember $$icon$$, $$banner_text$$ variable though
67
gBannerTemplate    = ""                               ' Banner html is now replaceable you need to remember $$icon$$, $$banner_text$$ variable though
68
gWikiBodyPrefix    = ""
68
gWikiBodyPrefix    = ""
69
gHideTopSearch     = false
69
gHideTopSearch     = false
70
gDisableScripting  = true
70
gDisableScripting  = true
71
gSearchLabel       = " Search On:"
71
gSearchLabel       = " Search On:"
72
gFooterHtml        = "</body></html>"                 ' Now you can customize the footer with your chosen html. Even remove ads
72
gFooterHtml        = "</body></html>"                 ' Now you can customize the footer with your chosen html. Even remove ads
73
gEnableEdit        = false
73
gEnableEdit        = false
74
gDevNotePrefix     = "??"                             ' Dev Note Prefix
74
gDevNotePrefix     = "??"                             ' Dev Note Prefix
75
gBulkDelete        = false                            ' Bulk delete mode
75
gBulkDelete        = false                            ' Bulk delete mode
76
gFavIcon           = ""                               ' FavIcon
76
gFavIcon           = ""                               ' FavIcon
77
 
77
 
78
'+-----------------------------------------------------------------------------+
78
'+-----------------------------------------------------------------------------+
79
'| DO YOU WANT TO SEPARATE SOME CONFIG SETTINGS IN ANOTHER FILE?               |
79
'| DO YOU WANT TO SEPARATE SOME CONFIG SETTINGS IN ANOTHER FILE?               |
80
'+-----------------------------------------------------------------------------+
80
'+-----------------------------------------------------------------------------+
81
'| IF yes,just uncomment line after this box (by removing single quote as      |
81
'| IF yes,just uncomment line after this box (by removing single quote as      |
82
'| the first character. If you do this,  BE SURE TO CREATE config.asp          |
82
'| the first character. If you do this,  BE SURE TO CREATE config.asp          |
83
'| which will override the same variable settings above this box               |
83
'| which will override the same variable settings above this box               |
84
'+-----------------------------------------------------------------------------+
84
'+-----------------------------------------------------------------------------+
85
 
85
 
86
%><!--#include file="config.asp"--><%
86
%><!--#include file="config.asp"--><%
87
 
87
 
88
gDebug               = 0                             ' 0 - no debug message 1-6 for verbose debug
88
gDebug               = 0                             ' 0 - no debug message 1-6 for verbose debug
89
gEngineVersion       = "v1.6.4 beta  Elrey Ronald V."  ' Engine Version
89
gEngineVersion       = "v1.6.4 beta  Elrey Ronald V."  ' Engine Version
90
gScript              = "wiki.asp"                    ' Main ASP filename (this file)
90
gScript              = "wiki.asp"                    ' Main ASP filename (this file)
91
gProvider            = "Microsoft.Jet.OLEDB.4.0"     ' Db Provider
91
gProvider            = "Microsoft.Jet.OLEDB.4.0"     ' Db Provider
92
giEditAreaRows       = 30                            ' Edit Rows
92
giEditAreaRows       = 30                            ' Edit Rows
93
giEditAreaCols       = 115                           ' Edit Columns
93
giEditAreaCols       = 115                           ' Edit Columns
94
giNumRecentFiles     = 15                            ' No. of wikipages to list in Recent files page
94
giNumRecentFiles     = 15                            ' No. of wikipages to list in Recent files page
95
gDbTableName         = "WikiData"                    ' Table name in the database
95
gDbTableName         = "WikiData"                    ' Table name in the database
96
gSpaceNames          = 1                             ' 1 means put spaces in WikiNames, 0 - no spaces
96
gSpaceNames          = 1                             ' 1 means put spaces in WikiNames, 0 - no spaces
97
 
97
 
98
 
98
 
99
' Elrey 3/06  Now Override the gHttpDomain with this!!
99
' Elrey 3/06  Now Override the gHttpDomain with this!!
100
If gHttpDomain = "auto" Then
100
If gHttpDomain = "auto" Then
101
  gHttpDomain  = "http://" & Request.ServerVariables("HTTP_HOST") & _
101
  gHttpDomain  = "http://" & Request.ServerVariables("HTTP_HOST") & _
102
                 Replace(Request.ServerVariables("URL"), "/" & gScript, "" )
102
                 Replace(Request.ServerVariables("URL"), "/" & gScript, "" )
103
End If
103
End If
104
 
104
 
105
'check for database name
105
'check for database name
106
If len(request("db")) > 0 Then
106
If len(request("db")) > 0 Then
107
    gDataSourceFile = request("db")
107
    gDataSourceFile = request("db")
108
Else
108
Else
109
    gDataSourceFile = gDefaultHomePage
109
    gDataSourceFile = gDefaultHomePage
110
End If
110
End If
111
 
111
 
112
If len(gDocRootDir) > 0 Then
112
If len(gDocRootDir) > 0 Then
113
  gDataSource = gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & gMdbExtension 
113
  gDataSource = gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & gMdbExtension 
114
Else
114
Else
115
  gDataSource = gDataSourceDir & "\" & gDataSourceFile & gMdbExtension 
115
  gDataSource = gDataSourceDir & "\" & gDataSourceFile & gMdbExtension 
116
End If
116
End If
117
 
117
 
118
'check for database human-readable name
118
'check for database human-readable name
119
If len(request("dbname")) > 0 Then
119
If len(request("dbname")) > 0 Then
120
    gDataSourceName = request("dbname")
120
    gDataSourceName = request("dbname")
121
Else
121
Else
122
    gDataSourceName = "DefaultDb"
122
    gDataSourceName = "DefaultDb"
123
End If
123
End If
124
 
124
 
125
' Can only Edit on the Test / Development System not on the Live System
125
' Can only Edit on the Test / Development System not on the Live System
126
If (IsEmpty(Application("LiveSystem"))) Then
126
If (IsEmpty(Application("LiveSystem"))) Then
127
    gHideLogin = false
127
    gHideLogin = false
128
    If (Session("login") <> 0) Then
128
    If (Session("login") <> 0) Then
129
            gHideWikiFooter = false
129
            gHideWikiFooter = false
130
            gEnableEdit = true
130
            gEnableEdit = true
131
            Session("login") = 1
131
            Session("login") = 1
132
            If Session("BulkDelete") = 1 Then
132
            If Session("BulkDelete") = 1 Then
133
                gBulkDelete = true
133
                gBulkDelete = true
134
            Else
134
            Else
135
                gBulkDelete = false
135
                gBulkDelete = false
136
            End If
136
            End If
137
 
137
 
138
    End If
138
    End If
139
    gHideWikiFooter = NOT gEnableEdit
139
    gHideWikiFooter = NOT gEnableEdit
140
Else
140
Else
141
    gHideLogin = true
141
    gHideLogin = true
142
    gHideWikiFooter = true
142
    gHideWikiFooter = true
143
    gBulkDelete = false
143
    gBulkDelete = false
144
End If
144
End If
145
 
145
 
146
'set destination URL
146
'set destination URL
147
gScriptURL    = gScript & "?db=" & gDataSourceFile  ' removed & "&dbname=" & server.urlencode(gDataSourceName)
147
gScriptURL    = gScript & "?db=" & gDataSourceFile  ' removed & "&dbname=" & server.urlencode(gDataSourceName)
148
gHomeTopic    = gDataSourceFile  ' default home topic is the same as ms access db name unless overwritten by .ini
148
gHomeTopic    = gDataSourceFile  ' default home topic is the same as ms access db name unless overwritten by .ini
149
gStyleSheet   = "wiki.css"
149
gStyleSheet   = "wiki.css"
150
 
150
 
151
 
151
 
152
Call GetHomeTopic 'Get the topic from wiki.ini if it exists
152
Call GetHomeTopic 'Get the topic from wiki.ini if it exists
153
 
153
 
154
gIconName = gDefaultIcon
154
gIconName = gDefaultIcon
155
 
155
 
156
Call GetIconName   'Get the real icon name
156
Call GetIconName   'Get the real icon name
157
 
157
 
158
Dim rs, dts, i, sqlQuery
158
Dim rs, dts, i, sqlQuery
159
 
159
 
160
Const ADOERROR_NOFILE  = -2147467259  ' cannot find file (*.mdb)
160
Const ADOERROR_NOFILE  = -2147467259  ' cannot find file (*.mdb)
161
Const ADOERROR_NOTABLE = -2147217865  ' Cannot find output table
161
Const ADOERROR_NOTABLE = -2147217865  ' Cannot find output table
162
Const FOR_READING      = 1
162
Const FOR_READING      = 1
163
Const FOR_WRITING      = 2
163
Const FOR_WRITING      = 2
164
 
164
 
165
' Determine the action mode (edit/browse/save/list/search) or browse
165
' Determine the action mode (edit/browse/save/list/search) or browse
166
glsMode = ""
166
glsMode = ""
167
If Not isEmpty(request("a")) Then
167
If Not isEmpty(request("a")) Then
168
   glsMode = request("a")
168
   glsMode = request("a")
169
Else
169
Else
170
   glsMode = "browse"
170
   glsMode = "browse"
171
End If
171
End If
172
 
172
 
173
' Determine the topic otherwise use home topic.
173
' Determine the topic otherwise use home topic.
174
glsTopic = "WikiAsp"
174
' Provide a clean version for use in file systems
175
If Not isEmpty(request("o")) Then
175
'     glsTopicClean - Replace space with _
176
   glsTopic = request("o")
176
glsTopic = "WikiAsp"
177
Else
177
If Not isEmpty(request("o")) Then
178
   glsTopic = gHomeTopic
178
   glsTopic = request("o")
179
End If
179
Else
180
 
180
   glsTopic = gHomeTopic
181
' Determine if RSS contains highlighting or not
181
End If
182
If Not isEmpty(request("h")) then
182
glsTopicClean=replace(glsTopic, " ", "_" )
183
   gHighlightFlag = true
183
 
184
Else
184
 
185
   gHighlightFlag = false
185
' Determine if RSS contains highlighting or not
186
End If
186
If Not isEmpty(request("h")) then
187
 
187
   gHighlightFlag = true
188
' Initialize the Regular Expression object variable
188
Else
189
Set gRE=server.createobject("VBScript.Regexp")
189
   gHighlightFlag = false
190
gRE.IgnoreCase  = False
190
End If
191
gRE.Global      = True
191
 
192
 
192
' Initialize the Regular Expression object variable
193
dim httpReferer
193
Set gRE=server.createobject("VBScript.Regexp")
194
httpReferer= Request.ServerVariables("HTTP_REFERER")
194
gRE.IgnoreCase  = False
195
 
195
gRE.Global      = True
196
 
196
 
197
' Get remote addresses globally
197
dim httpReferer
198
dim remoteIPHost
198
httpReferer= Request.ServerVariables("HTTP_REFERER")
199
remoteIPHost = Request.ServerVariables("REMOTE_HOST")
199
 
200
 
200
 
201
dim remoteIPAddr
201
' Get remote addresses globally
202
remoteIPAddr = Request.ServerVariables("REMOTE_ADDR")
202
dim remoteIPHost
203
 
203
remoteIPHost = Request.ServerVariables("REMOTE_HOST")
204
If IsNull( remoteIPHost) Then
204
 
205
  remoteIPHost = "0.0.0.0"
205
dim remoteIPAddr
206
End If
206
remoteIPAddr = Request.ServerVariables("REMOTE_ADDR")
207
 
207
 
208
If IsNull( remoteIPHost) Then
208
If IsNull( remoteIPHost) Then
209
  remoteIPAddr = "0.0.0.0"
209
  remoteIPHost = "0.0.0.0"
210
End If
210
End If
211
 
211
 
212
'-- Let us get he IP first 3 numbers
212
If IsNull( remoteIPHost) Then
213
dim remoteIPHost3numbers
213
  remoteIPAddr = "0.0.0.0"
214
Dim DotPos 
214
End If
215
DotPos = InStrRev(remoteIPHost,".")
215
 
216
remoteIPHost3numbers= mid(remoteIPHost,1,DotPos)
216
'-- Let us get he IP first 3 numbers
217
 
217
dim remoteIPHost3numbers
218
'------------------------------------------------------------------------------------------------------------
218
Dim DotPos 
219
'                                        SUBROUTINES AND FUNCTIONS
219
DotPos = InStrRev(remoteIPHost,".")
220
'------------------------------------------------------------------------------------------------------------
220
remoteIPHost3numbers= mid(remoteIPHost,1,DotPos)
221
 
221
 
222
Sub GetHomeTopic
222
'------------------------------------------------------------------------------------------------------------
223
    '-----------------------------------------------------------------------
223
'                                        SUBROUTINES AND FUNCTIONS
224
    ' This looks for the Home Topic Name from the 1-line file wiki.ini file.
224
'------------------------------------------------------------------------------------------------------------
225
    '-----------------------------------------------------------------------
225
 
226
    Dim objFSO
226
Sub GetHomeTopic
227
    err.Clear
227
    '-----------------------------------------------------------------------
228
    On Error Resume Next
228
    ' This looks for the Home Topic Name from the 1-line file wiki.ini file.
229
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
229
    '-----------------------------------------------------------------------
230
    On Error GoTo 0
230
    Dim objFSO
231
    If Not IsObject(objFSO) Then
231
    err.Clear
232
        Exit Sub
232
    On Error Resume Next
233
    End If
233
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
234
 
234
    On Error GoTo 0
235
    'Open the ini file whch should be at same dir as access db file
235
    If Not IsObject(objFSO) Then
236
    Dim objTextStream
236
        Exit Sub
237
    Dim strIniFile
237
    End If
238
 
238
 
239
    if len(gDocRootDir) > 0 then
239
    'Open the ini file whch should be at same dir as access db file
240
       strIniFile= gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & ".ini"
240
    Dim objTextStream
241
    else
241
    Dim strIniFile
242
       strIniFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".ini")
242
 
243
    end if
243
    if len(gDocRootDir) > 0 then
244
 
244
       strIniFile= gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & ".ini"
245
    If objFSO.FileExists(strIniFile) Then
245
    else
246
        Set objTextStream = objFSO.OpenTextFile(strIniFile, FOR_READING)
246
       strIniFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".ini")
247
        gHomeTopic = objTextStream.ReadLine()
247
    end if
248
        objTextStream.Close
248
 
249
    End If
249
    If objFSO.FileExists(strIniFile) Then
250
 
250
        Set objTextStream = objFSO.OpenTextFile(strIniFile, FOR_READING)
251
    '
251
        gHomeTopic = objTextStream.ReadLine()
252
    ' Check For db specific style sheet if any. First look CSS at the roo
252
        objTextStream.Close
253
    ' If it is not there, look in the DB Folder.  If not again there don't
253
    End If
254
    ' Override the default  (which is Wiki.css).
254
 
255
    '
255
    '
256
    Dim strCss
256
    ' Check For db specific style sheet if any. First look CSS at the roo
257
    strCss= Server.MapPath( gDataSourceFile & ".css")
257
    ' If it is not there, look in the DB Folder.  If not again there don't
258
    If objFSO.FileExists(strCss) Then
258
    ' Override the default  (which is Wiki.css).
259
        gStyleSheet = gDataSourceFile & ".css"
259
    '
260
    Else
260
    Dim strCss
261
        Dim strCssFile
261
    strCss= Server.MapPath( gDataSourceFile & ".css")
262
        strCssFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".css")
262
    If objFSO.FileExists(strCss) Then
263
        If objFSO.FileExists(strCssFile) Then
263
        gStyleSheet = gDataSourceFile & ".css"
264
            gStyleSheet =  gDataSourceDir & "\" & gDataSourceFile & ".css"
264
    Else
265
        End If
265
        Dim strCssFile
266
    End If
266
        strCssFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".css")
267
 
267
        If objFSO.FileExists(strCssFile) Then
268
    Set objTextStream = Nothing
268
            gStyleSheet =  gDataSourceDir & "\" & gDataSourceFile & ".css"
269
    Set objFSO = Nothing
269
        End If
270
 
270
    End If
271
End Sub
271
 
272
 
272
    Set objTextStream = Nothing
273
Function DayName (intDay)
273
    Set objFSO = Nothing
274
  '------------------------------------------
274
 
275
  ' Returns Abbreviated Day of Week
275
End Sub
276
  '------------------------------------------
276
 
277
  select case intDay
277
Function DayName (intDay)
278
      case 1
278
  '------------------------------------------
279
          DayName = "Sun"
279
  ' Returns Abbreviated Day of Week
280
      case 2
280
  '------------------------------------------
281
          DayName = "Mon"
281
  select case intDay
282
      case 3
282
      case 1
283
          DayName = "Tue"
283
          DayName = "Sun"
284
      case 4
284
      case 2
285
          DayName = "Wed"
285
          DayName = "Mon"
286
      case 5
286
      case 3
287
          DayName = "Thu"
287
          DayName = "Tue"
288
      case 6
288
      case 4
289
          DayName = "Fri"
289
          DayName = "Wed"
290
      case 7
290
      case 5
291
          DayName = "Sat"
291
          DayName = "Thu"
292
  end select
292
      case 6
293
end function
293
          DayName = "Fri"
294
 
294
      case 7
295
function MonthName(intMonth)
295
          DayName = "Sat"
296
  '-----------------------------------------
296
  end select
297
  ' Returns Abbreviated Month Name
297
end function
298
  '-----------------------------------------
298
 
299
  select case intMonth
299
function MonthName(intMonth)
300
      case 1
300
  '-----------------------------------------
301
         MonthName = "Jan"
301
  ' Returns Abbreviated Month Name
302
      case 2
302
  '-----------------------------------------
303
         MonthName = "Feb"
303
  select case intMonth
304
      case 3
304
      case 1
305
         MonthName = "Mar"
305
         MonthName = "Jan"
306
      case 4
306
      case 2
307
         MonthName = "Apr"
307
         MonthName = "Feb"
308
      case 5
308
      case 3
309
         MonthName = "May"
309
         MonthName = "Mar"
310
      case 6
310
      case 4
311
         MonthName = "Jun"
311
         MonthName = "Apr"
312
      case 7
312
      case 5
313
         MonthName = "Jul"
313
         MonthName = "May"
314
      case 8
314
      case 6
315
         MonthName = "Aug"
315
         MonthName = "Jun"
316
      case 9
316
      case 7
317
         MonthName = "Sep"
317
         MonthName = "Jul"
318
      case 10
318
      case 8
319
         MonthName = "Oct"
319
         MonthName = "Aug"
320
      case 11
320
      case 9
321
         MonthName = "Nov"
321
         MonthName = "Sep"
322
      case 12
322
      case 10
323
          MonthName = "Dec"
323
         MonthName = "Oct"
324
  end select
324
      case 11
325
end function
325
         MonthName = "Nov"
326
 
326
      case 12
327
Function GetRFC822date(dateVar)
327
          MonthName = "Dec"
328
   '----------------------------------------------
328
  end select
329
   ' Returns standard format date for RSS feeds
329
end function
330
   '----------------------------------------------
330
 
331
   GetRFC822date =  DayName (WeekDay(dateVar)) & ", " & _
331
Function GetRFC822date(dateVar)
332
                    Day(dateVar) & " " & MonthName(Month(dateVar)) & " " & _
332
   '----------------------------------------------
333
                    Year(dateVar) & " " & FormatDateTime(dateVar, 4) &":00 " & gTimeZoneOffset
333
   ' Returns standard format date for RSS feeds
334
End Function
334
   '----------------------------------------------
335
 
335
   GetRFC822date =  DayName (WeekDay(dateVar)) & ", " & _
336
 
336
                    Day(dateVar) & " " & MonthName(Month(dateVar)) & " " & _
337
Function WrappedQueryExecute( connObject, queryString )  
337
                    Year(dateVar) & " " & FormatDateTime(dateVar, 4) &":00 " & gTimeZoneOffset
338
   '----------------------------------------------
338
End Function
339
   ' If something is wrong with db connection redirect to URL
339
 
340
   '----------------------------------------------
340
 
341
  Dim rsResult
341
Function WrappedQueryExecute( connObject, queryString )  
342
  If gRedirectURL = "" Then
342
   '----------------------------------------------
343
      set rsResult = connObject.execute(queryString)
343
   ' If something is wrong with db connection redirect to URL
344
  Else
344
   '----------------------------------------------
345
      on error resume next
345
  Dim rsResult
346
      set rsResult = connObject.execute(queryString)
346
  If gRedirectURL = "" Then
347
      on error goto 0
347
      set rsResult = connObject.execute(queryString)
348
      
348
  Else
349
      If  isEmpty(rsResult) then
349
      on error resume next
350
	       Response.Redirect gRedirectURL
350
      set rsResult = connObject.execute(queryString)
351
         Response.End
351
      on error goto 0
352
      End If
352
      
353
  End If
353
      If  isEmpty(rsResult) then
354
  Set WrappedQueryExecute = rsResult
354
	    Response.Redirect gRedirectURL
355
End Function
355
        Response.End
356
 
356
      End If
357
 
357
  End If
358
Function AnyFileExistsIn( objFSO, extensions, baseFilename)
358
  Set WrappedQueryExecute = rsResult
359
 
359
End Function
360
    Dim arrIconExts, sIconPathFile, sIconFile, element
360
 
361
        
361
 
362
    AnyFileExistsIn = false
362
Function AnyFileExistsIn( objFSO, extensions, baseFilename)
363
    arrIconExts = Split(extensions, ",")
363
 
364
 
364
    Dim arrIconExts, sIconPathFile, sIconFile, element
365
    For Each element In arrIconExts
365
        
366
    
366
    AnyFileExistsIn = false
367
        sIconFile =  baseFilename & element
367
    arrIconExts = Split(extensions, ",")
368
        sIconPathFile= Server.MapPath( sIconFile)
368
 
369
 
369
    For Each element In arrIconExts
370
        If objFSO.FileExists(sIconPathFile) Then
370
    
371
           gIconName = sIconFile
371
        sIconFile =  baseFilename & element
372
           AnyFileExistsIn = true
372
        sIconPathFile= Server.MapPath( sIconFile)
373
           Exit For
373
 
374
        End If
374
        If objFSO.FileExists(sIconPathFile) Then
375
        
375
           gIconName = sIconFile
376
    Next
376
           AnyFileExistsIn = true
377
    
377
           Exit For
378
 
378
        End If
379
End Function
379
        
380
 
380
    Next
381
 
381
    
382
Sub GetIconName
382
 
383
    '-------------------------------------------------
383
End Function
384
    ' Get the icon file name. gif first then jpg
384
 
385
    ' Now it look a various places to guarantee an icon
385
 
386
    '-------------------------------------------------
386
Sub GetIconName
387
    Dim objFSO, sIconPathFile, sIconFile
387
    '-------------------------------------------------
388
    err.Clear
388
    ' Get the icon file name. gif first then jpg
389
    On Error Resume Next
389
    ' Now it look a various places to guarantee an icon
390
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
390
    '-------------------------------------------------
391
    On Error GoTo 0
391
    Dim objFSO, sIconPathFile, sIconFile
392
    If Not IsObject(objFSO)  Then
392
    err.Clear
393
        Exit Sub
393
    On Error Resume Next
394
    End If
394
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
395
    
395
    On Error GoTo 0
396
    ' look for <msaccessdb>.xxx icon file
396
    If Not IsObject(objFSO)  Then
397
    
397
        Exit Sub
398
    Dim iconSearchOrder 
398
    End If
399
    iconSearchOrder = ".gif,.jpg,.png"
399
    
400
    
400
    ' look for <msaccessdb>.xxx icon file
401
    ' first look at the db directory, then on root , then for icon.xxx, otherwise default to the c2 icon
401
    
402
    
402
    Dim iconSearchOrder 
403
    If not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceDir & "/" & gDataSourceFile ) Then
403
    iconSearchOrder = ".gif,.jpg,.png"
404
        If not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceFile ) Then
404
    
405
            If not AnyFileExistsIn( objFSO, iconSearchOrder , gIconName ) Then
405
    ' first look at the db directory, then on root , then for icon.xxx, otherwise default to the c2 icon
406
                gIconName = "http://c2.com/sig/wiki.gif"
406
    
407
            End If
407
    If not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceDir & "/" & gDataSourceFile ) Then
408
        End If
408
        If not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceFile ) Then
409
    End If
409
            If not AnyFileExistsIn( objFSO, iconSearchOrder , gIconName ) Then
410
    Set objFSO = Nothing
410
                gIconName = "http://c2.com/sig/wiki.gif"
411
End Sub
411
            End If
412
 
412
        End If
413
Function SpaceName(strX)
413
    End If
414
   '------------------------------------------------------------
414
    Set objFSO = Nothing
415
   ' This function splits up a string into words by inserting a
415
End Sub
416
   ' space before each upper case letter. Ignores numbers and .
416
 
417
   '------------------------------------------------------------
417
Function SpaceName(strX)
418
   Dim i, strY
418
   '------------------------------------------------------------
419
   i = 1
419
   ' This function splits up a string into words by inserting a
420
   strY = ""
420
   ' space before each upper case letter. Ignores numbers and .
421
   Do While i <= len(strX)
421
   '------------------------------------------------------------
422
     If UCase(mid(strX,i,1)) = mid(strX,i,1) Then
422
   Dim i, strY
423
       if  (( mid(strX,i,1) < "0" ) OR ( mid(strX,i,1) > "9")) AND ( mid(strX,i,1) <> ".")then
423
   i = 1
424
        strY = strY & " "
424
   strY = ""
425
       end if
425
   Do While i <= len(strX)
426
     End If
426
     If UCase(mid(strX,i,1)) = mid(strX,i,1) Then
427
     strY = strY & mid(strX,i,1)
427
       if  (( mid(strX,i,1) < "0" ) OR ( mid(strX,i,1) > "9")) AND ( mid(strX,i,1) <> ".")then
428
     i = i + 1
428
        strY = strY & " "
429
   Loop
429
       end if
430
   EmitDebug 9,  2, "Original string: " & strX & " ... Spaced out string: " & strY & "<br/>"
430
     End If
431
   SpaceName = strY
431
     strY = strY & mid(strX,i,1)
432
End Function
432
     i = i + 1
433
 
433
   Loop
434
 
434
   EmitDebug 9,  2, "Original string: " & strX & " ... Spaced out string: " & strY & "<br/>"
435
Function removeHTML(txt)
435
   SpaceName = strY
436
  removeHTML=server.htmlencode(txt)
436
End Function
437
End Function
437
 
438
 
438
 
439
Function safeQuote(txt)
439
Function removeHTML(txt)
440
  If IsNull(txt) Then
440
  removeHTML=server.htmlencode(txt)
441
     txt = ""
441
End Function
442
  End If
442
 
443
  safeQuote=replace(txt,"'","''")
443
Function safeQuote(txt)
444
End Function
444
  If IsNull(txt) Then
445
 
445
     txt = ""
446
 
446
  End If
447
Function replaceBoundingPattern(txt, pattern, tag)
447
  safeQuote=replace(txt,"'","''")
448
  Dim workingText
448
End Function
449
  workingText = txt
449
 
450
  gRE.Pattern = pattern & "([^\n]{0,}?)" & pattern    ' kgreiner
450
 
451
  workingText= gRE.Replace(workingText, "<" & tag & ">$1</" & tag & ">")
451
Function replaceBoundingPattern(txt, pattern, tag)
452
  replaceBoundingPattern = workingText
452
  Dim workingText
453
End Function
453
  workingText = txt
454
 
454
  gRE.Pattern = pattern & "([^\n]{0,}?)" & pattern    ' kgreiner
455
' Elrey Ronald
455
  workingText= gRE.Replace(workingText, "<" & tag & ">$1</" & tag & ">")
456
Function replaceTableColumnPattern(txt)
456
  replaceBoundingPattern = workingText
457
  Dim workingText
457
End Function
458
  Dim aryLines, aryLinesCount
458
 
459
  Dim i
459
' Elrey Ronald
460
  workingText = txt
460
Function replaceTableColumnPattern(txt)
461
 
461
  Dim workingText
462
  aryLines = Split(workingText,vbCRLF)
462
  Dim aryLines, aryLinesCount
463
  aryLinesCount = UBound(aryLines)
463
  Dim i
464
 
464
  workingText = txt
465
  For i = 0 To aryLinesCount
465
 
466
           If left(aryLines(i), 6 ) = "_tmp_0"  Then
466
  aryLines = Split(workingText,vbCRLF)
467
               aryLines(i) = Replace(aryLines(i), "_tmp_0", "<tr><td valign=top class=TableCell>")
467
  aryLinesCount = UBound(aryLines)
468
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
468
 
469
           End If
469
  For i = 0 To aryLinesCount
470
           If left(aryLines(i), 6 ) = "_tmp_1"  Then
470
           If left(aryLines(i), 6 ) = "_tmp_0"  Then
471
               aryLines(i) = Replace(aryLines(i), "_tmp_1", "<tr class=TableRow1><td  valign=top class=TableCell>")
471
               aryLines(i) = Replace(aryLines(i), "_tmp_0", "<tr><td valign=top class=TableCell>")
472
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
472
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
473
           End If
473
           End If
474
           If left(aryLines(i), 6 ) = "_tmp_2"  Then
474
           If left(aryLines(i), 6 ) = "_tmp_1"  Then
475
               aryLines(i) = Replace(aryLines(i), "_tmp_2", "<tr class=TableRow2><td  valign=top class=TableCell>")
475
               aryLines(i) = Replace(aryLines(i), "_tmp_1", "<tr class=TableRow1><td  valign=top class=TableCell>")
476
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
476
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
477
           End If
477
           End If
478
           If left(aryLines(i), 6 ) = "_tmp_3"  Then
478
           If left(aryLines(i), 6 ) = "_tmp_2"  Then
479
               aryLines(i) = Replace(aryLines(i), "_tmp_3", "<tr class=TableRow3><td  valign=top class=TableCell>")
479
               aryLines(i) = Replace(aryLines(i), "_tmp_2", "<tr class=TableRow2><td  valign=top class=TableCell>")
480
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
480
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
481
           End If
481
           End If
482
  Next
482
           If left(aryLines(i), 6 ) = "_tmp_3"  Then
483
  replaceTableColumnPattern= Join(aryLines,vbCRLF)
483
               aryLines(i) = Replace(aryLines(i), "_tmp_3", "<tr class=TableRow3><td  valign=top class=TableCell>")
484
End Function
484
               aryLines(i) = Replace(aryLines(i), "||", "</td><td  valign=top class=TableCell>")
485
 
485
           End If
486
Function AddAnchors(txt)
486
  Next
487
  Dim workingText
487
  replaceTableColumnPattern= Join(aryLines,vbCRLF)
488
  Dim aryLines, aryLinesCount
488
End Function
489
  Dim i
489
 
490
  Dim tocText
490
Function AddAnchors(txt)
491
  workingText = txt
491
  Dim workingText
492
 
492
  Dim aryLines, aryLinesCount
493
  dim toc(100)
493
  Dim i
494
  dim tocIndex: tocIndex = 0
494
  Dim tocText
495
 
495
  workingText = txt
496
  aryLines = Split(workingText,vbCRLF)
496
 
497
  aryLinesCount = UBound(aryLines)
497
  dim toc(100)
498
 
498
  dim tocIndex: tocIndex = 0
499
  For i = 0 To aryLinesCount
499
 
500
           If left(aryLines(i), 3 ) = "== "  Then
500
  aryLines = Split(workingText,vbCRLF)
501
               toc(tocIndex) = "<a href=""#Section_"& tocIndex &""">" & Mid(aryLines(i), 3) &"</a>"
501
  aryLinesCount = UBound(aryLines)
502
               aryLines(i) = "<a name=""Section_"& tocIndex &"""></a>" & vbCRLF & aryLines(i)
502
 
503
               tocIndex = tocIndex + 1
503
  For i = 0 To aryLinesCount
504
           End If
504
           If left(aryLines(i), 3 ) = "== "  Then
505
  Next
505
               toc(tocIndex) = "<a href=""#Section_"& tocIndex &""">" & Mid(aryLines(i), 3) &"</a>"
506
 
506
               aryLines(i) = "<a name=""Section_"& tocIndex &"""></a>" & vbCRLF & aryLines(i)
507
  if ( tocIndex > 0 ) then
507
               tocIndex = tocIndex + 1
508
      Dim ii
508
           End If
509
      Dim Text
509
  Next
510
      For ii = 0 to tocIndex -1
510
 
511
          Text = Text & vbcrlf & " *" & toc(ii)
511
  if ( tocIndex > 0 ) then
512
      Next
512
      Dim ii
513
      tocText = Text & vbcrlf & tocText
513
      Dim Text
514
  end if
514
      For ii = 0 to tocIndex -1
515
 
515
          Text = Text & vbcrlf & " *" & toc(ii)
516
  ' Look for the spot to drop the TOC
516
      Next
517
  ' [[TOC]]
517
      tocText = Text & vbcrlf & tocText
518
  For i = 0 To aryLinesCount
518
  end if
519
           If left(aryLines(i), 7 ) = "[[TOC]]"  Then
519
 
520
            aryLines(i) = tocText & vbCRLF' & aryLines(i)
520
  ' Look for the spot to drop the TOC
521
           End If
521
  ' [[TOC]]
522
  Next
522
  For i = 0 To aryLinesCount
523
  
523
           If left(aryLines(i), 7 ) = "[[TOC]]"  Then
524
 
524
            aryLines(i) = tocText & vbCRLF' & aryLines(i)
525
  AddAnchors = Join(aryLines,vbCRLF)
525
           End If
526
End Function
526
  Next
527
 
527
  
528
 
528
 
529
 
529
  AddAnchors = Join(aryLines,vbCRLF)
530
'Elrey 3/06
530
End Function
531
Function RandomInteger(HighValue , LowValue )
531
 
532
     Rnd -1
532
 
533
     Randomize (time)
533
 
534
     RandomInteger = Int((HighValue - Lowvalue + 1) * Rnd() + Lowvalue)
534
'Elrey 3/06
535
End Function
535
Function RandomInteger(HighValue , LowValue )
536
 
536
     Rnd -1
537
 
537
     Randomize (time)
538
Function replaceListPattern(txt, wikiPattern, topPattern, bottomPattern, startLinePattern, endLinePattern)
538
     RandomInteger = Int((HighValue - Lowvalue + 1) * Rnd() + Lowvalue)
539
  '
539
End Function
540
  ' Search through the text, creating numbered lists
540
 
541
  ' where so indicated by the pattern occurances.
541
 
542
  '
542
Function replaceListPattern(txt, wikiPattern, topPattern, bottomPattern, startLinePattern, endLinePattern)
543
  ' To indicate a numbered list, the pattern must always
543
  '
544
  ' appear at the very beginning of a line.
544
  ' Search through the text, creating numbered lists
545
  '
545
  ' where so indicated by the pattern occurances.
546
  Dim workingText,replaceText
546
  '
547
  Dim aryLines,aryLinesCount
547
  ' To indicate a numbered list, the pattern must always
548
  Dim nPatternLength,bInsidePattern
548
  ' appear at the very beginning of a line.
549
  Dim i
549
  '
550
 
550
  Dim workingText,replaceText
551
  'Elrey  - added multiple pattern
551
  Dim aryLines,aryLinesCount
552
  Dim aPatterns
552
  Dim nPatternLength,bInsidePattern
553
  Dim aPatternsCount
553
  Dim i
554
  Dim aPatternLength
554
 
555
  aPatterns = Split(wikiPattern,"^")
555
  'Elrey  - added multiple pattern
556
  aPatternsCount = UBound(aPatterns)
556
  Dim aPatterns
557
  Dim patternFound, j
557
  Dim aPatternsCount
558
 
558
  Dim aPatternLength
559
  Dim aStartPattern
559
  aPatterns = Split(wikiPattern,"^")
560
  aStartPattern = Split(startLinePattern,"^")
560
  aPatternsCount = UBound(aPatterns)
561
 
561
  Dim patternFound, j
562
  workingText = txt
562
 
563
  nPatternLength = len(wikiPattern)
563
  Dim aStartPattern
564
  bInsidePattern = False
564
  aStartPattern = Split(startLinePattern,"^")
565
  aryLines = Split(workingText,vbCRLF)
565
 
566
  aryLinesCount = UBound(aryLines)
566
  workingText = txt
567
 
567
  nPatternLength = len(wikiPattern)
568
  For i = 0 To aryLinesCount
568
  bInsidePattern = False
569
         ' Elrey
569
  aryLines = Split(workingText,vbCRLF)
570
         patternFound = 0
570
  aryLinesCount = UBound(aryLines)
571
         For j = 0 to aPatternsCount
571
 
572
             aPatternLength = len( aPatterns(j) )
572
  For i = 0 To aryLinesCount
573
             If  left( aryLines(i), aPatternLength ) = aPatterns(j) Then
573
         ' Elrey
574
                patternFound = 1
574
         patternFound = 0
575
                Exit For
575
         For j = 0 to aPatternsCount
576
             End If
576
             aPatternLength = len( aPatterns(j) )
577
         Next
577
             If  left( aryLines(i), aPatternLength ) = aPatterns(j) Then
578
 
578
                patternFound = 1
579
    If patternFound = 1 Then
579
                Exit For
580
        If Not bInsidePattern Then
580
             End If
581
            replaceText = topPattern & vbCRLF & aStartPattern (j)
581
         Next
582
 
582
 
583
            bInsidePattern = True
583
    If patternFound = 1 Then
584
        Else
584
        If Not bInsidePattern Then
585
            replaceText = aStartPattern (j)
585
            replaceText = topPattern & vbCRLF & aStartPattern (j)
586
        End If
586
 
587
        aryLines(i) = replaceText & right(aryLines(i),len(aryLines(i)) - aPatternLength ) & endLinePattern
587
            bInsidePattern = True
588
    Else
588
        Else
589
        If bInsidePattern Then
589
            replaceText = aStartPattern (j)
590
            aryLines(i) = bottomPattern & vbCRLF & aryLines(i)
590
        End If
591
            bInsidePattern = False
591
        aryLines(i) = replaceText & right(aryLines(i),len(aryLines(i)) - aPatternLength ) & endLinePattern
592
        End If
592
    Else
593
    End If
593
        If bInsidePattern Then
594
  Next
594
            aryLines(i) = bottomPattern & vbCRLF & aryLines(i)
595
 
595
            bInsidePattern = False
596
  replaceListPattern = Join(aryLines,vbCRLF)
596
        End If
597
 
597
    End If
598
End Function
598
  Next
599
 
599
 
600
 
600
  replaceListPattern = Join(aryLines,vbCRLF)
601
Function imageize(txt)
601
 
602
  ' Include a tag like img:http://www.brinkster.com/images/brinksterlogo.gif
602
End Function
603
  ' to get an inlined-image. <img src="foo">
603
 
604
  Dim workingText
604
 
605
  workingText = txt
605
Function imageize(txt)
606
 
606
  ' Include a tag like img:http://www.brinkster.com/images/brinksterlogo.gif
607
  ' referencing local images  Elrey Ronald 1/2006
607
  ' to get an inlined-image. <img src="foo">
608
  gRE.IgnoreCase = True
608
  Dim workingText
609
  gRE.Pattern = "(\s)(image:local|img:local):([^ \t\n\r]+)"
609
  workingText = txt
610
  workingText=gRE.Replace(workingText,"$1<img src='$3'  >")
610
 
611
 
611
  ' referencing local images  Elrey Ronald 1/2006
612
  gRE.IgnoreCase = True
612
  gRE.IgnoreCase = True
613
  gRE.Pattern = "(\s)(imageleft:local|imgleft:local):([^ \t\n\r]+)"
613
  gRE.Pattern = "(\s)(image:local|img:local):([^ \t\n\r]+)"
614
  workingText=gRE.Replace(workingText,"$1<img src='$3' align='left' style='margin-right:15pt'>")
614
  workingText=gRE.Replace(workingText,"$1<img src='$3'  >")
615
 
615
 
616
  gRE.IgnoreCase = True
616
  gRE.IgnoreCase = True
617
  gRE.Pattern = "(\s)(imageright:local|imgright:local):([^ \t\n\r]+)"
617
  gRE.Pattern = "(\s)(imageleft:local|imgleft:local):([^ \t\n\r]+)"
618
  workingText=gRE.Replace(workingText,"$1<img src='$3' align='right' style='margin-left:15pt'>")
618
  workingText=gRE.Replace(workingText,"$1<img src='$3' align='left' style='margin-right:15pt'>")
619
 
619
 
620
  gRE.IgnoreCase = True
620
  gRE.IgnoreCase = True
621
  gRE.Pattern = "(\s)(imgcenter:local|imagecenter:local|imgmiddle:local|imagemiddle:local):([^ \t\n\r]+)"
621
  gRE.Pattern = "(\s)(imageright:local|imgright:local):([^ \t\n\r]+)"
622
  workingText=gRE.Replace(workingText,"$1<p align=center><img src='$3' align='middle'></p>" )
622
  workingText=gRE.Replace(workingText,"$1<img src='$3' align='right' style='margin-left:15pt'>")
623
 
623
 
624
 
624
  gRE.IgnoreCase = True
625
  gRE.IgnoreCase = True
625
  gRE.Pattern = "(\s)(imgcenter:local|imagecenter:local|imgmiddle:local|imagemiddle:local):([^ \t\n\r]+)"
626
  gRE.Pattern = "(\s)(img|image):([^ \t\n\r]+)"
626
  workingText=gRE.Replace(workingText,"$1<p align=center><img src='$3' align='middle'></p>" )
627
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3'>")
627
 
628
 
628
 
629
  gRE.Pattern = "(\s)(imgleft|imageleft):([^ \t\n\r]+)"
629
  gRE.IgnoreCase = True
630
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='left' style='margin-right:15pt'>")
630
  gRE.Pattern = "(\s)(img|image):([^ \t\n\r]+)"
631
 
631
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3'>")
632
  gRE.Pattern = "(\s)(imgright|imageright):([^ \t\n\r]+)"
632
 
633
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='right' style='margin-left:15pt'>")
633
  gRE.Pattern = "(\s)(imgleft|imageleft):([^ \t\n\r]+)"
634
 
634
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='left' style='margin-right:15pt'>")
635
  gRE.Pattern = "(\s)(imgcenter|imagecenter|imgmiddle|imagemiddle):([^ \t\n\r]+)"
635
 
636
  workingText=gRE.Replace(workingText,"$1<p align=center><img title='$3' src='$3' align='middle' ></p>")
636
  gRE.Pattern = "(\s)(imgright|imageright):([^ \t\n\r]+)"
637
 
637
  workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='right' style='margin-left:15pt'>")
638
  ' local links
638
 
639
  gRE.IgnoreCase = True
639
  gRE.Pattern = "(\s)(imgcenter|imagecenter|imgmiddle|imagemiddle):([^ \t\n\r]+)"
640
  gRE.Pattern = "(\s)(local):([^ \t\n\r]+)"
640
  workingText=gRE.Replace(workingText,"$1<p align=center><img title='$3' src='$3' align='middle' ></p>")
641
  workingText=gRE.Replace(workingText,"$1<a href='$3' >$3</a>")
641
 
642
 
642
  ' local links
643
 
643
  gRE.IgnoreCase = True
644
  gRE.IgnoreCase = False
644
  gRE.Pattern = "(\s)(local):([^ \t\n\r]+)"
645
  imageize = workingText
645
  workingText=gRE.Replace(workingText,"$1<a href='$3' >$3</a>")
646
 
646
 
647
End Function
647
 
648
 
648
  gRE.IgnoreCase = False
649
Function isbnize(txt)
649
  imageize = workingText
650
  ' include a tag like isbn:0000000000
650
 
651
  ' to get a link to a book on Amazon <a href="amazonURL?isbn=0000">0000</a>
651
End Function
652
  Dim workingText
652
 
653
  workingText = txt
653
Function isbnize(txt)
654
 
654
  ' include a tag like isbn:0000000000
655
  gRE.IgnoreCase = True
655
  ' to get a link to a book on Amazon <a href="amazonURL?isbn=0000">0000</a>
656
  gRE.Pattern = "(\s)(isbn|ISBN):(\d{9}[\dX])"
656
  Dim workingText
657
  workingText=gRE.Replace(workingText,"$1<a  title='Amazon $3' href='http://www.amazon.com/exec/obidos/ISBN=$3'>ISBN:$3</a>")
657
  workingText = txt
658
 
658
 
659
  gRE.IgnoreCase = False  ' switch it back
659
  gRE.IgnoreCase = True
660
  isbnize = workingText
660
  gRE.Pattern = "(\s)(isbn|ISBN):(\d{9}[\dX])"
661
 
661
  workingText=gRE.Replace(workingText,"$1<a  title='Amazon $3' href='http://www.amazon.com/exec/obidos/ISBN=$3'>ISBN:$3</a>")
662
End Function
662
 
663
 
663
  gRE.IgnoreCase = False  ' switch it back
664
Function IsRequestFromWikiASPPage
664
  isbnize = workingText
665
 
665
 
666
  dim sHidden
666
End Function
667
  sHidden = Request.Form("hiddenInput")
667
 
668
 
668
Function IsRequestFromWikiASPPage
669
  If IsEmpty(sHidden) Then
669
 
670
     response.write "hmmm empty"
670
  dim sHidden
671
     IsRequestFromWikiASPPage = False
671
  sHidden = Request.Form("hiddenInput")
672
  End if
672
 
673
 
673
  If IsEmpty(sHidden) Then
674
  If sHidden <> "errv2010" Then
674
     response.write "hmmm empty"
675
     response.write "hmmm=" & sHidden
675
     IsRequestFromWikiASPPage = False
676
     IsRequestFromWikiASPPage = False
676
  End if
677
  End if
677
 
678
 
678
  If sHidden <> "errv2010" Then
679
  IsRequestFromWikiASPPage = True
679
     response.write "hmmm=" & sHidden
680
 
680
     IsRequestFromWikiASPPage = False
681
End Function
681
  End if
682
 
682
 
683
' Regular expression version ---------------------------
683
  IsRequestFromWikiASPPage = True
684
Function IsRemoteAdressBlackListedRE
684
 
685
 
685
End Function
686
  If Trim(gBlackListedIpsRE  ) = "" Then
686
 
687
     IsRemoteAdressBlackListedRE = False
687
' Regular expression version ---------------------------
688
  else
688
Function IsRemoteAdressBlackListedRE
689
     gRE.Pattern = gBlackListedIpsRE  
689
 
690
  
690
  If Trim(gBlackListedIpsRE  ) = "" Then
691
     IsRemoteAdressBlackListedRE = gRE.Test( remoteIPHost)
691
     IsRemoteAdressBlackListedRE = False
692
  End If
692
  else
693
End Function
693
     gRE.Pattern = gBlackListedIpsRE  
694
 
694
  
695
' Non RE version (Exact)--------------------------------
695
     IsRemoteAdressBlackListedRE = gRE.Test( remoteIPHost)
696
Function IsRemoteBlackListed 
696
  End If
697
 
697
End Function
698
    IsRemoteBlackListed = False
698
 
699
 
699
' Non RE version (Exact)--------------------------------
700
    Dim pos
700
Function IsRemoteBlackListed 
701
 
701
 
702
    pos =  InStr(gBlackListedIps, remoteIPHost3numbers) ' Leading 3 digits. Set IP list as ~1.2.3.~4.5.3~
702
    IsRemoteBlackListed = False
703
 
703
 
704
    If Not IsNull(pos) and pos > 0 Then
704
    Dim pos
705
       IsRemoteBlackListed = True
705
 
706
    End If
706
    pos =  InStr(gBlackListedIps, remoteIPHost3numbers) ' Leading 3 digits. Set IP list as ~1.2.3.~4.5.3~
707
 
707
 
708
End Function
708
    If Not IsNull(pos) and pos > 0 Then
709
 
709
       IsRemoteBlackListed = True
710
 
710
    End If
711
Function hyperlink(txt)
711
 
712
  Dim workingText
712
End Function
713
  Dim matches
713
 
714
  Dim nHits
714
 
715
  Dim thisMatchBefore, thisMatchAfter
715
Function hyperlink(txt)
716
 
716
  Dim workingText
717
  workingText = txt
717
  Dim matches
718
 
718
  Dim nHits
719
 
719
  Dim thisMatchBefore, thisMatchAfter
720
  'pattern with no spaces:
720
 
721
  'gRE.Pattern = "(http|https)://[^ \t\n\r]+"
721
  workingText = txt
722
  'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]]+)"
722
 
723
 
723
 
724
  'ElreyRonald 8/03  Bjarne 10/31
724
  'pattern with no spaces:
725
  gRE.Pattern = "([^\[])\[([^\|\]]+)\|((http://|https://|ftp://|mailto:|news:|file:)[^\]\r\n\t]+)\]"
725
  'gRE.Pattern = "(http|https)://[^ \t\n\r]+"
726
  workingText=gRE.Replace(workingText,"$1<a href='$3'>$2</a>")
726
  'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]]+)"
727
 
727
 
728
  'ElreyRonald  local links inside [ | ]
728
  'ElreyRonald 8/03  Bjarne 10/31
729
  gRE.Pattern = "([^\[])\[([^\|\]]+)\|(local):([^ \t\n\r]+)\]"
729
  gRE.Pattern = "([^\[])\[([^\|\]]+)\|((http://|https://|ftp://|mailto:|news:|file:)[^\]\r\n\t]+)\]"
730
  workingText=gRE.Replace(workingText,"$1<a href='$4'>$2</a>")
730
  workingText=gRE.Replace(workingText,"$1<a href='$3'>$2</a>")
731
 
731
 
732
 
732
  'ElreyRonald  local links inside [ | ]
733
  'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]\r\n\t]+)"
733
  gRE.Pattern = "([^\[])\[([^\|\]]+)\|(local):([^ \t\n\r]+)\]"
734
  'Bjarne
734
  workingText=gRE.Replace(workingText,"$1<a href='$4'>$2</a>")
735
  gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:|file:)[^\s\<\>\(\)\[\]\r\n\t]+)"
735
 
736
  workingText=gRE.Replace(workingText,"$1<a href=""$2"">$2</a>")
736
 
737
 
737
  'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]\r\n\t]+)"
738
 
738
  'Bjarne
739
   'This is new  5/2006 see [/Drop]
739
  gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:|file:)[^\s\<\>\(\)\[\]\r\n\t]+)"
740
  '[Drop#001##Test]
740
  workingText=gRE.Replace(workingText,"$1<a href=""$2"">$2</a>")
741
            '       1    [    2      ::              3            ]
741
 
742
  gRE.Pattern = "([^\[])\[Drop\#(\S+)\#\#([^\<\>\(\)\=\r\n\t\]]+)\]"
742
 
743
  workingText=gRE.Replace(workingText,   _
743
   'This is new  5/2006 see [/Drop]
744
   "$1<div><span style=""font-weight: bold; color: white; background-color: green ; cursor: pointer"" onclick=""var div=document.getElementById('$2');if(div.style.display=='none') {div.style.display='block'; this.innerText='&nbsp;&#8592;&nbsp;';} else {div.style.display='none';this.innerText='&nbsp;+&nbsp;'}"">&nbsp;+&nbsp;</span>$3<div id='$2' style='display:none'> " )
744
  '[Drop#001##Test]
745
 
745
            '       1    [    2      ::              3            ]
746
 
746
  gRE.Pattern = "([^\[])\[Drop\#(\S+)\#\#([^\<\>\(\)\=\r\n\t\]]+)\]"
747
 
747
  workingText=gRE.Replace(workingText,   _
748
  ' interwiki  by Elrey
748
   "$1<div><span style=""font-weight: bold; color: white; background-color: green ; cursor: pointer"" onclick=""var div=document.getElementById('$2');if(div.style.display=='none') {div.style.display='block'; this.innerText='&nbsp;&#8592;&nbsp;';} else {div.style.display='none';this.innerText='&nbsp;+&nbsp;'}"">&nbsp;+&nbsp;</span>$3<div id='$2' style='display:none'> " )
749
  ' example:  [Sample One=CpOrders::SampleOne]
749
 
750
            '       1    [     2    =   3      ::               4            ]
750
 
751
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"
751
 
752
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3&o=$4'>$2</a>")
752
  ' interwiki  by Elrey
753
 
753
  ' example:  [Sample One=CpOrders::SampleOne]
754
  ' interwiki  by Elrey
754
            '       1    [     2    =   3      ::               4            ]
755
  ' example:  [Sample One=CpOrders::]
755
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"
756
            '       1    [     2    =   3      ::    ]
756
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3&o=$4'>$2</a>")
757
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:\]"
757
 
758
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3'>$2</a>")
758
  ' interwiki  by Elrey
759
 
759
  ' example:  [Sample One=CpOrders::]
760
 
760
            '       1    [     2    =   3      ::    ]
761
 
761
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:\]"
762
  ' intern link by Bernd Michalke 9/15/2005
762
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3'>$2</a>")
763
  ' [anything geht=WikiASP]
763
 
764
 
764
 
765
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^\s\<\>\(\)\=\r\n\t\]]+)\]"
765
 
766
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$3'>$2</a>")
766
  ' intern link by Bernd Michalke 9/15/2005
767
 
767
  ' [anything geht=WikiASP]
768
  ' intern link by Elrey 3/2006
768
 
769
  ' [=WikiASP]
769
  gRE.Pattern = "([^\[])\[([^=\]]+)\=([^\s\<\>\(\)\=\r\n\t\]]+)\]"
770
  '              (--1--)   (-2----)
770
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$3'>$2</a>")
771
  gRE.Pattern = "([^\[])\[=([^\]]+)\]"
771
 
772
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")
772
  ' intern link by Elrey 3/2006
773
 
773
  ' [=WikiASP]
774
' intern link by Elrey 3/2006
774
  '              (--1--)   (-2----)
775
  ' [[WikiAS P topic]]
775
  gRE.Pattern = "([^\[])\[=([^\]]+)\]"
776
  '              (--1--)    (---2--)
776
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")
777
  gRE.Pattern = "([^\[])\[\[([^\]]+)\]\]"
777
 
778
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")
778
' intern link by Elrey 3/2006
779
 
779
  ' [[WikiAS P topic]]
780
 
780
  '              (--1--)    (---2--)
781
  ' interwiki  by Elrey
781
  gRE.Pattern = "([^\[])\[\[([^\]]+)\]\]"
782
  ' example:  [CpOrders::SampleOne]
782
  workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")
783
            '       1    [     2   ::   3         ]
783
 
784
  gRE.Pattern = "([^\[])\[([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"
784
 
785
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2&o=$3'>$3</a>")
785
  ' interwiki  by Elrey
786
 
786
  ' example:  [CpOrders::SampleOne]
787
  ' interwiki  by Elrey
787
            '       1    [     2   ::   3         ]
788
  ' example:  [CpOrders::]
788
  gRE.Pattern = "([^\[])\[([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"
789
            '       1    [    2  ::    ]
789
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2&o=$3'>$3</a>")
790
  gRE.Pattern = "([^\[])\[([^=\]]+)\:\:\]"
790
 
791
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2'>$2</a>")
791
  ' interwiki  by Elrey
792
 
792
  ' example:  [CpOrders::]
793
 
793
            '       1    [    2  ::    ]
794
  hyperlink = workingText
794
  gRE.Pattern = "([^\[])\[([^=\]]+)\:\:\]"
795
 
795
  workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2'>$2</a>")
796
End Function
796
 
797
 
797
 
798
 
798
  hyperlink = workingText
799
 
799
 
800
Function PreHack(isTeksten)
800
End Function
801
    Dim arr
801
 
802
    Dim element
802
 
803
    Dim preOn
803
 
804
    Dim newText
804
Function PreHack(isTeksten)
805
 
805
    Dim arr
806
    preOn = False
806
    Dim element
807
    arr = Split(isTeksten, vbCrLf)
807
    Dim preOn
808
 
808
    Dim newText
809
    For Each element In arr
809
 
810
    If newtext <> "" Then
810
    preOn = False
811
        newtext = newtext & vbCrLf
811
    arr = Split(isTeksten, vbCrLf)
812
    End If
812
 
813
    ' line begins with a space
813
    For Each element In arr
814
    If left(element, 1) = " " Then
814
    If newtext <> "" Then
815
        ' start pre tag
815
        newtext = newtext & vbCrLf
816
        If preOn = False Then
816
    End If
817
        preon = true
817
    ' line begins with a space
818
        newText = newtext & "<pre>" & vbcrlf & element
818
    If left(element, 1) = " " Then
819
        ' already in pre tag
819
        ' start pre tag
820
        else
820
        If preOn = False Then
821
        newtext = newtext & element
821
        preon = true
822
        end if
822
        newText = newtext & "<pre>" & vbcrlf & element
823
    ' empty line
823
        ' already in pre tag
824
    elseif element = "" then
824
        else
825
        newtext = newtext & vbcrlf
825
        newtext = newtext & element
826
    ' line begins with something besides a space
826
        end if
827
    else
827
    ' empty line
828
        ' turn pre off
828
    elseif element = "" then
829
        if preon then
829
        newtext = newtext & vbcrlf
830
        newText = newtext & "</pre>" & vbcrlf & element
830
    ' line begins with something besides a space
831
        preon = false
831
    else
832
        ' just append element
832
        ' turn pre off
833
        else
833
        if preon then
834
        newtext = newtext & element
834
        newText = newtext & "</pre>" & vbcrlf & element
835
        end if
835
        preon = false
836
    end if
836
        ' just append element
837
    next
837
        else
838
    if preon then
838
        newtext = newtext & element
839
    newtext = newtext & "</pre>"
839
        end if
840
    preon = false
840
    end if
841
    end if
841
    next
842
    prehack = newtext
842
    if preon then
843
end function
843
    newtext = newtext & "</pre>"
844
 
844
    preon = false
845
 
845
    end if
846
 
846
    prehack = newtext
847
function xform(isTeksten)
847
end function
848
  ' this is the transformation routine, in which all the markup
848
 
849
  ' is transformed into HTML.
849
 
850
  '
850
 
851
  ' ordering of the stages is important.
851
function xform(isTeksten)
852
  '
852
  ' this is the transformation routine, in which all the markup
853
  dim newText
853
  ' is transformed into HTML.
854
  newText = vbcrlf & isTeksten ' need a space to deal with first-line wikiname
854
  '
855
 
855
  ' ordering of the stages is important.
856
  'Elrey - move HTML removal into here
856
  '
857
  If gRemoveHtml Then
857
  dim newText
858
     newText = removeHTML(newText)
858
  newText = vbcrlf & isTeksten ' need a space to deal with first-line wikiname
859
  End If
859
 
860
 
860
  'Elrey - move HTML removal into here
861
  'David Purdie
861
  If gRemoveHtml Then
862
  'Remove comments - Lines starting with //
862
     newText = removeHTML(newText)
863
  gRE.Pattern = "(\r\n)//([^\r\n]+)"
863
  End If
864
  newText=gRE.Replace(newText,"")
864
 
865
  
865
  'David Purdie
866
  ' indented paragraph second level using '>' (  '|' is now used with Tables - Elrey
866
  'Remove comments - Lines starting with //
867
  newText=replace(newText,vbcrlf & "&gt;&gt;&gt;&gt;",vbcrlf & "<p style=""margin-left:80pt;"">")
867
  gRE.Pattern = "(\r\n)//([^\r\n]+)"
868
  newText=replace(newText,vbcrlf & "&gt;&gt;&gt;",vbcrlf & "<p style=""margin-left:60pt;"">")
868
  newText=gRE.Replace(newText,"")
869
  newText=replace(newText,vbcrlf & "&gt;&gt;",vbcrlf & "<p style=""margin-left:40pt;"">")
869
  
870
  newText=replace(newText,vbcrlf & "&gt;",vbcrlf & "<p style=""margin-left:20pt;"">")
870
  ' indented paragraph second level using '>' (  '|' is now used with Tables - Elrey
871
 ' Elrey 3/2007
871
  newText=replace(newText,vbcrlf & "&gt;&gt;&gt;&gt;",vbcrlf & "<p style=""margin-left:80pt;"">")
872
 newText=replace(newText,vbcrlf & ">>>>>>>>>*",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">&#9827;&nbsp;")
872
  newText=replace(newText,vbcrlf & "&gt;&gt;&gt;",vbcrlf & "<p style=""margin-left:60pt;"">")
873
 newText=replace(newText,vbcrlf & ">>>>>>>>*",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">&#8574;&nbsp;")
873
  newText=replace(newText,vbcrlf & "&gt;&gt;",vbcrlf & "<p style=""margin-left:40pt;"">")
874
 newText=replace(newText,vbcrlf & ">>>>>>>*",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">&#959;&nbsp;")
874
  newText=replace(newText,vbcrlf & "&gt;",vbcrlf & "<p style=""margin-left:20pt;"">")
875
 newText=replace(newText,vbcrlf & ">>>>>>*",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">&#8226;&nbsp;")
875
 ' Elrey 3/2007
876
 newText=replace(newText,vbcrlf & ">>>>>*",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">&#9830;&nbsp;")
876
 newText=replace(newText,vbcrlf & ">>>>>>>>>*",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">&#9827;&nbsp;")
877
 newText=replace(newText,vbcrlf & ">>>>*",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">&#8594;&nbsp;")
877
 newText=replace(newText,vbcrlf & ">>>>>>>>*",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">&#8574;&nbsp;")
878
 newText=replace(newText,vbcrlf & ">>>*",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">&#9674;&nbsp;")
878
 newText=replace(newText,vbcrlf & ">>>>>>>*",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">&#959;&nbsp;")
879
 newText=replace(newText,vbcrlf & ">>*",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">&#959;&nbsp;")
879
 newText=replace(newText,vbcrlf & ">>>>>>*",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">&#8226;&nbsp;")
880
 newText=replace(newText,vbcrlf & ">*",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">&#8226;&nbsp;")
880
 newText=replace(newText,vbcrlf & ">>>>>*",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">&#9830;&nbsp;")
881
 
881
 newText=replace(newText,vbcrlf & ">>>>*",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">&#8594;&nbsp;")
882
 
882
 newText=replace(newText,vbcrlf & ">>>*",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">&#9674;&nbsp;")
883
 
883
 newText=replace(newText,vbcrlf & ">>*",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">&#959;&nbsp;")
884
  ' indented paragraph second level using '>' (  '|' is now used with Tables - Elrey  updated 3/2007
884
 newText=replace(newText,vbcrlf & ">*",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">&#8226;&nbsp;")
885
  newText=replace(newText,vbcrlf & ">>>>>>>>>",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">")
885
 
886
  newText=replace(newText,vbcrlf & ">>>>>>>>",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">")
886
 
887
  newText=replace(newText,vbcrlf & ">>>>>>>",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">")
887
 
888
  newText=replace(newText,vbcrlf & ">>>>>>",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">")
888
  ' indented paragraph second level using '>' (  '|' is now used with Tables - Elrey  updated 3/2007
889
  newText=replace(newText,vbcrlf & ">>>>>",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">")
889
  newText=replace(newText,vbcrlf & ">>>>>>>>>",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">")
890
  newText=replace(newText,vbcrlf & ">>>>",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">")
890
  newText=replace(newText,vbcrlf & ">>>>>>>>",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">")
891
  newText=replace(newText,vbcrlf & ">>>",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">")
891
  newText=replace(newText,vbcrlf & ">>>>>>>",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">")
892
  newText=replace(newText,vbcrlf & ">>",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">")
892
  newText=replace(newText,vbcrlf & ">>>>>>",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">")
893
  newText=replace(newText,vbcrlf & ">",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">")
893
  newText=replace(newText,vbcrlf & ">>>>>",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">")
894
  
894
  newText=replace(newText,vbcrlf & ">>>>",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">")
895
 
895
  newText=replace(newText,vbcrlf & ">>>",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">")
896
 
896
  newText=replace(newText,vbcrlf & ">>",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">")
897
 
897
  newText=replace(newText,vbcrlf & ">",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">")
898
  ' newlines: three newlines = a blank line
898
  
899
  newText=replace(newText,vbcrlf & vbcrlf & vbcrlf,vbcrlf & "<br/>&nbsp;<br/></p><p>" & vbcrlf )
899
 
900
 
900
 
901
  ' newlines: two newlines = a hard return
901
 
902
  newText=replace(newText,vbcrlf & vbcrlf,vbcrlf & "<br/></p><p>" & vbcrlf )
902
  ' newlines: three newlines = a blank line
903
 
903
  newText=replace(newText,vbcrlf & vbcrlf & vbcrlf,vbcrlf & "<br/>&nbsp;<br/></p><p>" & vbcrlf )
904
 
904
 
905
  EmitDebug 10, 4, "xform-before(" &  newText & ")<br/>"
905
  ' newlines: two newlines = a hard return
906
 
906
  newText=replace(newText,vbcrlf & vbcrlf,vbcrlf & "<br/></p><p>" & vbcrlf )
907
  If right(newText,2) <> vbcrlf Then
907
 
908
    newText = newText & vbcrlf
908
 
909
  End If
909
  EmitDebug 10, 4, "xform-before(" &  newText & ")<br/>"
910
 
910
 
911
  'David Purdie
911
  If right(newText,2) <> vbcrlf Then
912
  newText=replace(newText, "$Page$", glsTopic )
912
    newText = newText & vbcrlf
913
  newText=replace(newText, "$image$", "local:images/page_" + glsTopic )
913
  End If
914
  newText=replace(newText, "$domain$", gHttpDomain )
914
 
915
 
915
  'David Purdie
916
  ' toc david
916
  newText=replace(newText, "$Page$", glsTopicClean )
917
  newText = AddAnchors(newText)
917
  newText=replace(newText, "$image$", "local:images/page_" + glsTopicClean )
918
 
918
  newText=replace(newText, "$domain$", glsTopicClean )
919
  'Elrey Ronald
919
 
920
  newText=replaceListPattern(newText, "        *", "<ul>", "</ul>", "<li> ", "</li>")
920
  ' toc david
921
  newText=replaceListPattern(newText, "        :*", "<ol>", "</ol>", "<li> ", "</li>")
921
  newText = AddAnchors(newText)
922
  newText=replaceListPattern(newText, "        1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")
922
 
923
 
923
  'Elrey Ronald
924
  'Elrey Ronald - more convenient bullet list
924
  newText=replaceListPattern(newText, "        *", "<ul>", "</ul>", "<li> ", "</li>")
925
  newText=replaceListPattern(newText, " *", "<ul>", "</ul>", "<li> ", "</li>")
925
  newText=replaceListPattern(newText, "        :*", "<ol>", "</ol>", "<li> ", "</li>")
926
  newText=replaceListPattern(newText, " :*", "<ol>", "</ol>", "<li> ", "</li>")
926
  newText=replaceListPattern(newText, "        1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")
927
  newText=replaceListPattern(newText, " 1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")
927
 
928
 
928
  'Elrey Ronald - more convenient bullet list
929
  'Elrey Ronald - Table Pattern
929
  newText=replaceListPattern(newText, " *", "<ul>", "</ul>", "<li> ", "</li>")
930
  newText=replaceListPattern(newText, "||^!|^|!^!!", "<table border=1 class=TableClass>", "</table>", "_tmp_0^_tmp_1^_tmp_2^_tmp_3", "</td></tr>")
930
  newText=replaceListPattern(newText, " :*", "<ol>", "</ol>", "<li> ", "</li>")
931
 
931
  newText=replaceListPattern(newText, " 1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")
932
  newText=replaceTableColumnPattern(newText)
932
 
933
 
933
  'Elrey Ronald - Table Pattern
934
  ' leading space rule
934
  newText=replaceListPattern(newText, "||^!|^|!^!!", "<table border=1 class=TableClass>", "</table>", "_tmp_0^_tmp_1^_tmp_2^_tmp_3", "</td></tr>")
935
  newText = PreHack(newText)
935
 
936
 
936
  newText=replaceTableColumnPattern(newText)
937
' outline ( ElreyRonald )
937
 
938
 
938
  ' leading space rule
939
  gRE.Pattern = "\r\n\[(\d+)\]======([^\r\n]+)"
939
  newText = PreHack(newText)
940
  newText=gRE.Replace(newText,"<h6>[<a name='$1' href='#fn_$1'>$1</a>] $2</h6>")
940
 
941
  gRE.Pattern = "\r\n\[(\d+)\]=====([^\r\n]+)"
941
' outline ( ElreyRonald )
942
  newText=gRE.Replace(newText,"<h5>[<a name='$1' href='#fn_$1'>$1</a>] $2</h5>")
942
 
943
  gRE.Pattern = "\r\n\[(\d+)\]====([^\r\n]+)"
943
  gRE.Pattern = "\r\n\[(\d+)\]======([^\r\n]+)"
944
  newText=gRE.Replace(newText,"<h4>[<a name='$1' href='#fn_$1'>$1</a>] $2</h4>")
944
  newText=gRE.Replace(newText,"<h6>[<a name='$1' href='#fn_$1'>$1</a>] $2</h6>")
945
  gRE.Pattern = "\r\n\[(\d+)\]===([^\r\n]+)"
945
  gRE.Pattern = "\r\n\[(\d+)\]=====([^\r\n]+)"
946
  newText=gRE.Replace(newText,"<h3>[<a name='$1' href='#fn_$1'>$1</a>] $2</h3>")
946
  newText=gRE.Replace(newText,"<h5>[<a name='$1' href='#fn_$1'>$1</a>] $2</h5>")
947
  gRE.Pattern = "\r\n\[(\d+)\]==([^\r\n]+)"
947
  gRE.Pattern = "\r\n\[(\d+)\]====([^\r\n]+)"
948
  newText=gRE.Replace(newText,"<h2>[<a name='$1' href='#fn_$1'>$1</a>] $2</h2>")
948
  newText=gRE.Replace(newText,"<h4>[<a name='$1' href='#fn_$1'>$1</a>] $2</h4>")
949
 
949
  gRE.Pattern = "\r\n\[(\d+)\]===([^\r\n]+)"
950
  ' footnote ( ElreyRonald )
950
  newText=gRE.Replace(newText,"<h3>[<a name='$1' href='#fn_$1'>$1</a>] $2</h3>")
951
 
951
  gRE.Pattern = "\r\n\[(\d+)\]==([^\r\n]+)"
952
  gRE.Pattern = "\r\n\[(\d+)\]\r\n"    ' blank footnote will just be an anchor (ElreyRonald)
952
  newText=gRE.Replace(newText,"<h2>[<a name='$1' href='#fn_$1'>$1</a>] $2</h2>")
953
  newText=gRE.Replace(newText,  "<a name='$1' href='#fn_$1'><hr size=1></a>" & vbcrlf)
953
 
954
 
954
  ' footnote ( ElreyRonald )
955
  gRE.Pattern = "\r\n\[(\d+)\]"
955
 
956
  newText=gRE.Replace(newText,  "<br>[<a name='$1' href='#fn_$1'>$1</a>]")
956
  gRE.Pattern = "\r\n\[(\d+)\]\r\n"    ' blank footnote will just be an anchor (ElreyRonald)
957
 
957
  newText=gRE.Replace(newText,  "<a name='$1' href='#fn_$1'><hr size=1></a>" & vbcrlf)
958
  gRE.Pattern = "\[(\d+)\]"
958
 
959
  newText=gRE.Replace(newText, "[<a href='#$1' name='fn_$1'>$1</a>]")
959
  gRE.Pattern = "\r\n\[(\d+)\]"
960
 
960
  newText=gRE.Replace(newText,  "<br>[<a name='$1' href='#fn_$1'>$1</a>]")
961
  ' topic line (ElreyRonald)
961
 
962
  gRE.Pattern = "\r\n======([^\r\n]+)"
962
  gRE.Pattern = "\[(\d+)\]"
963
  newText=gRE.Replace(newText,"<h6>$1</h6>")
963
  newText=gRE.Replace(newText, "[<a href='#$1' name='fn_$1'>$1</a>]")
964
  gRE.Pattern = "\r\n=====([^\r\n]+)"
964
 
965
  newText=gRE.Replace(newText,"<h5>$1</h5>")
965
  ' topic line (ElreyRonald)
966
  gRE.Pattern = "\r\n====([^\r\n]+)"
966
  gRE.Pattern = "\r\n======([^\r\n]+)"
967
  newText=gRE.Replace(newText,"<h4>$1</h4>")
967
  newText=gRE.Replace(newText,"<h6>$1</h6>")
968
  gRE.Pattern = "\r\n===([^\r\n]+)"
968
  gRE.Pattern = "\r\n=====([^\r\n]+)"
969
  newText=gRE.Replace(newText,"<h3>$1</h3>")
969
  newText=gRE.Replace(newText,"<h5>$1</h5>")
970
  gRE.Pattern = "\r\n==([^\r\n]+)"
970
  gRE.Pattern = "\r\n====([^\r\n]+)"
971
  newText=gRE.Replace(newText,"<h2>$1</h2>")
971
  newText=gRE.Replace(newText,"<h4>$1</h4>")
972
 
972
  gRE.Pattern = "\r\n===([^\r\n]+)"
973
  ' horizontal rule
973
  newText=gRE.Replace(newText,"<h3>$1</h3>")
974
  gRE.Pattern = "\r\n-{4,}"
974
  gRE.Pattern = "\r\n==([^\r\n]+)"
975
  newText=gRE.Replace(newText,vbCrLf & "<hr size=1 noshade=false />" & vbcrlf)
975
  newText=gRE.Replace(newText,"<h2>$1</h2>")
976
 
976
 
977
  ' special case for dash and a-umlaut - MARKUS
977
  ' horizontal rule
978
  'newText=replace(newText,"-", "&minus;")  ' this change breaks image URLs that include dashes
978
  gRE.Pattern = "\r\n-{4,}"
979
  newText=replace(newText,"", "&auml;")
979
  newText=gRE.Replace(newText,vbCrLf & "<hr size=1 noshade=false />" & vbcrlf)
980
 
980
 
981
  ' removed by ElreyRonald, use "|"
981
  ' special case for dash and a-umlaut - MARKUS
982
  ' newText=replace(newText,chr(9) & " :" & chr(9),"<p style=""margin-left:20pt;"">")
982
  'newText=replace(newText,"-", "&minus;")  ' this change breaks image URLs that include dashes
983
 
983
  newText=replace(newText,"", "&auml;")
984
  ' Removed by ElreyRonald, use "|"
984
 
985
  ' newText=replace(newText,vbcrlf & chr(9) & "]",vbcrlf & "<p style=""margin-left:20pt;"">")
985
  ' removed by ElreyRonald, use "|"
986
 
986
  ' newText=replace(newText,chr(9) & " :" & chr(9),"<p style=""margin-left:20pt;"">")
987
 
987
 
988
  '[MARKUS] Underline neu hinzugefgt - -_ irgendwas _-
988
  ' Removed by ElreyRonald, use "|"
989
  newText=replace(newText,"-_", "<u>")
989
  ' newText=replace(newText,vbcrlf & chr(9) & "]",vbcrlf & "<p style=""margin-left:20pt;"">")
990
  newText=replace(newText,"_-","</u>")
990
 
991
 
991
 
992
  '[Markus] LEERSTELLEN werden in HTML-Leerstellen umgewandelt
992
  '[MARKUS] Underline neu hinzugefgt - -_ irgendwas _-
993
  'newText=replace(newText," ","&nbsp;")  ' this change screws up images.  Why necessary?   dinoch Thu, 17 Oct 2002
993
  newText=replace(newText,"-_", "<u>")
994
 
994
  newText=replace(newText,"_-","</u>")
995
  ' bulleted lists: tab-star
995
 
996
  'newText=replace(newText,chr(9) & "*","<li> ")
996
  '[Markus] LEERSTELLEN werden in HTML-Leerstellen umgewandelt
997
  newText=replaceListPattern(newText, chr(9) & "*", "<ul>", "</ul>", "<li> ", "</li>")
997
  'newText=replace(newText," ","&nbsp;")  ' this change screws up images.  Why necessary?   dinoch Thu, 17 Oct 2002
998
 
998
 
999
  ' numbered lists: tab-colon-star
999
  ' bulleted lists: tab-star
1000
  newText=replaceListPattern(newText, chr(9) & ":*", "<ol>", "</ol>", "<li> ", "</li>")
1000
  'newText=replace(newText,chr(9) & "*","<li> ")
1001
 
1001
  newText=replaceListPattern(newText, chr(9) & "*", "<ul>", "</ul>", "<li> ", "</li>")
1002
  ' numbered lists: Changed to use 1. to conform with http://www.c2.com/cgi/wiki?TextFormattingRules
1002
 
1003
  newText=replaceListPattern(newText, chr(9) & "1.", "<ol>", "</ol>", "<li> ", "</li>")
1003
  ' numbered lists: tab-colon-star
1004
 
1004
  newText=replaceListPattern(newText, chr(9) & ":*", "<ol>", "</ol>", "<li> ", "</li>")
1005
  ' COLORS: (german and english)- german removed (ElreyRonald)
1005
 
1006
  'SCHRIFTFARBEN {schwarz} {braun} {grn} {blau} {gelb} {rot} {orange}
1006
  ' numbered lists: Changed to use 1. to conform with http://www.c2.com/cgi/wiki?TextFormattingRules
1007
  '{farbe} {/farbe}
1007
  newText=replaceListPattern(newText, chr(9) & "1.", "<ol>", "</ol>", "<li> ", "</li>")
1008
  newText=replace(newText,"{black}","<font color=black>")
1008
 
1009
  newText=replace(newText,"{/black}","</font>")
1009
  ' COLORS: (german and english)- german removed (ElreyRonald)
1010
  newText=replace(newText,"{green}","<font color=darkgreen>")
1010
  'SCHRIFTFARBEN {schwarz} {braun} {grn} {blau} {gelb} {rot} {orange}
1011
  newText=replace(newText,"{/green}","</font>")
1011
  '{farbe} {/farbe}
1012
  newText=replace(newText,"{blue}","<font color=darkblue>")
1012
  newText=replace(newText,"{black}","<font color=black>")
1013
  newText=replace(newText,"{/blue}","</font>")
1013
  newText=replace(newText,"{/black}","</font>")
1014
  newText=replace(newText,"{sienna}","<font color=sienna>")
1014
  newText=replace(newText,"{green}","<font color=darkgreen>")
1015
  newText=replace(newText,"{/sienna}","</font>")
1015
  newText=replace(newText,"{/green}","</font>")
1016
  newText=replace(newText,"{red}","<font color=firebrick>")
1016
  newText=replace(newText,"{blue}","<font color=darkblue>")
1017
  newText=replace(newText,"{/red}","</font>")
1017
  newText=replace(newText,"{/blue}","</font>")
1018
  newText=replace(newText,"{pink}","<font color=deeppink>")
1018
  newText=replace(newText,"{sienna}","<font color=sienna>")
1019
  newText=replace(newText,"{/pink}","</font>")
1019
  newText=replace(newText,"{/sienna}","</font>")
1020
 
1020
  newText=replace(newText,"{red}","<font color=firebrick>")
1021
  ' 5/2006
1021
  newText=replace(newText,"{/red}","</font>")
1022
  newText=replace(newText,"[/Drop]","</div></div>")
1022
  newText=replace(newText,"{pink}","<font color=deeppink>")
1023
 
1023
  newText=replace(newText,"{/pink}","</font>")
1024
  '
1024
 
1025
  newText=replace(newText,"{italic}","<I>")
1025
  ' 5/2006
1026
  newText=replace(newText,"{/italic}","</I>")
1026
  newText=replace(newText,"[/Drop]","</div></div>")
1027
  newText=replace(newText,"{bold}","<strong>")
1027
 
1028
  newText=replace(newText,"{/bold}","</strong>")
1028
  '
1029
 
1029
  newText=replace(newText,"{italic}","<I>")
1030
  ' CHANGE SIZE / SCHRIFTGRSSE
1030
  newText=replace(newText,"{/italic}","</I>")
1031
  'SMALLER / KLEINER
1031
  newText=replace(newText,"{bold}","<strong>")
1032
  newText=replace(newText,"{small}","<font size='-1'>")
1032
  newText=replace(newText,"{/bold}","</strong>")
1033
  newText=replace(newText,"{/small}","</font>")
1033
 
1034
  newText=replace(newText,"{smaller}","<font size='-2'>")
1034
  ' CHANGE SIZE / SCHRIFTGRSSE
1035
  newText=replace(newText,"{/smaller}","</font>")
1035
  'SMALLER / KLEINER
1036
  newText=replace(newText,"{smallest}","<font size='-3'>")
1036
  newText=replace(newText,"{small}","<font size='-1'>")
1037
  newText=replace(newText,"{/smallest}","</font>")
1037
  newText=replace(newText,"{/small}","</font>")
1038
  'LARGER / GRSSER
1038
  newText=replace(newText,"{smaller}","<font size='-2'>")
1039
  newText=replace(newText,"{big}","<font size='+1'>")
1039
  newText=replace(newText,"{/smaller}","</font>")
1040
  newText=replace(newText,"{/big}","</font>")
1040
  newText=replace(newText,"{smallest}","<font size='-3'>")
1041
  newText=replace(newText,"{bigger}","<font size='+2'>")
1041
  newText=replace(newText,"{/smallest}","</font>")
1042
  newText=replace(newText,"{/bigger}","</font>")
1042
  'LARGER / GRSSER
1043
  newText=replace(newText,"{biggest}","<font size='+3'>")
1043
  newText=replace(newText,"{big}","<font size='+1'>")
1044
  newText=replace(newText,"{/biggest}","</font>")
1044
  newText=replace(newText,"{/big}","</font>")
1045
 
1045
  newText=replace(newText,"{bigger}","<font size='+2'>")
1046
  ' this is were you can insert your own bracket comands...
1046
  newText=replace(newText,"{/bigger}","</font>")
1047
  newText=replace(newText,"{br}","<br/>")
1047
  newText=replace(newText,"{biggest}","<font size='+3'>")
1048
 
1048
  newText=replace(newText,"{/biggest}","</font>")
1049
 
1049
 
1050
  ' images:
1050
  ' this is were you can insert your own bracket comands...
1051
  newText= imageize(newText)
1051
  newText=replace(newText,"{br}","<br/>")
1052
 
1052
 
1053
  ' isbns:
1053
 
1054
  newText= isbnize(newText)
1054
  ' images:
1055
 
1055
  newText= imageize(newText)
1056
  ' auto-hyperlinks
1056
 
1057
  newText= hyperlink(newText)
1057
  ' isbns:
1058
 
1058
  newText= isbnize(newText)
1059
  ' bold text: three single quotes
1059
 
1060
  newText= replaceBoundingPattern(newText,"'''","b")
1060
  ' auto-hyperlinks
1061
 
1061
  newText= hyperlink(newText)
1062
  ' em text: two single quotes
1062
 
1063
  newText= replaceBoundingPattern(newText,"''","em")
1063
  ' bold text: three single quotes
1064
 
1064
  newText= replaceBoundingPattern(newText,"'''","b")
1065
  ' consolidate a series of trailing vbcrlf to just 2.
1065
 
1066
  gRE.Pattern = "(\r\n){3,}$"
1066
  ' em text: two single quotes
1067
  newText=gRE.Replace(newText, vbcrlf & vbcrlf)
1067
  newText= replaceBoundingPattern(newText,"''","em")
1068
 
1068
 
1069
  If  gDisableScripting = false Then
1069
  ' consolidate a series of trailing vbcrlf to just 2.
1070
    ' 2007.08.25 disable scripts
1070
  gRE.Pattern = "(\r\n){3,}$"
1071
    gRE.Pattern = "<([s|S][c|C][r|R][i|I][p|P][t|T])"
1071
  newText=gRE.Replace(newText, vbcrlf & vbcrlf)
1072
    newText=gRE.Replace(newText, "&lt;$1")
1072
 
1073
  End If
1073
  If  gDisableScripting = false Then
1074
 
1074
    ' 2007.08.25 disable scripts
1075
 
1075
    gRE.Pattern = "<([s|S][c|C][r|R][i|I][p|P][t|T])"
1076
  EmitDebug 11, 4, "xform-after(" &  newText & ")<br/>"
1076
    newText=gRE.Replace(newText, "&lt;$1")
1077
 
1077
  End If
1078
  newText = Replace(newText, "#@91;", "[")
1078
 
1079
  newText = Replace(newText, "#@93;", "]")
1079
 
1080
  newText = Replace(newText, "#@3A;", ":")
1080
  EmitDebug 11, 4, "xform-after(" &  newText & ")<br/>"
1081
  newText = Replace(newText, "#@3C;", "<")
1081
 
1082
  newText = Replace(newText, "#@3E;", ">")
1082
  newText = Replace(newText, "#@91;", "[")
1083
 
1083
  newText = Replace(newText, "#@93;", "]")
1084
  xform = newText
1084
  newText = Replace(newText, "#@3A;", ":")
1085
 
1085
  newText = Replace(newText, "#@3C;", "<")
1086
End Function
1086
  newText = Replace(newText, "#@3E;", ">")
1087
 
1087
 
1088
 
1088
  xform = newText
1089
Function WalkWiki(isTeksten)
1089
 
1090
    Dim myText
1090
End Function
1091
    myText = isTeksten
1091
 
1092
    WalkWiki = myText
1092
 
1093
 
1093
Function WalkWiki(isTeksten)
1094
End Function
1094
    Dim myText
1095
 
1095
    myText = isTeksten
1096
function RemoveBrackets(s)
1096
    WalkWiki = myText
1097
  Dim ts
1097
 
1098
  ts = replace( s, "[","")
1098
End Function
1099
  ts = replace( ts, "]","")
1099
 
1100
  RemoveBrackets = ts
1100
function RemoveBrackets(s)
1101
end function
1101
  Dim ts
1102
 
1102
  ts = replace( s, "[","")
1103
function RemoveSpaces(s)
1103
  ts = replace( ts, "]","")
1104
  Dim ts
1104
  RemoveBrackets = ts
1105
  ts = replace( s, " ","")
1105
end function
1106
  RemoveSpaces = ts
1106
 
1107
end function
1107
function RemoveSpaces(s)
1108
 
1108
  Dim ts
1109
 
1109
  ts = replace( s, " ","")
1110
 
1110
  RemoveSpaces = ts
1111
Sub EmitDebug(sig,lvl,arg)
1111
end function
1112
  If gDebug >= lvl Then Response.Write("debug:" & sig & " " & arg & vbcrlf)
1112
 
1113
End Sub
1113
 
1114
 
1114
 
1115
 
1115
Sub EmitDebug(sig,lvl,arg)
1116
'----------------------------------------------------
1116
  If gDebug >= lvl Then Response.Write("debug:" & sig & " " & arg & vbcrlf)
1117
' This function builds and returns the connection
1117
End Sub
1118
' string, based on input provided from the web form.
1118
 
1119
'
1119
 
1120
function ConnStr(includeMode)
1120
'----------------------------------------------------
1121
  dim localDs
1121
' This function builds and returns the connection
1122
  ' Map MDB database to physical path
1122
' string, based on input provided from the web form.
1123
   if len(gDocRootDir) > 0 then
1123
'
1124
      localDs = gDataSource
1124
function ConnStr(includeMode)
1125
   else
1125
  dim localDs
1126
      localDs = Server.MapPath(gDataSource)
1126
  ' Map MDB database to physical path
1127
   end if
1127
   if len(gDocRootDir) > 0 then
1128
 
1128
      localDs = gDataSource
1129
  ConnStr= "Provider=" & gProvider & ";Data Source=" & localDs & ";"
1129
   else
1130
  if (includeMode) then
1130
      localDs = Server.MapPath(gDataSource)
1131
      ConnStr=   ConnStr & "mode= Share Deny None"
1131
   end if
1132
  end if
1132
 
1133
  EmitDebug 20, 3, "ConnStr= (" &  ConnStr & ")<br/>"
1133
  ConnStr= "Provider=" & gProvider & ";Data Source=" & localDs & ";"
1134
end function
1134
  if (includeMode) then
1135
 
1135
      ConnStr=   ConnStr & "mode= Share Deny None"
1136
 
1136
  end if
1137
 
1137
  EmitDebug 20, 3, "ConnStr= (" &  ConnStr & ")<br/>"
1138
sub CheckDbErrors
1138
end function
1139
  if  gDataConn.errors.count> 0 then
1139
 
1140
    dim counter
1140
 
1141
    response.write "<br/><b>Database Errors Occurred" & "</b><br/>" & vbcrlf
1141
 
1142
    for counter= 0 to gDataConn.errors.count
1142
sub CheckDbErrors
1143
      response.write "Error #" & gDataConn.errors(counter).number & vbcrlf & "<br/>"
1143
  if  gDataConn.errors.count> 0 then
1144
      response.write "  Description(" & gDataConn.errors(counter).description & ")" & vbcrlf & "<br/>"
1144
    dim counter
1145
    next
1145
    response.write "<br/><b>Database Errors Occurred" & "</b><br/>" & vbcrlf
1146
  else
1146
    for counter= 0 to gDataConn.errors.count
1147
    response.write "<br/><b>No Database Errors Occurred" & "</b><br/>" & vbcrlf
1147
      response.write "Error #" & gDataConn.errors(counter).number & vbcrlf & "<br/>"
1148
  end if
1148
      response.write "  Description(" & gDataConn.errors(counter).description & ")" & vbcrlf & "<br/>"
1149
end sub
1149
    next
1150
 
1150
  else
1151
 
1151
    response.write "<br/><b>No Database Errors Occurred" & "</b><br/>" & vbcrlf
1152
' Elrey Ronald  2/21/05
1152
  end if
1153
sub VerifyWikiTableNoAdoxComponent
1153
end sub
1154
  on error resume next
1154
 
1155
  gDataConn.Open ConnStr(0)
1155
 
1156
  on error goto 0
1156
' Elrey Ronald  2/21/05
1157
 
1157
sub VerifyWikiTableNoAdoxComponent
1158
  on error resume next
1158
  on error resume next
1159
  gDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")
1159
  gDataConn.Open ConnStr(0)
1160
  on error goto 0
1160
  on error goto 0
1161
 
1161
 
1162
end sub
1162
  on error resume next
1163
 
1163
  gDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")
1164
'----------------------------------------------------------------------------
1164
  on error goto 0
1165
' VerifyWikiTable
1165
 
1166
' This routine:
1166
end sub
1167
' (a) verifies the existence of the target database (dbname) at the given
1167
 
1168
'     ADO connection.  If necessary, this routine creates that
1168
'----------------------------------------------------------------------------
1169
'     database.
1169
' VerifyWikiTable
1170
' (b) verifies the existence of the table in that database.  If necessary,
1170
' This routine:
1171
'     this routine will create the required table, and build the table
1171
' (a) verifies the existence of the target database (dbname) at the given
1172
'     structure.  The columns in the target table are determined by the
1172
'     ADO connection.  If necessary, this routine creates that
1173
'     fields in the source record set (sourceRs).   Two additional
1173
'     database.
1174
'     columns are also added. (in fact we do not use the entire recordset,
1174
' (b) verifies the existence of the table in that database.  If necessary,
1175
'     but only the collection of fields in the recordset.
1175
'     this routine will create the required table, and build the table
1176
'
1176
'     structure.  The columns in the target table are determined by the
1177
 
1177
'     fields in the source record set (sourceRs).   Two additional
1178
sub VerifyWikiTable
1178
'     columns are also added. (in fact we do not use the entire recordset,
1179
  if not gAutoCreateMdb then
1179
'     but only the collection of fields in the recordset.
1180
     Call VerifyWikiTableNoAdoxComponent
1180
'
1181
     Exit Sub
1181
 
1182
  End If
1182
sub VerifyWikiTable
1183
  dim tbl, cat, dbname, fso
1183
  if not gAutoCreateMdb then
1184
  dim fsoErrMessage, adoxErrMessage, instructions
1184
     Call VerifyWikiTableNoAdoxComponent
1185
 
1185
     Exit Sub
1186
  fsoErrMessage  = "<font color=red >ERROR: Directory or MS Access File can not be created! Automatic DB creation is not possible. Your server is missing the needed <b>FileSystemObject component</b>.</font><BR>"
1186
  End If
1187
  adoxErrMessage = "<font color=red >ERROR: Database file can not be created! Some file actions are disabled. Your server is missing the needed <b>ADOX.Catalog component</b>.</font><BR>"
1187
  dim tbl, cat, dbname, fso
1188
  instructions =   "<LI>You may have to <b>MANUALLY</b> create the folder/MsAccess file -> <b>" & gDataSource & " </b> </LI>"  & _
1188
  dim fsoErrMessage, adoxErrMessage, instructions
1189
                   "<LI>You may modify 'gDefaultIcon', 'gDefaultHomePage' variables in the WikiAsp program to view your default icon and access the proper Ms Access file (mdb).</LI>" & _
1189
 
1190
                   "<LI>You may modify 'gAutoCreateMdb' and set it to false to prevent creation of MDB and avoid this message." & _
1190
  fsoErrMessage  = "<font color=red >ERROR: Directory or MS Access File can not be created! Automatic DB creation is not possible. Your server is missing the needed <b>FileSystemObject component</b>.</font><BR>"
1191
                   "<LI>The program will attempt to continue using default values, if this works you can just remove these comments from the program (look for VerifyWikiTable  subroutine).</LI>" & _
1191
  adoxErrMessage = "<font color=red >ERROR: Database file can not be created! Some file actions are disabled. Your server is missing the needed <b>ADOX.Catalog component</b>.</font><BR>"
1192
                   "<BR><BR><B><i>Now trying to use default values to see if this would work...</i></B>"
1192
  instructions =   "<LI>You may have to <b>MANUALLY</b> create the folder/MsAccess file -> <b>" & gDataSource & " </b> </LI>"  & _
1193
 
1193
                   "<LI>You may modify 'gDefaultIcon', 'gDefaultHomePage' variables in the WikiAsp program to view your default icon and access the proper Ms Access file (mdb).</LI>" & _
1194
  err.clear
1194
                   "<LI>You may modify 'gAutoCreateMdb' and set it to false to prevent creation of MDB and avoid this message." & _
1195
  ' Check if ADOX.Catalog component is available in this computer
1195
                   "<LI>The program will attempt to continue using default values, if this works you can just remove these comments from the program (look for VerifyWikiTable  subroutine).</LI>" & _
1196
  on error resume next
1196
                   "<BR><BR><B><i>Now trying to use default values to see if this would work...</i></B>"
1197
  set cat= CreateObject("ADOX.Catalog")
1197
 
1198
  on error goto 0
1198
  err.clear
1199
 
1199
  ' Check if ADOX.Catalog component is available in this computer
1200
  ' Check if FileSystemObject component is available in this computer
1200
  on error resume next
1201
  on error resume next
1201
  set cat= CreateObject("ADOX.Catalog")
1202
  set fso = CreateObject("Scripting.FileSystemObject")
1202
  on error goto 0
1203
  on error goto 0
1203
 
1204
 
1204
  ' Check if FileSystemObject component is available in this computer
1205
  If Not IsObject(cat) or cat is nothing Then
1205
  on error resume next
1206
     Response.Write( adoxErrMessage)
1206
  set fso = CreateObject("Scripting.FileSystemObject")
1207
     Response.Write( instructions )
1207
  on error goto 0
1208
     Call VerifyWikiTableNoAdoxComponent
1208
 
1209
     Exit Sub
1209
  If Not IsObject(cat) or cat is nothing Then
1210
  End If
1210
     Response.Write( adoxErrMessage)
1211
 
1211
     Response.Write( instructions )
1212
  err.clear
1212
     Call VerifyWikiTableNoAdoxComponent
1213
  If Not IsObject(fso)  Then
1213
     Exit Sub
1214
     Response.Write( fsoErrMessage)
1214
  End If
1215
     Response.Write( instructions )
1215
 
1216
     Call VerifyWikiTableNoAdoxComponent
1216
  err.clear
1217
     Exit Sub
1217
  If Not IsObject(fso)  Then
1218
  End If
1218
     Response.Write( fsoErrMessage)
1219
 
1219
     Response.Write( instructions )
1220
  if len (gDocRootDir) > 0 then
1220
     Call VerifyWikiTableNoAdoxComponent
1221
    dbname = gDataSource
1221
     Exit Sub
1222
  else
1222
  End If
1223
    dbname = Server.MapPath(gDataSource)
1223
 
1224
  end if
1224
  if len (gDocRootDir) > 0 then
1225
 
1225
    dbname = gDataSource
1226
  '--------------------------------------------
1226
  else
1227
  ' step 0: check the directory, create if necessary
1227
    dbname = Server.MapPath(gDataSource)
1228
  dim folder, f1
1228
  end if
1229
  if len (gDocRootDir) > 0 then
1229
 
1230
    f1 = gDocRootDir & "\" & gDataSourceDir
1230
  '--------------------------------------------
1231
  else
1231
  ' step 0: check the directory, create if necessary
1232
    f1 = Server.MapPath(gDataSourceDir)
1232
  dim folder, f1
1233
  end if
1233
  if len (gDocRootDir) > 0 then
1234
  if not fso.FolderExists(f1) then
1234
    f1 = gDocRootDir & "\" & gDataSourceDir
1235
      on error resume next
1235
  else
1236
      Set folder = fso.CreateFolder(f1)
1236
    f1 = Server.MapPath(gDataSourceDir)
1237
      on error goto 0
1237
  end if
1238
      If Not IsObject(folder) Then
1238
  if not fso.FolderExists(f1) then
1239
         Response.Write( "Unable to create [" & f1 & "].  Please modify DOCROOT and gDataSourceDir in the program. Consult your website settings." )
1239
      on error resume next
1240
         Response.End
1240
      Set folder = fso.CreateFolder(f1)
1241
      End If
1241
      on error goto 0
1242
      set folder = nothing
1242
      If Not IsObject(folder) Then
1243
  end if
1243
         Response.Write( "Unable to create [" & f1 & "].  Please modify DOCROOT and gDataSourceDir in the program. Consult your website settings." )
1244
  set fso = nothing
1244
         Response.End
1245
  '---- some security here
1245
      End If
1246
 
1246
      set folder = nothing
1247
  If gDataSourceFile <> gDefaultHomePage Then
1247
  end if
1248
 
1248
  set fso = nothing
1249
    ' Expecting delVerified=1 for deletion confirmation
1249
  '---- some security here
1250
    If Request.QueryString("dbCreate") <> "1" Then
1250
 
1251
      Response.Write("<center><h2>Database Creation</h2></center><hr>")
1251
  If gDataSourceFile <> gDefaultHomePage Then
1252
      Response.Write("<center>")
1252
 
1253
      If gHideLogin Then
1253
    ' Expecting delVerified=1 for deletion confirmation
1254
          Response.Write("The Database --> <b>" &  gDataSource & "</b> <--- Cannot be created on this Server")
1254
    If Request.QueryString("dbCreate") <> "1" Then
1255
          Response.Write("<br><a href='" & gScript & "'><button>Return to Home</button></a>")
1255
      Response.Write("<center><h2>Database Creation</h2></center><hr>")
1256
      ElseIf NOT gEnableEdit Then
1256
      Response.Write("<center>")
1257
          Response.Write("The Database --> <b>" &  gDataSource & "</b> <--- Cannot be created until you enable editing")
1257
      If gHideLogin Then
1258
          Response.Write("<br><a href='" & gScript & "'><button>Return to Home</button></a>")
1258
          Response.Write("The Database --> <b>" &  gDataSource & "</b> <--- Cannot be created on this Server")
1259
      Else
1259
          Response.Write("<br><a href='" & gScript & "'><button>Return to Home</button></a>")
1260
          Response.Write("<br><br><span style='border: solid 5px red; padding: 10px;display:inline-block'>")
1260
      ElseIf NOT gEnableEdit Then
1261
          response.write("Create Database --> <b>" &  gDataSource & "</b>  <---")
1261
          Response.Write("The Database --> <b>" &  gDataSource & "</b> <--- Cannot be created until you enable editing")
1262
          Response.Write("<p align=left>Folder: " & f1 & ".")
1262
          Response.Write("<br><a href='" & gScript & "'><button>Return to Home</button></a>")
1263
          Response.Write("<br>DataBase: " & gDataSource & ".")
1263
      Else
1264
          response.write("<p>Are your sure that you wish to continue!")
1264
          Response.Write("<br><br><span style='border: solid 5px red; padding: 10px;display:inline-block'>")
1265
          response.write( "<br><br><a href='" & gScriptURL & "&dbCreate=1'><button style='color:red'>Create Database.</button></a>" )
1265
          response.write("Create Database --> <b>" &  gDataSource & "</b>  <---")
1266
          response.write( "&nbsp;&nbsp;<a href='" & gScript & "'><button>No,  don't create it.</button></a>" )
1266
          Response.Write("<p align=left>Folder: " & f1 & ".")
1267
          response.write( "</span>" )
1267
          Response.Write("<br>DataBase: " & gDataSource & ".")
1268
      End If
1268
          response.write("<p>Are your sure that you wish to continue!")
1269
      Response.Write("</center>")
1269
          response.write( "<br><br><a href='" & gScriptURL & "&dbCreate=1'><button style='color:red'>Create Database.</button></a>" )
1270
      Response.End
1270
          response.write( "&nbsp;&nbsp;<a href='" & gScript & "'><button>No,  don't create it.</button></a>" )
1271
    End If
1271
          response.write( "</span>" )
1272
  End If
1272
      End If
1273
 
1273
      Response.Write("</center>")
1274
  '--------------------------------------------
1274
      Response.End
1275
  ' step 1: create the new db catalog, if necessary
1275
    End If
1276
  Err.Clear
1276
  End If
1277
  EmitDebug 21, 2, vbcrlf & " creating db " & dbname & "<br/>"
1277
 
1278
  on error resume next
1278
  '--------------------------------------------
1279
  cat.Create ConnStr(0)
1279
  ' step 1: create the new db catalog, if necessary
1280
  on error goto 0
1280
  Err.Clear
1281
  EmitDebug 22, 2, ">> error(" & err.Number & "," & err.Description &  ")<br/>"
1281
  EmitDebug 21, 2, vbcrlf & " creating db " & dbname & "<br/>"
1282
  'EmitDebug 23, 2, vbcrlf & " catConnErrorCount(" & _
1282
  on error resume next
1283
  '    cat.ActiveConnection.errors.count  & ")<br/>"
1283
  cat.Create ConnStr(0)
1284
 
1284
  on error goto 0
1285
  if not (err.Number = 0) then
1285
  EmitDebug 22, 2, ">> error(" & err.Number & "," & err.Description &  ")<br/>"
1286
    if not (err.Description = "Database already exists." ) then
1286
  'EmitDebug 23, 2, vbcrlf & " catConnErrorCount(" & _
1287
      dim sError
1287
  '    cat.ActiveConnection.errors.count  & ")<br/>"
1288
      sError = ">> error(" & err.Number & "," & err.Description & ")" & _
1288
 
1289
          "(EXPECTED ""Database already exists"")..." & "<br/>"
1289
  if not (err.Number = 0) then
1290
      EmitDebug 24, 2, sError
1290
    if not (err.Description = "Database already exists." ) then
1291
      Response.Write( "<span style='color:red'>Fatal error creating db: " & err.Number & " " & err.description & "</span>")
1291
      dim sError
1292
    else
1292
      sError = ">> error(" & err.Number & "," & err.Description & ")" & _
1293
      EmitDebug 25, 2, ">> Database already exists..." & "<br/>"
1293
          "(EXPECTED ""Database already exists"")..." & "<br/>"
1294
      cat.ActiveConnection= ConnStr(0)
1294
      EmitDebug 24, 2, sError
1295
    end if
1295
      Response.Write( "<span style='color:red'>Fatal error creating db: " & err.Number & " " & err.description & "</span>")
1296
  else
1296
    else
1297
    EmitDebug 26, 2, ">> Database has just been created..." & "<br/>"
1297
      EmitDebug 25, 2, ">> Database already exists..." & "<br/>"
1298
  end if
1298
      cat.ActiveConnection= ConnStr(0)
1299
  EmitDebug 27, 2, " Database now exists..." & "<br/>"
1299
    end if
1300
 
1300
  else
1301
 
1301
    EmitDebug 26, 2, ">> Database has just been created..." & "<br/>"
1302
  '--------------------------------------------
1302
  end if
1303
  ' step 2: create the new table, with columns, if necessary
1303
  EmitDebug 27, 2, " Database now exists..." & "<br/>"
1304
  Err.Clear
1304
 
1305
  EmitDebug 28, 2, " verifying presence of table(" & gDbTableName & ")<br/>"
1305
 
1306
  'if not isNothing(gDataConn) then set gDataConn = nothing
1306
  '--------------------------------------------
1307
  on error resume next
1307
  ' step 2: create the new table, with columns, if necessary
1308
  set gDataConn = Server.CreateObject("ADODB.Connection")
1308
  Err.Clear
1309
  on error goto 0
1309
  EmitDebug 28, 2, " verifying presence of table(" & gDbTableName & ")<br/>"
1310
  If Not IsObject(gDataConn) Then
1310
  'if not isNothing(gDataConn) then set gDataConn = nothing
1311
    Response.Write ( "Unable to establish connection. Missing ADO object.")
1311
  on error resume next
1312
    Response.End
1312
  set gDataConn = Server.CreateObject("ADODB.Connection")
1313
  End If
1313
  on error goto 0
1314
 
1314
  If Not IsObject(gDataConn) Then
1315
  on error resume next
1315
    Response.Write ( "Unable to establish connection. Missing ADO object.")
1316
  gDataConn.Open ConnStr(0)
1316
    Response.End
1317
  on error goto 0
1317
  End If
1318
 
1318
 
1319
 
1319
  on error resume next
1320
  on error resume next
1320
  gDataConn.Open ConnStr(0)
1321
  gDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")
1321
  on error goto 0
1322
  on error goto 0
1322
 
1323
 
1323
 
1324
  if (0 = gDataConn.errors.count) then
1324
  on error resume next
1325
      EmitDebug 29, 1, vbcrlf & "(no db errors, ergo table exists)"  & "<br/>"
1325
  gDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")
1326
  elseif ((gDataConn.errors.count>0) and ( ADOERROR_NOTABLE = gDataConn.errors(0).number)) then
1326
  on error goto 0
1327
      set gDataConn = nothing
1327
 
1328
      ' error: table does not exist.
1328
  if (0 = gDataConn.errors.count) then
1329
      EmitDebug 30, 2, vbcrlf & " creating table " & gDbTableName  & "<br/>"
1329
      EmitDebug 29, 1, vbcrlf & "(no db errors, ergo table exists)"  & "<br/>"
1330
      Dim idx 'As New ADOX.Index
1330
  elseif ((gDataConn.errors.count>0) and ( ADOERROR_NOTABLE = gDataConn.errors(0).number)) then
1331
      set idx= CreateObject("ADOX.Index")
1331
      set gDataConn = nothing
1332
      ' now, create a new table in the db:
1332
      ' error: table does not exist.
1333
      set tbl= CreateObject("ADOX.Table")
1333
      EmitDebug 30, 2, vbcrlf & " creating table " & gDbTableName  & "<br/>"
1334
      With tbl
1334
      Dim idx 'As New ADOX.Index
1335
      ' drop tbl into a MDB provider context; need to do this NOW
1335
      set idx= CreateObject("ADOX.Index")
1336
      ' to be able to use autoIncrement, later.
1336
      ' now, create a new table in the db:
1337
      set .ParentCatalog = cat
1337
      set tbl= CreateObject("ADOX.Table")
1338
 
1338
      With tbl
1339
      ' Name the new table.
1339
      ' drop tbl into a MDB provider context; need to do this NOW
1340
      .Name = gDbTableName
1340
      ' to be able to use autoIncrement, later.
1341
 
1341
      set .ParentCatalog = cat
1342
      .Columns.Append "ID", 3
1342
 
1343
      .Columns("ID").Properties("AutoIncrement") = True
1343
      ' Name the new table.
1344
 
1344
      .Name = gDbTableName
1345
      .Columns.Append "Title", 202, 127
1345
 
1346
      .Columns.Append "PageData", 203
1346
      .Columns.Append "ID", 3
1347
      .Columns.Append "PrevPageData", 203
1347
      .Columns("ID").Properties("AutoIncrement") = True
1348
      .Columns("PrevPageData").Properties("Jet OLEDB:Allow Zero Length") = True
1348
 
1349
      .Columns("PrevPageData").Properties("Nullable") = True
1349
      .Columns.Append "Title", 202, 127
1350
      .Columns.Append "LastUpdate", 7     ' timestamp
1350
      .Columns.Append "PageData", 203
1351
      .Columns.Append "LastEditor", 202, 127
1351
      .Columns.Append "PrevPageData", 203
1352
 
1352
      .Columns("PrevPageData").Properties("Jet OLEDB:Allow Zero Length") = True
1353
      ' create the Primary Key :
1353
      .Columns("PrevPageData").Properties("Nullable") = True
1354
      idx.Name = "RecordIndex"
1354
      .Columns.Append "LastUpdate", 7     ' timestamp
1355
      idx.Columns.Append "ID"
1355
      .Columns.Append "LastEditor", 202, 127
1356
      idx.PrimaryKey = True
1356
 
1357
      idx.Unique = True
1357
      ' create the Primary Key :
1358
      .Indexes.Append idx
1358
      idx.Name = "RecordIndex"
1359
 
1359
      idx.Columns.Append "ID"
1360
 
1360
      idx.PrimaryKey = True
1361
 
1361
      idx.Unique = True
1362
      End With
1362
      .Indexes.Append idx
1363
 
1363
 
1364
      ' this appends the table to the db catalog
1364
 
1365
      cat.Tables.Append  tbl
1365
 
1366
      EmitDebug 31, 2, vbcrlf & " post-append: catConnErrorCount(" & _
1366
      End With
1367
      cat.ActiveConnection.errors.count  & ")<br/>"
1367
 
1368
 
1368
      ' this appends the table to the db catalog
1369
      set idx= nothing
1369
      cat.Tables.Append  tbl
1370
 
1370
      EmitDebug 31, 2, vbcrlf & " post-append: catConnErrorCount(" & _
1371
      ' insert the first record into the newly-created table
1371
      cat.ActiveConnection.errors.count  & ")<br/>"
1372
      EmitDebug 32, 2,  ">> inserting into table(" & gDbTableName  & ")<br/>"
1372
 
1373
 
1373
      set idx= nothing
1374
      set gDataConn = Server.CreateObject("ADODB.Connection")
1374
 
1375
      gDataConn.Open ConnStr(1)
1375
      ' insert the first record into the newly-created table
1376
 
1376
      EmitDebug 32, 2,  ">> inserting into table(" & gDbTableName  & ")<br/>"
1377
      dts = Now
1377
 
1378
      EmitDebug 33, 2,  ">> the time is now(" & dts  & ")<br/>"
1378
      set gDataConn = Server.CreateObject("ADODB.Connection")
1379
 
1379
      gDataConn.Open ConnStr(1)
1380
      DoInitialPageCreation(".")
1380
 
1381
 
1381
      dts = Now
1382
  else
1382
      EmitDebug 33, 2,  ">> the time is now(" & dts  & ")<br/>"
1383
      EmitDebug 34, 2,  ">> table " & tablename & " already exists?" & "<br/>"
1383
 
1384
  end if
1384
      DoInitialPageCreation(".")
1385
 
1385
 
1386
  set cat = nothing
1386
  else
1387
  set tbl = nothing
1387
      EmitDebug 34, 2,  ">> table " & tablename & " already exists?" & "<br/>"
1388
  on error goto  0
1388
  end if
1389
 
1389
 
1390
end sub
1390
  set cat = nothing
1391
 
1391
  set tbl = nothing
1392
 
1392
  on error goto  0
1393
Function DoInitialPageCreation(folderspec)
1393
 
1394
  Dim fso, f, f1, fc, s, dts, sPageData, fPage, stmnt
1394
end sub
1395
  Set fso = CreateObject( "Scripting.FileSystemObject" )
1395
 
1396
 
1396
 
1397
  EmitDebug 35, 2,  ">> checking dir (" & Server.MapPath(folderspec) & ")<br/>"
1397
Function DoInitialPageCreation(folderspec)
1398
  Set f = fso.GetFolder(Server.MapPath(folderspec))
1398
  Dim fso, f, f1, fc, s, dts, sPageData, fPage, stmnt
1399
  Set fc = f.Files
1399
  Set fso = CreateObject( "Scripting.FileSystemObject" )
1400
  EmitDebug 36, 2,  ">> files counted (" & fc.Count & ")<br/>"
1400
 
1401
  For Each f1 in fc
1401
  EmitDebug 35, 2,  ">> checking dir (" & Server.MapPath(folderspec) & ")<br/>"
1402
    if (Right(f1.name, 4) = ".wik") then
1402
  Set f = fso.GetFolder(Server.MapPath(folderspec))
1403
        s = Left(f1.name, Len(f1.name)-4)
1403
  Set fc = f.Files
1404
        EmitDebug 37, 2,  ">> found file  (" & s & ")<br/>"
1404
  EmitDebug 36, 2,  ">> files counted (" & fc.Count & ")<br/>"
1405
        on error resume next
1405
  For Each f1 in fc
1406
        set fPage= fso.OpenTextFile(Server.MapPath(f1.name),FOR_READING)
1406
    if (Right(f1.name, 4) = ".wik") then
1407
        sPageData = fPage.ReadAll
1407
        s = Left(f1.name, Len(f1.name)-4)
1408
        on error goto 0
1408
        EmitDebug 37, 2,  ">> found file  (" & s & ")<br/>"
1409
        fPage.Close
1409
        on error resume next
1410
        set fPage = nothing
1410
        set fPage= fso.OpenTextFile(Server.MapPath(f1.name),FOR_READING)
1411
        dts = Now  ' timestamp
1411
        sPageData = fPage.ReadAll
1412
        EmitDebug 38, 2,  ">> inserting record (" & s & ")<br/>"
1412
        on error goto 0
1413
 
1413
        fPage.Close
1414
        stmnt = "INSERT INTO " & gDbTableName & " (Title,PageData,PrevPageData,LastUpdate,LastEditor) " & _
1414
        set fPage = nothing
1415
        "VALUES ( '" & s & "','" & safeQuote(sPageData) & "', '--', '" & dts & "', '" & gScript & " (initial creation)');"
1415
        dts = Now  ' timestamp
1416
        on error resume next
1416
        EmitDebug 38, 2,  ">> inserting record (" & s & ")<br/>"
1417
        gDataConn.execute(stmnt)
1417
 
1418
        on error goto 0
1418
        stmnt = "INSERT INTO " & gDbTableName & " (Title,PageData,PrevPageData,LastUpdate,LastEditor) " & _
1419
        if gDebug>=1 then CheckDbErrors
1419
        "VALUES ( '" & s & "','" & safeQuote(sPageData) & "', '--', '" & dts & "', '" & gScript & " (initial creation)');"
1420
    end if
1420
        on error resume next
1421
  Next
1421
        gDataConn.execute(stmnt)
1422
  set fso = nothing
1422
        on error goto 0
1423
  set f = nothing
1423
        if gDebug>=1 then CheckDbErrors
1424
  set fc = nothing
1424
    end if
1425
 
1425
  Next
1426
end Function
1426
  set fso = nothing
1427
 
1427
  set f = nothing
1428
 
1428
  set fc = nothing
1429
 
1429
 
1430
function theWhereClause(theStr)
1430
end Function
1431
  dim result
1431
 
1432
  result= ""
1432
 
1433
  dim myArray
1433
 
1434
  dim element
1434
function theWhereClause(theStr)
1435
  EmitDebug 39, 1, "whereClause(" & theStr & ")<br/>" & vbcrlf
1435
  dim result
1436
 
1436
  result= ""
1437
  myArray = split(Trim(theStr), " ")
1437
  dim myArray
1438
  for each element in myArray
1438
  dim element
1439
    element = Trim(element)
1439
  EmitDebug 39, 1, "whereClause(" & theStr & ")<br/>" & vbcrlf
1440
    if (result = "") then
1440
 
1441
      result = " where "
1441
  myArray = split(Trim(theStr), " ")
1442
    else
1442
  for each element in myArray
1443
      result = result & " and "
1443
    element = Trim(element)
1444
    end if
1444
    if (result = "") then
1445
    result= result &  " PageData like '%" & element & "%'"
1445
      result = " where "
1446
  next
1446
    else
1447
  EmitDebug 40, 1, "whereClause:result(" & result & ")<br/>" & vbcrlf
1447
      result = result & " and "
1448
  theWhereClause = result
1448
    end if
1449
 
1449
    result= result &  " PageData like '%" & element & "%'"
1450
end function
1450
  next
1451
 
1451
  EmitDebug 40, 1, "whereClause:result(" & result & ")<br/>" & vbcrlf
1452
sub handleLogout
1452
  theWhereClause = result
1453
    Dim url
1453
 
1454
    url = gScriptURL & "&o=" & glsTopic
1454
end function
1455
    gEnableEdit = false
1455
 
1456
    Session.Abandon
1456
sub handleLogout
1457
    Response.Redirect(url)
1457
    Dim url
1458
end sub
1458
    url = gScriptURL & "&o=" & glsTopic
1459
 
1459
    gEnableEdit = false
1460
sub handleLogin
1460
    Session.Abandon
1461
    Dim url
1461
    Response.Redirect(url)
1462
    url = gScriptURL & "&o=" & glsTopic
1462
end sub
1463
    gEnableEdit = true
1463
 
1464
    Session("login") = 1
1464
sub handleLogin
1465
    Response.Redirect(url)
1465
    Dim url
1466
end sub
1466
    url = gScriptURL & "&o=" & glsTopic
1467
 
1467
    gEnableEdit = true
1468
sub handleEdit
1468
    Session("login") = 1
1469
    If NOT gEnableEdit Then
1469
    Response.Redirect(url)
1470
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")
1470
end sub
1471
        Response.End
1471
 
1472
        exit sub
1472
sub handleEdit
1473
    End If
1473
    If NOT gEnableEdit Then
1474
 
1474
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")
1475
    If IsRemoteBlackListed Then
1475
        Response.End
1476
 
1476
        exit sub
1477
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Please send e-mail to this site's Web Master ASAP.</h2></center>")
1477
    End If
1478
        Response.End
1478
 
1479
        Exit Sub
1479
    If IsRemoteBlackListed Then
1480
 
1480
 
1481
    End If
1481
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Please send e-mail to this site's Web Master ASAP.</h2></center>")
1482
 
1482
        Response.End
1483
      sqlQuery = "select PageData,Title, lastupdate, PrevPageData from " & gDbTableName & " where title='" & glsTopic & "'"
1483
        Exit Sub
1484
      EmitDebug 41, 2, "Edit query(" & sqlQuery & ")<br/>" & vbcrlf
1484
 
1485
 
1485
    End If
1486
      'set rs = gDataConn.execute(sqlQuery)
1486
 
1487
      set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1487
      sqlQuery = "select PageData,Title, lastupdate, PrevPageData from " & gDbTableName & " where title='" & glsTopic & "'"
1488
      
1488
      EmitDebug 41, 2, "Edit query(" & sqlQuery & ")<br/>" & vbcrlf
1489
      
1489
 
1490
      dim strPageData, strTitle, strLastUpdate, strPrevPageData
1490
      'set rs = gDataConn.execute(sqlQuery)
1491
 
1491
      set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1492
      if not rs.eof then
1492
      
1493
         'page exists
1493
      
1494
          strTitle = rs("title")
1494
      dim strPageData, strTitle, strLastUpdate, strPrevPageData
1495
          strPageData = rs("pageData")
1495
 
1496
          strLastUpdate = CStr(rs("lastupdate"))
1496
      if not rs.eof then
1497
          strPrevPageData = rs("PrevPageData")
1497
         'page exists
1498
      else
1498
          strTitle = rs("title")
1499
          'page does not exist
1499
          strPageData = rs("pageData")
1500
          strTitle = glsTopic
1500
          strLastUpdate = CStr(rs("lastupdate"))
1501
          strPageData = ""
1501
          strPrevPageData = rs("PrevPageData")
1502
          strLastUpdate = ""
1502
      else
1503
          strPrevPageData = ""
1503
          'page does not exist
1504
      end if
1504
          strTitle = glsTopic
1505
 
1505
          strPageData = ""
1506
     'If Not gHideWikiSource Then
1506
          strLastUpdate = ""
1507
              response.write("<form id=form1 name=form1 method=""POST"" action=""" & gScript & """>" & vbcrlf)
1507
          strPrevPageData = ""
1508
              response.write "<h4>Edit: <font color=blue>&nbsp;" & SpaceName(strTitle) & "</font>&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit value=Save>&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'></h4>"  & vbcrlf
1508
      end if
1509
              ' [MARKUS - replace virtual with hard]
1509
 
1510
              response.write("<textarea id=""pagetext""  name=""pagetext"" rows='" & giEditAreaRows & "'  cols='" & giEditAreaCols & _
1510
     'If Not gHideWikiSource Then
1511
                "'  style='width:100%'>"  & _
1511
              response.write("<form id=form1 name=form1 method=""POST"" action=""" & gScript & """>" & vbcrlf)
1512
                Server.HtmlEncode(strPageData) & _
1512
              response.write "<h4>Edit: <font color=blue>&nbsp;" & SpaceName(strTitle) & "</font>&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit value=Save>&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'></h4>"  & vbcrlf
1513
                "</textarea>" & vbcrlf & _
1513
              ' [MARKUS - replace virtual with hard]
1514
                "<br/> <input type=submit value=' Save '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & _
1514
              response.write("<textarea id=""pagetext""  name=""pagetext"" rows='" & giEditAreaRows & "'  cols='" & giEditAreaCols & _
1515
                "<br/></br/> "  & _
1515
                "'  style='width:100%'>"  & _
1516
                vbcrlf & "<input type=hidden name=lupdt value='" & strLastUpdate & "'>" & _
1516
                Server.HtmlEncode(strPageData) & _
1517
                vbcrlf & "<input type=hidden name=o value='" & strTitle & "'>" & _
1517
                "</textarea>" & vbcrlf & _
1518
                vbcrlf & "<input type=hidden name=db value='" & gDataSourceFile & "'>" & _
1518
                "<br/> <input type=submit value=' Save '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & _
1519
                vbcrlf & "<input type=hidden name=hiddenInput value='errv2010'>" & _
1519
                "<br/></br/> "  & _
1520
                vbcrlf & "<input type=hidden name=dbname value='" & gDataSourceName & "'>" & _
1520
                vbcrlf & "<input type=hidden name=lupdt value='" & strLastUpdate & "'>" & _
1521
                vbcrlf & "<input type=hidden name='a' value='save'>" & vbcrlf )
1521
                vbcrlf & "<input type=hidden name=o value='" & strTitle & "'>" & _
1522
 
1522
                vbcrlf & "<input type=hidden name=db value='" & gDataSourceFile & "'>" & _
1523
 
1523
                vbcrlf & "<input type=hidden name=hiddenInput value='errv2010'>" & _
1524
 
1524
                vbcrlf & "<input type=hidden name=dbname value='" & gDataSourceName & "'>" & _
1525
    'End If
1525
                vbcrlf & "<input type=hidden name='a' value='save'>" & vbcrlf )
1526
 
1526
 
1527
    If gHideWikiSource then
1527
 
1528
       exit sub
1528
 
1529
    end if
1529
    'End If
1530
 
1530
 
1531
    'History of changes
1531
    Session("CurrentEditPage") = "# "  & strTitle 
1532
    response.write("<br><br><br><br><br><h3>History of Changes:</h3><textarea readonly style='font-size:8pt; background:silver;' rows='" & giEditAreaRows & "' cols='" & giEditAreaCols & _
1532
    If gHideWikiSource then
1533
    "'  style='width:100%'>" & strPrevPageData & "</textarea>")
1533
       exit sub
1534
 
1534
    end if
1535
    'Original Text
1535
 
1536
    response.Write("<textarea name=""pagetextorig"" rows=0 cols=0 style='width:0;'>" & strPageData & "</textarea></form>" )
1536
    'History of changes
1537
    response.Write("<script language=javascript>form1.pagetext.rows=window.screen.height/26;</script>")
1537
    response.write("<br><br><br><br><br><h3>History of Changes:</h3><textarea readonly style='font-size:8pt; background:silver;' rows='" & giEditAreaRows & "' cols='" & giEditAreaCols & _
1538
 
1538
    "'  style='width:100%'>" & strPrevPageData & "</textarea>")
1539
    Session("CurrentEditPage") = "# "  & strTitle 
1539
 
1540
end sub
1540
    'Original Text
1541
 
1541
    response.Write("<textarea name=""pagetextorig"" rows=0 cols=0 style='width:0;'>" & strPageData & "</textarea></form>" )
1542
 
1542
    response.Write("<script language=javascript>form1.pagetext.rows=window.screen.height/26;</script>")
1543
sub handleSearch
1543
 
1544
 
1544
end sub
1545
  dim pageTitle, s
1545
 
1546
  's= Request.QueryString("o")  BUG - Fri, 2002 jan 22 - Dan Shaw
1546
 
1547
  s= glsTopic
1547
sub handleSearch
1548
  if not isEmpty(s) then
1548
 
1549
    EmitDebug 42, 2, "<br/>SEARCH(" & s & ")<br/>" & vbcrlf
1549
  dim pageTitle, s
1550
    pageTitle = "Search Results (" & s & ")"
1550
  's= Request.QueryString("o")  BUG - Fri, 2002 jan 22 - Dan Shaw
1551
    dim myClause
1551
  s= glsTopic
1552
    myClause= theWhereClause(s)
1552
  if not isEmpty(s) then
1553
    sqlQuery="select ID, Title, LastUpdate , LastEditor from " & gDbTableName & myClause & " order by Title"
1553
    EmitDebug 42, 2, "<br/>SEARCH(" & s & ")<br/>" & vbcrlf
1554
  end if
1554
    pageTitle = "Search Results (" & s & ")"
1555
 
1555
    dim myClause
1556
  EmitTabularOutput pageTitle, ""
1556
    myClause= theWhereClause(s)
1557
 
1557
    sqlQuery="select ID, Title, LastUpdate , LastEditor from " & gDbTableName & myClause & " order by Title"
1558
end sub
1558
  end if
1559
 
1559
 
1560
'ElreyRonald 4/2004
1560
  EmitTabularOutput pageTitle, ""
1561
Sub HandleDelete
1561
 
1562
    Dim sh
1562
end sub
1563
    sh = "<br><a href='" & gScriptURL & "' >Click here proceed to home page</a>"
1563
 
1564
 
1564
'ElreyRonald 4/2004
1565
  ' Expecting delVerified=1 for deletion confirmation
1565
Sub HandleDelete
1566
  Response.Write("<center><h2>Page Deletion</h2></center><hr>")
1566
    Dim sh
1567
  Response.Write("<center>")
1567
    sh = "<br><a href='" & gScriptURL & "' >Click here proceed to home page</a>"
1568
 
1568
 
1569
  If Request.QueryString("delVerified") <> 1  Then
1569
  ' Expecting delVerified=1 for deletion confirmation
1570
    if gHideLogin Then
1570
  Response.Write("<center><h2>Page Deletion</h2></center><hr>")
1571
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Cannot be created on this Server")
1571
  Response.Write("<center>")
1572
          Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1572
 
1573
    ElseIf NOT gEnableEdit Then
1573
  If Request.QueryString("delVerified") <> 1  Then
1574
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Cannot be deleted until you enable editing")
1574
    if gHideLogin Then
1575
          Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1575
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Cannot be created on this Server")
1576
    Else
1576
          Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1577
        Response.Write("<br><br><span style='border: solid 5px red; padding: 10px;display:inline-block'>")
1577
    ElseIf NOT gEnableEdit Then
1578
        response.write("Deletion of the page --> <b>" &  glsTopic & "</b>  <--- cannot be undone")
1578
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Cannot be deleted until you enable editing")
1579
        response.write("<br>Are your sure that you wish to continue!")
1579
          Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1580
        response.write( "<br><br><a href='" & gScriptURL & "&a=del&delVerified=1&o=" & glsTopic & "'><button style='color:red'>Delete this page.</button></a>" )
1580
    Else
1581
        response.write( "&nbsp;&nbsp;<a href='" & gScriptURL & "'><button>No,  don't delete it.</button></a>" )
1581
        Response.Write("<br><br><span style='border: solid 5px red; padding: 10px;display:inline-block'>")
1582
        response.write( "</span>" )
1582
        response.write("Deletion of the page --> <b>" &  glsTopic & "</b>  <--- cannot be undone")
1583
    End If
1583
        response.write("<br>Are your sure that you wish to continue!")
1584
  Else
1584
        response.write( "<br><br><a href='" & gScriptURL & "&a=del&delVerified=1&o=" & glsTopic & "'><button style='color:red'>Delete this page.</button></a>" )
1585
 
1585
        response.write( "&nbsp;&nbsp;<a href='" & gScriptURL & "'><button>No,  don't delete it.</button></a>" )
1586
      Dim topic
1586
        response.write( "</span>" )
1587
      topic = Request.QueryString("o") ' Topic to delete
1587
    End If
1588
      If IsNull(topic) or topic = "" Then
1588
  Else
1589
        Response.Write( "Specify page name to delete i.e.  &o=MyPage" & sh)
1589
 
1590
        Response.End
1590
      Dim topic
1591
      End If
1591
      topic = Request.QueryString("o") ' Topic to delete
1592
 
1592
      If IsNull(topic) or topic = "" Then
1593
      Dim stmnt
1593
        Response.Write( "Specify page name to delete i.e.  &o=MyPage" & sh)
1594
      stmnt = "delete from WikiData where Title='" & topic & "'"
1594
        Response.End
1595
      Set gDataConn = Server.CreateObject("ADODB.Connection")
1595
      End If
1596
      on error resume next
1596
 
1597
      gDataConn.Open ConnStr(1)
1597
      Dim stmnt
1598
      on error goto 0
1598
      stmnt = "delete from WikiData where Title='" & topic & "'"
1599
      on error resume next
1599
      Set gDataConn = Server.CreateObject("ADODB.Connection")
1600
      gDataConn.execute(stmnt)
1600
      on error resume next
1601
      on error goto 0
1601
      gDataConn.Open ConnStr(1)
1602
      If  gDataConn.errors.count = 0 then
1602
      on error goto 0
1603
        Response.Write( "<b>" & topic & " </b> was successfully deleted. " )
1603
      on error resume next
1604
      Else
1604
      gDataConn.execute(stmnt)
1605
        Response.Write( "<b>" & topic & " </b>  was not deleted due to some errors. " )
1605
      on error goto 0
1606
      End if
1606
      If  gDataConn.errors.count = 0 then
1607
      Set gDataConn = nothing
1607
        Response.Write( "<b>" & topic & " </b> was successfully deleted. " )
1608
      Response.write  sh
1608
      Else
1609
    End If
1609
        Response.Write( "<b>" & topic & " </b>  was not deleted due to some errors. " )
1610
    Response.Write("</center>")
1610
      End if
1611
    Response.End
1611
      Set gDataConn = nothing
1612
end sub
1612
      Response.write  sh
1613
 
1613
    End If
1614
Sub HandleConfig
1614
    Response.Write("</center>")
1615
  Dim showSessionData
1615
    Response.End
1616
 
1616
end sub
1617
  Response.Write("<center><h2>Edit Configuration</h2></center><hr>")
1617
 
1618
 
1618
Sub HandleConfig
1619
  if gHideLogin Then
1619
  Dim showSessionData
1620
      Response.Write("Configuration not available on this server")
1620
 
1621
      Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1621
  Response.Write("<center><h2>Edit Configuration</h2></center><hr>")
1622
  ElseIf NOT gEnableEdit Then
1622
 
1623
      Response.Write("Configuration not available until you enable editing")
1623
  if gHideLogin Then
1624
      Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1624
      Response.Write("Configuration not available on this server")
1625
  Else
1625
      Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1626
      select case (glsTopic)
1626
  ElseIf NOT gEnableEdit Then
1627
          case "bde"
1627
      Response.Write("Configuration not available until you enable editing")
1628
              Session("BulkDelete") = 1
1628
      Response.Write("<br><a href='" & gScriptURL & "'><button>Return to Home</button></a>")
1629
              gBulkDelete = true
1629
  Else
1630
 
1630
      select case (glsTopic)
1631
          case "bdd"
1631
          case "bde"
1632
              Session.Contents.Remove("BulkDelete")
1632
              Session("BulkDelete") = 1
1633
              gBulkDelete = false
1633
              gBulkDelete = true
1634
 
1634
 
1635
          case "ssv"
1635
          case "bdd"
1636
                showSessionData = true
1636
              Session.Contents.Remove("BulkDelete")
1637
      end select
1637
              gBulkDelete = false
1638
 
1638
 
1639
      response.write( "<br><a href='" & gScriptURL & "&a=config&o=ssv'><button>Show Session Variables</button></a>" )
1639
          case "ssv"
1640
      If not gBulkDelete Then
1640
                showSessionData = true
1641
        response.write( "<br><a href='" & gScriptURL & "&a=config&o=bde'><button>Enable Bulk Delete</button></a>" )
1641
      end select
1642
      Else
1642
 
1643
        response.write( "<br><a href='" & gScriptURL & "&a=config&o=bdd'><button>Disable Bulk Delete</button></a>" )
1643
      response.write( "<br><a href='" & gScriptURL & "&a=config&o=ssv'><button>Show Session Variables</button></a>" )
1644
      End If
1644
      If not gBulkDelete Then
1645
      response.write( "<br><form action="&gScriptURL&"&a=config&o=cdb>"&_
1645
        response.write( "<br><a href='" & gScriptURL & "&a=config&o=bde'><button>Enable Bulk Delete</button></a>" )
1646
                            "<input type=submit value='Create New Wiki Database'>"&_
1646
      Else
1647
                            "<input type=text name=db>"&_
1647
        response.write( "<br><a href='" & gScriptURL & "&a=config&o=bdd'><button>Disable Bulk Delete</button></a>" )
1648
                            "<input type=hidden name=a value=config>"&_
1648
      End If
1649
                            "<input type=hidden name=aa value=cdb>"&_
1649
      response.write( "<br><form action="&gScriptURL&"&a=config&o=cdb>"&_
1650
                            "</form>" )
1650
                            "<input type=submit value='Create New Wiki Database'>"&_
1651
      response.write( "<br><a href='" & gScriptURL & "'><button>Return to Wiki.</button></a>" )
1651
                            "<input type=text name=db>"&_
1652
  End If
1652
                            "<input type=hidden name=a value=config>"&_
1653
 
1653
                            "<input type=hidden name=aa value=cdb>"&_
1654
  If showSessionData Then WriteSessionData
1654
                            "</form>" )
1655
 
1655
      response.write( "<br><a href='" & gScriptURL & "'><button>Return to Wiki.</button></a>" )
1656
  Response.End
1656
  End If
1657
end sub
1657
 
1658
 
1658
  If showSessionData Then WriteSessionData
1659
 
1659
 
1660
'ElreyRonald 4/2004
1660
  Response.End
1661
sub handleRss
1661
end sub
1662
 
1662
 
1663
  dim pageTitle, initialRow, s, sSortOrder
1663
 
1664
  dim modifiedUrl
1664
'ElreyRonald 4/2004
1665
 
1665
sub handleRss
1666
  sqlQuery="select top " & giNumRecentFiles & " ID, LastEditor, Title,PageData,PrevPageData, LastUpdate from " & gDbTableName & " order by LastUpdate DESC"
1666
 
1667
 
1667
  dim pageTitle, initialRow, s, sSortOrder
1668
  sqlQuery = sqlQuery & sSortOrder
1668
  dim modifiedUrl
1669
 
1669
 
1670
  set gDataConn = Server.CreateObject("ADODB.Connection")
1670
  sqlQuery="select top " & giNumRecentFiles & " ID, LastEditor, Title,PageData,PrevPageData, LastUpdate from " & gDbTableName & " order by LastUpdate DESC"
1671
 
1671
 
1672
  on error resume next
1672
  sqlQuery = sqlQuery & sSortOrder
1673
  gDataConn.Open ConnStr(1)
1673
 
1674
  on error goto 0
1674
  set gDataConn = Server.CreateObject("ADODB.Connection")
1675
 
1675
 
1676
  if not (0 = gDataConn.errors.count) then
1676
  on error resume next
1677
    if (ADOERROR_NOFILE = gDataConn.errors(0).number) then
1677
  gDataConn.Open ConnStr(1)
1678
      EmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlf
1678
  on error goto 0
1679
      EmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_
1679
 
1680
      gDataConn.errors(0).description & ")<br/>" & vbcrlf
1680
  if not (0 = gDataConn.errors.count) then
1681
      VerifyWikiTable
1681
    if (ADOERROR_NOFILE = gDataConn.errors(0).number) then
1682
    end if
1682
      EmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlf
1683
  end if
1683
      EmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_
1684
 
1684
      gDataConn.errors(0).description & ")<br/>" & vbcrlf
1685
  'set rs= gDataConn.execute(sqlQuery)
1685
      VerifyWikiTable
1686
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1686
    end if
1687
  
1687
  end if
1688
 
1688
 
1689
  modifiedUrl = Replace(gScriptURL, "&", "&amp;")
1689
  'set rs= gDataConn.execute(sqlQuery)
1690
  if not rs.eof then
1690
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1691
    response.ContentType = "text/xml"
1691
  
1692
    response.Write("<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>")
1692
 
1693
    response.Write(gRssStyle)
1693
  modifiedUrl = Replace(gScriptURL, "&", "&amp;")
1694
    response.Write("<rss version=""2.0"">")
1694
  if not rs.eof then
1695
    response.Write("<channel>")
1695
    response.ContentType = "text/xml"
1696
    response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")
1696
    response.Write("<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>")
1697
    response.Write("<link>" & gHttpDomain & "/" & modifiedUrl &  "&amp;a=rss</link> ")
1697
    response.Write(gRssStyle)
1698
    Response.Write("<ttl>1000</ttl>")
1698
    response.Write("<rss version=""2.0"">")
1699
    response.Write("<description>Latest changes and postings for the topic:" & SpaceName(gHomeTopic) & ". </description> ")
1699
    response.Write("<channel>")
1700
    response.Write("<copyright>Copyright (C)2003  Elrey Ronald Vel. All rights reserved.</copyright> ")
1700
    response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")
1701
    response.Write("<generator> WikiAsp RSS Generator by Elrey </generator> ")
1701
    response.Write("<link>" & gHttpDomain & "/" & modifiedUrl &  "&amp;a=rss</link> ")
1702
    Response.Write("<webMaster>lambda326@hotmail.com</webMaster>")
1702
    Response.Write("<ttl>1000</ttl>")
1703
    response.Write("<image><width>80</width><height>40</height>")
1703
    response.Write("<description>Latest changes and postings for the topic:" & SpaceName(gHomeTopic) & ". </description> ")
1704
    response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")
1704
    response.Write("<copyright>Copyright (C)2003  Elrey Ronald Vel. All rights reserved.</copyright> ")
1705
    response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "</link> ")
1705
    response.Write("<generator> WikiAsp RSS Generator by Elrey </generator> ")
1706
    If  left(gIconName,4) = "http" Then
1706
    Response.Write("<webMaster>lambda326@hotmail.com</webMaster>")
1707
      response.Write("<url>" &  gIconName &" </url></image>")
1707
    response.Write("<image><width>80</width><height>40</height>")
1708
    Else
1708
    response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")
1709
      response.Write("<url>" & gHttpDomain & "/" & gIconName &" </url></image>")
1709
    response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "</link> ")
1710
    End If
1710
    If  left(gIconName,4) = "http" Then
1711
 
1711
      response.Write("<url>" &  gIconName &" </url></image>")
1712
    Do while Not rs.eof
1712
    Else
1713
      Response.Write("<item>")
1713
      response.Write("<url>" & gHttpDomain & "/" & gIconName &" </url></image>")
1714
      Response.Write("<title>" & SpaceName(rs("Title"))&  "</title>")
1714
    End If
1715
      Response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "&amp;o=" & rs("Title") & "</link> ")
1715
 
1716
      Response.Write("<category>" & SpaceName(gHomeTopic) & "</category>")
1716
    Do while Not rs.eof
1717
      Response.Write("<author>user@" & rs("LastEditor")& "</author>")
1717
      Response.Write("<item>")
1718
      Response.Write("<description>")
1718
      Response.Write("<title>" & SpaceName(rs("Title"))&  "</title>")
1719
      Response.Write( "<![CD" & "ATA[ ")
1719
      Response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "&amp;o=" & rs("Title") & "</link> ")
1720
      If gHighlightFlag Then
1720
      Response.Write("<category>" & SpaceName(gHomeTopic) & "</category>")
1721
          Response.Write(  ProcessRssItem(rs) )
1721
      Response.Write("<author>user@" & rs("LastEditor")& "</author>")
1722
      Else
1722
      Response.Write("<description>")
1723
          Response.Write WalkWiki(xform(  rs("PageData")  ))
1723
      Response.Write( "<![CD" & "ATA[ ")
1724
      End If
1724
      If gHighlightFlag Then
1725
      Response.Write("]]></description>")
1725
          Response.Write(  ProcessRssItem(rs) )
1726
      Response.Write("<pubDate>" & GetRFC822date(rs("LastUpdate")) & "</pubDate> ")
1726
      Else
1727
      Response.Write("</item>")
1727
          Response.Write WalkWiki(xform(  rs("PageData")  ))
1728
      rs.MoveNext
1728
      End If
1729
      i= i+1
1729
      Response.Write("]]></description>")
1730
    Loop
1730
      Response.Write("<pubDate>" & GetRFC822date(rs("LastUpdate")) & "</pubDate> ")
1731
 
1731
      Response.Write("</item>")
1732
    response.Write( "</channel></rss>")
1732
      rs.MoveNext
1733
  end if
1733
      i= i+1
1734
  Set gDataConn = nothing
1734
    Loop
1735
  Set rs = nothing
1735
 
1736
end sub
1736
    response.Write( "</channel></rss>")
1737
 
1737
  end if
1738
 
1738
  Set gDataConn = nothing
1739
'Get the nth page in History
1739
  Set rs = nothing
1740
'ElreyRonald
1740
end sub
1741
Function GetPrevData(rs, n)
1741
 
1742
   Dim arrD, tmpStr, i, cnt, getFlag
1742
 
1743
   Dim prevData
1743
'Get the nth page in History
1744
   prevData = rs("PrevPageData")
1744
'ElreyRonald
1745
   If    IsNull(prevData) Then
1745
Function GetPrevData(rs, n)
1746
      GetPrevData   = ""
1746
   Dim arrD, tmpStr, i, cnt, getFlag
1747
   Else
1747
   Dim prevData
1748
 
1748
   prevData = rs("PrevPageData")
1749
      arrD    =  Split( rs("PrevPageData"), vbCRLF)
1749
   If    IsNull(prevData) Then
1750
      cnt     = 0
1750
      GetPrevData   = ""
1751
      getFlag = 0
1751
   Else
1752
      tmpSTr  = ""
1752
 
1753
      For i = 1 to UBound(arrD)
1753
      arrD    =  Split( rs("PrevPageData"), vbCRLF)
1754
         If left(arrD(i), 8) = "--------"   Then
1754
      cnt     = 0
1755
            cnt = cnt + 1
1755
      getFlag = 0
1756
            if getFlag = 1 Then Exit For
1756
      tmpSTr  = ""
1757
            if  n =  cnt Then
1757
      For i = 1 to UBound(arrD)
1758
               getFlag = 1
1758
         If left(arrD(i), 8) = "--------"   Then
1759
            end if
1759
            cnt = cnt + 1
1760
         End If
1760
            if getFlag = 1 Then Exit For
1761
         If getFlag = 1 and left(arrD(i), 8) <> "--------" Then
1761
            if  n =  cnt Then
1762
            tmpStr = tmpStr & arrD(i) & vbCRLF
1762
               getFlag = 1
1763
         End If
1763
            end if
1764
 
1764
         End If
1765
      Next
1765
         If getFlag = 1 and left(arrD(i), 8) <> "--------" Then
1766
      GetPrevData = tmpStr
1766
            tmpStr = tmpStr & arrD(i) & vbCRLF
1767
   End If
1767
         End If
1768
End Function
1768
 
1769
 
1769
      Next
1770
 
1770
      GetPrevData = tmpStr
1771
'Process the current record (rs) for RSS
1771
   End If
1772
'ElreyRonald
1772
End Function
1773
Function    ProcessRssItem(rs)
1773
 
1774
   Dim currData, prevData, markedStr
1774
 
1775
   Dim beginMark, endMark, tmpS
1775
'Process the current record (rs) for RSS
1776
   beginMark = "###s###"
1776
'ElreyRonald
1777
   endMark  = "###e###"
1777
Function    ProcessRssItem(rs)
1778
   currData = rs("PageData")
1778
   Dim currData, prevData, markedStr
1779
   prevData = GetPrevData( rs, 1 )
1779
   Dim beginMark, endMark, tmpS
1780
   markedStr =  MarkWhatWasAdded( prevData, currData, beginMark , endMark)
1780
   beginMark = "###s###"
1781
   tmpS = WalkWiki(xform(markedStr))
1781
   endMark  = "###e###"
1782
   tmpS = Replace( tmpS, beginMark, "<U style='background:yellow' >")
1782
   currData = rs("PageData")
1783
   tmpS = Replace( tmpS, endMark,   "</U>")
1783
   prevData = GetPrevData( rs, 1 )
1784
   ProcessRssItem = tmpS
1784
   markedStr =  MarkWhatWasAdded( prevData, currData, beginMark , endMark)
1785
End Function
1785
   tmpS = WalkWiki(xform(markedStr))
1786
 
1786
   tmpS = Replace( tmpS, beginMark, "<U style='background:yellow' >")
1787
Function MarkWhatWasAdded( prevData, currData, st, en)
1787
   tmpS = Replace( tmpS, endMark,   "</U>")
1788
Dim arrCurrData, arrPrevData
1788
   ProcessRssItem = tmpS
1789
Dim currMaxIndex
1789
End Function
1790
Dim prevMaxIndex, i
1790
 
1791
arrCurrData  = Split( currData, vbCRLF)
1791
Function MarkWhatWasAdded( prevData, currData, st, en)
1792
arrPrevData  = Split( prevData, vbCRLF)
1792
Dim arrCurrData, arrPrevData
1793
currMaxIndex =  UBound( arrCurrData )
1793
Dim currMaxIndex
1794
prevMaxIndex =  UBound( arrPrevData )
1794
Dim prevMaxIndex, i
1795
If  prevMaxIndex <  0 Then
1795
arrCurrData  = Split( currData, vbCRLF)
1796
  MarkWhatWasAdded = currData
1796
arrPrevData  = Split( prevData, vbCRLF)
1797
  Exit Function
1797
currMaxIndex =  UBound( arrCurrData )
1798
End If
1798
prevMaxIndex =  UBound( arrPrevData )
1799
 
1799
If  prevMaxIndex <  0 Then
1800
Dim marked, prevPtr, started
1800
  MarkWhatWasAdded = currData
1801
marked =    0
1801
  Exit Function
1802
prevPtr = 0
1802
End If
1803
started = 0
1803
 
1804
'Search delta forward
1804
Dim marked, prevPtr, started
1805
For i = 0 to prevMaxIndex
1805
marked =    0
1806
   If lTrim(rtrim(arrPrevData(i))) <> "" Then Exit For
1806
prevPtr = 0
1807
Next
1807
started = 0
1808
prevPtr = i  'start here
1808
'Search delta forward
1809
For i   = 0 to currMaxIndex
1809
For i = 0 to prevMaxIndex
1810
   If lTrim(rtrim(arrCurrData(i))) = "" and started = 0Then
1810
   If lTrim(rtrim(arrPrevData(i))) <> "" Then Exit For
1811
 
1811
Next
1812
   Else
1812
prevPtr = i  'start here
1813
      Started = 1
1813
For i   = 0 to currMaxIndex
1814
      If    prevPtr <=  prevMaxIndex Then
1814
   If lTrim(rtrim(arrCurrData(i))) = "" and started = 0Then
1815
         If arrCurrData(i)  <>  arrPrevData( prevPtr) Then
1815
 
1816
            if ( i > 0 ) then
1816
   Else
1817
               if arrCurrData(i-1) = "" Then
1817
      Started = 1
1818
                 arrCurrData(i-1)   =  vbCRLF & arrCurrData(i-1) & st
1818
      If    prevPtr <=  prevMaxIndex Then
1819
               else
1819
         If arrCurrData(i)  <>  arrPrevData( prevPtr) Then
1820
                 arrCurrData(i-1)   = arrCurrData(i-1) & st
1820
            if ( i > 0 ) then
1821
               end if
1821
               if arrCurrData(i-1) = "" Then
1822
            else
1822
                 arrCurrData(i-1)   =  vbCRLF & arrCurrData(i-1) & st
1823
               arrCurrData(i)   = st &   vbCRLF & arrCurrData(i)
1823
               else
1824
            end if
1824
                 arrCurrData(i-1)   = arrCurrData(i-1) & st
1825
            marked =    1
1825
               end if
1826
            Exit For
1826
            else
1827
         End If
1827
               arrCurrData(i)   = st &   vbCRLF & arrCurrData(i)
1828
         prevPtr = prevPtr + 1
1828
            end if
1829
         if prevPtr >  prevMaxIndex and i < currMaxIndex then
1829
            marked =    1
1830
            arrCurrData(i)  = arrCurrData(i+1) & st
1830
            Exit For
1831
            marked = 1
1831
         End If
1832
            exit for
1832
         prevPtr = prevPtr + 1
1833
         end if
1833
         if prevPtr >  prevMaxIndex and i < currMaxIndex then
1834
      End If
1834
            arrCurrData(i)  = arrCurrData(i+1) & st
1835
   End If
1835
            marked = 1
1836
Next
1836
            exit for
1837
 
1837
         end if
1838
If  marked =    0 Then
1838
      End If
1839
   MarkWhatWasAdded = currData
1839
   End If
1840
   exit function
1840
Next
1841
End If
1841
 
1842
 
1842
If  marked =    0 Then
1843
'Search delta Backwards
1843
   MarkWhatWasAdded = currData
1844
For i = prevMaxIndex to 0 step -1
1844
   exit function
1845
   If lTrim(rtrim(arrPrevData(i))) <> "" Then Exit For
1845
End If
1846
Next
1846
 
1847
Dim pi
1847
'Search delta Backwards
1848
pi  = i
1848
For i = prevMaxIndex to 0 step -1
1849
started = 0
1849
   If lTrim(rtrim(arrPrevData(i))) <> "" Then Exit For
1850
For i   = currMaxIndex  to  0 step -1
1850
Next
1851
  If lTrim(rtrim(arrCurrData(i))) = "" and started = 0Then
1851
Dim pi
1852
     ' do nothing
1852
pi  = i
1853
  Else
1853
started = 0
1854
    Started  = 1
1854
For i   = currMaxIndex  to  0 step -1
1855
    If  pi  >= 0 Then
1855
  If lTrim(rtrim(arrCurrData(i))) = "" and started = 0Then
1856
      'Response.Write "backward Compare " & Cstr(i) & "-" & Cstr(pi) &" [" &arrCurrData(i) & "]=["& arrPrevData(pi) & "] " &    vbCRLF
1856
     ' do nothing
1857
      If    arrCurrData(i)  <>  arrPrevData(pi) Then
1857
  Else
1858
         arrCurrData(i) = arrCurrData(i) & en
1858
    Started  = 1
1859
         Exit For
1859
    If  pi  >= 0 Then
1860
      End If
1860
      'Response.Write "backward Compare " & Cstr(i) & "-" & Cstr(pi) &" [" &arrCurrData(i) & "]=["& arrPrevData(pi) & "] " &    vbCRLF
1861
      pi    = pi - 1
1861
      If    arrCurrData(i)  <>  arrPrevData(pi) Then
1862
      if pi < 0 and i > 0 then
1862
         arrCurrData(i) = arrCurrData(i) & en
1863
         arrCurrData(i-1)   = arrCurrData(i-1) & en
1863
         Exit For
1864
         exit for
1864
      End If
1865
      End if
1865
      pi    = pi - 1
1866
    End If
1866
      if pi < 0 and i > 0 then
1867
  End If
1867
         arrCurrData(i-1)   = arrCurrData(i-1) & en
1868
Next
1868
         exit for
1869
 
1869
      End if
1870
Dim sres
1870
    End If
1871
sres = ""
1871
  End If
1872
For i   = 0 to currMaxIndex
1872
Next
1873
   sres = sres  & arrCurrData(i) & vbCRLF
1873
 
1874
Next
1874
Dim sres
1875
MarkWhatWasAdded = sres
1875
sres = ""
1876
 
1876
For i   = 0 to currMaxIndex
1877
End Function
1877
   sres = sres  & arrCurrData(i) & vbCRLF
1878
 
1878
Next
1879
 
1879
MarkWhatWasAdded = sres
1880
 
1880
 
1881
 
1881
End Function
1882
sub handleList
1882
 
1883
 
1883
 
1884
  dim pageTitle, initialRow, s, sDirection, sSortOrder, sNextDirectionTitle, sNextDirectionDate
1884
 
1885
  ' Request.ServerVariables("HTTP_REFERER")
1885
 
1886
 
1886
sub handleList
1887
  initialRow= ""
1887
 
1888
  s = Request.QueryString("o")
1888
  dim pageTitle, initialRow, s, sDirection, sSortOrder, sNextDirectionTitle, sNextDirectionDate
1889
  EmitDebug 43, 2, "<br/>" & s & "<br/>" & vbcrlf
1889
  ' Request.ServerVariables("HTTP_REFERER")
1890
  if (s = "recent") then
1890
 
1891
    pageTitle = "Recently Modified Topics"
1891
  initialRow= ""
1892
    sqlQuery="select top " & giNumRecentFiles & " ID, Title, LastUpdate, LastEditor from " & gDbTableName & " order by LastUpdate DESC"
1892
  s = Request.QueryString("o")
1893
  else
1893
  EmitDebug 43, 2, "<br/>" & s & "<br/>" & vbcrlf
1894
    pageTitle = "List of All Topics"
1894
  if (s = "recent") then
1895
    sqlQuery= "select ID, Title, LastUpdate , LastEditor from " & gDbTableName & " order by "
1895
    pageTitle = "Recently Modified Topics"
1896
    sDirection = Request.QueryString("d")
1896
    sqlQuery="select top " & giNumRecentFiles & " ID, Title, LastUpdate, LastEditor from " & gDbTableName & " order by LastUpdate DESC"
1897
 
1897
  else
1898
    if (s = "ByDate") then
1898
    pageTitle = "List of All Topics"
1899
      sqlQuery = sqlQuery & "LastUpdate "
1899
    sqlQuery= "select ID, Title, LastUpdate , LastEditor from " & gDbTableName & " order by "
1900
      if (sDirection = "down") then
1900
    sDirection = Request.QueryString("d")
1901
    sSortOrder = ""  ' the reverse natural sort order (oldest first)
1901
 
1902
    sNextDirectionDate= ""
1902
    if (s = "ByDate") then
1903
      else
1903
      sqlQuery = sqlQuery & "LastUpdate "
1904
    sSortOrder = "DESC"  ' the natural sort order (most recent first)
1904
      if (sDirection = "down") then
1905
    sNextDirectionDate= "&d=down"
1905
    sSortOrder = ""  ' the reverse natural sort order (oldest first)
1906
      end if
1906
    sNextDirectionDate= ""
1907
    elseif (s = "ByTitle") then
1907
      else
1908
      sqlQuery = sqlQuery & "Title "
1908
    sSortOrder = "DESC"  ' the natural sort order (most recent first)
1909
      if (sDirection = "down") then
1909
    sNextDirectionDate= "&d=down"
1910
    sSortOrder = "DESC"   ' the reverse natural sort order (alphabetic)
1910
      end if
1911
    sNextDirectionTitle = ""
1911
    elseif (s = "ByTitle") then
1912
      else
1912
      sqlQuery = sqlQuery & "Title "
1913
    sSortOrder = ""   ' the natural sort order (alphabetic)
1913
      if (sDirection = "down") then
1914
    sNextDirectionTitle = "&d=down"
1914
    sSortOrder = "DESC"   ' the reverse natural sort order (alphabetic)
1915
      end if
1915
    sNextDirectionTitle = ""
1916
    end if
1916
      else
1917
 
1917
    sSortOrder = ""   ' the natural sort order (alphabetic)
1918
    sqlQuery = sqlQuery & sSortOrder
1918
    sNextDirectionTitle = "&d=down"
1919
 
1919
      end if
1920
 
1920
    end if
1921
    'initialRow= "<tr style='background-color:White;'> <td></td><td align='right'><a href='" & gScript & "?a=list&o=ByTitle" & sNextDirectionTitle & "'>Sort</a></td> <td align='right'><a href='" & gScript & "?a=list&o=ByDate" & sNextDirectionDate & "'>Sort</a></td></tr>"
1921
 
1922
    initialRow= "<tr style='background-color:White;'> <td></td><td align='right'><a href='" & gScriptURL & "&a=list&o=ByTitle" & sNextDirectionTitle & "'>Sort by Title</a></td> <td align='right'><a href='" & gScriptURL & "&a=list&o=ByDate" & sNextDirectionDate & "'>Sort by Date</a></td></tr>"
1922
    sqlQuery = sqlQuery & sSortOrder
1923
 
1923
 
1924
 
1924
 
1925
  end if
1925
    'initialRow= "<tr style='background-color:White;'> <td></td><td align='right'><a href='" & gScript & "?a=list&o=ByTitle" & sNextDirectionTitle & "'>Sort</a></td> <td align='right'><a href='" & gScript & "?a=list&o=ByDate" & sNextDirectionDate & "'>Sort</a></td></tr>"
1926
 
1926
    initialRow= "<tr style='background-color:White;'> <td></td><td align='right'><a href='" & gScriptURL & "&a=list&o=ByTitle" & sNextDirectionTitle & "'>Sort by Title</a></td> <td align='right'><a href='" & gScriptURL & "&a=list&o=ByDate" & sNextDirectionDate & "'>Sort by Date</a></td></tr>"
1927
  EmitTabularOutput pageTitle, initialRow
1927
 
1928
 
1928
 
1929
end sub
1929
  end if
1930
 
1930
 
1931
 
1931
  EmitTabularOutput pageTitle, initialRow
1932
 
1932
 
1933
sub EmitTabularOutput(pageTitle, initialRow)
1933
end sub
1934
 
1934
 
1935
  EmitDebug 44, 2, "<br/>query(" & sqlQuery & ")<br/>" & vbcrlf
1935
 
1936
  
1936
 
1937
  'set rs= gDataConn.execute(sqlQuery)
1937
sub EmitTabularOutput(pageTitle, initialRow)
1938
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1938
 
1939
 
1939
  EmitDebug 44, 2, "<br/>query(" & sqlQuery & ")<br/>" & vbcrlf
1940
  Call WriteBanner(pageTitle,"")
1940
  
1941
 
1941
  'set rs= gDataConn.execute(sqlQuery)
1942
  if not rs.eof  then
1942
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
1943
'    Response.write("<h2>" & pageTitle & ":</h2>)
1943
 
1944
    Response.write("<table cellpadding=5  cellspacing=0 border=0 >" & vbcrlf)
1944
  Call WriteBanner(pageTitle,"")
1945
    i = 1
1945
 
1946
    if not isEmpty(initialRow) then
1946
  if not rs.eof  then
1947
      Response.write initialRow & vbcrlf
1947
'    Response.write("<h2>" & pageTitle & ":</h2>)
1948
    end if
1948
    Response.write("<table cellpadding=5  cellspacing=0 border=0 >" & vbcrlf)
1949
    Do while (Not rs.eof )
1949
    i = 1
1950
      if (i mod 2 = 0) then
1950
    if not isEmpty(initialRow) then
1951
          Response.Write("<tr style=""background-color:whitesmoke;"">")
1951
      Response.write initialRow & vbcrlf
1952
      else
1952
    end if
1953
          Response.Write("<tr style=""background-color:lightcyan;"">")
1953
    Do while (Not rs.eof )
1954
      end if
1954
      if (i mod 2 = 0) then
1955
 
1955
          Response.Write("<tr style=""background-color:whitesmoke;"">")
1956
      Dim deleteColumn
1956
      else
1957
      deleteColumn = ""
1957
          Response.Write("<tr style=""background-color:lightcyan;"">")
1958
 
1958
      end if
1959
      ' Allow bulk deletion
1959
 
1960
      If (gBulkDelete)  Then
1960
      Dim deleteColumn
1961
          deleteColumn = "<td class='tabular'><a href=""" & gScriptURL & "&o=" & rs("Title")&"&a=del&delVerified=1" & """>[Delete Page]</td>"
1961
      deleteColumn = ""
1962
      End If
1962
 
1963
 
1963
      ' Allow bulk deletion
1964
      Response.Write("<td class='tabular'>" & i & ".</td><td class='tabular'><a href=""" &_
1964
      If (gBulkDelete)  Then
1965
                  gScriptURL & "&o=" & rs("Title") & """>" & rs("Title") & "</a></td> <td class='tabular'>" & _
1965
          deleteColumn = "<td class='tabular'><a href=""" & gScriptURL & "&o=" & rs("Title")&"&a=del&delVerified=1" & """>[Delete Page]</td>"
1966
                  rs("LastUpdate") & " by " & rs("LastEditor")& "</td>" &  deleteColumn & _
1966
      End If
1967
                  "</tr>" &  vbcrlf)
1967
 
1968
      i= i+1
1968
      Response.Write("<td class='tabular'>" & i & ".</td><td class='tabular'><a href=""" &_
1969
      rs.MoveNext
1969
                  gScriptURL & "&o=" & rs("Title") & """>" & rs("Title") & "</a></td> <td class='tabular'>" & _
1970
    Loop
1970
                  GetRFC822date(rs("LastUpdate")) & " by " & rs("LastEditor")& "</td>" &  deleteColumn & _
1971
    Response.write("</table>" & vbcrlf)
1971
                  "</tr>" &  vbcrlf)
1972
  else
1972
      i= i+1
1973
'    Response.write("<h2>" & pageTitle & ":</h2>)
1973
      rs.MoveNext
1974
    Response.write("<table style='border: 1px solid gainsboro'>" & vbcrlf)
1974
    Loop
1975
    Response.write("<tr><td>This topic is not mentioned on any other page! </td></tr>" & vbcrlf)
1975
    Response.write("</table>" & vbcrlf)
1976
    Response.write("</table>" & vbcrlf)
1976
  else
1977
  end if
1977
'    Response.write("<h2>" & pageTitle & ":</h2>)
1978
 
1978
    Response.write("<table style='border: 1px solid gainsboro'>" & vbcrlf)
1979
   Call WriteFooter("","",""  )
1979
    Response.write("<tr><td>This topic is not mentioned on any other page! </td></tr>" & vbcrlf)
1980
end sub
1980
    Response.write("</table>" & vbcrlf)
1981
 
1981
  end if
1982
 
1982
 
1983
sub handleSave
1983
   Call WriteFooter("","",""  )
1984
  if gDisableSave = "yes" then
1984
end sub
1985
    exit sub
1985
 
1986
  end if
1986
 
1987
 
1987
sub handleSave
1988
  dim sText, dts, sLupdt
1988
  if gDisableSave = "yes" then
1989
  dim sChanges, sTextOrig
1989
    exit sub
1990
  sText=request.Form("pagetext")
1990
  end if
1991
  sTextOrig=request.Form("pagetextorig")
1991
 
1992
  sLupdt=request.Form("lupdt")  ' last update (ElreyRonald)
1992
  dim sText, dts, sLupdt
1993
 
1993
  dim sChanges, sTextOrig
1994
 
1994
  sText=request.Form("pagetext")
1995
  Dim lastPageEdited
1995
  sTextOrig=request.Form("pagetextorig")
1996
  if IsEmpty (Session("CurrentEditPage") ) Then
1996
  sLupdt=request.Form("lupdt")  ' last update (ElreyRonald)
1997
        lastPageEdited = "*"
1997
 
1998
        Exit Sub
1998
 
1999
  else
1999
  Dim lastPageEdited
2000
    lastPageEdited =Session("CurrentEditPage")
2000
  if IsEmpty (Session("CurrentEditPage") ) Then
2001
  end if
2001
        lastPageEdited = "*"
2002
 
2002
        Exit Sub
2003
  If not IsRequestFromWikiASPPage Then
2003
  else
2004
     response.write("1:>" & remoteIPHost & " - " & remoteIPAddr  )
2004
    lastPageEdited =Session("CurrentEditPage")
2005
     response.end
2005
  end if
2006
     exit sub
2006
 
2007
  End if
2007
  If not IsRequestFromWikiASPPage Then
2008
 
2008
     response.write("1:>" & remoteIPHost & " - " & remoteIPAddr  )
2009
  If IsRemoteAdressBlackListedRE Then
2009
     response.end
2010
     response.write("2:>" & remoteIPHost & " - " & remoteIPAddr  )
2010
     exit sub
2011
     exit sub
2011
  End if
2012
  End if
2012
 
2013
 
2013
  If IsRemoteAdressBlackListedRE Then
2014
  If IsRemoteBlackListed Then
2014
     response.write("2:>" & remoteIPHost & " - " & remoteIPAddr  )
2015
     response.write("3:>" & remoteIPHost & " - " & remoteIPAddr  )
2015
     exit sub
2016
     exit sub
2016
  End if
2017
  End if
2017
 
2018
 
2018
  If IsRemoteBlackListed Then
2019
  sqlQuery = "select Title,PageData, lastupdate , PrevPageData, LastEditor from " & gDbTableName & " where title='" & glsTopic & "'"
2019
     response.write("3:>" & remoteIPHost & " - " & remoteIPAddr  )
2020
  EmitDebug 45, 2, "<br/>save-check query(" & sqlQuery & ")<br/>" & vbcrlf
2020
     exit sub
2021
 
2021
  End if
2022
 
2022
 
2023
  'set rs = gDataConn.execute(sqlQuery)
2023
  sqlQuery = "select Title,PageData, lastupdate , PrevPageData, LastEditor from " & gDbTableName & " where title='" & glsTopic & "'"
2024
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007          
2024
  EmitDebug 45, 2, "<br/>save-check query(" & sqlQuery & ")<br/>" & vbcrlf
2025
  
2025
 
2026
  dts = Now
2026
 
2027
 
2027
  'set rs = gDataConn.execute(sqlQuery)
2028
  'update record
2028
  set rs = WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007          
2029
  if not rs.eof then
2029
  
2030
 
2030
  dts = Now
2031
 
2031
 
2032
 
2032
  'update record
2033
      EmitDebug 46, 2, "Record already exists....<br/>" & vbcrlf
2033
  if not rs.eof then
2034
 
2034
 
2035
      ' check if someone has updated the record while you were editing (ElreyRonald)
2035
 
2036
      if  Trim(Cstr( rs("lastupdate"))) <> Trim(sLupdt) then
2036
 
2037
        response.write("<html><head></head><body>")
2037
      EmitDebug 46, 2, "Record already exists....<br/>" & vbcrlf
2038
        Response.Write(  "["& Trim(Cstr( rs("lastupdate"))) & "]["& Trim(sLupdt)& "]<br>" )
2038
 
2039
        Response.Write("<b>Sorry! That page is being edited by another user or is in the process of being saved. <br>Your changes were not saved.</b>" )
2039
      ' check if someone has updated the record while you were editing (ElreyRonald)
2040
 
2040
      if  Trim(Cstr( rs("lastupdate"))) <> Trim(sLupdt) then
2041
        response.write( "<br><br> <a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'>Click here to re-edit the page. </a>" )
2041
        response.write("<html><head></head><body>")
2042
        response.end
2042
        Response.Write(  "["& Trim(Cstr( GetRFC822date(rs("lastupdate")))) & "]["& Trim(sLupdt)& "]<br>" )
2043
      else
2043
        Response.Write("<b>Sorry! That page is being edited by another user or is in the process of being saved. <br>Your changes were not saved.</b>" )
2044
 
2044
 
2045
      ' consolidate a series of trailing vbcrlf to just 2.
2045
        response.write( "<br><br> <a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'>Click here to re-edit the page. </a>" )
2046
      gRE.Pattern = "(\r\n){3,}$"
2046
        response.end
2047
      sText=gRE.Replace(sText, vbcrlf & vbcrlf)
2047
      else
2048
 
2048
 
2049
      ' replace 8 spaces with tab (ElreyRonald)
2049
      ' consolidate a series of trailing vbcrlf to just 2.
2050
      sText = replace(sText, vbcrlf & "        *", vbcrlf & chr(9) & "*" )
2050
      gRE.Pattern = "(\r\n){3,}$"
2051
      sText = replace(sText, vbcrlf & chr(9) & " :        ", vbcrlf & chr(9)& " :" & chr(9) )
2051
      sText=gRE.Replace(sText, vbcrlf & vbcrlf)
2052
 
2052
 
2053
      If abs( len(sText) - len(sTextOrig) ) > 10 Then
2053
      ' replace 8 spaces with tab (ElreyRonald)
2054
        sChanges =  vbcrlf & vbcrlf & "@@@@@@@@@@@@@@@@" & rs("lastupdate") & " : " & _
2054
      sText = replace(sText, vbcrlf & "        *", vbcrlf & chr(9) & "*" )
2055
          rs("lasteditor") & "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" & vbcrlf & vbcrlf &  rs("PageData")  & rs("PrevPageData")
2055
      sText = replace(sText, vbcrlf & chr(9) & " :        ", vbcrlf & chr(9)& " :" & chr(9) )
2056
        sChanges =  left(sChanges, 15000)
2056
 
2057
      else
2057
      If abs( len(sText) - len(sTextOrig) ) > 10 Then
2058
        sChanges = rs("PrevPageData")
2058
        sChanges =  vbcrlf & vbcrlf & "@@@@@@@@@@@@@@@@" & rs("lastupdate") & " : " & _
2059
      End if
2059
          rs("lasteditor") & "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" & vbcrlf & vbcrlf &  rs("PageData")  & rs("PrevPageData")
2060
 
2060
        sChanges =  left(sChanges, 15000)
2061
      sqlQuery = "UPDATE " & gDbTableName & " SET PageData='" &_
2061
      else
2062
      safeQuote(sText) & "',PrevPageData='" & safeQuote(  sChanges   ) &_
2062
        sChanges = rs("PrevPageData")
2063
      "',LastUpdate='" & dts & "', LastEditor='" & remoteIPHost  &_
2063
      End if
2064
      "'  WHERE title='" & rs("title") & "'"
2064
 
2065
 
2065
      sqlQuery = "UPDATE " & gDbTableName & " SET PageData='" &_
2066
 
2066
      safeQuote(sText) & "',PrevPageData='" & safeQuote(  sChanges   ) &_
2067
      EmitDebug 47, 1, "update sqlQuery(" & sqlQuery & ")<br/>"
2067
      "',LastUpdate='" & dts & "', LastEditor='" & remoteIPHost  &_
2068
      
2068
      "'  WHERE title='" & rs("title") & "'"
2069
      'gDataConn.execute(sqlQuery)
2069
 
2070
 
2070
 
2071
      call WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
2071
      EmitDebug 47, 1, "update sqlQuery(" & sqlQuery & ")<br/>"
2072
      
2072
      
2073
      
2073
      'gDataConn.execute(sqlQuery)
2074
      end if
2074
 
2075
      ' new record
2075
      call WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
2076
  else
2076
      
2077
 
2077
      
2078
     
2078
      end if
2079
      EmitDebug 48, 2, "Record does not exist, inserting...." & vbcrlf
2079
      ' new record
2080
      sqlQuery = "INSERT INTO " & gDbTableName & " (Title,PageData,LastEditor,LastUpdate) " & _
2080
  else
2081
      "VALUES ('" & glsTopic   & "', '" & safeQuote(sText) & "', '" & remoteIPHost   &_
2081
 
2082
       "', '" & dts & "')"
2082
     
2083
      EmitDebug 49, 1, "<br/>sqlQuery(" & sqlQuery & ")<br/>"
2083
      EmitDebug 48, 2, "Record does not exist, inserting...." & vbcrlf
2084
      
2084
      sqlQuery = "INSERT INTO " & gDbTableName & " (Title,PageData,LastEditor,LastUpdate) " & _
2085
      'gDataConn.execute(sqlQuery)
2085
      "VALUES ('" & glsTopic   & "', '" & safeQuote(sText) & "', '" & remoteIPHost   &_
2086
 
2086
       "', '" & dts & "')"
2087
      call WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
2087
      EmitDebug 49, 1, "<br/>sqlQuery(" & sqlQuery & ")<br/>"
2088
      
2088
      
2089
      
2089
      'gDataConn.execute(sqlQuery)
2090
  end if
2090
 
2091
 
2091
      call WrappedQueryExecute( gDataConn, sqlQuery )  ' ERV 3/2007        
2092
  ' direct to the newly saved page :
2092
      
2093
  'Response.Redirect gScript & "?" & glsTopic
2093
      
2094
  Response.Redirect gScriptURL & "&o=" & glsTopic
2094
  end if
2095
 
2095
 
2096
end sub
2096
  ' direct to the newly saved page :
2097
 
2097
  'Response.Redirect gScript & "?" & glsTopic
2098
Sub WriteBanner(title,search)
2098
  Response.Redirect gScriptURL & "&o=" & glsTopic
2099
      Dim iconPart, bannerPart, bannerTextPart
2099
 
2100
      iconPart = "<a  href='" & gScriptURL & "'><img src='" & gIconName & "' border='0' alt='Go to Start Page'></a>"
2100
end sub
2101
 
2101
 
2102
      if search <> "" then
2102
Sub WriteBanner(title,search)
2103
         bannerTextPart = "<a  title='Search for references to " & title & "' href='" & gScriptURL & "&a=search&o=" & search & "'>" &  SpaceName(title) & "</a>"
2103
      Dim iconPart, bannerPart, bannerTextPart
2104
      else
2104
      iconPart = "<a  href='" & gScriptURL & "'><img src='" & gIconName & "' border='0' alt='Go to Start Page'></a>"
2105
         bannerTextPart = SpaceName(title)
2105
 
2106
      end if
2106
      if search <> "" then
2107
      
2107
         bannerTextPart = "<a  title='Search for references to " & title & "' href='" & gScriptURL & "&a=search&o=" & search & "'>" &  SpaceName(title) & "</a>"
2108
      If gBannerTemplate = "" Then
2108
      else
2109
         bannerPart = ""
2109
         bannerTextPart = SpaceName(title)
2110
         bannerPart =  bannerPart &  "<a href='" & gScriptURL & "'>Wiki Home</a>"
2110
      end if
2111
         bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=list&o=ByTitle' title='this may take a loooong time'>List all pages</a>"
2111
      
2112
         if ( NOT gHideLogin ) Then
2112
      If gBannerTemplate = "" Then
2113
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"
2113
         bannerPart = ""
2114
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<span style='color: #FF0000;font-weight: bold;'>Development Web Server</span>"
2114
         bannerPart =  bannerPart &  "<a href='" & gScriptURL & "'>Wiki Home</a>"
2115
            if (search <> "") AND (gEnableEdit) then
2115
         bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=list&o=ByTitle' title='this may take a loooong time'>List all pages</a>"
2116
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=edit&o=" & search & "'>Edit page</a>"
2116
         if ( NOT gHideLogin ) Then
2117
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=del&o=" & search & "'>Del page</a>"
2117
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"
2118
            end if
2118
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<span style='color: #FF0000;font-weight: bold;'>Development Web Server</span>"
2119
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ReleaseNotes&o=TextFormattingRules'>Formatting Rules</a>"
2119
            if (search <> "") AND (gEnableEdit) then
2120
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ReleaseNotes'>Release Notes</a>"
2120
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=edit&o=" & search & "'>Edit page</a>"
2121
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ImplementationNotes'>"& gDevNotePrefix &" Dev Notes</a>"
2121
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=del&o=" & search & "'>Del page</a>"
2122
            if gEnableEdit Then
2122
            end if
2123
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=config&o='>Config</a>"
2123
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ReleaseNotes&o=TextFormattingRules'>Formatting Rules</a>"
2124
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=logout&o=" & search & "'>Disable Editing</a>"
2124
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ReleaseNotes'>Release Notes</a>"
2125
            Else
2125
            bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScript & "?db=ImplementationNotes'>"& gDevNotePrefix &" Dev Notes</a>"
2126
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=login&o=" & search & "'>Enable Editing</a>"
2126
            if gEnableEdit Then
2127
            End If
2127
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=config&o='>Config</a>"
2128
         End If
2128
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=logout&o=" & search & "'>Disable Editing</a>"
2129
         bannerPart =  bannerPart &  "<hr>"
2129
            Else
2130
         
2130
                bannerPart =  bannerPart &  "&nbsp;|&nbsp;<a href='" & gScriptURL & "&a=login&o=" & search & "'>Enable Editing</a>"
2131
         bannerPart =  bannerPart &  " <table class='cssBannerTable' id='idBannerTable' cellSpacing='0' cellPadding='0' border='0'>"
2131
            End If
2132
         bannerPart =  bannerPart &  "    </tr>"
2132
         End If
2133
         bannerPart =  bannerPart &  "    <tr class='cssBannerRow' id='idBannerRow'> "
2133
         bannerPart =  bannerPart &  "<hr>"
2134
         bannerPart =  bannerPart &  "          <td class='cssBannerCellIcon' id='idBannerCellIcon' valign='top'> $$icon$$</td>"
2134
         
2135
         bannerPart =  bannerPart &  "          <td width=90% class='cssBannerCellText' id='idBannerCellText' valign='bottom' align='left' >"
2135
         bannerPart =  bannerPart &  " <table class='cssBannerTable' id='idBannerTable' cellSpacing='0' cellPadding='0' border='0'>"
2136
         bannerPart =  bannerPart &  "            <h1 class='cssBannerSpanText' id='idBannerSpanText'>$$banner_text$$</h1>"
2136
         bannerPart =  bannerPart &  "    </tr>"
2137
         bannerPart =  bannerPart &  "          </td>"
2137
         bannerPart =  bannerPart &  "    <tr class='cssBannerRow' id='idBannerRow'> "
2138
         bannerPart =  bannerPart &  "          <td>"
2138
         bannerPart =  bannerPart &  "          <td class='cssBannerCellIcon' id='idBannerCellIcon' valign='top'> $$icon$$</td>"
2139
         bannerPart =  bannerPart &  "          <td class='cssTopSearch'id='idTopSearch' >"         	
2139
         bannerPart =  bannerPart &  "          <td width=90% class='cssBannerCellText' id='idBannerCellText' valign='bottom' align='left' >"
2140
         If not gHideTopSearch Then
2140
         bannerPart =  bannerPart &  "            <h1 class='cssBannerSpanText' id='idBannerSpanText'>$$banner_text$$</h1>"
2141
             bannerPart =  bannerPart &  "          <form method=POST action='wiki.asp?a=search&db="& gDataSourceFile &"' id=search001 name=search001 >" & gSearchLabel & "<br/><input class='cssTopSearchbox' id='idTopSearchbox' title='Click and enter search text here!' size=12 type=text name=o value='" & gDataSourceFile & "' onclick=this.value="""" /></form>&nbsp;&nbsp;&nbsp;&nbsp;"
2141
         bannerPart =  bannerPart &  "          </td>"
2142
         End If
2142
         bannerPart =  bannerPart &  "          <td>"
2143
         bannerPart =  bannerPart &  "          </td><td>&nbsp;&nbsp;&nbsp;</d>"
2143
         bannerPart =  bannerPart &  "          <td class='cssTopSearch'id='idTopSearch' >"         	
2144
         bannerPart =  bannerPart &  "    </tr>"
2144
         If not gHideTopSearch Then
2145
         bannerPart =  bannerPart &  " </table>"
2145
             bannerPart =  bannerPart &  "          <form method=POST action='wiki.asp?a=search&db="& gDataSourceFile &"' id=search001 name=search001 >" & gSearchLabel & "<br/><input class='cssTopSearchbox' id='idTopSearchbox' title='Click and enter search text here!' size=12 type=text name=o value='" & gDataSourceFile & "' onclick=this.value="""" /></form>&nbsp;&nbsp;&nbsp;&nbsp;"
2146
      
2146
         End If
2147
      Else
2147
         bannerPart =  bannerPart &  "          </td><td>&nbsp;&nbsp;&nbsp;</d>"
2148
      
2148
         bannerPart =  bannerPart &  "    </tr>"
2149
         bannerPart = gBannerTemplate
2149
         bannerPart =  bannerPart &  " </table>"
2150
      End if
2150
      
2151
      
2151
      Else
2152
      bannerPart = Replace( bannerPart, "$$icon$$", iconPart)
2152
      
2153
      bannerPart = Replace( bannerPart, "$$banner_text$$", bannerTextPart)
2153
         bannerPart = gBannerTemplate
2154
      
2154
      End if
2155
         
2155
      
2156
      Response.Write ( bannerPart )
2156
      bannerPart = Replace( bannerPart, "$$icon$$", iconPart)
2157
 
2157
      bannerPart = Replace( bannerPart, "$$banner_text$$", bannerTextPart)
2158
End Sub
2158
      
2159
 
2159
         
2160
Sub WriteFooter(hideScript,lastUpdate,lastEditor)
2160
      Response.Write ( bannerPart )
2161
      If Not gHideWikiFooter Then
2161
 
2162
          response.write "<div id=wikifooter class=footer ><form method='POST' action=""" & gScript & """ id=""formFooter"" name=""formFooter""><br>"
2162
End Sub
2163
          response.write "<hr size=1 noshade=true>"
2163
 
2164
 
2164
Sub WriteFooter(hideScript,lastUpdate,lastEditor)
2165
          If Not gHideLastEditor Then
2165
      If Not gHideWikiFooter Then
2166
            if lastUpdate <> "" Then
2166
          response.write "<div id=wikifooter class=footer ><form method='POST' action=""" & gScript & """ id=""formFooter"" name=""formFooter""><br>"
2167
                response.write "<span title='Click this now to prepare page for Printing by removing unnecessary portions! ' onclick=""" & hideScript & """ ><font size=-1>Last Updated " & lastUpdate & " by '" & lastEditor &  "' </font></span><br/>"
2167
          response.write "<hr size=1 noshade=true>"
2168
            End If
2168
 
2169
          end if
2169
          If Not gHideLastEditor Then
2170
          response.write "<font size=-1>Domain: " & gHttpDomain & "</font><br>"
2170
            if lastUpdate <> "" Then
2171
 
2171
                response.write "<span title='Click this now to prepare page for Printing by removing unnecessary portions! ' onclick=""" & hideScript & """ ><font size=-1>Last Updated " & GetRFC822date(lastUpdate) & " by '" & lastEditor &  "' </font></span><br/>"
2172
'          response.write "<a href='" & gScriptURL & "' title='GO TO START PAGE'>Home</a> | "
2172
            End If
2173
'          if  Not gHideLogin Then
2173
          end if
2174
'            response.write "<a href='" & gScriptURL & "&a=edit&o=" & rs("title") & "'>Edit page</a> | "
2174
          response.write "<font size=-1>Domain: " & gHttpDomain & "</font><br>"
2175
'          end if
2175
 
2176
'          response.write "<a href='" & gScriptURL & "&a=logout&o=" & rs("title") & "'>Log out</a> | "
2176
'          response.write "<a href='" & gScriptURL & "' title='GO TO START PAGE'>Home</a> | "
2177
'          response.write "<a href='" & gScriptURL & "&a=list&o=ByTitle'>List pages</a> |  "
2177
'          if  Not gHideLogin Then
2178
'          response.write "<a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"
2178
'            response.write "<a href='" & gScriptURL & "&a=edit&o=" & rs("title") & "'>Edit page</a> | "
2179
'          If gHttpDomain <> "" Then
2179
'          end if
2180
'            response.write " | <a href='" & gScriptURL & "&a=rss' ><span style='background:#FF6600;text-decoration:none;font-family:tahoma;' >&nbsp;<b><font color=white>RSS</font></b>&nbsp;</span></a>"
2180
'          response.write "<a href='" & gScriptURL & "&a=logout&o=" & rs("title") & "'>Log out</a> | "
2181
'          End If
2181
'          response.write "<a href='" & gScriptURL & "&a=list&o=ByTitle'>List pages</a> |  "
2182
'
2182
'          response.write "<a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"
2183
'          response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&gSearchLabel&"&nbsp;<input title='Type in your search terms and press [Enter]' type='text' name='o' value=''/><input type='hidden' name='db' value='"& gDataSourceFile & "'><input type='hidden' name='dbname' value='" & gDataSourceName & "'><input type='hidden' name='a' value='search'></form></div> "
2183
'          If gHttpDomain <> "" Then
2184
 
2184
'            response.write " | <a href='" & gScriptURL & "&a=rss' ><span style='background:#FF6600;text-decoration:none;font-family:tahoma;' >&nbsp;<b><font color=white>RSS</font></b>&nbsp;</span></a>"
2185
          response.write "<font size='-1'>WikiAsp Engine version:  " & gEngineVersion & "</font>" & vbcrlf
2185
'          End If
2186
'          response.write "<br><font size='-1'>gScriptURL:  " & gScriptURL & "</font>" & vbcrlf
2186
'
2187
          response.write "</div>"
2187
'          response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&gSearchLabel&"&nbsp;<input title='Type in your search terms and press [Enter]' type='text' name='o' value=''/><input type='hidden' name='db' value='"& gDataSourceFile & "'><input type='hidden' name='dbname' value='" & gDataSourceName & "'><input type='hidden' name='a' value='search'></form></div> "
2188
      End If
2188
 
2189
End Sub
2189
          response.write "<font size='-1'>WikiAsp Engine version:  " & gEngineVersion & "</font>" & vbcrlf
2190
 
2190
'          response.write "<br><font size='-1'>gScriptURL:  " & gScriptURL & "</font>" & vbcrlf
2191
Sub WriteSessionData
2191
          response.write "</div>"
2192
    Dim name
2192
      End If
2193
    If 0 Then
2193
End Sub
2194
        ' Display all the Server Request Variables
2194
 
2195
        %>
2195
Sub WriteSessionData
2196
        <h1>Server Request Variables</h1>
2196
    Dim name
2197
        <div align="left">
2197
    If 0 Then
2198
        <table border="0" cellpadding="0" cellspacing="0" width="850">
2198
        ' Display all the Server Request Variables
2199
        <tr>
2199
        %>
2200
        <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2200
        <h1>Server Request Variables</h1>
2201
        <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2201
        <div align="left">
2202
        </tr>
2202
        <table border="0" cellpadding="0" cellspacing="0" width="850">
2203
        <%
2203
        <tr>
2204
        for each name in request.servervariables
2204
        <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2205
            %>
2205
        <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2206
            <tr>
2206
        </tr>
2207
            <td valign="top" align="left" width="250">
2207
        <%
2208
            <font face="Arial" size="1" color="#FF0000">
2208
        for each name in request.servervariables
2209
            <%= name %></font></td>
2209
            %>
2210
            <td valign="top" align="left" width="600">
2210
            <tr>
2211
            <font face="Arial" size="1"><%= request.servervariables(name) %></font></td>
2211
            <td valign="top" align="left" width="250">
2212
            </tr>
2212
            <font face="Arial" size="1" color="#FF0000">
2213
            <%
2213
            <%= name %></font></td>
2214
        Next
2214
            <td valign="top" align="left" width="600">
2215
        %>
2215
            <font face="Arial" size="1"><%= request.servervariables(name) %></font></td>
2216
        </table>
2216
            </tr>
2217
        </div>
2217
            <%
2218
        <%
2218
        Next
2219
    End If
2219
        %>
2220
    ' Display all the Contents of the Session Variable
2220
        </table>
2221
    %>
2221
        </div>
2222
    <h1>Session Variables</h1>
2222
        <%
2223
    <div align="left">
2223
    End If
2224
    <table border="0" cellpadding="0" cellspacing="0" width="850">
2224
    ' Display all the Contents of the Session Variable
2225
    <tr>
2225
    %>
2226
    <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2226
    <h1>Session Variables</h1>
2227
    <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2227
    <div align="left">
2228
    </tr>
2228
    <table border="0" cellpadding="0" cellspacing="0" width="850">
2229
    <%for each name in Session.Contents%>
2229
    <tr>
2230
    <tr>
2230
    <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2231
    <td valign="top" align="left" width="250">
2231
    <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2232
    <font face="Arial" size="1" color="#FF0000"><%= name %></font></td>
2232
    </tr>
2233
    <td valign="top" align="left" width="600">
2233
    <%for each name in Session.Contents%>
2234
    <%If VarType(Session(name)) < 100 Then %>
2234
    <tr>
2235
    <font face="Arial" size="1">[<%=TypeName(Session(name))%>:<%=VarType(Session(name))%>]&nbsp;<%=Session(name) %></font></td>
2235
    <td valign="top" align="left" width="250">
2236
    <%Else%>
2236
    <font face="Arial" size="1" color="#FF0000"><%= name %></font></td>
2237
    <font face="Arial" size="1">[<%=TypeName(Session(name))%>:<%=VarType(Session(name))%>]</font></td>
2237
    <td valign="top" align="left" width="600">
2238
    <%End If%>
2238
    <%If VarType(Session(name)) < 100 Then %>
2239
    </tr>
2239
    <font face="Arial" size="1">[<%=TypeName(Session(name))%>:<%=VarType(Session(name))%>]&nbsp;<%=Session(name) %></font></td>
2240
    <%Next%>
2240
    <%Else%>
2241
    <tr>
2241
    <font face="Arial" size="1">[<%=TypeName(Session(name))%>:<%=VarType(Session(name))%>]</font></td>
2242
    <td><font face="Arial" size="1" color="#FF0000">Timeout</font></td>
2242
    <%End If%>
2243
    <td><font face="Arial" size="1"><%=Session.Timeout%></font></td>
2243
    </tr>
2244
 
2244
    <%Next%>
2245
    <tr>
2245
    <tr>
2246
    <td><font face="Arial" size="1" color="#FF0000">SessionId</font></td>
2246
    <td><font face="Arial" size="1" color="#FF0000">Timeout</font></td>
2247
    <td><font face="Arial" size="1"><%=Session.SessionId%></font></td>
2247
    <td><font face="Arial" size="1"><%=Session.Timeout%></font></td>
2248
    </table>
2248
 
2249
    </div>
2249
    <tr>
2250
 
2250
    <td><font face="Arial" size="1" color="#FF0000">SessionId</font></td>
2251
    <%
2251
    <td><font face="Arial" size="1"><%=Session.SessionId%></font></td>
2252
    ' Display all the Contents of the Application Variable
2252
    </table>
2253
    %>
2253
    </div>
2254
    <h1>Application Variables</h1>
2254
 
2255
    <div align="left">
2255
    <%
2256
    <table border="0" cellpadding="0" cellspacing="0" width="850">
2256
    ' Display all the Contents of the Application Variable
2257
    <tr>
2257
    %>
2258
    <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2258
    <h1>Application Variables</h1>
2259
    <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2259
    <div align="left">
2260
    </tr>
2260
    <table border="0" cellpadding="0" cellspacing="0" width="850">
2261
    <%
2261
    <tr>
2262
    for each name in Application.Contents
2262
    <td valign="top" align="left" width="250"><font face="Arial" size="2" color="#FF0000"><b>Variable Name</b></font></td>
2263
    %>
2263
    <td valign="top" align="left" width="600"><font face="Arial" size="2"><b>Value</font></b></td>
2264
    <tr>
2264
    </tr>
2265
    <td valign="top" align="left" width="250">
2265
    <%
2266
    <font face="Arial" size="1" color="#FF0000">
2266
    for each name in Application.Contents
2267
    <%= name %></font></td>
2267
    %>
2268
    <td valign="top" align="left" width="600">
2268
    <tr>
2269
    <font face="Arial" size="1"><%= Application(name) %></font></td>
2269
    <td valign="top" align="left" width="250">
2270
    </tr>
2270
    <font face="Arial" size="1" color="#FF0000">
2271
    <%
2271
    <%= name %></font></td>
2272
    Next
2272
    <td valign="top" align="left" width="600">
2273
    %>
2273
    <font face="Arial" size="1"><%= Application(name) %></font></td>
2274
    </table>
2274
    </tr>
2275
    </div>
2275
    <%
2276
    <%
2276
    Next
2277
End Sub
2277
    %>
2278
 
2278
    </table>
2279
Sub HandleBrowse
2279
    </div>
2280
 
2280
    <%
2281
  sqlQuery = "select PageData,Title,LastEditor,LastUpdate from " & gDbTableName & " where title='" & glsTopic & "'"
2281
End Sub
2282
  EmitDebug 50, 2, "Browse query(" & sqlQuery & ")<br/>" & vbcrlf
2282
 
2283
 
2283
Sub HandleBrowse
2284
  set rs = gDataConn.execute(sqlQuery)
2284
 
2285
 
2285
  sqlQuery = "select PageData,Title,LastEditor,LastUpdate from " & gDbTableName & " where title='" & glsTopic & "'"
2286
  if rs.eof=true then
2286
  EmitDebug 50, 2, "Browse query(" & sqlQuery & ")<br/>" & vbcrlf
2287
        Response.Write("<center><h2>Page Creation</h2><hr>")
2287
 
2288
    if gHideLogin Then
2288
  set rs = gDataConn.execute(sqlQuery)
2289
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Does not exit and it cannot be created on this Server")
2289
 
2290
    ElseIf NOT gEnableEdit Then
2290
  if rs.eof=true then
2291
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Does not exit and it cannot be created until you enable editing")
2291
        Response.Write("<center><h2>Page Creation</h2><hr>")
2292
    Else
2292
    if gHideLogin Then
2293
        Response.Write("<br><br><span style='border: solid 2px black; padding: 10px;display:inline-block'>")
2293
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Does not exit and it cannot be created on this Server")
2294
        response.write("The page --> <b>" &  glsTopic & "</b>  <--- does not exist.")
2294
    ElseIf NOT gEnableEdit Then
2295
        response.write("<br><br><a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'><button style='color:red'>Create this page.</button></a>" )
2295
        Response.Write("The page --> <b>" &  glsTopic & "</b> <--- Does not exit and it cannot be created until you enable editing")
2296
        response.write("&nbsp;&nbsp;<a href='" & gScriptURL & "'><button>Don't create page.</button></a>" )
2296
    Else
2297
        Response.Write("</span>")
2297
        Response.Write("<br><br><span style='border: solid 2px black; padding: 10px;display:inline-block'>")
2298
    End If
2298
        response.write("The page --> <b>" &  glsTopic & "</b>  <--- does not exist.")
2299
        Response.Write("</center>")
2299
        response.write("<br><br><a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'><button style='color:red'>Create this page.</button></a>" )
2300
 
2300
        response.write("&nbsp;&nbsp;<a href='" & gScriptURL & "'><button>Don't create page.</button></a>" )
2301
  else
2301
        Response.Write("</span>")
2302
      EmitDebug 51, 3, "found...(" & rs("PageData") & ")<br/>" & vbcrlf
2302
    End If
2303
 
2303
        Response.Write("</center>")
2304
      If gEnableEdit Then
2304
 
2305
        response.write" <body ondblclick=" & chr(34) & "document.location.href='" & _
2305
  else
2306
            gScriptURL & "&a=edit&o=" & glsTopic    & "'" & chr(34) &">"
2306
      EmitDebug 51, 3, "found...(" & rs("PageData") & ")<br/>" & vbcrlf
2307
      Else
2307
 
2308
         response.write" <body >"
2308
      If gEnableEdit Then
2309
 
2309
        response.write" <body ondblclick=" & chr(34) & "document.location.href='" & _
2310
      End If
2310
            gScriptURL & "&a=edit&o=" & glsTopic    & "'" & chr(34) &">"
2311
 
2311
      Else
2312
      Call WriteBanner(rs("title"),rs("title"))
2312
         response.write" <body >"
2313
      response.write " <div class='wikibody'>" & WalkWiki(  xform( "<span id=bodyPrefix>" & vbcrlf & gWikiBodyPrefix & VbCrLF & "</span>" & VbCrLF &  rs("PageData")))  ' Elrey - xform func now removes html
2313
 
2314
      response.write "</b></i></font></u></strong></font>"
2314
      End If
2315
 
2315
 
2316
      
2316
      Call WriteBanner(rs("title"),rs("title"))
2317
      dim hideScript
2317
      response.write " <div class='wikibody'>" & WalkWiki(  xform( "<span id=bodyPrefix>" & vbcrlf & gWikiBodyPrefix & VbCrLF & "</span>" & VbCrLF &  rs("PageData")))  ' Elrey - xform func now removes html
2318
      hideScript = "var div1=document.getElementById('wikifooter'); if (div1) {div1.style.display='none';}"
2318
      response.write "</b></i></font></u></strong></font>"
2319
      hideScript = hideScript & "div1=document.getElementById('bodyPrefix'); if (div1) {div1.style.display='none';}"
2319
 
2320
      hideScript = hideScript & "div1=document.getElementById('idTopSearch'); if (div1) {div1.style.display='none';}"
2320
      
2321
 
2321
      dim hideScript
2322
      Call WriteFooter(hideScript, rs("LastUpdate"), rs("LastEditor")  )
2322
      hideScript = "var div1=document.getElementById('wikifooter'); if (div1) {div1.style.display='none';}"
2323
  end if
2323
      hideScript = hideScript & "div1=document.getElementById('bodyPrefix'); if (div1) {div1.style.display='none';}"
2324
 
2324
      hideScript = hideScript & "div1=document.getElementById('idTopSearch'); if (div1) {div1.style.display='none';}"
2325
end sub
2325
 
2326
 
2326
      Call WriteFooter(hideScript, rs("LastUpdate"), rs("LastEditor")  )
2327
 
2327
  end if
2328
 
2328
 
2329
sub handleCreate
2329
end sub
2330
    If gHideLogin Then
2330
 
2331
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")
2331
 
2332
        Response.End
2332
 
2333
        exit sub
2333
sub handleCreate
2334
    End If
2334
    If gHideLogin Then
2335
 
2335
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")
2336
    If NOT gEnableEdit Then
2336
        Response.End
2337
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed until logged in</h2></center>")
2337
        exit sub
2338
        Response.End
2338
    End If
2339
        exit sub
2339
 
2340
    End If
2340
    If NOT gEnableEdit Then
2341
 
2341
        Response.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed until logged in</h2></center>")
2342
  on error resume next
2342
        Response.End
2343
  VerifyWikiTable
2343
        exit sub
2344
  on error goto 0
2344
    End If
2345
  Response.Redirect gScriptURL
2345
 
2346
end sub
2346
  on error resume next
2347
 
2347
  VerifyWikiTable
2348
 
2348
  on error goto 0
2349
'Intercept RSS request here
2349
  Response.Redirect gScriptURL
2350
if ( glsMode = "rss" ) then
2350
end sub
2351
  If ( gHttpDomain = "" ) then
2351
 
2352
    response.write("RSS is not enabled")
2352
 
2353
  Else
2353
'Intercept RSS request here
2354
    handleRss
2354
if ( glsMode = "rss" ) then
2355
  End If
2355
  If ( gHttpDomain = "" ) then
2356
  response.End
2356
    response.write("RSS is not enabled")
2357
end if
2357
  Else
2358
 
2358
    handleRss
2359
'********************************************************************
2359
  End If
2360
'*********************************************************************
2360
  response.End
2361
'<?xml version="1.0" encoding="UTF-8" ?>
2361
end if
2362
'<!DOCTYPE html
2362
 
2363
'     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2363
'********************************************************************
2364
'     "DTD/xhtml1-transitional.dtd">
2364
'*********************************************************************
2365
'
2365
'<?xml version="1.0" encoding="UTF-8" ?>
2366
 
2366
'<!DOCTYPE html
2367
    Response.Buffer=TRUE
2367
'     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2368
%>
2368
'     "DTD/xhtml1-transitional.dtd">
2369
<html>
2369
'
2370
    <head>
2370
 
2371
        <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
2371
    Response.Buffer=TRUE
2372
        <title>
2372
%>
2373
<%
2373
<html>
2374
        if not isEmpty(glsMode) and glsMode <> "browse" then
2374
    <head>
2375
            response.write(glsMode & " ")
2375
        <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
2376
        end if
2376
        <title>
2377
        response.write(SpaceName(glsTopic))
2377
<%
2378
%>
2378
        if not isEmpty(glsMode) and glsMode <> "browse" then
2379
        </title>
2379
            response.write(glsMode & " ")
2380
        <LINK REL="StyleSheet" HREF="<%=gStyleSheet%>" TYPE="text/css" >
2380
        end if
2381
<%
2381
        response.write(SpaceName(glsTopic))
2382
       Response.Write(gHtmlHeadStr)
2382
%>
2383
%>
2383
        </title>
2384
    <link rel="shortcut icon" href="<%=gFavIcon%>"/>
2384
        <LINK REL="StyleSheet" HREF="<%=gStyleSheet%>" TYPE="text/css" >
2385
    </head>
2385
<%
2386
    <body>
2386
       Response.Write(gHtmlHeadStr)
2387
 
2387
%>
2388
    <%
2388
    <link rel="shortcut icon" href="<%=gFavIcon%>"/>
2389
 
2389
    </head>
2390
      if  Session("Hits") = "" then
2390
    <body>
2391
    Session("Hits")= 1
2391
 
2392
      else
2392
    <%
2393
    Session("Hits")= Session("Hits") + 1
2393
 
2394
      end if
2394
      if  Session("Hits") = "" then
2395
 
2395
    Session("Hits")= 1
2396
      EmitDebug 52, 1, "debug(" & gDebug & ")<br/>" & vbcrlf
2396
      else
2397
      EmitDebug 53, 1, "<br/>QueryString = (" & Request.QueryString & ")<br/>" & _
2397
    Session("Hits")= Session("Hits") + 1
2398
    "Hits(" & Session("Hits") & ")<br/>" & _
2398
      end if
2399
    "mode(" & glsMode & ")<br/>" & _
2399
 
2400
    "topic(" & glsTopic & ")<br/>"
2400
      EmitDebug 52, 1, "debug(" & gDebug & ")<br/>" & vbcrlf
2401
 
2401
      EmitDebug 53, 1, "<br/>QueryString = (" & Request.QueryString & ")<br/>" & _
2402
      set gDataConn = Server.CreateObject("ADODB.Connection")
2402
    "Hits(" & Session("Hits") & ")<br/>" & _
2403
 
2403
    "mode(" & glsMode & ")<br/>" & _
2404
      ' 21 nov - need resume next to catch "no file" error
2404
    "topic(" & glsTopic & ")<br/>"
2405
      on error resume next
2405
 
2406
      gDataConn.Open ConnStr(1)
2406
      set gDataConn = Server.CreateObject("ADODB.Connection")
2407
      on error goto 0
2407
 
2408
 
2408
      ' 21 nov - need resume next to catch "no file" error
2409
      if not (0 = gDataConn.errors.count) then
2409
      on error resume next
2410
    if (ADOERROR_NOFILE = gDataConn.errors(0).number) then
2410
      gDataConn.Open ConnStr(1)
2411
      EmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlf
2411
      on error goto 0
2412
      EmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_
2412
 
2413
        gDataConn.errors(0).description & ")<br/>" & vbcrlf
2413
      if not (0 = gDataConn.errors.count) then
2414
      VerifyWikiTable
2414
    if (ADOERROR_NOFILE = gDataConn.errors(0).number) then
2415
    end if
2415
      EmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlf
2416
      end if
2416
      EmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_
2417
 
2417
        gDataConn.errors(0).description & ")<br/>" & vbcrlf
2418
    select case (glsMode)
2418
      VerifyWikiTable
2419
        case "edit"    handleEdit
2419
    end if
2420
        case "list"    handleList
2420
      end if
2421
        case "search"  handleSearch
2421
 
2422
        case "create"  handleCreate
2422
    select case (glsMode)
2423
        case "save"    handleSave
2423
        case "edit"    handleEdit
2424
        case "browse"  handleBrowse
2424
        case "list"    handleList
2425
        case "logout"  handleLogout
2425
        case "search"  handleSearch
2426
        case "login"   handleLogin
2426
        case "create"  handleCreate
2427
        case "del"     handleDelete
2427
        case "save"    handleSave
2428
        case "config"  handleConfig
2428
        case "browse"  handleBrowse
2429
        case else
2429
        case "logout"  handleLogout
2430
    end select
2430
        case "login"   handleLogin
2431
 
2431
        case "del"     handleDelete
2432
    EmitDebug 56, 2, "<br/>done...<br/>" & vbcrlf
2432
        case "config"  handleConfig
2433
    gDataConn.Close()
2433
        case else
2434
    set gDataConn = nothing
2434
    end select
2435
    %>
2435
 
2436
 
2436
    EmitDebug 56, 2, "<br/>done...<br/>" & vbcrlf
2437
<% Response.Write(gFooterHtml) %>
2437
    gDataConn.Close()
2438
<% Response.Flush  %>
2438
    set gDataConn = nothing
2439
 
2439
    %>
-
 
2440
 
-
 
2441
<% Response.Write(gFooterHtml) %>
-
 
2442
<% Response.Flush  %>
-
 
2443