diff options
Diffstat (limited to 'dansguardian-model.lua')
-rw-r--r-- | dansguardian-model.lua | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/dansguardian-model.lua b/dansguardian-model.lua index f313eec..5289ee3 100644 --- a/dansguardian-model.lua +++ b/dansguardian-model.lua @@ -74,12 +74,32 @@ get_general_config = function() end fptr:close() else - error = "Failed to open /etc/dansguardian/dansguardian.conf file!" + error = "Failed to open " .. dansguardiancfg .. " file!" end return retval, error end +get_plain_config = function() + + local retval = "" + local error = "" + + local fptr = io.open( dansguardiancfg, "r" ) + if fptr ~= nil then + retval = fptr:read( "*a" ) + fptr:close() + if retval == nil then + retval = "" + error = "Failed to read " .. dansguardiancfg .. " file!" + end + else + error = "Failed to open " .. dansguardiancfg .. " file!" + end + + return retval, error +end + update_general_config = function( config ) local retval = "" @@ -126,6 +146,23 @@ update_general_config = function( config ) return retval end +update_plain_config = function( config ) + + local retval = "" + local cfgptr = -1 + local error = "" + + cfgptr = io.open( dansguardiancfg, "wb+" ) + if cfgptr ~= nil then + cfgptr:write( config ) + cfgptr:close() + else + retval = "Failed to open " .. dansguardiancfg .. " file!" + end + + return retval +end + get_cfg_value = function( str ) local retval = "" |