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