#!/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"
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
}
case "${PATH_INFO}" in
- /"[wiki]"/*)
- FILE "${_EXEC}/${PATH_INFO#/\[wiki\]}"
+ /"[.]"/*)
+ FILE "${_EXEC}/${PATH_INFO#/\[.\]}"
;;
*/)
if [ -f "$_DATA/pages/$PATH_INFO/#page.md" \
-o -f "$_EXEC/pages/$PATH_INFO/#page.md" ]; then
theme_page "${PATH_INFO}"
- else
- theme_404
fi
;;
- */"[attachment]"/*)
- : # TODO: Original attachment file
+ */"[login]")
+ [ "$USER_NAME" ] \
+ && REDIRECT "./" \
+ || theme_login
+ ;;
+ */"[register]")
+ theme_register
;;
*/"#"*)
: # TODO: Invalid page name
;;
- *)
- attachment "${PATH_INFO}"
- ;;
esac
+
+. "$_EXEC/page_edit.sh"
+. "$_EXEC/attachment.sh"