--- /dev/null
+#!/bin/sh
+
+. "${_EXEC:-${0%/*}}"/cgilite/cgilite.sh
+. "$_EXEC"/cgilite/session.sh
+. "$_EXEC"/cgilite/file.sh
+. "$_EXEC"/cgilite/storage.sh
+. "$_EXEC"/widgets.sh
+
+PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")"
+
+# bookmarks_cookie="$(COOKIE bookmarks |grep -xE '[0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?( [0-9a-zA-Z:=]{16}(/[0-9a-zA-Z:=]{16})?)*')"
+bookmarks=''
+for bm in $(COOKIE bookmarks); do
+ [ -f "${_DATA}/$(checkid "${bm%/*}")" ] && bookmarks="${bookmarks}${bookmarks:+ }${bm}"
+done
+if [ "$bookmarks" ]; then
+ SET_COOKIE +$((182 * 86400)) bookmarks="${bm}" Path="${_BASE}/"
+fi
+
+yield_page(){
+ title="${1:-Webpoll}" page="$2"
+ printf '%s\r\n' 'Content-Type: text/html; charset=utf-8' \
+ "Content-Security-Policy: script-src 'none'" \
+ ''
+ { printf '[html
+ [head
+ [meta name="viewport" content="width=device-width"]
+ [link rel="stylesheet" type="text/css" href="%s/common.css"]
+ [link rel="stylesheet" type="text/css" href="%s/widgets.css"]
+ [link rel="stylesheet" type="text/css" href="%s/webpoll.css"]
+ [title %s]
+ ] [body class="%s"
+ ' "$_BASE" "$_BASE" "$_BASE" "$(HTML "$title")" "$page"
+ cat
+ printf '] ]'
+ } |"$_EXEC/cgilite/html-sh.sed" -u
+}
+
+pagename() {
+ local id="$1"
+ local file="$_DATA/$id"
+ if [ -f "$file" ]; then
+ DBM "$file" get title || printf 'Unnamed Page'
+ else
+ return 1;
+ fi
+}
+
+ page_home() { . "$_EXEC"/home.sh; }
+page_newdate() { . "$_EXEC"/newdate.sh; }
+ page_poll() { . "$_EXEC"/poll.sh; }
+
+case ${PATH_INFO} in
+ /favicon.ico) printf '%s\r\n' 'Content-Length: 0' '';;
+ /common.css) FILE "$_EXEC/cgilite/common.css";;
+ /widgets.css|/webpoll.css) FILE "${_EXEC}/${PATH_INFO}";;
+ /) page_home;;
+ /[0-9a-zA-Z:=]???????????????/[0-9a-zA-Z:=]???????????????) page_newdate;;
+ /*/newoptions);;
+ /[0-9a-zA-Z:=]???????????????) page_poll;;
+ /*) page_home;;
+esac
+
+exit 0