IngRRD/lib/read_query_string
Vincent Riquer d618373dc9 Show current level on all pages
Begin splitting code into functions
2014-06-29 19:11:33 +02:00

39 lines
616 B
Bash

#!/bin/bash
read_query_string() {
local \
exprgraph \
exprtime \
name \
query_data \
value \
if [ -n "$QUERY_STRING" ]
then
query_data="${QUERY_STRING//&/
}"
exprtime='[[:alnum:]-]+'
exprgraph='[[:alpha:]_]+'
while read name value
do
case $name in
start)
[[ $value =~ $exprtime ]] && start=$value
;;
end)
[[ $value =~ $exprtime ]] && end=$value
;;
hist|trend)
show_graphs=1
;;
graph)
[[ $value =~ $exprgraph ]] && graph=$value
;;
show)
[[ $value == all ]] && show_all=1
;;
esac
done <<<"${query_data//=/ }"
fi
}