|
|
|
@ -401,22 +401,38 @@ SetWebUILayout() {
|
|
|
|
|
change_setting "WEBUIBOXEDLAYOUT" "${args[2]}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CheckUrl(){
|
|
|
|
|
local regex
|
|
|
|
|
# Check for characters NOT allowed in URLs
|
|
|
|
|
regex="[^a-zA-Z0-9:/?&%=~._-]"
|
|
|
|
|
if [[ "${1}" =~ ${regex} ]]; then
|
|
|
|
|
return 1
|
|
|
|
|
else
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomizeAdLists() {
|
|
|
|
|
local address
|
|
|
|
|
address="${args[3]}"
|
|
|
|
|
local comment
|
|
|
|
|
comment="${args[4]}"
|
|
|
|
|
|
|
|
|
|
if [[ "${args[2]}" == "enable" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 1 WHERE address = '${address}'"
|
|
|
|
|
elif [[ "${args[2]}" == "disable" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 0 WHERE address = '${address}'"
|
|
|
|
|
elif [[ "${args[2]}" == "add" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "INSERT OR IGNORE INTO adlist (address, comment) VALUES ('${address}', '${comment}')"
|
|
|
|
|
elif [[ "${args[2]}" == "del" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "DELETE FROM adlist WHERE address = '${address}'"
|
|
|
|
|
if CheckUrl "${address}"; then
|
|
|
|
|
if [[ "${args[2]}" == "enable" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 1 WHERE address = '${address}'"
|
|
|
|
|
elif [[ "${args[2]}" == "disable" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "UPDATE adlist SET enabled = 0 WHERE address = '${address}'"
|
|
|
|
|
elif [[ "${args[2]}" == "add" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "INSERT OR IGNORE INTO adlist (address, comment) VALUES ('${address}', '${comment}')"
|
|
|
|
|
elif [[ "${args[2]}" == "del" ]]; then
|
|
|
|
|
sqlite3 "${gravityDBfile}" "DELETE FROM adlist WHERE address = '${address}'"
|
|
|
|
|
else
|
|
|
|
|
echo "Not permitted"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "Not permitted"
|
|
|
|
|
echo "Invalid Url"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|