X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=write%2Fwikimeta.cgi;h=e032d910d28eeff2edfffbab042c0de92a008e49;hb=df48ee8dcf49374dca18f0807a636358cef9877a;hp=71ece533f51007cd63ae1347e063c5a30eb57234;hpb=62c3d9c54dec22772956bea9f2ec482c891e511e;p=busy diff --git a/write/wikimeta.cgi b/write/wikimeta.cgi index 71ece53..e032d91 100755 --- a/write/wikimeta.cgi +++ b/write/wikimeta.cgi @@ -15,6 +15,12 @@ # 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/acl.sh +env >../debug +$ACL_WIKIEDIT || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n" +$ACL_WIKIEDIT || exit 0 + info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')" [ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)" @@ -45,12 +51,12 @@ if [ -z "$cancel" -a -n "$comment" ]; then touch "../Wiki/$info" echo -e "author=${REMOTE_USER}" > "$commfile" echo -e "${comment}" >> "$commfile" - echo -n "Location: http://${HTTP_HOST}/?p=Wiki&i=$info\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki&i=$info\n\n" elif [ -z "$cancel" -a -n "$description" ]; then touch "../Wiki/$info" echo -e "title=${title}" > "$descfile" echo -e "description=${description}" >> "$descfile" - echo -n "Location: http://${HTTP_HOST}/?p=Wiki#$anchor\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n" elif [ -n "$cancel" ]; then - echo -n "Location: http://${HTTP_HOST}/?p=Wiki#$anchor\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n" fi