From 84db09d81e4a9627b9467a9dfb205e75baf926e2 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 22 Apr 2008 19:44:45 +0000 Subject: Fixed automatic redirection to include prefix git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1033 ab2d0c66-481e-0410-8bed-d214d4d58bed --- www/cgi-bin/mvc.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'www') diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index 2b7c8b4..1fa88da 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -115,21 +115,24 @@ dispatch = function (self, userprefix, userctlr, useraction) local controller = nil local action = "" self.conf.default_controller = self.conf.default_controller or "" + self.conf.default_prefix = self.conf.default_prefix or "" if "" == self.conf.controller then + self.conf.prefix = self.conf.default_prefix self.conf.controller = self.conf.default_controller self.conf.action = "" end while "" ~= self.conf.controller do -- We now know the controller / action combo, check if we're allowed to do it local perm = true + local worker_loaded = false if type(self.worker.mvc.check_permission) == "function" then perm = self.worker.mvc.check_permission(self, self.conf.controller) end if perm then - controller = self:new(self.conf.prefix .. self.conf.controller) + controller, worker_loaded = self:new(self.conf.prefix .. self.conf.controller) end - if controller then + if worker_loaded then controller.conf.default_action = controller.conf.default_action or "" action = controller.conf.action or "" if "" == action then @@ -161,6 +164,7 @@ dispatch = function (self, userprefix, userctlr, useraction) controller = nil self.conf.action = "" if self.conf.controller ~= self.conf.default_controller then + self.conf.prefix = self.conf.default_prefix self.conf.controller = self.conf.default_controller else self.conf.controller = "" -- cgit v1.2.3