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)"
;;
if [ "$type" = dir ]; then
name="${meta%% *}";
- display="$(HTML "$name")"; link="$(URL "$ITEM/$name")"
+ display="$(HTML "$name")"; link="$(URL "${PATH_INFO%/}/$name")"
printf '[a .list .dir href="%s" %s]' "${link}?${w_refuri#*\?}" "$name"
return 0
fi
if [ "$type" = metashort ]; then
name="$(list_fullname "$(UNSTRING "${name%${CR}}")")"
fi
- if [ -f "$_DATA/$ITEM/$name" ]; then
- link="$(URL "$ITEM/$name")"
- name="$(HTML "$ITEM/$name")"
+ if [ -f "$_DATA/${PATH_INFO%/}/$name" ]; then
+ link="$(URL "${PATH_INFO%/}/${name#./}")"
+ name="$(HTML "${PATH_INFO%/}/${name#./}")"
printf '[div .list .file
- [a href="%s" [img src="%s?a=thumbnail"]][label %s]
+ [a href="%s" [img src="%s?a=thumbnail"]][label . %s]
[span .time %i:%02imin] [span .dim %ix%i] %s
[checkbox "select" "%s" id="select_%s"][label for="select_%s" +]
]' \
- "$link" "$link" "${name##*/}" \
+ "$link" "$link" "${name##/}" \
"$((length / 60))" "$((length % 60))" \
"$width" "$height" \
"$(printf '%s\n' "${tags#tags=}" \