]> git.plutz.net Git - shellwiki/blobdiff - index.cgi
remove debug output
[shellwiki] / index.cgi
index 9d2ed3d657b4f8cc16b19511c5d7a53654b361bb..6f71a4b6aaa54ea0a7538c08c813a65f55c159d7 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -1,10 +1,9 @@
 #!/bin/sh
 
 . "${_EXEC:-${0%/*}}/cgilite/cgilite.sh"
-set -- nocookie
 . "${_EXEC}/cgilite/session.sh"
 . "${_EXEC}/cgilite/file.sh"
-# . "$_EXEC"/cgilite/users.sh
+. "${_EXEC}/cgilite/users.sh"
 
 . "${_EXEC}/themes/default.sh"
 
@@ -20,6 +19,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
@@ -65,9 +78,11 @@ attachment() {
   fi
 }
 
+. "$_EXEC/page_edit.sh"
+
 case "${PATH_INFO}" in
-  /"[wiki]"/*)
-    FILE "${_EXEC}/${PATH_INFO#/\[wiki\]}"
+  /"[.]"/*)
+    FILE "${_EXEC}/${PATH_INFO#/\[.\]}"
     ;;
   */)
     if [ -f "$_DATA/pages/$PATH_INFO/#page.md" \
@@ -77,6 +92,14 @@ case "${PATH_INFO}" in
       theme_404
     fi
     ;;
+  */"[login]")
+    [ "$USER_NAME" ] \
+    && REDIRECT "./" \
+    || theme_login
+    ;;
+  */"[register]")
+    theme_register
+    ;;
   */"[attachment]"/*)
     :  # TODO: Original attachment file
     ;;