diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-07-03 13:42:27 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-07-03 13:42:27 +0000 |
commit | 060b3f4716e38a69d85ce104abbc21e384fb70a5 (patch) | |
tree | 25bb69279a6459bc1558aead1c6c8dc4401cf054 /app/acf_www-controller.lua | |
parent | 5b1f815f835e543fe17d63993bf0d87b68d3f07a (diff) | |
download | acf-core-060b3f4716e38a69d85ce104abbc21e384fb70a5.tar.bz2 acf-core-060b3f4716e38a69d85ce104abbc21e384fb70a5.tar.xz |
Added debug html page. Change redirect_to_referreferrer when there's no referrer.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1271 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app/acf_www-controller.lua')
-rw-r--r-- | app/acf_www-controller.lua | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 6b1bc6e..06570a7 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -468,15 +468,22 @@ end -- If we've done something, cause a redirect to the referring page (assuming it's different) -- Also handles retrieving the result of a previously redirected action redirect_to_referrer = function(self, result) - -- If we have a result, then we did something, so we might have to redirect if result then - local prefix, controller, action = self.parse_path_info(ENV.HTTP_REFERER) - if controller ~= self.conf.controller or action ~= self.conf.action then - self.sessiondata[self.conf.action.."result"] = result - error({type="redir_to_referrer"}) + -- If we have a result, then we did something, so we might have to redirect + if not ENV.HTTP_REFERER then + -- If no referrer, we have a problem. Can't let it go through, because action + -- might not have view. So redirect to default action for this controller. + self:redirect() + else + local prefix, controller, action = self.parse_path_info(ENV.HTTP_REFERER) + if controller ~= self.conf.controller or action ~= self.conf.action then + self.sessiondata[self.conf.action.."result"] = result + error({type="redir_to_referrer"}) + end end - -- If we don't have a result, then we might be a component redirected as above elseif self.sessiondata[self.conf.action.."result"] then + -- If we don't have a result, but there's a result in the session data, + -- then we're a component redirected as above. Return the last result. result = self.sessiondata[self.conf.action.."result"] self.sessiondata[self.conf.action.."result"] = nil end |