X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=cards%2Ffilter_card.sh;fp=cards%2Ffilter_card.sh;h=d09adabc07cf5f23c8b9d5925cf296835f3cb09a;hp=cc0f9127e404fbbaf52ba752ad97d4545dc70ddc;hb=d5fb0b81bce3f19153b9c74f4bc17fe7a3043a7c;hpb=da89c059ba413f8dbc01409aa883dfc1b4be1f9e diff --git a/cards/filter_card.sh b/cards/filter_card.sh index cc0f912..d09adab 100755 --- a/cards/filter_card.sh +++ b/cards/filter_card.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014, 2017 Paul Hänsch +# Copyright 2014, 2017, 2019 Paul Hänsch # # This file is part of Confetti. # @@ -17,17 +17,16 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -cgi_post - -if [ "${_POST[choice]}" = new_filter ]; then +if [ "$(POST choice)" = new_filter ]; then filter="$( - for n in filter{0..100}; do - # [ -z "${_POST[$n]:+x}" ] && break - printf %s "${_POST[$n]}" - done \ - | sed -r 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX; s;^\^;;; s;\^[^:]*:$;;;' + seq 0 100 |while read n; do + printf %s "$(POST filter$n)" + done | sed -r \ + 's;\|+;\|;g; s;\^+;\^;g; s;:\|;:;g; + :X; s;\^[^:]*:\^;\^;g; /\^[^:]*:\^/bX; + s;^\^;;; s;\^[^:]*:$;;;' )" - printf 'Location: ?p=cards&order=%s&filter=%s\n\n' "${_POST[order]}" "$filter" + REDIRECT "/cards/?order=$(POST order)&filter=${filter}" else - printf 'Location: ?p=cards\n\n' + REDIRECT '/cards/' fi