From NewWiki

completeWiki

All

Wiki package for webMathematica

Hyperlink jumps

<<AuthorTools`

TableForm[Map[Hyperlink[ToString[#], {EvaluationNotebook[], #} ] & , Partition[Sort[NotebookCellTags[EvaluationNotebook[]]], 5, 5, {1, 1}, {"", ""}], {2}]]

AddNameSpace AddToWatchlist AddUserToSysop AdjustForNameSpace All
Beginnings BuildNavigationLists CheckForAutoLoad confirmUploadString CountText
CreateAccountLoginandWelcome DBText2HTML DoLogin DoPreferences DoSearch
DoSiteStats extractUserOptions FAQFormattingRules GetAdminList GetAllMessages
GetAllPages GetCategoryList GetContributions GetDeadEndPages GetImageList
GetNewPages GetNotebookList GetOrphanPages GetPageText GetPopularPages
GetShortPages GetUncategorizedPages GetUnusedImages GetUserList GetWantedPages
GetWatchlist GetWhatlinkshere HTML functions HTML Functions InsertCellTakeNotebook
InsertFullNotebook InsertOutput InsertTagNotebook IsUserIdSysop IsWatched
KeepValidCharacters Known Issues MakeBackgroundImage makeDate makeDirName
MakeIntoValidPageName MakeLogoImage MakeLogoStyle ManageFileUpload matchPageName
monthNames pageLayoutDefault pageLayoutMonoBook preferenceHTML ReadUserOptions
RecentChangesImageTable RecentChangesNotebookTable RecentChangesTable RefreshSysopList ResubmitLogin
ResubmitPref revisions SaveThis SetUserSkinOption ShowRecentChanges
skinNames specialpagesHTML StopWatching supportedFileExtensions ThumbnailTable
TimeStampNow TOCformatting ToFileName UpdateCachedVariables UpdateDatabaseLinks
variableRules wikiPage wikiUpload

$Version

"6.0 for Microsoft Windows (April 18, 2005)"

All,Known Issues

Known Issues

All,Known Issues

Implement Related changes
fix upload log on uploads. Implement upload log display
Implement Editing sections
Add Mathematica color to the text editing?
Show search string in search window
Enable search of keyword in notebooks
protect server filenames for paranoia
enable sysops to edit Special pages. Put all html text in DB.
auto tabs in forms.
add tooltips
Enable mathematica TML notebook

All

Revisions

revisions,All

2005 06 02

revisions,All

Added Cookies to remember login
repaireed broken countlinkfrompage

revisions,All

2005 05 30

revisions,All

fixed stats reversed (was depressing)
fixed a bad regularExpression for pageLinkRE

revisions,All

2005 05 29

revisions,All

Added DownloadNotebook link equvalent to Media.
Added LinkToViewAsHTML to match the functionality used in recent changes

revisions,All

2005 05 26

revisions,All

fixed a bug introduced on 5/13 about editing. the old version was not saved. This becasue I added the oldcomment but the old comment is an SQLBinary

revisions,All

2005 05 23

revisions,All

implemented my watch list

revisions,All

2005 05 16→22

revisions,All

Major refactoring of code.
added about 20 html functions.
replaced all the major pieces of html text by functions.
implemented a large part of the support for monobook
implemented preference for skin, background and logo
stopped loading the page layout.

revisions,All

2005 05 14

revisions,All

Added table of content
Added code to add remove users from sysop list

revisions,All

2005 05 10

revisions,All

Propagated the fix to MSP.m to the web site
enabled sysop users to modify the upload text.
Work around to timeout on upload. FTP_> document in upload window.

revisions,All

2005 05 09

revisions,All

Add code display to site pages
Fixed PageWidth in MSP export of notebook finds.
fixed notebooks not saved with 100% magnification
fixed a bug that lost DB data on images
uploaded 36 notebooks.
found a bug in the display of recent thumbnails.
Implemented the [[Image:xxx|thumb|description]] thing.

revisions,All

2005 05 08

revisions,All

remove forbidden characters from image names → _
There is a problem with paragraph replacement rule.
added a list of recent pages visited at the top.
added some editing rules to be able to display special characters.
added an editing tips window that opens in a new window. (regular page)
Fixed a simple bug that force the countlinks from page to be an exact name match.
Added a few notebooks, FAQs. content to ediing tips.
Show user who edited in short recent pages.

revisions,All

2005 05 07

revisions,All

Enable login to go back to current page

revisions,All

2005 05 05

revisions,All

Better stats graphics
Add better CountText features excluded some rules.
Added editing comment <** **>
added number of active user variable.
Update image size on re-upload.
Fix accents again
updated what is a validfilename can't have space, [  ] ? " / \\ < > * | :
added extensions txt text dat and no estensions at all.

revisions,All

2005 05 04

revisions,All

Fix a couple of bad html links
Added very basic site stats
added NotebookClose after Export to HTML.

revisions,All

2005 05 03

revisions,All

Fixed bad page history links.
Added FTP autoLoad
Added NotebookFind
Tag usage on notebook displays

revisions,All

2005 05 02

revisions,All

Figured out how to initialize the checkboxes (CHECKED>). Used it for Login Data
Implement Search SQLExecute[conn,"SELECT cur_title FROM cur WHERE cur_namespace=2 AND MATCH \
cur_text AGAINST ('search' IN BOOLEAN MODE)"]
Add Auto counting of some page elements. Use CountText and CountPages and CountLinks and make them allowed symbols.
Added Autocounting of links in a page.

revisions,All

2005 05 01

revisions,All

trap against Robot on login
Added "debug" account to enable variables at bottom of pages
add a link to the left to view the page content without editing.
Implemented preview pages when editing
add action to statistical log

revisions,All

2005 04 30

revisions,All

Added list of ForbiddenWords={"cephalexin","crestor","effexor","hydrocodone","lisinopril","mobic","naproxen","phentermine","prednisone","ritalin","vioxx"}
edit refuses to save when those words are in the page
Added partially a simple riddle for new account creation.

revisions,All

2005 04 28

revisions,All

Added Statistic login to be able to show stat page
Added FAQ formatting rules.
Added better loging of package during startup
Added IP loging. Dealt with the proxy forwarded issue.
Fixed the mime data to make sure notebooks are downloaded not open.
Fixed Html notebook display I broke yesterday

revisions,All

2005 04 27

revisions,All

Implement last 12 pages modified table
Improved recent changes page
Added recent notebooks table
Added recent images table
Fixed the diff to work on the public web site.
Added thumbnail creation on upload and on server launch.
Added Special page showing thumbnails.
debugged link to images.
Enabled the editing of descriptions of notebooks or images
Added Thumbnail creation for graphics.

revisions,All

2005 04 26

revisions,All

refactoring of namespace.
fix broken link about Help:Content in main page.
Add complain about SQL not running.
request login to upload
Add login link to login required to edit page
Added Notebook list special page
Add automatic update of notebooks
garbage at bottom of upload success page
clean top of upload page.
Ad error message if html reference to a non existing notebook

revisions,All

2005 04 25

revisions,All

Show login first if edit page
fixed a bad link in research page
confirmed we can create new pages
confirmed we can have user links in pages
added uploads to My contributions
Fix name convention in file uploads (" "->"_" and more)
Add a call to run Mathematica code in a wiki page.

revisions,All

2005 04 19

revisions,All

When saving a page update the link tables.
My contributions
My watchlist, start watching, stop watching.
What links here
Replaced unsafe ToExpression with MSPToExpression

Beginnings,All

Package Beginnings

All

Package Begins

All

BeginPackage [ "Wiki`" , "JLink`", "MSP`", "Miscellaneous`Calendar`"] ;

All

Unprotect @   "Wiki`*" ;

ClearAll @@ (Names @ "Wiki`*") ;

ClearAll @ "Wiki`Private`*" ;

All

Package Usage Statements

All

wikiPage :: usage = "wikiPage[]" ;

wikiUpload :: usage = "wikiUpload[]" ;

CountText :: usage = "CountText[localString_]" ;

All

Error Message Declarations

All

Package Post Begin

All

Begin @ "`Private`" ;

All

Main code of the package

All

Packages required

All

Needs["DatabaseLink`"]

All

Needs["JLink`"]

All

Needs["Miscellaneous`Calendar`"]

All

InstallJava[] ;

All

logFolder = ToFileName[$BaseDirectory, "logs"] ;

All

conn = OpenSQLConnection[JDBC["odbc", "wikidb"]] ;

SQLBinToString[l_] := FromCharacterCode[l[[1]]] ;

All

curCountCache = {} ;

All

countTextCache = {} ;

All

verbose = True ;

All

Get the text as is to initialize the edit

TimeStampNow,All

