X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=actions%2Fmeta.sh;h=13732e4b47659b308e8b10f62a35c5241f976fff;hb=8d127fe6a7ae92a34d8885a945a36dca1b47211e;hp=a5f578cc8d4fb6cc81bb91a47ce4edf09ecb1afd;hpb=dcdca39400b4b67090aa35c6dbfcafe8a2131b2f;p=serve0 diff --git a/actions/meta.sh b/actions/meta.sh index a5f578c..13732e4 100755 --- a/actions/meta.sh +++ b/actions/meta.sh @@ -1,42 +1,43 @@ #!/bin/zsh -info="$_GET[\"i\"]" -file="{$DATA}/meta/$info.meta" + info="${_GET[i]}" + order="${_GET[o]}" +search="${_GET[s]}" +filter="${_GET[f]}" + page="${_GET[pn]}" +file="${_DATA}/meta/$info.meta" cgi_post -length="$_POST[\"length\"]" -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\"]" \ +length="${_POST[length]}" + width="${_POST[width]}" +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' )" -description="$(echo -e "$_POST[\"description\"]" \ +description="$(echo -e "${_POST[description]}" \ |sed 's/\r//g;s/\\/\\\\/g;s//\>\;/g' )" -n=0; while [ -n "$_POST[\"tag$n\"]" ]; do - tagacc="$_POST[\"tag$n\"]|$tagacc" +n=0; while [ -n "${_POST[tag$n]}" ]; do + tagacc="${_POST[tag$n]}|$tagacc" 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/*[0-9]\?* 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"