7 <meta name="viewport" content="width=device-width"/>
8 <link rel="stylesheet" type="text/css" href="%s/[.]/cgilite/common.css">
9 <link rel="stylesheet" type="text/css" href="%s/[.]/themes/default.css">
14 printf '<header>%s</header>' "$(wiki '[wiki]/header/')"
18 printf '<footer>%s</footer>' "$(wiki '[wiki]/footer/')"
24 if acl_write "$page"; then
27 <li><a href="[edit]">Edit</a></li>
28 <li><a href="[attachment]/">Attachments</a></li>
35 title="${page%/}"; title="${title##*/}"
37 # Important! Web Server response including newline
38 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
44 <title>$(HTML "${title}")</title>
45 </head><body id="$(HTML "$page")">
50 $(wiki "$page" || printf 'Error while loading page <br> function "wiki" of index.sh returned with an error.')
59 local page="$1" template="$2" title
60 title="${page%/}"; title="${title##*/}"
62 [ "$template" ] && acl_read "$template" || template="$page"
64 # Important! Web Server response including newline
65 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
71 <title>$(HTML "${title}")</title>
72 </head><body id="$(HTML "$page")" class="editor">
74 <main><form method=POST action="$(HTML "${page%/}/[edit]")">
75 <input type=hidden name=session_key value="${SESSION_KEY}"/>
76 <textarea name=pagetext>$({ wiki_text "$page" \
77 || wiki_text "$template"; } |HTML)</textarea>
78 <button type=submit name=action value=update>Update</button>
79 <button type=submit name=action value=cancel>Cancel</button>
88 title="${page%/}"; title="${title##*/}"
90 # Important! Web Server response including newline
91 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
97 <title>Revisions $(HTML "${title}")</title>
98 </head><body id="$(HTML "$page")[attachment]/">
101 $("$_EXEC/macros/revisions" "$page")
109 local page="$1" title
110 title="${page%/}"; title="${title##*/}"
112 # Important! Web Server response including newline
113 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
115 if acl_write "$page"; then
120 <title>Attachments $(HTML "${title}")</title>
121 </head><body id="$(HTML "$page")[attachment]/">
124 <form class=upload method=POST enctype="multipart/form-data">
125 <input type=hidden name=session_id value="$SESSION_ID">
126 <input type=file name=file multiple>
127 <button type=submit name=action value=upload>Upload</button>
130 <form method=POST><ul class="attachment list">
131 <input type=hidden name=session_key value="$SESSION_KEY">
132 $(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do
133 [ "$file" = "$_EXEC/pages/$page/#attachments/${file##*/}" \
134 -a -f "$_DATA/pages/$page/#attachments/${file##*/}" ] && continue
135 stat="$(stat -c '%s %Y' -- "$file" 2>&-)" || continue
136 size="${stat% *}" date="${stat#* }"
138 printf '<li><button type=submit name=delete value="%s">Delete</button><a class=name href="%s">%s</a>
139 <span class=size>%s</span><span class=date>%s</span></li>' \
140 "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" \
141 "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
153 <title>Attachments $(HTML "${title}")</title>
154 </head><body id="$(HTML "$page")[attachment]/">
157 <ul class="attachment list">
158 $(for file in "$_EXEC/pages/$page/#attachments"/* "$_DATA/pages/$page/#attachments"/*; do
159 [ "$file" = "$_EXEC/pages/$page/#attachments/${file##*/}" \
160 -a -f "$_DATA/pages/$page/#attachments/${file##*/}" ] && continue
161 stat="$(stat -c '%s %Y' -- "$file" 2>&-)" || continue
162 size="${stat% *}" date="${stat#* }"
164 printf '<li><a class=name href="%s">%s</a>
165 <span class=size>%s</span><span class=date>%s</span></li>' \
166 "$(HTML "${file##*/}")" "$(HTML "${file##*/}")" "$(size_human "$size")" "$(date -d @"$date" +"%F %T")"
180 400) printf "%s\r\n" "Status: 400 Bad Request";;
181 403) printf "%s\r\n" "Status: 403 Forbidden";;
182 404) printf "%s\r\n" "Status: 404 Not Found";;
183 409) printf "%s\r\n" "Status: 409 Conflict";;
184 500) printf "%s\r\n" "Status: 500 Internal Server Error";;
187 if [ "$(mdfile "/[wiki]/$errno/")" ]; then
188 theme_page "/[wiki]/$errno/"
190 printf "Content-Length: 0\r\n\r\n"