From 95e743197047cc4c2550563ea8ef323c9b1230fd Mon Sep 17 00:00:00 2001 From: Nathan Angelacos Date: Sun, 9 Nov 2008 00:27:32 +0000 Subject: per-controller auditing now allowed via acf-hooks.lua git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1582 ab2d0c66-481e-0410-8bed-d214d4d58bed --- www/cgi-bin/mvc.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'www/cgi-bin/mvc.lua') diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index aef3547..4ded73d 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -260,6 +260,20 @@ read_config = function( self, appname ) break end end + + if (#self.conf.confdir) then -- check for an appname-hooks.lua file + self.conf.app_hooks = {} + setmetatable (self.conf.app_hooks, {__index = _G}) + + -- loadfile loads into the global environment + -- so we set env 0, not env 1 + setfenv (0, self.conf.app_hooks) + local f = loadfile(self.conf.confdir .. "/" .. appname.. "-hooks.lua") + if (f) then f() end + setfenv (0, _G) + -- setmetatable (self.conf.app_hooks, {}) + end + end -- parse a "URI" like string into a prefix, controller and action -- cgit v1.2.3