]> git.plutz.net Git - busy/blob - write/projectmeta.cgi
436f31e391f3c71889f3ce0517bde98043295dd6
[busy] / write / projectmeta.cgi
1 #!/bin/zsh
2
3 # Copyright 2012 Paul Hänsch
4 # This file is part of Busy
5 #
6 # Busy is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Busy is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with Busy.  If not, see <http://www.gnu.org/licenses/>.
18
19 metafile="../project.meta"
20
21 [ "$HTTPS" = "on" ] && proto=https || proto=http
22 . ../auth/permissions.sh
23 $ACL_ADMIN || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
24 $ACL_ADMIN || exit 0 
25
26 if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
27 (head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' \
28   |sed -rn '/^((appName|appSlogan|svnRepo|gitRepo|flattrThingURL|paypalAddress|btcAddress|btcAdAddress)=.*|repoType=(svn|git)|(useFlattr|usePaypal|useBitcoin)=yes|advertise=(btcAd|no)|btcAdContent=[1-4])$/{
29             s:\+: :g;s:%:\\x:g;p}' \
30   |while line="$(line)"; do
31     eval "$(echo -e "$line" |sed -r 's:[\n\r'\'']::g;s:^([a-zA-Z0-9_+-]+)=(.*)$:\1='"'\2'"':;')"
32   done
33 fi
34
35 echo "\
36 name=$appName
37 slogan=$appSlogan
38 repoType=$repoType
39 svnRepo=$svnRepo
40 gitRepo=$gitRepo
41 useFlattr=$useFlattr
42 flattrThingURL=$flattrThingURL
43 usePaypal=$usePaypal
44 paypalAddress=$paypalAddress
45 useBitcoin=$useBitcoin
46 btcAddress=$btcAddress
47 advertise=$advertise
48 btcAdAddress=$btcAdAddress
49 btcAdContent=$btcAdContent
50 " >"$metafile"
51
52 echo -n "Location: ${proto}://${HTTP_HOST}/?p=Admin\n\n"