diff options
author | Steven Barth <steven@midlink.org> | 2008-04-06 12:08:05 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-04-06 12:08:05 +0000 |
commit | 6f934c0dbe089c532e2eef8b4008618ae2945ab0 (patch) | |
tree | 11f2504337ea2d69cd64a5e1d64174e6abb26b8c /src/ffluci | |
parent | 9ba8d2aea994c832316f111354668f52de831043 (diff) |
* Added file upload capabilities
Diffstat (limited to 'src/ffluci')
-rw-r--r-- | src/ffluci/http.lua | 8 | ||||
-rw-r--r-- | src/ffluci/template.lua | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ffluci/http.lua b/src/ffluci/http.lua index b7ce92ffab..06e1c43bda 100644 --- a/src/ffluci/http.lua +++ b/src/ffluci/http.lua @@ -54,11 +54,17 @@ function request_redirect(category, module, action, ...) module = module or "index" action = action or "index" - local pattern = os.getenv("SCRIPT_NAME") .. "/%s/%s/%s" + local pattern = script_name() .. "/%s/%s/%s" redirect(pattern:format(category, module, action), ...) end +-- Returns the script name +function script_name() + return ENV.SCRIPT_NAME +end + + -- Gets form value from key function formvalue(key, default) local c = formvalues() diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua index 589f43c679..502013684b 100644 --- a/src/ffluci/template.lua +++ b/src/ffluci/template.lua @@ -29,6 +29,7 @@ require("ffluci.config") require("ffluci.util") require("ffluci.fs") require("ffluci.i18n") +require("ffluci.http") require("ffluci.model.uci") viewdir = ffluci.config.path .. "/view/" @@ -53,7 +54,7 @@ compiler_enable_bytecode = false viewns = { translate = ffluci.i18n.translate, config = function(...) return ffluci.model.uci.get(...) or "" end, - controller = os.getenv("SCRIPT_NAME"), + controller = ffluci.http.script_name(), media = ffluci.config.main.mediaurlbase, write = io.write, include = function(name) Template(name):render(getfenv(2)) end, |