summaryrefslogtreecommitdiffhomepage
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/bits.lua2
-rw-r--r--core/src/cbi.lua70
-rw-r--r--core/src/config.lua18
-rw-r--r--core/src/debug.lua2
-rw-r--r--core/src/dispatcher.lua62
-rw-r--r--core/src/fs.lua4
-rw-r--r--core/src/http.lua8
-rw-r--r--core/src/i18n.lua10
-rw-r--r--core/src/init.lua6
-rw-r--r--core/src/menu.lua20
-rw-r--r--core/src/model/ipkg.lua20
-rw-r--r--core/src/model/uci.lua8
-rw-r--r--core/src/model/uci/libuci.lua16
-rw-r--r--core/src/model/uci/wrapper.lua16
-rw-r--r--core/src/sys.lua52
-rw-r--r--core/src/sys/iptparser.lua16
-rw-r--r--core/src/template.lua52
-rw-r--r--core/src/util.lua4
-rw-r--r--core/src/view/cbi/header.htm2
-rw-r--r--core/src/view/cbi/mvalue.htm4
-rw-r--r--core/src/view/error404.htm2
-rw-r--r--core/src/view/footer.htm2
-rw-r--r--core/src/view/header.htm26
23 files changed, 211 insertions, 211 deletions
diff --git a/core/src/bits.lua b/core/src/bits.lua
index f8434c335..13b4c3066 100644
--- a/core/src/bits.lua
+++ b/core/src/bits.lua
@@ -50,7 +50,7 @@
--]]
-module("ffluci.bits", package.seeall);
+module("luci.bits", package.seeall);
local hex2bin = {
["0"] = "0000",
diff --git a/core/src/cbi.lua b/core/src/cbi.lua
index 8a623b62c..b7097b5d9 100644
--- a/core/src/cbi.lua
+++ b/core/src/cbi.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Configuration Bind Interface
+LuCI - Configuration Bind Interface
Description:
Offers an interface for binding confiugration values to certain
@@ -24,35 +24,35 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.cbi", package.seeall)
+module("luci.cbi", package.seeall)
-require("ffluci.template")
-require("ffluci.util")
-require("ffluci.http")
-require("ffluci.model.uci")
+require("luci.template")
+require("luci.util")
+require("luci.http")
+require("luci.model.uci")
-local class = ffluci.util.class
-local instanceof = ffluci.util.instanceof
+local class = luci.util.class
+local instanceof = luci.util.instanceof
-- Loads a CBI map from given file, creating an environment and returns it
function load(cbimap)
- require("ffluci.fs")
- require("ffluci.i18n")
- require("ffluci.config")
- require("ffluci.sys")
+ require("luci.fs")
+ require("luci.i18n")
+ require("luci.config")
+ require("luci.sys")
- local cbidir = ffluci.sys.libpath() .. "/model/cbi/"
+ local cbidir = luci.sys.libpath() .. "/model/cbi/"
local func, err = loadfile(cbidir..cbimap..".lua")
if not func then
return nil
end
- ffluci.i18n.loadc("cbi")
+ luci.i18n.loadc("cbi")
- ffluci.util.resfenv(func)
- ffluci.util.updfenv(func, ffluci.cbi)
- ffluci.util.extfenv(func, "translate", ffluci.i18n.translate)
+ luci.util.resfenv(func)
+ luci.util.updfenv(func, luci.cbi)
+ luci.util.extfenv(func, "translate", luci.i18n.translate)
local map = func()
@@ -91,7 +91,7 @@ function Node.render(self, scope)
scope = scope or {}
scope.self = self
- ffluci.template.render(self.template, scope)
+ luci.template.render(self.template, scope)
end
-- Render the children
@@ -122,7 +122,7 @@ function Map.__init__(self, config, ...)
Node.__init__(self, ...)
self.config = config
self.template = "cbi/map"
- self.uci = ffluci.model.uci.Session()
+ self.uci = luci.model.uci.Session()
self.ucidata, self.uciorder = self.uci:sections(self.config)
if not self.ucidata or not self.uciorder then
error("Unable to read UCI data: " .. self.config)
@@ -242,7 +242,7 @@ function AbstractSection.parse_optionals(self, section)
self.optionals[section] = {}
- local field = ffluci.http.formvalue("cbi.opt."..self.config.."."..section)
+ local field = luci.http.formvalue("cbi.opt."..self.config.."."..section)
for k,v in ipairs(self.children) do
if v.optional and not v:cfgvalue(section) then
if field == v.option then
@@ -270,8 +270,8 @@ function AbstractSection.parse_dynamic(self, section)
return
end
- local arr = ffluci.util.clone(self:cfgvalue(section))
- local form = ffluci.http.formvaluetable("cbid."..self.config.."."..section)
+ local arr = luci.util.clone(self:cfgvalue(section))
+ local form = luci.http.formvaluetable("cbid."..self.config.."."..section)
for k, v in pairs(form) do
arr[k] = v
end
@@ -329,11 +329,11 @@ function NamedSection.parse(self)
if self.addremove then
local path = self.config.."."..s
if active then -- Remove the section
- if ffluci.http.formvalue("cbi.rns."..path) and self:remove(s) then
+ if luci.http.formvalue("cbi.rns."..path) and self:remove(s) then
return
end
else -- Create and apply default values
- if ffluci.http.formvalue("cbi.cns."..path) and self:create(s) then
+ if luci.http.formvalue("cbi.cns."..path) and self:create(s) then
for k,v in pairs(self.children) do
v:write(s, v.default)
end
@@ -343,7 +343,7 @@ function NamedSection.parse(self)
if active then
AbstractSection.parse_dynamic(self, s)
- if ffluci.http.formvalue("cbi.submit") then
+ if luci.http.formvalue("cbi.submit") then
Node.parse(self, s)
end
AbstractSection.parse_optionals(self, s)
@@ -413,7 +413,7 @@ function TypedSection.parse(self)
if self.addremove then
-- Create
local crval = "cbi.cts." .. self.config .. "." .. self.sectiontype
- local name = ffluci.http.formvalue(crval)
+ local name = luci.http.formvalue(crval)
if self.anonymous then
if name then
self:create()
@@ -439,7 +439,7 @@ function TypedSection.parse(self)
-- Remove
crval = "cbi.rts." .. self.config
- name = ffluci.http.formvaluetable(crval)
+ name = luci.http.formvaluetable(crval)
for k,v in pairs(name) do
if self:cfgvalue(k) and self:checkscope(k) then
self:remove(k)
@@ -449,7 +449,7 @@ function TypedSection.parse(self)
for i, k in ipairs(self:cfgsections()) do
AbstractSection.parse_dynamic(self, k)
- if ffluci.http.formvalue("cbi.submit") then
+ if luci.http.formvalue("cbi.submit") then
Node.parse(self, k)
end
AbstractSection.parse_optionals(self, k)
@@ -522,13 +522,13 @@ end
-- Return whether this object should be created
function AbstractValue.formcreated(self, section)
local key = "cbi.opt."..self.config.."."..section
- return (ffluci.http.formvalue(key) == self.option)
+ return (luci.http.formvalue(key) == self.option)
end
-- Returns the formvalue for this object
function AbstractValue.formvalue(self, section)
local key = "cbid."..self.map.config.."."..section.."."..self.option
- return ffluci.http.formvalue(key)
+ return luci.http.formvalue(key)
end
function AbstractValue.parse(self, section)
@@ -605,7 +605,7 @@ function Value.validate(self, val)
val = nil
end
- return ffluci.util.validate(val, self.isnumber, self.isinteger)
+ return luci.util.validate(val, self.isnumber, self.isinteger)
end
@@ -623,7 +623,7 @@ function DummyValue.parse(self)
end
function DummyValue.render(self, s)
- ffluci.template.render(self.template, {self=self, section=s})
+ luci.template.render(self.template, {self=self, section=s})
end
@@ -684,7 +684,7 @@ function ListValue.value(self, key, val)
end
function ListValue.validate(self, val)
- if ffluci.util.contains(self.keylist, val) then
+ if luci.util.contains(self.keylist, val) then
return val
else
return nil
@@ -723,7 +723,7 @@ function MultiValue.valuelist(self, section)
return {}
end
- return ffluci.util.split(val, self.delimiter)
+ return luci.util.split(val, self.delimiter)
end
function MultiValue.validate(self, val)
@@ -734,7 +734,7 @@ function MultiValue.validate(self, val)
local result = ""
for value in val:gmatch("[^\n]+") do
- if ffluci.util.contains(self.keylist, value) then
+ if luci.util.contains(self.keylist, value) then
result = result .. self.delimiter .. value
end
end
diff --git a/core/src/config.lua b/core/src/config.lua
index 0db45ac89..854b12814 100644
--- a/core/src/config.lua
+++ b/core/src/config.lua
@@ -1,8 +1,8 @@
--[[
-FFLuCI - Configuration
+LuCI - Configuration
Description:
-Some FFLuCI configuration values read from uci file "luci"
+Some LuCI configuration values read from uci file "luci"
FileId:
@@ -25,16 +25,16 @@ limitations under the License.
]]--
-module("ffluci.config", package.seeall)
-require("ffluci.model.uci")
-require("ffluci.util")
-require("ffluci.sys")
+module("luci.config", package.seeall)
+require("luci.model.uci")
+require("luci.util")
+require("luci.sys")
-- Warning! This is only for fallback and compatibility purporses! --
main = {}
-- This is where stylesheets and images go
-main.mediaurlbase = "/ffluci/media"
+main.mediaurlbase = "/luci/media"
-- Does anybody think about browser autodetect here?
-- Too bad busybox doesn't populate HTTP_ACCEPT_LANGUAGE
@@ -42,7 +42,7 @@ main.lang = "de"
-- Now overwrite with UCI values
-local ucidata = ffluci.model.uci.sections("luci")
+local ucidata = luci.model.uci.sections("luci")
if ucidata then
- ffluci.util.update(ffluci.config, ucidata)
+ luci.util.update(luci.config, ucidata)
end \ No newline at end of file
diff --git a/core/src/debug.lua b/core/src/debug.lua
index 1be40348e..a56400f34 100644
--- a/core/src/debug.lua
+++ b/core/src/debug.lua
@@ -1,2 +1,2 @@
-module("ffluci.debug", package.seeall)
+module("luci.debug", package.seeall)
__file__ = debug.getinfo(1, 'S').source:sub(2) \ No newline at end of file
diff --git a/core/src/dispatcher.lua b/core/src/dispatcher.lua
index fce0ce294..daf975e9d 100644
--- a/core/src/dispatcher.lua
+++ b/core/src/dispatcher.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Dispatcher
+LuCI - Dispatcher
Description:
The request dispatcher and module dispatcher generators
@@ -23,10 +23,10 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.dispatcher", package.seeall)
-require("ffluci.http")
-require("ffluci.sys")
-require("ffluci.fs")
+module("luci.dispatcher", package.seeall)
+require("luci.http")
+require("luci.sys")
+require("luci.fs")
-- Local dispatch database
local tree = {nodes={}}
@@ -40,17 +40,17 @@ dispatched = nil
-- Builds a URL
function build_url(...)
- return ffluci.http.dispatcher() .. "/" .. table.concat(arg, "/")
+ return luci.http.dispatcher() .. "/" .. table.concat(arg, "/")
end
-- Sends a 404 error code and renders the "error404" template if available
function error404(message)
- ffluci.http.status(404, "Not Found")
+ luci.http.status(404, "Not Found")
message = message or "Not Found"
- require("ffluci.template")
- if not pcall(ffluci.template.render, "error404") then
- ffluci.http.prepare_content("text/plain")
+ require("luci.template")
+ if not pcall(luci.template.render, "error404") then
+ luci.http.prepare_content("text/plain")
print(message)
end
return false
@@ -58,11 +58,11 @@ end
-- Sends a 500 error code and renders the "error500" template if available
function error500(message)
- ffluci.http.status(500, "Internal Server Error")
+ luci.http.status(500, "Internal Server Error")
- require("ffluci.template")
- if not pcall(ffluci.template.render, "error500", {message=message}) then
- ffluci.http.prepare_content("text/plain")
+ require("luci.template")
+ if not pcall(luci.template.render, "error500", {message=message}) then
+ luci.http.prepare_content("text/plain")
print(message)
end
return false
@@ -70,7 +70,7 @@ end
-- Dispatches a request depending on the PATH_INFO variable
function httpdispatch()
- local pathinfo = ffluci.http.env.PATH_INFO or ""
+ local pathinfo = luci.http.env.PATH_INFO or ""
local c = tree
for s in pathinfo:gmatch("/([%w-]+)") do
@@ -97,15 +97,15 @@ function dispatch()
if track.i18n then
- require("ffluci.i18n").loadc(track.i18n)
+ require("luci.i18n").loadc(track.i18n)
end
if track.setgroup then
- ffluci.sys.process.setgroup(track.setgroup)
+ luci.sys.process.setgroup(track.setgroup)
end
if track.setuser then
- ffluci.sys.process.setuser(track.setuser)
+ luci.sys.process.setuser(track.setuser)
end
@@ -124,20 +124,20 @@ end
-- Calls the index function of all available controllers
function createindex()
- local root = ffluci.sys.libpath() .. "/controller/"
+ local root = luci.sys.libpath() .. "/controller/"
local suff = ".lua"
- local controllers = ffluci.util.combine(
- ffluci.fs.glob(root .. "*" .. suff),
- ffluci.fs.glob(root .. "*/*" .. suff)
+ local controllers = luci.util.combine(
+ luci.fs.glob(root .. "*" .. suff),
+ luci.fs.glob(root .. "*/*" .. suff)
)
for i,c in ipairs(controllers) do
- c = "ffluci.controller." .. c:sub(#root+1, #c-#suff):gsub("/", ".")
+ c = "luci.controller." .. c:sub(#root+1, #c-#suff):gsub("/", ".")
stat, mod = pcall(require, c)
if stat and mod and type(mod.index) == "function" then
- ffluci.util.updfenv(mod.index, ffluci.dispatcher)
+ luci.util.updfenv(mod.index, luci.dispatcher)
pcall(mod.index)
end
end
@@ -188,16 +188,16 @@ function alias(...)
end
function template(name)
- require("ffluci.template")
- return function() ffluci.template.render(name) end
+ require("luci.template")
+ return function() luci.template.render(name) end
end
function cbi(model)
- require("ffluci.cbi")
- require("ffluci.template")
+ require("luci.cbi")
+ require("luci.template")
return function()
- local stat, res = pcall(ffluci.cbi.load, model)
+ local stat, res = pcall(luci.cbi.load, model)
if not stat then
error500(res)
return true
@@ -209,8 +209,8 @@ function cbi(model)
return true
end
- ffluci.template.render("cbi/header")
+ luci.template.render("cbi/header")
res:render()
- ffluci.template.render("cbi/footer")
+ luci.template.render("cbi/footer")
end
end
diff --git a/core/src/fs.lua b/core/src/fs.lua
index fc47287b9..5c1f2a051 100644
--- a/core/src/fs.lua
+++ b/core/src/fs.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Filesystem tools
+LuCI - Filesystem tools
Description:
A module offering often needed filesystem manipulation functions
@@ -24,7 +24,7 @@ limitations under the License.
]]--
-module("ffluci.fs", package.seeall)
+module("luci.fs", package.seeall)
require("posix")
diff --git a/core/src/http.lua b/core/src/http.lua
index f4ba57094..fa8821c5a 100644
--- a/core/src/http.lua
+++ b/core/src/http.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - HTTP-Interaction
+LuCI - HTTP-Interaction
Description:
HTTP-Header manipulator and form variable preprocessor
@@ -27,10 +27,10 @@ limitations under the License.
]]--
-module("ffluci.http", package.seeall)
+module("luci.http", package.seeall)
if ENV and ENV.HASERLVER then
- require("ffluci.sgi.haserl")
+ require("luci.sgi.haserl")
elseif webuci then
- require("ffluci.sgi.webuci")
+ require("luci.sgi.webuci")
end \ No newline at end of file
diff --git a/core/src/i18n.lua b/core/src/i18n.lua
index 4e4187308..3a8a9a6c7 100644
--- a/core/src/i18n.lua
+++ b/core/src/i18n.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Internationalisation
+LuCI - Internationalisation
Description:
A very minimalistic but yet effective internationalisation module
@@ -24,11 +24,11 @@ limitations under the License.
]]--
-module("ffluci.i18n", package.seeall)
-require("ffluci.sys")
+module("luci.i18n", package.seeall)
+require("luci.sys")
table = {}
-i18ndir = ffluci.sys.libpath() .. "/i18n/"
+i18ndir = luci.sys.libpath() .. "/i18n/"
-- Clears the translation table
function clear()
@@ -49,7 +49,7 @@ end
-- Same as load but autocompletes the filename with .LANG from config.lang
function loadc(file)
- return load(file .. "." .. require("ffluci.config").main.lang)
+ return load(file .. "." .. require("luci.config").main.lang)
end
-- Returns the i18n-value defined by "key" or if there is no such: "default"
diff --git a/core/src/init.lua b/core/src/init.lua
index 7af43c736..ce52d0aad 100644
--- a/core/src/init.lua
+++ b/core/src/init.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Freifunk Lua Configuration Interface
+LuCI - Lua Configuration Interface
Description:
Main class
@@ -23,7 +23,7 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci", package.seeall)
+module("luci", package.seeall)
__version__ = "0.5"
-__appname__ = "FFLuCI"
+__appname__ = "LuCI"
diff --git a/core/src/menu.lua b/core/src/menu.lua
index 9328e332c..30cc5a122 100644
--- a/core/src/menu.lua
+++ b/core/src/menu.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Menu Builder
+LuCI - Menu Builder
Description:
Collects menu building information from controllers
@@ -23,21 +23,21 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.menu", package.seeall)
+module("luci.menu", package.seeall)
-require("ffluci.fs")
-require("ffluci.util")
-require("ffluci.sys")
-require("ffluci.dispatcher")
+require("luci.fs")
+require("luci.util")
+require("luci.sys")
+require("luci.dispatcher")
-- Default modelpath
-modelpattern = ffluci.sys.libpath() .. "/model/menu/*.lua"
+modelpattern = luci.sys.libpath() .. "/model/menu/*.lua"
-- Menu definition extra scope
scope = {
- translate = function(...) return require("ffluci.i18n").translate(...) end,
- loadtrans = function(...) return require("ffluci.i18n").loadc(...) end,
- isfile = ffluci.fs.isfile
+ translate = function(...) return require("luci.i18n").translate(...) end,
+ loadtrans = function(...) return require("luci.i18n").loadc(...) end,
+ isfile = luci.fs.isfile
}
-- Returns the menu information
diff --git a/core/src/model/ipkg.lua b/core/src/model/ipkg.lua
index 3b149fb16..e95a2620a 100644
--- a/core/src/model/ipkg.lua
+++ b/core/src/model/ipkg.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - IPKG wrapper library
+LuCI - IPKG wrapper library
Description:
Wrapper for the ipkg Package manager
@@ -25,9 +25,9 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.model.ipkg", package.seeall)
-require("ffluci.sys")
-require("ffluci.util")
+module("luci.model.ipkg", package.seeall)
+require("luci.sys")
+require("luci.util")
ipkg = "ipkg"
@@ -88,7 +88,7 @@ function _lookup(act, pkg)
cmd = cmd .. " '" .. pkg:gsub("'", "") .. "'"
end
- return _parselist(ffluci.sys.exec(cmd .. " 2>/dev/null"))
+ return _parselist(luci.sys.exec(cmd .. " 2>/dev/null"))
end
-- Internal parser function
@@ -97,23 +97,23 @@ function _parselist(rawdata)
error("IPKG: Invalid rawdata given")
end
- rawdata = ffluci.util.split(rawdata)
+ rawdata = luci.util.split(rawdata)
local data = {}
local c = {}
local l = nil
for k, line in pairs(rawdata) do
if line:sub(1, 1) ~= " " then
- local split = ffluci.util.split(line, ":", 1)
+ local split = luci.util.split(line, ":", 1)
local key = nil
local val = nil
if split[1] then
- key = ffluci.util.trim(split[1])
+ key = luci.util.trim(split[1])
end
if split[2] then
- val = ffluci.util.trim(split[2])
+ val = luci.util.trim(split[2])
end
if key and val then
@@ -122,7 +122,7 @@ function _parselist(rawdata)
data[val] = c
elseif key == "Status" then
c.Status = {}
- for i, j in pairs(ffluci.util.split(val, " ")) do
+ for i, j in pairs(luci.util.split(val, " ")) do
c.Status[j] = true
end
else
diff --git a/core/src/model/uci.lua b/core/src/model/uci.lua
index ca5b232eb..39354bed1 100644
--- a/core/src/model/uci.lua
+++ b/core/src/model/uci.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - UCI mpdel
+LuCI - UCI mpdel
Description:
Generalized UCI model
@@ -23,16 +23,16 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.model.uci", package.seeall)
+module("luci.model.uci", package.seeall)
-- Default savedir
savedir = "/tmp/.uci"
-- Test whether to load libuci-Wrapper or /sbin/uci-Wrapper
if pcall(require, "uci") then
- Session = require("ffluci.model.uci.libuci").Session
+ Session = require("luci.model.uci.libuci").Session
else
- Session = require("ffluci.model.uci.wrapper").Session
+ Session = require("luci.model.uci.wrapper").Session
end
-- The default Session
diff --git a/core/src/model/uci/libuci.lua b/core/src/model/uci/libuci.lua
index b160dc10a..9a1112500 100644
--- a/core/src/model/uci/libuci.lua
+++ b/core/src/model/uci/libuci.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - UCI libuci wrapper
+LuCI - UCI libuci wrapper
Description:
Wrapper for the libuci Lua bindings
@@ -24,19 +24,19 @@ limitations under the License.
]]--
-module("ffluci.model.uci.libuci", package.seeall)
+module("luci.model.uci.libuci", package.seeall)
require("uci")
-require("ffluci.util")
-require("ffluci.sys")
+require("luci.util")
+require("luci.sys")
-- Session class
-Session = ffluci.util.class()
+Session = luci.util.class()
-- Session constructor
function Session.__init__(self, savedir)
self.ucicmd = savedir and "uci -P " .. savedir or "uci"
- self.savedir = savedir or ffluci.model.uci.savedir
+ self.savedir = savedir or luci.model.uci.savedir
end
function Session.add(self, config, section_type)
@@ -152,7 +152,7 @@ end
function Session._uci(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>/dev/null " .. cmd)
+ local res = luci.sys.exec(self.ucicmd .. " 2>/dev/null " .. cmd)
if res:len() == 0 then
return nil
@@ -162,7 +162,7 @@ function Session._uci(self, cmd)
end
function Session._uci2(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>&1 " .. cmd)
+ local res = luci.sys.exec(self.ucicmd .. " 2>&1 " .. cmd)
if res:len() > 0 then
return false, res
diff --git a/core/src/model/uci/wrapper.lua b/core/src/model/uci/wrapper.lua
index 3aa3b5fd1..e063b272c 100644
--- a/core/src/model/uci/wrapper.lua
+++ b/core/src/model/uci/wrapper.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - UCI wrapper library
+LuCI - UCI wrapper library
Description:
Wrapper for the /sbin/uci application, syntax of implemented functions
@@ -27,13 +27,13 @@ limitations under the License.
]]--
-module("ffluci.model.uci.wrapper", package.seeall)
+module("luci.model.uci.wrapper", package.seeall)
-require("ffluci.util")
-require("ffluci.sys")
+require("luci.util")
+require("luci.sys")
-- Session class
-Session = ffluci.util.class()
+Session = luci.util.class()
-- Session constructor
function Session.__init__(self, savedir)
@@ -104,7 +104,7 @@ Session.t_set = Session.set
function Session._uci(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>/dev/null " .. cmd)
+ local res = luci.sys.exec(self.ucicmd .. " 2>/dev/null " .. cmd)
if res:len() == 0 then
return nil
@@ -114,7 +114,7 @@ function Session._uci(self, cmd)
end
function Session._uci2(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>&1 " .. cmd)
+ local res = luci.sys.exec(self.ucicmd .. " 2>&1 " .. cmd)
if res:len() > 0 then
return false, res
@@ -124,7 +124,7 @@ function Session._uci2(self, cmd)
end
function Session._uci3(self, cmd)
- local res = ffluci.sys.execl(self.ucicmd .. " 2>&1 " .. cmd)
+ local res = luci.sys.execl(self.ucicmd .. " 2>&1 " .. cmd)
if res[1] and res[1]:sub(1, self.ucicmd:len()+1) == self.ucicmd..":" then
return nil, res[1]
end
diff --git a/core/src/sys.lua b/core/src/sys.lua
index debd8e94c..d174c8e74 100644
--- a/core/src/sys.lua
+++ b/core/src/sys.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - System library
+LuCI - System library
Description:
Utilities for interaction with the Linux system
@@ -24,10 +24,10 @@ limitations under the License.
]]--
-module("ffluci.sys", package.seeall)
+module("luci.sys", package.seeall)
require("posix")
-require("ffluci.bits")
-require("ffluci.util")
+require("luci.bits")
+require("luci.util")
-- Returns whether a system is bigendian
function bigendian()
@@ -61,9 +61,9 @@ function execl(command)
return data
end
--- Uses "ffluci-flash" to flash a new image file to the system
+-- Uses "luci-flash" to flash a new image file to the system
function flash(image, kpattern)
- local cmd = "ffluci-flash "
+ local cmd = "luci-flash "
if kpattern then
cmd = cmd .. "-k '" .. kpattern:gsub("'", "") .. "' "
end
@@ -84,7 +84,7 @@ end
-- Returns the FFLuci-Basedir
function libpath()
- return ffluci.fs.dirname(require("ffluci.debug").__file__)
+ return luci.fs.dirname(require("luci.debug").__file__)
end
-- Returns the load average
@@ -106,18 +106,18 @@ function sysinfo()
local c4 = "cat /proc/cpuinfo|grep cpu\\ model|cut -d: -f2 2>/dev/null"
local c5 = "cat /proc/meminfo|grep MemTotal|cut -d: -f2 2>/dev/null"
- local s = ffluci.util.trim(exec(c1))
+ local s = luci.util.trim(exec(c1))
local m = ""
local r = ""
if s == "" then
- s = ffluci.util.trim(exec(c2))
- m = ffluci.util.trim(exec(c3))
+ s = luci.util.trim(exec(c2))
+ m = luci.util.trim(exec(c3))
else
- m = ffluci.util.trim(exec(c4))
+ m = luci.util.trim(exec(c4))
end
- r = ffluci.util.trim(exec(c5))
+ r = luci.util.trim(exec(c5))
return s, m, r
end
@@ -147,7 +147,7 @@ function net.defaultroute()
local routes = net.routes()
local route = nil
- for i, r in pairs(ffluci.sys.net.routes()) do
+ for i, r in pairs(luci.sys.net.routes()) do
if r.Destination == "00000000" and (not route or route.Metric > r.Metric) then
route = r
end
@@ -186,7 +186,7 @@ function net.mask4prefix(mask)
return nil
end
- return #ffluci.util.split(bin, "1")-1
+ return #luci.util.split(bin, "1")-1
end
-- Returns the kernel routing table
@@ -202,7 +202,7 @@ function net.hexip4(hex, be)
be = be or bigendian()
- local hexdec = ffluci.bits.Hex2Dec
+ local hexdec = luci.bits.Hex2Dec
local ip = ""
if be then
@@ -222,12 +222,12 @@ end
-- Returns the binary IP to a given IP
function net.ip4bin(ip)
- local parts = ffluci.util.split(ip, '.')
+ local parts = luci.util.split(ip, '.')
if #parts ~= 4 then
return nil
end
- local decbin = ffluci.bits.Dec2Bin
+ local decbin = luci.bits.Dec2Bin
local bin = ""
bin = bin .. decbin(parts[1], 8)
@@ -283,7 +283,7 @@ function wifi.getiwconfig()
local cnt = exec("/usr/sbin/iwconfig 2>/dev/null")
local iwc = {}
- for i, l in pairs(ffluci.util.split(ffluci.util.trim(cnt), "\n\n")) do
+ for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n\n")) do
local k = l:match("^(.-) ")
l = l:gsub("^(.-) +", "", 1)
if k then
@@ -298,15 +298,15 @@ function wifi.iwscan()
local cnt = exec("iwlist scan 2>/dev/null")
local iws = {}
- for i, l in pairs(ffluci.util.split(ffluci.util.trim(cnt), "\n\n")) do
+ for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n\n")) do
local k = l:match("^(.-) ")
l = l:gsub("^[^\n]+", "", 1)
- l = ffluci.util.trim(l)
+ l = luci.util.trim(l)
if k then
iws[k] = {}
- for j, c in pairs(ffluci.util.split(l, "\n Cell")) do
+ for j, c in pairs(luci.util.split(l, "\n Cell")) do
c = c:gsub("^(.-)- ", "", 1)
- c = ffluci.util.split(c, "\n", 7)
+ c = luci.util.split(c, "\n", 7)
c = table.concat(c, "\n", 1)
table.insert(iws[k], _parse_mixed_record(c))
end
@@ -323,8 +323,8 @@ function _parse_delimited_table(iter, delimiter)
delimiter = delimiter or "%s+"
local data = {}
- local trim = ffluci.util.trim
- local split = ffluci.util.split
+ local trim = luci.util.trim
+ local split = luci.util.split
local keys = split(trim(iter()), delimiter, nil, true)
for i, j in pairs(keys) do
@@ -350,8 +350,8 @@ end
function _parse_mixed_record(cnt)
local data = {}
- for i, l in pairs(ffluci.util.split(ffluci.util.trim(cnt), "\n")) do
- for j, f in pairs(ffluci.util.split(ffluci.util.trim(l), " ")) do
+ for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n")) do
+ for j, f in pairs(luci.util.split(luci.util.trim(l), " ")) do
local k, x, v = f:match('([^%s][^:=]+) *([:=]*) *"*([^\n"]*)"*')
if k then
diff --git a/core/src/sys/iptparser.lua b/core/src/sys/iptparser.lua
index 3e518d41c..6450c3072 100644
--- a/core/src/sys/iptparser.lua
+++ b/core/src/sys/iptparser.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Iptables parser and query library
+LuCI - Iptables parser and query library
Copyright 2008 Jo-Philipp Wich <freifunk@wwsnet.net>
@@ -19,12 +19,12 @@ $Id$
]]--
-module("ffluci.sys.iptparser", package.seeall)
-require("ffluci.sys")
-require("ffluci.util")
+module("luci.sys.iptparser", package.seeall)
+require("luci.sys")
+require("luci.util")
-IptParser = ffluci.util.class()
+IptParser = luci.util.class()
--[[
IptParser.__init__( ... )
@@ -77,7 +77,7 @@ Each rule table contains the following fields:
Example:
-ip = ffluci.sys.iptparser.IptParser()
+ip = luci.sys.iptparser.IptParser()
result = ip.find( {
target="REJECT",
protocol="tcp",
@@ -180,7 +180,7 @@ function IptParser._parse_rules( self )
for i, tbl in ipairs({ "filter", "nat", "mangle" }) do
- for i, rule in ipairs(ffluci.sys.execl("iptables -t " .. tbl .. " --line-numbers -nxvL")) do
+ for i, rule in ipairs(luci.sys.execl("iptables -t " .. tbl .. " --line-numbers -nxvL")) do
if rule:find( "Chain " ) == 1 then
@@ -189,7 +189,7 @@ function IptParser._parse_rules( self )
else
if rule:find("%d") == 1 then
- local rule_parts = ffluci.util.split( rule, "%s+", nil, true )
+ local rule_parts = luci.util.split( rule, "%s+", nil, true )
local rule_details = { }
rule_details["table"] = tbl
diff --git a/core/src/template.lua b/core/src/template.lua
index a56b49d83..7fc2958c8 100644
--- a/core/src/template.lua
+++ b/core/src/template.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Template Parser
+LuCI - Template Parser
Description:
A template parser supporting includes, translations, Lua code blocks
@@ -23,14 +23,14 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
-module("ffluci.template", package.seeall)
+module("luci.template", package.seeall)
-require("ffluci.config")
-require("ffluci.util")
-require("ffluci.fs")
-require("ffluci.http")
+require("luci.config")
+require("luci.util")
+require("luci.fs")
+require("luci.http")
-viewdir = ffluci.sys.libpath() .. "/view/"
+viewdir = luci.sys.libpath() .. "/view/"
-- Compile modes:
@@ -50,12 +50,12 @@ compiler_enable_bytecode = false
-- Define the namespace for template modules
viewns = {
- translate = function(...) return require("ffluci.i18n").translate(...) end,
- config = function(...) return require("ffluci.model.uci").get(...) or "" end,
- controller = ffluci.http.dispatcher(),
- uploadctrl = ffluci.http.dispatcher_upload(),
- media = ffluci.config.main.mediaurlbase,
- resource = ffluci.config.main.resourcebase,
+ translate = function(...) return require("luci.i18n").translate(...) end,
+ config = function(...) return require("luci.model.uci").get(...) or "" end,
+ controller = luci.http.dispatcher(),
+ uploadctrl = luci.http.dispatcher_upload(),
+ media = luci.config.main.mediaurlbase,
+ resource = luci.config.main.resourcebase,
write = io.write,
include = function(name) Template(name):render(getfenv(2)) end,
}
@@ -70,15 +70,15 @@ function compile(template)
-- As "expr" should be local, we have to assign it to the "expr_add" scope
local expr = {}
- ffluci.util.extfenv(expr_add, "expr", expr)
+ luci.util.extfenv(expr_add, "expr", expr)
-- Save all expressiosn to table "expr"
template = template:gsub("<%%(.-)%%>", expr_add)
local function sanitize(s)
- s = ffluci.util.escape(s)
- s = ffluci.util.escape(s, "'")
- s = ffluci.util.escape(s, "\n")
+ s = luci.util.escape(s)
+ s = luci.util.escape(s, "'")
+ s = luci.util.escape(s, "\n")
return s
end
@@ -137,7 +137,7 @@ end
-- Template class
-Template = ffluci.util.class()
+Template = luci.util.class()
-- Shared template cache to store templates in to avoid unnecessary reloading
Template.cache = {}
@@ -170,18 +170,18 @@ function Template.__init__(self, name)
local err
if compiler_mode == "file" then
- local tplmt = ffluci.fs.mtime(sourcefile)
- local commt = ffluci.fs.mtime(compiledfile)
+ local tplmt = luci.fs.mtime(sourcefile)
+ local commt = luci.fs.mtime(compiledfile)
-- Build if there is no compiled file or if compiled file is outdated
if ((commt == nil) and not (tplmt == nil))
or (not (commt == nil) and not (tplmt == nil) and commt < tplmt) then
local source
- source, err = ffluci.fs.readfile(sourcefile)
+ source, err = luci.fs.readfile(sourcefile)
if source then
local compiled = compile(source)
- ffluci.fs.writefile(compiledfile, compiled)
+ luci.fs.writefile(compiledfile, compiled)
self.template, err = loadstring(compiled)
end
else
@@ -193,7 +193,7 @@ function Template.__init__(self, name)
elseif compiler_mode == "memory" then
local source
- source, err = ffluci.fs.readfile(sourcefile)
+ source, err = luci.fs.readfile(sourcefile)
if source then
self.template, err = loadstring(compile(source))
end
@@ -217,9 +217,9 @@ function Template.render(self, scope)
local oldfenv = getfenv(self.template)
-- Put our predefined objects in the scope of the template
- ffluci.util.resfenv(self.template)
- ffluci.util.updfenv(self.template, scope)
- ffluci.util.updfenv(self.template, self.viewns)
+ luci.util.resfenv(self.template)
+ luci.util.updfenv(self.template, scope)
+ luci.util.updfenv(self.template, self.viewns)
-- Now finally render the thing
self.template()
diff --git a/core/src/util.lua b/core/src/util.lua
index c7dba3196..0559fff6f 100644
--- a/core/src/util.lua
+++ b/core/src/util.lua
@@ -1,5 +1,5 @@
--[[
-FFLuCI - Utility library
+LuCI - Utility library
Description:
Several common useful Lua functions
@@ -24,7 +24,7 @@ limitations under the License.
]]--
-module("ffluci.util", package.seeall)
+module("luci.util", package.seeall)
-- Lua simplified Python-style OO class support emulation
diff --git a/core/src/view/cbi/header.htm b/core/src/view/cbi/header.htm
index 3b615d729..a66d28fee 100644
--- a/core/src/view/cbi/header.htm
+++ b/core/src/view/cbi/header.htm
@@ -1,5 +1,5 @@
<%+header%>
- <form method="post" action="<%=ffluci.http.env.REQUEST_URI%>">
+ <form method="post" action="<%=luci.http.env.REQUEST_URI%>">
<div>
<script type="text/javascript" src="<%=media%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />
diff --git a/core/src/view/cbi/mvalue.htm b/core/src/view/cbi/mvalue.htm
index 97a1c4295..bed66e569 100644
--- a/core/src/view/cbi/mvalue.htm
+++ b/core/src/view/cbi/mvalue.htm
@@ -5,14 +5,14 @@ local v = self:valuelist(section)
<% if self.widget == "select" then %>
<select multiple="multiple" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if self.size then %> size="<%=self.size%>"<% end %>>
<%for i, key in pairs(self.keylist) do %>
- <option<% if ffluci.util.contains(v, key) then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
+ <option<% if luci.util.contains(v, key) then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
<% end %>
</select>
<% elseif self.widget == "checkbox" then
local c = 0;
for i, key in pairs(self.keylist) do
c = c + 1%>
- <%=self.vallist[i]%><input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if ffluci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" />
+ <%=self.vallist[i]%><input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if luci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" />
<% if c == self.size then c = 0 %><br />
<% end end %>
<% end %>
diff --git a/core/src/view/error404.htm b/core/src/view/error404.htm
index 51ea176d6..60daee2cb 100644
--- a/core/src/view/error404.htm
+++ b/core/src/view/error404.htm
@@ -1,5 +1,5 @@
<%+header%>
<h1>404 Not Found</h1>
<p>Sorry, the object you requested was not found.</p>
-<tt>Unable to dispatch: <%=ffluci.http.env.PATH_INFO%></tt>
+<tt>Unable to dispatch: <%=luci.http.env.PATH_INFO%></tt>
<%+footer%> \ No newline at end of file
diff --git a/core/src/view/footer.htm b/core/src/view/footer.htm
index f324408a1..c8506ac5c 100644
--- a/core/src/view/footer.htm
+++ b/core/src/view/footer.htm
@@ -2,6 +2,6 @@
<div class="clear"></div>
</div></div>
-<div class="separator magenta bold"><a href="http://luci.freifunk-halle.net"><%=require("ffluci").__appname__ .. " " .. ffluci.__version__%> - Freifunk Lua Configuration Interface</a></div>
+<div class="separator magenta bold"><a href="http://luci.freifunk-halle.net"><%=require("luci").__appname__ .. " " .. luci.__version__%> - Lua Configuration Interface</a></div>
</body>
</html> \ No newline at end of file
diff --git a/core/src/view/header.htm b/core/src/view/header.htm
index 99b43805d..126eb3696 100644
--- a/core/src/view/header.htm
+++ b/core/src/view/header.htm
@@ -1,12 +1,12 @@
<%
-require("ffluci.sys")
-local load1, load5, load15 = ffluci.sys.loadavg()
+require("luci.sys")
+local load1, load5, load15 = luci.sys.loadavg()
-local request = require("ffluci.dispatcher").request
+local request = require("luci.dispatcher").request
local category = request[1]
-local tree = ffluci.dispatcher.node()
-local cattree = category and ffluci.dispatcher.node(category)
-local node = ffluci.dispatcher.dispatched
+local tree = luci.dispatcher.node()
+local cattree = category and luci.dispatcher.node(category)
+local node = luci.dispatcher.dispatched
local c = tree
for i,r in ipairs(request) do
@@ -16,9 +16,9 @@ for i,r in ipairs(request) do
end
end
-require("ffluci.i18n").loadc("default")
+require("luci.i18n").loadc("default")
-require("ffluci.http").prepare_content("text/html")
+require("luci.http").prepare_content("text/html")
%><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -27,7 +27,7 @@ require("ffluci.http").prepare_content("text/html")
<% if node and node.css then %><link rel="stylesheet" type="text/css" href="<%=resource%>/<%=node.css%>" /><% end %>
<meta http-equiv="content-type" content="text/xhtml+xml; charset=utf-8" />
<meta http-equiv="content-script-type" content="text/javascript" />
- <title>FFLuCI - Freifunk Lua Configuration Interface</title>
+ <title>LuCI - Lua Configuration Interface</title>
</head>
<body>
<div id="header">
@@ -36,7 +36,7 @@ require("ffluci.http").prepare_content("text/html")
OpenWRT Kamikaze<br />
Freifunk Firmware 2.0-dev<br />
<%:load Last%>: <%=load1%> <%=load5%> <%=load15%><br />
- <%:hostname Hostname%>: <%=ffluci.sys.hostname()%>
+ <%:hostname Hostname%>: <%=luci.sys.hostname()%>
</div>
<div>
<span class="headertitle"><%~luci.main.title%></span><br />
@@ -115,10 +115,10 @@ end
</div>
<%
if "admin" == request[1] then
- require("ffluci.model.uci")
- local ucic = ffluci.model.uci.changes()
+ require("luci.model.uci")
+ local ucic = luci.model.uci.changes()
if ucic then
- ucic = #ffluci.util.split(ucic)
+ ucic = #luci.util.split(ucic)
end
%>
<div><%:config Konfiguration%>