printf 'Refresh: %i\r\n' 4
theme_error 403
return 0
- else
+ elif [ "$REV_PAGES" = true ]; then
git -C "$_DATA" mv "pages/$oldname" "pages/$newname"
git -C "$_DATA" commit -m 'Page # '"$oldname"' # renamed to # '"$newname"' # by user @ '"$USER_NAME"' @' \
-- "pages/$oldname" "pages/$newname"
REDIRECT "$_BASE${newname}"
+ else
+ mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
+ REDIRECT "$_BASE${newname}"
fi
elif [ "$action" = move -a "$newlocation" ]; then
oldname="${PATH_INFO%\[*\]}"
printf 'Refresh: %i\r\n' 4
theme_error 403
return 0
- else
+ elif [ "$REV_PAGES" = true ]; then
git -C "$_DATA" mv "pages/${oldname}" "pages/${newname}"
git -C "$_DATA" commit -m 'Page # '"$oldname"' # moved to # '"$newname"' # by user @ '"$USER_NAME"' @' \
-- "pages/${oldname}" "pages/${newname}"
REDIRECT "$_BASE${newname}"
+ else
+ mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
+ REDIRECT "$_BASE${newname}"
fi
elif [ "$action" = delete ]; then
oldname="${PATH_INFO%\[*\]}"
printf 'Refresh: %i\r\n' 4
theme_error 403
return 0
- else
+ elif [ "$REV_PAGES" = true ]; then
git -C "$_DATA" rm "pages/${oldname}/#page.md"
git -C "$_DATA" commit -m 'Page # '"$oldname"' # deleted by user @ '"$USER_NAME"' @' \
-- "pages/${oldname}/#page.md"
rm -r -- "$_DATA/pages/${oldname}"/\#*
rmdir -- "$_DATA/pages/${oldname}/" || true
REDIRECT ./
+ else
+ rm -- "$_DATA/pages/${oldname}/#page.md"
+ rm -r -- "$_DATA/pages/${oldname}"/\#*
+ rmdir -- "$_DATA/pages/${oldname}/" || true
+ REDIRECT ./
fi
elif [ "$action" = cancel ]; then
REDIRECT ./
. "${_EXEC}/tools.sh"
. "${_EXEC}/acl.sh"
+REV_PAGES=${REV_PAGES:-true}
REV_ATTACHMENTS=${REV_ATTACHMENTS:-false}
WIKI_THEME="${WIKI_THEME:-default}"
+
+which git >/dev/null || REV_PAGES=false
+[ "$REV_PAGES" != true ] && REV_ATTACHMENTS=false
+
. "${_EXEC}/themes/${WIKI_THEME}.sh"
# Renew session cookie, only if cookie already set
cat -- "$mdfile"
}
-if [ "$(which git)" -a ! -f "$_DATA/.gitignore" ]; then
+if [ "$REV_PAGES" = true -a ! -f "$_DATA/.gitignore" ]; then
cat >"$_DATA/.gitignore" <<-EOF
users.db
serverkey
- $([ "$REV_ATTACHMENTS" = true ] || printf %s "**/#attachments/")
**/#cache/
**/#page.lock
**/#page.*.cache
**/#page:*.*.cache
**/#page:*.*.cache.*
EOF
+ [ "$REV_ATTACHMENTS" != true ] \
+ && printf '**/#attachments/\n' >>"$_DATA/.gitignore"
git init "$_DATA"
git -C "$_DATA" add .gitignore
git -C "$_DATA" commit -m 'initialization' -- .gitignore
for handler in "$_EXEC"/handlers/*; do
. "$handler" && break
done
-
if [ $? != 0 ]; then
export ERROR_MSG="The presented URL schema cannot be handled"
theme_error 400