Merge fixes / improvements

This commit is contained in:
Steven Barth 2009-06-20 07:14:36 +00:00
parent e2f2d1a634
commit 341f757255
2 changed files with 15 additions and 4 deletions

View file

@ -1287,6 +1287,11 @@ function AbstractValue.parse(self, section, novld)
else else
self.error = { [section] = "invalid" } self.error = { [section] = "invalid" }
end end
if self.section.error then
table.insert(self.section.error[section], "invalid")
else
self.section.error = {[section] = {"invalid"}}
end
self.map.save = false self.map.save = false
end end
if fvalue and not (fvalue == cvalue) then if fvalue and not (fvalue == cvalue) then

View file

@ -264,7 +264,9 @@ function dispatch(request)
local user local user
if sdat then if sdat then
sdat = loadstring(sdat)() sdat = loadstring(sdat)
setfenv(sdat, {})
sdat = sdat()
if not verifytoken or ctx.urltoken.stok == sdat.token then if not verifytoken or ctx.urltoken.stok == sdat.token then
user = sdat.user user = sdat.user
end end
@ -657,18 +659,22 @@ local function _cbi(self, ...)
end end
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 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 return
end end
if config.on_changed_to and state and state > 1 then 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 return
end end
if config.on_success_to and state and state > 0 then 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 return
end end