X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=actions%2Fintroedit.sh;fp=write%2Fintroedit.cgi;h=d55b1b2396ee2a97e29519c562a25b4581a2884c;hp=7d0887e4beafaea8ea4f9a962817bdc9f8e2bf1d;hb=f485895094cd72318b46f39689c3ba954eb37411;hpb=904730d1782749bfac15b0344fe5782433f3099b diff --git a/write/introedit.cgi b/actions/introedit.sh similarity index 56% rename from write/introedit.cgi rename to actions/introedit.sh index 7d0887e..d55b1b2 100755 --- a/write/introedit.cgi +++ b/actions/introedit.sh @@ -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 @@ -15,10 +15,8 @@ # You should have received a copy of the GNU Affero General Public License # along with Busy. If not, see . -[ "$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"