TimeStampNow[] := Module[{DateList, TimeStamp}, DateList = Floor /@ Date[] ;  ... uot;", ""}] ]) & /@ Rest[DateList]] ; ToString[TimeStamp] ] ;

MakeTimeStamp[thisDate_] := Module[{DateList, TimeStamp}, DateList = Floor /@ thisDa ... uot;", ""}] ]) & /@ Rest[DateList]] ; ToString[TimeStamp] ] ;

All

Directory and local files stuff

All

If[FileDate["C:\\apachefriends\\xampp\\xampp\\www\\mma-users.org\\mediawiki\\images&quo ... thematica\\WEB-INF\\Applications\\wiki.nb" ; deployed = True ; ] ; 

All

(* pageLayout = Import["pageLayout.txt"] ; *)ForbiddenWords = {"cepha ... ;] ; MemberQ[ImageExtensions, ToUpperCase[extensionString]] ] ; 

All

Null^4

All

Loggin of the startup sequence of the package enabled from here

All

thisLog = OpenWrite[ToFileName[startupLogDirectoryName, TimeStampNow[] <>"InitLog.txt"]] ;

WriteString[thisLog, "ImageDirectoryName ="<>ImageDirectoryName<>"\n"] ;

WriteString[thisLog, "statDirectoryName ="<>statDirectoryName<>"\n"] ;

All

Site stats functions

All

WriteString[thisLog, "Site stats functions\n" ] ;

GetStatFileName[] := ToFileName[statDirectoryName, "sitestat"<>StringTake[TimeStampNow[], 8] <>".log"] ;

SavePageStat[pageNameParam_, commands_, sessionValues_, timing_] := Module[{userName, userId ... t;"\n"] ; Close[thisFile] ; ] ; (* record the kernel launch *)

Module[{thisFile}, thisFile = OpenAppend[GetStatFileName[]] ; WriteString[th ... uot;, "", ""}] <>"\n"] ; Close[thisFile] ; ]

All

Caching Functions

All

WriteString[thisLog, "Caching Functions\n" ] ;

UpdateCurCountCache[{pageName_, count_, timeStamp_}] := Module[{pos}, pos = Position ... oString[count] ; curCountCache[[pos, 3]] = ToString[timeStamp] ; ] ; ] ;

GetCurCountCache[pageName_] := Module[{resultcount = "0", resultTimeStamp = " ... ing[ curCountCache[[pos, 3]] ] ; ] ;  {resultcount, resultTimeStamp} ] ;

All

MakeValidUserName[user_] := StringReplace[user, " ""_"] ;

MakeValidFileName[fileName_] := StringReplace[fileName, {" ""_", ... #62754;"_", "|""_", ":""_"}] ;

All

MyToExpression[str_] := MSPToExpression[ToString[str]] ;

User Management

All,AddUserToSysop

WriteString[thisLog, "User Management\n" ] ;

AddUserToSysop[FromUserId_, userName_] := Module[{QueryResult, data, userValid, userRightsSt ... result = result<>"Error in AddUserToSysop[]!?" ; ] ; ] ;

RemoveUserFromSysop[FromUserId_, userName_] := Module[ {QueryResult, data, userValid, userRi ... #62371;, result = result<>"Error in AddUserToSysop[]!?" ; ] ;] ;

HTML Functions,All

WriteString[thisLog, "HTML functions\n" ] ;

HTML functions,HTML Functions,All

HTML functions

HTML Functions,All

tableHTML[width_, border_, cellspacing_, matrixOfString_, lineExtras_: {}] := Module[{maxLen ... gt;"] &, matrixOfString, {2}], {1}]) <>"</table>\n"]] ] ;

tableHTML :: usage = "tableHTML[width,border,cellspacing,matrixOfString,{}]" ;

HTML Functions,All

listHTML[listOfStrings_, lineExtras_: {}] := Module[{liExtras = lineExtras, maxLength}, > ... lt;/li>\n"] &, listOfStrings], "</ul>"]] ] ;

listHTML :: usage = "listHTML[listOfStrings,lineExtras]" ;

HTML Functions,All

listWExtraHTML[listOfStrings_, lineExtras_: {}] := Module[{liExtras = lineExtras, maxLength} ... lt;/li>\n"] &, listOfStrings], "</ul>"]] ] ;

listWExtraHTML :: usage = "listWExtraHTML[listOfStrings,lineExtras]" ;

HTML Functions,All

listwIdHTML[name_, listOfStrings_, lineExtras_: {}] := Module[{liExtras = lineExtras, maxLen ... lt;/li>\n"] &, listOfStrings], "</ul>"]] ] ;

listHTML :: usage = "listHTML[listOfStrings,lineExtras]" ;

fieldSetHTML[legendName_, str__] := ToString[StringJoin["<fieldset><legend>", legendName, "</legend>\n", str, "</fieldset>\n"]] ;

fieldSetHTML :: usage = "fieldSetHTML[legendName,str]" ;

divHTML[str__] := ToString[StringJoin["<div>", str, "</div>\n"]] ;

divHTML :: usage = "divHTML[str]" ;

labelHTML[str__] := ToString[StringJoin["<label>", str, "</label>"]] ;

labelHTML :: usage = "labelHTML[str]" ;

textInputHTML[varName_, value_, size_:20] := ToString[StringJoin["<input type='text' ... ; value=\"", value, "\" size='", ToString[size], "'/>"]] ;

textInputHTML :: usage = "textInputHTML[varName,value,size(20)]" ;

fileInputHTML[varName_, size_:40] := ToString[StringJoin["<input type='file' name=\"", varName, "\" size='", ToString[size], "'/>\n"]] ;

fileInputHTML :: usage = "fileInputHTML[varName,size(40)]" ;

buttonHTML[varName_, value_] := ToString[StringJoin["<input type=\"submit\" ... e=\"", varName, "\" value=\"", value, "\"/>"]] ;

buttonHTML :: usage = "buttonHTML[varName,value]" ;

passwordInputHTML[varName_, value_, size_:20] := ToString[StringJoin["<input type='p ... ; value=\"", value, "\" size='", ToString[size], "'/>"]] ;

passwordInputHTML :: usage = "passwordInputHTML[varName,value,size(20)]" ;

pageTitleHTML[title_] := ToString[StringJoin["<h1 class=\"pagetitle\">", title, "</h1>"]] ;

pageTitleHTML :: usage = "pageTitleHTML[title]" ;

pageSubTitleHTML[subtitle_] := ToString[StringJoin["<p class='subtitle'>", subtitle, "</p>\n"]] ;

pageSubTitleHTML :: usage = "pageSubTitleHTML[subtitle]" ;

formPostHTML[name_, action_, str__] := ToString[StringJoin["<form id=\"",  ... quot;\n", "method=\"post\">\n", str, "</form>\n"]] ;

formPostHTML :: usage = "formPostHTML[name,action,str]" ;

fileFormPostHTML[action_, str__] := ToString[StringJoin["<form enctype=\"multip ... quot;\n", "method=\"post\">\n", str, "</form>\n"]] ;

fileFormPostHTML :: usage = "fileFormPostHTML[name,action,str]" ;

formPostinlineHTML[name_, action_, str__] := ToString[StringJoin["<form id=\"&q ... quot;\n", "method=\"post\">\n", str, "</form>\n"]] ;

formPostinlineHTML :: usage = "formPostinlineHTML[name,action,str]" ;

pHTML[str__] := ToString[StringJoin["<p>", str, "</p>\n"]] ;

pHTML :: usage = "pHTML[str]" ;

sectionTitleHTML[str__] := ToString[StringJoin["<h2>", str, "</h2>\n" ]] ;

sectionTitleHTML :: usage = "sectionTitleHTML[str]" ;

hiddenVariableHTML[varName_, value_] := ToString[StringJoin["<input type='hidden' name=\"", varName, "\" value=\"", value, "\" />\n"]] ;

hiddenVariableHTML :: usage = "hiddenVariableHTML[varName,value]" ;

boldHTML[str__] := ToString[StringJoin["<strong>", str, "</strong>\n"]] ;

boldHTML :: usage = "boldHTML[str]" ;

smallHTML[str__] := ToString[StringJoin["<small>", str, "</small>\n"]] ;

smallHTML :: usage = "smallHTML[str]" ;

checkBoxHTML[varName_, checked_:""] := ToString[StringJoin["<input type='c ...  "\" name=\"", varName, "\" ", checked, "/>"]] ;

checkBoxHTML :: usage = "checkBoxHTML[varName,checked]" ;

labelForHTML[varName_, str__] := ToString[StringJoin["<label for=\"", varName, "\">", str, "</label>"]] ;

labelForHTML :: usage = "labelForHTML[varName,str]" ;

divwClassHTML[class_, str__] := ToString[StringJoin["<div class='", class, "' >", str, "</div>\n"]] ;

divwClassHTML :: usage = "divwClassHTML[class,str]" ;

divwIdHTML[id_, str__] := ToString[StringJoin["<div id='", id, "' >", str, "</div>\n"]] ;

divwIdHTML :: usage = "divwIdHTML[id,str]" ;

anchorLinkHTML[link_, str__] := ToString[StringJoin["<a href=\"#", link, "\">", str, "</a>"]] ;

anchorLinkHTML :: usage = "anchorLinkHTML[link,str]" ;

spanHTML[id_, str__] := ToString[StringJoin["<span id=\""<>id<>"\">"<>str<>"</span>\n"]] ;

spanHTML :: usage = "spanHTML[id,str]" ;

fileFormResetButton[value_] := ToString[StringJoin["<input type=\"reset\" value=\"", value, "\">\n"]] ;

fileFormResetButton :: usage = "fileFormResetButton[value]" ;

fileFormSubmitButton[value_] := ToString[StringJoin["<input type=\"submit\" value=\"", value, "\">\n"]] ;

fileFormSubmitButton :: usage = "fileFormSubmitButton[value]" ;

HTML Functions,All

tableNoWidthHTML[matrixOfString_] := "<table border=\"0\">\n&qu ... "</td>"&, matrixOfString, {2}], {1}]) <>"</table>\n" ;

tableNoWidthHTML :: usage = "tableNoWidthHTML[matrixOfString]" ;

HTML Functions,All

makePageNameLink[pageName_] := "<a href=\"wiki.jsp?pageName="<>pageN ... lt;>StringReplace[pageName, "_"->" "] <>"</a>" ;

makePageNameLink :: usage = "makePageNameLink[pageName]" ;

HTML Functions,All

makePageLink[pageName_, title_, extraParams_] := Module[{}, "<a href=\" ... extraParams<>"\">"<>title<>"</a>"] ;

makePageLink :: usage = "makePageLink[pageName,title,extraParams]" ;

linkwClass[class_, link_, str__] := ToString[StringJoin["<A CLASS=\"", cla ... quot;\" HREF=\"", link, "\">", str, "</A>" ]] ;

linkwClass :: usage = "linkwClass[class,link,str]" ;

simpleWikiLink[pagename_, str__] := ToString[StringJoin["<A CLASS=\"wikipage\&q ... ot;wiki.jsp?pageName=", pagename, "\">", str, "</A>" ]] ;

simpleWikiLink :: usage = "simpleWikiLink[pagename,str]" ;

simpleWikiActionLink[pagename_, action_, str__] := ToString[StringJoin["<A CLASS=\&q ... ame, "&action=", action, "\">", str, "</A>" ]] ;

simpleWikiActionLink :: usage = "simpleWikiActionLink[pagename,action,str]" ;

linkwClassNewWindow[class_, link_, str__] := ToString[StringJoin["<A CLASS=\"&q ... ot;, link, "\" target=\"BLANK\" >", str, "</A>" ]] ;

linkwClassNewWindow :: usage = "linkwClassNewWindow[class,link,str]" ;

All,HTML Functions

MakeSelectTable[varName_, itemList_, selected_:""] := Module[{}, "< ... option>\n") & , itemList])] <>"</select>\n"] ;

MakeSelectTable :: usage = "MakeSelectTable[varName,itemList,selected]" ;

HTML Functions,All

MakeNotebookHTMLNameLink[pageName_] := "(<a href=\"wiki.jsp?pageName=Notebook:& ... pageName<>"\">"<>"Html"<>"</a>)" ;

MakeNotebookHTMLNameLink :: usage = "MakeNotebookHTMLNameLink[pageName]" ;

HTML Functions,All

MakeMediaNameLink[pageName_] := "<a href=\""<>ToString[makeDirName[p ... 1]] ] <>"\">"<>ToString[pageName] <>"</a>" ;

MakeMediaNameLink :: usage = "MakeMediaNameLink[pageName]" ;

HTML Functions,All

MakeThumbnailLink[imageName_] := Module[{result = "", MD5String, subFolder1, subFo ... ot;, Print["MakeThumbnailLink->nolink"] ; ""] ] ;

MakeThumbnailLink :: usage = "MakeThumbnailLink[imageName]" ;

HTML Functions,All

HTMLSmall[str_] := "<small>\n"<>str<>"</small>\n" ;

HTMLSmall :: usage = "HTMLSmall[str]" ;

HTML Functions,All

ShowImageLink[imageName_] := Module[{result = "", MD5String, subFolder1, subFolder ... Folder2<>"/"<>imageName<>"\" border=0>"] ;

ShowImageLink :: usage = "ShowImageLink[imageName]" ;

textAreaInputHTML[varName_, value_, rows_, cols_, style_] := ToString[StringJoin["<T ... gt;", value, "</TEXTAREA><br>\n"] ] ;

textAreaInputHTML :: usage = "textAreaInputHTML[varName,value,rows,cols,style]" ;

htmlHTML[str__] := ToString[StringJoin["<html lang=\"en\">\n", str, "</html>\n"]] ;

htmlHTML :: usage = "htmlHTML[str]" ;

headHTML[str__] := ToString[StringJoin["<head>\n", str, "</head>\n"]] ;

headHTML :: usage = "headHTML[str]" ;

bodyHTML[str__] := ToString[StringJoin["<body>\n", str, "</body>\n"]] ;

bodyHTML :: usage = "bodyHTML[str]" ;

styleHTML[str__] := ToString[StringJoin["<style type='text/css' media=\"screen,projection\">", str, "</style>\n"]] ;

styleHTML :: usage = "styleHTML[str]" ;

titleHTML[str__] := ToString[StringJoin["<title>\n", str, "</title>\n"]] ;

titleHTML :: usage = "titleHTML[str]" ;

docTypeString = StringJoin["<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Trans ... "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"] ;

bodywClassHTML[class_, str__] := ToString[StringJoin["<body class=\"", class, "\">\n", str, "</body>\n"]] ;

bodywClassHTML :: usage = "bodywClassHTML[class,str]" ;

divwPortletHTML[portlet_, str__] := ToString[StringJoin["<div class=\"portlet\" id=\"", portlet, "\" >", str, "</div>\n"]] ;

divwPortletHTML :: usage = "divwPortletHTML[class,str]" ;

MakeRedirectLink[page_, time_:10] := (redirectLink = ToString[StringJoin["<m ... Mathematica/wiki/wiki.jsp?pageName=", page, "\" />"]]) ; 



Page Layouts

pageLayoutDefault

pageLayoutDefault = ToString[StringJoin[docTypeString, htmlHTML[head ... .mathematica-users.org in TIMETOSERVE secs.-->"] ] ] ] ;

pageLayoutMonoBook

pageLayoutMonoBook = ToString[StringJoin[docTypeString, htmlHTML[hea ... t;<!--Served by webMathematica in TIMETOSERVE secs.-->"] ] ]]

pageLayoutMonoBook

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\"http://w ... <!--Served by webMathematica in TIMETOSERVE secs.--></body><br /></html><br />

All

Java related functions;

All

WriteString[thisLog, "Java related functions\n" ] ;

PrintSessionVariables[] := Module[{result = "", name, value, session, enumeration} ...  = result<>ToString[GetSessionVariables[]] ; ToString[result] ] ; 

GetSessionVariables[] := Module[{result = {}, name, value, session, enumeration}, Pr ... result = Append[result, {ToString[name], value}] ; ] ; result] ;

All

SetSessionVariable[variable_, value_] := Module[{session}, Print[Hold[SetSessionVari ... @ getSession[True] ; session @ setAttribute[variable, MakeJavaExpr[value]] ; ] ;

All

SetSessionTimeOut[seconds_] := Module[{result = "", session}, Print[Hold[S ... vletRequest @ getSession[True] ; session @ setMaxInactiveInterval[seconds] ; ] ;

All

PrintRequestVariables[] := Module[{result = "", name, value, enumeration},  ...  = result<>ToString[GetRequestVariables[]] ; ToString[result] ] ; 

GetRequestVariables[] := Module[{result = {}, name, value, enumeration}, enumeration ... result = Append[result, {ToString[name], value}] ; ] ; result] ;

All

PrintRequestHeaders[] := Module[{result = "", name, value, enumeration}, r ... lt = result<>ToString[GetRequestHeaders[]] ; ToString[result] ] ; 

GetRequestHeaders[] := Module[{result = {}, name, value, enumeration}, enumeration = ... sult = Append[result, {ToString[name], ToString[value]}] ; ] ; result] ;

All

Tricky bit here. we get the user IP from the getRemoteAddr, but if the proxy is running, we need to ask for the header values passed by the proxy.

All

GetUserIPString[] := Module[{IPstr}, IPstr = ToString[$ServletRequest @ getRemoteAdd ... ServletRequest @ getHeader["x-forwarded-for"] ] ; ] ; IPstr] ;

All

log related functions

All

<br />WriteString[thisLog, "Log Starts\n"] ; <br />If[verbose,    ... thisLog, "SQL connection="<>ToString[conn] <>"\n"] ; ] ;

All

Null^2

All

md5 related code

All

WriteString[thisLog, "md5 related code\n" ] ;

LoadJavaClass["java.security.MessageDigest"] ;

All

ProcessMD5String[str_] := Module[{md}, md = MessageDigest`getInstance["MD5" ... #] & /@ (md @ digest[JavaNew["java.lang.String", str] @ getBytes[]]))] ] ;

All

helper functions

All,FromFileName

WriteString[thisLog, "helper functions\n" ] ;

FromFileName[path_String] := Module[{dir, file},  (dir = Most[#] ; file = #[[-1]]) & ... ngth[dir] == 1, dir = dir[[1]]] ; If[file == "", {dir}, {dir, file}] ]

MakeIntoValidPageName,All

MakeIntoValidPageName[str_] := Module[{temp = str}, While[StringLength[temp] >1&a ... emp, -1] ; ] ;  StringReplace[temp, " "->"_"] ] ;

All

CharacterCodeConvertDB2Page[str_] := Module[{result}, Print["Before CharacterCo ... #62371;Print["After CharacterCodeConvertDB2Page=", result] ; result] ;

All

CharacterCodeConvertPage2DB[str_] := Module[{result}, Print["Before CharacterCo ... #62371;Print["After CharacterCodeConvertPage2DB=", result] ; result] ;

All

used for directory naming for uploaded content

makeDirName,All

WriteString[thisLog, "used for directory naming for uploaded content\n" ] ;

makeDirName[submittedstr_] := Module[{tempStr, ext, success = False, path = "", ty ... e ; dateStamp = ToDate[0] ;] ; ] ;  {success, dateStamp, size, path} ] ;

makeDirName,All

makeDirNameThumb[submittedstr_] := Module[{tempStr, ext, success = False, path = "" ... e ; dateStamp = ToDate[0] ;] ; ] ;  {success, dateStamp, size, path} ] ;

All

Find a page name even if the case is wrong

matchPageName,All

WriteString[thisLog, "Find a page name even if the case is wrong\n" ] ;

matchPageName[str_] := Module[{str1, STR2, match, result}, str1 = MakeIntoValidPageN ... sp; ]  STR2&] ; If[Length[result] >0, result[[1]], str1] ] ;

All

Section formatting code

All,DBText2HTML,TOCformatting

WriteString[thisLog, "Section formatting code\n" ] ;

makeLegalAnchor[str_] := StringReplace[str, {RegularExpression["[^\\w]+"] "_"}] ;

makeLegalTextLink[str_] := StringReplace[str, {"<""_", ">""_", "\"""_"}] ;

All,DBText2HTML,TOCformatting

startTOCHTML = "<table border=\"0\" id=\"toc\"><tr id=\&qu ... ript></td></tr><tr id=\"tocinside\"><td>\n" ; 

TOCLineHTML[sectionStr_, n_] := divwClassHTML["tocline", anchorLinkHTML[makeLegalA ...  ToString[n], " ", makeLegalTextLink[sectionStr]], "<br/>"] ; 

endTOCHTML = "</td></tr></table>" ; 

MakeTOC[listOfSections_] := Module[{}, If[Length[listOfSections] ≥3, s ...  listOfSections ]) <>endTOCHTML, ""] ] ;

insertSectionAchor[sectionStr_] := (sectionList = Join[sectionList, {sectionStr}] ;  ... =\""<>makeLegalAnchor[sectionStr] <>"\"></a>\n") ;

All

preEqualSequence[str_] := Module[{}, If [StringLength[str] ≤6, "<h&quo ... ">", "<h6>"<>StringDrop[str, 6] ] ] ;

postEqualSequence[str_, str2_] := Module[{}, If [StringLength[str] ≤6, "& ... ngDrop[str2, -6] <>"</h6>", "</h6>"] ] ] ;

All

List formatting code

All

WriteString[thisLog, "List formatting code\n" ] ;

ManageList[str_] := Module[{data2, data3}, thisStream = StringToStream[str] ; <br /> ... uot;, "</li>\n</ul>"-> "</li></ul>"}] ] ;

All

<pre> formatting code

All

WriteString[thisLog, "<pre> formatting code\n" ] ;

ManageCode[str_] := Module[{data2, data3}, thisStream = StringToStream[str] ; <br /> ... #, 1], #] & /@ data3 ; StringJoin[#<>"\n"& /@ data4] ] ;

All

Wiki formatting code

All

WriteString[thisLog, "Wiki formatting code\n" ] ;

GetClassString[str_] := Module[{str1, STR2, match, result}, If[StringPosition[str, & ... t;class=\"wikipage\"", "class=\"new\""] ] ] ;

All

beforeBodyRE = RegularExpression["^[[:ascii:]]+<body"] ;

beforeBodyRE2 = RegularExpression["^[^>]*>"] ;

afterBodyRE = RegularExpression["</body>[[:ascii:]]+$"] ;

All

All

ThumbOutOfDate[imageName_] := Module[{MD5String, subFolder1, subFolder2, thumbFileName, imag ... t;<>imageName<>" does not need updating\n"] ;] ; result] ;

All

HtmlOutOfDate[notebookName_] := Module[{MD5String, subFolder1, subFolder2, htmlFileName, not ... lt;>notebookName<>" does not need updating\n"] ;] ; result] ;

InsertFullNotebook,All

InsertFullNotebook[notebookName_] := Module[{MD5String, subFolder1, subFolder2, htmlFileName ... Length[result], " bytes\n"] ; (* return the result *)result] ;

InsertTagNotebook,All

InsertNotebookFind[notebookName_, data_, dirParam_, elemsParam_, extraSelect_, n_] := Module ...    Developer`UseFrontEnd[NotebookClose[thisNB]] ; result]

InsertCellTakeNotebook,All

InsertCellTakeNotebook[notebookName_, takeString_] := Module[{}, "detected notebook celltake expression"]

InsertOutput,All

InsertOutput[ref_, ShowInput_, Live_, Showlabel_] := Module[{result = "", executed ... t;\n", ""] ; ] ; InputOutputNumber ++ ; result] ;

All

countLinksFrom[pageName_] := Module[{result = "", target, thisPageID, allLinks}, & ...  result = result<>"0" ; ] ; ToString[result] ] ;

DBText2HTML,All

The following cells show the rules used by the site to transform the text edited by the user and kept in the database into an html form that represent the center part of the web page. The other elements are similarly shown in the page main loop.

FAQFormattingRules,All,DBText2HTML

FAQFormattingRules = {"== FAQ Question ==" "<hr> <ta ... 1;"== FAQ End ==""</td></tr>\n</table>"} ;

All

doubleLine1 = FromCharacterCode[{13, 10, 13, 10}] <>"+" ;

doubleLine2 = "\n\n+" ;

DBText2HTML,All

imageRE1 =         RegularExpression["\\[\\[Image\\:([\\w \\-_\\.]+)\\]\\]"] ;

imageRE2 =        RegularExpression["\\[\\[Image\\:([\\w \\-_\\.]+)\\|([\\w\\-\\. ]+)\\]\\]"] ;

imageRE3 =        RegularExpression["\\[\\[Image\\:([\\w \\-_\\.]+)\\| *thumb *\\|([\\w\\-\\. ]+)\\]\\]"] ;

mediaRE1 =        RegularExpression["\\[\\[Media\\:([\\w \\-_\\.]+)\\]\\]"] ;

mediaRE2 =        RegularExpression["\\[\\[Media\\:([\\w \\-_\\.]+)\\|([\\w\\-\\. ]+)\\]\\]"] ;

downloadRE1 =        RegularExpression["\\[\\[DownloadNotebook\\:([\\w \\-_\\.]+)\\]\\]"] ;

downloadRE2 =        RegularExpression["\\[\\[DownloadNotebook\\:([\\w \\-_\\.]+)\\|([\\w\\-\\. ]+)\\]\\]"] ;

htmlLinkRE1 =        RegularExpression["\\[\\[LinkToViewAsHTML\\:([\\w \\-_\\.]+)\\]\\]"] ;

htmlLinkRE2 =        RegularExpression["\\[\\[LinkToViewAsHTML\\:([\\w \\-_\\.]+)\\|([\\w\\-\\. ]+)\\]\\]"] ;

pageRE1 =          RegularExpression["\\[\\[([\\w \\/\\:\\-_]+)\\]\\]"] ;

pageRE2 =         RegularExpression["\\[\\[([\\w \\/\\:\\-_]+)\\|([\\w \\/]+)\\]\\]"] ;

categoryRE1 = RegularExpression["\\[\\[Category\\:([\\w \\-_\\.]+)\\]\\]"] ;

categoryRE2 = RegularExpression["\\[\\[Category\\:([\\w \\-_\\.]+)\\|([\\w\\-\\. ]+)\\]\\]"] ;

httpRE1 =          RegularExpression["\\[h ... :([\\w/\\.\\-\\:\\?\\=\\_\\(\\)\\#\\%\\&\\;\\~]+) ([\\w\\-\\' \\_\\.\\,\\(\\)]+)\\]"] ;

httpRE2 =          RegularExpression["\\[http\\:([\\w/\\.\\-\\:\\?\\=\\_\\(\\)\\#\\%\\&\\;\\~]+)\\]"] ;

ftpRE1 =          RegularExpression["\\[ftp\\:([\\w/\\.\\-\\:\\?\\=\\_\\(\\)\\#\\%\\&\\;\\~]+) ([\\w\\-\\' \\_\\.\\,\\(\\)]+)\\]"] ;

ftpRE2 =          RegularExpression["\\[ftp\\:([\\w/\\.\\-\\:\\?\\=\\_\\(\\)\\#\\%\\&\\;\\~]+)\\]"] ;

notebookRE1 =         RegularExpression["\\[\\[Notebook\\:([\\w \\-_\\.]+)\\]\\]"] ;

notebookFindRE1 =         RegularExpression["\\[\\[NotebookFind\\[([\\w \\-_\\.]+),([^\\,]+),([^\\,]+),([^\\,]+),([^\\]\\,]+)] *\\]\\]"] ;

notebookFindRE2 =    RegularExpression["\\[\\[NotebookFind\\[([\\w \\-_\\.]+),([^\\,]+),([^\\,]+),([^\\,]+),([^\\,]+),([^\\]]+)] *\\]\\]"] ;

notebookRE3 =         RegularExpression["\\[\\[Notebook\\:([\\w \\-_\\.]+)\\|cellTake\\[([[:alnum:]]+)\\]\\]\\]"] ;

countLinksFromRE1 = RegularExpression["\\[\\[CountLinksFrom\\:([\\w \\-_\\.]+)\\]\\]&qu ... 371;(* InsertNotebookFind[notebookName_, data_, dir_, elems_, extraSelect_, n_:"1"] *)

countTextRules = {ShortestMatch["<**" ~~ ref___ ~~ "**>"]  ... "[[JustOutputLive:|||" ~~ ref___ ~~ "|||]]"] ""} ;

DBText2HTML,All

DBText2HTMLrules = {ShortestMatch["<**" ~~ ref___ ~~ "**>" ... t;\n", RegularExpression[doubleLine2] "\n<P/>\n"} ;

DBText2HTML,All

pseudoEditingRules = {(* editing characters*)"[["> ... }}""*", "**""**"} ;

variableRules,All

variableRules[userId_] := {"196"ToString[Length[v ... able[36], "91"-> ToString[NumberActiveUsers] } ;

DBText2HTML,All

DBText2HTML[str_, userId_] := Module[{result}, InputOutputNumber = 1 ; secti ... EditingRules] ; result = MakeTOC[sectionList] <>result ; result] ;

monthNames,All

monthNames = {"January", "February", "March", "April" ... quot;, "September", "October", "November", "December"} ;

All

notLoginString = "Not logged in" ;

All

date helper function

All,makeDate

WriteString[thisLog, "date helper function\n" ] ;

makeDate[str_] := Module[{}, MSPToExpression/@{StringTake[str, 4], StringTake[str, { ... 8}], StringTake[str, {9, 10}], StringTake[str, {11, 12}], StringTake[str, {13, 14}]} ] ;

AdjustForNameSpace,All

{nsTalk, nsUser, nsImage, nsSpecial, nsHelp, nsNotebook} = {1, 2, 6, 8, 12, 20} ;

nameSpaceList = {{"Talk:", nsTalk}, {"User:", nsUser}, {"Image:&quo ... ", nsSpecial}, {"Help:", nsHelp}, {"Notebook:", nsNotebook}} ; 

AdjustForNameSpace[pageNameparam_, nameSpaceparam_] := Module[{pageName = pageNameparam, nam ... , {"Notebook:", nsNotebook}}] ; ] ;  {pageName, nameSpace} ] ;

All,AddNameSpace

AddNameSpace[pageNameparam_, nameSpaceparam_] := Module[{pos, nameSpace = MyToExpression[nam ... 62371;If[pos≠ {}, StringJoin[pos[[1, 1]], pageNameparam], pageNameparam] ]

All

interleaveStrings[data_, str_] := StringJoin @@ Most[Flatten[Transpose[ {data, Table[str, {Length[data]}]}]]] ;

All,BuildNavigationLists

BuildNavigationLists[commands_, sessionValues_] := Module[{diffCurId = 0, diffDiffId = 0, di ... 1;buttonHTML["fulltext", "Search"] ] ] ; ] ;

All

GetPNAVPORTLET[] := Module[{n0, n1}, n0 = Last /@ Select[navigation0, MemberQ[First[ ... onUser2, MemberQ[First[#], "pnav"] &] ; listHTML[Join[n0, n1]] ] ;

GetSEARCHFORM[] := Module[{}, navigationSearch] ;

GetTOOLBOX[] := Module[{n0, n1}, n0 = Last /@ Select[navigation2, MemberQ[First[#],  ... ion4, MemberQ[First[#], "toolbox"] &] ; listHTML[Join[n0, n1]] ] ;

GetINNER[] := Module[{n0, n1}, n0 = Last /@ Select[navigation5, MemberQ[First[#], "inner"] &] ; listHTML[n0] ] ;

GetPERSOPANEL[] := Module[{n0, n1, n2, n3}, n0 = Last /@ Select[navigation4, MemberQ ... #], "perso"] &] ; (* my watch *)listHTML[Join[n0, n1, n2, n3]] ] ;

GetCACTION[] := Module[{n0, n1}, n0 = Rest /@ Select[navigation1short, MemberQ[First[#], "caction"] &] ; listWExtraHTML[n0] ] ;

All

GetQuickbar[] := Module[{n0, n1, n2, n3, n4, n5}, (* navigation *)n0 ... nner workings of the site *)interleaveStrings[n5, separatorString] ] ] ;

All

ExtractPageNamesFromString[str_] := Module[{strm, data}, strm = StringToStream[str]  ... , "}", " ", "\t"}] ; Close[strm] ; data] ;

All

GetTopLeftText[] := Module[{n0, n1, n2}, n0 = Last /@ Select[navigation0, MemberQ[Fi ... cial:General_disclaimer", "Disclaimers"] ] ] ] ; 

GetRecentLinksData[commands_, sessionValues_] := Module[{pageName, lastFewPages, listOfPages ... ges", ToString[listOfPages]] ; ] ; ] ; listOfPagesString] ;

All

GetBottomLeftText[] := Module[{n0, n1, n2, n3, n4, n5}, n0 = Last /@ Select[navigati ... 71;navigationSearch, "<BR/>", statString] ] ] ; 

GetTopRightText[] := Module[{ nU1, nU2}, nU1 = Last /@ Select[navigationUser1, Membe ... ;BR/>", navigationSearch, "<BR/>"] ] ] ;

All

GetUserClass[user_] := Module[{}, If[MemberQ[userWithPages, user], " ", " class=\"new\" "] ]

All

All

Retrieve the text of a page as is (for editing or creating a new page)

All

WriteString[thisLog, "Retrieve the text of a page\n" ] ;

GetRealText[inputStr_, nameSpaceParam_, oldId_] := Module[{pageName = ToString[inputStr], na ... rbose, Print[pageString<>"\n"] ;] ;  {pageString, timeStamp} ] ;

All

Retrieve the text of a page as is (for diff'ing)

All

GetRealTextFromId[whichId_, whichTable_] := Module[{pageString = "", timeStamp = & ... gt;"\n"] ; ] ;  {pageString, timeStamp, comment, userName} ] ;

All

Get The pageName with quotes.

All

WriteString[thisLog, "Get The pageName with quotes\n" ] ;

GetPageName[pageName_] := Module[{}, If[verbose, Print["GetPageName\n"] ;  ...  ; ] ; "\""<>pageName<>"\""] ;

All

Check the user ID and password for validity in the Database. Uses the MD5 encryption.

All

WriteString[thisLog, "Check the user ID and password for validity in the Database\n" ] ;

hexFromByte[b_] := FromCharacterCode[If[#<10, # + 48, # + 87] & /@IntegerDigits[b, 16, 2]] ;

All

md5Password[password_, userID_] := Module[{step1, passwordCalculated, md}, md = Mess ... ID] <>"-"<>step1] @ getBytes[]]))] ; passwordCalculated] ;

CheckUserID[userName_, password_] := Module[{QueryResult, result, userID = "-1", p ... ;>ToString[userID] <>" \n"] ;] ; ToString[userID] ] ;

All

Display recent changes page

All

WriteString[thisLog, "Display recent changes page\n" ] ;

ShowOneDayRecentChanges[l_] := Module[{}, "<h2>"<>StringJoin[l ... ""] <>"\n</li>") & /@ l] ] ;

All,ShowRecentChanges

ShowRecentChanges[] := StringJoin[ShowOneDayRecentChanges /@ Split[& ... t_oldid"}] ] ], #1[[1]] #2[[1]] &] ] ; 

All,ShowRecentChanges

ShowRecentChanges[restrictedList_] := StringJoin[ShowOneDayRecentChanges /@  ...  6}]] ] & ] ] ], #1[[1]] #2[[1]] &] ] ; 

All

extractDiffCommand[str_] := Module[{posList, posa, posc, posd, posComma, FirstPart, SecondPa ... t] ; ] ;  {{number1, number2}, letter, {number3, number4}} ] ] ;

All

Generate the diff text.

All

WriteString[thisLog, "Generate the diff text\n" ] ;

DisplayDiffData[str_, leftLines_, rightLines_] := Module[{leftBegin, leftEnd, rightBegin, ri ... lt;>ToString[{leftN, rightN}] <>"\n"] ; ] ; result] ;

All

MakeDateString[timeStamp_] := Module[{}, StringTake[timeStamp, {9, 10}] <>&quo ... , 6}]   ] ]] <>" "<>StringTake[timeStamp, 4] ] ;

All

MakeShortDateString[timeStamp_] := Module[{}, StringTake[timeStamp, {7, 8}] <> ... , 6}]   ] ]] <>" "<>StringTake[timeStamp, 4] ] ;

All

All

DiffText[inputStr_, diffCurId_, diffDiffId_, diffOldID_] := Module[{result = "", l ... ot;</table>\n"<>"<HR>" ;  {result, rightPage} ]

All

nameSpaceRules = {"Notebook:""Notebook:", " ... -_\\.\\:]+)\\}\\}"] "wiki.jsp?pageName="<>"$1"} ;

All

convertSpecial text to html

All

SpecialText2HTML[str_] := Module[{result}, result = StringReplace[str, nameSpaceRules] ; ToString[result] ] ;

All

HTML Strings

All

WriteString[thisLog, "HTML Strings\n" ] ;

All

loginHTML = StringJoin[pageTitleHTML["Create an account or log in"], ɯ ... rd", "Mail me a new password"]}} ] ] ] ; 

bulletListHTML[data_] := ToString[StringJoin["<ul>", Sequenc ... quot;</li>\n"] & /@ data], "</ul>\n"]] ; 

All,specialpagesHTML

specialpagesHTML = StringJoin[pageTitleHTML["Special pages"], page ... uot;Special:Allmessages", "All system messages"} }) ] ] ;

All

uploadFormHTML = ToString[StringJoin[fileFormPostHTML["wiki2.jsp",  ... tton["Clear"], fileFormSubmitButton["Submit"] ]] ] ;

All

statsHTML = ToString[StringJoin[pageTitleHTML["Statistics"], pageS ... oldHTML["NUMADMINS"], " of these are administrators."] <br />] ] ; ;

All

VersionHTML = ToString[StringJoin[pageTitleHTML["Version"], pageSu ... ion, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."] ] ] ;

All

DisclaimerHTML = ToString[StringJoin[pageTitleHTML["Disclaimer"],  ... L["From Mathematica-Users"], pHTML["No text here yet!"] ]] ;

All

EditHTML = formPostHTML["edit", "wiki.jsp", <br />textAreaInputH ... ;Editing Tips"], smallHTML[" (this link opens a new page)"] ] ] ;

All

AlmostEditHTML = formPostHTML["edit", "wiki.jsp", <br />textAreaInputHTML["text", "PAGETEXT", 25, 80, "width:95%;"] ] ;

watchHTML = ToString[StringJoin[pHTML["The page 'PAGENAME' has been added to yo ... " in the sidebar."], pHTML["Return to RETURNPAGELINK."] ]] ;

unWatchHTML = ToString[StringJoin[pageTitleHTML["Remove from watchlist"],  ... om your WATCHLISTLINK."], pHTML["Return to RETURNPAGELINK."] ]] ;

All

GetStats[start_] := Module[{result = start, totalPages, totalNormalPages, pageViews, pageEdi ... ToString[numUsers], "NUMADMINS"->ToString[numAdmins] }] ] ;

All

GetValue[cmd_, def_, allCmds_] := Module[{pos}, pos = Select[allCmds, First[#] ɱ ... 2371;If[Length[pos] >0 && pos[[1, 2]] =!= Null, pos[[1, 2]], def] ] ;

SetValue[cmd_, def_, allCmds_] := Module[{result = allCmds, pos}, pos = Position[Fir ...  ; , result = Append[result, {cmd, def}] ; ] ; result] ;

All

loginTextHTML = "You have to <A CLASS=\"wikipage\" HREF=\"wiki.jsp?pageName=Special:Userlogin&returnPage=RETURNPAGE\">Log in</A> first." ;

YouShouldLoginFirst[start_, pageName_] := Module[{result = start, nameSpace, QueryResult, te ...  nameSpace = 8 ;  {result, "Whitelistedittext", nameSpace} ] ;

User options

extractUserOptions,All

WriteString[thisLog, "User options\n" ] ;

extractUserOptions[str_] := Module[{stream, Data}, stream = StringToStream[str] ; &# ... ators {"=", "\n"}] ; Close[stream] ; Data] ;

extractUserOptions,All

SetUserOption[userIdParam_, optionName_, optionValue_] := Module[{userId = MSPToExpression[T ... for:", userIdParam, "; allUserOptions=", allUserOptions ] ; ] ] ;

extractUserOptions,All

GetUserOption[userIdParam_, optionName_] := Module[{userId = MSPToExpression[ToString[userId ... 62371;result[[2]] , default] , default] , default] ] ] ;

GetUserOptionSkinNumber[userIdParam_] := Module[{result}, result = GetUserOption[use ... sult = pos[[1, 1]] - 1 ; result, MSPToExpression[ToString[result]] ] ] ;



All,skinNames

skinNames = {{"standard", "Standard (prefered)", "wikistandard.css& ... eblue.css"}, {"monobook", "MonoBook", "monobook/main.css"}} ;

{{"standard", "Standard (prefered)", "wikistandard.css"}, {&qu ... quot;myskin", "MySkin (does not work well yet )", "myskin/main.css"}} ;

All,SetUserSkinOption

SetUserSkinOption[userIdParam_, skinNameParam_] := Module[{skinName = ToString[skinNameParam ... pos≠ {}, SetUserOption[userIdParam, "skin", skinName ] ; ] ; ] ;

All

MakeCSSFileName[userId_] := Module[{skinNum}, skinNum = 1 + GetUserOptionSkinNumber[ ... inNum>Length[skinNames], skinNum = 1 ;] ; skinNames[[skinNum, 3]] ] ;

All,MakeLogoImage

MakeLogoImage[userId_] := Module[{result = "", imageName, tempStr, temp},  ... me[imageName][[-1]] <>"\" border=0>"], ""] ] ;

All,MakeLogoStyle

MakeLogoStyle[userId_] := Module[{result = "", imageName, tempStr, temp},  ... makeDirName[imageName][[-1]] <>");\"\n"], ""] ] ;

All,MakeBackgroundImage

MakeBackgroundImage[userId_] := Module[{result = "", imageName, tempStr, temp, rep ... ][[-1]] <>"');background-repeat:no-repeat;}"], ""] ] ;

extractUserOptions,All

GetOptionString[userIdparam_] := Module[{userId = MSPToExpression[ToString[userIdparam] ], d ... [[2]]], ""] <>"\n") & /@ data), -1]] ] ] ]

ReadUserOptions,All

ReadUserOptions[] := Module[{}, allUserOptions = {MSPToExpression[ToString[#[[1]] ]] ... ptions"}] ; ] ; (* make sure we update that data when the package is run *)

ReadUserOptions[] ;

All

Special pages

All

Popular pages

All

WriteString[thisLog, "Special pages\n" ] ;

All,GetPopularPages

GetPopularPages[start_] := Module[{result = start, data, QueryResult}, result = resu ... ;>"Error in GetPopularPages[]!?" ; ] ; ToString[result] ] ;

All

Search

All,DoSearch

DoSearch[searchString_] := Module[{result = "", data, QueryResult}, result ... uires at least 4 characters.<br/>" ; ] ; ToString[result] ] ;

All

Short pages

All,GetShortPages

GetShortPages[start_, reverse_] := Module[{result = start, data, QueryResult}, resul ... lt;>"Error in GetShortPages[]!?" ; ] ; ToString[result] ] ;

All

New pages

All,GetNewPages

GetNewPages[start_, reverse_] := Module[{result = start, data, QueryResult}, result  ... t<>"Error in GetNewPages[]!?" ; ] ; ToString[result] ] ;

All

RecentChangesTable

All,RecentChangesTable

RecentChangesTable[howMany_, userIdparam_] := Module[{userId = MyToExpression[userIdparam],  ... t;"Error in RecentChangesTable[]!?" ; ] ; ToString[result] ] ;

All

tumbnail table

ThumbnailTable,All

ThumbnailTable[howMany_] := Module[{result = "", data, QueryResult}, If[ho ... t;>"Error in ThumbnailTable[]!?" ; ] ; ToString[result] ] ;

Partition[Range[36], 10, 10, {1, 1}, {"", ""}]

( {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, {21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, {31, 32, 33, 34, 35, 36, , , , }} )

All

RecentChangesNotebookTable

All,RecentChangesNotebookTable

RecentChangesNotebookTable[howMany_] := Module[{result = "", data, QueryResult}, & ... Error in RecentChangesNotebookTable[]!?" ; ] ; ToString[result] ] ;

All

RecentChangesImagesTable

All,RecentChangesImageTable

RecentChangesImageTable[howMany_] := Module[{result = "", data, QueryResult}, > ... ot;Error in RecentChangesImageTable[]!?" ; ] ; ToString[result] ] ;

All

All pages

All,GetAllPages

GetAllPages[start_] := Module[{result = start, data, QueryResult}, result = result&l ... t<>"Error in GetAllPages[]!?" ; ] ; ToString[result] ] ;

All

Image List

All,GetImageList

GetImageList[start_] := Module[{result = start, data, QueryResult}, result = result& ... <>"Error in GetImageList[]!?" ; ] ; ToString[result] ] ;

All

Notebook List

All,GetNotebookList

GetNotebookList[start_] := Module[{result = start, data, QueryResult}, result = resu ... ;>"Error in GetNotebookList[]!?" ; ] ; ToString[result] ] ;

All

Unused images

All,GetUnusedImages

GetUnusedImages[start_] := Module[{result = start, data, QueryResult, linkedImages},  ... result<>"No unlinked images!" ; ] ; ToString[result] ] ;

All

User List

All,GetUserList

GetUserList[start_, userId_, commands_] := Module[{result = start, data, QueryResult, hasSys ... t<>"Error in GetUserList[]!?" ; ] ; ToString[result] ] ;

All

Category List

All,GetCategoryList

GetCategoryList[start_] := Module[{result = start, data, QueryResult}, result = resu ... ;>"Error in GetCategoryList[]!?" ; ] ; ToString[result] ] ;

All

Admin List

All,GetAdminList

GetAdminList[start_, userId_, commands_] := Module[{result = start, data, QueryResult, hasSy ... <>"Error in GetAdminList[]!?" ; ] ; ToString[result] ] ;

All

Orphaned pages

All,GetOrphanPages

GetOrphanPages[start_] := Module[{result = start, orphanIds, QueryResult, linkedIds }, ɯ ... t;>"Error in GetOrphanPages[]!?" ; ] ; ToString[result] ] ;

All

Dead end  pages

All,GetDeadEndPages

GetDeadEndPages[start_] := Module[{result = start, orphanIds, QueryResult, linkedIds }, > ... t;>"Error in GetOrphanPages[]!?" ; ] ; ToString[result] ] ;

All

Uncategorized pages

All,GetUncategorizedPages

GetUncategorizedPages[start_] := Module[{result = start, uncategorizedIds, QueryResult, link ... quot;Error in GetUncategorizedPages[]!?" ; ] ; ToString[result] ] ;

All

Wanted pages

All,GetWantedPages

GetWantedPages[start_] := Module[{result = start, QueryResult, wantedPages }, result ...  = result<>"No Wanted pages!" ; ] ; ToString[result] ] ;

All

Get All Messages

All,GetAllMessages

GetAllMessages[start_] := Module[{result = start, QueryResult, wantedPages }, result ...  = result<>"No Wanted pages!" ; ] ; ToString[result] ] ;

All

Get WatchList

All,GetWatchlist

GetWatchlist[start_, userName_, userId_] := Module[{result = start, QueryResult, wantedPages ... uot;You have no pages on the watchlist!" ; ] ; ToString[result] ] ;

All,IsWatched

IsWatched[pageName_, namespace_, userId_] := Module[{}, QueryResult = SQLSelect[conn ... ;wl_namespace"] namespace ] ; Length[QueryResult] >0] ; 

All,AddToWatchlist

AddToWatchlist[pageName_, namespace_, userId_] := Module[{}, Print[Hold[AddToWatchli ... _namespace", "wl_user"}, {pageName, namespace, userId}] ] ; ] ] ;

All,StopWatching

StopWatching[pageName_, namespace_, userId_] := Module[{}, Print[Hold[StopWatching[p ... ame] && SQLColumn["wl_namespace"] namespace] ] ; ] ] ;

All

Get Contributions

All,GetContributions

GetContributions[start_, userName_, userId_] := Module[{result = start, QueryResult1, wanted ... t<>"No page contributed yet!" ; ] ; ToString[result] ] ;

All

Log in code

All

WriteString[thisLog, "Log in code\n" ] ;

All,ResubmitLogin

ResubmitLogin[str_, commands_] := Module[{errorString = str, name, password1, password2, ema ... HECKED"->wpRemember, "RETURNPAGE"->returnPage}] ] ;

All

WriteString[thisLog, "UserNameAlreadyExist\n" ] ;

PasswordHasBeenSentHTML = "" ;

UserNameAlreadyExist[name_] := Module[{QueryResult}, QueryResult = SQLSelect[conn, & ... ame)"] ToUpperCase[ToString[name]] ] ; Length[QueryResult] >0] ;

All

WriteString[thisLog, "welcomeAccountHTML\n" ] ;

welcomeAccountHTML = "<h1 class=\"pagetitle\">Account creation successf ... eName=Main_Page\" title=\"Main Page\">Main Page</a>.</p>\n" ;

All

WriteString[thisLog, "loginSuccessHTML\n" ] ;

loginSuccessHTML = "<h1 class=\"pagetitle\">Login successful</h1> ... e=RETURNPAGE\" title=\"RETURNPAGE\">RETURNPAGE</a> .</p>\n" ;

All

WriteString[thisLog, "LogoutHTML\n" ] ;

LogoutHTML = "<h1 class=\"pagetitle\">Logout successful</h1><p ... eName=Main_Page\" title=\"Main Page\">Main Page</a>.</p>\n" ;

All

WriteString[thisLog, "defaultUserOptions\n" ] ;

defaultUserOptions = "quickbar=1\n"<>"underline=1\n"<>" ... t;searchNs10=0\n"<>"searchNs11=1\n"<>"rememberpassword=0" ;

All

WriteString[thisLog, "CreateAccountLoginandWelcome\n" ] ;

All,CreateAccountLoginandWelcome

CreateAccountLoginandWelcome[commands_] := Module[{result = "", wpName, wpPassword ... sp;  TryToRemember[wpRemember, wpName, userID] ; ] ; result] ;

yearLongTime = 365 * 24 * 3600 ;

GenerateToken[wpName_, userID_] := ProcessMD5String["token"<>userID<>wpName] ; 

SetRememberCookie[wpName_, userID_] := ExpireCookies[wpName, userID, yearLongTime] ; 

ExpireCookies[wpName_, userID_, when_] := Module[{nameCookie, userCookie, token, tokenCookie ... hen] ; myCookieResult = $ServletResponse @ addCookie[tokenCookie] ; ] ; 

userHasCookies[] := Module[{result, cookieList, gotName = False, gotUser = False, gotToken = ... serName, userId], userName, userId} ; Print[result] ; result] ; 

ForgetCookies[wpName_, userID_] := Module[{nameCookie, userCookie, token, tokenCookie}, > ... s[][[1]], ExpireCookies[wpName, userID, 0] ; (* set maxAge to 0 *)] ] ; 

timeOutTime = 24 * 3600 ;

TryToRemember[wpRemember_, wpName_, userID_] := Module[{}, (* session variables are  ... sp; If[! wpRemember"", SetRememberCookie[wpName, userID] ;] ; ] ;

All

WriteString[thisLog, "KeepValidCharacters\n" ] ;

All,KeepValidCharacters

KeepValidCharacters[str_] := Module[{inputStr = ToString[str], temp}, FromCharacterC ... ) || (#≥97&& #≤122) || (#≥48&& #≤57) &]] ] ;

All

WriteString[thisLog, "DoLogin\n" ] ;

All,DoLogin

DoLogin[action_, start_, commands_] := Module[{result = start, localUserName, wpLogi ...  (* Which *)    ] ; (* Switch *)ToString[result] ] ;

All

WriteString[thisLog, "DoLogout\n" ] ;

DoLogout[start_, wpName_, userID_, commands_] := Module[{result = start}, returnPage ... getCookies[wpName, userID] ; result = result<>LogoutHTML ; result]

All

WriteString[thisLog, "WriteString\n" ] ;

All,preferenceHTML

preferenceHTML = StringJoin[pageTitleHTML["Preferences"], pageSubT ... ame=\"wpReset\" value=\"Reset\"/>"] ] ]] ] ;

All

WriteString[thisLog, "ResubmitPref\n" ] ;

All,ResubmitPref

ResubmitPref[wpUserName_, userId_, wpRealName_, wpUserEmail_, str_, str2_, wpOldpass_, wpNew ... ;</label></div>\n") &, skinNames])] } ] ] ;

All

WriteString[thisLog, "DoPreferences\n" ] ;

All,DoPreferences

DoPreferences[action_, start_, commands_, sessionValues_] := Module[{temp, userName, userNam ...   ] (* Which *) ; ] (* confirm login *) ; ToString[result] ] ;

All

WriteString[thisLog, "MakePageLinkFromID\n" ] ;

MakePageLinkFromID[Id_] := Module[{pageName, temp}, Print[Hold[MakePageLinkFromID[Id ... t;>" >"<>pageName<>"</A>", ""] ] ;

All

WriteString[thisLog, "GetWhatlinkshere\n" ] ;

All,GetWhatlinkshere

GetWhatlinkshere[start_, commands_] := Module[{result = start, target, thisPageID, allLinks, ... ;>pHTML["Error page not found!"] ; ] ; ToString[result] ] ;

All

IpAddressQ[str_] := Module[{dots}, dots = StringPosition[str, "."] ; If[Length[dots] 3, True, False] ] ;

convertOneLine[str_] := Module[{temp, oneLine}, oneLine = StringToStream[str] ; > ... p[[4]] ], temp = Join[Take[temp, 2], {temp[[{3, 4}]]}, Drop[temp, 4]]] ; temp] ;

ExtractDateFromFileName[str_] := Module[{result, year, month, day}, year = StringTak ... 16}] ; day<>" "<>month<>" "<>year] ;

All,DoSiteStats

DoSiteStats[] := Module[{result = "", DateString, thisFile, data, accesses, allSta ... 2371;result = result<>totalResults<>pageResults ; ToString[result] ]

All

Main code to display a regular page

All

WriteString[thisLog, "Main code to display a regular page\n" ] ;

All,GetPageText

GetPageText[commands_, sessionValues_] := Module[{inputStr = "", nameSpaceParam =  ... umbnailTable[36] <>ShowRecentChanges[] ;] ; ToString[result] ] ] ;

All

    Saving an edited page

All

Update links

All,UpdateDatabaseLinks

UpdateDatabaseLinks[newText_, curId_, TimeStamp_, pageName_] := (* ok now we update  ...  before *)Print["imagelinks did not change"] ; ] ; ] ;

All,SaveThis

SaveThis[{pageNameParam_, newText_, originalTimestamp_, newComment_, isMinorEditParam_, this ... ", "User not authorized to edit those pages, sorry!"] ] ;

All,supportedFileExtensions

supportedFileExtensions = ToUpperCase /@ {"jpeg", "jpg", "gif" ... ot;zip", "txt", "text", "dat", "m", ""} ;

All

Manage file upload

All

If the file exists copy the old one to the archive folder with the timestamp and "!" in front of the name.
then overide it.
update the database  oldimage and image.
update the cur table for the upload log

All,confirmUploadString

    confirmUploadString = <br />    "<table  ... ;<td align='left'>Return to the upload form.</td></tr></table>\n" ;

All

FileExits[filePath_] := Module[{path}, path = FromFileName[filePath] ; Length[FileNames[Last[path], ToFileName[First[path]]] ] >0] ; 

CreateDirectories[str_] := Module[{data}, data = FromFileName[str][[1]] ; da ... [2]]]])  {}, CreateDirectory[ToFileName[#[[2]], #[[1]] ] ] ] & /@ data ; ] ;

All

allcurrentNotebooks = Select[FileNames["*.nb", ToFileName[ImageDirectoryName, #] & ... ;, "f"}, Infinity],  (StringPosition[#, "421"]  {}) &] ;

WriteString[thisLog, ToString[allcurrentNotebooks] ] ;

All

allcurrentImages = FileNames[{"*.BMP", "*.GIF", "*.JPG", " ... a", "b", "c", "d", "e", "f"}, Infinity] ;

WriteString[thisLog, ToString[allcurrentImages] ] ;

All

RefreshNotebookContent[sourcePath_] := Module[{fileName, MD5String, subFolder1, subFolder2,  ...    Developer`UseFrontEnd[NotebookClose[thisNB]] ; ] ; ] ;

All

RefreshThumbnail[sourcePath_] := Module[{fileName, MD5String, subFolder1, subFolder2, destPa ... 371;] ; , Print["cound not process file=", fileName] ; ] ; ] ;

All,ManageFileUpload

ManageFileUpload[{rules_, description_, UploadAffirm_}, userName_, userId_, Overwrite_] := M ... one!", {"", "", "0"}, ToString[result]} ] ] ;

All

The ultimate wikiPage call

All,wikiUpload

wikiUpload[rules_] := Module[{commands, sessionValues, checkboxValue, description, result, d ... ikiUpload calling wikiPage"] ; <br />    wikiPage[pageText] ] ;

All,wikiPage

wikiPage[pageText_:""] := Module[{commands, sessionValues, pageName, anyNumber, Qu ... vePageStat[pageNameStats, commandsStats, sessionValuesStats, timing] ; result] ;

All

Code to calculate things in a notebook

All,UpdateCachedVariables

UpdateCachedVariables[] := Module[{}, (* kill caches *)countTextCache = {} ; ... ;8] ; NumberActiveUsers = Length[Union[Flatten[QueryResult]]] - 1 ; ] ; 

All,CountText

CountText[localString_] := Module[{pos, QueryResult, bigString, result}, (* counts h ... error"] ,  countTextCache[[ pos[[1, 1]], -1]] ] ] ;

CountText[localString_, pageNameParam_, nameSpaceParam_:0] := Module[{pos, QueryResult, bigS ... ;error"] ,  countTextCache[[ pos[[1, 1]], -1 ]] ] ]

All

Code to run to update the HTML versions of notebooks

All

If[deployed, RefreshNotebookContent[wikiNoteBook] ; ] ; 

If[True, WriteString[thisLog, "\n===========================\nchecking the date ... OfDate[name], RefreshNotebookContent[#]]) & /@ allcurrentNotebooks ; ] ; ] ;

If[True, WriteString[thisLog, "\nchecking the validity of the images thumbnails ...  ThumbOutOfDate[name], RefreshThumbnail[#]]) & /@ allcurrentImages ; ] ; ] ;

All,CheckForAutoLoad

CheckForAutoLoad[] := Module[{allFiles, goodFiles, result, data, pageText}, allFiles ... utoLoad is Deleting:", #] ; DeleteFile[#] ; ) & /@ badFiles ; ]

All

UpdateCachedVariables[]

All

validImagesNames = {#[[1]], makeDate[#[[2]]]} & /@   SQLSelect[conn, &quo ... t;img_name", "img_timestamp"}] ; (* fix for for screw in SQL update up *)

(* FixOneImageDateSize[imageName_] := Module[{success, dateStamp, size, path, result}, ɯ ... tring[allimageNames], "\n"] ; FixOneImageDateSize /@allimageNames ; *)

All,IsUserIdSysop,RefreshSysopList

(* make a list of users who have sysop duty *)RefreshSysopList[] := Module[{QueryRes ... 2371;IsUserIdSysop[thisID_] := MemberQ[ToString[First[#]] & /@ sysopUsers, ToString[thisID]]

All,IsUserIdSysop,RefreshSysopList

Null^3

All

Close[thisLog] ;

All

Package Ends

All

End Private

All

End[] ;

All

End the Package

All

EndPackage[] ;

All


Created by Mathematica  (June 5, 2005) Valid XHTML 1.1!
Contributors to this Page This is a new page. It was created by LucB on Mon 9 May 2005 05:34:59
Retrieved from completeWiki .
Personal tools