From dd9606825da5d73883b8313f5af905ea1b2a4d7d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 5 Jun 2008 19:16:38 +0000 Subject: * Merged Luci to use native UCI-library --- .../usr/lib/luci-splash/htdocs/cgi-bin/index.cgi | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'applications/luci-splash/root/usr/lib') diff --git a/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi b/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi index 545233d8d9..22cab67cc8 100644 --- a/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi +++ b/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi @@ -1,31 +1,33 @@ #!/usr/bin/haserl --shell=luac -package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path -package.cpath = "/usr/lib/lua/?.so;" .. package.cpath require("luci.http") require("luci.sys") require("luci.model.uci") +luci.model.uci.set_savedir(luci.model.uci.savedir_state) + local srv local net local ip = luci.http.env.REMOTE_ADDR -for k, v in pairs(luci.model.uci.sections("network")) do - if v[".type"] == "interface" and v.ipaddr then - local p = luci.sys.net.mask4prefix(v.netmask) - if luci.sys.net.belongs(ip, v.ipaddr, p) then - net = k - srv = v.ipaddr - break +luci.model.uci.foreach("network", "interface", + function (section) + if section.ipaddr then + local p = luci.sys.net.mask4prefix(section.netmask) + if luci.sys.net.belongs(ip, section.ipaddr, p) then + net = section[".name"] + srv = section.ipaddr + return + end end - end -end + end) local stat = false -for k, v in pairs(luci.model.uci.sections("luci_splash")) do - if v[".type"] == "iface" and v.network == net then - stat = true - end -end +luci.model.uci.foreach("luci_splash", "iface", + function (section) + if section.network == net then + stat = true + end + end) if not srv then luci.http.prepare_content("text/plain") -- cgit v1.2.3