]> git.plutz.net Git - busy/blobdiff - actions/introedit.sh
porting busy to confetti framework
[busy] / actions / introedit.sh
diff --git a/actions/introedit.sh b/actions/introedit.sh
new file mode 100755 (executable)
index 0000000..d55b1b2
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+
+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"