5 order=$(echo "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$')
6 page=$(echo "$_GET[\"p\"]" |egrep '^[0-9]+$')
12 length=0; width=0; height=0;
13 if [ -r "$meta" ]; then
14 head -n1 "$meta" |read length width height info
15 tags="$(sed -n 2p "$meta" |sed -r 's:^\|(.*)$:\1:')"
16 description="$(sed -n '3,$p' "$meta")"
19 egrep -q "(^|.*\|)$tag(\|.*|$)" <<<"$tags" || tags="$tag|$tags"
22 $length $width $height $info
29 if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
30 (head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
31 if expr "$line" : "tagsel=" >/dev/null; then
33 tagsel[$n]="$(echo -e "$(sed -nr 's:(^|&)tagsel=(.*)(&|$):\2:;s:&.*$::;s:\+: :g;s:%:\\x:g;p' <<<"$line" )")"
34 elif expr "$line" : "ctag=" >/dev/null; then
35 tag="$(sed -r 's:^ctag=(.*)$:\1:;s:\+:_:g;s:%:\\x:g' <<<"$line")"
36 tag="$(echo -e "${tag}" |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\<\;/g;s/>/\>\;/g')"
38 addtag "${_DATA}/meta/$tagsel[$i].meta" "$tag"
39 rm "${_DATA}/cache/$tagsel[$i].cache" 2>/dev/null
41 elif expr "$line" : 'tags=.\+' >/dev/null; then
42 tags="$(sed -r 's:^tags=(.*)$:\1:;s:\+:_:g;s:%:\\x:g' <<<"$line")"
43 tags="$(echo -e "${tags}" |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\<\;/g;s/>/\>\;/g')"
44 for i in {1..$n}; do echo "$tags" |while read tag; do
45 addtag "${_DATA}/meta/$tagsel[$i].meta" "$tag"
46 rm "${_DATA}/cache/$tagsel[$i].cache" 2>/dev/null
52 rm "${_DATA}"/cache/\?* 2>/dev/null
54 echo -n "Location: ?o=$order&s=$search&f=$filter&p=$page#$info\n\n"