Subversion Repositories DevTools

Rev

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

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