]> git.plutz.net Git - clickslide/commitdiff
allow CSS and BODY variable to be overridden (e.g. in local.opts)
authorpaul <paul@plutz.net>
Sun, 10 Jan 2016 23:10:09 +0000 (23:10 +0000)
committerpaul <paul@plutz.net>
Sun, 10 Jan 2016 23:10:09 +0000 (23:10 +0000)
svn path=/trunk/; revision=19

page.sh

diff --git a/page.sh b/page.sh
index 5726ed9d8d39d2cf18e32647d3ca18891a3c394f..cb1b87ffd85b5438c2e46a439c92f947e721e165 100755 (executable)
--- a/page.sh
+++ b/page.sh
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
 #!/bin/zsh
 
-# Copyright 2014,2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of shcgi.
 # 
 #
 # This file is part of shcgi.
 # 
 
 printf "Content-Type: text/html;charset=utf-8\n\n"
 
 
 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;'))
 
 [ -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"
 
 . "${_EXEC}/pages/${PAGE}.sh"
 . "${_EXEC}/templates/frame.html.sh"