]> git.plutz.net Git - busy/blobdiff - write/wikimeta.cgi
modified to use acl engine
[busy] / write / wikimeta.cgi
index fe234aee772299a229bdde77c35fd2d122a33558..e032d910d28eeff2edfffbab042c0de92a008e49 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Busy.  If not, see <http://www.gnu.org/licenses/>.
 
+[ "$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: https://${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: https://${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: https://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
+  echo -n "Location: ${proto}://${HTTP_HOST}/?p=Wiki#$anchor\n\n"
 fi