-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))