X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=index.cgi;h=093a5c4a90051bb87e717c6619c7cffd6cde997a;hp=12f59b299db03c715539a229c965f0e63e73cc59;hb=f697cfeeaa6196451b1ddbb2ec682058d74fe680;hpb=e6309da8eba1d1474b98aa2d4723a10747d808b0 diff --git a/index.cgi b/index.cgi index 12f59b2..093a5c4 100755 --- a/index.cgi +++ b/index.cgi @@ -10,15 +10,23 @@ esac; done [ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}" . "$_EXEC/cgilite/cgilite.sh" +. "$_EXEC/cgilite/session.sh" _PATH="$(PATH "/${PATH_INFO}")" ACTION="$(GET a)" +message="$(COOKIE message)" +[ "$message" ] && SET_COOKIE 0 message='' + +checked(){ [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'checked="checked"' 2>/dev/null; } +selected(){ [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'selected="selected"' 2>/dev/null; } + yield_page() { local class="$1" style="$2" printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' { printf ' [html [head + [title Confetti] [meta name="viewport" content="width=device-width"] [link rel="stylesheet" type="text/css" href="/style.css"] ' @@ -29,13 +37,14 @@ yield_page() { ] [body class="%s" ' "$class" cat + [ "$message" ] && printf '[p #message\n%s\n]' $(l10n "$message") printf '] ]' } \ | "${_EXEC}/cgilite/html-sh.sed" } -if [ -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/main.cgi" ]; then - . "${_EXEC}/${_PATH}/main.cgi" +if [ -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/index.cgi" ]; then + . "${_EXEC}/${_PATH}/index.cgi" elif [ ! -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}" ]; then . "${_EXEC}/${_PATH}" elif [ ! -x "${_EXEC}/${_PATH}" -a -r "${_EXEC}/${_PATH}" ]; then