]> git.plutz.net Git - busy/blobdiff - write/taskmeta.cgi
modified to use acl engine
[busy] / write / taskmeta.cgi
index 0d8879c6ecb51910e143f2d9d5018e315bc9ba75..a5e2ffc99cdfdc053990439598c1638486f8e878 100755 (executable)
 # along with Busy.  If not, see <http://www.gnu.org/licenses/>.
 
 #info="$(egrep -o '(^|&)i=[0-9]{10}_[0-9]{3}(&|$)' <<<"${QUERY_STRING}" |tr -d '&i=')"
+[ "$HTTPS" = "on" ] && PROTO=https || proto=http
+
+. ../auth/acl.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)"
@@ -52,14 +58,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