mirror of
https://github.com/sigmasternchen/shochu
synced 2025-03-15 07:38:55 +00:00
set all variables to local
This commit is contained in:
parent
10b8f41076
commit
2b86c44b22
7 changed files with 24 additions and 19 deletions
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
getCookie() {
|
getCookie() {
|
||||||
key="$1"
|
local key="$1"
|
||||||
echo "$HTTP_COOKIE" | tr ';' $'\n' | grep -e "^$1=" | cut -d= -f2 | sed -r 's/\s*$//g'
|
echo "$HTTP_COOKIE" | tr ';' $'\n' | grep -e "^$1=" | cut -d= -f2 | sed -r 's/\s*$//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
setCookie() {
|
setCookie() {
|
||||||
key="$1"
|
local key="$1"
|
||||||
value="$2"
|
local value="$2"
|
||||||
attributes="$3"
|
local attributes="$3"
|
||||||
header "Set-Cookie" "$key=$value; $attributes"
|
header "Set-Cookie" "$key=$value; $attributes"
|
||||||
}
|
}
|
||||||
|
|
17
mysql.sh
17
mysql.sh
|
@ -26,16 +26,15 @@ query() {
|
||||||
|
|
||||||
escape() {
|
escape() {
|
||||||
echo "$1" |
|
echo "$1" |
|
||||||
sed "s/\\/\\\\/g" |
|
sed 's/\\/\\\\/g' |
|
||||||
sed "s/'/\\'/g" |
|
sed "s/'/\\'/g" |
|
||||||
sed "s/\"/\\\"/g" |
|
sed 's/\"/\\\"/g' |
|
||||||
sed "s/\n/\\n/g" |
|
sed 's/\n/\\n/g' |
|
||||||
sed "s/\r/\\r/g" |
|
sed 's/\r/\\r/g' |
|
||||||
sed "s/\t/\\t/g" |
|
sed 's/\t/\\t/g' |
|
||||||
sed "s/\Z/\\Z/g" |
|
sed 's/\Z/\\Z/g' |
|
||||||
sed "s/\b/\\b/g" |
|
sed 's/%/\\%/g' |
|
||||||
sed "s/%/\\%/g" |
|
sed 's/_/\\_/g'
|
||||||
sed "s/_/\\_/g"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getColumns() {
|
getColumns() {
|
||||||
|
|
|
@ -20,8 +20,8 @@ _default404() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_matchPaths() {
|
_matchPaths() {
|
||||||
actual="$1"
|
local actual="$1"
|
||||||
search="$2"
|
local search="$2"
|
||||||
|
|
||||||
# TODO: add wildcards
|
# TODO: add wildcards
|
||||||
test "$actual" = "$search"
|
test "$actual" = "$search"
|
||||||
|
|
|
@ -32,8 +32,8 @@ _getSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_newSessionId() {
|
_newSessionId() {
|
||||||
base="$(date -Ins -u)"
|
local base="$(date -Ins -u)"
|
||||||
random="$RANDOM"
|
local random="$RANDOM"
|
||||||
while _getSession "$(echo "$base$random" | md5sum | cut -d' ' -f1)" > /dev/null; do
|
while _getSession "$(echo "$base$random" | md5sum | cut -d' ' -f1)" > /dev/null; do
|
||||||
random="$RANDOM"
|
random="$RANDOM"
|
||||||
done
|
done
|
||||||
|
|
2
shinden
2
shinden
|
@ -1 +1 @@
|
||||||
Subproject commit 6b398f25719243c102f7a91972966538ed23dd01
|
Subproject commit 0964fdc24ff68d84f419354f227b12cb9ff27df3
|
6
uri.sh
6
uri.sh
|
@ -17,6 +17,12 @@ queryString() {
|
||||||
|
|
||||||
_formData=""
|
_formData=""
|
||||||
|
|
||||||
|
cacheFormData() {
|
||||||
|
if test -z "$_formData"; then
|
||||||
|
_formData="$(cat)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
formData() {
|
formData() {
|
||||||
if test -z "$_formData"; then
|
if test -z "$_formData"; then
|
||||||
_formData="$(cat)"
|
_formData="$(cat)"
|
||||||
|
|
2
utils.sh
2
utils.sh
|
@ -4,7 +4,7 @@ _hasStatus=0
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
_hasStatus=1
|
_hasStatus=1
|
||||||
status="$1"
|
local status="$1"
|
||||||
echo -n "Status: $status "
|
echo -n "Status: $status "
|
||||||
case "$status" in
|
case "$status" in
|
||||||
100) echo "Continue" ;;
|
100) echo "Continue" ;;
|
||||||
|
|
Loading…
Reference in a new issue