From: paul Date: Sun, 27 Sep 2015 15:43:10 +0000 (+0000) Subject: adaption for changes in shcgi external X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=4e49d483fd5121fda86a33cf583c15afa6556ad1;p=lobster adaption for changes in shcgi external svn path=/trunk/; revision=70 --- diff --git a/actions/edit_attendee.sh b/actions/edit_attendee.sh index 766031c..2252582 100755 --- a/actions/edit_attendee.sh +++ b/actions/edit_attendee.sh @@ -19,9 +19,9 @@ 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" diff --git a/actions/edit_course.sh b/actions/edit_course.sh index ecf5bc6..1841e05 100755 --- a/actions/edit_course.sh +++ b/actions/edit_course.sh @@ -17,6 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -course="$_GET[\"course\"]" +course="${_GET[course]}" echo -n "Location: ?p=courses&edit=$course\n\n" diff --git a/actions/export_ical.sh b/actions/export_ical.sh index 715f4d2..e595cb6 100755 --- a/actions/export_ical.sh +++ b/actions/export_ical.sh @@ -18,5 +18,5 @@ # along with Confetti. If not, see . echo -n "Content-Type: text/calendar;charset=utf-8\n\n" -course="$_GET[\"course\"]" +course="${_GET[course]}" cat "$_DATA/ical/$course" diff --git a/actions/export_vcard.sh b/actions/export_vcard.sh index 4c78411..d6ea293 100755 --- a/actions/export_vcard.sh +++ b/actions/export_vcard.sh @@ -18,5 +18,5 @@ # along with Confetti. If not, see . echo -n "Content-Type: text/vcard;charset=utf-8\n\n" -card="$_GET[\"card\"]" +card="${_GET[card]}" cat "$_DATA/vcard/$card" diff --git a/actions/filter_attendee.sh b/actions/filter_attendee.sh index fcdf8d1..cb620d5 100755 --- a/actions/filter_attendee.sh +++ b/actions/filter_attendee.sh @@ -19,11 +19,11 @@ 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" ;; *) diff --git a/actions/generate_courselist.sh b/actions/generate_courselist.sh index 4b9c4ae..6ea6d43 100755 --- a/actions/generate_courselist.sh +++ b/actions/generate_courselist.sh @@ -18,7 +18,7 @@ # along with Confetti. If not, see . 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) diff --git a/actions/new_attendee.sh b/actions/new_attendee.sh index b998d1d..0b9b70e 100755 --- a/actions/new_attendee.sh +++ b/actions/new_attendee.sh @@ -20,9 +20,9 @@ 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" diff --git a/actions/update_attendee.sh b/actions/update_attendee.sh index 6125b2f..4d2157f 100755 --- a/actions/update_attendee.sh +++ b/actions/update_attendee.sh @@ -20,46 +20,46 @@ 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" diff --git a/actions/update_course.sh b/actions/update_course.sh index d95d062..e98892e 100755 --- a/actions/update_course.sh +++ b/actions/update_course.sh @@ -19,22 +19,22 @@ 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) @@ -45,21 +45,21 @@ date -d ${dts_year}-${dts_month}-${dts_day} >/dev/null 2>/dev/null || dts_day="0 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 @@ -73,19 +73,19 @@ echo "DTSTAMP:TZID=${tzid}:${tstamp}\r" >>"$tempfile" 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" diff --git a/pages/attendees.sh b/pages/attendees.sh index b528e54..9cc387e 100755 --- a/pages/attendees.sh +++ b/pages/attendees.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2015 Paul Hänsch # # This file is part of Confetti. # @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -[ -z "$_GET[\"order\"]" ] && _GET["order"]=firstname +[ -z "${_GET[order]}" ] && _GET[order]=firstname listcourses() { ls -1 ${_DATA}/ical/*ics |while read file; do @@ -27,30 +27,30 @@ listcourses() { } 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") diff --git a/pages/courses.sh b/pages/courses.sh index ae81ccf..14d1713 100755 --- a/pages/courses.sh +++ b/pages/courses.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -[ -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 @@ -28,10 +28,10 @@ listcards() { 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")" diff --git a/pages/email.sh b/pages/email.sh index c4c8a21..817d5c6 100755 --- a/pages/email.sh +++ b/pages/email.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -[ -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 diff --git a/templates/attendees.html.sh b/templates/attendees.html.sh index 1b57df1..325ddb4 100755 --- a/templates/attendees.html.sh +++ b/templates/attendees.html.sh @@ -16,15 +16,15 @@ # along with Confetti. If not, see . 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 < diff --git a/templates/courses.html.sh b/templates/courses.html.sh index 698fe2c..99e3381 100755 --- a/templates/courses.html.sh +++ b/templates/courses.html.sh @@ -15,10 +15,10 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -edit="$_GET[\"edit\"]" +edit="${_GET[edit]}" check_order(){ - [ "$_GET[\"order\"]" = "$1" ] && echo 'checked="checked"' + [ "${_GET[order]}" = "$1" ] && echo 'checked="checked"' } cat <