]> git.plutz.net Git - cgilite/blobdiff - cgilite.sh
bugfix: parameter passing in cgilite_value calls
[cgilite] / cgilite.sh
index e145f2eebe173be82475cde1ec60fb200a14ed63..9fa56eef0633f22e7fa5d8f901ddf776143a6a55 100755 (executable)
@@ -18,6 +18,9 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with CGIlite.  If not, see <http://www.gnu.org/licenses/>. 
 
+[ -n "$include_cgilite" ] && return 0
+# guard set after webserver part
+
 # ksh and zsh workaround
 # set -o posix # ksh, not portable
 setopt -o OCTAL_ZEROES 2>&-
@@ -27,8 +30,6 @@ BR='
 '
 cgilite_timeout=2
 
-debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a /dev/stderr; }
-
 PATH(){ 
   local str seg out
   [ $# -eq 0 ] && str="$(cat)" || str="$*"
@@ -121,11 +122,14 @@ if [ -z "$REQUEST_METHOD" ]; then
   exit 0
 fi
 
+include_cgilite="$0"
+
 if [ "${REQUEST_METHOD}" = POST -a "${CONTENT_LENGTH:-0}" -gt 0 -a \
      "${CONTENT_TYPE}" = "application/x-www-form-urlencoded" ]; then
   cgilite_post="$(head -c "$CONTENT_LENGTH")"
 fi
 
+debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a /dev/stderr; }
 [ "${DEBUG+x}" ] && env >&2
 
 cgilite_count(){
@@ -153,15 +157,15 @@ cgilite_keys(){
   | sort -u
 }
 
-GET(){ cgilite_value "${QUERY_STRING}" $@; }
+GET(){ cgilite_value "${QUERY_STRING}" "$@"; }
 GET_COUNT(){ cgilite_count "${QUERY_STRING}" $1; }
 GET_KEYS(){ cgilite_keys "${QUERY_STRING}"; }
 
-POST(){ cgilite_value "${cgilite_post}" $@; }
+POST(){ cgilite_value "${cgilite_post}" "$@"; }
 POST_COUNT(){ cgilite_count "${cgilite_post}" $1; }
 POST_KEYS(){ cgilite_keys "${cgilite_post}"; }
 
-REF(){ cgilite_value "${HTTP_REFERER#*\?}" $@; }
+REF(){ cgilite_value "${HTTP_REFERER#*\?}" "$@"; }
 REF_COUNT(){ cgilite_count "${HTTP_REFERER#*\?}" $1; }
 REF_KEYS(){ cgilite_keys "${HTTP_REFERER#*\?}"; }