]> git.plutz.net Git - shellwiki/blobdiff - handlers/60_edit.sh
Merge commit '6bc502434737d7f08379e79b94fc6fda424ef779'
[shellwiki] / handlers / 60_edit.sh
index 9d1a404a85485db348e1ee405054527655de5c95..b55a3440bf91ba77e27ccca3aab0e7b9e28b2642 100755 (executable)
@@ -1,20 +1,20 @@
 #!/bin/sh
 
-. "${_EXEC}/session_lock.sh"
-
-wiki_text() {
-  # Print source text of a wiki page
-  # Get page from data or underlay dir
-  local page="$(PATH "$1")"
+# Copyright 2022 - 2023 Paul Hänsch
+# 
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+# 
+# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-  if [ -f "$_DATA/pages/$page/#page.md" ]; then
-    cat -- "$_DATA/pages/$page/#page.md"
-  elif [ -f "$_EXEC/pages/$page/#page.md" ]; then
-    cat -- "$_EXEC/pages/$page/#page.md"
-  else
-    return 1
-  fi
-}
+. "${_EXEC}/session_lock.sh"
 
 case $PATH_INFO in
   */\[edit\]) : ;;
@@ -39,7 +39,7 @@ elif [ "$edit_action" = update ]; then
     POST pagetext >"$edit_file"
     S_RELEASE "$edit_file"
   else
-    export ERRMSG="ERR_NOLOCK"
+    export ERROR_MSG="Unable to lock page for editing"
     REDIRECT "${_BASE}${PATH_INFO%\[edit\]}/[edit]"
   fi