summaryrefslogtreecommitdiffstats
path: root/dansguardian-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'dansguardian-model.lua')
-rw-r--r--dansguardian-model.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/dansguardian-model.lua b/dansguardian-model.lua
index 7fbabb4..2a5c7cd 100644
--- a/dansguardian-model.lua
+++ b/dansguardian-model.lua
@@ -107,12 +107,12 @@ mymodule.read_general_config = function()
if config.proxyport then retval.proxyport.value = config.proxyport end
if config.accessdeniedaddress then retval.accessdeniedaddress.value = string.sub(config.accessdeniedaddress, 2, -2) end
end
-
+
config = format.parse_ini_file(fs.read_file(dansguardiancfg2) or "", "")
if config then
if config.naughtynesslimit then retval.naughtynesslimit.value = config.naughtynesslimit end
end
-
+
return cfe({ type="group", value=retval, label="Dansguardian General Config" })
end
@@ -121,7 +121,7 @@ mymodule.update_general_config = function(self, config)
if success then
local text = fs.read_file(dansguardiancfg) or ""
-
+
text = format.update_ini_file(text, "", "filterip", config.value.filterip.value)
text = format.update_ini_file(text, "", "filterport", config.value.filterport.value)
text = format.update_ini_file(text, "", "proxyip", config.value.proxyip.value)
@@ -135,7 +135,7 @@ mymodule.update_general_config = function(self, config)
else
config.errtxt = "Failed to set config"
end
-
+
return config
end
@@ -176,7 +176,7 @@ get_categories = function()
local retval = {}
local entries = posix.dir( baseurl .. "/phraselists" )
-
+
for k,v in ipairs( entries ) do
local attrs = posix.stat( baseurl .. "/phraselists/" .. v )
@@ -186,7 +186,7 @@ get_categories = function()
for k1,v1 in pairs(posix.dir( baseurl .. "/phraselists/" .. v )) do
if not string.match(v1, "^%.") then
local active
- if (categoryfilecontent[string.match(v1,'%w*')][baseurl .. "/phraselists/" .. v .."/" .. v1]) then
+ if (categoryfilecontent[string.match(v1,'%w*')][baseurl .. "/phraselists/" .. v .."/" .. v1]) then
active = true
someactive = true
end
@@ -196,14 +196,14 @@ get_categories = function()
table.insert( retval, {name=v, option=entrycontent, active=someactive} )
end
end
-
+
return retval
end
get_category = function(category, object)
local filename = baseurl .. "/phraselists/" .. category .. "/" .. object
- if not (categoryfilecontent[string.match(object,'%w*')]) or
+ if not (categoryfilecontent[string.match(object,'%w*')]) or
not (fs.is_file(filename)) or
not (validator.is_valid_filename(filename, baseurl)) then
return nil, "Something went wrong."