}
theme_page(){
- local page="$1" title="$2" id="$3"
+ local page="$1" title="$2"
title="$(HTML "${title:-"${page}"}")"
- id="$(HTML "${id:-"${page}"}")"
# Important! Web Server response including newline
printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
<html><head>
$(theme_head)
<title>${title}</title>
- </head><body id="$id">
+ </head><body id="$(HTML "${PATH_INFO}")">
$(theme_header)
<main>
$(theme_pagemenu)
[ "$template" ] && acl_read "$template" || template="$page"
- theme_page - "Editor: $title" "${page}[edit]" <<-EOF
+ theme_page - "Editor: $title" <<-EOF
<form method=POST action="$(HTML "${page%/}/[edit]")">
<input type=hidden name=session_key value="${SESSION_KEY}"/>
<textarea name=pagetext>$({ wiki_text "$page" \
title="${page%/}"; title="${title##*/}"
"$_EXEC/macros/revisions" "$page" \
- | theme_page - "Revisions: $title" "${page}[revision]"
+ | theme_page - "Revisions: $title"
}
theme_attachments(){
title="${page%/}"; title="${title##*/}"
if acl_write "$page"; then
- theme_page - "Attachments: $title" "${page}[attachment]" <<-EOF
+ theme_page - "Attachments: $title" <<-EOF
<form class=upload method=POST enctype="multipart/form-data">
<input type=hidden name=session_id value="$SESSION_ID">
<input type=file name=file multiple>
-a -f "$_DATA/pages/$page/#attachments/${file##*/}" ] && continue
stat="$(stat -c '%s %Y' -- "$file" 2>&-)" || continue
size="${stat% *}" date="${stat#* }"
+ hfile="$(HTML "${file##*/}")"
- printf '<li><button type=submit name=delete value="%s">Delete</button><a class=name href="%s">%s</a>
+ printf '<li><button type=submit name=delete value="%s">Delete</button><a class=name href="[attachment]/%s">%s</a>
<span class=size>%s</span><span class=date>%s</span></li>' \
- "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" \
- "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
+ "$hfile" "$hfile" "$hfile" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
done)
</ul></form>
EOF
else
- theme_page - "Attachments: $title" "${page}[attachment]" <<-EOF
+ theme_page - "Attachments: $title" <<-EOF
<ul class="attachment list">
$(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do
[ "$file" = "$_EXEC/pages/$page/#attachments/${file##*/}" \
-a -f "$_DATA/pages/$page/#attachments/${file##*/}" ] && continue
stat="$(stat -c '%s %Y' -- "$file" 2>&-)" || continue
size="${stat% *}" date="${stat#* }"
+ hfile="$(HTML "${file##*/}")"
printf '<li><a class=name href="%s">%s</a>
<span class=size>%s</span><span class=date>%s</span></li>' \
- "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
+ "$hfile" "$hfile" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
done)
</ul>
EOF