summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-splash/luasrc/controller/splash
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-27 12:23:39 +0000
committerSteven Barth <steven@midlink.org>2008-05-27 12:23:39 +0000
commitd35a620e9f5665a94967f4bd02c93581a1dd7e00 (patch)
treecbe7a9b9fe71e40d850c649361c87608d56ea48b /applications/luci-splash/luasrc/controller/splash
parent5df565faba5eb0c26a7ce0e2d6e9092bf71cb1e8 (diff)
commit 4f6198094cf4134179d1f9c9fa8f79759a27c87e
Author: Felix Fietkau <nbd@openwrt.org> Date: Tue May 27 13:56:12 2008 +0200 rename src/ to luasrc/
Diffstat (limited to 'applications/luci-splash/luasrc/controller/splash')
-rw-r--r--applications/luci-splash/luasrc/controller/splash/splash.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/applications/luci-splash/luasrc/controller/splash/splash.lua b/applications/luci-splash/luasrc/controller/splash/splash.lua
new file mode 100644
index 0000000000..544f1e89ea
--- /dev/null
+++ b/applications/luci-splash/luasrc/controller/splash/splash.lua
@@ -0,0 +1,30 @@
+module("luci.controller.splash.splash", package.seeall)
+
+function index()
+ local page = node("admin", "services", "splash")
+ page.target = cbi("splash/splash")
+ page.title = "Client-Splash"
+
+ node("splash", "splash", "activate").target = action_activate
+ node("splash", "splash", "allowed").target = action_allowed
+ node("splash", "splash", "unknown").target = action_unknown
+ node("splash", "splash", "splash").target = template("splash_splash/splash")
+end
+
+function action_activate()
+ local mac = luci.sys.net.ip4mac(luci.http.env.REMOTE_ADDR)
+ if mac and luci.http.formvalue("accept") then
+ os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
+ luci.http.redirect(luci.model.uci.get("freifunk", "community", "homepage"))
+ else
+ luci.http.redirect(luci.dispatcher.build_url())
+ end
+end
+
+function action_allowed()
+ luci.http.redirect(luci.dispatcher.build_url())
+end
+
+function action_unknown()
+ luci.http.redirect(luci.dispatcher.build_url())
+end \ No newline at end of file