X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fmeta.sh;h=894743e7796f558fcc6fb05a77c16155a189c881;hb=6b08e359a06ed38d25c1756e5600096c77417a9c;hp=034befabe19d2ee374f38094af9481b2aecef1d2;hpb=8d001b4467b644b462faabdf75d8f6af50c4e2ae;p=serve0
diff --git a/actions/meta.sh b/actions/meta.sh
index 034befa..894743e 100755
--- a/actions/meta.sh
+++ b/actions/meta.sh
@@ -1,4 +1,20 @@
#!/bin/zsh
+# Copyright 2014 - 2016 Paul Hänsch
+#
+# This file is part of Serve0
+#
+# Serve0 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Serve0 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Serve0 If not, see .
cgi_refdata
@@ -16,14 +32,11 @@ height="${_POST[height]}"
trash="${_POST[trash]}"
cancel="${_POST[cancel]}"
tagacc="${_POST[tag]}"
-tags="$(echo "${_POST[tags]}" \
- | sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/\<\;/g;s/>/\>\;/g'
-)"
-description="$(echo -e "${_POST[description]}" \
- |sed 's/\r//g;s/\\/\\\\/g;s/\<\;/g;s/>/\>\;/g'
-)"
+tags="$(htmlsafe "${_POST[tags]}" |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;' |tr '\n' '|')"
+description="$(htmlsafe "${_POST[description]}")"
+
n=0; while [ -n "${_POST[tag$n]}" ]; do
- tagacc="${_POST[tag$n]}|$tagacc"
+ tagacc="$(htmlsafe ${_POST[tag$n]} |sed -r '2,$d;s:\t| :_:g;s:^!|\r|\$|\^::g;')|$tagacc"
n=$(($n + 1))
done
@@ -33,13 +46,14 @@ done
rm "${_DATA}/cache/$info.cache" 2>/dev/null
rm ${_DATA}/cache/\?* 2>/dev/null
else
- echo -e "$length\t$width\t$height\t$info" > "$file"
- echo -e "${tagacc}|${tags}" |tr '\n' '|' >> "$file"
- echo >>"$file"
- echo -e "${description}" >> "$file"
+ cat >$file </dev/null
rm ${_DATA}/cache/*[0-9]\?* 2>/dev/null
rm ${_DATA}/cache/taglist 2>/dev/null
fi
-echo -n "Location: ?i=&pn=${page}&s=${search}&f=${filter}&o=${order}#$info\n\n"
+redirect "?i=&pn=${page}&s=${search}&f=${filter}&o=${order}#${info}"