X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=7edd4b9986c60ad8e989f07a2740c7dc327d7c48;hb=7b1d88cf33d962e2ac98e03d0fd21327aee583a6;hp=022a29ab4985bbad8dd05a8624fdbae6dc6084d9;hpb=f90caa452953aa14b05305dadcf254d289d73386;p=shellwiki
diff --git a/themes/default.sh b/themes/default.sh
index 022a29a..7edd4b9 100755
--- a/themes/default.sh
+++ b/themes/default.sh
@@ -93,10 +93,19 @@ theme_attachments(){
local page="$1" title
title="${page%/}"; title="${title##*/}"
+ if [ ! "$(mdfile "$page")" ]; then
+ theme_404
+ return 0
+ elif ! acl_read "$page"; then
+ theme_403
+ return 0
+ fi
+
# Important! Web Server response including newline
printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
- cat <<-EOF
+ if acl_write "$page"; then
+ cat <<-EOF
$(theme_head)
@@ -109,6 +118,32 @@ theme_attachments(){
+
+
+ $(theme_footer)
+
+ EOF
+ else
+ cat <<-EOF
+
+
+ $(theme_head)
+ Attachments $(HTML "${title}")
+
+ $(theme_header)
+
$(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do
[ "$file" = "$_EXEC/pages/$page/#attachments/${file##*/}" \
@@ -116,15 +151,16 @@ theme_attachments(){
stat="$(stat -c '%s %Y' -- "$file" 2>&-)" || continue
size="${stat% *}" date="${stat#* }"
- printf '- %s
+ printf '
- %s
%s%s
' \
- "$(HTML "${file##*/}")" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
+ "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
done)
$(theme_footer)
EOF
+ fi
}
theme_login(){