4 */\[move\]|*/\[rename\]|*/\[delete\])
5 page="${PATH_INFO%\[*\]}"
6 if [ ! -d "$_DATA/pages/${page}" -a ! -d "$_EXEC/pages/${page}" ]; then
9 elif ! acl_write "$page"; then
10 printf 'Refresh: %i, url=%s\r\n' 4 ./
13 elif [ -d "$_EXEC/pages/${page}/" ]; then
17 <h1>Immutable Page</h1>
18 This is a core page of the wiki system. Its name and position cannot be changed.
19 You may however update this page and you can use ACLs to hide it from various listings.
29 if [ "$REQUEST_METHOD" = POST ]; then
30 action="$(POST action)"
31 newname="$(POST newname |grep -m1 -xE '[^#/]*')"
32 newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')"
33 else case "${PATH_INFO}" in
35 location="${page%/}" location="${location%/*}/"
37 <form method=POST id=movepage>
38 <input type=hidden name=session_id value="$SESSION_KEY">
40 <p class="pageid">$(HTML "${page}")</p>
41 <input name="newlocation" value="$(HTML "$location")" placeholder="New Location">
43 <li>A page with the same name must not already exist at the new location.</li>
44 <li>You must have permission to create new pages at this location.</li>
45 <li>All subpages will become available under the new path name.</li>
46 <li>Subpages will become unavailable under their current name.</li>
48 <button type=submit name=action value=move>Move</button>
49 <button type=submit name=action value=cancel>Cancel</button>
55 name="${page%/}" name="${name##*/}"
57 <form method=POST id=renamepage>
58 <input type=hidden name=session_id value="$SESSION_KEY">
60 <p class="pageid">$(HTML "${page}")</p>
61 <input name="newname" value="$(HTML "$name")" placeholder="New Name">
63 <li>A page with the new name must not already exist.</li>
64 <li>You must have permission to create new pages at this location.</li>
65 <li>All subpages will become available under the new path name.</li>
66 <li>Subpages will become unavailable under their current name.</li>
68 <button type=submit name=action value=rename>Rename</button>
69 <button type=submit name=action value=cancel>Cancel</button>
76 <form method=POST id=deletepage>
77 <input type=hidden name=session_id value="$SESSION_KEY">
79 <p class="pageid">$(HTML "${page}")</p>
80 <p>This page and its attachments will be deleted</p>
82 <li>Past revisions of the page text (including the current one) will remain accessible and can be restored.</li>
83 <li>Attachments will be deleted completely, and cannot be restored.</li>
84 <li>Subpages will not be affected and can still be accessed normally.</li>
86 <button type=submit name=action value=delete>Delete</button>
87 <button type=submit name=action value=cancel>Cancel</button>
95 if [ "$action" = rename -a "$newname" ]; then
96 oldname="${PATH_INFO%\[*\]}"
97 newname="${oldname%/*/}$(PATH "${newname}/")"
99 if [ -d "$_DATA/pages/$newname" ]; then
100 printf 'Refresh: %i\r\n' 4
101 export ERRORMSG="A location of that name already exists."
104 elif ! acl_write "$oldname" || ! acl_write "$newname"; then
105 printf 'Refresh: %i\r\n' 4
108 elif [ "$REV_PAGES" = true ]; then
109 git -C "$_DATA" mv "pages/$oldname" "pages/$newname"
110 git -C "$_DATA" commit -m 'Page # '"$oldname"' # renamed to # '"$newname"' # by user @ '"$USER_NAME"' @' \
111 -- "pages/$oldname" "pages/$newname"
112 REDIRECT "$_BASE${newname}"
114 mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
115 REDIRECT "$_BASE${newname}"
117 elif [ "$action" = move -a "$newlocation" ]; then
118 oldname="${PATH_INFO%\[*\]}"
119 newlocation="$(PATH "$newlocation")"
120 newname="${oldname%/}"
121 newname="${newlocation%/}/${newname##*/}/"
123 if [ -d "$_DATA/pages/$newname" ]; then
124 printf 'Refresh: %i\r\n' 4
125 export ERRORMSG="A page of that name already exists at the given location."
128 elif [ ! -d "$_DATA/pages/$newlocation" ]; then
129 printf 'Refresh: %i\r\n' 4
130 export ERRORMSG="The given location does not exist."
133 elif ! acl_write "$oldname" || ! acl_write "$newname"; then
134 printf 'Refresh: %i\r\n' 4
137 elif [ "$REV_PAGES" = true ]; then
138 git -C "$_DATA" mv "pages/${oldname}" "pages/${newname}"
139 git -C "$_DATA" commit -m 'Page # '"$oldname"' # moved to # '"$newname"' # by user @ '"$USER_NAME"' @' \
140 -- "pages/${oldname}" "pages/${newname}"
141 REDIRECT "$_BASE${newname}"
143 mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
144 REDIRECT "$_BASE${newname}"
146 elif [ "$action" = delete ]; then
147 oldname="${PATH_INFO%\[*\]}"
148 if ! acl_write "$oldname"; then
149 printf 'Refresh: %i\r\n' 4
152 elif [ "$REV_PAGES" = true ]; then
153 git -C "$_DATA" rm "pages/${oldname}/#page.md"
154 git -C "$_DATA" commit -m 'Page # '"$oldname"' # deleted by user @ '"$USER_NAME"' @' \
155 -- "pages/${oldname}/#page.md"
156 rm -r -- "$_DATA/pages/${oldname}"/\#*
157 rmdir -- "$_DATA/pages/${oldname}/" || true
160 rm -- "$_DATA/pages/${oldname}/#page.md"
161 rm -r -- "$_DATA/pages/${oldname}"/\#*
162 rmdir -- "$_DATA/pages/${oldname}/" || true
165 elif [ "$action" = cancel ]; then
167 elif [ "$action" ]; then
168 printf 'Refresh: %i\r\n' 4
169 export ERRORMSG="Missing parameters."