+ EOF
+ return 0
+ ;;
+ esac
+fi
+
+if [ "$action" = rename -a "$newname" ]; then
+ oldname="${PATH_INFO%\[*\]}"
+ newname="${oldname%/*/}$(PATH "${newname}/")"
+
+ if [ -d "$_DATA/pages/$newname" ]; then
+ printf 'Refresh: %i\r\n' 4
+ export ERRORMSG="A location of that name already exists."
+ theme_error 400
+ return 0
+ elif ! acl_write "$oldname" || ! acl_write "$newname"; then
+ printf 'Refresh: %i\r\n' 4
+ theme_error 403
+ return 0
+ else
+ 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}"
+ fi
+elif [ "$action" = move -a "$newlocation" ]; then
+ oldname="${PATH_INFO%\[*\]}"
+ newlocation="$(PATH "$newlocation")"
+ newname="${oldname%/}"
+ newname="${newlocation%/}/${newname##*/}/"
+
+ if [ -d "$_DATA/pages/$newname" ]; then
+ printf 'Refresh: %i\r\n' 4
+ export ERRORMSG="A page of that name already exists at the given location."
+ theme_error 400
+ return 0
+ elif [ ! -d "$_DATA/pages/$newlocation" ]; then
+ printf 'Refresh: %i\r\n' 4
+ export ERRORMSG="The given location does not exist."
+ theme_error 400
+ return 0
+ elif ! acl_write "$oldname" || ! acl_write "$newname"; then
+ printf 'Refresh: %i\r\n' 4
+ theme_error 403
+ return 0
+ else
+ 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}"
+ fi
+elif [ "$action" = delete ]; then
+ oldname="${PATH_INFO%\[*\]}"
+ if ! acl_write "$oldname"; then
+ printf 'Refresh: %i\r\n' 4
+ theme_error 403
+ return 0
+ else
+ 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 ./
+ fi
+fi
diff --git a/themes/default.css b/themes/default.css
index 11c3dae..91458c3 100644
--- a/themes/default.css
+++ b/themes/default.css
@@ -52,6 +52,8 @@ main .pagemenu li {
main .pagemenu li a { color: #FFF; }
main article,
+main > form#renamepage, main > form#movepage,
+main > form#deletepage,
[id$="/[attachment]"] main form.upload {
margin: 1em;
padding: .125em 1em 1em 1em;
diff --git a/themes/default.sh b/themes/default.sh
index 89d4fad..0b85007 100755
--- a/themes/default.sh
+++ b/themes/default.sh
@@ -28,6 +28,9 @@ theme_pagemenu(){