X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=page.sh;h=def728041a6cd837d2d443bcc9ae53a8e72c0088;hp=96f3fcc26f048924abad208e4c4c0f5c4cb953aa;hb=1a1d111199b770c092e1b16a7e03568d3d911b79;hpb=c4c5b0acdaaa275baa934caeeba960ad12d14c71 diff --git a/page.sh b/page.sh index 96f3fcc..def7280 100755 --- a/page.sh +++ b/page.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014,2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of shcgi. # @@ -17,18 +17,17 @@ # You should have received a copy of the GNU Affero General Public License # along with shcgi. If not, see . -echo -n "Content-Type: text/html;charset=utf-8\n\n" +. "${_EXEC}/shcgi/forms.sh" -PAGE="$(echo -E "$_GET[\"p\"]" |egrep '^[a-zA-Z0-9_-]+$')" -PAGE="${_EXEC}/pages/${PAGE}.sh" -[ -x "$PAGE" ] || PAGE="${_EXEC}/pages/error.sh" +[ -z "$NAVIGATION" ] \ +&& NAVIGATION=($(printf %s\\n "${_EXEC}"/pages/*.sh |sed -r 's;^.*/([^/]*)\.sh$;\1;')) -NAVIGATION() { - for each in "${_EXEC}"/pages/*.sh; do - link="$(echo -E "$each" |sed -r "s:^.*/([^/]*)\.sh$:\1:")" - title="$($each title)" - [ -n "$title" ] && echo -E "?p=$link $title" - done -} +CSS="${CSS:-${_EXEC}/templates/${PAGE}.css.sh}" +BODY="${BODY:-${_EXEC}/templates/${PAGE}.html.sh}" -. ${_EXEC}/templates/frame.html.sh +. "${_EXEC}/pages/${PAGE}.sh" + +# prevent browsers from caching generated pages +printf "Cache-Control: no-cache, no-store, must-revalidate\r\nPragma: no-cache\r\nExpires: 0\r\n" +printf "Content-Type: text/html;charset=utf-8\r\n\r\n" +. "${_EXEC}/templates/frame.html.sh"