X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=write%2Ftaskmeta.cgi;h=7b09551d000e0f571f04e872b411782b29f370b3;hp=0d8879c6ecb51910e143f2d9d5018e315bc9ba75;hb=405324e13eb8124602f8e3651b0903afad2365fe;hpb=5ff77d0007cf59429f6d71ae361863f0d2432721 diff --git a/write/taskmeta.cgi b/write/taskmeta.cgi index 0d8879c..7b09551 100755 --- a/write/taskmeta.cgi +++ b/write/taskmeta.cgi @@ -16,6 +16,12 @@ # along with Busy. If not, see . #info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')" +[ "$HTTPS" = "on" ] && PROTO=https || proto=http + +. ../auth/permissions.sh +$ACL_CREATETASK || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n" +$ACL_CREATETASK || exit 0 + info="$(sed -r 's:(^|.*&)i=(.*)|.*:\2:;s:&.*::' <<<"${QUERY_STRING}")" [ -z "$info" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)" @@ -44,6 +50,8 @@ if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then comment="$(echo -e "${comment}" |sed 's/\r//g;s/\\/\\\\/g')" elif (egrep -xq 'cancel=.+' <<<"${line}"); then cancel="true" + elif (egrep -xq 'submit=Robots click here' <<<"${line}"); then + cancel="true" fi done fi @@ -52,14 +60,14 @@ if [ -z "$cancel" -a -n "$comment" ]; then touch "../Tasks/$info" echo -e "author=${REMOTE_USER}" > "$commfile" echo -e "${comment}" >> "$commfile" - echo -n "Location: http://${HTTP_HOST}/?p=Tasks&i=$info\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks&i=$info\n\n" elif [ -z "$cancel" -a -n "$description" ]; then touch "../Tasks/$info" echo -e "headline=${headline}" > "$descfile" echo -e "status=${taskstatus}" >> "$descfile" echo -e "section=${section}" >> "$descfile" echo -e "${description}" >> "../Tasks/$info" - echo -n "Location: http://${HTTP_HOST}/?p=Tasks#$anchor\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks#$anchor\n\n" elif [ -n "$cancel" ]; then - echo -n "Location: http://${HTTP_HOST}/?p=Tasks#$anchor\n\n" + echo -n "Location: ${proto}://${HTTP_HOST}/?p=Tasks#$anchor\n\n" fi