X-Git-Url: http://git.plutz.net/?p=busy;a=blobdiff_plain;f=actions%2Fintroedit.sh;h=3c6e69843220b896124f309eeba846c2a1cb09e4;hp=d55b1b2396ee2a97e29519c562a25b4581a2884c;hb=HEAD;hpb=f485895094cd72318b46f39689c3ba954eb37411 diff --git a/actions/introedit.sh b/actions/introedit.sh index d55b1b2..3c6e698 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="$(printf %s\\n "${_GET[i]}" |grep -Ex 'intro|news|[0-9]{10}_[0-9]{3}')" -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 +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 -[ "$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='') +[ -n "$info" ] || echo -n "Location: ?p=Error&i=noaccess\n\n" +[ -n "$info" ] || exit 0 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"