From: Paul Hänsch Date: Sun, 22 May 2022 11:15:57 +0000 (+0200) Subject: removed various acl checks (previously moved to handlers), introduce revision theme X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=210e62ec5d92672b5471c10a47a886d5cd6d1238;p=shellwiki removed various acl checks (previously moved to handlers), introduce revision theme --- diff --git a/themes/default.sh b/themes/default.sh index 3c5f2a1..e9e9d73 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -15,21 +15,25 @@ theme_header(){ } theme_footer(){ - printf '' "$(wiki '[wiki]/footer/' ||echo No footer)" + printf '' "$(wiki '[wiki]/footer/')" +} + +theme_pagemenu(){ + local page="$1" + + if acl_write "$page"; then + printf ' + ' + fi } theme_page(){ local page="$1" title title="${page%/}"; title="${title##*/}" - if [ ! "$(mdfile "$page")" ]; then - theme_error 404 - return 0 - elif ! acl_read "$page"; then - theme_error 403 - return 0 - fi - # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" @@ -41,12 +45,7 @@ theme_page(){ $(theme_header)
- $(acl_write "$page" && printf %s \ - '' - ) + $(theme_pagemenu)
$(wiki "$page" || printf 'Error while loading page
function "wiki" of index.sh returned with an error.')
@@ -60,11 +59,6 @@ theme_editor(){ local page="$1" template="$2" title title="${page%/}"; title="${title##*/}" - if ! acl_write "$page"; then - theme_error 403 - return 0 - fi - [ "$template" ] && acl_read "$template" || template="$page" # Important! Web Server response including newline @@ -89,17 +83,31 @@ theme_editor(){ EOF } -theme_attachments(){ +theme_revisions(){ local page="$1" title title="${page%/}"; title="${title##*/}" - if [ ! "$(mdfile "$page")" ]; then - theme_error 404 - return 0 - elif ! acl_read "$page"; then - theme_error 403 - return 0 - fi + # Important! Web Server response including newline + printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" + + cat <<-EOF + + + $(theme_head) + Revisions $(HTML "${title}") + + $(theme_header) +
+ $("$_EXEC/macros/revisions" "$page") +
+ $(theme_footer) + + EOF +} + +theme_attachments(){ + local page="$1" title + title="${page%/}"; title="${title##*/}" # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""