]> git.plutz.net Git - busy/blobdiff - write/projectmeta.cgi
prevent endless loop on malformed svn path
[busy] / write / projectmeta.cgi
index 7f95dfd609a9288c07c0994120c2eea66d0caa74..c2ee4427ff718ab95327b463260b87518bf0aeca 100755 (executable)
@@ -25,13 +25,18 @@ $ACL_ADMIN || exit 0
 
 if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
 (head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' \
-  |sed -rn '/^((appName|appSlogan|svnRepo|gitRepo|flattrThingURL|paypalAddress|btcAddress)=.*|repoType=(svn|git)|(useFlattr|usePaypal|useBitcoin)=yes)$/{
-            s:\+: :g;s:%:\\x:g;s:^([a-zA-Z0-9_+-]+)=(.*)$:\1='"'\2'"':;p}' \
+  |sed -rn '/^((appName|appSlogan|svnRepo|gitRepo|flattrThingURL|paypalAddress|btcAddress|btcAdAddress)=.*|repoType=(svn|git)|(useFlattr|usePaypal|useBitcoin|btcAdGamble|btcAdErotic)=yes|advertise=(btcAd|no))$/{
+            s:\+: :g;s:%:\\x:g;p}' \
   |while line="$(line)"; do
-    eval "$(echo -e "$line" |tr -d '\n\r')"
+    eval "$(echo -e "$line" |sed -r 's:[\n\r'\'']::g;s:^([a-zA-Z0-9_+-]+)=(.*)$:\1='"'\2'"':;')"
   done
 fi
 
+[ "$btcAdGamble" = yes -a "$btcAdErotic" = yes ] && btcAdContent=1
+[ "$btcAdGamble" != yes -a "$btcAdErotic" = yes ] && btcAdContent=2
+[ "$btcAdGamble" = yes -a "$btcAdErotic" != yes ] && btcAdContent=3
+[ "$btcAdGamble" != yes -a "$btcAdErotic" != yes ] && btcAdContent=4
+
 echo "\
 name=$appName
 slogan=$appSlogan
@@ -44,6 +49,9 @@ usePaypal=$usePaypal
 paypalAddress=$paypalAddress
 useBitcoin=$useBitcoin
 btcAddress=$btcAddress
+advertise=$advertise
+btcAdAddress=$btcAdAddress
+btcAdContent=$btcAdContent
 " >"$metafile"
 
 echo -n "Location: ${proto}://${HTTP_HOST}/?p=Admin\n\n"