X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=actions%2Fintroedit.sh;fp=actions%2Fintroedit.sh;h=d55b1b2396ee2a97e29519c562a25b4581a2884c;hp=0000000000000000000000000000000000000000;hb=f485895094cd72318b46f39689c3ba954eb37411;hpb=904730d1782749bfac15b0344fe5782433f3099b diff --git a/actions/introedit.sh b/actions/introedit.sh new file mode 100755 index 0000000..d55b1b2 --- /dev/null +++ b/actions/introedit.sh @@ -0,0 +1,39 @@ +#!/bin/zsh +# Copyright 2011 - 2014 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 . + + +info="$(echo -E "$_GET[\"i\"]" |grep -Ex 'intro|news')" + +if [ "$info" = "news" ]; then + $ACL_ADDNEWS || info='' +elif [ "$info" = "intro" ]; then + $ACL_EDITINTRO || info='' +elif [ -z "$info" ]; then + $ACL_EDITNEWS || info='' +fi +[ -n "$info" ] || echo -n "Location: //${HTTP_HOST}/?p=Error&i=noaccess\n\n" +[ -n "$info" ] || exit 0 + +[ "$info" = "news" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)" +[ "$info" != "intro" ] && info="${info}.news" +[ "$info" = "intro" ] && ($ACL_EDITINTRO || info='') + +cgi_post + +[ -z "$_POST[\"cancel\"]" ] && echo -E "$_POST[\"text\"]" >"$_DATA/Home/$info" + +echo -n "Location: ${HTTP_REFERER}\n\n"