[EXAMPLES]

* SmallWiki: Add a few comments to explain how the wiki data is stored.


git-svn-id: svn://localhost/gambas/trunk@6121 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-02-01 23:22:29 +00:00
parent 081d4fc2ad
commit ee7adf9fd4
3 changed files with 17 additions and 3 deletions

View file

@ -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

View file

@ -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.<date>.<user>" 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

View file

@ -2,7 +2,7 @@ Main
SmallWiki
0
0
0.0.77
0.0.78
gb.web