Blame | Last modification | View Log | RSS feed
<% @LANGUAGE = VBScript %><%'+----------------------------------------------------------------------------+'| Description: |'| WikiAsp is a derivative of AspWiki, a wiki program written in ASP. |'| WikiAsp will run on Windows with IIS, MDAC v2.5. WikiAsp will |'| automatically create MS Access DB on first time use. |'| |'| The following are the dlls to make mdb creation work. |'| 1. Program Files\Common Files\System\ado\msadox.dll |'| 2. WINDOWS\System32\scrrun.dll |'| |'| Credits: |'| Elrey Ronald Velicaria. - Author of WikiAsp. (lambda326@hotmail.com) |'| Dino Chiesa - AspWiki author. |'| Contributors: Bjarne D, Julian Tosh |'| |'| Websites: |'| http://www.c2.com/cgi/wiki, http://www.c2.com/cgi/wiki?WikiAsp |'+----------------------------------------------------------------------------+'| Please retain the above credits on any future versions of this program |'+----------------------------------------------------------------------------+Option ExplicitResponse.CacheControl = "no-cache"Response.Expires = -1Response.AddHeader "Pragma", "no-cache"Dim gPassword, gDefaultIcon, gDefaultHomePage, gAutoCreateMdbDim gHttpDomain , gDebug, gEngineVersion, gDbTableNameDim gProvider, gDataConn, gDataSource, gDataSourceNameDim gDocRootDir, gDataSourceDir, gDataSourceFile, gSpaceNamesDim gScript, gScriptURL, giEditAreaRows, giEditAreaCols, giNumRecentFilesDim gHomeTopic, gStyleSheet, gIconName, gEditPassword, gIsOpenWikiDim glsTopic, glsMode , gHideLastEditor, gLoginFlag, gRemoveHtml,gBlackListedIpsDim gRE, gHighlightFlag, gHideWikiSource, gHideWikiFooter, gHideLogin, gHtmlHeadStrDim gDisableSave,gTimeZoneOffset, gRssStyle, gRedirectURLDim gBannerTemplate, gWikiBodyPrefix, gHideTopSearch, gDisableScriptingDim gMdbExtension , gSearchLabel, gBlackListedIpsRE ,gDeletePassword , gPersistPasswordDim gPasswordLabel, gFooterHtml, gEnableEdit'+-----------------------------------------------------------------------------+'| AN IMPORTANT NOTE: !!!!! |'| Enter your password below for creating new DB and for Delete. |'| Enter your URL inside quotes below e.g. http://www28.brinkster.com/site |'| Modify gDefaultIcon, gDefaultHomePage here is FSO objects is not installed |'+-----------------------------------------------------------------------------+gAutoCreateMdb = true ' Create db automaticallygDisableSave = false ' Set to true if you have to fully disable save.gBlackListedIps = "" ' List of IPs to reject. (Exact match 1st 3 digits of IP, delimit list by ~)gBlackListedIpsRE = "" ' List of IPs to reject (Regular ExpressionMatch)gRemoveHtml = false ' Set to true if HTML input in wiki will be enabled.gLoginFlag = "log" ' The default enable login flag ( must be overriden by config.asp).gIsOpenWiki = true ' Allow editing or Password Protect Editing?gHideWikiSource = false ' Allow viewing of unformatted wiki text when loggin in.gHideWikiFooter = false ' Show or Hide the whole wiki footergHideLogin = false ' Enable/Disable double-click or Edit. This can be overriden by &loggHideLastEditor = false ' Show/Hide in the footer the info about last editgDeletePassword = "passworddel" ' password for deletinggEditPassword = "password" ' password for editing the sitegPassword = "password" ' password for editing and delete and db creation.gHttpDomain = "auto" ' URL for RSS links to work. Override in config.asp . Set to "" to remove rss footer linksgDefaultIcon = "icon" ' This default. Maybe overridden if your site has icon.gif, icon.jpg or xxxx.gif and if FSO is working.gDefaultHomePage = "WikiAsp" ' modify your start page here. this may be overridden by .ini file. The .ini file is same dir as mdb filegDataSourceDir = "db" ' MSAccess folder. this is normally `db`gDocRootDir = "" ' physical absolute path of root (e.g. c:/dc2/mysite.com) make it blank if `gDataSourceDir` is relative to wiki.aspgTimeZoneOffset = "-0400" ' Put your serverTimezone offset here. East Coast is -0400 .gRssStyle = "" ' Example: "<?xml-stylesheet type=""text/xsl"" href=""rss.xsl"" ?>"gRedirectURL = ""gMdbExtension = ".mdb"gBannerTemplate = "" ' Banner html is now replaceable you need to remember $$icon$$, $$banner_text$$ variable thoughgWikiBodyPrefix = ""gHideTopSearch = falsegDisableScripting = truegSearchLabel = " Search On:"gPersistPassword = true ' Remember password by defaultgPasswordLabel = " To edit, enter the password: " ' The prompt label to use when entering a password. 4/2010gFooterHtml = "</body></html>" ' Now you can customize the footer with your chosen html. Even remove adsgEnableEdit = false'+-----------------------------------------------------------------------------+'| DO YOU WANT TO SEPARATE SOME CONFIG SETTINGS IN ANOTHER FILE? |'+-----------------------------------------------------------------------------+'| IF yes,just uncomment line after this box (by removing single quote as |'| the first character. If you do this, BE SURE TO CREATE config.asp |'| which will override the same variable settings above this box |'+-----------------------------------------------------------------------------+%><!--#include file="config.asp"--><%gDebug = 0 ' 0 - no debug message 1-6 for verbose debuggEngineVersion = "v1.6.4 beta Elrey Ronald V." ' Engine VersiongScript = "wiki.asp" ' Main ASP filename (this file)gProvider = "Microsoft.Jet.OLEDB.4.0" ' Db ProvidergiEditAreaRows = 30 ' Edit RowsgiEditAreaCols = 115 ' Edit ColumnsgiNumRecentFiles = 15 ' No. of wikipages to list in Recent files pagegDbTableName = "WikiData" ' Table name in the databasegSpaceNames = 1 ' 1 means put spaces in WikiNames, 0 - no spaces' Elrey 3/06 Now Override the gHttpDomain with this!!If gHttpDomain = "auto" ThengHttpDomain = "http://" & Request.ServerVariables("HTTP_HOST") & _Replace(Request.ServerVariables("URL"), "/" & gScript, "" )End If'check for database nameIf len(request("db")) > 0 ThengDataSourceFile = request("db")ElsegDataSourceFile = gDefaultHomePageEnd IfIf len(gDocRootDir) > 0 ThengDataSource = gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & gMdbExtensionElsegDataSource = gDataSourceDir & "\" & gDataSourceFile & gMdbExtensionEnd If'check for database human-readable nameIf len(request("dbname")) > 0 ThengDataSourceName = request("dbname")ElsegDataSourceName = "DefaultDb"End If' Can only Edit on the Test / Development System not on the Live SystemIf (IsEmpty(Application("LiveSystem"))) ThengHideLogin = falseIf (Session("login") <> 0) ThengHideWikiFooter = falsegEnableEdit = trueSession("login") = 1End IfgHideWikiFooter = NOT gEnableEditElsegHideLogin = truegHideWikiFooter = trueEnd If'set destination URLgScriptURL = gScript & "?db=" & gDataSourceFile ' removed & "&dbname=" & server.urlencode(gDataSourceName)gHomeTopic = gDataSourceFile ' default home topic is the same as ms access db name unless overwritten by .inigStyleSheet = "wiki.css"Call GetHomeTopic 'Get the topic from wiki.ini if it existsgIconName = gDefaultIconCall GetIconName 'Get the real icon nameDim rs, dts, i, sqlQueryConst ADOERROR_NOFILE = -2147467259 ' cannot find file (*.mdb)Const ADOERROR_NOTABLE = -2147217865 ' Cannot find output tableConst FOR_READING = 1Const FOR_WRITING = 2' Determine the action mode (edit/browse/save/list/search) or browseglsMode = ""If Not isEmpty(request("a")) ThenglsMode = request("a")ElseglsMode = "browse"End If' Determine the topic otherwise use home topic.glsTopic = "WikiAsp"If Not isEmpty(request("o")) ThenglsTopic = request("o")ElseglsTopic = gHomeTopicEnd If' Determine if RSS contains highlighting or notIf Not isEmpty(request("h")) thengHighlightFlag = trueElsegHighlightFlag = falseEnd If' Initialize the Regular Expression object variableSet gRE=server.createobject("VBScript.Regexp")gRE.IgnoreCase = FalsegRE.Global = Truedim httpRefererhttpReferer= Request.ServerVariables("HTTP_REFERER")' Get remote addresses globallydim remoteIPHostremoteIPHost = Request.ServerVariables("REMOTE_HOST")dim remoteIPAddrremoteIPAddr = Request.ServerVariables("REMOTE_ADDR")If IsNull( remoteIPHost) ThenremoteIPHost = "0.0.0.0"End IfIf IsNull( remoteIPHost) ThenremoteIPAddr = "0.0.0.0"End IfIf not IsEmpty( Session("pwd") ) ThenIf Session("pwd") = gPassword ThenremoteIPHost = "Editor"remoteIPAddr = ""End IfEnd If'-- Let us get he IP first 3 numbersdim remoteIPHost3numbersDim DotPosDotPos = InStrRev(remoteIPHost,".")remoteIPHost3numbers= mid(remoteIPHost,1,DotPos)'------------------------------------------------------------------------------------------------------------' SUBROUTINES AND FUNCTIONS'------------------------------------------------------------------------------------------------------------Sub GetHomeTopic'-----------------------------------------------------------------------' This looks for the Home Topic Name from the 1-line file wiki.ini file.'-----------------------------------------------------------------------Dim objFSOerr.ClearOn Error Resume NextSet objFSO = Server.CreateObject("Scripting.FileSystemObject")On Error GoTo 0If Not IsObject(objFSO) ThenExit SubEnd If'Open the ini file whch should be at same dir as access db fileDim objTextStreamDim strIniFileif len(gDocRootDir) > 0 thenstrIniFile= gDocRootDir & "\" & gDataSourceDir & "\" & gDataSourceFile & ".ini"elsestrIniFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".ini")end ifIf objFSO.FileExists(strIniFile) ThenSet objTextStream = objFSO.OpenTextFile(strIniFile, FOR_READING)gHomeTopic = objTextStream.ReadLine()objTextStream.CloseEnd If'' Check For db specific style sheet if any. First look CSS at the roo' If it is not there, look in the DB Folder. If not again there don't' Override the default (which is Wiki.css).'Dim strCssstrCss= Server.MapPath( gDataSourceFile & ".css")If objFSO.FileExists(strCss) ThengStyleSheet = gDataSourceFile & ".css"ElseDim strCssFilestrCssFile= Server.MapPath( gDataSourceDir & "\" & gDataSourceFile & ".css")If objFSO.FileExists(strCssFile) ThengStyleSheet = gDataSourceDir & "\" & gDataSourceFile & ".css"End IfEnd IfSet objTextStream = NothingSet objFSO = NothingEnd SubFunction DayName (intDay)'------------------------------------------' Returns Abbreviated Day of Week'------------------------------------------select case intDaycase 1DayName = "Sun"case 2DayName = "Mon"case 3DayName = "Tue"case 4DayName = "Wed"case 5DayName = "Thu"case 6DayName = "Fri"case 7DayName = "Sat"end selectend functionfunction MonthName(intMonth)'-----------------------------------------' Returns Abbreviated Month Name'-----------------------------------------select case intMonthcase 1MonthName = "Jan"case 2MonthName = "Feb"case 3MonthName = "Mar"case 4MonthName = "Apr"case 5MonthName = "May"case 6MonthName = "Jun"case 7MonthName = "Jul"case 8MonthName = "Aug"case 9MonthName = "Sep"case 10MonthName = "Oct"case 11MonthName = "Nov"case 12MonthName = "Dec"end selectend functionFunction GetRFC822date(dateVar)'----------------------------------------------' Returns standard format date for RSS feeds'----------------------------------------------GetRFC822date = DayName (WeekDay(dateVar)) & ", " & _Day(dateVar) & " " & MonthName(Month(dateVar)) & " " & _Year(dateVar) & " " & FormatDateTime(dateVar, 4) &":00 " & gTimeZoneOffsetEnd FunctionFunction WrappedQueryExecute( connObject, queryString )'----------------------------------------------' If something is wrong with db connection redirect to URL'----------------------------------------------Dim rsResultIf gRedirectURL = "" Thenset rsResult = connObject.execute(queryString)Elseon error resume nextset rsResult = connObject.execute(queryString)on error goto 0If isEmpty(rsResult) thenResponse.Redirect gRedirectURLResponse.EndEnd IfEnd IfSet WrappedQueryExecute = rsResultEnd FunctionFunction AnyFileExistsIn( objFSO, extensions, baseFilename)Dim arrIconExts, sIconPathFile, sIconFile, elementAnyFileExistsIn = falsearrIconExts = Split(extensions, ",")For Each element In arrIconExtssIconFile = baseFilename & elementsIconPathFile= Server.MapPath( sIconFile)If objFSO.FileExists(sIconPathFile) ThengIconName = sIconFileAnyFileExistsIn = trueExit ForEnd IfNextEnd FunctionSub GetIconName'-------------------------------------------------' Get the icon file name. gif first then jpg' Now it look a various places to guarantee an icon'-------------------------------------------------Dim objFSO, sIconPathFile, sIconFileerr.ClearOn Error Resume NextSet objFSO = Server.CreateObject("Scripting.FileSystemObject")On Error GoTo 0If Not IsObject(objFSO) ThenExit SubEnd If' look for <msaccessdb>.xxx icon fileDim iconSearchOrdericonSearchOrder = ".gif,.jpg,.png"' first look at the db directory, then on root , then for icon.xxx, otherwise default to the c2 iconIf not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceDir & "/" & gDataSourceFile ) ThenIf not AnyFileExistsIn( objFSO, iconSearchOrder, gDataSourceFile ) ThenIf not AnyFileExistsIn( objFSO, iconSearchOrder , gIconName ) ThengIconName = "http://c2.com/sig/wiki.gif"End IfEnd IfEnd IfSet objFSO = NothingEnd SubFunction SpaceName(strX)'------------------------------------------------------------' This function splits up a string into words by inserting a' space before each upper case letter. Ignores numbers and .'------------------------------------------------------------Dim i, strYi = 1strY = ""Do While i <= len(strX)If UCase(mid(strX,i,1)) = mid(strX,i,1) Thenif (( mid(strX,i,1) < "0" ) OR ( mid(strX,i,1) > "9")) AND ( mid(strX,i,1) <> ".")thenstrY = strY & " "end ifEnd IfstrY = strY & mid(strX,i,1)i = i + 1LoopEmitDebug 9, 2, "Original string: " & strX & " ... Spaced out string: " & strY & "<br/>"SpaceName = strYEnd FunctionFunction removeHTML(txt)removeHTML=server.htmlencode(txt)End FunctionFunction safeQuote(txt)If IsNull(txt) Thentxt = ""End IfsafeQuote=replace(txt,"'","''")End FunctionFunction replaceBoundingPattern(txt, pattern, tag)Dim workingTextworkingText = txtgRE.Pattern = pattern & "([^\n]{0,}?)" & pattern ' kgreinerworkingText= gRE.Replace(workingText, "<" & tag & ">$1</" & tag & ">")replaceBoundingPattern = workingTextEnd Function' Elrey RonaldFunction replaceTableColumnPattern(txt)Dim workingTextDim aryLines, aryLinesCountDim iworkingText = txtaryLines = Split(workingText,vbCRLF)aryLinesCount = UBound(aryLines)For i = 0 To aryLinesCountIf left(aryLines(i), 6 ) = "_tmp_0" ThenaryLines(i) = Replace(aryLines(i), "_tmp_0", "<tr><td valign=top class=TableCell>")aryLines(i) = Replace(aryLines(i), "||", "</td><td valign=top class=TableCell>")End IfIf left(aryLines(i), 6 ) = "_tmp_1" ThenaryLines(i) = Replace(aryLines(i), "_tmp_1", "<tr class=TableRow1><td valign=top class=TableCell>")aryLines(i) = Replace(aryLines(i), "||", "</td><td valign=top class=TableCell>")End IfIf left(aryLines(i), 6 ) = "_tmp_2" ThenaryLines(i) = Replace(aryLines(i), "_tmp_2", "<tr class=TableRow2><td valign=top class=TableCell>")aryLines(i) = Replace(aryLines(i), "||", "</td><td valign=top class=TableCell>")End IfIf left(aryLines(i), 6 ) = "_tmp_3" ThenaryLines(i) = Replace(aryLines(i), "_tmp_3", "<tr class=TableRow3><td valign=top class=TableCell>")aryLines(i) = Replace(aryLines(i), "||", "</td><td valign=top class=TableCell>")End IfNextreplaceTableColumnPattern= Join(aryLines,vbCRLF)End FunctionFunction AddAnchors(txt)Dim workingTextDim aryLines, aryLinesCountDim iDim tocTextworkingText = txtdim toc(100)dim tocIndex: tocIndex = 0aryLines = Split(workingText,vbCRLF)aryLinesCount = UBound(aryLines)For i = 0 To aryLinesCountIf left(aryLines(i), 3 ) = "== " Thentoc(tocIndex) = "<a href=""#Section_"& tocIndex &""">" & Mid(aryLines(i), 3) &"</a>"aryLines(i) = "<a name=""Section_"& tocIndex &"""></a>" & vbCRLF & aryLines(i)tocIndex = tocIndex + 1End IfNextif ( tocIndex > 0 ) thenDim iiDim TextFor ii = 0 to tocIndex -1Text = Text & vbcrlf & " *" & toc(ii)NexttocText = Text & vbcrlf & tocTextend if' Look for the spot to drop the TOC' [[TOC]]For i = 0 To aryLinesCountIf left(aryLines(i), 7 ) = "[[TOC]]" ThenaryLines(i) = tocText & vbCRLF' & aryLines(i)End IfNextAddAnchors = Join(aryLines,vbCRLF)End Function'Elrey 3/06Function RandomInteger(HighValue , LowValue )Rnd -1Randomize (time)RandomInteger = Int((HighValue - Lowvalue + 1) * Rnd() + Lowvalue)End FunctionFunction replaceListPattern(txt, wikiPattern, topPattern, bottomPattern, startLinePattern, endLinePattern)'' Search through the text, creating numbered lists' where so indicated by the pattern occurances.'' To indicate a numbered list, the pattern must always' appear at the very beginning of a line.'Dim workingText,replaceTextDim aryLines,aryLinesCountDim nPatternLength,bInsidePatternDim i'Elrey - added multiple patternDim aPatternsDim aPatternsCountDim aPatternLengthaPatterns = Split(wikiPattern,"^")aPatternsCount = UBound(aPatterns)Dim patternFound, jDim aStartPatternaStartPattern = Split(startLinePattern,"^")workingText = txtnPatternLength = len(wikiPattern)bInsidePattern = FalsearyLines = Split(workingText,vbCRLF)aryLinesCount = UBound(aryLines)For i = 0 To aryLinesCount' ElreypatternFound = 0For j = 0 to aPatternsCountaPatternLength = len( aPatterns(j) )If left( aryLines(i), aPatternLength ) = aPatterns(j) ThenpatternFound = 1Exit ForEnd IfNextIf patternFound = 1 ThenIf Not bInsidePattern ThenreplaceText = topPattern & vbCRLF & aStartPattern (j)bInsidePattern = TrueElsereplaceText = aStartPattern (j)End IfaryLines(i) = replaceText & right(aryLines(i),len(aryLines(i)) - aPatternLength ) & endLinePatternElseIf bInsidePattern ThenaryLines(i) = bottomPattern & vbCRLF & aryLines(i)bInsidePattern = FalseEnd IfEnd IfNextreplaceListPattern = Join(aryLines,vbCRLF)End FunctionFunction imageize(txt)' Include a tag like img:http://www.brinkster.com/images/brinksterlogo.gif' to get an inlined-image. <img src="foo">Dim workingTextworkingText = txt' referencing local images Elrey Ronald 1/2006gRE.IgnoreCase = TruegRE.Pattern = "(\s)(image:local|img:local):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img src='$3' >")gRE.IgnoreCase = TruegRE.Pattern = "(\s)(imageleft:local|imgleft:local):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img src='$3' align='left' style='margin-right:15pt'>")gRE.IgnoreCase = TruegRE.Pattern = "(\s)(imageright:local|imgright:local):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img src='$3' align='right' style='margin-left:15pt'>")gRE.IgnoreCase = TruegRE.Pattern = "(\s)(imgcenter:local|imagecenter:local|imgmiddle:local|imagemiddle:local):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<p align=center><img src='$3' align='middle'></p>" )gRE.IgnoreCase = TruegRE.Pattern = "(\s)(img|image):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3'>")gRE.Pattern = "(\s)(imgleft|imageleft):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='left' style='margin-right:15pt'>")gRE.Pattern = "(\s)(imgright|imageright):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<img title='$3' src='$3' align='right' style='margin-left:15pt'>")gRE.Pattern = "(\s)(imgcenter|imagecenter|imgmiddle|imagemiddle):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<p align=center><img title='$3' src='$3' align='middle' ></p>")' local linksgRE.IgnoreCase = TruegRE.Pattern = "(\s)(local):([^ \t\n\r]+)"workingText=gRE.Replace(workingText,"$1<a href='$3' >$3</a>")gRE.IgnoreCase = Falseimageize = workingTextEnd FunctionFunction isbnize(txt)' include a tag like isbn:0000000000' to get a link to a book on Amazon <a href="amazonURL?isbn=0000">0000</a>Dim workingTextworkingText = txtgRE.IgnoreCase = TruegRE.Pattern = "(\s)(isbn|ISBN):(\d{9}[\dX])"workingText=gRE.Replace(workingText,"$1<a title='Amazon $3' href='http://www.amazon.com/exec/obidos/ISBN=$3'>ISBN:$3</a>")gRE.IgnoreCase = False ' switch it backisbnize = workingTextEnd FunctionFunction IsRequestFromWikiASPPagedim sHiddensHidden = Request.Form("hiddenInput")If IsEmpty(sHidden) Thenresponse.write "hmmm empty"IsRequestFromWikiASPPage = FalseEnd ifIf sHidden <> "errv2010" Thenresponse.write "hmmm=" & sHiddenIsRequestFromWikiASPPage = FalseEnd ifIsRequestFromWikiASPPage = TrueEnd Function' Regular expression version ---------------------------Function IsRemoteAdressBlackListedREIf Trim(gBlackListedIpsRE ) = "" ThenIsRemoteAdressBlackListedRE = FalseelsegRE.Pattern = gBlackListedIpsREIsRemoteAdressBlackListedRE = gRE.Test( remoteIPHost)End IfEnd Function' Non RE version (Exact)--------------------------------Function IsRemoteBlackListedIsRemoteBlackListed = FalseDim pospos = InStr(gBlackListedIps, remoteIPHost3numbers) ' Leading 3 digits. Set IP list as ~1.2.3.~4.5.3~If Not IsNull(pos) and pos > 0 ThenIsRemoteBlackListed = TrueEnd IfEnd FunctionFunction hyperlink(txt)Dim workingTextDim matchesDim nHitsDim thisMatchBefore, thisMatchAfterworkingText = txt'pattern with no spaces:'gRE.Pattern = "(http|https)://[^ \t\n\r]+"'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]]+)"'ElreyRonald 8/03 Bjarne 10/31gRE.Pattern = "([^\[])\[([^\|\]]+)\|((http://|https://|ftp://|mailto:|news:|file:)[^\]\r\n\t]+)\]"workingText=gRE.Replace(workingText,"$1<a href='$3'>$2</a>")'ElreyRonald local links inside [ | ]gRE.Pattern = "([^\[])\[([^\|\]]+)\|(local):([^ \t\n\r]+)\]"workingText=gRE.Replace(workingText,"$1<a href='$4'>$2</a>")'gRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:)[^\s\<\>\(\)\[\]\r\n\t]+)"'BjarnegRE.Pattern = "([^A-Za-z0-9'])((http://|https://|ftp://|mailto:|news:|file:)[^\s\<\>\(\)\[\]\r\n\t]+)"workingText=gRE.Replace(workingText,"$1<a href=""$2"">$2</a>")'This is new 5/2006 see [/Drop]'[Drop#001##Test]' 1 [ 2 :: 3 ]gRE.Pattern = "([^\[])\[Drop\#(\S+)\#\#([^\<\>\(\)\=\r\n\t\]]+)\]"workingText=gRE.Replace(workingText, _"$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=' ← ';} else {div.style.display='none';this.innerText=' + '}""> + </span>$3<div id='$2' style='display:none'> " )' interwiki by Elrey' example: [Sample One=CpOrders::SampleOne]' 1 [ 2 = 3 :: 4 ]gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3&o=$4'>$2</a>")' interwiki by Elrey' example: [Sample One=CpOrders::]' 1 [ 2 = 3 :: ]gRE.Pattern = "([^\[])\[([^=\]]+)\=([^=\]]+)\:\:\]"workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$3'>$2</a>")' intern link by Bernd Michalke 9/15/2005' [anything geht=WikiASP]gRE.Pattern = "([^\[])\[([^=\]]+)\=([^\s\<\>\(\)\=\r\n\t\]]+)\]"workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$3'>$2</a>")' intern link by Elrey 3/2006' [=WikiASP]' (--1--) (-2----)gRE.Pattern = "([^\[])\[=([^\]]+)\]"workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")' intern link by Elrey 3/2006' [[WikiAS P topic]]' (--1--) (---2--)gRE.Pattern = "([^\[])\[\[([^\]]+)\]\]"workingText=gRE.Replace(workingText,"$1<a href='"& gScriptURL & "&o=$2'>$2</a>")' interwiki by Elrey' example: [CpOrders::SampleOne]' 1 [ 2 :: 3 ]gRE.Pattern = "([^\[])\[([^=\]]+)\:\:([^\s\<\>\(\)\=\r\n\t\]]+)\]"workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2&o=$3'>$3</a>")' interwiki by Elrey' example: [CpOrders::]' 1 [ 2 :: ]gRE.Pattern = "([^\[])\[([^=\]]+)\:\:\]"workingText=gRE.Replace(workingText,"$1<a href='" & gScript & "?db=$2'>$2</a>")hyperlink = workingTextEnd FunctionFunction PreHack(isTeksten)Dim arrDim elementDim preOnDim newTextpreOn = Falsearr = Split(isTeksten, vbCrLf)For Each element In arrIf newtext <> "" Thennewtext = newtext & vbCrLfEnd If' line begins with a spaceIf left(element, 1) = " " Then' start pre tagIf preOn = False Thenpreon = truenewText = newtext & "<pre>" & vbcrlf & element' already in pre tagelsenewtext = newtext & elementend if' empty lineelseif element = "" thennewtext = newtext & vbcrlf' line begins with something besides a spaceelse' turn pre offif preon thennewText = newtext & "</pre>" & vbcrlf & elementpreon = false' just append elementelsenewtext = newtext & elementend ifend ifnextif preon thennewtext = newtext & "</pre>"preon = falseend ifprehack = newtextend functionfunction xform(isTeksten)' this is the transformation routine, in which all the markup' is transformed into HTML.'' ordering of the stages is important.'dim newTextnewText = vbcrlf & isTeksten ' need a space to deal with first-line wikiname'Elrey - move HTML removal into hereIf gRemoveHtml ThennewText = removeHTML(newText)End If' indented paragraph second level using '>' ( '|' is now used with Tables - ElreynewText=replace(newText,vbcrlf & ">>>>",vbcrlf & "<p style=""margin-left:80pt;"">")newText=replace(newText,vbcrlf & ">>>",vbcrlf & "<p style=""margin-left:60pt;"">")newText=replace(newText,vbcrlf & ">>",vbcrlf & "<p style=""margin-left:40pt;"">")newText=replace(newText,vbcrlf & ">",vbcrlf & "<p style=""margin-left:20pt;"">")' Elrey 3/2007newText=replace(newText,vbcrlf & ">>>>>>>>>*",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">♣ ")newText=replace(newText,vbcrlf & ">>>>>>>>*",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">ⅾ ")newText=replace(newText,vbcrlf & ">>>>>>>*",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">ο ")newText=replace(newText,vbcrlf & ">>>>>>*",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">• ")newText=replace(newText,vbcrlf & ">>>>>*",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">♦ ")newText=replace(newText,vbcrlf & ">>>>*",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">→ ")newText=replace(newText,vbcrlf & ">>>*",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">◊ ")newText=replace(newText,vbcrlf & ">>*",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">ο ")newText=replace(newText,vbcrlf & ">*",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">• ")' indented paragraph second level using '>' ( '|' is now used with Tables - Elrey updated 3/2007newText=replace(newText,vbcrlf & ">>>>>>>>>",vbcrlf & "<p style=""margin-left:135pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>>>>>>",vbcrlf & "<p style=""margin-left:120pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>>>>>",vbcrlf & "<p style=""margin-left:105pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>>>>",vbcrlf & "<p style=""margin-left:90pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>>>",vbcrlf & "<p style=""margin-left:75pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>>",vbcrlf & "<p style=""margin-left:60pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>>",vbcrlf & "<p style=""margin-left:45pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">>",vbcrlf & "<p style=""margin-left:30pt;margin-top:2pt;"">")newText=replace(newText,vbcrlf & ">",vbcrlf & "<p style=""margin-left:15pt;margin-top:2pt;"">")' newlines: three newlines = a blank linenewText=replace(newText,vbcrlf & vbcrlf & vbcrlf,vbcrlf & "<br/> <br/></p><p>" & vbcrlf )' newlines: two newlines = a hard returnnewText=replace(newText,vbcrlf & vbcrlf,vbcrlf & "<br/></p><p>" & vbcrlf )EmitDebug 10, 4, "xform-before(" & newText & ")<br/>"If right(newText,2) <> vbcrlf ThennewText = newText & vbcrlfEnd If'David PurdienewText=replace(newText, "$Page$", glsTopic )newText=replace(newText, "$image$", "local:images/page_" + glsTopic )newText=replace(newText, "$domain$", gHttpDomain )' toc davidnewText = AddAnchors(newText)'Elrey RonaldnewText=replaceListPattern(newText, " *", "<ul>", "</ul>", "<li> ", "</li>")newText=replaceListPattern(newText, " :*", "<ol>", "</ol>", "<li> ", "</li>")newText=replaceListPattern(newText, " 1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")'Elrey Ronald - more convenient bullet listnewText=replaceListPattern(newText, " *", "<ul>", "</ul>", "<li> ", "</li>")newText=replaceListPattern(newText, " :*", "<ol>", "</ol>", "<li> ", "</li>")newText=replaceListPattern(newText, " 1.", "<ol class='nlist'>", "</ol>", "<li> ", "</li>")'Elrey Ronald - Table PatternnewText=replaceListPattern(newText, "||^!|^|!^!!", "<table border=1 class=TableClass>", "</table>", "_tmp_0^_tmp_1^_tmp_2^_tmp_3", "</td></tr>")newText=replaceTableColumnPattern(newText)' leading space rulenewText = PreHack(newText)' outline ( ElreyRonald )gRE.Pattern = "\r\n\[(\d+)\]======([^\r\n]+)"newText=gRE.Replace(newText,"<h6>[<a name='$1' href='#fn_$1'>$1</a>] $2</h6>")gRE.Pattern = "\r\n\[(\d+)\]=====([^\r\n]+)"newText=gRE.Replace(newText,"<h5>[<a name='$1' href='#fn_$1'>$1</a>] $2</h5>")gRE.Pattern = "\r\n\[(\d+)\]====([^\r\n]+)"newText=gRE.Replace(newText,"<h4>[<a name='$1' href='#fn_$1'>$1</a>] $2</h4>")gRE.Pattern = "\r\n\[(\d+)\]===([^\r\n]+)"newText=gRE.Replace(newText,"<h3>[<a name='$1' href='#fn_$1'>$1</a>] $2</h3>")gRE.Pattern = "\r\n\[(\d+)\]==([^\r\n]+)"newText=gRE.Replace(newText,"<h2>[<a name='$1' href='#fn_$1'>$1</a>] $2</h2>")' footnote ( ElreyRonald )gRE.Pattern = "\r\n\[(\d+)\]\r\n" ' blank footnote will just be an anchor (ElreyRonald)newText=gRE.Replace(newText, "<a name='$1' href='#fn_$1'><hr size=1></a>" & vbcrlf)gRE.Pattern = "\r\n\[(\d+)\]"newText=gRE.Replace(newText, "<br>[<a name='$1' href='#fn_$1'>$1</a>]")gRE.Pattern = "\[(\d+)\]"newText=gRE.Replace(newText, "[<a href='#$1' name='fn_$1'>$1</a>]")' topic line (ElreyRonald)gRE.Pattern = "\r\n======([^\r\n]+)"newText=gRE.Replace(newText,"<h6>$1</h6>")gRE.Pattern = "\r\n=====([^\r\n]+)"newText=gRE.Replace(newText,"<h5>$1</h5>")gRE.Pattern = "\r\n====([^\r\n]+)"newText=gRE.Replace(newText,"<h4>$1</h4>")gRE.Pattern = "\r\n===([^\r\n]+)"newText=gRE.Replace(newText,"<h3>$1</h3>")gRE.Pattern = "\r\n==([^\r\n]+)"newText=gRE.Replace(newText,"<h2>$1</h2>")' horizontal rulegRE.Pattern = "\r\n-{4,}"newText=gRE.Replace(newText,vbCrLf & "<hr size=1 noshade=false />" & vbcrlf)' special case for dash and a-umlaut - MARKUS'newText=replace(newText,"-", "−") ' this change breaks image URLs that include dashesnewText=replace(newText,"", "ä")' removed by ElreyRonald, use "|"' newText=replace(newText,chr(9) & " :" & chr(9),"<p style=""margin-left:20pt;"">")' Removed by ElreyRonald, use "|"' newText=replace(newText,vbcrlf & chr(9) & "]",vbcrlf & "<p style=""margin-left:20pt;"">")'[MARKUS] Underline neu hinzugefgt - -_ irgendwas _-newText=replace(newText,"-_", "<u>")newText=replace(newText,"_-","</u>")'[Markus] LEERSTELLEN werden in HTML-Leerstellen umgewandelt'newText=replace(newText," "," ") ' this change screws up images. Why necessary? dinoch Thu, 17 Oct 2002' bulleted lists: tab-star'newText=replace(newText,chr(9) & "*","<li> ")newText=replaceListPattern(newText, chr(9) & "*", "<ul>", "</ul>", "<li> ", "</li>")' numbered lists: tab-colon-starnewText=replaceListPattern(newText, chr(9) & ":*", "<ol>", "</ol>", "<li> ", "</li>")' numbered lists: Changed to use 1. to conform with http://www.c2.com/cgi/wiki?TextFormattingRulesnewText=replaceListPattern(newText, chr(9) & "1.", "<ol>", "</ol>", "<li> ", "</li>")' COLORS: (german and english)- german removed (ElreyRonald)'SCHRIFTFARBEN {schwarz} {braun} {grn} {blau} {gelb} {rot} {orange}'{farbe} {/farbe}newText=replace(newText,"{black}","<font color=black>")newText=replace(newText,"{/black}","</font>")newText=replace(newText,"{green}","<font color=darkgreen>")newText=replace(newText,"{/green}","</font>")newText=replace(newText,"{blue}","<font color=darkblue>")newText=replace(newText,"{/blue}","</font>")newText=replace(newText,"{sienna}","<font color=sienna>")newText=replace(newText,"{/sienna}","</font>")newText=replace(newText,"{red}","<font color=firebrick>")newText=replace(newText,"{/red}","</font>")newText=replace(newText,"{pink}","<font color=deeppink>")newText=replace(newText,"{/pink}","</font>")' 5/2006newText=replace(newText,"[/Drop]","</div></div>")'newText=replace(newText,"{italic}","<I>")newText=replace(newText,"{/italic}","</I>")newText=replace(newText,"{bold}","<strong>")newText=replace(newText,"{/bold}","</strong>")' CHANGE SIZE / SCHRIFTGRSSE'SMALLER / KLEINERnewText=replace(newText,"{small}","<font size='-1'>")newText=replace(newText,"{/small}","</font>")newText=replace(newText,"{smaller}","<font size='-2'>")newText=replace(newText,"{/smaller}","</font>")newText=replace(newText,"{smallest}","<font size='-3'>")newText=replace(newText,"{/smallest}","</font>")'LARGER / GRSSERnewText=replace(newText,"{big}","<font size='+1'>")newText=replace(newText,"{/big}","</font>")newText=replace(newText,"{bigger}","<font size='+2'>")newText=replace(newText,"{/bigger}","</font>")newText=replace(newText,"{biggest}","<font size='+3'>")newText=replace(newText,"{/biggest}","</font>")' this is were you can insert your own bracket comands...newText=replace(newText,"{br}","<br/>")' images:newText= imageize(newText)' isbns:newText= isbnize(newText)' auto-hyperlinksnewText= hyperlink(newText)' bold text: three single quotesnewText= replaceBoundingPattern(newText,"'''","b")' em text: two single quotesnewText= replaceBoundingPattern(newText,"''","em")' consolidate a series of trailing vbcrlf to just 2.gRE.Pattern = "(\r\n){3,}$"newText=gRE.Replace(newText, vbcrlf & vbcrlf)If gDisableScripting = false Then' 2007.08.25 disable scriptsgRE.Pattern = "<([s|S][c|C][r|R][i|I][p|P][t|T])"newText=gRE.Replace(newText, "<$1")End IfEmitDebug 11, 4, "xform-after(" & newText & ")<br/>"newText = Replace(newText, "#@91;", "[")newText = Replace(newText, "#@93;", "]")newText = Replace(newText, "#@3A;", ":")newText = Replace(newText, "#@3C;", "<")newText = Replace(newText, "#@3E;", ">")xform = newTextEnd FunctionFunction WalkWiki(isTeksten)Dim myTextmyText = isTekstenWalkWiki = myTextEnd Functionfunction RemoveBrackets(s)Dim tsts = replace( s, "[","")ts = replace( ts, "]","")RemoveBrackets = tsend functionfunction RemoveSpaces(s)Dim tsts = replace( s, " ","")RemoveSpaces = tsend functionSub EmitDebug(sig,lvl,arg)If gDebug >= lvl Then Response.Write("debug:" & sig & " " & arg & vbcrlf)End Sub'----------------------------------------------------' This function builds and returns the connection' string, based on input provided from the web form.'function ConnStr(includeMode)dim localDs' Map MDB database to physical pathif len(gDocRootDir) > 0 thenlocalDs = gDataSourceelselocalDs = Server.MapPath(gDataSource)end ifConnStr= "Provider=" & gProvider & ";Data Source=" & localDs & ";"if (includeMode) thenConnStr= ConnStr & "mode= Share Deny None"end ifEmitDebug 20, 3, "ConnStr= (" & ConnStr & ")<br/>"end functionsub CheckDbErrorsif gDataConn.errors.count> 0 thendim counterresponse.write "<br/><b>Database Errors Occurred" & "</b><br/>" & vbcrlffor counter= 0 to gDataConn.errors.countresponse.write "Error #" & gDataConn.errors(counter).number & vbcrlf & "<br/>"response.write " Description(" & gDataConn.errors(counter).description & ")" & vbcrlf & "<br/>"nextelseresponse.write "<br/><b>No Database Errors Occurred" & "</b><br/>" & vbcrlfend ifend sub' Elrey Ronald 2/21/05sub VerifyWikiTableNoAdoxComponenton error resume nextgDataConn.Open ConnStr(0)on error goto 0on error resume nextgDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")on error goto 0end sub'----------------------------------------------------------------------------' VerifyWikiTable' This routine:' (a) verifies the existence of the target database (dbname) at the given' ADO connection. If necessary, this routine creates that' database.' (b) verifies the existence of the table in that database. If necessary,' this routine will create the required table, and build the table' structure. The columns in the target table are determined by the' fields in the source record set (sourceRs). Two additional' columns are also added. (in fact we do not use the entire recordset,' but only the collection of fields in the recordset.'sub VerifyWikiTableif not gAutoCreateMdb thenCall VerifyWikiTableNoAdoxComponentExit SubEnd Ifdim tbl, cat, dbname, fsodim fsoErrMessage, adoxErrMessage, instructionsfsoErrMessage = "<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>"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>"instructions = "<LI>You may have to <b>MANUALLY</b> create the folder/MsAccess file -> <b>" & gDataSource & " </b> </LI>" & _"<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>" & _"<LI>You may modify 'gAutoCreateMdb' and set it to false to prevent creation of MDB and avoid this message." & _"<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>" & _"<BR><BR><B><i>Now trying to use default values to see if this would work...</i></B>"err.clear' Check if ADOX.Catalog component is available in this computeron error resume nextset cat= CreateObject("ADOX.Catalog")on error goto 0' Check if FileSystemObject component is available in this computeron error resume nextset fso = CreateObject("Scripting.FileSystemObject")on error goto 0If Not IsObject(cat) or cat is nothing ThenResponse.Write( adoxErrMessage)Response.Write( instructions )Call VerifyWikiTableNoAdoxComponentExit SubEnd Iferr.clearIf Not IsObject(fso) ThenResponse.Write( fsoErrMessage)Response.Write( instructions )Call VerifyWikiTableNoAdoxComponentExit SubEnd Ifif len (gDocRootDir) > 0 thendbname = gDataSourceelsedbname = Server.MapPath(gDataSource)end if'--------------------------------------------' step 0: check the directory, create if necessarydim folder, f1if len (gDocRootDir) > 0 thenf1 = gDocRootDir & "\" & gDataSourceDirelsef1 = Server.MapPath(gDataSourceDir)end ifif not fso.FolderExists(f1) thenon error resume nextSet folder = fso.CreateFolder(f1)on error goto 0If Not IsObject(folder) ThenResponse.Write( "Unable to create [" & f1 & "]. Please modify DOCROOT and gDataSourceDir in the program. Consult your website settings." )Response.EndEnd Ifset folder = nothingend ifset fso = nothing'---- some security hereIf gDataSourceFile <> gDefaultHomePage ThenDim pwdIf Request.QueryString("pw") <> gPassword ThenResponse.Write("Sorry but the Database (db) requested does not exist, or may not be writable.<br>Correct password must be sent to create it.")Response.Write("<br>Hint. Add &pw=" & gPassword & " to the URL.")Response.Write("<p>Folder:" & f1 & ".")Response.Write("<br>DataBase:" & gDataSource & ".")Response.EndEnd IfEnd If'--------------------------------------------' step 1: create the new db catalog, if necessaryErr.ClearEmitDebug 21, 2, vbcrlf & " creating db " & dbname & "<br/>"on error resume nextcat.Create ConnStr(0)on error goto 0EmitDebug 22, 2, ">> error(" & err.Number & "," & err.Description & ")<br/>"'EmitDebug 23, 2, vbcrlf & " catConnErrorCount(" & _' cat.ActiveConnection.errors.count & ")<br/>"if not (err.Number = 0) thenif not (err.Description = "Database already exists." ) thendim sErrorsError = ">> error(" & err.Number & "," & err.Description & ")" & _"(EXPECTED ""Database already exists"")..." & "<br/>"EmitDebug 24, 2, sErrorResponse.Write( "<span style='color:red'>Fatal error creating db: " & err.Number & " " & err.description & "</span>")elseEmitDebug 25, 2, ">> Database already exists..." & "<br/>"cat.ActiveConnection= ConnStr(0)end ifelseEmitDebug 26, 2, ">> Database has just been created..." & "<br/>"end ifEmitDebug 27, 2, " Database now exists..." & "<br/>"'--------------------------------------------' step 2: create the new table, with columns, if necessaryErr.ClearEmitDebug 28, 2, " verifying presence of table(" & gDbTableName & ")<br/>"'if not isNothing(gDataConn) then set gDataConn = nothingon error resume nextset gDataConn = Server.CreateObject("ADODB.Connection")on error goto 0If Not IsObject(gDataConn) ThenResponse.Write ( "Unable to establish connection. Missing ADO object.")Response.EndEnd Ifon error resume nextgDataConn.Open ConnStr(0)on error goto 0on error resume nextgDataConn.execute("select PageData, Title from " & gDbTableName & " where ID = 2")on error goto 0if (0 = gDataConn.errors.count) thenEmitDebug 29, 1, vbcrlf & "(no db errors, ergo table exists)" & "<br/>"elseif ((gDataConn.errors.count>0) and ( ADOERROR_NOTABLE = gDataConn.errors(0).number)) thenset gDataConn = nothing' error: table does not exist.EmitDebug 30, 2, vbcrlf & " creating table " & gDbTableName & "<br/>"Dim idx 'As New ADOX.Indexset idx= CreateObject("ADOX.Index")' now, create a new table in the db:set tbl= CreateObject("ADOX.Table")With tbl' drop tbl into a MDB provider context; need to do this NOW' to be able to use autoIncrement, later.set .ParentCatalog = cat' Name the new table..Name = gDbTableName.Columns.Append "ID", 3.Columns("ID").Properties("AutoIncrement") = True.Columns.Append "Title", 202, 127.Columns.Append "PageData", 203.Columns.Append "PrevPageData", 203.Columns("PrevPageData").Properties("Jet OLEDB:Allow Zero Length") = True.Columns("PrevPageData").Properties("Nullable") = True.Columns.Append "LastUpdate", 7 ' timestamp.Columns.Append "LastEditor", 202, 127' create the Primary Key :idx.Name = "RecordIndex"idx.Columns.Append "ID"idx.PrimaryKey = Trueidx.Unique = True.Indexes.Append idxEnd With' this appends the table to the db catalogcat.Tables.Append tblEmitDebug 31, 2, vbcrlf & " post-append: catConnErrorCount(" & _cat.ActiveConnection.errors.count & ")<br/>"set idx= nothing' insert the first record into the newly-created tableEmitDebug 32, 2, ">> inserting into table(" & gDbTableName & ")<br/>"set gDataConn = Server.CreateObject("ADODB.Connection")gDataConn.Open ConnStr(1)dts = NowEmitDebug 33, 2, ">> the time is now(" & dts & ")<br/>"DoInitialPageCreation(".")elseEmitDebug 34, 2, ">> table " & tablename & " already exists?" & "<br/>"end ifset cat = nothingset tbl = nothingon error goto 0end subFunction DoInitialPageCreation(folderspec)Dim fso, f, f1, fc, s, dts, sPageData, fPage, stmntSet fso = CreateObject( "Scripting.FileSystemObject" )EmitDebug 35, 2, ">> checking dir (" & Server.MapPath(folderspec) & ")<br/>"Set f = fso.GetFolder(Server.MapPath(folderspec))Set fc = f.FilesEmitDebug 36, 2, ">> files counted (" & fc.Count & ")<br/>"For Each f1 in fcif (Right(f1.name, 4) = ".wik") thens = Left(f1.name, Len(f1.name)-4)EmitDebug 37, 2, ">> found file (" & s & ")<br/>"on error resume nextset fPage= fso.OpenTextFile(Server.MapPath(f1.name),FOR_READING)sPageData = fPage.ReadAllon error goto 0fPage.Closeset fPage = nothingdts = Now ' timestampEmitDebug 38, 2, ">> inserting record (" & s & ")<br/>"stmnt = "INSERT INTO " & gDbTableName & " (Title,PageData,PrevPageData,LastUpdate,LastEditor) " & _"VALUES ( '" & s & "','" & safeQuote(sPageData) & "', '--', '" & dts & "', '" & gScript & " (initial creation)');"on error resume nextgDataConn.execute(stmnt)on error goto 0if gDebug>=1 then CheckDbErrorsend ifNextset fso = nothingset f = nothingset fc = nothingend Functionfunction theWhereClause(theStr)dim resultresult= ""dim myArraydim elementEmitDebug 39, 1, "whereClause(" & theStr & ")<br/>" & vbcrlfmyArray = split(Trim(theStr), " ")for each element in myArrayelement = Trim(element)if (result = "") thenresult = " where "elseresult = result & " and "end ifresult= result & " PageData like '%" & element & "%'"nextEmitDebug 40, 1, "whereClause:result(" & result & ")<br/>" & vbcrlftheWhereClause = resultend functionsub handleLogoutDim urlurl = gScriptURL & "&o=" & glsTopicgEnableEdit = falseSession.AbandonResponse.Redirect(url)end subsub handleLoginDim urlurl = gScriptURL & "&o=" & glsTopicgEnableEdit = trueSession("login") = 1Response.Redirect(url)end subsub handleEditIf NOT gEnableEdit ThenResponse.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")Response.Endexit subEnd IfDim readonlyflag, disableflagreadonlyflag = ""disableflag = ""' If glsTopic = "TextFormattingRules" Then' exit sub' End IfIf IsRemoteBlackListed ThenResponse.Write("<br/><br/><br/><br/><br/><center><h2>Please send e-mail to this site's Web Master ASAP.</h2></center>")Response.EndExit SubEnd IfIf glsTopic <> "WikiSandBox" _and glsTopic <> "VwisitorsPage" _and glsTopic <> "VisitorsPage" _and ( not gIsOpenWiki or _glsTopic = "TextFormattingRules" ) ThenIf Not IsEmpty(Request.Form("pwd")) Then Session("pwd") = Request.Form("pwd")If IsEmpty( Session("pwd") ) or _( Session("pwd") <> gEditpassword and _Session("pwd") <> gPassword ) ThenResponse.Write "<br/><center><img src='" &gIconName & "'><form id=form1 name=form1 method=post action='" & _gScript & "?a=edit&o=" & glsTopic & "&db=" & gDataSourceFile & _"'> " & gPasswordLabel & "<input type=password name=pwd id=pwd><input type=submit value=Go></form>"' "<hr><a href=mailto:lambda326@hotmail.com>Send me an E-mail </a> to get a password . For now, you can only <b>click and edit</b> <a href=wiki.asp?o=WikiSandBox>WikiSandBox</a><hr></center>"readonlyflag = "readonly style='font-size:8pt; background:silver; border:solid 1px '"disableflag = " disabled "End IfEnd IfsqlQuery = "select PageData,Title, lastupdate, PrevPageData from " & gDbTableName & " where title='" & glsTopic & "'"EmitDebug 41, 2, "Edit query(" & sqlQuery & ")<br/>" & vbcrlf'set rs = gDataConn.execute(sqlQuery)set rs = WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007dim strPageData, strTitle, strLastUpdate, strPrevPageDataif not rs.eof then'page existsstrTitle = rs("title")strPageData = rs("pageData")strLastUpdate = CStr(rs("lastupdate"))strPrevPageData = rs("PrevPageData")else'page does not existstrTitle = glsTopicstrPageData = ""strLastUpdate = ""strPrevPageData = ""end if'If Not gHideWikiSource Thenresponse.write("<form id=form1 name=form1 method=""POST"" action=""" & gScript & """>" & vbcrlf)response.write "<h4>Edit: <font color=blue> " & SpaceName(strTitle) & "</font> <input type=submit value=Save " & disableflag & "> <input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'></h4>" & vbcrlf' [MARKUS - replace virtual with hard]response.write("<textarea id=""pagetext"" name=""pagetext"" rows='" & giEditAreaRows & "' " & readonlyflag &" cols='" & giEditAreaCols & _"' style='width:100%'>" & _Server.HtmlEncode(strPageData) & _"</textarea>" & vbcrlf & _"<br/> <input type=submit value=' Save ' " & disableflag & " > <input type=button value='Cancel' onclick='location.href=""" & gScriptURL & "&o=" & strTitle & """'> " & _"<br/></br/> " & _vbcrlf & "<input type=hidden name=lupdt value='" & strLastUpdate & "'>" & _vbcrlf & "<input type=hidden name=o value='" & strTitle & "'>" & _vbcrlf & "<input type=hidden name=db value='" & gDataSourceFile & "'>" & _vbcrlf & "<input type=hidden name=hiddenInput value='errv2010'>" & _vbcrlf & "<input type=hidden name=dbname value='" & gDataSourceName & "'>" & _vbcrlf & "<input type=hidden name='a' value='save'>" & vbcrlf )'End IfIf disableflag <> "" Thenexit subend ifIf gHideWikiSource thenexit subend if'History of changesresponse.write("<br><br><br><br><br><h3>History of Changes:</h3><textarea readonly style='font-size:8pt; background:silver;' rows='" & giEditAreaRows & "' cols='" & giEditAreaCols & _"' style='width:100%'>" & strPrevPageData & "</textarea>")'Original Textresponse.Write("<textarea name=""pagetextorig"" rows=0 cols=0 style='width:0;'>" & strPageData & "</textarea></form>" )response.Write("<script language=javascript>form1.pagetext.rows=window.screen.height/26;</script>")Session("CurrentEditPage") = "# " & strTitleend subsub handleSearchdim pageTitle, s's= Request.QueryString("o") BUG - Fri, 2002 jan 22 - Dan Shaws= glsTopicif not isEmpty(s) thenEmitDebug 42, 2, "<br/>SEARCH(" & s & ")<br/>" & vbcrlfpageTitle = "Search Results (" & s & ")"dim myClausemyClause= theWhereClause(s)sqlQuery="select ID, Title, LastUpdate , LastEditor from " & gDbTableName & myClause & " order by Title"end ifEmitTabularOutput pageTitle, ""end sub'ElreyRonald 4/2004Sub HandleDeleteDim pwd, topic, shResponse.Write("<center><h2>Page Deletion</h2></center><hr>")sh = "<br><a href='" & gScriptURL & "' >Click here proceed to home page</a>"If Request.QueryString("pw") <> gDeletePassword ThenResponse.Write( "Authorization to delete failed. Try adding &pw=" & gDeletePassword & sh)Response.EndEnd Iftopic = Request.QueryString("o") ' Topic to deleteIf IsNull(topic) or topic = "" ThenResponse.Write( "Specify page name to delete i.e. &o=MyPage" & sh)Response.EndEnd IfDim stmntstmnt = "delete from WikiData where Title='" & topic & "'"Set gDataConn = Server.CreateObject("ADODB.Connection")on error resume nextgDataConn.Open ConnStr(1)on error goto 0on error resume nextgDataConn.execute(stmnt)on error goto 0If gDataConn.errors.count = 0 thenResponse.Write( "<b>" & topic & " </b> was successfully deleted. " )ElseResponse.Write( "<b>" & topic & " </b> was not deleted due to some errors. " )End ifSet gDataConn = nothingResponse.write shResponse.Endend sub'ElreyRonald 4/2004sub handleRssdim pageTitle, initialRow, s, sSortOrderdim modifiedUrlsqlQuery="select top " & giNumRecentFiles & " ID, LastEditor, Title,PageData,PrevPageData, LastUpdate from " & gDbTableName & " order by LastUpdate DESC"sqlQuery = sqlQuery & sSortOrderset gDataConn = Server.CreateObject("ADODB.Connection")on error resume nextgDataConn.Open ConnStr(1)on error goto 0if not (0 = gDataConn.errors.count) thenif (ADOERROR_NOFILE = gDataConn.errors(0).number) thenEmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlfEmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_gDataConn.errors(0).description & ")<br/>" & vbcrlfVerifyWikiTableend ifend if'set rs= gDataConn.execute(sqlQuery)set rs = WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007modifiedUrl = Replace(gScriptURL, "&", "&")if not rs.eof thenresponse.ContentType = "text/xml"response.Write("<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>")response.Write(gRssStyle)response.Write("<rss version=""2.0"">")response.Write("<channel>")response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "&a=rss</link> ")Response.Write("<ttl>1000</ttl>")response.Write("<description>Latest changes and postings for the topic:" & SpaceName(gHomeTopic) & ". </description> ")response.Write("<copyright>Copyright (C)2003 Elrey Ronald Vel. All rights reserved.</copyright> ")response.Write("<generator> WikiAsp RSS Generator by Elrey </generator> ")Response.Write("<webMaster>lambda326@hotmail.com</webMaster>")response.Write("<image><width>80</width><height>40</height>")response.Write("<title>" & SpaceName(gHomeTopic) & "</title> ")response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "</link> ")If left(gIconName,4) = "http" Thenresponse.Write("<url>" & gIconName &" </url></image>")Elseresponse.Write("<url>" & gHttpDomain & "/" & gIconName &" </url></image>")End IfDo while Not rs.eofIf rs("Title") <> "RegisteredUsers" ThenResponse.Write("<item>")Response.Write("<title>" & SpaceName(rs("Title"))& "</title>")Response.Write("<link>" & gHttpDomain & "/" & modifiedUrl & "&o=" & rs("Title") & "</link> ")Response.Write("<category>" & SpaceName(gHomeTopic) & "</category>")Response.Write("<author>user@" & rs("LastEditor")& "</author>")Response.Write("<description>")Response.Write( "<![CD" & "ATA[ ")If gHighlightFlag ThenResponse.Write( ProcessRssItem(rs) )ElseResponse.Write WalkWiki(xform( rs("PageData") ))End IfResponse.Write("]]></description>")Response.Write("<pubDate>" & GetRFC822date(rs("LastUpdate")) & "</pubDate> ")Response.Write("</item>")End Ifrs.MoveNexti= i+1Loopresponse.Write( "</channel></rss>")end ifSet gDataConn = nothingSet rs = nothingend sub'Get the nth page in History'ElreyRonaldFunction GetPrevData(rs, n)Dim arrD, tmpStr, i, cnt, getFlagDim prevDataprevData = rs("PrevPageData")If IsNull(prevData) ThenGetPrevData = ""ElsearrD = Split( rs("PrevPageData"), vbCRLF)cnt = 0getFlag = 0tmpSTr = ""For i = 1 to UBound(arrD)If left(arrD(i), 8) = "--------" Thencnt = cnt + 1if getFlag = 1 Then Exit Forif n = cnt ThengetFlag = 1end ifEnd IfIf getFlag = 1 and left(arrD(i), 8) <> "--------" ThentmpStr = tmpStr & arrD(i) & vbCRLFEnd IfNextGetPrevData = tmpStrEnd IfEnd Function'Process the current record (rs) for RSS'ElreyRonaldFunction ProcessRssItem(rs)Dim currData, prevData, markedStrDim beginMark, endMark, tmpSbeginMark = "###s###"endMark = "###e###"currData = rs("PageData")prevData = GetPrevData( rs, 1 )markedStr = MarkWhatWasAdded( prevData, currData, beginMark , endMark)tmpS = WalkWiki(xform(markedStr))tmpS = Replace( tmpS, beginMark, "<U style='background:yellow' >")tmpS = Replace( tmpS, endMark, "</U>")ProcessRssItem = tmpSEnd FunctionFunction MarkWhatWasAdded( prevData, currData, st, en)Dim arrCurrData, arrPrevDataDim currMaxIndexDim prevMaxIndex, iarrCurrData = Split( currData, vbCRLF)arrPrevData = Split( prevData, vbCRLF)currMaxIndex = UBound( arrCurrData )prevMaxIndex = UBound( arrPrevData )If prevMaxIndex < 0 ThenMarkWhatWasAdded = currDataExit FunctionEnd IfDim marked, prevPtr, startedmarked = 0prevPtr = 0started = 0'Search delta forwardFor i = 0 to prevMaxIndexIf lTrim(rtrim(arrPrevData(i))) <> "" Then Exit ForNextprevPtr = i 'start hereFor i = 0 to currMaxIndexIf lTrim(rtrim(arrCurrData(i))) = "" and started = 0ThenElseStarted = 1If prevPtr <= prevMaxIndex ThenIf arrCurrData(i) <> arrPrevData( prevPtr) Thenif ( i > 0 ) thenif arrCurrData(i-1) = "" ThenarrCurrData(i-1) = vbCRLF & arrCurrData(i-1) & stelsearrCurrData(i-1) = arrCurrData(i-1) & stend ifelsearrCurrData(i) = st & vbCRLF & arrCurrData(i)end ifmarked = 1Exit ForEnd IfprevPtr = prevPtr + 1if prevPtr > prevMaxIndex and i < currMaxIndex thenarrCurrData(i) = arrCurrData(i+1) & stmarked = 1exit forend ifEnd IfEnd IfNextIf marked = 0 ThenMarkWhatWasAdded = currDataexit functionEnd If'Search delta BackwardsFor i = prevMaxIndex to 0 step -1If lTrim(rtrim(arrPrevData(i))) <> "" Then Exit ForNextDim pipi = istarted = 0For i = currMaxIndex to 0 step -1If lTrim(rtrim(arrCurrData(i))) = "" and started = 0Then' do nothingElseStarted = 1If pi >= 0 Then'Response.Write "backward Compare " & Cstr(i) & "-" & Cstr(pi) &" [" &arrCurrData(i) & "]=["& arrPrevData(pi) & "] " & vbCRLFIf arrCurrData(i) <> arrPrevData(pi) ThenarrCurrData(i) = arrCurrData(i) & enExit ForEnd Ifpi = pi - 1if pi < 0 and i > 0 thenarrCurrData(i-1) = arrCurrData(i-1) & enexit forEnd ifEnd IfEnd IfNextDim sressres = ""For i = 0 to currMaxIndexsres = sres & arrCurrData(i) & vbCRLFNextMarkWhatWasAdded = sresEnd Functionsub handleListdim pageTitle, initialRow, s, sDirection, sSortOrder, sNextDirectionTitle, sNextDirectionDate' Request.ServerVariables("HTTP_REFERER")initialRow= ""s = Request.QueryString("o")EmitDebug 43, 2, "<br/>" & s & "<br/>" & vbcrlfif (s = "recent") thenpageTitle = "Recently Modified Topics"sqlQuery="select top " & giNumRecentFiles & " ID, Title, LastUpdate, LastEditor from " & gDbTableName & " order by LastUpdate DESC"elsepageTitle = "List of All Topics"sqlQuery= "select ID, Title, LastUpdate , LastEditor from " & gDbTableName & " order by "sDirection = Request.QueryString("d")if (s = "ByDate") thensqlQuery = sqlQuery & "LastUpdate "if (sDirection = "down") thensSortOrder = "" ' the reverse natural sort order (oldest first)sNextDirectionDate= ""elsesSortOrder = "DESC" ' the natural sort order (most recent first)sNextDirectionDate= "&d=down"end ifelseif (s = "ByTitle") thensqlQuery = sqlQuery & "Title "if (sDirection = "down") thensSortOrder = "DESC" ' the reverse natural sort order (alphabetic)sNextDirectionTitle = ""elsesSortOrder = "" ' the natural sort order (alphabetic)sNextDirectionTitle = "&d=down"end ifend ifsqlQuery = sqlQuery & sSortOrder'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>"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>"end ifEmitTabularOutput pageTitle, initialRowend subsub EmitTabularOutput(pageTitle, initialRow)EmitDebug 44, 2, "<br/>query(" & sqlQuery & ")<br/>" & vbcrlf'set rs= gDataConn.execute(sqlQuery)set rs = WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007Call WriteBanner(pageTitle,"")if not rs.eof then' Response.write("<h2>" & pageTitle & ":</h2>)Response.write("<table cellpadding=5 cellspacing=0 border=0 >" & vbcrlf)i = 1if not isEmpty(initialRow) thenResponse.write initialRow & vbcrlfend ifDo while (Not rs.eof )if (i mod 2 = 0) thenResponse.Write("<tr style=""background-color:whitesmoke;"">")elseResponse.Write("<tr style=""background-color:lightcyan;"">")end ifDim deleteColumndeleteColumn = ""' gDelete is only passed on querystringIf Request.QueryString("pw") = gDeletePassword ThendeleteColumn = "<td class='tabular'><a href=""" & gScriptURL & "&o=" & rs("Title")&"&a=del&pw=" & gDeletePassword & """> del </td>"End Ifif rs("Title") <> "RegisteredUsers" thenResponse.Write("<td class='tabular'>" & i & ".</td><td class='tabular'><a href=""" &_gScriptURL & "&o=" & rs("Title") & """>" & rs("Title") & "</a></td> <td class='tabular'>" & _rs("LastUpdate") & " by " & rs("LastEditor")& "</td>" & deleteColumn & _"</tr>" & vbcrlf)i= i+1end ifrs.MoveNextLoopResponse.write("</table>" & vbcrlf)else' Response.write("<h2>" & pageTitle & ":</h2>)Response.write("<table style='border: 1px solid gainsboro'>" & vbcrlf)Response.write("<tr><td>This topic is not mentioned on any other page! </td></tr>" & vbcrlf)Response.write("</table>" & vbcrlf)end ifCall WriteFooter("","","" )end subsub handleSaveif gDisableSave = "yes" thenexit subend ifdim sText, dts, sLupdtdim sChanges, sTextOrigsText=request.Form("pagetext")sTextOrig=request.Form("pagetextorig")sLupdt=request.Form("lupdt") ' last update (ElreyRonald)Dim lastPageEditedif IsEmpty (Session("CurrentEditPage") ) ThenlastPageEdited = "*"Exit SubelselastPageEdited =Session("CurrentEditPage")end ifIf not IsRequestFromWikiASPPage Thenresponse.write("1:>" & remoteIPHost & " - " & remoteIPAddr )response.endexit subEnd ifIf IsRemoteAdressBlackListedRE Thenresponse.write("2:>" & remoteIPHost & " - " & remoteIPAddr )exit subEnd ifIf IsRemoteBlackListed Thenresponse.write("3:>" & remoteIPHost & " - " & remoteIPAddr )exit subEnd ifIf not gPersistPassword ThenSession("pwd") = ""End IfsqlQuery = "select Title,PageData, lastupdate , PrevPageData, LastEditor from " & gDbTableName & " where title='" & glsTopic & "'"EmitDebug 45, 2, "<br/>save-check query(" & sqlQuery & ")<br/>" & vbcrlf'set rs = gDataConn.execute(sqlQuery)set rs = WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007dts = Now'update recordif not rs.eof thenEmitDebug 46, 2, "Record already exists....<br/>" & vbcrlf' check if someone has updated the record while you were editing (ElreyRonald)if Trim(Cstr( rs("lastupdate"))) <> Trim(sLupdt) thenresponse.write("<html><head></head><body>")Response.Write( "["& Trim(Cstr( rs("lastupdate"))) & "]["& Trim(sLupdt)& "]<br>" )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>" )response.write( "<br><br> <a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'>Click here to re-edit the page. </a>" )response.endelse' consolidate a series of trailing vbcrlf to just 2.gRE.Pattern = "(\r\n){3,}$"sText=gRE.Replace(sText, vbcrlf & vbcrlf)' replace 8 spaces with tab (ElreyRonald)sText = replace(sText, vbcrlf & " *", vbcrlf & chr(9) & "*" )sText = replace(sText, vbcrlf & chr(9) & " : ", vbcrlf & chr(9)& " :" & chr(9) )If abs( len(sText) - len(sTextOrig) ) > 10 ThensChanges = vbcrlf & vbcrlf & "@@@@@@@@@@@@@@@@" & rs("lastupdate") & " : " & _rs("lasteditor") & "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" & vbcrlf & vbcrlf & rs("PageData") & rs("PrevPageData")sChanges = left(sChanges, 15000)elsesChanges = rs("PrevPageData")End ifsqlQuery = "UPDATE " & gDbTableName & " SET PageData='" &_safeQuote(sText) & "',PrevPageData='" & safeQuote( sChanges ) &_"',LastUpdate='" & dts & "', LastEditor='" & remoteIPHost &_"' WHERE title='" & rs("title") & "'"EmitDebug 47, 1, "update sqlQuery(" & sqlQuery & ")<br/>"'gDataConn.execute(sqlQuery)call WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007end if' new recordelseEmitDebug 48, 2, "Record does not exist, inserting...." & vbcrlfsqlQuery = "INSERT INTO " & gDbTableName & " (Title,PageData,LastEditor,LastUpdate) " & _"VALUES ('" & glsTopic & "', '" & safeQuote(sText) & "', '" & remoteIPHost &_"', '" & dts & "')"EmitDebug 49, 1, "<br/>sqlQuery(" & sqlQuery & ")<br/>"'gDataConn.execute(sqlQuery)call WrappedQueryExecute( gDataConn, sqlQuery ) ' ERV 3/2007end if' direct to the newly saved page :'Response.Redirect gScript & "?" & glsTopicResponse.Redirect gScriptURL & "&o=" & glsTopicend subSub WriteBanner(title,search)Dim iconPart, bannerPart, bannerTextParticonPart = "<a href='" & gScriptURL & "'><img src='" & gIconName & "' border='0' alt='Go to Start Page'></a>"if search <> "" thenbannerTextPart = "<a title='Search for references to " & title & "' href='" & gScriptURL & "&a=search&o=" & search & "'>" & SpaceName(title) & "</a>"elsebannerTextPart = SpaceName(title)end ifIf gBannerTemplate = "" ThenbannerPart = ""bannerPart = bannerPart & "<a href='" & gScriptURL & "'>Wiki Home</a>"bannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=list&o=ByTitle' title='this may take a loooong time'>List all pages</a>"if ( NOT gHideLogin ) ThenbannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"bannerPart = bannerPart & " | <span style='color: #FF0000;font-weight: bold;'>Development Web Server</span>"if (search <> "") AND (gEnableEdit) thenbannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=edit&o=" & search & "'>Edit page</a>"bannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=del&o=" & search & "'>Del page</a>"end ifbannerPart = bannerPart & " | <a href='" & gScript & "?db=ReleaseNotes&o=TextFormattingRules'>Formatting Rules</a>"bannerPart = bannerPart & " | <a href='" & gScript & "?db=ReleaseNotes'>Release Notes</a>"bannerPart = bannerPart & " | <a href='" & gScript & "?db=ImplementationNotes'>PM Dev Notes</a>"if gEnableEdit ThenbannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=logout&o=" & search & "'>Log out</a>"ElsebannerPart = bannerPart & " | <a href='" & gScriptURL & "&a=login&o=" & search & "'>Log in</a>"End IfEnd IfbannerPart = bannerPart & "<hr>"bannerPart = bannerPart & " <table class='cssBannerTable' id='idBannerTable' cellSpacing='0' cellPadding='0' border='0'>"bannerPart = bannerPart & " </tr>"bannerPart = bannerPart & " <tr class='cssBannerRow' id='idBannerRow'> "bannerPart = bannerPart & " <td class='cssBannerCellIcon' id='idBannerCellIcon' valign='top'> $$icon$$</td>"bannerPart = bannerPart & " <td width=90% class='cssBannerCellText' id='idBannerCellText' valign='bottom' align='left' >"bannerPart = bannerPart & " <h1 class='cssBannerSpanText' id='idBannerSpanText'>$$banner_text$$</h1>"bannerPart = bannerPart & " </td>"bannerPart = bannerPart & " <td>"bannerPart = bannerPart & " <td class='cssTopSearch'id='idTopSearch' >"If not gHideTopSearch ThenbannerPart = 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> "End IfbannerPart = bannerPart & " </td><td> </d>"bannerPart = bannerPart & " </tr>"bannerPart = bannerPart & " </table>"ElsebannerPart = gBannerTemplateEnd ifbannerPart = Replace( bannerPart, "$$icon$$", iconPart)bannerPart = Replace( bannerPart, "$$banner_text$$", bannerTextPart)Response.Write ( bannerPart )End SubSub WriteFooter(hideScript,lastUpdate,lastEditor)If Not gHideWikiFooter Thenresponse.write "<div id=wikifooter class=footer ><form method='POST' action=""" & gScript & """ id=""formFooter"" name=""formFooter""><br>"response.write "<hr size=1 noshade=true>"If Not gHideLastEditor Thenif lastUpdate <> "" Thenresponse.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/>"End Ifend ifresponse.write "<font size=-1>Domain: " & gHttpDomain & "</font><br>"' response.write "<a href='" & gScriptURL & "' title='GO TO START PAGE'>Home</a> | "' if Not gHideLogin Then' response.write "<a href='" & gScriptURL & "&a=edit&o=" & rs("title") & "'>Edit page</a> | "' end if' response.write "<a href='" & gScriptURL & "&a=logout&o=" & rs("title") & "'>Log out</a> | "' response.write "<a href='" & gScriptURL & "&a=list&o=ByTitle'>List pages</a> | "' response.write "<a href='" & gScriptURL & "&a=list&o=recent'>Recent pages</a>"' If gHttpDomain <> "" Then' response.write " | <a href='" & gScriptURL & "&a=rss' ><span style='background:#FF6600;text-decoration:none;font-family:tahoma;' > <b><font color=white>RSS</font></b> </span></a>"' End If'' response.write " "&gSearchLabel&" <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> "response.write "<font size='-1'>WikiAsp Engine version: " & gEngineVersion & "</font>" & vbcrlf' response.write "<br><font size='-1'>gScriptURL: " & gScriptURL & "</font>" & vbcrlfresponse.write "</div>"End IfEnd SubSub HandleBrowse' Prevent this page from being viewed.if not IsEmpty(Request.Form("pwd")) then Session("pwd") = Request.Form("pwd")if glsTopic = "RegisteredUsers" thenIf IsEmpty( Session("pwd")) or Session("pwd") <> gPassword thenexit subEnd Ifend ifsqlQuery = "select PageData,Title,LastEditor,LastUpdate from " & gDbTableName & " where title='" & glsTopic & "'"EmitDebug 50, 2, "Browse query(" & sqlQuery & ")<br/>" & vbcrlfset rs = gDataConn.execute(sqlQuery)if rs.eof=true thenResponse.Write("<center><h2>Page Creation</h2><hr>")if gHideLogin ThenResponse.Write("The page --> <b>" & glsTopic & "</b> <--- Does not exit and it cannot be created on this Server")ElseIf NOT gEnableEdit ThenResponse.Write("The page --> <b>" & glsTopic & "</b> <--- Does not exit and it cannot be created until you log in")Elseresponse.write("Sorry! The page --> <b>" & glsTopic & "</b> <--- is not existing or it is a page that must be created </h4>")response.write( "<br><a href='" & gScriptURL & "&a=edit&o=" & glsTopic & "'>Click this link to create this page.</a>" )response.write( "<br><br><a href='" & gScriptURL & "'>No, don't create it.</a>" )End IfResponse.Write("</center>")elseEmitDebug 51, 3, "found...(" & rs("PageData") & ")<br/>" & vbcrlfIf gEnableEdit Thenresponse.write" <body ondblclick=" & chr(34) & "document.location.href='" & _gScriptURL & "&a=edit&o=" & glsTopic & "'" & chr(34) &">"Elseresponse.write" <body >"End IfCall WriteBanner(rs("title"),rs("title"))response.write " <div class='wikibody'>" & WalkWiki( xform( "<span id=bodyPrefix>" & vbcrlf & gWikiBodyPrefix & VbCrLF & "</span>" & VbCrLF & rs("PageData"))) ' Elrey - xform func now removes htmlresponse.write "</b></i></font></u></strong></font>"dim hideScripthideScript = "var div1=document.getElementById('wikifooter'); if (div1) {div1.style.display='none';}"hideScript = hideScript & "div1=document.getElementById('bodyPrefix'); if (div1) {div1.style.display='none';}"hideScript = hideScript & "div1=document.getElementById('idTopSearch'); if (div1) {div1.style.display='none';}"Call WriteFooter(hideScript, rs("LastUpdate"), rs("LastEditor") )end ifend subsub handleCreateIf gHideLogin ThenResponse.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed</h2></center>")Response.Endexit subEnd IfIf NOT gEnableEdit ThenResponse.Write("<br/><br/><br/><br/><br/><center><h2>Editing is not allowed until logged in</h2></center>")Response.Endexit subEnd Ifon error resume nextVerifyWikiTableon error goto 0Response.Redirect gScriptURLend sub'Intercept RSS request hereif ( glsMode = "rss" ) thenIf ( gHttpDomain = "" ) thenresponse.write("RSS is not enabled")ElsehandleRssEnd Ifresponse.Endend if'Intercept delete request hereif ( glsMode = "del") thenhandleDeleteresponse.Endend if'********************************************************************'*********************************************************************'<?xml version="1.0" encoding="UTF-8" ?>'<!DOCTYPE html' PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' "DTD/xhtml1-transitional.dtd">'Response.Buffer=TRUE%><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title><%if not isEmpty(glsMode) and glsMode <> "browse" thenresponse.write(glsMode & " ")end ifresponse.write(SpaceName(glsTopic) & vbcrlf)%></title><LINK REL="StyleSheet" HREF="<%=gStyleSheet%>" TYPE="text/css" ><%Response.Write(gHtmlHeadStr)%></head><body><%if Session("Hits") = "" thenSession("Hits")= 1elseSession("Hits")= Session("Hits") + 1end ifEmitDebug 52, 1, "debug(" & gDebug & ")<br/>" & vbcrlfEmitDebug 53, 1, "<br/>QueryString = (" & Request.QueryString & ")<br/>" & _"Hits(" & Session("Hits") & ")<br/>" & _"mode(" & glsMode & ")<br/>" & _"topic(" & glsTopic & ")<br/>"set gDataConn = Server.CreateObject("ADODB.Connection")' 21 nov - need resume next to catch "no file" erroron error resume nextgDataConn.Open ConnStr(1)on error goto 0if not (0 = gDataConn.errors.count) thenif (ADOERROR_NOFILE = gDataConn.errors(0).number) thenEmitDebug 54, 1, "<br/>ErrorCount(" & gDataConn.errors.count & ")<br/>" & vbcrlfEmitDebug 55, 1, "<br/>Error(" & gDataConn.errors(0).number &") desc(" &_gDataConn.errors(0).description & ")<br/>" & vbcrlfVerifyWikiTableend ifend ifselect case (glsMode)case "edit" handleEditcase "list" handleListcase "search" handleSearchcase "create" handleCreatecase "save" handleSavecase "browse" handleBrowsecase "logout" handleLogoutcase "login" handleLogincase elseend selectEmitDebug 56, 2, "<br/>done...<br/>" & vbcrlfgDataConn.Close()set gDataConn = nothing%><% Response.Write(gFooterHtml) %><% Response.Flush %>