2008-05-25 17:00:30 +00:00
|
|
|
module("luci.controller.splash.splash", package.seeall)
|
2008-04-27 11:16:31 +00:00
|
|
|
|
2008-05-22 14:04:03 +00:00
|
|
|
function index()
|
|
|
|
local page = node("admin", "services", "splash")
|
|
|
|
page.target = cbi("splash/splash")
|
|
|
|
page.title = "Client-Splash"
|
|
|
|
|
2008-05-27 20:39:48 +00:00
|
|
|
node("splash", "splash", "activate").target = call("action_activate")
|
|
|
|
node("splash", "splash", "allowed").target = call("action_allowed")
|
|
|
|
node("splash", "splash", "unknown").target = call("action_unknown")
|
2008-05-22 14:04:03 +00:00
|
|
|
node("splash", "splash", "splash").target = template("splash_splash/splash")
|
|
|
|
end
|
|
|
|
|
2008-04-27 11:16:31 +00:00
|
|
|
function action_activate()
|
2008-06-14 14:12:12 +00:00
|
|
|
local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR"))
|
2008-05-25 17:00:30 +00:00
|
|
|
if mac and luci.http.formvalue("accept") then
|
2008-04-27 16:12:24 +00:00
|
|
|
os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
|
2008-05-25 17:00:30 +00:00
|
|
|
luci.http.redirect(luci.model.uci.get("freifunk", "community", "homepage"))
|
2008-04-27 16:12:24 +00:00
|
|
|
else
|
2008-05-25 17:00:30 +00:00
|
|
|
luci.http.redirect(luci.dispatcher.build_url())
|
2008-04-27 16:12:24 +00:00
|
|
|
end
|
2008-04-27 11:16:31 +00:00
|
|
|
end
|
|
|
|
|
2008-05-22 14:04:03 +00:00
|
|
|
function action_allowed()
|
2008-05-25 17:00:30 +00:00
|
|
|
luci.http.redirect(luci.dispatcher.build_url())
|
2008-04-27 11:16:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function action_unknown()
|
2008-05-25 17:00:30 +00:00
|
|
|
luci.http.redirect(luci.dispatcher.build_url())
|
2008-04-27 11:16:31 +00:00
|
|
|
end
|