for n in "$@"; do case ${n%%=*} in
data) _DATA="${n#data=}";;
exec) _EXEC="${n#exec=}";;
- noerr) exec 2>&-;;
+ base) _BASE="${n#base=}";;
+ debug) DEBUG="${n#debug=}";;
esac; done
-[ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
-[ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}"
+[ ! "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
+[ ! "${_DATA%/}" ] && _DATA="${PWD%/}" || _DATA="${_DATA%/}"
+_BASE="${_BASE%/}"
+[ "$DEBUG" ] && exec 2>>"$DEBUG"
-debug() {
- local dbg=/dev/stderr
- if [ ! "$DEBUG" ]; then
- [ "$#" -gt 0 ] && : || cat;
- elif [ "$#" -gt 0 ]; then
- printf '%s\n' "$@" >>"$dbg"
- else
- tee -a "$dbg"
- fi
-}
+mkdir -p "${_DATA}/cache" "${_DATA}/mappings" "${_DATA}/export" "${_DATA}/lock" "${_DATA}/ical" "${_DATA}/vcard" "${_DATA}/therapies"
. "$_EXEC/cgilite/cgilite.sh"
. "$_EXEC/cgilite/session.sh"
+. "$_EXEC/l10n.sh"
+
_PATH="$(PATH "/${PATH_INFO}")"
+_PATH="${_PATH#${_BASE}}"
ACTION="$(GET a)"
message="$(COOKIE message)"
printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
{ printf '
[html [head
- [title Confetti]
+ [title Lobster]
[meta name="viewport" content="width=device-width"]
- [link rel="stylesheet" type="text/css" href="/style.css"]
- '
+ [link rel="stylesheet" type="text/css" href="%s/cgilite/common.css"]
+ [link rel="stylesheet" type="text/css" href="%s/style.css"]
+ ' "${_BASE}" "${_BASE}"
[ -n "$style" ] && printf '
[link rel="stylesheet" type="text/css" href="%s"]
' "$style"
printf '
] [body #top class="%s"
' "$class"
- cat
[ "$message" ] && printf '[p #message\n%s\n]' "$(l10n "$message")"
+ cat
printf '] ]'
} \
| "${_EXEC}/cgilite/html-sh.sed"
topdir="/${topdir%%/*}"
case ${_PATH} in
- /) REDIRECT /cards/
- ;;
- /export/*.pdf) . "$_EXEC/cgilite/file.sh"
- FILE "${_DATA}/${_PATH}" "application/pdf"
- ;;
- /export/*) . "$_EXEC/cgilite/file.sh"
- FILE "${_DATA}/${_PATH}"
+ "/") REDIRECT "${_BASE}/cards/"
;;
*)
if [ -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/index.cgi" ]; then