2 # Copyright 2014 - 2016 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/>.
21 order=$(validate "${_GET[o]}" 'Name|Date|Length' Name)
22 page=$(validate "${_GET[pn]}" '[0-9]+' 1)
28 length=0; width=0; height=0;
29 if [ -r "$meta" ]; then
30 head -n1 "$meta" |read length width height info
31 tags="$(sed -n 2p "$meta" |sed -r 's:^\|(.*)$:\1:')"
32 description="$(sed -n '3,$p' "$meta")"
35 egrep -q "(^|.*\|)$tag(\|.*|$)" <<<"$tags" || tags="$tag|$tags"
38 $length $width $height $info
46 while [ -n "${_POST[tagsel$n]}" ]; do
47 tagsel="${_POST[tagsel$n]}"
49 while [ -n "${_POST[ctag$t]}" ]; do
50 htmlsafe "${_POST[ctag$t]}"
52 [ -z "$t" ] && t=0 || t=$(($t + 1))
54 htmlsafe "${_POST[tags]}"
56 ) | sed -r 's:\t: :g;s:^!|[\r\$\^\|]::g;' \
58 addtag "${_DATA}/meta/$tagsel.meta" "$tag"
60 rm "${_DATA}/cache/$tagsel.cache" 2>/dev/null
62 [ -z "$n" ] && n=0 || n=$(($n + 1))
65 rm "${_DATA}"/cache/*[0-9]\?* 2>/dev/null
66 [ -n "${_POST[tags]}" ] && rm "${_DATA}"/cache/taglist 2>/dev/null
68 redirect "?o=$order&s=$search&f=$filter&pn=$page"