summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffluci')
-rw-r--r--src/ffluci/cbi.lua729
-rw-r--r--src/ffluci/config.lua51
-rw-r--r--src/ffluci/controller/admin/index.lua1
-rw-r--r--src/ffluci/controller/admin/network.lua1
-rw-r--r--src/ffluci/controller/admin/services.lua1
-rw-r--r--src/ffluci/controller/admin/status.lua1
-rw-r--r--src/ffluci/controller/admin/system.lua202
-rw-r--r--src/ffluci/controller/admin/uci.lua59
-rw-r--r--src/ffluci/controller/admin/wifi.lua1
-rw-r--r--src/ffluci/controller/public/index.lua1
-rw-r--r--src/ffluci/debug.lua2
-rw-r--r--src/ffluci/dispatcher.lua257
-rw-r--r--src/ffluci/fs.lua106
-rw-r--r--src/ffluci/http.lua104
-rw-r--r--src/ffluci/i18n.lua59
-rw-r--r--src/ffluci/i18n/cbi.en4
-rw-r--r--src/ffluci/i18n/index.en1
-rw-r--r--src/ffluci/init.lua33
-rw-r--r--src/ffluci/menu.lua120
-rw-r--r--src/ffluci/model/cbi/admin_index/contact.lua15
-rw-r--r--src/ffluci/model/cbi/admin_index/luci.lua17
-rw-r--r--src/ffluci/model/cbi/admin_network/dhcp.lua37
-rw-r--r--src/ffluci/model/cbi/admin_network/firewall.lua61
-rw-r--r--src/ffluci/model/cbi/admin_network/ifaces.lua40
-rw-r--r--src/ffluci/model/cbi/admin_network/portfw.lua24
-rw-r--r--src/ffluci/model/cbi/admin_network/ptp.lua31
-rw-r--r--src/ffluci/model/cbi/admin_network/routes.lua16
-rw-r--r--src/ffluci/model/cbi/admin_network/vlan.lua10
-rw-r--r--src/ffluci/model/cbi/admin_services/dnsmasq.lua29
-rw-r--r--src/ffluci/model/cbi/admin_services/dropbear.lua14
-rw-r--r--src/ffluci/model/cbi/admin_services/httpd.lua18
-rw-r--r--src/ffluci/model/cbi/admin_services/olsrd.lua82
-rw-r--r--src/ffluci/model/cbi/admin_system/fstab.lua21
-rw-r--r--src/ffluci/model/cbi/admin_wifi/devices.lua52
-rw-r--r--src/ffluci/model/cbi/admin_wifi/networks.lua70
-rw-r--r--src/ffluci/model/ipkg.lua140
-rw-r--r--src/ffluci/model/menu/00main.lua38
-rw-r--r--src/ffluci/model/uci.lua202
-rw-r--r--src/ffluci/sys.lua126
-rw-r--r--src/ffluci/template.lua229
-rw-r--r--src/ffluci/util.lua208
-rw-r--r--src/ffluci/view/admin_index/index.htm5
-rw-r--r--src/ffluci/view/admin_mesh/index.htm2
-rw-r--r--src/ffluci/view/admin_network/index.htm2
-rw-r--r--src/ffluci/view/admin_services/index.htm2
-rw-r--r--src/ffluci/view/admin_status/index.htm2
-rw-r--r--src/ffluci/view/admin_status/system.htm2
-rw-r--r--src/ffluci/view/admin_system/editor.htm14
-rw-r--r--src/ffluci/view/admin_system/index.htm2
-rw-r--r--src/ffluci/view/admin_system/ipkg.htm23
-rw-r--r--src/ffluci/view/admin_system/packages.htm77
-rw-r--r--src/ffluci/view/admin_system/passwd.htm34
-rw-r--r--src/ffluci/view/admin_system/reboot.htm10
-rw-r--r--src/ffluci/view/admin_system/sshkeys.htm23
-rw-r--r--src/ffluci/view/admin_system/upgrade.htm32
-rw-r--r--src/ffluci/view/admin_uci/apply.htm6
-rw-r--r--src/ffluci/view/admin_uci/changes.htm11
-rw-r--r--src/ffluci/view/admin_uci/revert.htm5
-rw-r--r--src/ffluci/view/admin_wifi/index.htm2
-rw-r--r--src/ffluci/view/cbi/dvalue.htm12
-rw-r--r--src/ffluci/view/cbi/footer.htm7
-rw-r--r--src/ffluci/view/cbi/fvalue.htm3
-rw-r--r--src/ffluci/view/cbi/header.htm7
-rw-r--r--src/ffluci/view/cbi/lvalue.htm16
-rw-r--r--src/ffluci/view/cbi/map.htm7
-rw-r--r--src/ffluci/view/cbi/mvalue.htm19
-rw-r--r--src/ffluci/view/cbi/nsection.htm17
-rw-r--r--src/ffluci/view/cbi/tsection.htm22
-rw-r--r--src/ffluci/view/cbi/ucisection.htm23
-rw-r--r--src/ffluci/view/cbi/value.htm3
-rw-r--r--src/ffluci/view/cbi/valuefooter.htm8
-rw-r--r--src/ffluci/view/cbi/valueheader.htm3
-rw-r--r--src/ffluci/view/error404.htm5
-rw-r--r--src/ffluci/view/error500.htm5
-rw-r--r--src/ffluci/view/footer.htm7
-rw-r--r--src/ffluci/view/header.htm78
-rw-r--r--src/ffluci/view/public_index/contact.htm12
-rw-r--r--src/ffluci/view/public_index/index.htm5
78 files changed, 0 insertions, 3726 deletions
diff --git a/src/ffluci/cbi.lua b/src/ffluci/cbi.lua
deleted file mode 100644
index 1ccf2e56d..000000000
--- a/src/ffluci/cbi.lua
+++ /dev/null
@@ -1,729 +0,0 @@
---[[
-FFLuCI - Configuration Bind Interface
-
-Description:
-Offers an interface for binding confiugration values to certain
-data types. Supports value and range validation and basic dependencies.
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("ffluci.cbi", package.seeall)
-
-require("ffluci.template")
-require("ffluci.util")
-require("ffluci.http")
-require("ffluci.model.uci")
-
-local class = ffluci.util.class
-local instanceof = ffluci.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")
-
- local cbidir = ffluci.config.path .. "/model/cbi/"
- local func, err = loadfile(cbidir..cbimap..".lua")
-
- if not func then
- return nil
- end
-
- ffluci.i18n.loadc("cbi")
-
- ffluci.util.resfenv(func)
- ffluci.util.updfenv(func, ffluci.cbi)
- ffluci.util.extfenv(func, "translate", ffluci.i18n.translate)
-
- local map = func()
-
- if not instanceof(map, Map) then
- error("CBI map returns no valid map object!")
- return nil
- end
-
- return map
-end
-
--- Node pseudo abstract class
-Node = class()
-
-function Node.__init__(self, title, description)
- self.children = {}
- self.title = title or ""
- self.description = description or ""
- self.template = "cbi/node"
-end
-
--- Append child nodes
-function Node.append(self, obj)
- table.insert(self.children, obj)
-end
-
--- Parse this node and its children
-function Node.parse(self, ...)
- for k, child in ipairs(self.children) do
- child:parse(...)
- end
-end
-
--- Render this node
-function Node.render(self)
- ffluci.template.render(self.template, {self=self})
-end
-
--- Render the children
-function Node.render_children(self, ...)
- for k, node in ipairs(self.children) do
- node:render(...)
- end
-end
-
-
---[[
-Map - A map describing a configuration file
-]]--
-Map = class(Node)
-
-function Map.__init__(self, config, ...)
- Node.__init__(self, ...)
- self.config = config
- self.template = "cbi/map"
- self.uci = ffluci.model.uci.Session()
- self.ucidata = self.uci:show(self.config)
- if not self.ucidata then
- error("Unable to read UCI data: " .. self.config)
- else
- if not self.ucidata[self.config] then
- self.ucidata[self.config] = {}
- end
- self.ucidata = self.ucidata[self.config]
- end
-end
-
--- Creates a child section
-function Map.section(self, class, ...)
- if instanceof(class, AbstractSection) then
- local obj = class(self, ...)
- self:append(obj)
- return obj
- else
- error("class must be a descendent of AbstractSection")
- end
-end
-
--- UCI add
-function Map.add(self, sectiontype)
- local name = self.uci:add(self.config, sectiontype)
- if name then
- self.ucidata[name] = {}
- self.ucidata[name][".type"] = sectiontype
- end
- return name
-end
-
--- UCI set
-function Map.set(self, section, option, value)
- local stat = self.uci:set(self.config, section, option, value)
- if stat then
- local val = self.uci:get(self.config, section, option)
- if option then
- self.ucidata[section][option] = val
- else
- if not self.ucidata[section] then
- self.ucidata[section] = {}
- end
- self.ucidata[section][".type"] = val
- end
- end
- return stat
-end
-
--- UCI del
-function Map.del(self, section, option)
- local stat = self.uci:del(self.config, section, option)
- if stat then
- if option then
- self.ucidata[section][option] = nil
- else
- self.ucidata[section] = nil
- end
- end
- return stat
-end
-
--- UCI get (cached)
-function Map.get(self, section, option)
- if not section then
- return self.ucidata
- elseif option and self.ucidata[section] then
- return self.ucidata[section][option]
- else
- return self.ucidata[section]
- end
-end
-
-
---[[
-AbstractSection
-]]--
-AbstractSection = class(Node)
-
-function AbstractSection.__init__(self, map, sectiontype, ...)
- Node.__init__(self, ...)
- self.sectiontype = sectiontype
- self.map = map
- self.config = map.config
- self.optionals = {}
-
- self.optional = true
- self.addremove = false
- self.dynamic = false
-end
-
--- Appends a new option
-function AbstractSection.option(self, class, ...)
- if instanceof(class, AbstractValue) then
- local obj = class(self.map, ...)
- self:append(obj)
- return obj
- else
- error("class must be a descendent of AbstractValue")
- end
-end
-
--- Parse optional options
-function AbstractSection.parse_optionals(self, section)
- if not self.optional then
- return
- end
-
- self.optionals[section] = {}
-
- local field = ffluci.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
- field = nil
- else
- table.insert(self.optionals[section], v)
- end
- end
- end
-
- if field and field:len() > 0 and self.dynamic then
- self:add_dynamic(field)
- end
-end
-
--- Add a dynamic option
-function AbstractSection.add_dynamic(self, field, optional)
- local o = self:option(Value, field, field)
- o.optional = optional
-end
-
--- Parse all dynamic options
-function AbstractSection.parse_dynamic(self, section)
- if not self.dynamic then
- return
- end
-
- local arr = ffluci.util.clone(self:cfgvalue(section))
- local form = ffluci.http.formvalue("cbid."..self.config.."."..section)
- if type(form) == "table" then
- for k,v in pairs(form) do
- arr[k] = v
- end
- end
-
- for key,val in pairs(arr) do
- local create = true
-
- for i,c in ipairs(self.children) do
- if c.option == key then
- create = false
- end
- end
-
- if create and key:sub(1, 1) ~= "." then
- self:add_dynamic(key, true)
- end
- end
-end
-
--- Returns the section's UCI table
-function AbstractSection.cfgvalue(self, section)
- return self.map:get(section)
-end
-
--- Removes the section
-function AbstractSection.remove(self, section)
- return self.map:del(section)
-end
-
--- Creates the section
-function AbstractSection.create(self, section)
- return self.map:set(section, nil, self.sectiontype)
-end
-
-
-
---[[
-NamedSection - A fixed configuration section defined by its name
-]]--
-NamedSection = class(AbstractSection)
-
-function NamedSection.__init__(self, map, section, ...)
- AbstractSection.__init__(self, map, ...)
- self.template = "cbi/nsection"
-
- self.section = section
- self.addremove = false
-end
-
-function NamedSection.parse(self)
- local s = self.section
- local active = self:cfgvalue(s)
-
-
- 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
- return
- end
- else -- Create and apply default values
- if ffluci.http.formvalue("cbi.cns."..path) and self:create(s) then
- for k,v in pairs(self.children) do
- v:write(s, v.default)
- end
- end
- end
- end
-
- if active then
- AbstractSection.parse_dynamic(self, s)
- if ffluci.http.formvalue("cbi.submit") then
- Node.parse(self, s)
- end
- AbstractSection.parse_optionals(self, s)
- end
-end
-
-
---[[
-TypedSection - A (set of) configuration section(s) defined by the type
- addremove: Defines whether the user can add/remove sections of this type
- anonymous: Allow creating anonymous sections
- validate: a validation function returning nil if the section is invalid
-]]--
-TypedSection = class(AbstractSection)
-
-function TypedSection.__init__(self, ...)
- AbstractSection.__init__(self, ...)
- self.template = "cbi/tsection"
- self.deps = {}
- self.excludes = {}
-
- self.anonymous = false
-end
-
--- Return all matching UCI sections for this TypedSection
-function TypedSection.cfgsections(self)
- local sections = {}
- for k, v in pairs(self.map:get()) do
- if v[".type"] == self.sectiontype then
- if self:checkscope(k) then
- sections[k] = v
- end
- end
- end
- return sections
-end
-
--- Creates a new section of this type with the given name (or anonymous)
-function TypedSection.create(self, name)
- if name then
- self.map:set(name, nil, self.sectiontype)
- else
- name = self.map:add(self.sectiontype)
- end
-
- for k,v in pairs(self.children) do
- if v.default then
- self.map:set(name, v.option, v.default)
- end
- end
-end
-
--- Limits scope to sections that have certain option => value pairs
-function TypedSection.depends(self, option, value)
- table.insert(self.deps, {option=option, value=value})
-end
-
--- Excludes several sections by name
-function TypedSection.exclude(self, field)
- self.excludes[field] = true
-end
-
-function TypedSection.parse(self)
- if self.addremove then
- -- Create
- local crval = "cbi.cts." .. self.config .. "." .. self.sectiontype
- local name = ffluci.http.formvalue(crval)
- if self.anonymous then
- if name then
- self:create()
- end
- else
- if name then
- -- Ignore if it already exists
- if self:cfgvalue(name) then
- name = nil;
- end
-
- name = self:checkscope(name)
-
- if not name then
- self.err_invalid = true
- end
-
- if name and name:len() > 0 then
- self:create(name)
- end
- end
- end
-
- -- Remove
- crval = "cbi.rts." .. self.config
- name = ffluci.http.formvalue(crval)
- if type(name) == "table" then
- for k,v in pairs(name) do
- if self:cfgvalue(k) and self:checkscope(k) then
- self:remove(k)
- end
- end
- end
- end
-
- for k, v in pairs(self:cfgsections()) do
- AbstractSection.parse_dynamic(self, k)
- if ffluci.http.formvalue("cbi.submit") then
- Node.parse(self, k)
- end
- AbstractSection.parse_optionals(self, k)
- end
-end
-
--- Render the children
-function TypedSection.render_children(self, section)
- for k, node in ipairs(self.children) do
- node:render(section)
- end
-end
-
--- Verifies scope of sections
-function TypedSection.checkscope(self, section)
- -- Check if we are not excluded
- if self.excludes[section] then
- return nil
- end
-
- -- Check if at least one dependency is met
- if #self.deps > 0 and self:cfgvalue(section) then
- local stat = false
-
- for k, v in ipairs(self.deps) do
- if self:cfgvalue(section)[v.option] == v.value then
- stat = true
- end
- end
-
- if not stat then
- return nil
- end
- end
-
- return self:validate(section)
-end
-
-
--- Dummy validate function
-function TypedSection.validate(self, section)
- return section
-end
-
-
---[[
-AbstractValue - An abstract Value Type
- null: Value can be empty
- valid: A function returning the value if it is valid otherwise nil
- depends: A table of option => value pairs of which one must be true
- default: The default value
- size: The size of the input fields
- rmempty: Unset value if empty
- optional: This value is optional (see AbstractSection.optionals)
-]]--
-AbstractValue = class(Node)
-
-function AbstractValue.__init__(self, map, option, ...)
- Node.__init__(self, ...)
- self.option = option
- self.map = map
- self.config = map.config
- self.tag_invalid = {}
- self.deps = {}
-
- self.rmempty = false
- self.default = nil
- self.size = nil
- self.optional = false
-end
-
--- Add a dependencie to another section field
-function AbstractValue.depends(self, field, value)
- table.insert(self.deps, {field=field, value=value})
-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)
-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)
-end
-
-function AbstractValue.parse(self, section)
- local fvalue = self:formvalue(section)
-
- if fvalue and fvalue ~= "" then -- If we have a form value, write it to UCI
- fvalue = self:validate(fvalue)
- if not fvalue then
- self.tag_invalid[section] = true
- end
- if fvalue and not (fvalue == self:cfgvalue(section)) then
- self:write(section, fvalue)
- end
- else -- Unset the UCI or error
- if self.rmempty or self.optional then
- self:remove(section)
- end
- end
-end
-
--- Render if this value exists or if it is mandatory
-function AbstractValue.render(self, s)
- if not self.optional or self:cfgvalue(s) or self:formcreated(s) then
- ffluci.template.render(self.template, {self=self, section=s})
- end
-end
-
--- Return the UCI value of this object
-function AbstractValue.cfgvalue(self, section)
- return self.map:get(section, self.option)
-end
-
--- Validate the form value
-function AbstractValue.validate(self, value)
- return value
-end
-
--- Write to UCI
-function AbstractValue.write(self, section, value)
- return self.map:set(section, self.option, value)
-end
-
--- Remove from UCI
-function AbstractValue.remove(self, section)
- return self.map:del(section, self.option)
-end
-
-
-
-
---[[
-Value - A one-line value
- maxlength: The maximum length
- isnumber: The value must be a valid (floating point) number
- isinteger: The value must be a valid integer
- ispositive: The value must be positive (and a number)
-]]--
-Value = class(AbstractValue)
-
-function Value.__init__(self, ...)
- AbstractValue.__init__(self, ...)
- self.template = "cbi/value"
-
- self.maxlength = nil
- self.isnumber = false
- self.isinteger = false
-end
-
--- This validation is a bit more complex
-function Value.validate(self, val)
- if self.maxlength and tostring(val):len() > self.maxlength then
- val = nil
- end
-
- return ffluci.util.validate(val, self.isnumber, self.isinteger)
-end
-
-
--- DummyValue - This does nothing except being there
-DummyValue = class(AbstractValue)
-
-function DummyValue.__init__(self, map, ...)
- AbstractValue.__init__(self, map, ...)
- self.template = "cbi/dvalue"
- self.value = nil
-end
-
-function DummyValue.parse(self)
-
-end
-
-function DummyValue.render(self, s)
- ffluci.template.render(self.template, {self=self, section=s})
-end
-
-
---[[
-Flag - A flag being enabled or disabled
-]]--
-Flag = class(AbstractValue)
-
-function Flag.__init__(self, ...)
- AbstractValue.__init__(self, ...)
- self.template = "cbi/fvalue"
-
- self.enabled = "1"
- self.disabled = "0"
-end
-
--- A flag can only have two states: set or unset
-function Flag.parse(self, section)
- local fvalue = self:formvalue(section)
-
- if fvalue then
- fvalue = self.enabled
- else
- fvalue = self.disabled
- end
-
- if fvalue == self.enabled or (not self.optional and not self.rmempty) then
- if not(fvalue == self:cfgvalue(section)) then
- self:write(section, fvalue)
- end
- else
- self:remove(section)
- end
-end
-
-
-
---[[
-ListValue - A one-line value predefined in a list
- widget: The widget that will be used (select, radio)
-]]--
-ListValue = class(AbstractValue)
-
-function ListValue.__init__(self, ...)
- AbstractValue.__init__(self, ...)
- self.template = "cbi/lvalue"
- self.keylist = {}
- self.vallist = {}
-
- self.size = 1
- self.widget = "select"
-end
-
-function ListValue.value(self, key, val)
- val = val or key
- table.insert(self.keylist, tostring(key))
- table.insert(self.vallist, tostring(val))
-end
-
-function ListValue.validate(self, val)
- if ffluci.util.contains(self.keylist, val) then
- return val
- else
- return nil
- end
-end
-
-
-
---[[
-MultiValue - Multiple delimited values
- widget: The widget that will be used (select, checkbox)
- delimiter: The delimiter that will separate the values (default: " ")
-]]--
-MultiValue = class(AbstractValue)
-
-function MultiValue.__init__(self, ...)
- AbstractValue.__init__(self, ...)
- self.template = "cbi/mvalue"
- self.keylist = {}
- self.vallist = {}
-
- self.widget = "checkbox"
- self.delimiter = " "
-end
-
-function MultiValue.value(self, key, val)
- val = val or key
- table.insert(self.keylist, tostring(key))
- table.insert(self.vallist, tostring(val))
-end
-
-function MultiValue.valuelist(self, section)
- local val = self:cfgvalue(section)
-
- if not(type(val) == "string") then
- return {}
- end
-
- return ffluci.util.split(val, self.delimiter)
-end
-
-function MultiValue.validate(self, val)
- if not(type(val) == "string") then
- return nil
- end
-
- local result = ""
-
- for value in val:gmatch("[^\n]+") do
- if ffluci.util.contains(self.keylist, value) then
- result = result .. self.delimiter .. value
- end
- end
-
- if result:len() > 0 then
- return result:sub(self.delimiter:len() + 1)
- else
- return nil
- end
-end \ No newline at end of file
diff --git a/src/ffluci/config.lua b/src/ffluci/config.lua
deleted file mode 100644
index 8b1a73dc7..000000000
--- a/src/ffluci/config.lua
+++ /dev/null
@@ -1,51 +0,0 @@
---[[
-FFLuCI - Configuration
-
-Description:
-Some FFLuCI configuration values read from uci file "luci"
-
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.config", package.seeall)
-require("ffluci.model.uci")
-require("ffluci.util")
-require("ffluci.debug")
-
--- Our path (wtf Lua lacks __file__ support)
-path = ffluci.debug.path
-
--- Warning! This is only for fallback and compatibility purporses! --
-main = {}
-
--- This is where stylesheets and images go
-main.mediaurlbase = "/ffluci/media"
-
--- Does anybody think about browser autodetect here?
--- Too bad busybox doesn't populate HTTP_ACCEPT_LANGUAGE
-main.lang = "de"
-
-
--- Now overwrite with UCI values
-local ucidata = ffluci.model.uci.show("luci")
-if ucidata and ucidata.luci then
- ffluci.util.update(ffluci.config, ucidata.luci)
-end \ No newline at end of file
diff --git a/src/ffluci/controller/admin/index.lua b/src/ffluci/controller/admin/index.lua
deleted file mode 100644
index b4a7720f8..000000000
--- a/src/ffluci/controller/admin/index.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.admin.index", package.seeall) \ No newline at end of file
diff --git a/src/ffluci/controller/admin/network.lua b/src/ffluci/controller/admin/network.lua
deleted file mode 100644
index 4f8160a4c..000000000
--- a/src/ffluci/controller/admin/network.lua
+++ /dev/null
@@ -1 +0,0 @@
-module(..., package.seeall) \ No newline at end of file
diff --git a/src/ffluci/controller/admin/services.lua b/src/ffluci/controller/admin/services.lua
deleted file mode 100644
index 42181212b..000000000
--- a/src/ffluci/controller/admin/services.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.admin.services", package.seeall) \ No newline at end of file
diff --git a/src/ffluci/controller/admin/status.lua b/src/ffluci/controller/admin/status.lua
deleted file mode 100644
index bdd51d462..000000000
--- a/src/ffluci/controller/admin/status.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.admin.status", package.seeall) \ No newline at end of file
diff --git a/src/ffluci/controller/admin/system.lua b/src/ffluci/controller/admin/system.lua
deleted file mode 100644
index b0763d8af..000000000
--- a/src/ffluci/controller/admin/system.lua
+++ /dev/null
@@ -1,202 +0,0 @@
-module("ffluci.controller.admin.system", package.seeall)
-
-require("ffluci.sys")
-require("ffluci.http")
-require("ffluci.util")
-require("ffluci.fs")
-require("ffluci.model.ipkg")
-require("ffluci.model.uci")
-
-function action_editor()
- local file = ffluci.http.formvalue("file", "")
- local data = ffluci.http.formvalue("data")
- local err = nil
- local msg = nil
- local stat = true
-
- if file and data then
- stat, err = ffluci.fs.writefile(file, data)
- end
-
- if not stat then
- err = ffluci.util.split(err, " ")
- table.remove(err, 1)
- msg = table.concat(err, " ")
- end
-
- local cnt, err = ffluci.fs.readfile(file)
- if cnt then
- cnt = ffluci.util.pcdata(cnt)
- end
- ffluci.template.render("admin_system/editor", {fn=file, cnt=cnt, msg=msg})
-end
-
-function action_ipkg()
- local file = "/etc/ipkg.conf"
- local data = ffluci.http.formvalue("data")
- local stat = nil
- local err = nil
-
- if data then
- stat, err = ffluci.fs.writefile(file, data)
- end
-
- local cnt = ffluci.fs.readfile(file)
- if cnt then
- cnt = ffluci.util.pcdata(cnt)
- end
-
- ffluci.template.render("admin_system/ipkg", {cnt=cnt, msg=err})
-end
-
-function action_packages()
- local ipkg = ffluci.model.ipkg
- local void = nil
- local submit = ffluci.http.formvalue("submit")
-
-
- -- Search query
- local query = ffluci.http.formvalue("query")
- query = (query ~= '') and query or nil
-
-
- -- Packets to be installed
- local install = ffluci.http.formvalue("install")
- install = (type(install) == "table" and submit) and install or nil
-
- -- Install from URL
- local url = ffluci.http.formvalue("url")
- if url and url ~= '' and submit then
- if not install then
- install = {}
- end
- install[url] = 1
- end
-
- -- Do install
- if install then
- for k, v in pairs(install) do
- void, install[k] = ipkg.install(k)
- end
- end
-
-
- -- Remove packets
- local remove = ffluci.http.formvalue("remove")
- remove = (type(remove) == "table" and submit) and remove or nil
- if remove then
- for k, v in pairs(remove) do
- void, remove[k] = ipkg.remove(k)
- end
- end
-
-
- -- Update all packets
- local update = ffluci.http.formvalue("update")
- if update then
- void, update = ipkg.update()
- end
-
-
- -- Upgrade all packets
- local upgrade = ffluci.http.formvalue("upgrade")
- if upgrade then
- void, upgrade = ipkg.upgrade()
- end
-
-
- -- Package info
- local info = ffluci.model.ipkg.info(query)
- info = info or {}
- local pkgs = {}
-
- -- Sort after status and name
- for k, v in pairs(info) do
- local x = 0
- for i, j in pairs(pkgs) do
- local vins = (v.Status and v.Status.installed)
- local jins = (j.Status and j.Status.installed)
- if vins ~= jins then
- if vins then
- break
- end
- else
- if j.Package > v.Package then
- break
- end
- end
- x = i
- end
- table.insert(pkgs, x+1, v)
- end
-
- ffluci.template.render("admin_system/packages", {pkgs=pkgs, query=query,
- install=install, remove=remove, update=update, upgrade=upgrade})
-end
-
-function action_passwd()
- local p1 = ffluci.http.formvalue("pwd1")
- local p2 = ffluci.http.formvalue("pwd2")
- local stat = nil
-
- if p1 or p2 then
- if p1 == p2 then
- stat = ffluci.sys.user.setpasswd("root", p1)
- else
- stat = 10
- end
- end
-
- ffluci.template.render("admin_system/passwd", {stat=stat})
-end
-
-function action_reboot()
- local reboot = ffluci.http.formvalue("reboot")
- ffluci.template.render("admin_system/reboot", {reboot=reboot})
- if reboot then
- ffluci.sys.reboot()
- end
-end
-
-function action_sshkeys()
- local file = "/etc/dropbear/authorized_keys"
- local data = ffluci.http.formvalue("data")
- local stat = nil
- local err = nil
-
- if data then
- stat, err = ffluci.fs.writefile(file, data)
- end
-
- local cnt = ffluci.fs.readfile(file)
- if cnt then
- cnt = ffluci.util.pcdata(cnt)
- end
-
- ffluci.template.render("admin_system/sshkeys", {cnt=cnt, msg=err})
-end
-
-function action_upgrade()
- local ret = nil
- local plat = ffluci.fs.mtime("/lib/upgrade/platform.sh")
-
- local image = ffluci.http.formvalue("image")
- local imgname = ffluci.http.formvalue("image_name")
- local keepcfg = ffluci.http.formvalue("keepcfg")
-
- if plat and imgname then
- local kpattern = nil
- if keepcfg then
- local files = ffluci.model.uci.show("luci", "flash_keep")
- if files.luci and files.luci.flash_keep then
- kpattern = ""
- for k,v in pairs(files.luci.flash_keep) do
- kpattern = kpattern .. " " .. v
- end
- end
- end
- ret = ffluci.sys.flash(image, kpattern)
- end
-
- ffluci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret})
-end \ No newline at end of file
diff --git a/src/ffluci/controller/admin/uci.lua b/src/ffluci/controller/admin/uci.lua
deleted file mode 100644
index 3c9fc8739..000000000
--- a/src/ffluci/controller/admin/uci.lua
+++ /dev/null
@@ -1,59 +0,0 @@
-module("ffluci.controller.admin.uci", package.seeall)
-require("ffluci.util")
-require("ffluci.sys")
-
--- This function has a higher priority than the admin_uci/apply template
-function action_apply()
- local changes = ffluci.model.uci.changes()
- local output = ""
-
- if changes then
- local apply = {}
-
- -- Collect files to be applied
- for i, line in ipairs(ffluci.util.split(changes)) do
- local r = line:match("^-?([^.]+)")
- if r then
- apply[r] = true
- end
- end
-
- -- Commit changes
- ffluci.model.uci.commit()
-
- -- Search for post-commit commands
- if ffluci.config.uci_oncommit then
- for k, v in pairs(apply) do
- local cmd = ffluci.config.uci_oncommit[k]
- if cmd then
- output = output .. cmd .. ":" .. ffluci.sys.exec(cmd)
- end
- end
- end
- end
-
- ffluci.template.render("admin_uci/apply", {changes=changes, output=output})
-end
-
-
-function action_revert()
- local changes = ffluci.model.uci.changes()
- if changes then
- local revert = {}
-
- -- Collect files to be reverted
- for i, line in ipairs(ffluci.util.split(changes)) do
- local r = line:match("^-?([^.]+)")
- if r then
- revert[r] = true
- end
- end
-
- -- Revert them
- for k, v in pairs(revert) do
- ffluci.model.uci.revert(k)
- end
- end
-
- ffluci.template.render("admin_uci/revert", {changes=changes})
-end \ No newline at end of file
diff --git a/src/ffluci/controller/admin/wifi.lua b/src/ffluci/controller/admin/wifi.lua
deleted file mode 100644
index bc1040c71..000000000
--- a/src/ffluci/controller/admin/wifi.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.admin.wifi", package.seeall) \ No newline at end of file
diff --git a/src/ffluci/controller/public/index.lua b/src/ffluci/controller/public/index.lua
deleted file mode 100644
index 4f8160a4c..000000000
--- a/src/ffluci/controller/public/index.lua
+++ /dev/null
@@ -1 +0,0 @@
-module(..., package.seeall) \ No newline at end of file
diff --git a/src/ffluci/debug.lua b/src/ffluci/debug.lua
deleted file mode 100644
index f1132edcc..000000000
--- a/src/ffluci/debug.lua
+++ /dev/null
@@ -1,2 +0,0 @@
-module("ffluci.debug", package.seeall)
-path = require("ffluci.fs").dirname(debug.getinfo(1, 'S').source:sub(2)) \ No newline at end of file
diff --git a/src/ffluci/dispatcher.lua b/src/ffluci/dispatcher.lua
deleted file mode 100644
index b60a9beef..000000000
--- a/src/ffluci/dispatcher.lua
+++ /dev/null
@@ -1,257 +0,0 @@
---[[
-FFLuCI - Dispatcher
-
-Description:
-The request dispatcher and module dispatcher generators
-
-
-The dispatching process:
- For a detailed explanation of the dispatching process we assume:
- You have installed the FFLuCI CGI-Dispatcher in /cgi-bin/ffluci
-
- To enforce a higher level of security only the CGI-Dispatcher
- resides inside the web server's document root, everything else
- stays inside an external directory, we assume this is /lua/ffluci
- for this explanation.
-
- All controllers and action are reachable as sub-objects of /cgi-bin/ffluci
- as if they were virtual folders and files
- e.g.: /cgi-bin/ffluci/public/info/about
- /cgi-bin/ffluci/admin/network/interfaces
- and so on.
-
- The PATH_INFO variable holds the dispatch path and
- will be split into three parts: /category/module/action
-
- Category: This is the category in which modules are stored in
- By default there are two categories:
- "public" - which is the default public category
- "admin" - which is the default protected category
-
- As FFLuCI itself does not implement authentication
- you should make sure that "admin" and other sensitive
- categories are protected by the webserver.
-
- E.g. for busybox add a line like:
- /cgi-bin/ffluci/admin:root:$p$root
- to /etc/httpd.conf to protect the "admin" category
-
-
- Module: This is the controller which will handle the request further
- It is always a submodule of ffluci.controller, so a module
- called "helloworld" will be stored in
- /lua/ffluci/controller/helloworld.lua
- You are free to submodule your controllers any further.
-
- Action: This is action that will be invoked after loading the module.
- The kind of how the action will be dispatched depends on
- the module dispatcher that is defined in the controller.
- See the description of the default module dispatcher down
- on this page for some examples.
-
-
- The main dispatcher at first searches for the module by trying to
- include ffluci.controller.category.module
- (where "category" is the category name and "module" is the module name)
- If this fails a 404 status code will be send to the client and FFLuCI exits
-
- Then the main dispatcher calls the module dispatcher
- ffluci.controller.category.module.dispatcher with the request object
- as the only argument. The module dispatcher is then responsible
- for the further dispatching process.
-
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.dispatcher", package.seeall)
-require("ffluci.http")
-require("ffluci.template")
-require("ffluci.config")
-require("ffluci.sys")
-
-
--- Sets privilege for given category
-function assign_privileges(category)
- local cp = ffluci.config.category_privileges
- if cp and cp[category] then
- local u, g = cp[category]:match("([^:]+):([^:]+)")
- ffluci.sys.process.setuser(u)
- ffluci.sys.process.setgroup(g)
- end
-end
-
--- Dispatches the "request"
-function dispatch(req)
- request = req
- local m = "ffluci.controller." .. request.category .. "." .. request.module
- local stat, module = pcall(require, m)
- if not stat then
- return error404()
- else
- module.request = request
- module.dispatcher = module.dispatcher or dynamic
- setfenv(module.dispatcher, module)
- return module.dispatcher(request)
- end
-end
-
--- Sends a 404 error code and renders the "error404" template if available
-function error404(message)
- message = message or "Not Found"
-
- if not pcall(ffluci.template.render, "error404") then
- ffluci.http.textheader()
- print(message)
- end
- return false
-end
-
--- Sends a 500 error code and renders the "error500" template if available
-function error500(message)
- ffluci.http.status(500, "Internal Server Error")
-
- if not pcall(ffluci.template.render, "error500", {message=message}) then
- ffluci.http.textheader()
- print(message)
- end
- return false
-end
-
-
--- Dispatches a request depending on the PATH_INFO variable
-function httpdispatch()
- local pathinfo = os.getenv("PATH_INFO") or ""
- local parts = pathinfo:gmatch("/[%w-]+")
-
- local sanitize = function(s, default)
- return s and s:sub(2) or default
- end
-
- local cat = sanitize(parts(), "public")
- local mod = sanitize(parts(), "index")
- local act = sanitize(parts(), "index")
-
- assign_privileges(cat)
- dispatch({category=cat, module=mod, action=act})
-end
-
-
--- Dispatchers --
-
-
--- The Action Dispatcher searches the module for any function called
--- action_"request.action" and calls it
-function action(request)
- local i18n = require("ffluci.i18n")
- local disp = require("ffluci.dispatcher")
-
- i18n.loadc(request.module)
- local action = getfenv()["action_" .. request.action:gsub("-", "_")]
- if action then
- action()
- else
- disp.error404()
- end
-end
-
--- The CBI dispatcher directly parses and renders the CBI map which is
--- placed in ffluci/modles/cbi/"request.module"/"request.action"
-function cbi(request)
- local i18n = require("ffluci.i18n")
- local disp = require("ffluci.dispatcher")
- local tmpl = require("ffluci.template")
- local cbi = require("ffluci.cbi")
-
- local path = request.category.."_"..request.module.."/"..request.action
-
- i18n.loadc(request.module)
-
- local stat, map = pcall(cbi.load, path)
- if stat and map then
- local stat, err = pcall(map.parse, map)
- if not stat then
- disp.error500(err)
- return
- end
- tmpl.render("cbi/header")
- map:render()
- tmpl.render("cbi/footer")
- elseif not stat then
- disp.error500(map)
- else
- disp.error404()
- end
-end
-
--- The dynamic dispatchers combines the action, simpleview and cbi dispatchers
--- in one dispatcher. It tries to lookup the request in this order.
-function dynamic(request)
- local i18n = require("ffluci.i18n")
- local disp = require("ffluci.dispatcher")
- local tmpl = require("ffluci.template")
- local cbi = require("ffluci.cbi")
-
- i18n.loadc(request.module)
-
- local action = getfenv()["action_" .. request.action:gsub("-", "_")]
- if action then
- action()
- return
- end
-
- local path = request.category.."_"..request.module.."/"..request.action
- if pcall(tmpl.render, path) then
- return
- end
-
- local stat, map = pcall(cbi.load, path)
- if stat and map then
- local stat, err = pcall(map.parse, map)
- if not stat then
- disp.error500(err)
- return
- end
- tmpl.render("cbi/header")
- map:render()
- tmpl.render("cbi/footer")
- return
- elseif not stat then
- disp.error500(map)
- return
- end
-
- disp.error404()
-end
-
--- The Simple View Dispatcher directly renders the template
--- which is placed in ffluci/views/"request.module"/"request.action"
-function simpleview(request)
- local i18n = require("ffluci.i18n")
- local tmpl = require("ffluci.template")
- local disp = require("ffluci.dispatcher")
-
- local path = request.category.."_"..request.module.."/"..request.action
-
- i18n.loadc(request.module)
- if not pcall(tmpl.render, path) then
- disp.error404()
- end
-end \ No newline at end of file
diff --git a/src/ffluci/fs.lua b/src/ffluci/fs.lua
deleted file mode 100644
index 6e8859a0d..000000000
--- a/src/ffluci/fs.lua
+++ /dev/null
@@ -1,106 +0,0 @@
---[[
-FFLuCI - Filesystem tools
-
-Description:
-A module offering often needed filesystem manipulation functions
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.fs", package.seeall)
-
-require("posix")
-
--- Checks whether a file exists
-function isfile(filename)
- local fp = io.open(path, "r")
- if file then file:close() end
- return file ~= nil
-end
-
--- Returns the content of file
-function readfile(filename)
- local fp, err = io.open(filename)
-
- if fp == nil then
- return nil, err
- end
-
- local data = fp:read("*a")
- fp:close()
- return data
-end
-
--- Returns the content of file as array of lines
-function readfilel(filename)
- local fp, err = io.open(filename)
- local line = ""
- local data = {}
-
- if fp == nil then
- return nil, err
- end
-
- while true do
- line = fp:read()
- if (line == nil) then break end
- table.insert(data, line)
- end
-
- fp:close()
- return data
-end
-
--- Writes given data to a file
-function writefile(filename, data)
- local fp, err = io.open(filename, "w")
-
- if fp == nil then
- return nil, err
- end
-
- fp:write(data)
- fp:close()
-
- return true
-end
-
--- Returns the file modification date/time of "path"
-function mtime(path)
- return posix.stat(path, "mtime")
-end
-
--- basename wrapper
-basename = posix.basename
-
--- dirname wrapper
-dirname = posix.dirname
-
--- dir wrapper
-function dir(path)
- local dir = {}
- for node in posix.files(path) do
- table.insert(dir, 1, node)
- end
- return dir
-end
-
--- Alias for lfs.mkdir
-mkdir = posix.mkdir \ No newline at end of file
diff --git a/src/ffluci/http.lua b/src/ffluci/http.lua
deleted file mode 100644
index 06e1c43bd..000000000
--- a/src/ffluci/http.lua
+++ /dev/null
@@ -1,104 +0,0 @@
---[[
-FFLuCI - HTTP-Interaction
-
-Description:
-HTTP-Header manipulator and form variable preprocessor
-
-FileId:
-$Id$
-
-ToDo:
-- Cookie handling
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.http", package.seeall)
-
-require("ffluci.util")
-
--- Sets HTTP-Status-Header
-function status(code, message)
- print("Status: " .. tostring(code) .. " " .. message)
-end
-
-
--- Asks the browser to redirect to "url"
-function redirect(url, qs)
- if qs then
- url = url .. "?" .. qs
- end
-
- status(302, "Found")
- print("Location: " .. url .. "\n")
-end
-
-
--- Same as redirect but accepts category, module and action for internal use
-function request_redirect(category, module, action, ...)
- category = category or "public"
- module = module or "index"
- action = action or "index"
-
- 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()
-
- for match in key:gmatch("[%w-_]+") do
- c = c[match]
- if c == nil then
- return default
- end
- end
-
- return c
-end
-
-
--- Returns a table of all COOKIE, GET and POST Parameters
-function formvalues()
- return FORM
-end
-
-
--- Prints plaintext content-type header
-function textheader()
- print("Content-Type: text/plain\n")
-end
-
-
--- Prints html content-type header
-function htmlheader()
- print("Content-Type: text/html\n")
-end
-
-
--- Prints xml content-type header
-function xmlheader()
- print("Content-Type: text/xml\n")
-end
diff --git a/src/ffluci/i18n.lua b/src/ffluci/i18n.lua
deleted file mode 100644
index 11f4afe87..000000000
--- a/src/ffluci/i18n.lua
+++ /dev/null
@@ -1,59 +0,0 @@
---[[
-FFLuCI - Internationalisation
-
-Description:
-A very minimalistic but yet effective internationalisation module
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.i18n", package.seeall)
-
-require("ffluci.config")
-
-table = {}
-i18ndir = ffluci.config.path .. "/i18n/"
-
--- Clears the translation table
-function clear()
- table = {}
-end
-
--- Loads a translation and copies its data into the global translation table
-function load(file)
- local f = loadfile(i18ndir .. file)
- if f then
- setfenv(f, table)
- f()
- return true
- else
- return false
- end
-end
-
--- Same as load but autocompletes the filename with .LANG from config.lang
-function loadc(file)
- return load(file .. "." .. ffluci.config.main.lang)
-end
-
--- Returns the i18n-value defined by "key" or if there is no such: "default"
-function translate(key, default)
- return table[key] or default
-end \ No newline at end of file
diff --git a/src/ffluci/i18n/cbi.en b/src/ffluci/i18n/cbi.en
deleted file mode 100644
index 7c159ce50..000000000
--- a/src/ffluci/i18n/cbi.en
+++ /dev/null
@@ -1,4 +0,0 @@
-uci_add = "Add entry"
-uci_del = "Remove entry"
-uci_save = "Save configuration"
-uci_reset = "Reset form" \ No newline at end of file
diff --git a/src/ffluci/i18n/index.en b/src/ffluci/i18n/index.en
deleted file mode 100644
index 71255873a..000000000
--- a/src/ffluci/i18n/index.en
+++ /dev/null
@@ -1 +0,0 @@
-hello = "Hello" \ No newline at end of file
diff --git a/src/ffluci/init.lua b/src/ffluci/init.lua
deleted file mode 100644
index dbecf57e4..000000000
--- a/src/ffluci/init.lua
+++ /dev/null
@@ -1,33 +0,0 @@
---[[
-FFLuCI - Freifunk Lua Configuration Interface
-
-Description:
-This is the init file
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("ffluci", package.seeall)
-
-__version__ = "0.2"
-__appname__ = "FFLuCI"
-
-dispatch = require("ffluci.dispatcher").httpdispatch
-env = ENV
-form = FORM
diff --git a/src/ffluci/menu.lua b/src/ffluci/menu.lua
deleted file mode 100644
index 0a1aad5d1..000000000
--- a/src/ffluci/menu.lua
+++ /dev/null
@@ -1,120 +0,0 @@
---[[
-FFLuCI - Menu Builder
-
-Description:
-Collects menu building information from controllers
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("ffluci.menu", package.seeall)
-
-require("ffluci.fs")
-require("ffluci.util")
-require("ffluci.template")
-require("ffluci.i18n")
-require("ffluci.config")
-
--- Default modelpath
-modelpath = ffluci.config.path .. "/model/menu/"
-
--- Menu definition extra scope
-scope = {
- translate = ffluci.i18n.translate
-}
-
--- Local menu database
-local menu = {}
-
--- The current pointer
-local menuc = {}
-
--- Adds a menu category to the current menu and selects it
-function add(cat, controller, title, order)
- order = order or 100
- if not menu[cat] then
- menu[cat] = {}
- end
-
- local entry = {}
- entry[".descr"] = title
- entry[".order"] = order
- entry[".contr"] = controller
-
- menuc = entry
-
- local i = 0
- for k,v in ipairs(menu[cat]) do
- if v[".order"] > entry[".order"] then
- break
- end
- i = k
- end
- table.insert(menu[cat], i+1, entry)
-
- return true
-end
-
--- Adds an action to the current menu
-function act(action, title)
- table.insert(menuc, {action = action, descr = title})
- return true
-end
-
--- Selects a menu category
-function sel(cat, controller)
- if not menu[cat] then
- return nil
- end
- menuc = menu[cat]
-
- local stat = nil
- for k,v in ipairs(menuc) do
- if v[".contr"] == controller then
- menuc = v
- stat = true
- end
- end
-
- return stat
-end
-
-
--- Collect all menu information provided in the model dir
-function collect()
- for k, menu in pairs(ffluci.fs.dir(modelpath)) do
- if menu:sub(1, 1) ~= "." then
- local f = loadfile(modelpath.."/"..menu)
- local env = ffluci.util.clone(scope)
-
- env.add = add
- env.sel = sel
- env.act = act
-
- setfenv(f, env)
- f()
- end
- end
-end
-
--- Returns the menu information
-function get()
- collect()
- return menu
-end \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_index/contact.lua b/src/ffluci/model/cbi/admin_index/contact.lua
deleted file mode 100644
index 55f5098a5..000000000
--- a/src/ffluci/model/cbi/admin_index/contact.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-m = Map("luci", "Kontakt", [[Diese Daten sind auf der öffentlichen Kontaktseite
-sichtbar. Alle Felder sind natürlich freiwillig. Du kannst soviel oder so wenig
-über dich angeben, wie du möchtest.]])
-
-c = m:section(NamedSection, "contact")
-
-c:option(Value, "nickname", "Pseudonym")
-c:option(Value, "name", "Name")
-c:option(Value, "mail", "E-Mail")
-c:option(Value, "phone", "Telefon")
-c:option(Value, "location", "Standort")
-c:option(Value, "geo", "Koordinaten", "Bitte als Breite;Länge angeben")
-c:option(Value, "note", "Notiz")
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_index/luci.lua b/src/ffluci/model/cbi/admin_index/luci.lua
deleted file mode 100644
index eed626c5b..000000000
--- a/src/ffluci/model/cbi/admin_index/luci.lua
+++ /dev/null
@@ -1,17 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("luci", "FFLuCI")
-
-c = m:section(NamedSection, "main", "core", "Allgemein")
-c:option(Value, "lang", "Sprache")
-c:option(Value, "mediaurlbase", "Mediaverzeichnis")
-
-f = m:section(NamedSection, "flash", "extern", "Firmwareupgrade")
-f:option(Value, "keep", "Übernehme Dateien").size = 64
-
-p = m:section(NamedSection, "category_privileges", "core", "Kategorieprivilegien")
-p.dynamic = true
-
-u = m:section(NamedSection, "uci_oncommit", "event", "UCI-Befehle beim Anwenden")
-u.dynamic = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/dhcp.lua b/src/ffluci/model/cbi/admin_network/dhcp.lua
deleted file mode 100644
index 83ba19641..000000000
--- a/src/ffluci/model/cbi/admin_network/dhcp.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-require("ffluci.model.uci")
-require("ffluci.sys")
-
-m = Map("dhcp", "DHCP")
-
-s = m:section(TypedSection, "dhcp")
-s.addremove = true
-s.anonymous = true
-
-iface = s:option(ListValue, "interface", "Schnittstelle")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
- if v[".type"] == "interface" and k ~= "loopback" then
- iface:value(k)
- end
-end
-
-s:option(Value, "start", "Start").rmempty = true
-
-s:option(Value, "limit", "Limit").rmempty = true
-
-s:option(Flag, "dynamicdhcp", "Dynamisches DHCP").rmempty = true
-
-s:option(Value, "name", "Name").optional = true
-
-s:option(Flag, "ignore", "Schnittstelle ignorieren").optional = true
-
-s:option(Value, "netmask", "Netzmaske").optional = true
-
-s:option(Flag, "force", "Start erzwingen").optional = true
-
-for i, line in pairs(ffluci.sys.execl("dnsmasq --help dhcp")) do
- k, v = line:match("([^ ]+) +([^ ]+)")
- s:option(Value, "dhcp"..k, v).optional = true
-end
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/firewall.lua b/src/ffluci/model/cbi/admin_network/firewall.lua
deleted file mode 100644
index cf7018e99..000000000
--- a/src/ffluci/model/cbi/admin_network/firewall.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("luci_fw", "Firewall")
-
-s = m:section(TypedSection, "rule")
-s.addremove = true
-s.anonymous = true
-
-chain = s:option(ListValue, "chain", "Kette")
-chain:value("forward", "Forward")
-chain:value("input", "Input")
-chain:value("output", "Output")
-chain:value("prerouting", "Prerouting")
-chain:value("postrouting", "Postrouting")
-
-s:option(Value, "iface", "Eingangsschnittstelle").optional = true
-s:option(Value, "oface", "Ausgangsschnittstelle").optional = true
-
-proto = s:option(ListValue, "proto", "Protokoll")
-proto.optional = true
-proto:value("")
-proto:value("tcp", "TCP")
-proto:value("udp", "UDP")
-
-s:option(Value, "source", "Quelladresse").optional = true
-s:option(Value, "destination", "Zieladresse").optional = true
-
-sport = s:option(Value, "sport", "Quellport")
-sport.optional = true
-sport:depends("proto", "tcp")
-sport:depends("proto", "udp")
-
-dport = s:option(Value, "dport", "Zielport")
-dport.optional = true
-dport:depends("proto", "tcp")
-dport:depends("proto", "udp")
-
-tosrc = s:option(Value, "tosrc", "Neue Quelladresse [SNAT]")
-tosrc.optional = true
-tosrc:depends("jump", "SNAT")
-
-tosrc = s:option(Value, "todest", "Neue Zieladresse [DNAT]")
-tosrc.optional = true
-tosrc:depends("jump", "DNAT")
-
-jump = s:option(ListValue, "jump", "Aktion")
-jump.rmempty = true
-jump:value("", "")
-jump:value("ACCEPT", "annehmen (ACCEPT)")
-jump:value("REJECT", "zurückweisen (REJECT)")
-jump:value("DROP", "verwerfen (DROP)")
-jump:value("LOG", "protokollieren (LOG)")
-jump:value("DNAT", "Ziel umschreiben (DNAT) [nur Prerouting]")
-jump:value("MASQUERADE", "maskieren (MASQUERADE) [nur Postrouting]")
-jump:value("SNAT", "Quelle umschreiben (SNAT) [nur Postrouting]")
-
-
-add = s:option(Value, "command", "Eigener Befehl")
-add.size = 50
-add.rmempty = true
-
-return m
diff --git a/src/ffluci/model/cbi/admin_network/ifaces.lua b/src/ffluci/model/cbi/admin_network/ifaces.lua
deleted file mode 100644
index 193f83f51..000000000
--- a/src/ffluci/model/cbi/admin_network/ifaces.lua
+++ /dev/null
@@ -1,40 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("network", "Schnittstellen")
-
-s = m:section(TypedSection, "interface")
-s.addremove = true
-s:exclude("loopback")
-s:depends("proto", "static")
-s:depends("proto", "dhcp")
-
-p = s:option(ListValue, "proto", "Protokoll")
-p:value("static", "statisch")
-p:value("dhcp", "DHCP")
-p.default = "static"
-
-br = s:option(Flag, "type", "Netzwerkbrücke", "überbrückt angegebene Schnittstelle(n)")
-br.enabled = "bridge"
-br.rmempty = true
-
-s:option(Value, "ifname", "Schnittstelle")
-
-s:option(Value, "ipaddr", "IP-Adresse")
-
-s:option(Value, "netmask", "Netzmaske"):depends("proto", "static")
-
-gw = s:option(Value, "gateway", "Gateway")
-gw:depends("proto", "static")
-gw.rmempty = true
-
-dns = s:option(Value, "dns", "DNS-Server")
-dns:depends("proto", "static")
-dns.optional = true
-
-mtu = s:option(Value, "mtu", "MTU")
-mtu.optional = true
-mtu.isinteger = true
-
-mac = s:option(Value, "macaddr", "MAC-Adresse")
-mac.optional = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/portfw.lua b/src/ffluci/model/cbi/admin_network/portfw.lua
deleted file mode 100644
index 70a174907..000000000
--- a/src/ffluci/model/cbi/admin_network/portfw.lua
+++ /dev/null
@@ -1,24 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-require("ffluci.sys")
-m = Map("luci_fw", "Portweiterleitung")
-
-s = m:section(TypedSection, "portfw")
-s.addremove = true
-s.anonymous = true
-
-iface = s:option(ListValue, "iface", "Externes Interface")
-iface:value("")
-for k,v in pairs(ffluci.sys.net.devices()) do
- iface:value(v)
-end
-
-proto = s:option(ListValue, "proto", "Protokoll")
-proto:value("tcp", "TCP")
-proto:value("udp", "UDP")
-proto:value("tcpudp", "TCP+UDP")
-
-dport = s:option(Value, "dport", "Externer Port", "Port[:Endport]")
-
-to = s:option(Value, "to", "Interne Adresse", "IP-Adresse[:Zielport[-Zielendport]]")
-
-return m
diff --git a/src/ffluci/model/cbi/admin_network/ptp.lua b/src/ffluci/model/cbi/admin_network/ptp.lua
deleted file mode 100644
index 78fcf94b9..000000000
--- a/src/ffluci/model/cbi/admin_network/ptp.lua
+++ /dev/null
@@ -1,31 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("network", "Punkt-zu-Punkt Verbindungen")
-
-s = m:section(TypedSection, "interface")
-s.addremove = true
-s:depends("proto", "pppoe")
-s:depends("proto", "pptp")
-
-p = s:option(ListValue, "proto", "Protokoll")
-p:value("pppoe", "PPPoE")
-p:value("pptp", "PPTP")
-p.default = "pppoe"
-
-s:option(Value, "ifname", "Schnittstelle")
-
-s:option(Value, "username", "Benutzername")
-s:option(Value, "password", "Passwort")
-
-s:option(Value, "keepalive", "Keep-Alive").optional = true
-
-s:option(Value, "demand", "Dial on Demand (idle time)").optional = true
-
-srv = s:option(Value, "server", "PPTP-Server")
-srv:depends("proto", "pptp")
-srv.optional = true
-
-mtu = s:option(Value, "mtu", "MTU")
-mtu.optional = true
-mtu.isinteger = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/routes.lua b/src/ffluci/model/cbi/admin_network/routes.lua
deleted file mode 100644
index 5a5f78007..000000000
--- a/src/ffluci/model/cbi/admin_network/routes.lua
+++ /dev/null
@@ -1,16 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("network", "Statische Routen")
-
-s = m:section(TypedSection, "route")
-s.addremove = true
-s.anonymous = true
-
-s:option(Value, "interface", "Schnittstelle")
-
-s:option(Value, "target", "Ziel", "Host-IP oder Netzwerk")
-
-s:option(Value, "netmask", "Netzmaske", "falls Ziel ein Netzwerk ist").rmemepty = true
-
-s:option(Value, "gateway", "Gateway")
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/vlan.lua b/src/ffluci/model/cbi/admin_network/vlan.lua
deleted file mode 100644
index 3186f2d9b..000000000
--- a/src/ffluci/model/cbi/admin_network/vlan.lua
+++ /dev/null
@@ -1,10 +0,0 @@
--- ToDo: Autodetect things, maybe use MultiValue instead, Translate, Add descriptions
-m = Map("network", "VLAN", "Konfguriert den Switch des Routers.")
-
-s = m:section(TypedSection, "switch")
-
-for i = 0, 15 do
- s:option(Value, "vlan"..i, "vlan"..i).optional = true
-end
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_services/dnsmasq.lua b/src/ffluci/model/cbi/admin_services/dnsmasq.lua
deleted file mode 100644
index d6934c891..000000000
--- a/src/ffluci/model/cbi/admin_services/dnsmasq.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-m = Map("dhcp", "Dnsmasq")
-
-s = m:section(TypedSection, "dnsmasq", "Einstellungen")
-s.anonymous = true
-
-s:option(Flag, "domainneeded", "Anfragen nur mit Domain", "Anfragen ohne Domainnamen nicht weiterleiten")
-s:option(Flag, "authoritative", "Authoritativ", "Dies ist der einzige DHCP im lokalen Netz")
-s:option(Flag, "boguspriv", "Private Anfragen filtern", "Reverse DNS-Anfragen für lokalen Netze nicht weiterleiten")
-s:option(Flag, "filterwin2k", "Windowsanfragen filtern", "nutzlose DNS-Anfragen aktueller Windowssysteme filtern")
-s:option(Flag, "localise_queries", "Lokalisiere Anfragen", "Gibt die Adresse eines Hostnamen entsprechend seines Subnetzes zurück")
-s:option(Value, "local", "Lokale Server")
-s:option(Value, "domain", "Lokale Domain")
-s:option(Flag, "expandhosts", "Erweitere Hosts", "Fügt Domainnamen zu einfachen Hosteinträgen in der Resolvdatei hinzu")
-s:option(Flag, "nonegcache", "Unbekannte nicht cachen", "Negative DNS-Antworten nicht zwischenspeichern")
-s:option(Flag, "readethers", "Verwende /etc/ethers", "Lese Informationen aus /etc/ethers um den DHCP-Server zu konfigurieren")
-s:option(Value, "leasefile", "Leasedatei", "Speicherort für vergebenen DHCP-Adressen")
-s:option(Value, "resolvfile", "Resolvdatei", "Lokale DNS-Datei")
-s:option(Flag, "nohosts", "Ignoriere /etc/hosts").optional = true
-s:option(Flag, "strictorder", "Strikte Reihenfolge", "DNS-Server werden strikt der Reihenfolge in der Resolvdatei nach abgefragt").optional = true
-s:option(Flag, "logqueries", "Schreibe Abfragelog").optional = true
-s:option(Flag, "noresolv", "Ignoriere Resolvdatei").optional = true
-s:option(Value, "dnsforwardmax", "gleichzeitige Abfragen").optional = true
-s:option(Value, "port", "DNS-Port").optional = true
-s:option(Value, "ednspacket_max", "max. EDNS.0 Paketgröße").optional = true
-s:option(Value, "dhcpleasemax", "max. DHCP-Leases").optional = true
-s:option(Value, "addnhosts", "Zusätzliche Hostdatei").optional = true
-s:option(Value, "queryport", "Abfrageport").optional = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_services/dropbear.lua b/src/ffluci/model/cbi/admin_services/dropbear.lua
deleted file mode 100644
index b8fcb9e6b..000000000
--- a/src/ffluci/model/cbi/admin_services/dropbear.lua
+++ /dev/null
@@ -1,14 +0,0 @@
--- ToDo: Translate, Add descriptions
-m = Map("dropbear", "SSH-Server")
-
-s = m:section(TypedSection, "dropbear")
-s.anonymous = true
-
-port = s:option(Value, "Port", "Port")
-port.isinteger = true
-
-pwauth = s:option(Flag, "PasswordAuth", "Passwortanmeldung")
-pwauth.enabled = 'on'
-pwauth.disabled = 'off'
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_services/httpd.lua b/src/ffluci/model/cbi/admin_services/httpd.lua
deleted file mode 100644
index f89dbb7ae..000000000
--- a/src/ffluci/model/cbi/admin_services/httpd.lua
+++ /dev/null
@@ -1,18 +0,0 @@
--- ToDo: Translate, Add descriptions
-m = Map("httpd", "HTTP-Server")
-
-s = m:section(TypedSection, "httpd")
-s.anonymous = true
-
-port = s:option(Value, "port", "Port")
-port.isinteger = true
-
-s:option(Value, "home", "Wurzelverzeichnis")
-
-config = s:option(Value, "c_file", "Konfigurationsdatei", "/etc/httpd.conf wenn leer")
-config.rmempty = true
-
-realm = s:option(Value, "realm", "Anmeldeaufforderung")
-realm.rmempty = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_services/olsrd.lua b/src/ffluci/model/cbi/admin_services/olsrd.lua
deleted file mode 100644
index 430b78687..000000000
--- a/src/ffluci/model/cbi/admin_services/olsrd.lua
+++ /dev/null
@@ -1,82 +0,0 @@
--- ToDo: Autodetect things, Translate, Add descriptions
-require("ffluci.fs")
-
-m = Map("olsr", "OLSR")
-
-s = m:section(NamedSection, "general", "olsr", "Allgemeine Einstellungen")
-
-debug = s:option(ListValue, "DebugLevel", "Debugmodus")
-for i=0, 9 do
- debug:value(i)
-end
-
-ipv = s:option(ListValue, "IpVersion", "Internet Protokoll")
-ipv:value("4", "IPv4")
-ipv:value("6", "IPv6")
-
-noint = s:option(Flag, "AllowNoInt", "Start ohne Netzwerk")
-noint.enabled = "yes"
-noint.disabled = "no"
-
-s:option(Value, "Pollrate", "Abfragerate (Pollrate)", "s").isnumber = true
-
-tcr = s:option(ListValue, "TcRedundancy", "TC-Redundanz")
-tcr:value("0", "MPR-Selektoren")
-tcr:value("1", "MPR-Selektoren und MPR")
-tcr:value("2", "Alle Nachbarn")
-
-s:option(Value, "MprCoverage", "MPR-Erfassung").isinteger = true
-
-lql = s:option(ListValue, "LinkQualityLevel", "VQ-Level")
-lql:value("0", "deaktiviert")
-lql:value("1", "MPR-Auswahl")
-lql:value("2", "MPR-Auswahl und Routing")
-
-lqfish = s:option(Flag, "LinkQualityFishEye", "VQ-Fisheye")
-
-s:option(Value, "LinkQualityWinSize", "VQ-Fenstergröße").isinteger = true
-
-s:option(Value, "LinkQualityDijkstraLimit", "VQ-Dijkstralimit")
-
-hyst = s:option(Flag, "UseHysteresis", "Hysterese aktivieren")
-hyst.enabled = "yes"
-hyst.disabled = "no"
-
-
-i = m:section(TypedSection, "Interface", "Schnittstellen")
-i.anonymous = true
-i.addremove = true
-i.dynamic = true
-
-i:option(Value, "Interface", "Netzwerkschnittstellen")
-
-i:option(Value, "HelloInterval", "Hello-Intervall").isnumber = true
-
-i:option(Value, "HelloValidityTime", "Hello-Gültigkeit").isnumber = true
-
-i:option(Value, "TcInterval", "TC-Intervall").isnumber = true
-
-i:option(Value, "TcValidityTime", "TC-Gültigkeit").isnumber = true
-
-i:option(Value, "MidInterval", "MID-Intervall").isnumber = true
-
-i:option(Value, "MidValidityTime", "MID-Gültigkeit").isnumber = true
-
-i:option(Value, "HnaInterval", "HNA-Intervall").isnumber = true
-
-i:option(Value, "HnaValidityTime", "HNA-Gültigkeit").isnumber = true
-
-
-p = m:section(TypedSection, "LoadPlugin", "Plugins")
-p.addremove = true
-p.dynamic = true
-
-lib = p:option(ListValue, "Library", "Bibliothek")
-lib:value("")
-for k, v in pairs(ffluci.fs.dir("/usr/lib")) do
- if v:sub(1, 6) == "olsrd_" then
- lib:value(v)
- end
-end
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_system/fstab.lua b/src/ffluci/model/cbi/admin_system/fstab.lua
deleted file mode 100644
index cf9a483d7..000000000
--- a/src/ffluci/model/cbi/admin_system/fstab.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-m = Map("fstab", "Einhängepunkte")
-
-mount = m:section(TypedSection, "mount", "Einhängepunkte")
-mount.anonymous = true
-mount.addremove = true
-
-mount:option(Flag, "enabled", "aktivieren")
-mount:option(Value, "device", "Gerät")
-mount:option(Value, "target", "Einhängepunkt")
-mount:option(Value, "fstype", "Dateisystem")
-mount:option(Value, "options", "Optionen")
-
-
-swap = m:section(TypedSection, "swap", "SWAP")
-swap.anonymous = true
-swap.addremove = true
-
-swap:option(Flag, "enabled", "aktivieren")
-swap:option(Value, "device", "Gerät")
-
-return m
diff --git a/src/ffluci/model/cbi/admin_wifi/devices.lua b/src/ffluci/model/cbi/admin_wifi/devices.lua
deleted file mode 100644
index 0b1b9a2ff..000000000
--- a/src/ffluci/model/cbi/admin_wifi/devices.lua
+++ /dev/null
@@ -1,52 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-
-m = Map("wireless", "Geräte")
-
-s = m:section(TypedSection, "wifi-device")
---s.addremove = true
-
-en = s:option(Flag, "disabled", "Aktivieren")
-en.enabled = "0"
-en.disabled = "1"
-
-t = s:option(ListValue, "type", "Typ")
-t:value("broadcom")
-t:value("atheros")
-t:value("mac80211")
-t:value("prism2")
---[[
-require("ffluci.sys")
-local c = ". /etc/functions.sh;for i in /lib/wifi/*;do . $i;done;echo $DRIVERS"
-for driver in ffluci.sys.execl(c)[1]:gmatch("[^ ]+") do
- t:value(driver)
-end
-]]--
-
-mode = s:option(ListValue, "mode", "Modus")
-mode:value("", "standard")
-mode:value("11b", "802.11b")
-mode:value("11g", "802.11g")
-mode:value("11a", "802.11a")
-mode:value("11bg", "802.11b+g")
-mode.rmempty = true
-
-s:option(Value, "channel", "Funkkanal")
-
-s:option(Value, "txantenna", "Sendeantenne").rmempty = true
-
-s:option(Value, "rxantenna", "Empfangsantenne").rmempty = true
-
-s:option(Value, "distance", "Distanz",
- "Distanz zum am weitesten entfernten Funkpartner (m)").rmempty = true
-
-s:option(Value, "diversity", "Diversität"):depends("type", "atheros")
-
-country = s:option(Value, "country", "Ländercode")
-country.optional = true
-country:depends("type", "broadcom")
-
-maxassoc = s:option(Value, "maxassoc", "Verbindungslimit")
-maxassoc:depends("type", "broadcom")
-maxassoc.optional = true
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_wifi/networks.lua b/src/ffluci/model/cbi/admin_wifi/networks.lua
deleted file mode 100644
index 20342ffb0..000000000
--- a/src/ffluci/model/cbi/admin_wifi/networks.lua
+++ /dev/null
@@ -1,70 +0,0 @@
--- ToDo: Translate, Add descriptions and help texts
-m = Map("wireless", "Netze")
-
-s = m:section(TypedSection, "wifi-iface")
-s.addremove = true
-s.anonymous = true
-
-s:option(Value, "ssid", "Netzkennung (ESSID)").maxlength = 32
-
-device = s:option(ListValue, "device", "Gerät")
-local d = ffluci.model.uci.show("wireless").wireless
-if d then
- for k, v in pairs(d) do
- if v[".type"] == "wifi-device" then
- device:value(k)
- end
- end
-end
-
-network = s:option(ListValue, "network", "Netzwerk")
-network:value("")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
- if v[".type"] == "interface" and k ~= "loopback" then
- network:value(k)
- end
-end
-
-mode = s:option(ListValue, "mode", "Modus")
-mode:value("ap", "Access Point")
-mode:value("adhoc", "Ad-Hoc")
-mode:value("sta", "Client")
-mode:value("wds", "WDS")
-
-s:option(Value, "bssid", "BSSID").optional = true
-
-s:option(Value, "txpower", "Sendeleistung", "dbm").rmempty = true
-
-encr = s:option(ListValue, "encryption", "Verschlüsselung")
-encr:value("none", "keine")
-encr:value("wep", "WEP")
-encr:value("psk", "WPA-PSK")
-encr:value("wpa", "WPA-Radius")
-encr:value("psk2", "WPA2-PSK")
-encr:value("wpa2", "WPA2-Radius")
-
-key = s:option(Value, "key", "Schlüssel")
-key:depends("encryption", "wep")
-key:depends("encryption", "psk")
-key:depends("encryption", "wpa")
-key:depends("encryption", "psk2")
-key:depends("encryption", "wpa2")
-key.rmempty = true
-
-server = s:option(Value, "server", "Radius-Server")
-server:depends("encryption", "wpa")
-server:depends("encryption", "wpa2")
-server.rmempty = true
-
-port = s:option(Value, "port", "Radius-Port")
-port:depends("encryption", "wpa")
-port:depends("encryption", "wpa2")
-port.rmempty = true
-
-s:option(Flag, "isolate", "AP-Isolation", "Unterbindet Client-Client-Verkehr").optional = true
-
-s:option(Flag, "hidden", "ESSID verstecken").optional = true
-
-
-
-return m \ No newline at end of file
diff --git a/src/ffluci/model/ipkg.lua b/src/ffluci/model/ipkg.lua
deleted file mode 100644
index 3b149fb16..000000000
--- a/src/ffluci/model/ipkg.lua
+++ /dev/null
@@ -1,140 +0,0 @@
---[[
-FFLuCI - IPKG wrapper library
-
-Description:
-Wrapper for the ipkg Package manager
-
-Any return value of false or nil can be interpreted as an error
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-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")
-
-ipkg = "ipkg"
-
--- Returns repository information
-function info(pkg)
- return _lookup("info", pkg)
-end
-
--- Returns a table with status information
-function status(pkg)
- return _lookup("status", pkg)
-end
-
--- Installs packages
-function install(...)
- return _action("install", ...)
-end
-
--- Returns whether a package is installed
-function installed(pkg, ...)
- local p = status(...)[pkg]
- return (p and p.Status and p.Status.installed)
-end
-
--- Removes packages
-function remove(...)
- return _action("remove", ...)
-end
-
--- Updates package lists
-function update()
- return _action("update")
-end
-
--- Upgrades installed packages
-function upgrade()
- return _action("upgrade")
-end
-
-
--- Internal action function
-function _action(cmd, ...)
- local pkg = ""
- arg.n = nil
- for k, v in pairs(arg) do
- pkg = pkg .. " '" .. v:gsub("'", "") .. "'"
- end
-
- local c = ipkg.." "..cmd.." "..pkg.." >/dev/null 2>&1"
- local r = os.execute(c)
- return (r == 0), r
-end
-
--- Internal lookup function
-function _lookup(act, pkg)
- local cmd = ipkg .. " " .. act
- if pkg then
- cmd = cmd .. " '" .. pkg:gsub("'", "") .. "'"
- end
-
- return _parselist(ffluci.sys.exec(cmd .. " 2>/dev/null"))
-end
-
--- Internal parser function
-function _parselist(rawdata)
- if type(rawdata) ~= "string" then
- error("IPKG: Invalid rawdata given")
- end
-
- rawdata = ffluci.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 key = nil
- local val = nil
-
- if split[1] then
- key = ffluci.util.trim(split[1])
- end
-
- if split[2] then
- val = ffluci.util.trim(split[2])
- end
-
- if key and val then
- if key == "Package" then
- c = {Package = val}
- data[val] = c
- elseif key == "Status" then
- c.Status = {}
- for i, j in pairs(ffluci.util.split(val, " ")) do
- c.Status[j] = true
- end
- else
- c[key] = val
- end
- l = key
- end
- else
- -- Multi-line field
- c[l] = c[l] .. "\n" .. line:sub(2)
- end
- end
-
- return data
-end \ No newline at end of file
diff --git a/src/ffluci/model/menu/00main.lua b/src/ffluci/model/menu/00main.lua
deleted file mode 100644
index 09c5dbf0d..000000000
--- a/src/ffluci/model/menu/00main.lua
+++ /dev/null
@@ -1,38 +0,0 @@
--- General menu definition
-add("public", "index", "Übersicht", 10)
-act("contact", "Kontakt")
-
-
-add("admin", "index", "Übersicht", 10)
-act("contact", "Kontakt")
-act("luci", "FFLuCI")
-
-add("admin", "status", "Status", 20)
-act("system", "System")
-
-add("admin", "system", "System", 30)
-act("packages", "Paketverwaltung")
-act("passwd", "Passwort ändern")
-act("sshkeys", "SSH-Schlüssel")
-act("fstab", "Einhängepunkte")
-act("upgrade", "Firmwareupgrade")
-act("reboot", "Neu starten")
-
-add("admin", "services", "Dienste", 40)
-act("olsrd", "OLSR")
-act("httpd", "HTTP-Server")
-act("dropbear", "SSH-Server")
-act("dnsmasq", "Dnsmasq")
-
-add("admin", "network", "Netzwerk", 50)
-act("vlan", "Switch")
-act("ifaces", "Schnittstellen")
-act("dhcp", "DHCP-Server")
-act("ptp", "PPPoE / PPTP")
-act("routes", "Statische Routen")
-act("portfw", "Portweiterleitung")
-act("firewall", "Firewall")
-
-add("admin", "wifi", "Drahtlos", 60)
-act("devices", "Geräte")
-act("networks", "Netze") \ No newline at end of file
diff --git a/src/ffluci/model/uci.lua b/src/ffluci/model/uci.lua
deleted file mode 100644
index 828659780..000000000
--- a/src/ffluci/model/uci.lua
+++ /dev/null
@@ -1,202 +0,0 @@
---[[
-FFLuCI - UCI wrapper library
-
-Description:
-Wrapper for the /sbin/uci application, syntax of implemented functions
-is comparable to the syntax of the uci application
-
-Any return value of false or nil can be interpreted as an error
-
-
-ToDo: Reimplement in Lua
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("ffluci.model.uci", package.seeall)
-require("ffluci.util")
-require("ffluci.fs")
-require("ffluci.sys")
-
--- The OS uci command
-ucicmd = "uci"
-
--- Session class
-Session = ffluci.util.class()
-
--- Session constructor
-function Session.__init__(self, path, uci)
- uci = uci or ucicmd
- if path then
- self.ucicmd = uci .. " -P " .. path
- else
- self.ucicmd = uci
- end
-end
-
--- The default Session
-local default = Session()
-
--- Wrapper for "uci add"
-function Session.add(self, config, section_type)
- return self:_uci("add " .. _path(config) .. " " .. _path(section_type))
-end
-
-function add(...)
- return default:add(...)
-end
-
-
--- Wrapper for "uci changes"
-function Session.changes(self, config)
- return self:_uci("changes " .. _path(config))
-end
-
-function changes(...)
- return default:changes(...)
-end
-
-
--- Wrapper for "uci commit"
-function Session.commit(self, config)
- return self:_uci2("commit " .. _path(config))
-end
-
-function commit(...)
- return default:commit(...)
-end
-
-
--- Wrapper for "uci del"
-function Session.del(self, config, section, option)
- return self:_uci2("del " .. _path(config, section, option))
-end
-
-function del(...)
- return default:del(...)
-end
-
-
--- Wrapper for "uci get"
-function Session.get(self, config, section, option)
- return self:_uci("get " .. _path(config, section, option))
-end
-
-function get(...)
- return default:get(...)
-end
-
-
--- Wrapper for "uci revert"
-function Session.revert(self, config)
- return self:_uci2("revert " .. _path(config))
-end
-
-function revert(...)
- return default:revert(...)
-end
-
-
--- Wrapper for "uci show"
-function Session.show(self, config)
- return self:_uci3("show " .. _path(config))
-end
-
-function show(...)
- return default:show(...)
-end
-
-
--- Wrapper for "uci set"
-function Session.set(self, config, section, option, value)
- return self:_uci2("set " .. _path(config, section, option, value))
-end
-
-function set(...)
- return default:set(...)
-end
-
-
--- Internal functions --
-
-function Session._uci(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>/dev/null " .. cmd)
-
- if res:len() == 0 then
- return nil
- else
- return res:sub(1, res:len()-1)
- end
-end
-
-function Session._uci2(self, cmd)
- local res = ffluci.sys.exec(self.ucicmd .. " 2>&1 " .. cmd)
-
- if res:len() > 0 then
- return false, res
- else
- return true
- end
-end
-
-function Session._uci3(self, cmd)
- local res = ffluci.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
-
- table = {}
-
- for k,line in pairs(res) do
- c, s, t = line:match("^([^.]-)%.([^.]-)=(.-)$")
- if c then
- table[c] = table[c] or {}
- table[c][s] = {}
- table[c][s][".type"] = t
- end
-
- c, s, o, v = line:match("^([^.]-)%.([^.]-)%.([^.]-)=(.-)$")
- if c then
- table[c][s][o] = v
- end
- end
-
- return table
-end
-
--- Build path (config.section.option=value) and prevent command injection
-function _path(...)
- local result = ""
-
- -- Not using ipairs because it is not reliable in case of nil arguments
- arg.n = nil
- for k,v in pairs(arg) do
- if v then
- v = tostring(v)
- if k == 1 then
- result = "'" .. v:gsub("['.]", "") .. "'"
- elseif k < 4 then
- result = result .. ".'" .. v:gsub("['.]", "") .. "'"
- elseif k == 4 then
- result = result .. "='" .. v:gsub("'", "") .. "'"
- end
- end
- end
- return result
-end \ No newline at end of file
diff --git a/src/ffluci/sys.lua b/src/ffluci/sys.lua
deleted file mode 100644
index d8fbaa57a..000000000
--- a/src/ffluci/sys.lua
+++ /dev/null
@@ -1,126 +0,0 @@
---[[
-FFLuCI - System library
-
-Description:
-Utilities for interaction with the Linux system
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.sys", package.seeall)
-require("posix")
-
--- Runs "command" and returns its output
-function exec(command)
- local pp = io.popen(command)
- local data = pp:read("*a")
- pp:close()
-
- return data
-end
-
--- Runs "command" and returns its output as a array of lines
-function execl(command)
- local pp = io.popen(command)
- local line = ""
- local data = {}
-
- while true do
- line = pp:read()
- if (line == nil) then break end
- table.insert(data, line)
- end
- pp:close()
-
- return data
-end
-
--- Uses "ffluci-flash" to flash a new image file to the system
-function flash(image, kpattern)
- local cmd = "ffluci-flash "
- if kpattern then
- cmd = cmd .. "-k '" .. kapttern:gsub("'", "") .. "' "
- end
- cmd = cmd .. "'" .. image:gsub("'", "") .. "'"
-
- return os.execute(cmd)
-end
-
--- Returns the hostname
-function hostname()
- return io.lines("/proc/sys/kernel/hostname")()
-end
-
--- Returns the load average
-function loadavg()
- local loadavg = io.lines("/proc/loadavg")()
- return loadavg:match("^(.-) (.-) (.-) (.-) (.-)$")
-end
-
--- Reboots the system
-function reboot()
- return os.execute("reboot >/dev/null 2>&1")
-end
-
-
-group = {}
-group.getgroup = posix.getgroup
-
-net = {}
--- Returns all available network interfaces
-function net.devices()
- local devices = {}
- for line in io.lines("/proc/net/dev") do
- table.insert(devices, line:match(" *(.-):"))
- end
- return devices
-end
-
-process = {}
-process.info = posix.getpid
-
--- Sets the gid of a process
-function process.setgroup(pid, gid)
- return posix.setpid("g", pid, gid)
-end
-
--- Sets the uid of a process
-function process.setuser(pid, uid)
- return posix.setpid("u", pid, uid)
-end
-
-user = {}
--- returns user information to a given uid
-user.getuser = posix.getpasswd
-
--- Changes the user password of given user
-function user.setpasswd(user, pwd)
- if pwd then
- pwd = pwd:gsub("'", "")
- end
-
- if user then
- user = user:gsub("'", "")
- end
-
- local cmd = "(echo '"..pwd.."';sleep 1;echo '"..pwd.."')|"
- cmd = cmd .. "passwd '"..user.."' >/dev/null 2>&1"
- return os.execute(cmd)
-end \ No newline at end of file
diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua
deleted file mode 100644
index 502013684..000000000
--- a/src/ffluci/template.lua
+++ /dev/null
@@ -1,229 +0,0 @@
---[[
-FFLuCI - Template Parser
-
-Description:
-A template parser supporting includes, translations, Lua code blocks
-and more. It can be used either as a compiler or as an interpreter.
-
-FileId: $Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("ffluci.template", package.seeall)
-
-require("ffluci.config")
-require("ffluci.util")
-require("ffluci.fs")
-require("ffluci.i18n")
-require("ffluci.http")
-require("ffluci.model.uci")
-
-viewdir = ffluci.config.path .. "/view/"
-
-
--- Compile modes:
--- none: Never compile, only use precompiled data from files
--- memory: Always compile, do not save compiled files, ignore precompiled
--- file: Compile on demand, save compiled files, update precompiled
-compiler_mode = "memory"
-
-
--- This applies to compiler modes "always" and "smart"
---
--- Produce compiled lua code rather than lua sourcecode
--- WARNING: Increases template size heavily!!!
--- This produces the same bytecode as luac but does not have a strip option
-compiler_enable_bytecode = false
-
-
--- Define the namespace for template modules
-viewns = {
- translate = ffluci.i18n.translate,
- config = function(...) return ffluci.model.uci.get(...) or "" end,
- controller = ffluci.http.script_name(),
- media = ffluci.config.main.mediaurlbase,
- write = io.write,
- include = function(name) Template(name):render(getfenv(2)) end,
-}
-
--- Compiles a given template into an executable Lua module
-function compile(template)
- -- Search all <% %> expressions (remember: Lua table indexes begin with #1)
- local function expr_add(command)
- table.insert(expr, command)
- return "<%" .. tostring(#expr) .. "%>"
- end
-
- -- As "expr" should be local, we have to assign it to the "expr_add" scope
- local expr = {}
- ffluci.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")
- return s
- end
-
- -- Escape and sanitize all the template (all non-expressions)
- template = sanitize(template)
-
- -- Template module header/footer declaration
- local header = "write('"
- local footer = "')"
-
- template = header .. template .. footer
-
- -- Replacements
- local r_include = "')\ninclude('%s')\nwrite('"
- local r_i18n = "'..translate('%1','%2')..'"
- local r_uci = "'..config('%1','%2','%3')..'"
- local r_pexec = "'..%s..'"
- local r_exec = "')\n%s\nwrite('"
-
- -- Parse the expressions
- for k,v in pairs(expr) do
- local p = v:sub(1, 1)
- local re = nil
- if p == "+" then
- re = r_include:format(sanitize(string.sub(v, 2)))
- elseif p == ":" then
- re = sanitize(v):gsub(":(.-) (.+)", r_i18n)
- elseif p == "~" then
- re = sanitize(v):gsub("~(.-)%.(.-)%.(.+)", r_uci)
- elseif p == "=" then
- re = r_pexec:format(v:sub(2))
- else
- re = r_exec:format(v)
- end
- template = template:gsub("<%%"..tostring(k).."%%>", re)
- end
-
- if compiler_enable_bytecode then
- tf = loadstring(template)
- template = string.dump(tf)
- end
-
- return template
-end
-
--- Oldstyle render shortcut
-function render(name, scope, ...)
- scope = scope or getfenv(2)
- local s, t = pcall(Template, name)
- if not s then
- error(t)
- else
- t:render(scope, ...)
- end
-end
-
-
--- Template class
-Template = ffluci.util.class()
-
--- Shared template cache to store templates in to avoid unnecessary reloading
-Template.cache = {}
-
-
--- Constructor - Reads and compiles the template on-demand
-function Template.__init__(self, name)
- if self.cache[name] then
- self.template = self.cache[name]
- else
- self.template = nil
- end
-
- -- Create a new namespace for this template
- self.viewns = {}
-
- -- Copy over from general namespace
- for k, v in pairs(viewns) do
- self.viewns[k] = v
- end
-
- -- If we have a cached template, skip compiling and loading
- if self.template then
- return
- end
-
- -- Compile and build
- local sourcefile = viewdir .. name .. ".htm"
- local compiledfile = viewdir .. name .. ".lua"
- local err
-
- if compiler_mode == "file" then
- local tplmt = ffluci.fs.mtime(sourcefile)
- local commt = ffluci.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)
-
- if source then
- local compiled = compile(source)
- ffluci.fs.writefile(compiledfile, compiled)
- self.template, err = loadstring(compiled)
- end
- else
- self.template, err = loadfile(compiledfile)
- end
-
- elseif compiler_mode == "none" then
- self.template, err = loadfile(self.compiledfile)
-
- elseif compiler_mode == "memory" then
- local source
- source, err = ffluci.fs.readfile(sourcefile)
- if source then
- self.template, err = loadstring(compile(source))
- end
-
- end
-
- -- If we have no valid template throw error, otherwise cache the template
- if not self.template then
- error(err)
- else
- self.cache[name] = self.template
- end
-end
-
-
--- Renders a template
-function Template.render(self, scope)
- scope = scope or getfenv(2)
-
- -- Save old environment
- 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)
-
- -- Now finally render the thing
- self.template()
-
- -- Reset environment
- setfenv(self.template, oldfenv)
-end
diff --git a/src/ffluci/util.lua b/src/ffluci/util.lua
deleted file mode 100644
index dfc88e3e4..000000000
--- a/src/ffluci/util.lua
+++ /dev/null
@@ -1,208 +0,0 @@
---[[
-FFLuCI - Utility library
-
-Description:
-Several common useful Lua functions
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-
-module("ffluci.util", package.seeall)
-
-
--- Lua simplified Python-style OO class support emulation
-function class(base)
- local class = {}
-
- local create = function(class, ...)
- local inst = {}
- setmetatable(inst, {__index = class})
-
- if inst.__init__ then
- local stat, err = pcall(inst.__init__, inst, ...)
- if not stat then
- error(err)
- end
- end
-
- return inst
- end
-
- local classmeta = {__call = create}
-
- if base then
- classmeta.__index = base
- end
-
- setmetatable(class, classmeta)
- return class
-end
-
-
--- Clones an object (deep on-demand)
-function clone(object, deep)
- local copy = {}
-
- for k, v in pairs(object) do
- if deep and type(v) == "table" then
- v = clone(v, deep)
- end
- copy[k] = v
- end
-
- setmetatable(copy, getmetatable(object))
-
- return copy
-end
-
-
--- Checks whether a table has an object "value" in it
-function contains(table, value)
- for k,v in pairs(table) do
- if value == v then
- return true
- end
- end
- return false
-end
-
-
--- Dumps a table to stdout (useful for testing and debugging)
-function dumptable(t, i)
- i = i or 0
- for k,v in pairs(t) do
- print(string.rep("\t", i) .. k, v)
- if type(v) == "table" then
- dumptable(v, i+1)
- end
- end
-end
-
-
--- Escapes all occurences of c in s
-function escape(s, c)
- c = c or "\\"
- return s:gsub(c, "\\" .. c)
-end
-
-
--- Populate obj in the scope of f as key
-function extfenv(f, key, obj)
- local scope = getfenv(f)
- scope[key] = obj
-end
-
-
--- Checks whether an object is an instanceof class
-function instanceof(object, class)
- local meta = getmetatable(object)
- while meta and meta.__index do
- if meta.__index == class then
- return true
- end
- meta = getmetatable(meta.__index)
- end
- return false
-end
-
-
--- Creates valid XML PCDATA from a string
-function pcdata(value)
- value = value:gsub("&", "&amp;")
- value = value:gsub('"', "&quot;")
- value = value:gsub("'", "&apos;")
- value = value:gsub("<", "&lt;")
- return value:gsub(">", "&gt;")
-end
-
-
--- Resets the scope of f doing a shallow copy of its scope into a new table
-function resfenv(f)
- setfenv(f, clone(getfenv(f)))
-end
-
-
--- Returns the Haserl unique sessionid
-function sessionid()
- return ENV.SESSIONID
-end
-
-
--- Splits a string into an array (Adapted from lua-users.org)
-function split(str, pat, max)
- pat = pat or "\n"
- max = max or -1
-
- local t = {}
- local fpat = "(.-)" .. pat
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
-
- while s do
- max = max - 1
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- if max == 0 then
- break
- end
- s, e, cap = str:find(fpat, last_end)
- end
-
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
-
- return t
-end
-
--- Removes whitespace from beginning and end of a string
-function trim (string)
- return string:gsub("^%s*(.-)%s*$", "%1")
-end
-
--- Updates given table with new values
-function update(t, updates)
- for k, v in pairs(updates) do
- t[k] = v
- end
-end
-
-
--- Updates the scope of f with "extscope"
-function updfenv(f, extscope)
- update(getfenv(f), extscope)
-end
-
-
--- Validates a variable
-function validate(value, cast_number, cast_int)
- if cast_number or cast_int then
- value = tonumber(value)
- end
-
- if cast_int and value and not(value % 1 == 0) then
- value = nil
- end
-
- return value
-end \ No newline at end of file
diff --git a/src/ffluci/view/admin_index/index.htm b/src/ffluci/view/admin_index/index.htm
deleted file mode 100644
index 1f06e344c..000000000
--- a/src/ffluci/view/admin_index/index.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<%+header%>
-<h1><%:hello Hallo!%></h1>
-<p><%:admin1 Dies ist der Administrationsbereich. %>
-<p><em>ToDo: Intelligenter Einleitungstext</em></p>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_mesh/index.htm b/src/ffluci/view/admin_mesh/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_mesh/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_network/index.htm b/src/ffluci/view/admin_network/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_network/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_services/index.htm b/src/ffluci/view/admin_services/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_services/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_status/index.htm b/src/ffluci/view/admin_status/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_status/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_status/system.htm b/src/ffluci/view/admin_status/system.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_status/system.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/editor.htm b/src/ffluci/view/admin_system/editor.htm
deleted file mode 100644
index 0215c91df..000000000
--- a/src/ffluci/view/admin_system/editor.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<%+header%>
-<h1><%:texteditor Texteditor%></h1>
-<form method="post" action="<%=controller%>/admin/system/editor">
-<div><%:file Datei%>: <input type="text" name="file" size="30" value="<%=(fn or '')%>" />
-<% if msg then %><span class="error"><%:error Fehler%>: <%=msg%></span><% end %></div>
-<br />
-<div><textarea style="width: 100%" rows="20" name="data"><%=(cnt or '')%></textarea></div>
-<br />
-<div>
- <input type="submit" value="<%:save Speichern%>" />
- <input type="reset" value="<%:reset Zurücksetzen%>" />
-</div>
-</form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/index.htm b/src/ffluci/view/admin_system/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_system/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/ipkg.htm b/src/ffluci/view/admin_system/ipkg.htm
deleted file mode 100644
index bbe7f3bc6..000000000
--- a/src/ffluci/view/admin_system/ipkg.htm
+++ /dev/null
@@ -1,23 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:ipkg IPKG-Konfiguration%></h2>
-
-<br />
-
-<div><strong><%:ipkg_pkglists Paketlisten%>:</strong><code>src <em>Name</em> <em>URL</em></code></div>
-<div><strong><%:ipkg_targets Installationsziele%>:</strong><code>dest <em>Name</em> <em>Pfad</em></code></div>
-
-<br />
-
-<form method="post" action="<%=controller%>/admin/system/ipkg">
- <fieldset class="cbi-section-node">
- <div><textarea style="width: 100%" rows="10" name="data"><%=(cnt or '')%></textarea></div>
- <br />
- <div>
- <input type="submit" value="<%:save Speichern%>" />
- <input type="reset" value="<%:reset Zurücksetzen%>" />
- </div>
- <% if msg then %><br /><div class="error"><%:error Fehler%>: <%=msg%></div><% end %>
- </fieldset>
-</form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/packages.htm b/src/ffluci/view/admin_system/packages.htm
deleted file mode 100644
index d9cdb4dd0..000000000
--- a/src/ffluci/view/admin_system/packages.htm
+++ /dev/null
@@ -1,77 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:packages Paketverwaltung%></h2>
-
-<br />
-
-<% if install or remove or update or upgrade then %>
-<div class="code"><strong><%:status Status%>:</strong><br />
-<% if update then %>
- <%:packages_update Paketlisten aktualisieren%>: <% if update == 0 then %><span class="ok"><%:ok OK%></span><% else %><span class="error"><%:error Fehler%> (<%:code Code%> <%=update%>)</span><% end %><br />
-<% end %>
-<% if upgrade then%>
- <%:packages_upgrade Installierte Pakete aktualisieren%>: <% if upgrade == 0 then %><span class="ok"><%:ok OK%></span><% else %><span class="error"><%:error Fehler%> (<%:code Code%> <%=upgrade%>)</span><% end %><br />
-<% end %>
-<% if install then for k,v in pairs(install) do %>
- <%:packages_install Installation von%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok OK%></span><% else %><span class="error"><%:error Fehler%> (<%:code Code%> <%=v%>)</span><% end %><br />
-<% end end %>
-<% if remove then for k,v in pairs(remove) do %>
- <%:packages_remove Deinstallation von%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok OK%></span><% else %><span class="error"><%:error Fehler%> (<%:code Code%> <%=v%>)</span><% end %><br />
-<% end end %>
-</div>
-<br />
-<% end %>
-
-<div>
-<a href="<%=controller%>/admin/system/ipkg"><%:packages_ipkg Paketlisten und Installationsziele bearbeiten%></a><br />
-<a href="<%=controller%>/admin/system/packages?update=1"><%:packages_updatelist Paketlisten aktualisieren%></a><br />
-<a href="<%=controller%>/admin/system/packages?upgrade=1"><%:packages_upgrade Installierte Pakete aktualisieren%></a>
-</div>
-
-<br />
-<br />
-
-<form method="post" action="<%=controller%>/admin/system/packages">
- <div>
- <span class="bold"><%:packages_installurl Paket herunterladen und installieren%>:</span><br />
- <input type="text" name="url" size="30" value="" />
- <input type="submit" name="submit" value="<%:ok OK%>" />
- </div>
-
- <br />
- <br />
-
- <div>
- <span class="bold"><%:filter Filter%>:</span>
- <input type="text" name="query" size="20" value="<%=(query or '')%>" />
- <input type="submit" name="search" value="<%:packages_search Paket suchen%>" />
- <input type="submit" name="submit" value="<%:packages_do Aktionen ausführen%>" />
- </div>
-
- <br />
- <br />
-
- <div>
- <table style="font-size: 0.8em">
- <tr>
- <th><%:packages_name Paketname%></th>
- <th><%:version Version%></th>
- <th><%:install Installieren%></th>
- <th><%:delete Löschen%></th>
- <th><%:descr Beschreibung%></th>
- </tr>
- <% for k, pkg in pairs(pkgs) do %>
- <tr>
- <td><%=pkg.Package%></td>
- <td><%=(pkg.Version or '')%></td>
- <td><% if not pkg.Status or not pkg.Status.installed then %><input type="checkbox" name="install.<%=pkg.Package%>" value="1" /><% else %><%:installed installiert%><% end %></td>
- <td><% if pkg.Status and pkg.Status.installed then %><input type="checkbox" name="remove.<%=pkg.Package%>" value="1" /><% else %><%:notinstalled nicht installiert%><% end %></td>
- <td><%=(pkg.Description or '')%></td>
- </tr>
- <% end %>
- </table>
- </div>
- <br />
- <input type="submit" name="submit" value="<%:packages_do Aktionen ausführen%>" />
-</form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/passwd.htm b/src/ffluci/view/admin_system/passwd.htm
deleted file mode 100644
index 441753d83..000000000
--- a/src/ffluci/view/admin_system/passwd.htm
+++ /dev/null
@@ -1,34 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:passwd Passwort ändern%></h2>
-<div><br />
-<% if stat then %>
- <% if stat == 0 then %>
- <code><%:password_changed Passwort erfolgreich geändert!%></code>
- <% elseif stat == 10 then %>
- <code class="error"><%:password_nomatch Passwörter stimmen nicht überein! %></code>
- <% else %>
- <code class="error"><%:unknown_error Unbekannter Fehler!%></code>
- <% end %>
-<% end %>
-<% if not stat or stat == 10 then %>
- <form method="post" action="<%=controller%>/admin/system/passwd">
- <fieldset class="cbi-section-node">
- <div class="cbi-value clear">
- <div class="cbi-value-title left"><%:password Passwort%></div>
- <div class="cbi-value-field"><input type="password" name="pwd1" /></div>
- </div>
- <div class="cbi-value clear">
- <div class="cbi-value-title left"><%:confirmation Bestätigung%></div>
- <div class="cbi-value-field"><input type="password" name="pwd2" /></div>
- </div>
- <br />
- <div>
- <input type="submit" value="<%:save Speichern%>" />
- <input type="reset" value="<%:reset Zurücksetzen%>" />
- </div>
- </fieldset>
- </form>
-<% end %>
-</div>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/reboot.htm b/src/ffluci/view/admin_system/reboot.htm
deleted file mode 100644
index 365c33078..000000000
--- a/src/ffluci/view/admin_system/reboot.htm
+++ /dev/null
@@ -1,10 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:reboot Neu starten%></h2>
-<% if not reboot then %>
-<p><a href="<%=controller%>/admin/system/reboot?reboot=1"><%:reboot_do Neustart durchführen%></a></p>
-<% else %>
-<p><%:reboot_running Bitte warten: Neustart wird durchgeführt...%></p>
-<script type="text/javascript">setTimeout("location='<%=controller%>/admin'", 30000)</script>
-<% end %>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/sshkeys.htm b/src/ffluci/view/admin_system/sshkeys.htm
deleted file mode 100644
index 1e1cc24ce..000000000
--- a/src/ffluci/view/admin_system/sshkeys.htm
+++ /dev/null
@@ -1,23 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:sshkeys SSH-Schlüssel%></h2>
-
-<br />
-
-<div><%:sshkeys_descr Hier können öffentliche SSH-Schlüssel (einer pro Zeile)
- zur Authentifizierung abgelegt werden.%></div>
-
-<br />
-
-<form method="post" action="<%=controller%>/admin/system/sshkeys">
- <fieldset class="cbi-section-node">
- <div><textarea style="width: 100%" rows="10" name="data"><%=(cnt or '')%></textarea></div>
- <br />
- <div>
- <input type="submit" value="<%:save Speichern%>" />
- <input type="reset" value="<%:reset Zurücksetzen%>" />
- </div>
- <% if msg then %><br /><div class="error"><%:error Fehler%>: <%=msg%></div><% end %>
- </fieldset>
-</form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_system/upgrade.htm b/src/ffluci/view/admin_system/upgrade.htm
deleted file mode 100644
index d91d169a4..000000000
--- a/src/ffluci/view/admin_system/upgrade.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<%+header%>
-<h1><%:system System%></h1>
-<h2><%:upgrade Upgrade%></h2>
-<br />
-<% if sysupgrade and not ret then %>
-<form method="post" action="<%=controller%>-upload/admin/system/upgrade" enctype="multipart/form-data">
- <fieldset class="cbi-section-node">
- <div class="cbi-value clear">
- <div class="cbi-value-title left"><%:fwimage Firmwareimage%></div>
- <div class="cbi-value-field"><input type="file" size="30" name="image" /></div>
- </div>
- <br />
- <div class="cbi-value clear">
- <input type="checkbox" name="keepcfg" value="1" checked="checked" />
- <span class="bold"><%:keepcfg Konfigurationsdateien übernehmen%></span>
- </div>
- <br />
- <div>
- <input type="submit" value="<%:fwupgrade Firmware aktualisieren%>" />
- </div>
- </fieldset>
-</form>
-<% elseif ret then %>
- <% if ret == 0 then %>
-<div class="ok"><%:flashed Flashvorgang erfolgreich. Router startet neu...%></div>
- <% else %>
-<div class="error"><%:flasherr Flashvorgang fehlgeschlagen!%> (<%:code Code%> <%=ret%>)</div>
- <% end %>
-<% else %>
-<div class="error"><%:notimplemented Diese Funktion steht leider (noch) nicht zur Verfügung.%></div>
-<% end %>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_uci/apply.htm b/src/ffluci/view/admin_uci/apply.htm
deleted file mode 100644
index 43777c6c6..000000000
--- a/src/ffluci/view/admin_uci/apply.htm
+++ /dev/null
@@ -1,6 +0,0 @@
-<%+header%>
-<h1><%:config Konfiguration%></h1>
-<p><%:uci_applied Die folgenden Änderungen wurden übernommen:%></p>
-<code><%=(changes or "-")%>
-<%=output%></code>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_uci/changes.htm b/src/ffluci/view/admin_uci/changes.htm
deleted file mode 100644
index 3bbcd0e5f..000000000
--- a/src/ffluci/view/admin_uci/changes.htm
+++ /dev/null
@@ -1,11 +0,0 @@
-<%+header%>
-<h1><%:config Konfiguration%></h1>
-<h2><%:changes Änderungen%></h2>
-<code><%=(ffluci.model.uci.changes() or "-")%></code>
-<form class="inline" method="get" action="<%=controller%>/admin/uci/apply">
- <input type="submit" value="<%:apply Anwenden%>" />
-</form>
-<form class="inline" method="get" action="<%=controller%>/admin/uci/revert">
- <input type="submit" value="<%:revert Verwerfen%>" />
-</form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_uci/revert.htm b/src/ffluci/view/admin_uci/revert.htm
deleted file mode 100644
index f5eabc71b..000000000
--- a/src/ffluci/view/admin_uci/revert.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<%+header%>
-<h1><%:config Konfiguration%></h1>
-<p><%:uci_reverted Die folgenden Änderungen wurden verworfen:%></p>
-<code><%=(changes or "-")%></code>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/admin_wifi/index.htm b/src/ffluci/view/admin_wifi/index.htm
deleted file mode 100644
index 75aa02658..000000000
--- a/src/ffluci/view/admin_wifi/index.htm
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/dvalue.htm b/src/ffluci/view/cbi/dvalue.htm
deleted file mode 100644
index 178f2e16a..000000000
--- a/src/ffluci/view/cbi/dvalue.htm
+++ /dev/null
@@ -1,12 +0,0 @@
-<%+cbi/valueheader%>
-<% if self.value then
- if type(self.value) == "function" then %>
- <%=self:value(section)%>
-<% else %>
- <%=self.value%>
-<% end
-else %>
- <%=(self:cfgvalue(section) or "")%>
-<% end %>
-&nbsp;
-<%+cbi/valuefooter%>
diff --git a/src/ffluci/view/cbi/footer.htm b/src/ffluci/view/cbi/footer.htm
deleted file mode 100644
index 2acf710cd..000000000
--- a/src/ffluci/view/cbi/footer.htm
+++ /dev/null
@@ -1,7 +0,0 @@
- <div>
- <input type="submit" value="<%:save Speichern%>" />
- <input type="reset" value="<%:reset Zurücksetzen%>" />
- <script type="text/javascript">cbi_d_init();</script>
- </div>
- </form>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/fvalue.htm b/src/ffluci/view/cbi/fvalue.htm
deleted file mode 100644
index b609f1d4f..000000000
--- a/src/ffluci/view/cbi/fvalue.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-<%+cbi/valueheader%>
- <input onchange="cbi_d_update(this.id)" type="checkbox" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == self.enabled then %> checked="checked"<% end %> value="1" />
-<%+cbi/valuefooter%> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/header.htm b/src/ffluci/view/cbi/header.htm
deleted file mode 100644
index 20b4aac7f..000000000
--- a/src/ffluci/view/cbi/header.htm
+++ /dev/null
@@ -1,7 +0,0 @@
-<%+header%>
- <form method="post" action="<%=os.getenv("REQUEST_URI")%>">
- <div>
- <script type="text/javascript" src="<%=media%>/cbi.js"></script>
- <input type="hidden" name="cbi.submit" value="1" />
- <input type="submit" value="<%:cbi_save Speichern%>" class="hidden" />
- </div>
diff --git a/src/ffluci/view/cbi/lvalue.htm b/src/ffluci/view/cbi/lvalue.htm
deleted file mode 100644
index f1ae5a093..000000000
--- a/src/ffluci/view/cbi/lvalue.htm
+++ /dev/null
@@ -1,16 +0,0 @@
-<%+cbi/valueheader%>
-<% if self.widget == "select" then %>
- <select onchange="cbi_d_update(this.id)" id="cbid.<%=self.config.."."..section.."."..self.option%>" 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 self:cfgvalue(section) == key then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
-<% end %>
- </select>
-<% elseif self.widget == "radio" then
- local c = 0;
- for i, key in pairs(self.keylist) do
- c = c + 1%>
- <%=self.vallist[i]%><input type="radio" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" />
-<% if c == self.size then c = 0 %><br />
-<% end end %>
-<% end %>
-<%+cbi/valuefooter%> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/map.htm b/src/ffluci/view/cbi/map.htm
deleted file mode 100644
index 83c377fb8..000000000
--- a/src/ffluci/view/cbi/map.htm
+++ /dev/null
@@ -1,7 +0,0 @@
- <div class="cbi-map" id="cbi-<%=self.config%>">
- <h1><%=self.title%></h1>
- <div class="cbi-map-descr"><%=self.description%></div>
- <br />
-<% self:render_children() %>
- <br />
- </div>
diff --git a/src/ffluci/view/cbi/mvalue.htm b/src/ffluci/view/cbi/mvalue.htm
deleted file mode 100644
index 97a1c4295..000000000
--- a/src/ffluci/view/cbi/mvalue.htm
+++ /dev/null
@@ -1,19 +0,0 @@
-<%
-local v = self:valuelist(section)
-%>
-<%+cbi/valueheader%>
-<% 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>
-<% 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%>" />
-<% if c == self.size then c = 0 %><br />
-<% end end %>
-<% end %>
-<%+cbi/valuefooter%> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/nsection.htm b/src/ffluci/view/cbi/nsection.htm
deleted file mode 100644
index 9c54a9942..000000000
--- a/src/ffluci/view/cbi/nsection.htm
+++ /dev/null
@@ -1,17 +0,0 @@
-<% if self:cfgvalue(self.section) then
-section = self.section %>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=section%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
- <% if self.addremove then %><div class="cbi-section-remove">
- <input type="submit" name="cbi.rns.<%=self.config%>.<%=section%>" value="<%:cbi_del Eintrag entfernen%>" />
- </div><% end %>
-<%+cbi/ucisection%>
- </div>
-<% elseif self.addremove then %>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
- <input type="submit" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:cbi_cns Eintrag anlegen%>" />
- </div>
-<% end %>
diff --git a/src/ffluci/view/cbi/tsection.htm b/src/ffluci/view/cbi/tsection.htm
deleted file mode 100644
index 8da0b4a1d..000000000
--- a/src/ffluci/view/cbi/tsection.htm
+++ /dev/null
@@ -1,22 +0,0 @@
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
-<% for k, v in pairs(self:cfgsections()) do%>
- <% if self.addremove then %><div class="cbi-section-remove right">
- <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" />
- </div><% end %>
- <% if not self.anonymous then %><h3><%=k%></h3><% end %>
-<% section = k %>
-<%+cbi/ucisection%>
-<% end %>
-<% if self.addremove then %>
- <div class="cbi-section-create">
- <% if self.anonymous then %>
- <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add Eintrag hinzufügen%>" />
- <% else %>
- <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
- <input type="submit" value="<%:cbi_add Eintrag hinzufügen%>" />
- <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %>
- </div>
-<% end %>
- </div>
diff --git a/src/ffluci/view/cbi/ucisection.htm b/src/ffluci/view/cbi/ucisection.htm
deleted file mode 100644
index ef1b6cb0e..000000000
--- a/src/ffluci/view/cbi/ucisection.htm
+++ /dev/null
@@ -1,23 +0,0 @@
- <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
-<% self:render_children(section) %>
- <% if #self.optionals[section] > 0 or self.dynamic then %>
- <div class="cbi-optionals">
- <% if self.dynamic then %>
- <input type="text" name="cbi.opt.<%=self.config%>.<%=section%>" />
- <% else %>
- <select name="cbi.opt.<%=self.config%>.<%=section%>">
- <option><%:cbi_addopt -- Feld --%></option>
- <% for key, val in pairs(self.optionals[section]) do %>
- <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option>
- <% end %>
- </select>
- <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
- <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..val.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
- <% end %><% end %>
- <% end %></script>
- <% end %>
- <input type="submit" value="<%:add hinzufügen%>" />
- </div>
- <% end %>
- </fieldset>
- <br /> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/value.htm b/src/ffluci/view/cbi/value.htm
deleted file mode 100644
index 61033a0f5..000000000
--- a/src/ffluci/view/cbi/value.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-<%+cbi/valueheader%>
- <input type="text" onchange="cbi_d_update(this.id)" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" id="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" />
-<%+cbi/valuefooter%>
diff --git a/src/ffluci/view/cbi/valuefooter.htm b/src/ffluci/view/cbi/valuefooter.htm
deleted file mode 100644
index 3f92f09e2..000000000
--- a/src/ffluci/view/cbi/valuefooter.htm
+++ /dev/null
@@ -1,8 +0,0 @@
- <div class="cbi-value-description inline"><%=self.description%></div>
- </div>
- <% if self.tag_invalid[section] then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %>
- </div>
- <% if #self.deps > 0 then %><script type="text/javascript">
- <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
- <% end %>
- </script><% end %> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/valueheader.htm b/src/ffluci/view/cbi/valueheader.htm
deleted file mode 100644
index 86c782d71..000000000
--- a/src/ffluci/view/cbi/valueheader.htm
+++ /dev/null
@@ -1,3 +0,0 @@
- <div class="cbi-value clear" id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
- <div class="cbi-value-title left"><%=self.title%></div>
- <div class="cbi-value-field"> \ No newline at end of file
diff --git a/src/ffluci/view/error404.htm b/src/ffluci/view/error404.htm
deleted file mode 100644
index adc671de0..000000000
--- a/src/ffluci/view/error404.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<%+header%>
-<h1>404 Not Found</h1>
-<p>Sorry, the object you requested was not found.</p>
-<tt>Unable to dispatch: <%=os.getenv("PATH_INFO")%></tt>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/error500.htm b/src/ffluci/view/error500.htm
deleted file mode 100644
index 8af22e8f2..000000000
--- a/src/ffluci/view/error500.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<%+header%>
-<h1>500 Internal Server Error</h1>
-<p>Sorry, the server encountered an unexpected error.</p>
-<tt><%=message%></tt>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/footer.htm b/src/ffluci/view/footer.htm
deleted file mode 100644
index 8d48c5fac..000000000
--- a/src/ffluci/view/footer.htm
+++ /dev/null
@@ -1,7 +0,0 @@
- </div>
- <div class="clear"></div>
-</div></div>
-
-<div class="separator magenta bold">FFLuCI 0.2 - Freifunk Lua Configuration Interface</div>
-</body>
-</html> \ No newline at end of file
diff --git a/src/ffluci/view/header.htm b/src/ffluci/view/header.htm
deleted file mode 100644
index 40d54f516..000000000
--- a/src/ffluci/view/header.htm
+++ /dev/null
@@ -1,78 +0,0 @@
-<%
-require("ffluci.sys")
-local load1, load5, load15 = ffluci.sys.loadavg()
-local req = require("ffluci.dispatcher").request
-local menu = require("ffluci.menu").get()[req.category]
-require("ffluci.i18n").loadc("default")
-require("ffluci.http").htmlheader()
-%><?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">
-<head>
- <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
- <link rel="stylesheet" type="text/css" href="<%=media%>/css/<%=req.category%>_<%=req.module%>.css" />
- <meta http-equiv="content-type" content="text/xhtml+xml; charset=utf-8" />
- <meta http-equiv="content-script-type" content="text/javascript" />
- <title>FFLuCI</title>
-</head>
-<body>
-<div id="header">
- <div class="headerlogo left"><img src="<%=media%>/logo.png" alt="Freifunk" /></div>
- <div class="whitetext smalltext right">
- OpenWRT Kamikaze<br />
- Freifunk Firmware 2.0-dev<br />
- <%:load Last%>: <%=load1%> <%=load5%> <%=load15%><br />
- <%:hostname Hostname%>: <%=ffluci.sys.hostname()%>
- </div>
- <div>
- <span class="headertitle">Freifunk Kamikaze</span><br />
- <span class="whitetext bold"><%:batmanedition Fledermausedition%></span>
- </div>
-</div>
-
-<div class="separator yellow bold">
-<%:path Pfad%>: <a href="<%=controller .. "/" .. req.category%>"><%=translate(req.category, req.category)%></a>
-&#187; <a href="<%=controller .. "/" .. req.category .. "/" .. req.module %>"><%=translate(req.module, req.module)%></a>
-&#187; <a href="<%=controller .. "/" .. req.category .. "/" .. req.module .. "/" .. req.action %>"><%=translate(req.action, req.action)%></a>
-</div>
-
-<div id="columns"><div id="columnswrapper">
- <div class="sidebar left">
- <% for k,v in pairs(menu) do %>
- <div<% if v[".contr"] == req.module then %> class="yellowtext"<% end %>><a href="<%=controller.."/"..req.category.."/"..v[".contr"]%>"><%=translate(v[".contr"], v[".descr"])%></a><%
- if v[".contr"] == req.module then %>
- <ul><% for key,val in ipairs(v) do %>
- <li<% if val.action == req.action then %> class="yellowtext"<% end %>><a href="<%=controller.."/"..req.category.."/"..req.module.."/"..val.action%>"><%=translate(val.action, val.descr)%></a></li>
- <% end %></ul>
- <% end %></div>
- <% end %>
- </div>
- <div class="sidebar right">
- <div><%:webif Weboberfläche%>
- <ul>
- <li<% if "public" == req.category then %> class="yellowtext"<% end %>><a href="<%=controller%>/public"><%:public Öffentlich%></a></li>
- <li<% if "admin" == req.category then %> class="yellowtext"<% end %>><a href="<%=controller%>/admin"><%:admin Verwaltung%></a></li>
- </ul>
- </div>
- <%
- if "admin" == req.category then
- require("ffluci.model.uci")
- local ucic = ffluci.model.uci.changes()
- if ucic then
- ucic = #ffluci.util.split(ucic)
- end
- %>
- <div><%:config Konfiguration%>
- <ul>
- <% if ucic then %>
- <li><a href="<%=controller%>/admin/uci/changes"><%:changes Änderungen:%> <%=ucic%></a></li>
- <li><a href="<%=controller%>/admin/uci/apply"><%:apply Anwenden%></a></li>
- <li><a href="<%=controller%>/admin/uci/revert"><%:revert Verwerfen%></a></li>
- <% else %>
- <li><%:changes Änderungen: %> 0</li>
- <% end %>
- </ul>
- </div>
- <% end %>
- </div>
- <div id="content"> \ No newline at end of file
diff --git a/src/ffluci/view/public_index/contact.htm b/src/ffluci/view/public_index/contact.htm
deleted file mode 100644
index ded0a94af..000000000
--- a/src/ffluci/view/public_index/contact.htm
+++ /dev/null
@@ -1,12 +0,0 @@
-<%+header%>
-<h1><%:contact Kontakt%></h1>
-<table class="contact">
- <tr><th><%:nickname Pseudonym%>:</th><td><%~luci.contact.nickname%></td></tr>
- <tr><th><%:name Name%>:</th><td><%~luci.contact.name%></td></tr>
- <tr><th><%:mail E-Mail%>:</th><td><%~luci.contact.mail%></td></tr>
- <tr><th><%:phone Telefon%>:</th><td><%~luci.contact.phone%></td></tr>
- <tr><th><%:location Standort%>:</th><td><%~luci.contact.location%></td></tr>
- <tr><th><%:geocoord Geokoordinaten%>:</th><td><%~luci.contact.geo%></td></tr>
- <tr><th><%:note Notiz%>:</th><td><%~luci.contact.note%></td></tr>
-</table>
-<%+footer%> \ No newline at end of file
diff --git a/src/ffluci/view/public_index/index.htm b/src/ffluci/view/public_index/index.htm
deleted file mode 100644
index 1f06e344c..000000000
--- a/src/ffluci/view/public_index/index.htm
+++ /dev/null
@@ -1,5 +0,0 @@
-<%+header%>
-<h1><%:hello Hallo!%></h1>
-<p><%:admin1 Dies ist der Administrationsbereich. %>
-<p><em>ToDo: Intelligenter Einleitungstext</em></p>
-<%+footer%> \ No newline at end of file