X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=3c5f2a1819a000277c06dc31451a2013f1335812;hb=d7ed83d3debc31d5f7910304fa31c23c699ac69a;hp=7edd4b9986c60ad8e989f07a2740c7dc327d7c48;hpb=048d632f308bf93536f35fcebbe56d82671e0a14;p=shellwiki diff --git a/themes/default.sh b/themes/default.sh index 7edd4b9..3c5f2a1 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -23,10 +23,10 @@ theme_page(){ title="${page%/}"; title="${title##*/}" if [ ! "$(mdfile "$page")" ]; then - theme_404 + theme_error 404 return 0 elif ! acl_read "$page"; then - theme_403 + theme_error 403 return 0 fi @@ -57,17 +57,16 @@ theme_page(){ } theme_editor(){ - local page="$1" title + local page="$1" template="$2" title title="${page%/}"; title="${title##*/}" - if [ ! "$(mdfile "$page")" ]; then - theme_404 - return 0 - elif ! acl_write "$page"; then - theme_403 + if ! acl_write "$page"; then + theme_error 403 return 0 fi + [ "$template" ] && acl_read "$template" || template="$page" + # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" @@ -78,9 +77,10 @@ theme_editor(){