X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=page.sh;h=9b3b10c48d81f7a3ba17487bfa0f380ea378f8e5;hp=d4e38cec88e2d79c3354feedde3bc74934ecd5cb;hb=147a3ae4c390dfc186f25b0aba267d7ff23b2151;hpb=3a43bceff672dae6d391a53a1a12943c207aeff1 diff --git a/page.sh b/page.sh index d4e38ce..9b3b10c 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,15 @@ # You should have received a copy of the GNU Affero General Public License # along with shcgi. If not, see . -printf "Content-Type: text/html;charset=utf-8\n\n" +. "${_EXEC}/shcgi/forms.sh" -PAGE="$(printf %s "$_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="$(printf %s "$each" |sed -r "s:^.*/([^/]*)\.sh$:\1:")" - title="$($each title)" - [ -n "$title" ] && printf '%s\n' "?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" + +printf "Content-Type: text/html;charset=utf-8\r\n\r\n" +. "${_EXEC}/templates/frame.html.sh"