]> git.plutz.net Git - serve0/blobdiff - actions/meta.sh
rename p attribute to pn, and use p for cgi page name instead
[serve0] / actions / meta.sh
index a5f578cc8d4fb6cc81bb91a47ce4edf09ecb1afd..10b188fef0bdab35f217fe5e299fd7a7f635429e 100755 (executable)
@@ -1,7 +1,11 @@
 #!/bin/zsh
 
 info="$_GET[\"i\"]"
-file="{$DATA}/meta/$info.meta"
+order="$_GET[\"o\"]"
+search="$_GET[\"s\"]"
+filter="$_GET[\"f\"]"
+page="$_GET[\"pn\"]"
+file="${_DATA}/meta/$info.meta"
 
 cgi_post
 length="$_POST[\"length\"]"
@@ -9,10 +13,6 @@ width="$_POST[\"width\"]"
 height="$_POST[\"height\"]"
 trash="$_POST[\"trash\"]"
 cancel="$_POST[\"cancel\"]"
-filter="$_POST[\"f\"]"
-search="$_POST[\"s\"]"
-page="$_POST[\"p\"]"
-order="$_POST[\"o\"]"
 tagacc="$_POST[\"tag\"]"
 tags="$(echo "$_POST[\"tags\"]" \
         | sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s/</\&lt\;/g;s/>/\&gt\;/g'
@@ -25,18 +25,19 @@ n=0; while [ -n "$_POST[\"tag$n\"]" ]; do
   n=$(($n + 1))
 done
 
-[ -z "$cancel" ] && if [ -n "$trash" ]; then
+[ -z "$cancel" -a -n "$info" ] && if [ -n "$trash" ]; then
   rm "${_DATA}/thumbs/$info.jpg" 2>/dev/null
   mv "${_DATA}/videos/$info" "${_DATA}/meta/$info.meta" "${_DATA}/trash/" 2>/dev/null
   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 -e "${tagacc}|${tags}" |tr '\n' '|' >> "$file"
   echo >>"$file"
   echo -e "${description}" >> "$file"
   rm "${_DATA}/cache/$info.cache" 2>/dev/null
   rm ${_DATA}/cache/\?* 2>/dev/null
+  rm ${_DATA}/cache/taglist 2>/dev/null
 fi
 
-echo -n "Location: ?i=&p=${page}&s=${search}&f=${filter}&o=${order}#$info\n\n"
+echo -n "Location: ?i=&pn=${page}&s=${search}&f=${filter}&o=${order}#$info\n\n"