X-Git-Url: https://git.plutz.net/?p=httpchat;a=blobdiff_plain;f=index.cgi;h=16bd9044053803c2ca16b840b5514ab3fde9d106;hp=2daabd824e750495e42b0bf42f318fbd5b576476;hb=1b78a6c60a0c44a164dcf12f1e7683008f2cf402;hpb=1cd692ed9af229a0118fb77b77bcbd889a0adcbf diff --git a/index.cgi b/index.cgi index 2daabd8..16bd904 100755 --- a/index.cgi +++ b/index.cgi @@ -21,6 +21,7 @@ yield_page(){ [title Webchat] ] [body class="%s" ' "$page" + [ "$QUERY_STRING" = settings ] && settings_menu cat printf '] ]' } |"$_EXEC/cgilite/html-sh.sed" -u @@ -28,48 +29,55 @@ yield_page(){ settings_menu(){ printf ' - [input #check_settings type="checkbox"][label for=check_settings Settings] - [div #settings - [h1 Settings][label for=check_settings Close] - [input #set_nick type=radio name="setting" value="nick" selected][label for=set_nick Nickname] - [div [input name="nickname" value="%s"][submit "action" "nick" Set Cookie]] - ] + [form #settings method="POST" action="?" + [h1 Settings][a .settings href="?" Close]' + printf ' + [a .section href="#nick" Nickname] + [div #nick [input name="nickname" value="%s"][submit "action" "nick" Set Cookie]] ' "$(HTML "${nickname#\?}")" + printf ' + [a .section href="#register" Register Nickname] + [div #register + [p Registration will set a permanent Cookie in your Browser. + Registration requires neither a password, nor an email address.] + [input name="regnick" value="%s"][submit "action" "register" Register] + ]' "$(HTML "${nickname#\?}")" + printf ']' } +. "$_EXEC/usernick.sh" + case ${LOCATION} in - \&?*) chatfile="$_DATA/${LOCATION}" - . $_EXEC/channel.sh - exit 0 - ;; - @?*) if [ -d "$_DATA/${LOCATION}" ]; then - chatfile="$_DATA/${LOCATION}/?${SESSION_ID}" - . $_EXEC/channel.sh - else - REDIRECT / - fi - exit 0 - ;; - ~?*) if [ -d "$_DATA/@${LOCATION#~}" ]; then - pubinfo="$_DATA/@${LOCATION#~}/pubinfo" - page=pubinfo - else - REDIRECT / - fi - ;; webchat.css) - . "$_EXEC/file.sh" + . "$_EXEC/cgilite/file.sh" FILE "$_EXEC/webchat.css" exit 0 ;; - '') page=front;; - *) REDIRECT /;; -esac - -case "$page $(POST action)" in - pubinfo\ *);; - front\ *) yield_page front <<-EOF + \&?*) + chatfile="$_DATA/${LOCATION}" + . "$_EXEC/channel.sh" + exit 0 + ;; + @?*) + if [ -d "$_DATA/${LOCATION}" ]; then + chatfile="$_DATA/${LOCATION}/?${SESSION_ID}" + . "$_EXEC/channel.sh" + else + REDIRECT / + fi + exit 0 + ;; + ~?*) + if [ -d "$_DATA/@${LOCATION#~}" ]; then + pubinfo="$_DATA/@${LOCATION#~}/pubinfo" + else + REDIRECT / + fi + ;; + '') yield_page front <<-EOF Front EOF ;; + *) REDIRECT / + ;; esac