diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-11-17 19:47:28 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-11-17 19:47:28 +0000 |
commit | 6a6e0c812beafc4a2b6304c8b17fae317035a898 (patch) | |
tree | f320e6826e3677597b517ba2cbdae9c3f71e2793 /www/cgi-bin | |
parent | 63c4b0abf1bfb922d6497a816108c35b971a1d2d (diff) | |
download | acf-core-6a6e0c812beafc4a2b6304c8b17fae317035a898.tar.bz2 acf-core-6a6e0c812beafc4a2b6304c8b17fae317035a898.tar.xz |
Modified mvc to create a stack of self pointers as controllers are created. Modelfunctions write_file_with_audit uses the stack to find self for auditing.release-0.4.12
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1595 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'www/cgi-bin')
-rwxr-xr-x | www/cgi-bin/mvc.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index 4ded73d..a36878c 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -93,6 +93,10 @@ new = function (self, modname) c.worker.mvc.on_load = nil end + -- save the new self on the SELF stack + if not SELF then SELF = {} end + SELF[#SELF + 1] = c + return c, worker_loaded, model_loaded end @@ -101,6 +105,16 @@ destroy = function (self) self.worker.mvc.on_unload(self) self.worker.mvc.on_unload = nil end + + -- remove the self from the SELF stack (should be at the end, but just in case) + if SELF then + for i,s in ipairs(SELF) do + if s == self then + table.remove(SELF, i) + break + end + end + end end -- This is a sample front controller/dispatch. |