summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-06-20 07:14:36 +0000
committerSteven Barth <steven@midlink.org>2009-06-20 07:14:36 +0000
commit341f757255caa08ee2922a3f32a00849e306f23c (patch)
tree3162599dc44dd392a78072a56ce69fb104f98d20 /libs/web/luasrc/dispatcher.lua
parente2f2d1a63406da4fb5ff870394035bf60760398a (diff)
Merge fixes / improvements
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r--libs/web/luasrc/dispatcher.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 73daeaf17e..71d2a5c740 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -264,7 +264,9 @@ function dispatch(request)
local user
if sdat then
- sdat = loadstring(sdat)()
+ sdat = loadstring(sdat)
+ setfenv(sdat, {})
+ sdat = sdat()
if not verifytoken or ctx.urltoken.stok == sdat.token then
user = sdat.user
end
@@ -657,18 +659,22 @@ local function _cbi(self, ...)
end
end
+ local function _resolve_path(path)
+ return type(path) == "table" and build_url(unpack(path)) or path
+ end
+
if config.on_valid_to and state and state > 0 and state < 2 then
- http.redirect(config.on_valid_to)
+ http.redirect(_resolve_path(config.on_valid_to))
return
end
if config.on_changed_to and state and state > 1 then
- http.redirect(config.on_changed_to)
+ http.redirect(_resolve_path(config.on_changed_to))
return
end
if config.on_success_to and state and state > 0 then
- http.redirect(config.on_success_to)
+ http.redirect(_resolve_path(config.on_success_to))
return
end