6 . "$_EXEC"/cgilite/cgilite.sh
7 . "$_EXEC"/cgilite/session.sh
8 . "$_EXEC"/cgilite/file.sh
9 . "$_EXEC"/session_lock.sh
13 printf '%s\r\n' 'Content-Type: text/html; charset=utf-8' \
14 "Content-Security-Policy: script-src 'none'" \
18 [meta name="viewport" content="width=device-width"]
19 [link rel="stylesheet" type="text/css" href="common.css"]
20 [link rel="stylesheet" type="text/css" href="webnote.css"]
26 } |"$_EXEC/cgilite/html-sh.sed" -u
29 case ${PATH_INFO##*/} in
30 favicon.ico) printf '%s\r\n' 'Content-Length: 0' '';;
31 common.css) FILE "$_EXEC/cgilite/common.css";;
32 webnote.css) FILE "$_EXEC/webnote.css";;
34 [form .new action=new [button type=submit New Note]
36 $({ COOKIE pages; echo; } |tr \ \\n |while read page; do
37 [ "$(printf %s "$page" |checkid)" ] && printf '[li [a href="./%s" . %s]]' "$page" "$page"
50 doc="$_DATA/$(printf %s ${PATH_INFO##*/} |checkid)"
52 if [ ! -f "$doc" ]; then
53 REDIRECT "${PATH_INFO%%/*}/"
57 [ $REQUEST_METHOD = POST ] && case $(POST action) in
59 if temp=$(SLOCK "$doc"); then
62 [input type=hidden name=session_key value="$SESSION_KEY"]
63 [button type=submit name=action value=cancel Cancel]
64 [button type=submit name=action value=update Update]
65 [textarea name=document . $(HTML <"$doc")]
70 [p .error .locked Someone else is already editing this Dokument. Wait a few minutes and try again. [a href="$PATH_INFO" Nothing else I can do.]]
80 if temp=$(CHECK_SLOCK "$doc"); then
82 POST document >"${doc}"
86 [p .error .stolen Your edit took too long and someone else is now editing this file. [a href="$PATH_INFO" Dang, I must be quicker next time!]]
87 [p Copy your Content for reference:]
88 [div .text . $(POST document |HTML)]
95 COOKIE pages |tr \ \\n |grep -qF "${doc##*/}" \
96 || SET_COOKIE +$((90 * 86400)) pages="$(COOKIE pages && printf ' %s' "${doc##*/}" || printf '%s' "${doc##*/}")"
100 [input type=hidden name=session_key value="$SESSION_KEY"]
101 [button type=submit name=action value=edit Edit]
103 [div .text . $(HTML <"$doc")]