X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=index.cgi;h=76f1bef6a0062b6e71e6191a3feeb74bd990a7c2;hb=5188614dbad08cce02ab53910d9252b0007f228f;hp=9d2ed3d657b4f8cc16b19511c5d7a53654b361bb;hpb=3d34cb0400fc26eaefaf1b0299ddf9dcc0a090b9;p=shellwiki diff --git a/index.cgi b/index.cgi index 9d2ed3d..76f1bef 100755 --- a/index.cgi +++ b/index.cgi @@ -4,7 +4,7 @@ set -- nocookie . "${_EXEC}/cgilite/session.sh" . "${_EXEC}/cgilite/file.sh" -# . "$_EXEC"/cgilite/users.sh +. "${_EXEC}/cgilite/users.sh" . "${_EXEC}/themes/default.sh" @@ -20,6 +20,20 @@ else md() { cat; } fi +wiki_text() { + # Print source text of a wiki page + # Get page from data or underlay dir + local page="$(PATH "$1")" + + if [ -f "$_DATA/pages/$page/#page.md" ]; then + cat -- "$_DATA/pages/$page/#page.md" + elif [ -f "$_EXEC/pages/$page/#page.md" ]; then + cat -- "$_EXEC/pages/$page/#page.md" + else + return 1 + fi +} + wiki() { # Print content of a wiki page # Get page from data or underlay dir, handle caching @@ -66,8 +80,8 @@ attachment() { } case "${PATH_INFO}" in - /"[wiki]"/*) - FILE "${_EXEC}/${PATH_INFO#/\[wiki\]}" + /"[.]"/*) + FILE "${_EXEC}/${PATH_INFO#/\[.\]}" ;; */) if [ -f "$_DATA/pages/$PATH_INFO/#page.md" \ @@ -77,6 +91,17 @@ case "${PATH_INFO}" in theme_404 fi ;; + */"[edit]") + theme_editor "${PATH_INFO%\[edit\]}" + ;; + */"[login]") + [ "$USER_NAME" ] \ + && REDIRECT "./" \ + || theme_login + ;; + */"[register]") + theme_register + ;; */"[attachment]"/*) : # TODO: Original attachment file ;;