3 l10n_immutablepage >/dev/null 2>&1 \
4 || l10n_immutablepage(){ #TRANSLATION
6 <h1>Immutable Page</h1>
7 This is a core page of the wiki system. Its name and position cannot be changed.
8 You may however update this page and you can use ACLs to hide it from various listings.
12 case "${PATH_INFO}" in
13 */\[move\]|*/\[rename\]|*/\[delete\])
14 page="${PATH_INFO%\[*\]}"
15 if [ ! -d "$_DATA/pages/${page}" -a ! -d "$_EXEC/pages/${page}" ]; then
18 elif ! acl_write "$page"; then
19 printf 'Refresh: %i, url=%s\r\n' 4 ./
22 elif [ -d "$_EXEC/pages/${page}/" ]; then
36 l10n_movepage >/dev/null 2>&1 \
37 || l10n_movepage(){ # TRANSLATION
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>
52 l10n_renamepage >/dev/null 2>&1 \
53 || l10n_renamepage(){ # TRANSLATION
56 <p class="pageid">$(HTML "${page}")</p>
57 <input name="newname" value="$(HTML "$name")" placeholder="New Name">
59 <li>A page with the new name must not already exist.</li>
60 <li>You must have permission to create new pages at this location.</li>
61 <li>All subpages will become available under the new path name.</li>
62 <li>Subpages will become unavailable under their current name.</li>
64 <button type=submit name=action value=rename>Rename</button>
65 <button type=submit name=action value=cancel>Cancel</button>
68 l10n_deletepage >/dev/null 2>&1 \
69 || l10n_deletepage(){ # TRANSLATION
72 <p class="pageid">$(HTML "${page}")</p>
73 <p>This page and its attachments will be deleted</p>
75 <li>Past revisions of the page text (including the current one) will remain accessible and can be restored.</li>
76 <li>Attachments will be deleted completely, and cannot be restored.</li>
77 <li>Subpages will not be affected and can still be accessed normally.</li>
79 <button type=submit name=action value=delete>Delete</button>
80 <button type=submit name=action value=cancel>Cancel</button>
84 if [ "$REQUEST_METHOD" = POST ]; then
85 action="$(POST action)"
86 newname="$(POST newname |grep -m1 -xE '[^#/]*')"
87 newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')"
88 else case "${PATH_INFO}" in
90 location="${page%/}" location="${location%/*}/"
92 <form method=POST id=movepage>
93 <input type=hidden name=session_id value="$SESSION_KEY">
100 name="${page%/}" name="${name##*/}"
102 <form method=POST id=renamepage>
103 <input type=hidden name=session_id value="$SESSION_KEY">
111 <form method=POST id=deletepage>
112 <input type=hidden name=session_id value="$SESSION_KEY">
121 if [ "$action" = rename -a "$newname" ]; then
122 oldname="${PATH_INFO%\[*\]}"
123 newname="${oldname%/*/}$(PATH "${newname}/")"
125 if [ -d "$_DATA/pages/$newname" ]; then
126 printf 'Refresh: %i\r\n' 4
127 export ERRORMSG="A location of that name already exists."
130 elif ! acl_write "$oldname" || ! acl_write "$newname"; then
131 printf 'Refresh: %i\r\n' 4
134 elif [ "$REV_PAGES" = true ]; then
135 git -C "$_DATA" mv "pages/$oldname" "pages/$newname"
136 git -C "$_DATA" commit -m 'Page # '"$oldname"' # renamed to # '"$newname"' # by user @ '"$USER_NAME"' @' \
137 -- "pages/$oldname" "pages/$newname"
138 REDIRECT "$_BASE${newname}"
140 mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
141 REDIRECT "$_BASE${newname}"
143 elif [ "$action" = move -a "$newlocation" ]; then
144 oldname="${PATH_INFO%\[*\]}"
145 newlocation="$(PATH "$newlocation")"
146 newname="${oldname%/}"
147 newname="${newlocation%/}/${newname##*/}/"
149 if [ -d "$_DATA/pages/$newname" ]; then
150 printf 'Refresh: %i\r\n' 4
151 export ERRORMSG="A page of that name already exists at the given location."
154 elif [ ! -d "$_DATA/pages/$newlocation" ]; then
155 printf 'Refresh: %i\r\n' 4
156 export ERRORMSG="The given location does not exist."
159 elif ! acl_write "$oldname" || ! acl_write "$newname"; then
160 printf 'Refresh: %i\r\n' 4
163 elif [ "$REV_PAGES" = true ]; then
164 git -C "$_DATA" mv "pages/${oldname}" "pages/${newname}"
165 git -C "$_DATA" commit -m 'Page # '"$oldname"' # moved to # '"$newname"' # by user @ '"$USER_NAME"' @' \
166 -- "pages/${oldname}" "pages/${newname}"
167 REDIRECT "$_BASE${newname}"
169 mv -- "$_DATA/pages/$oldname" "$_DATA/pages/$newname"
170 REDIRECT "$_BASE${newname}"
172 elif [ "$action" = delete ]; then
173 oldname="${PATH_INFO%\[*\]}"
174 if ! acl_write "$oldname"; then
175 printf 'Refresh: %i\r\n' 4
178 elif [ "$REV_PAGES" = true ]; then
179 git -C "$_DATA" rm "pages/${oldname}/#page.md"
180 git -C "$_DATA" commit -m 'Page # '"$oldname"' # deleted by user @ '"$USER_NAME"' @' \
181 -- "pages/${oldname}/#page.md"
182 rm -r -- "$_DATA/pages/${oldname}"/\#*
183 rmdir -- "$_DATA/pages/${oldname}/" || true
186 rm -- "$_DATA/pages/${oldname}/#page.md"
187 rm -r -- "$_DATA/pages/${oldname}"/\#*
188 rmdir -- "$_DATA/pages/${oldname}/" || true
191 elif [ "$action" = cancel ]; then
193 elif [ "$action" ]; then
194 printf 'Refresh: %i\r\n' 4
195 export ERRORMSG="Missing parameters."