X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=page.sh;h=f68df8e26b92445703aee85cbd83fe63ff3a82de;hp=578e93a9d023917236d0543fdbcf38eadfcac0ba;hb=0678b538a6d0f56a629a8e4dd9ef6e7665b14208;hpb=49831f4301899b008b94f590b4c9765f76b4c0f0 diff --git a/page.sh b/page.sh index 578e93a..f68df8e 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,13 @@ # 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" +[ -z "$NAVIGATION" ] \ +&& NAVIGATION=($(printf %s\\n "${_EXEC}"/pages/*.sh |sed -r 's;^.*/([^/]*)\.sh$;\1;')) -PAGE="$(echo -E "$_GET[\"p\"]" |egrep '^[a-zA-Z0-9_-]+$')" -PAGE="${_EXEC}/pages/${PAGE}.sh" -[ -x "$PAGE" ] || PAGE="${_EXEC}/pages/error.sh" +CSS="${CSS:-${_EXEC}/templates/${PAGE}.css.sh}" +BODY="${BODY:-${_EXEC}/templates/${PAGE}.html.sh}" -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 -} +. "${_EXEC}/pages/${PAGE}.sh" -. ${_EXEC}/templates/frame.html.sh +printf "Content-Type: text/html;charset=utf-8\r\n\r\n" +. "${_EXEC}/templates/frame.html.sh"