X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=actions%2Fintroedit.sh;fp=actions%2Fintroedit.sh;h=5f987fda78ae66513417ef9c4b7ace296a98dcbe;hp=d55b1b2396ee2a97e29519c562a25b4581a2884c;hb=1df6f8d8c85d0dbdaab93b9ee32c396e317cae29;hpb=e1944a84d1d7ba27ace2adb0d00a14b3276a5a4c diff --git a/actions/introedit.sh b/actions/introedit.sh index d55b1b2..5f987fd 100755 --- a/actions/introedit.sh +++ b/actions/introedit.sh @@ -16,24 +16,29 @@ # along with Busy. If not, see . -info="$(echo -E "$_GET[\"i\"]" |grep -Ex 'intro|news')" +info="$(echo -E "$_GET[\"i\"]" |grep -Ex 'intro|news|[0-9]{10}_[0-9]{3}')" + +case "$info" in + news) + $ACL_ADDNEWS \ + && file="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3).news" \ + || info='' + ;; + intro) + $ACL_EDITINTRO \ + && file="intro" \ + || info='' + ;; + *) $ACL_EDITNEWS \ + && file="${info}.news" \ + || info='' +esac -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" +[ -z "$_POST[\"cancel\"]" ] && echo -E "$_POST[\"text\"]" >"$_DATA/Home/${file}" -echo -n "Location: ${HTTP_REFERER}\n\n" +echo -n "Location: ${HTTP_REFERER}#news_${info}\n\n"