diff --git a/examples/examples/Web/SmallWiki/.project b/examples/examples/Web/SmallWiki/.project index d776caeed..4d91f4d2d 100644 --- a/examples/examples/Web/SmallWiki/.project +++ b/examples/examples/Web/SmallWiki/.project @@ -4,7 +4,7 @@ Title=SmallWiki Startup=Main UseHttpServer=1 Icon=.public/logo.png -Version=0.0.78 +Version=0.0.79 Component=gb.web TabSize=2 ExecPath=/home/guygle/guygle/cgi-bin/wiki.gambas diff --git a/examples/examples/Web/SmallWiki/.src/Main.module b/examples/examples/Web/SmallWiki/.src/Main.module index 1ef83ab82..65616269c 100644 --- a/examples/examples/Web/SmallWiki/.src/Main.module +++ b/examples/examples/Web/SmallWiki/.src/Main.module @@ -52,18 +52,30 @@ Public Sub Main() Dim aPage As String[] Dim sDir As String + ' The wiki is stored in the following root directory. + Root = User.Home &/ "wiki" Try Mkdir Root - + + ' All pages are stored in a "data" directory stored in the root directory. + ' If the "data" directory does not exist, the wiki is initialized with a default root page. + If Not Exist(Root &/ "data") Then InitWiki Response.Redirect(Application.Root) Return Endif + ' The url path is directly converted to a relative directory path inside the "data" directory located in the root directory. + ' The page contents is stored inside a "~page" file located in that directory. + ' Consequently, no "~" character is allowed in the url path. + ' Each page modification is archived in a "~page.." file, allowing changes to be undone. + Path = Request.Path If Path = "/" Then Path) = "" + ' Handle resource files: images, style sheet... + If Path And If Exist(".public" &/ Path) Then sExt = File.Ext(Path) If sExt = "css" Then @@ -77,6 +89,8 @@ Public Sub Main() Return Endif + ' Reject pages whose url includes a "~" character. + If InStr(Path, "~") Then Response.Status = "404 Not Found" Response.Begin diff --git a/examples/examples/Web/SmallWiki/.startup b/examples/examples/Web/SmallWiki/.startup index bd7d5f86f..ba0934f35 100644 --- a/examples/examples/Web/SmallWiki/.startup +++ b/examples/examples/Web/SmallWiki/.startup @@ -2,7 +2,7 @@ Main SmallWiki 0 0 -0.0.77 +0.0.78 gb.web