From: paul Date: Sun, 10 Jan 2016 23:10:09 +0000 (+0000) Subject: allow CSS and BODY variable to be overridden (e.g. in local.opts) X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=66a81257205b0f2b4c5561ddc82c3177d4acbd7b;p=cgilite allow CSS and BODY variable to be overridden (e.g. in local.opts) svn path=/trunk/; revision=19 --- diff --git a/page.sh b/page.sh index 5726ed9..cb1b87f 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. # @@ -19,13 +19,13 @@ printf "Content-Type: text/html;charset=utf-8\n\n" -[ -z "$PAGE" ] && PAGE="$(printf %s "${_GET[page]}" |egrep '^[a-zA-Z0-9_-]+$')" +PAGE=$(validate "${PAGE:-${_GET[page]}}" '[a-zA-Z0-9_-]+' error) [ -x "${_EXEC}/pages/${PAGE}.sh" ] || PAGE="error" [ -z "$NAVIGATION" ] && NAVIGATION=($(printf %s\\n "${_EXEC}"/pages/*.sh |sed -r 's;^.*/([^/]*)\.sh$;\1;')) -CSS="${_EXEC}/templates/${PAGE}.css.sh" -BODY="${_EXEC}/templates/${PAGE}.html.sh" +CSS="${CSS:-${_EXEC}/templates/${PAGE}.css.sh}" +BODY="${BODY:-${_EXEC}/templates/${PAGE}.html.sh}" . "${_EXEC}/pages/${PAGE}.sh" . "${_EXEC}/templates/frame.html.sh"