X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=cards%2Fnew_card.sh;h=69f89c662f87dfa6fb3a35cc5a3520d0ac446f10;hb=e5ac3bcdba86bd9e7967c4ce7177399d2f9bf69f;hp=2d6c39b3ff4200f0952697e051e43a7b73e37107;hpb=43e7c60df0632fd383306a2d3c6dc8c4213d4b9d;p=confetti
diff --git a/cards/new_card.sh b/cards/new_card.sh
index 2d6c39b..69f89c6 100755
--- a/cards/new_card.sh
+++ b/cards/new_card.sh
@@ -1,6 +1,6 @@
-#!/bin/zsh
+#!/bin/sh
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2019 Paul Hänsch
#
# This file is part of Confetti.
#
@@ -17,29 +17,59 @@
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see .
-cgi_post
-cgi_refdata
+filter="$(REF f)"
+order="$(REF o)"
-filter="&filter=${_REF[filter]}"
-filtertype="&filtertype=${_REF[filtertype]}"
-order="&order=${_REF[order]}"
-
-uid=$(uuidgenerator)
+uid="$(timeid)$(randomid)" # 32 Octets UID, starting with timestamp
card="${uid}.vcf"
-tempfile="$_DATA/temp/$card"
-
-cat >"$tempfile" <"$lockfile" <<-EOF
+ BEGIN:VCARD
+ VERSION:4.0
+ N:$(vcf_escape "$ln" "$fn" "$mn" "" "")
+ FN:$(vcf_escape "${fn}${mn:+ }${mn} ${ln}")
+ BDAY:$(parse_date "${byear}-${bmonth}-${bday}")
+ TEL:$(vcf_escape "$tel")
+ TEL;TYPE=CELL:$(vcf_escape "$tcell")
+ EMAIL:$(vcf_escape "$email")
+ X-ZACK-JOINDATE:$(parse_date "$date")
+ ADR:
+ NOTE:$(vcf_escape "$note")
+ UID:${uid}
+ END:VCARD
+ EOF
+ REDIRECT "${_BASE}/cards/?o=${order}&f=${filter}&e=${card}"
+else
+ SET_COOKIE session message="EDITLOCK"
+ REDIRECT "${_BASE}/cards/?o=${order}&f=${filter}"
+fi