]> git.plutz.net Git - busy/blobdiff - actions/introedit.sh
porting busy to confetti framework
[busy] / actions / introedit.sh
similarity index 56%
rename from write/introedit.cgi
rename to actions/introedit.sh
index 7d0887e4beafaea8ea4f9a962817bdc9f8e2bf1d..d55b1b2396ee2a97e29519c562a25b4581a2884c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/zsh
-# Copyright 2011 Paul Haensch
+# Copyright 2011 - 2014 Paul Haensch
 # This file is part of Busy
 #
 # Busy is free software: you can redistribute it and/or modify
 # You should have received a copy of the GNU Affero General Public License
 # along with Busy.  If not, see <http://www.gnu.org/licenses/>.
 
-[ "$HTTPS" = "on" ] && proto=https || proto=http
-. ../auth/permissions.sh
 
-info="$(egrep -o '(^|&)i=([0-9]{10}_[0-9]{3}|intro|news)(&|$)' <<<"${QUERY_STRING}" |sed 's:&::g;s:i=::')"
+info="$(echo -E "$_GET[\"i\"]" |grep -Ex 'intro|news')"
 
 if [ "$info" = "news" ]; then
   $ACL_ADDNEWS || info=''
@@ -27,24 +25,15 @@ elif [ "$info" = "intro" ]; then
 elif [ -z "$info" ]; then
   $ACL_EDITNEWS || info=''
 fi
-[ -n "$info" ] || echo -n "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+[ -n "$info" ] || echo -n "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n"
 [ -n "$info" ] || exit 0
 
 [ "$info" = "news" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
 [ "$info" != "intro" ] && info="${info}.news"
 [ "$info" = "intro" ] && ($ACL_EDITINTRO || info='')
 
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
-  if (echo "${line}" | egrep -xq 'text=.+'); then
-    text="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
-    text=$(echo -e "${text}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
-  elif (echo "${line}" | egrep -xq 'cancel=.+'); then
-    cancel=true
-  fi
-done
-fi
+cgi_post
 
-[ -z "$cancel" ] && echo -e "${text}" >"../Home/$info"
+[ -z "$_POST[\"cancel\"]" ] && echo -E "$_POST[\"text\"]" >"$_DATA/Home/$info"
 
-echo -n "Location: ${proto}://${HTTP_HOST}/?p=Home\n\n"
+echo -n "Location: ${HTTP_REFERER}\n\n"