#!/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="!"
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))
#!/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;s/>/\>\;/g'
)"
-description="$(echo -e "$_POST[\"description\"]" \
+description="$(echo -e "${_POST[description]}" \
|sed 's/\r//g;s/\\/\\\\/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
#!/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"
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;s/>/\>\;/g' \
| while read tag; do
addtag "${_DATA}/meta/$tagsel.meta" "$tag"
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"
#!/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"
#!/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;')&"
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
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)$'
# You should have received a copy of the GNU Affero General Public License
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
-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=''
$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
. $_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(){
# You should have received a copy of the GNU Affero General Public License
# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
-info="$_GET[\"i\"]"
+info="${_GET[i]}"
. $_EXEC/pages/common.sh
meta="${_DATA}/meta/$info.meta"
<p class="filter final">
<label for="o3" class="order">Order by:</label>
<select class="edit order" size="1" name="o" id="o3">
- <option $([ "$_GET[\"o\"]" = Name ] && echo selected) >Name</option>
- <option $([ "$_GET[\"o\"]" = Date ] && echo selected) >Date</option>
- <option $([ "$_GET[\"o\"]" = Length ] && echo selected) >Length</option>
+ <option $([ "${_GET[o]}" = Name ] && echo selected) >Name</option>
+ <option $([ "${_GET[o]}" = Date ] && echo selected) >Date</option>
+ <option $([ "${_GET[o]}" = Length ] && echo selected) >Length</option>
</select>
<input type="submit" value="Filter!">
</p>