cgi_refdata
-card="$_GET[\"card\"]"
-filter="&filter=$_REF[\"filter\"]"
-filtertype="&filtertype=$_REF[\"filtertype\"]"
-order="&order=$_REF[\"order\"]"
+card="${_GET[card]}"
+filter="&filter=${_REF[filter]}"
+filtertype="&filtertype=${_REF[filtertype]}"
+order="&order=${_REF[order]}"
echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n"
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-course="$_GET[\"course\"]"
+course="${_GET[course]}"
echo -n "Location: ?p=courses&edit=$course\n\n"
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
echo -n "Content-Type: text/calendar;charset=utf-8\n\n"
-course="$_GET[\"course\"]"
+course="${_GET[course]}"
cat "$_DATA/ical/$course"
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
echo -n "Content-Type: text/vcard;charset=utf-8\n\n"
-card="$_GET[\"card\"]"
+card="${_GET[card]}"
cat "$_DATA/vcard/$card"
cgi_post
-case "$_POST[\"choice\"]"; in
+case "${_POST[choice]}"; in
new_filter)
- filter="$_POST[\"filter\"]"
- filtertype="$_POST[\"filtertype\"]"
- order="$_POST[\"order\"]"
+ filter="${_POST[filter]}"
+ filtertype="${_POST[filtertype]}"
+ order="${_POST[order]}"
echo -n "Location: ?p=attendees&filter=$filter&filtertype=$filtertype&order=$order\n\n"
;;
*)
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
pdflatex="$(where pdflatex |head -n1 || echo false)"
-course="$_GET[\"course\"]"
+course="${_GET[course]}"
fromdate=$_GET['fromdate']
fromdate=$(date -d "$fromdate" +%s)
[ -z "$fromdate" ] && fromdate=$(date +%s)
cgi_post
cgi_refdata
-filter="&filter=$_REF[\"filter\"]"
-filtertype="&filtertype=$_REF[\"filtertype\"]"
-order="&order=$_REF[\"order\"]"
+filter="&filter=${_REF[filter]}"
+filtertype="&filtertype=${_REF[filtertype]}"
+order="&order=${_REF[order]}"
uid=$(uuidgenerator)
card="${uid}.vcf"
cgi_post
cgi_refdata
-filter="&filter=$_REF[\"filter\"]"
-filtertype="&filtertype=$_REF[\"filtertype\"]"
-order="&order=$_REF[\"order\"]"
+filter="&filter=${_REF[filter]}"
+filtertype="&filtertype=${_REF[filtertype]}"
+order="&order=${_REF[order]}"
-card="$_POST[\"card\"]"
+card="${_POST[card]}"
tempfile="$_DATA/temp/$card"
cardfile="$_DATA/vcard/$card"
attfile="$_DATA/mappings/attendance"
-_POST["0N"]="$(echo "$_POST[\"0N\"]" |sed 's:;: :')"
-_POST["1N"]="$(echo "$_POST[\"1N\"]" |sed 's:;: :')"
-_POST["2N"]="$(echo "$_POST[\"2N\"]" |sed 's:;: :')"
-_POST["3N"]="$(echo "$_POST[\"3N\"]" |sed 's:;: :')"
-_POST["4N"]="$(echo "$_POST[\"4N\"]" |sed 's:;: :')"
+_POST[0N]="${(echo "$_POST[0N]}" |sed 's:;: :')"
+_POST[1N]="${(echo "$_POST[1N]}" |sed 's:;: :')"
+_POST[2N]="${(echo "$_POST[2N]}" |sed 's:;: :')"
+_POST[3N]="${(echo "$_POST[3N]}" |sed 's:;: :')"
+_POST[4N]="${(echo "$_POST[4N]}" |sed 's:;: :')"
echo "BEGIN:VCARD\r" >"$tempfile"
echo "VERSION:4.0\r" >>"$tempfile"
-echo "N:$_POST[\"0N\"];$_POST[\"1N\"];$_POST[\"2N\"];$_POST[\"3N\"];$_POST[\"4N\"]\r" >>"$tempfile"
-echo "UID:$_POST[\"UID\"]\r" >>"$tempfile"
+echo "N:${_POST[0N]};${_POST[1N]};${_POST[2N]};${_POST[3N]};${_POST[4N]}\r" >>"$tempfile"
+echo "UID:${_POST[UID]}\r" >>"$tempfile"
for field in $VCF_FIELDS; do
- value="$_POST[\"$field\"]"
+ value="${_POST[$field]}"
n=0
while [ -n "$value" ]; do
value="$(echo "$value" |sed -r ':a;N;$!ba;s:\n:\\\\n:g;s:\r:\\\\r:g')"
echo "${field}:${value}\r"
- value="$_POST[\"$field$n\"]"
+ value="${_POST[$field$n]}"
n=$(($n + 1))
done
done >>"$tempfile"
-case "$_POST[\"action\"]" in
+case "${_POST[action]}" in
addfield)
- echo "$_POST[\"newfield\"]:\r" >>"$tempfile"
+ echo "${_POST[newfield]}:\r" >>"$tempfile"
echo "END:VCARD\r" >>"$tempfile"
echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n"
;;
update)
attendance=()
for att in attendance attendance{0..100}; do
- [ -n "$_POST[\"$att\"]" ] && attendance+=("$_POST[\"$att\"]")
+ [ -n "${_POST[$att]}" ] && attendance+=("${_POST[$att]}")
done
sed -rn 's:^(.+)'$card'$:\1:p' "$attfile" |while read course; do
touch "$_DATA/ical/$course"
cgi_post
-course="$_POST[\"course\"]"
+course="${_POST[course]}"
tempfile="temp/$course"
coursefile="ical/$course"
# DURATION:
-uid="$_POST[\"UID\"]"
+uid="${_POST[UID]}"
tzid=$(cat /etc/timezone)
tstamp=$(TZ="$tzid" date +%Y%m%dT%H%M%S)
-dts_year="$_POST[\"DTSYEAR\"]"
-dts_month="$_POST[\"DTSMONTH\"]"
-dts_day="$_POST[\"DTSDAY\"]"
-[ -n "$_POST[\"DTSDAY0\"]" ] && dts_day="$_POST[\"DTSDAY0\"]"
-dts_hour="$_POST[\"DTSHOUR\"]"
-dts_minute="$_POST[\"DTSMINUTE\"]"
+dts_year="${_POST[DTSYEAR]}"
+dts_month="${_POST[DTSMONTH]}"
+dts_day="${_POST[DTSDAY]}"
+[ -n "${_POST[DTSDAY0]}" ] && dts_day="${_POST[DTSDAY0]}"
+dts_hour="${_POST[DTSHOUR]}"
+dts_minute="${_POST[DTSMINUTE]}"
[ -z $dts_year ] && dts_year=$(date +%Y)
[ -z $dts_month ] && dts_month=$(date +%m)
dtstart="TZID=${tzid}:${dts_year}${dts_month}${dts_day}T${dts_hour}${dts_minute}00"
-rr_int="$_POST[\"RRULE_INTERVAL\"]"
-rr_freq="$_POST[\"RRULE_FREQ\"]"
-rr_limit="$_POST[\"RRULE_LIMIT\"]"
+rr_int="${_POST[RRULE_INTERVAL]}"
+rr_freq="${_POST[RRULE_FREQ]}"
+rr_limit="${_POST[RRULE_LIMIT]}"
case "$rr_limit" in
ETERN)
rrule="FREQ=$rr_freq;INTERVAL=$rr_int"
;;
COUNT)
- t="$_POST[\"RRULE_COUNT\"]"
+ t="${_POST[RRULE_COUNT]}"
rrule="FREQ=$rr_freq;INTERVAL=$rr_int;COUNT=$t"
;;
UNTIL)
- uy="$_POST[\"RRULE_UYEAR\"]"
- um="$_POST[\"RRULE_UMONTH\"]"
- ud="$_POST[\"RRULE_UDAY\"]"
+ uy="${_POST[RRULE_UYEAR]}"
+ um="${_POST[RRULE_UMONTH]}"
+ ud="${_POST[RRULE_UDAY]}"
rrule="FREQ=$rr_freq;INTERVAL=$rr_int;UNTIL=${uy}${um}${ud}T000000Z"
;;
esac
echo "DTSTART:${dtstart}\r" >>"$tempfile"
echo "RRULE:${rrule}\r" >>"$tempfile"
for field in SUMMARY COMMENT; do
- value="$_POST[\"$field\"]"
+ value="${_POST[$field]}"
n=0
while [ -n "$value" ]; do
value="$(echo "$value" |sed -r ':a;N;$!ba;s:\n:\\\\n:g;s:\r:\\\\r:g')"
echo "${field}:${value}\r"
- value="$_POST[\"$field$n\"]"
+ value="${_POST[$field$n]}"
n=$(($n + 1))
done
done >>"$tempfile"
-case "$_POST[\"action\"]" in
+case "${_POST[action]}" in
addfield)
- echo "$_POST[\"newfield\"]:\r" >>"$tempfile"
+ echo "${_POST[newfield]}:\r" >>"$tempfile"
echo "END:VEVENT\r" >>"$tempfile"
echo "END:VCALENDAR\r" >>"$tempfile"
echo -n "Location: ?p=courses&edit=$course\n\n"
#!/bin/sh
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2015 Paul Hänsch
#
# This file is part of Confetti.
#
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-[ -z "$_GET[\"order\"]" ] && _GET["order"]=firstname
+[ -z "${_GET[order]}" ] && _GET[order]=firstname
listcourses() {
ls -1 ${_DATA}/ical/*ics |while read file; do
}
listcards() {
- case "$_GET[\"filtertype\"]" in
+ case "${_GET[filtertype]}" in
any)
- grep -il "$_GET[\"filter\"]" ${_DATA}/vcard/*vcf
+ grep -il "${_GET[filter]}" ${_DATA}/vcard/*vcf
;;
name)
- egrep -xil "(FN|NICKNAME|N)(;.+)*:.*$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf
+ egrep -xil "(FN|NICKNAME|N)(;.+)*:.*${_GET[filter]}.*" ${_DATA}/vcard/*vcf
;;
street)
- egrep -xil "(ADR)(;.+)*:([^;]*;){2}$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf
+ egrep -xil "(ADR)(;.+)*:([^;]*;){2}${_GET[filter]}.*" ${_DATA}/vcard/*vcf
;;
zip)
- egrep -xil "(ADR)(;.+)*:([^;]*;){5}$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf
+ egrep -xil "(ADR)(;.+)*:([^;]*;){5}${_GET[filter]}.*" ${_DATA}/vcard/*vcf
;;
telephone)
- egrep -xil "(TEL)(;.+)*:.*$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf
+ egrep -xil "(TEL)(;.+)*:.*${_GET[filter]}.*" ${_DATA}/vcard/*vcf
;;
birth)
- egrep -xil "(BDAY)(;.+)*:$_GET[\"filter\"].*" ${_DATA}/vcard/*vcf
+ egrep -xil "(BDAY)(;.+)*:${_GET[filter]}.*" ${_DATA}/vcard/*vcf
;;
course)
;;
*) ls -1 ${_DATA}/vcard/*vcf 2>/dev/null
;;
- esac |case "$_GET[\"order\"]" in
+ esac |case "${_GET[order]}" in
firstname)
while read file; do
fn=$(sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$file")
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-[ -z "$_GET[\"order\"]" ] && _GET["order"]=DOW
+[ -z "${_GET[order]}" ] && _GET[order]=DOW
listcards() {
ls -1 ${_DATA}/vcard/*vcf 2>/dev/null |while read file; do
listcourses() {
- case "$_GET[\"filtertype\"]" in
+ case "${_GET[filtertype]}" in
*) ls -1 ${_DATA}/ical/*ics 2>/dev/null
;;
- esac |case "$_GET[\"order\"]" in
+ esac |case "${_GET[order]}" in
DOW)
while read file; do
icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")"
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-[ -z "$_GET[\"order\"]" ] && _GET["order"]=DOW
+[ -z "${_GET[order]}" ] && _GET[order]=DOW
listcards() {
ls -1 ${_DATA}/vcard/*vcf 2>/dev/null |while read file; do
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
check_type(){
- [ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"'
+ [ "${_GET[filtertype]}" = "$1" ] && echo 'checked="checked"'
}
check_order(){
- [ "$_GET[\"order\"]" = "$1" ] && echo 'checked="checked"'
+ [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"'
}
-edit="$_GET[\"edit\"]"
-[ -z "$_GET[\"filtertype\"]" ] && _GET["filtertype"]="any"
-[ -z "$_GET[\"order\"]" ] && _GET["order"]="firstname"
+edit="${_GET[edit]}"
+[ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any"
+[ -z "${_GET[order]}" ] && _GET[order]="firstname"
cat <<EOF
<form class="filter" action="?action=filter_attendee" method="POST">
# You should have received a copy of the GNU Affero General Public License
# along with Confetti. If not, see <http://www.gnu.org/licenses/>.
-edit="$_GET[\"edit\"]"
+edit="${_GET[edit]}"
check_order(){
- [ "$_GET[\"order\"]" = "$1" ] && echo 'checked="checked"'
+ [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"'
}
cat <<EOF