X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fmultitag.sh;h=b38b204ea0688bb21592d02d32d09c7bae1ca212;hb=d716f2ce1fe64cf87f777490315bc51906001c72;hp=5691b4fd8869c3dfe254ad2a53d956ecba64cb8c;hpb=6b08e359a06ed38d25c1756e5600096c77417a9c;p=serve0 diff --git a/actions/multitag.sh b/actions/multitag.sh index 5691b4f..b38b204 100755 --- a/actions/multitag.sh +++ b/actions/multitag.sh @@ -1,5 +1,5 @@ #!/bin/zsh -# Copyright 2014 - 2016 Paul Hänsch +# Copyright 2014 - 2017 Paul Hänsch # # This file is part of Serve0 # @@ -16,10 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0 If not, see . -filter="${_GET[f]}" -search="${_GET[s]}" -order=$(validate "${_GET[o]}" 'Name|Date|Length' Name) -page=$(validate "${_GET[pn]}" '[0-9]+' 1) +backlink="${_POST[page]}" addtag(){ meta="$1" @@ -41,7 +38,6 @@ $description EOF } -cgi_post n='' while [ -n "${_POST[tagsel$n]}" ]; do tagsel="${_POST[tagsel$n]}" @@ -53,16 +49,16 @@ while [ -n "${_POST[tagsel$n]}" ]; do done htmlsafe "${_POST[tags]}" printf \\n - ) |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;' \ + ) | sed -r 's:\t: :g;s:^!|[\r\$\^\|]::g;' \ | while read tag; do addtag "${_DATA}/meta/$tagsel.meta" "$tag" done rm "${_DATA}/cache/$tagsel.cache" 2>/dev/null - [ -z "$n" ] && n=0 || n=$(($n + 1)) + n=$((${n:--1} + 1)) done -rm "${_DATA}"/cache/*[0-9]\?* 2>/dev/null -[ -n "${_POST[tags]}" ] && rm "${_DATA}"/cache/taglist 2>/dev/null +rm "${_DATA}"/cache/\?* 2>/dev/null +[ -n "${_POST[tags]}" ] && rm "${_DATA}"/cache/taglist_set "${_DATA}"/cache/taglist_filter 2>/dev/null -redirect "?o=$order&s=$search&f=$filter&pn=$page" +redirect "$backlink#$tagsel"