diff options
author | Steven Barth <steven@midlink.org> | 2008-06-05 19:16:38 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-05 19:16:38 +0000 |
commit | dd9606825da5d73883b8313f5af905ea1b2a4d7d (patch) | |
tree | 1f853ae56dd8e3051698ac6d0a38d61bf6d6997f /applications/luci-splash/root/usr/lib | |
parent | 75f3dbaa6136a1288fbe92d80fc127f5228f5d64 (diff) |
* Merged Luci to use native UCI-library
Diffstat (limited to 'applications/luci-splash/root/usr/lib')
-rw-r--r-- | applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi | 34 |
1 files changed, 18 insertions, 16 deletions
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") |