'
HEX_DECODE(){
- printf "$(printf %s "$1" |sed -r "$HEX_DECODE")"
+ printf -- "$(printf %s "$1" |sed -r "$HEX_DECODE")"
}
if [ -z "$REQUEST_METHOD" ]; then
str=${str#*&${name}=}
cnt=$((cnt - 1))
done
- printf "$(printf %s "${str%%&*}" |sed -r 's;\+; ;g;'"$HEX_DECODE")"
+ printf -- "$(printf %s "${str%%&*}" |sed -r 's;\+; ;g;'"$HEX_DECODE")"
}
+cgilite_keys(){
+ local str="&$1"
+ while [ "${str#*&}" != "${str}" ]; do
+ str="${str#*&}"
+ printf '%s\n' "${str%%=*}"
+ done \
+ | sort -u
+}
+
GET(){ cgilite_value "${QUERY_STRING}" $@; }
GET_COUNT(){ cgilite_count "${QUERY_STRING}" $1; }
+GET_KEYS(){ cgilite_keys "${QUERY_STRING}"; }
POST(){ cgilite_value "${cgilite_post}" $@; }
POST_COUNT(){ cgilite_count "${cgilite_post}" $1; }
+POST_KEYS(){ cgilite_keys "${cgilite_post}"; }
REF(){ cgilite_value "${HTTP_REFERER#*\?}" $@; }
REF_COUNT(){ cgilite_count "${HTTP_REFERER#*\?}" $1; }
+REF_KEYS(){ cgilite_keys "${HTTP_REFERER#*\?}"; }
COOKIE(){
HEX_DECODE "$(
- #!/bin/sed -nrf
+ #!/bin/sed -nEf
+
+ :Escapes
+ s,\\\\,\\,g; s,\\&,\&,g;
+ s,\\<,\<,g; s,\\>,\>,g;
+ s,\\",\",g; s,\\',\',g;
+ s,\\\[,\[,g; s,\\\],\],g;
+ s,\\\.,\.,g; s,\\#,\#,g;
+ s,\\,,g;
:CommentHandle
x; /^<\/!-->/{
t attribs;
s;(<[^/][^>]*>)[ \t]*;\1;g;
-s;(<[^/][^>]*)>[ \t]*</[^>]+>;\1/>;g;
+# s;(<[^/][^>]*)>[ \t]*</[^>]+>;\1/>;g;
+s;(<(br|hr|img|input|link|meta|area|base|col|command|embed|keygen|param|source|track|wbr)[^>]*)>[ \t]*</\1>;\1>;g;
s;<!-->;<!--;;