X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Fupdate_card.sh;h=f44eb28b8d534b5f69bb277d4ba693925ca8dd4e;hp=52ccfcda6e2d7cefe3106866055e462b09657350;hb=79c8cc42d90a62b40dd2fc2215c3d07208160f22;hpb=d6e018a83d2f0305b773ec01d8c27f8ce930a9b5 diff --git a/cards/update_card.sh b/cards/update_card.sh index 52ccfcd..f44eb28 100755 --- a/cards/update_card.sh +++ b/cards/update_card.sh @@ -20,6 +20,10 @@ . "$_EXEC/pdiread.sh" . "$_EXEC/session_lock.sh" +unset filter order card action newfield +unset cardfile attfile tempfile +unset vcf field cnt delete_key + filter="$(REF f)" order="$(REF o)" @@ -28,7 +32,12 @@ cardfile="$_DATA/vcard/$card" attfile="$_DATA/mappings/attendance" action="$(POST action)" -newfield="$(POST newfield)" +newfield="$(POST newfield |grep -m 1 -xE '[A-Z][A-Z0-9-]*')" + +if printf '%s\n' "$action" |grep -qxE 'addfield [A-Z][A-Z0-9]*'; then + newfield="${action##* }" + action=addfield +fi if ! tempfile=$(CHECK_SLOCK "$cardfile"); then SET_COOKIE 0 message="NO VALID FILE LOCK"