-Subproject commit 3fe2a9ceb477adf245f6cc8f72fb61282e42c904
+Subproject commit 441856d88c45de3a8a12a8e3ac74f23f3d9b273b
%s</textarea>
[label for=hourly Hourly Rate:]
[input #hourly type=number name=hourly value="%s"]
- [submit "update" "update" Update]
+ [submit "update" "%s" Update]
]' \
"$(HTML $id)" \
"$(UNSTRING "${address#address=}" |HTML)" \
- "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')"
+ "$(UNSTRING "${hourly#hourly=}" |grep -xE '[0-9]+')" \
+ "$(tid "clients/$id")"
}
list_clients(){
}
update_client(){
- id="$(POST id |checkid)"
- if [ "$(POST update)" = update -a "$id" ]; then
+ local id="$(POST id |checkid)"
+ if [ "$(POST update)" = "$(tid "clients/$id")" ]; then
mkdir -p clients
printf 'address=%s hourly=%s' \
"$(POST address |STRING)" "$(POST hourly |STRING)" \
>"clients/$id"
+ REDIRECT "/clients/"
else
- echo Invalid Data "$(POST id)" "$(POST update)" >&2
+ error Invalid Data "$id" "$(POST update)"
+ REDIRECT "/clients/$1"
fi
}
EOF
}
+tid(){
+ # transaction ID to modify a given file
+ local file="$1"
+ { stat -c %F%i%n%N%s%Y "$file" 2>&-
+ printf %s "$SESSION_ID"
+ server_key
+ } | sha256sum | cut -d\ -f1
+}
+
info="$(PATH "${PATH_INFO}")"
case $info in
/update_client)
. "$_EXEC/clients.sh"
update_client
- REDIRECT /clients/
;;
/senders)
. "$_EXEC/senders.sh"
/update_sender)
. "$_EXEC/senders.sh"
update_sender
- REDIRECT /senders/
;;
/invoices)
. "$_EXEC/invoices.sh"
{ list_invoices
- printf '[a .new href="/invoice/%s" New]' "$(timeid)"
+ printf '[a .new href="/invoices/%s" New]' "$(timeid)"
} | yield_page invoices
;;
- /invoice/*)
+ /invoices/*)
. "$_EXEC/invoices.sh"
- edit_invoice "${info#/invoice/}" |yield_page invoice
+ edit_invoice "${info#/invoices/}" |yield_page invoice
;;
/update_invoice)
. "$_EXEC/invoices.sh"
update_invoice
- REDIRECT "/invoice/$id"
;;
*) REDIRECT /invoices
;;
[form method="POST" action="/update_sender"
[hidden "id" "%s"]
<textarea name="address" placeholder="address">%s</textarea>
- [submit "update" "update" Update]
+ [submit "update" "%s" Update]
]' \
"$(HTML $id)" \
- "$(HTML "${address}")"
+ "$(HTML "${address}")" \
+ "$(tid "senders/$id")"
}
list_senders(){
update_sender(){
id="$(POST id |checkid)"
- if [ "$(POST update)" = update -a "$id" ]; then
+ if [ "$(POST update)" = "$(tid "senders/$id")" ]; then
mkdir -p senders
POST address >"senders/$id"
+ REDIRECT "/senders/"
+ else
+ REDIRECT "/senders/$id"
fi
}