summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-15 20:42:25 +0000
committerSteven Barth <steven@midlink.org>2008-08-15 20:42:25 +0000
commit8e4afe121087c05833ee7d567fe45f2ba270e54d (patch)
tree20d64661cd0c2bb67b2e440886ae3bae55b31f07 /libs
parent1d4196b3ff1bceaa858ffbee637bf212d5b5d428 (diff)
Several escaping fixes
Updated XML translation system Use the new Table widget for DHCP leases
Diffstat (limited to 'libs')
-rw-r--r--libs/cbi/luasrc/cbi.lua10
-rw-r--r--libs/core/luasrc/util.lua2
2 files changed, 8 insertions, 4 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index 7bcfceb2e..ab342feec 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -92,10 +92,10 @@ function Node._i18n(self, config, section, option, title, description)
-- i18n loaded?
if type(luci.i18n) == "table" then
- local key = config:gsub("[^%w]+", "")
+ local key = config and config:gsub("[^%w]+", "") or ""
if section then key = key .. "_" .. section:lower():gsub("[^%w]+", "") end
- if option then key = key .. "_" .. option:lower():gsub("[^%w]+", "") end
+ if option then key = key .. "_" .. tostring(option):lower():gsub("[^%w]+", "") end
self.title = title or luci.i18n.translate( key, option or section or config )
self.description = description or luci.i18n.translate( key .. "_desc", "" )
@@ -483,13 +483,15 @@ Table = class(AbstractSection)
function Table.__init__(self, form, data, ...)
local datasource = {}
+ datasource.config = "table"
self.data = data
function datasource.get(self, section, option)
- return data[option]
+ return data[section][option]
end
- AbstractSection.__init__(self, datasource, nil, ...)
+ AbstractSection.__init__(self, datasource, "table", ...)
+ self.template = "cbi/tblsection"
end
function Table.cfgsections(self)
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua
index 51d66e08e..ef1b8fe27 100644
--- a/libs/core/luasrc/util.lua
+++ b/libs/core/luasrc/util.lua
@@ -199,6 +199,8 @@ end
-- @param value String value containing the data to escape
-- @return String value containing the escaped data
function pcdata(value)
+ if not value then return end
+ value = tostring(value)
value = value:gsub("&", "&amp;")
value = value:gsub('"', "&quot;")
value = value:gsub("'", "&apos;")