SEARCH="$(GET s)"
ORDER="$(GET o |grep -m1 -axE 'Date|Name|Length|Group' || printf Name)"
LISTSIZE="$(COOKIE pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)"
-ITEM="$(PATH "${PATH_INFO#/}")"
+ITEM="${PATH_INFO%/}"
ACTION="$(GET a)"
case $ACTION in
;;
esac
-if [ "$ITEM" = "/style.css" ]; then
+if [ "$PATH_INFO" = "/style.css" ]; then
. "$_EXEC/cgilite/file.sh"
- [ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \
+ [ -r "$_DATA/$PATH_INFO" ] && FILE "$_DATA/$PATH_INFO" \
|| FILE "$_EXEC/style.css"
-elif [ "$ITEM" = "/stereoview.js" ]; then
+elif [ "$PATH_INFO" = "/stereoview.js" ]; then
. "$_EXEC/cgilite/file.sh"
FILE "$_EXEC/stereoview.js"
-elif [ -f "$_DATA/$ITEM" ]; then
+elif [ -f "$_DATA/$PATH_INFO" ]; then
case $ACTION in
thumbnail)
. "$_EXEC/cgilite/file.sh"
. "$_EXEC/thumbnail.sh"
- index="$_DATA/${ITEM%/*}/.index"
- thumb="$index/${ITEM##*/}"; thumb="${thumb%.*}.jpg"
+ index="$_DATA/${PATH_INFO%/*}/.index"
+ thumb="$index/${PATH_INFO##*/}"; thumb="${thumb%.*}.jpg"
[ -d "$index" -a ! -f "$thumb" ] \
- && { printf %s "$ITEM" |grep -qE -e "${file_pattern}" ;} \
- && gen_thumb "$_DATA/$ITEM" "$thumb"
+ && { printf %s "$PATH_INFO" |grep -qE -e "${file_pattern}" ;} \
+ && gen_thumb "$_DATA/$PATH_INFO" "$thumb"
FILE "$thumb"
;;
delete)
. "$_EXEC/cgilite/file.sh"
fakemp4="$(COOKIE fakemp4)"
downscale="$(COOKIE downscale)"
- downfile="$_DATA/${ITEM%/*}/.transcode/${ITEM%.*}.480p.webm"
+ downfile="$_DATA/${PATH_INFO%/*}/.transcode/${PATH_INFO%.*}.480p.webm"
if [ "$downscale" = yes -a -f "$downfile" ]; then
FILE "$downfile" "$([ "$fakemp4" = yes ] && printf 'video/mp4')"
else
- FILE "$_DATA/$ITEM" "$([ "$fakemp4" = yes ] && printf 'video/mp4')"
+ FILE "$_DATA/$PATH_INFO" "$([ "$fakemp4" = yes ] && printf 'video/mp4')"
fi
;;
*) . "$_EXEC/view.sh"
esac
-elif [ -d "$_DATA/$ITEM" ]; then
+elif [ -d "$_DATA/$PATH_INFO" ]; then
case $ACTION in
advsearch)
. "$_EXEC/advsearch.sh"
;;
spawnindex)
if [ "$(POST recursive)" = yes ]; then
- find "$_DATA/$ITEM" -depth -type d \! -name .index \
+ find "$_DATA/$PATH_INFO" -depth -type d \! -name .index \
-exec mkdir -p '{}'/.index \;
else
- mkdir -p "$_DATA/$ITEM/.index"
+ mkdir -p "$_DATA/$PATH_INFO/.index"
fi
REDIRECT "$(POST ref)"
;;