3 for n in "$@"; do case ${n%%=*} in
4 data) _DATA="${n#data=}";;
5 exec) _EXEC="${n#exec=}";;
9 [ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
10 [ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}"
12 mkdir -p "${_DATA}/cache" "${_DATA}/mappings" "${_DATA}/export" "${_DATA}/lock" "${_DATA}/ical" "${_DATA}/vcard"
16 if [ ! "$DEBUG" ]; then
17 [ "$#" -gt 0 ] && : || cat;
18 elif [ "$#" -gt 0 ]; then
19 printf '%s\n' "$@" >>"$dbg"
25 . "$_EXEC/cgilite/cgilite.sh"
26 . "$_EXEC/cgilite/session.sh"
30 _PATH="$(PATH "/${PATH_INFO}")"
33 message="$(COOKIE message)"
34 [ "$message" ] && SET_COOKIE 0 message=''
37 if [ "$1" = "$2" ] || [ "$1" -eq "$2" ]; then
38 printf 'checked="checked"'
42 if [ "$1" = "$2" ] || [ "$1" -eq "$2" ]; then
43 printf 'selected="selected"'
48 local class="$1" style="$2"
49 printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
53 [meta name="viewport" content="width=device-width"]
54 [link rel="stylesheet" type="text/css" href="/style.css"]
56 [ -n "$style" ] && printf '
57 [link rel="stylesheet" type="text/css" href="%s"]
60 ] [body #top class="%s"
62 printf '[ul .menu [li [a "/cards/" . %s]][li [a "/courses/" . %s]]]' "$(l10n cards)" "$(l10n courses)"
63 [ "$message" ] && printf '[p #message\n%s\n]' "$(l10n "$message")"
67 | "${_EXEC}/cgilite/html-sh.sed"
71 topdir="/${topdir%%/*}"
76 /export/*.pdf) . "$_EXEC/cgilite/file.sh"
77 FILE "${_DATA}/${_PATH}" "application/pdf"
79 /export/*) . "$_EXEC/cgilite/file.sh"
80 FILE "${_DATA}/${_PATH}"
83 if [ -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/index.cgi" ]; then
84 . "${_EXEC}/${_PATH}/index.cgi"
85 elif [ -f "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}" ]; then
87 elif [ -f "${_EXEC}/${_PATH}" -a -r "${_EXEC}/${_PATH}" ]; then
88 . "$_EXEC/cgilite/file.sh"
89 FILE "${_EXEC}/${_PATH}"
90 elif [ -d "${_EXEC}/${topdir}" -a -x "${_EXEC}/${topdir}/index.cgi" ]; then
91 . "${_EXEC}/${topdir}/index.cgi"
93 printf '%s\r\n' 'Status: 404 Not Found' 'Content-Length: 0' ''