From: paul Date: Fri, 31 Jul 2015 11:15:34 +0000 (+0000) Subject: adapted to update in shcgi X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=d0b44dc7ebbb28086c66506cbf40b8df32163796;p=serve0 adapted to update in shcgi svn path=/trunk/; revision=67 --- diff --git a/actions/filter.sh b/actions/filter.sh index ea0f85c..957b1e7 100755 --- a/actions/filter.sh +++ b/actions/filter.sh @@ -1,11 +1,11 @@ #!/bin/zsh cgi_post -order="$_POST[\"o\"]" +order="${_POST[o]}" for fn in {0..9}; do - type="$_POST[\"type${fn}\"]" - category="$(echo "$_POST[\"category${fn}\"]" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" + type="${_POST[type$fn]}" + category="$(echo "${_POST[category$fn]}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" if [ "$type" = "neg" ]; then [ -z "$filters" ] && filters="!" @@ -15,8 +15,8 @@ for fn in {0..9}; do fi n='' - while [ -n "$_POST[\"cfilter${fn}_$n\"]" ]; do - cfilter="$(echo "$_POST[\"cfilter${fn}_$n\"]" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" + while [ -n "${_POST[cfilter${fn}_$n]}" ]; do + cfilter="$(echo "${_POST[cfilter${fn}_$n]}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g' |head -n1)" egrep -q '(^|\^|\||!)$' <<<"${filters}" || filters="${filters}|" [ "$category" = "none" ] && filters="${filters}${cfilter}" || filters="${filters}${category}:${cfilter}" [ -z "$n" ] && n=0 || n=$(($n + 1)) diff --git a/actions/meta.sh b/actions/meta.sh index 10b188f..1895f1d 100755 --- a/actions/meta.sh +++ b/actions/meta.sh @@ -1,27 +1,27 @@ #!/bin/zsh -info="$_GET[\"i\"]" -order="$_GET[\"o\"]" -search="$_GET[\"s\"]" -filter="$_GET[\"f\"]" -page="$_GET[\"pn\"]" + 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\"]" -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 diff --git a/actions/multitag.sh b/actions/multitag.sh index ddd96c3..dd1d2cf 100755 --- a/actions/multitag.sh +++ b/actions/multitag.sh @@ -1,9 +1,9 @@ #!/bin/zsh -filter="$_GET[\"f\"]" -search="$_GET[\"s\"]" -order=$(echo "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$') -page=$(echo "$_GET[\"pn\"]" |egrep '^[0-9]+$') +filter="${_GET[f]}" +search="${_GET[s]}" +order=$(echo "${_GET[o]}" |egrep '^(Name|Date|Length)$') +page=$(echo "${_GET[pn]}" |egrep '^[0-9]+$') addtag(){ meta="$1" @@ -27,14 +27,14 @@ EOF cgi_post n='' -while [ -n "$_POST[\"tagsel$n\"]" ]; do - tagsel="$_POST[\"tagsel$n\"]" +while [ -n "${_POST[tagsel$n]}" ]; do + tagsel="${_POST[tagsel$n]}" ( t='' - while [ -n "$_POST[\"ctag$t\"]" ]; do - echo "$_POST[\"ctag$t\"]" + while [ -n "${_POST[ctag$t]}" ]; do + echo "${_POST[ctag$t]}" [ -z "$t" ] && t=0 || t=$(($t + 1)) done - echo "$_POST[\"tags\"]" + echo "${_POST[tags]}" ) |sed -r 's:\t| :_:g;s:^!|\r|\$|\^::g;s:\\:\\\\:g;s//\>\;/g' \ | while read tag; do addtag "${_DATA}/meta/$tagsel.meta" "$tag" @@ -45,6 +45,6 @@ while [ -n "$_POST[\"tagsel$n\"]" ]; do done rm "${_DATA}"/cache/\?* 2>/dev/null -[ -n "$_POST[\"tags\"]" ] && rm "${_DATA}"/cache/taglist 2>/dev/null +[ -n "${_POST[tags]}" ] && rm "${_DATA}"/cache/taglist 2>/dev/null echo -n "Location: ?o=$order&s=$search&f=$filter&pn=$page\n\n" diff --git a/actions/transcode.sh b/actions/transcode.sh index 7152104..427c154 100755 --- a/actions/transcode.sh +++ b/actions/transcode.sh @@ -1,7 +1,7 @@ #!/bin/zsh -info="$_GET[\"i\"]" -target="$_GET[\"t\"]" +info="${_GET[i]}" +target="${_GET[t]}" video="${_DATA}/videos/$info" meta="${_DATA}/meta/$info.meta" trans="${_DATA}/transcoded/${info}.${target}p.webm" diff --git a/actions/watch.sh b/actions/watch.sh index dbbc219..04c0239 100755 --- a/actions/watch.sh +++ b/actions/watch.sh @@ -1,11 +1,11 @@ #!/bin/zsh cgi_refdata -info="$_GET[\"i\"]" -order="$_REF[\"o\"]" -search="$_REF[\"s\"]" -filter="$_REF[\"f\"]" -page="$_REF[\"pn\"]" +info="${_GET[i]}" +order="${_REF[o]}" +search="${_REF[s]}" +filter="${_REF[f]}" +page="${_REF[pn]}" watch_link='' [ -n "$info" ] && watch_link="i=$(echo -n "${info}" |sed -r 's:%:%25:g;s:\&:%26:g;')&" diff --git a/constants.sh b/constants.sh index 1791215..89236b1 100755 --- a/constants.sh +++ b/constants.sh @@ -18,7 +18,7 @@ # along with Serve0. If not, see . alias _wiki="stx2any --no-template --link-abbrevs --quote -T html" -[ -z "$_GET[\"p\"]" ] && _GET["p"]=list +[ -z "${_GET[p]}" ] && _GET[p]=list pagesize=100 file_pattern='^.*(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|webm|iso|rmvb)$' diff --git a/pages/common.sh b/pages/common.sh index 7dfec96..b424dff 100755 --- a/pages/common.sh +++ b/pages/common.sh @@ -17,10 +17,10 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0. If not, see . -filter="$_GET[\"f\"]" -search="$_GET[\"s\"]" -order=$(echo -E "$_GET[\"o\"]" |egrep '^(Name|Date|Length)$') -page=$(echo -E "$_GET[\"pn\"]" |egrep '^[0-9]+$') +filter="${_GET[f]}" +search="${_GET[s]}" +order=$(echo -E "${_GET[o]}" |egrep '^(Name|Date|Length)$') +page=$(echo -E "${_GET[pn]}" |egrep '^[0-9]+$') [ -z "$page" ] && page=0 page_link='' @@ -130,7 +130,7 @@ thumblist() { $genlist |sed -rn 's:^(.+)$:'"${_DATA}"'/meta/\1'.meta':p' |xargs -d\\n egrep -sil "$search" |sed -rn 's:^(.*/)+([^/]+)\.meta$:\2:p' elif [ "$filterex" != "q0" ]; then $genlist |while read video; do - [ -r "${_DATA}/meta/$video.meta" ] && sed -rn "2{$filterex;q1}" "${_DATA}/meta/$video.meta" && echo -E "$video" + [ -r "${_DATA}/meta/$video.meta" ] && sed -rn "2{$filterex;q1}" "${_DATA}/meta/$video.meta" && printf '%s\n' "$video" done else $genlist diff --git a/pages/list.sh b/pages/list.sh index 9cf7e6f..a86f04c 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -19,7 +19,7 @@ . $_EXEC/pages/common.sh -filters="$(echo -E "$_GET[\"f\"]" |sed -r 's;^!*\^*;;; s;\^*!*$;;; s;!+;!;g; s;\^+;^;g')" +filters="$(printf %s "${_GET[f]}" |sed -r 's;^!*\^*;;; s;\^*!*$;;; s;!+;!;g; s;\^+;^;g')" debug "FILTERS: $filters" quicklinks(){ diff --git a/pages/view.sh b/pages/view.sh index 1520270..9dc0cc7 100755 --- a/pages/view.sh +++ b/pages/view.sh @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0. If not, see . -info="$_GET[\"i\"]" +info="${_GET[i]}" . $_EXEC/pages/common.sh meta="${_DATA}/meta/$info.meta" diff --git a/templates/advfilter.html.sh b/templates/advfilter.html.sh index dbfd323..ce7d6ce 100755 --- a/templates/advfilter.html.sh +++ b/templates/advfilter.html.sh @@ -78,9 +78,9 @@ cat <