EOF
}
-n=0
-if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
-(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if expr "$line" : "tagsel=" >/dev/null; then
- n=$(($n + 1))
- tagsel[$n]="$(echo -e "$(sed -nr 's:(^|&)tagsel=(.*)(&|$):\2:;s:&.*$::;s:\+: :g;s:%:\\x:g;p' <<<"$line" )")"
- elif expr "$line" : "ctag=" >/dev/null; then
- tag="$(sed -r 's:^ctag=(.*)$:\1:;s:\+:_:g;s:%:\\x:g' <<<"$line")"
- tag="$(echo -e "${tag}" |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\<\;/g;s/>/\>\;/g')"
- for i in {1..$n}; do
- addtag "${_DATA}/meta/$tagsel[$i].meta" "$tag"
- rm "${_DATA}/cache/$tagsel[$i].cache" 2>/dev/null
+cgi_post
+n=''
+while [ -n "$_POST[\"tagsel$n\"]" ]; do
+ tagsel="$_POST[\"tagsel$n\"]"
+ ( t=''
+ while [ -n "$_POST[\"ctag$t\"]" ]; do
+ echo "$_POST[\"ctag$t\"]"
+ [ -z "$t" ] && t=0 || t=$(($t + 1))
done
- elif expr "$line" : 'tags=.\+' >/dev/null; then
- tags="$(sed -r 's:^tags=(.*)$:\1:;s:\+:_:g;s:%:\\x:g' <<<"$line")"
- tags="$(echo -e "${tags}" |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\<\;/g;s/>/\>\;/g')"
- for i in {1..$n}; do echo "$tags" |while read tag; do
- addtag "${_DATA}/meta/$tagsel[$i].meta" "$tag"
- rm "${_DATA}/cache/$tagsel[$i].cache" 2>/dev/null
- done; done
- fi
+ echo "$_POST[\"tags\"]"
+ ) |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\<\;/g;s/>/\>\;/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))
done
-fi
rm "${_DATA}"/cache/\?* 2>/dev/null
-rm "${_DATA}"/cache/taglist 2>/dev/null
+[ -n "$_POST[\"tags\"]" ] && rm "${_DATA}"/cache/taglist 2>/dev/null
-echo -n "Location: ?o=$order&s=$search&f=$filter&p=$page#$info\n\n"
+echo -n "Location: ?o=$order&s=$search&f=$filter&p=$page\n\n"