- mkdir -p "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/"
- n=1; while filename=$(multipart_filename "file" "$n"); do
- filename="$(printf %s "$filename" |tr /\\0 __)"
- multipart "file" "$n" >"$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$filename"
- n=$((n + 1))
- done
- rm -- "$multipart_cachefile"
- REDIRECT "${_BASE}${PATH_INFO}"
- elif [ "${CONTENT_TYPE%%;*}" = "multipart/form-data" ]; then
- printf 'Refresh: %i\r\n' 4
- theme_error 403
- head -c $((CONTENT_LENGTH)) >/dev/null
- return 0
- elif [ "$attachment_delete" -a "$SESSION_ID" = "$tsid" ]; then
- rm -- "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$attachment_delete"
- REDIRECT "${_BASE}${PATH_INFO}"
- elif [ "$attachment_delete" ]; then
- printf 'Refresh: %i\r\n' 4
- theme_error 403
- return 0
- elif acl_read "${PATH_INFO%\[attachment\]/}"; then
- theme_attachments "${PATH_INFO%\[attachment\]/}"
- return 0
- else
- theme_error 404
- return 0
- fi
-
-elif [ "${PATH_INFO%/\[attachment\]/*}" != "${PATH_INFO}" ]; then
- attpath="${PATH_INFO%/\[attachment\]/*}/#attachments/${PATH_INFO##*/}"