2 # Copyright 2014 - 2017 Paul Hänsch
4 # This file is part of Serve0
6 # Serve0 is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Serve0 is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with Serve0 If not, see <http://www.gnu.org/licenses/>.
19 backlink="${_POST[page]}"
25 length=0; width=0; height=0;
26 if [ -r "$meta" ]; then
27 head -n1 "$meta" |read length width height info
28 tags="$(sed -n 2p "$meta" |sed -r 's:^\|(.*)$:\1:')"
29 description="$(sed -n '3,$p' "$meta")"
32 egrep -q "(^|.*\|)$tag(\|.*|$)" <<<"$tags" || tags="$tag|$tags"
35 $length $width $height $info
42 while [ -n "${_POST[tagsel$n]}" ]; do
43 tagsel="${_POST[tagsel$n]}"
45 while [ -n "${_POST[ctag$t]}" ]; do
46 htmlsafe "${_POST[ctag$t]}"
48 [ -z "$t" ] && t=0 || t=$(($t + 1))
50 htmlsafe "${_POST[tags]}"
52 ) | sed -r 's:\t: :g;s:^!|[\r\$\^\|]::g;' \
54 addtag "${_DATA}/meta/$tagsel.meta" "$tag"
56 rm "${_DATA}/cache/$tagsel.cache" 2>/dev/null
61 rm "${_DATA}"/cache/\?* 2>/dev/null
62 [ -n "${_POST[tags]}" ] && rm "${_DATA}"/cache/taglist_set "${_DATA}"/cache/taglist_filter 2>/dev/null
64 redirect "$backlink#$tagsel"