X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=index.cgi;h=ff9e563f356689f95115ddb1aaac6f4f4df42bbe;hb=982da7c4af273bb7a2b6df7fef192f5974bed25c;hp=f44d288db0e41ba30f093e2a1c485424b61172ed;hpb=8ab57724f6c6d4d14040a393f51a108c6aba9c60;p=httpchat diff --git a/index.cgi b/index.cgi index f44d288..ff9e563 100755 --- a/index.cgi +++ b/index.cgi @@ -1,7 +1,7 @@ #!/bin/sh -_EXEC=. -_DATA=. +_EXEC="${_EXEC:-.}" +_DATA="${_DATA:-.}" SESSION_TIMEOUT=43200 . "$_EXEC/cgilite/logging.sh" . "$_EXEC/cgilite/cgilite.sh" @@ -32,13 +32,18 @@ yield_page(){ settings_menu(){ printf ' - [form #settings method="POST" action="?" + [form #settings method="POST" action="?settings" [hidden "session_key" "%s"] - [h1 Settings][a .settings href="?" Close]' + [h1 Settings][a .settings href="?" Close] + ' "$SESSION_KEY" + if [ "$ERROR" ]; then + printf '[p .error %s %s]' "${ERROR%% *}" "$(HTML "${ERROR#.* }")" + unset ERROR + fi printf ' [a .section href="#nick" Nickname] [div #nick [input name="nickname" value="%s"][submit "action" "nick" Set Cookie]] - ' "$SESSION_KEY" "$(HTML "${nickname#\?}")" + ' "$(HTML "${nickname#\?}")" printf ' [a .section href="#register" Register Nickname] [div #register @@ -54,10 +59,11 @@ settings_menu(){ case ${LOCATION} in webchat.css) . "$_EXEC/cgilite/file.sh" - FILE "$_EXEC/webchat.css" - exit 0 + FILE "$_EXEC/${LOCATION}" + return 0 ;; \&?*) + [ "$(COOKIE nick)" -o "$QUERY_STRING" = settings ] || REDIRECT "/$LOCATION?settings#nick" chatfile="$_DATA/${LOCATION}/channel" . "$_EXEC/channel.sh" exit 0 @@ -75,6 +81,7 @@ case ${LOCATION} in if [ -d "$_DATA/@${LOCATION#~}" ]; then pubinfo="$_DATA/@${LOCATION#~}/pubinfo" else + # ToDo Edit / Display of public user information REDIRECT / fi ;;