refactoring card display
[confetti] / index.cgi
index e0bf125..cf70a45 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -14,18 +14,18 @@ esac; done
 FILTER="$(GET filter)"
 ORDER="$(GET o |grep -m1 -axE 'firstname|lastname|bdate' || printf firstname)"
 # LISTSIZE="$(COOKIE pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)"
-ITEM="$(PATH "${PATH_INFO#/}")"
+ITEM="$(PATH "${PATH_INFO#/}")"; ITEM="${ITEM#/}"
 ACTION="$(GET a)"
 
-if [ -d "${_EXEC}/${ITEM%%/*}/main.cgi" ]
+if [ -d "${_EXEC}/${ITEM%%/*}" -a -x "${_EXEC}/${ITEM%%/*}/main.cgi" ]; then
   . "${_EXEC}/${ITEM%%/*}/main.cgi"
-elif [ "$ITEM" = "/style.css" ]; then
+elif [ "$ITEM" = "style.css" ]; then
   . "$_EXEC/cgilite/file.sh"
   [ -r "$_DATA/$ITEM" ] && FILE "$_DATA/$ITEM" \
                         || FILE "$_EXEC/style.css"
-elif [ -d "${_EXEC}/${ITEM%%/*}" -a ! -x "${_EXEC}/$ITEM" ]
-  . "$_EXEC/cgilite/file.sh"
-  FILE "${_EXEC}/$ITEM"
+# elif [ -d "${_EXEC}/${ITEM%%/*}" -a ! -x "${_EXEC}/$ITEM" ]; then
+  . "$_EXEC/cgilite/file.sh"
+  FILE "${_EXEC}/$ITEM"
 else
   printf 'Status: 404 Not Found\r\nContent-Length: 0\r\n\r\n'
 fi