# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-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"