#!/bin/zsh # Copyright 2011 Paul Haensch # This file is part of Busy # # Busy is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Busy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Busy. If not, see . page=$(egrep -o '(^|&)p=(QandA|Locations|Wiki)(&|$)' <<<"${QUERY_STRING}" |sed 's,p=,,;s,&,,g') edit=$(egrep -o '(^|&)e=[0-9]{10}_[0-9]{3}(_[0-9]{1,4})?(&|$)' <<<"${QUERY_STRING}" |tr -d 'e=&') case "$page" in QandA) [ -f "../QandA/${edit}.qstn" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../QandA/${edit}.lock" ;; Locations) [ -f "../Locations/${edit}.jpg" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../Locations/${edit}.lock" ;; Wiki) [ -f "../Wiki/${edit}" ] && echo "${REMOTE_USER}:$(($(date +%s)+600))" >"../Wiki/${edit}.lock" ;; *) echo -n "Location: http://$host/?p=Error&r=input&$page\n\n" exit 0 ;; esac echo -n "Location: http://${HTTP_HOST}/?${QUERY_STRING}\n\n"