--[[
HTTP protocol implementation for LuCI - date handling
(c) 2008 Freifunk Leipzig / Jo-Philipp Wich
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
$Id: date.lua 3941 2008-12-23 21:39:38Z jow $
]]--
--- LuCI http protocol implementation - date helper class.
-- This class contains functions to parse, compare and format http dates.
module("luci.http.protocol.date", package.seeall)
require("luci.sys.zoneinfo")
MONTHS = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
}
--- Return the time offset in seconds between the UTC and given time zone.
-- @param tz Symbolic or numeric timezone specifier
-- @return Time offset to UTC in seconds
function tz_offset(tz)
if type(tz) == "string" then
-- check for a numeric identifier
local s, v = tz:match("([%+%-])([0-9]+)")
if s == '+' then s = 1 else s = -1 end
if v then v = tonumber(v) end
if s and v then
return s * 60 * ( math.floor( v / 100 ) * 60 + ( v % 100 ) )
-- lookup symbolic tz
elseif luci.sys.zoneinfo.OFFSET[tz:lower()] then
return luci.sys.zoneinfo.OFFSET[tz:lower()]
end
end
-- bad luck
return 0
end
--- Parse given HTTP date string and convert it to unix epoch time.
-- @param data String containing the date
-- @return Unix epoch time
function to_unix(date)
local wd, day, mon, yr, hr, min, sec, tz = date:match(
"([A-Z][a-z][a-z]), ([0-9]+) " ..
"([A-Z][a-z][a-z]) ([0-9]+) " ..
"([0-9]+):([0-9]+):([0-9]+) " ..
"([A-Z0-9%+%-]+)"
)
if day and mon and yr and hr and min and sec then
-- find month
local month = 1
for i = 1, 12 do
if MONTHS[i] == mon then
month = i
break
end
end
-- convert to epoch time
return tz_offset(tz) + os.time( {
year = yr,
month = month,
day = day,
hour = hr,
min = min,
sec = sec
} )
end
return 0
end
--- Convert the given unix epoch time to valid HTTP date string.
-- @param time Unix epoch time
-- @return String containing the formatted date
function to_http(time)
return os.date( "%a, %d %b %Y %H:%M:%S GMT", time )
end
--- Compare two dates which can either be unix epoch times or HTTP date strings.
-- @param d1 The first date or epoch time to compare
-- @param d2 The first date or epoch time to compare
-- @return -1 - if d1 is lower then d2
-- @return 0 - if both dates are equal
-- @return 1 - if d1 is higher then d2
function compare(d1, d2)
if d1:match("[^0-9]") then d1 = to_unix(d1) end
if d2:match("[^0-9]") then d2 = to_unix(d2) end
if d1 == d2 then
return 0
elseif d1 < d2 then
return -1
else
return 1
end
end
--[[
LuCI - HTTP-Interaction
Description:
HTTP-Header manipulator and form variable preprocessor
FileId:
$Id: http.lua 3838 2008-11-29 21:59:06Z Cyrus $
License:
Copyright 2008 Steven Barth
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.
]]--
local ltn12 = require "luci.ltn12"
local protocol = require "luci.http.protocol"
local util = require "luci.util"
local string = require "string"
local coroutine = require "coroutine"
local pairs, tostring, error = pairs, tostring, error
--- LuCI Web Framework high-level HTTP functions.
module "luci.http"
context = util.threadlocal()
Request = util.class()
function Request.__init__(self, env, sourcein, sinkerr)
self.input = sourcein
self.error = sinkerr
-- File handler
self.filehandler = function() end
-- HTTP-Message table
self.message = {
env = env,
headers = {},
params = protocol.urldecode_params(env.QUERY_STRING or ""),
}
self.parsed_input = false
end
function Request.formvalue(self, name, noparse)
if not noparse and not self.parsed_input then
self:_parse_input()
end
if name then
return self.message.params[name]
else
return self.message.params
end
end
function Request.formvaluetable(self, prefix)
local vals = {}
prefix = prefix and prefix .. "." or "."
if not self.parsed_input then
self:_parse_input()
end
local void = self.message.params[nil]
for k, v in pairs(self.message.params) do
if k:find(prefix, 1, true) == 1 then
vals[k:sub(#prefix + 1)] = tostring(v)
end
end
return vals
end
function Request.content(self)
if not self.parsed_input then
self:_parse_input()
end
return self.message.content, self.message.content_length
end
function Request.getcookie(self, name)
local c = string.gsub(";" .. (self:getenv("HTTP_COOKIE") or "") .. ";", "%s*;%s*", ";")
local p = ";" .. name .. "=(.-);"
local i, j, value = c:find(p)
return value and urldecode(value)
end
function Request.getenv(self, name)
if name then
return self.message.env[name]
else
return self.message.env
end
end
function Request.setfilehandler(self, callback)
self.filehandler = callback
end
function Request._parse_input(self)
protocol.parse_message_body(
self.input,
self.message,
self.filehandler
)
self.parsed_input = true
end
--- Close the HTTP-Connection.
function close()
if not context.eoh then
context.eoh = true
coroutine.yield(3)
end
if not context.closed then
context.closed = true
coroutine.yield(5)
end
end
--- Return the request content if the request was of unknown type.
-- @return HTTP request body
-- @return HTTP request body length
function content()
return context.request:content()
end
--- Get a certain HTTP input value or a table of all input values.
-- @param name Name of the GET or POST variable to fetch
-- @param noparse Don't parse POST data before getting the value
-- @return HTTP input value or table of all input value
function formvalue(name, noparse)
return context.request:formvalue(name, noparse)
end
--- Get a table of all HTTP input values with a certain prefix.
-- @param prefix Prefix
-- @return Table of all HTTP input values with given prefix
function formvaluetable(prefix)
return context.request:formvaluetable(prefix)
end
--- Get the value of a certain HTTP-Cookie.
-- @param name Cookie Name
-- @return String containing cookie data
function getcookie(name)
return context.request:getcookie(name)
end
--- Get the value of a certain HTTP environment variable
-- or the environment table itself.
-- @param name Environment variable
-- @return HTTP environment value or environment table
function getenv(name)
return context.request:getenv(name)
end
--- Set a handler function for incoming user file uploads.
-- @param callback Handler function
function setfilehandler(callback)
return context.request:setfilehandler(callback)
end
--- Send a HTTP-Header.
-- @param key Header key
-- @param value Header value
function header(key, value)
if not context.headers then
context.headers = {}
end
context.headers[key:lower()] = value
coroutine.yield(2, key, value)
end
--- Set the mime type of following content data.
-- @param mime Mimetype of following content
function prepare_content(mime)
if not context.headers or not context.headers["content-type"] then
if mime == "application/xhtml+xml" then
if not getenv("HTTP_ACCEPT") or
not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then
mime = "text/html; charset=UTF-8"
end
header("Vary", "Accept")
end
header("Content-Type", mime)
end
end
--- Get the RAW HTTP input source
-- @return HTTP LTN12 source
function source()
return context.request.input
end
--- Set the HTTP status code and status message.
-- @param code Status code
-- @param message Status message
function status(code, message)
code = code or 200
message = message or "OK"
context.status = code
coroutine.yield(1, code, message)
end
--- Send a chunk of content data to the client.
-- This function is as a valid LTN12 sink.
-- If the content chunk is nil this function will automatically invoke close.
-- @param content Content chunk
-- @param src_err Error object from source (optional)
-- @see close
function write(content, src_err)
if not content then
if src_err then
error(src_err)
else
close()
end
return true
elseif #content == 0 then
return true
else
if not context.eoh then
if not context.status then
status()
end
if not context.headers or not context.headers["content-type"] then
header("Content-Type", "text/html; charset=utf-8")
end
if not context.headers["cache-control"] then
header("Cache-Control", "no-cache")
header("Expires", "0")
end
context.eoh = true
coroutine.yield(3)
end
coroutine.yield(4, content)
return true
end
end
--- Redirects the client to a new URL and closes the connection.
-- @param url Target URL
function redirect(url)
status(302, "Found")
header("Location", url)
close()
end
--- Create a querystring out of a table of key - value pairs.
-- @param table Query string source table
-- @return Encoded HTTP query string
function build_querystring(table)
local s="?"
for k, v in pairs(table) do
s = s .. urlencode(k) .. "=" .. urlencode(v) .. "&"
end
return s
end
--- Return the URL-decoded equivalent of a string.
-- @param str URL-encoded string
-- @param no_plus Don't decode + to " "
-- @return URL-decoded string
-- @see urlencode
urldecode = protocol.urldecode
--- Return the URL-encoded equivalent of a string.
-- @param str Source string
-- @return URL-encoded string
-- @see urldecode
urlencode = protocol.urlencode
uvl_err_uciload = 'Não foi possível carregar a configuração \"%p\": %1'
uvl_err_scheme = 'Erro no esquema \"%p\":\n%c'
uvl_err_config = 'Erro na configuração \"%p\":\n%c'
uvl_err_section = 'Erro na seção \"%i\" (%I):\n%c'
uvl_err_option = 'Erro na opção \"%i\" (%I):\n%c'
uvl_err_reference = 'Opção \"%i\" tem especificação de referência inválida %1:\n%c'
uvl_err_dependency = 'Na dependência de verificação %t \"%i\":\n%c'
uvl_err_sme_find = 'Não é possível encontrar o esquema \"%p\" in \"%1\"'
uvl_err_sme_read = 'Não é possível acessar o arquivo \"%1\"'
uvl_err_sme_reqfld = 'Faltando campo requerido no esquema: \"%1\" em \"%i\"'
uvl_err_sme_invref = 'Referência \"1%\" ilegal para uma seção anônima'
uvl_err_sme_badref = 'Referência mal elaborada em \"%1\"'
uvl_err_sme_baddep = 'Especificação de dependência mal elaborada: \"%1\" em \"%i\"'
uvl_err_sme_badval = 'Especificação de validador mal elaborada: \"%1\" em \"%i\"'
uvl_err_sme_errval = 'Validador externo \"%1\" falhou: %2'
uvl_err_sme_vbadpack = 'Variável \"%o\" no esquema \"%p\" faz referência para um pacote desconecido \"%1\"'
uvl_err_sme_vbadsect = 'Variável \"%o\" no esquema \"%p\" faz referência para uma seção desconecida \"%1\"'
uvl_err_sme_ebadpack = 'Enum \"%v\" no esquema \"%p\" faz referência para um pacote desconecido \"%1\"'
uvl_err_sme_ebadsect = 'Enum \"%v\" no esquema \"%p\" faz referência para uma seção desconecida \"%1\"'
uvl_err_sme_ebadopt = 'Enum \"%v\" no esquema \"%p\" faz referência para uma opção desconecida \"%1\"'
uvl_err_sme_ebadtype = 'Enum \"%v\" no esquema \"%p\" faz referência para uma opção não-enum \"%p.%s.%o\"'
uvl_err_sme_ebaddef = 'Enum \"%v\" no esquema \"%p\" redeclara o valor padrão de \"%p.%s.%o\"'
uvl_err_sect_unknown = 'Seção \"%i\" (%I) não encontrada no esquema'
uvl_err_sect_required = 'Seção requerida \"%p.%s\" não encontrada na configuração'
uvl_err_sect_unique = 'Seção única \"%p.%s\" ocorre várias vezes na configuração'
uvl_err_sect_named = 'A seção do tipo \"%p.%s\" está armazenada na configuração como anônima, mas deve ser nomeada'
uvl_err_sect_notfound = 'Seção \"%p.%s\" não encontrada na configuração'
uvl_err_opt_unknown = 'Opção \"%i\" (%I) não encontrada no esquema'
uvl_err_opt_required = 'Opção requerida \"%i\" não tem nenhum valor'
uvl_err_opt_badvalue = 'Valor \"%1\" da opção \"%i\" não está definido no enum %2'
uvl_err_opt_invvalue = 'Valor \"%1\" da opção \"%i\" não foi validado como tipo de dados \"%2\"'
uvl_err_opt_notlist = 'Opção \"%i\" está definida como lista, mas armazenada como um valor simples'
uvl_err_opt_datatype = 'Opção \"%i\" tem o tipo de dados desconhecido \"%1\"'
uvl_err_opt_notfound = 'Opção \"%p.%s.%o\" não encontrada na configuração'
uvl_err_dep_notequal = 'Dependência (%1) falhou:\nopção \"%i\" is not eqal à \"%2\"'
uvl_err_dep_novalue = 'Dependência (%1) falhou:\nopção \"%i\" não tem nenhum valor'
uvl_err_dep_notvalid = 'Dependência (%1) falhou:\n%c'
uvl_err_dep_recursive = 'Dependência recursiva para a opção \"%i\" detectada'
uvl_err_dep_badenum = 'Na dependência, verificar pelo valor enum \"%i\":\n%c'
uci_applied = 'The following changes have been applied'
uci_reverted = 'The following changes have been reverted'
a_i_ui = 'User Interface'
c_lucidesc = 'LuCI is a collection of free Lua software including an MVC-Webframework and webinterface for embedded devices. LuCI is licensed under the Apache-License.'
c_projecthome = 'Project Homepage'
c_leaddev = 'Lead Development'
c_contributors = 'Contributing Developers'
c_thanksto = 'Thanks To'
a_i_i_hello = 'Hello!'
a_i_i_admin1 = 'This is the administration area of LuCI.'
a_i_i_admin2 = 'LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWrt Kamikaze.'
a_i_i_admin3 = 'On the following pages you can adjust all important settings of your router.'
a_i_i_admin4 = 'Notice: In LuCI changes have to be confirmed by clicking Changes - Save & Apply before being applied.'
a_i_i_admin5 = 'As we always want to improve this interface we are looking forward to your feedback and suggestions.'
a_i_i_admin6 = 'And now have fun with your router!'
a_i_i_team = 'The LuCI Team'
a_i_luci1 = 'Here you can customize the settings and the functionality of LuCI.'
a_i_ucicommit = 'Post-commit actions'
a_i_ucicommit1 = 'These commands will be executed automatically when a given UCI configuration is committed allowing changes to be applied instantly.'
a_i_keepflash = 'Files to be kept when flashing a new firmware'
a_i_keepflash1 = 'When flashing a new firmware with LuCI these files will be added to the new firmware installation.'
a_st_i_status1 = 'Here you can find information about the current system status like CPU clock frequency, memory usage or network interface data.'
a_st_i_status2 = 'Also kernel or service logfiles can be viewed here to get an overview over their current state.'
iwscan = 'WLAN-Scan'
iwscan1 = 'Wifi networks in your local environment'
iwscan_encr = 'Encr.'
iwscan_link = 'Link'
iwscan_signal = 'Signal'
iwscan_noise = 'Noise'
routes = 'Routes'
routes_netmask = 'Netmask'
routes_gateway = 'Gateway'
routes_metric = 'Metric'
a_s_desc = 'Here you can configure the basic aspects of your device like its hostname or the timezone.'
a_s_packages = 'Software'
a_s_changepw = 'Admin Password'
a_s_p_ipkg = 'OPKG-Configuration'
a_s_sshkeys = 'SSH-Keys'
a_s_fstab = 'Mount Points'
a_s_flash = 'Flash Firmware'
a_s_i_system1 = 'Change settings related to the system itself, its identification, installed hard- and software, authentication or mount points.'
a_s_i_system2 = 'These settings define the base of your system.'
a_s_i_system3 = 'Pay attention as any misconfiguration here may prevent your device from booting or may lock yourself out of it.'
a_s_packages_do = 'Perform Actions'
a_s_packages_install = 'Install'
a_s_packages_installurl = 'Download and install package'
a_s_packages_ipkg = 'Edit package lists and installation targets'
a_s_packages_name = 'Package name'
a_s_packages_remove = 'Remove'
a_s_packages_search = 'Find package'
a_s_packages_update = 'Package lists updated'
a_s_packages_updatelist = 'Update package lists'
a_s_packages_upgrade = 'Upgrade installed packages'
a_s_p_ipkg_pkglists = 'Package lists'
a_s_p_ipkg_targets = 'Installation targets'
a_s_changepw1 = 'Change the password of the system administrator (User root
)'
a_s_changepw_changed = 'Password successfully changed'
a_s_changepw_nomatch = 'Error: Passwords do not match'
a_s_sshkeys1 = 'Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.'
a_s_fstab_mountpoints = 'Mount Points'
a_s_fstab_mountpoints1 = 'Mount Points define at which point a memory device will be attached to the filesystem'
a_s_fstab_active = 'Mounted file systems'
a_s_fstab_used = 'Used'
a_s_fstab_avail = 'Available'
a_s_fstab_mountpoint = 'Mount Point'
a_s_fstab_device1 = 'The device file of the memory or partition (e.g. /dev/sda1
)'
a_s_fstab_fs1 = 'The filesystem that was used to format the memory (e.g. ext3)'
a_s_fstab_swap1 = 'If your physical memory is insufficient unused data can be temporarily swapped to a swap-device resulting in a higher amount of usable RAM. Be aware that swapping data is a very slow process as the swap-device cannot be accessed with the high datarates of the RAM.'
a_s_flash_flashed = 'Firmware successfully flashed. Rebooting device...'
a_s_flash_flasherr = 'Failed to flash'
a_s_flash_fwimage = 'Firmware image'
a_s_flash_received = 'Image received. About to start flashing process. DO NOT POWER OFF THE DEVICE!'
a_s_flash_inprogress = 'Writing firmware...'
a_s_flash_fwupgrade = 'Flash Firmware'
a_s_flash_keepcfg = 'Keep configuration files'
a_s_flash_notimplemented = 'Sorry, this function is not (yet) available for your platform.'
a_s_flash_upgrade1 = 'Replaces the installed firmware with a new one. The firmware format is platform-dependent.'
a_s_reboot1 = 'Reboots the operating system of your device'
a_s_reboot_do = 'Perform reboot'
a_s_reboot_running = 'Please wait: Device rebooting...'
a_s_reboot_u = 'Warning: There are unsaved changes that will be lost while rebooting!'
a_s_applyreboot1 = 'Changes applied.'
a_s_backup = 'Backup / Restore'
a_s_backup_backup = 'Create backup'
a_s_backup_archive = 'Backup Archive'
a_s_backup_reset = 'Reset router to defaults'
a_s_backup_reset1 = 'Proceed reverting all settings and resetting to firmware defaults?'
a_s_backup_restore = 'Restore backup'
a_s_backup1 = 'Here you can backup and restore your router configuration and - if possible - reset the router to the default settings.'
a_srv_http = 'HTTP-Server'
a_srv_ssh = 'SSH-Server'
a_srv_services1 = 'Services and daemons perform certain tasks on your device.'
a_srv_services2 = 'Most of them are network servers, that offer a certain service for your device or network like shell access, serving webpages like LuCI, doing mesh routing, sending e-mails, ...'
a_srv_http1 = 'A small webserver which can be used to serve LuCI.'
a_srv_http_authrealm = 'Authentication Realm'
a_srv_http_authrealm1 = 'The realm which will be displayed at the authentication prompt for protected pages.'
a_srv_http_config1 = 'defaults to /etc/httpd.conf
'
a_srv_http_root = 'Document root'
a_srv_dropbear1 = 'Dropbear offers SSH network shell access and an integrated SCP server'
a_srv_d_pwauth = 'Password authentication'
a_srv_d_pwauth1 = 'Allow SSH password authentication'
a_w_channel = 'Channel'
a_w_wifi1 = 'On this pages you can find configuration options for WLAN based wireless networks.'
a_w_wifi2 = 'You can easily integrate your 802.11a/b/g/n-devices into your physical network and use the virtual adapter support to build wireless repeaters or offer several networks with one device.'
a_w_wifi3 = 'There is support for Managed, Client, Ad-Hoc and WDS operating modes as well as WPA and WPA2 encryption for secure communnication.'
a_w_devices1 = 'Here you can configure installed wifi devices.'
a_w_txantenna = 'Transmit Antenna'
a_w_rxantenna = 'Receive Antenna'
a_w_distance1 = 'Distance to furthest station (in meter)'
a_w_diversity = 'Diversity'
a_w_countrycode = 'Country Code'
a_w_connlimit = 'Connection Limit'
a_w_networks1 = 'You can run several wifi networks with one device. Be aware that there are certain hardware and driverspecific restrictions. Normally you can operate 1 Ad-Hoc or up to 3 Master-Mode and 1 Client-Mode network simultaneously.'
a_w_netid = 'Network Name (ESSID)'
a_w_network1 = 'Add the Wifi network to physical network'
a_w_netmanual = ' - Create new Network - '
a_w_txpwr = 'Transmit Power'
a_w_brcmburst = 'Broadcom Frameburst'
a_w_athburst = 'Atheros Frameburst'
a_w_radiussrv = 'RadiusServer'
a_w_radiusport = 'Radius-Port'
a_w_apisolation = 'AP-Isolation'
a_w_apisolation1 = 'Prevents Client to Client communication'
a_w_hideessid = 'Hide ESSID'
a_w_ap = 'Access Point'
a_w_adhoc = 'Ad-Hoc'
a_w_ahdemo = 'Pseudo Ad-Hoc (ahdemo)'
a_w_client = 'Client'
a_w_wds = 'WDS'
a_w_monitor = 'Monitor'
dhcp_dnsmasq_desc = 'Dnsmasq is a combined DHCP-Server and DNS-Forwarder for NAT firewalls'
dhcp_dnsmasq_domainneeded = 'Domain required'
dhcp_dnsmasq_domainneeded_desc = 'Don't forward DNS-Requests without DNS-Name'
dhcp_dnsmasq_authoritative = 'Authoritative'
dhcp_dnsmasq_authoritative_desc = 'This is the only DHCP in the local network'
dhcp_dnsmasq_boguspriv = 'Filter private'
dhcp_dnsmasq_boguspriv_desc = 'Don't forward reverse lookups for local networks'
dhcp_dnsmasq_filterwin2k = 'Filter useless'
dhcp_dnsmasq_filterwin2k_desc = 'filter useless DNS-queries of Windows-systems'
dhcp_dnsmasq_localisequeries = 'Localise queries'
dhcp_dnsmasq_localisequeries_desc = 'localises the hostname depending on its subnet'
dhcp_dnsmasq_local = 'Local Server'
dhcp_dnsmasq_domain = 'Local Domain'
dhcp_dnsmasq_expandhosts = 'Expand Hosts'
dhcp_dnsmasq_expandhosts_desc = 'adds domain names to hostentries in the resolv file'
dhcp_dnsmasq_nonegcache = 'don't cache unknown'
dhcp_dnsmasq_nonegcache_desc = 'prevents caching of negative DNS-replies'
dhcp_dnsmasq_readethers = 'Use /etc/ethers
'
dhcp_dnsmasq_readethers_desc = 'Read /etc/ethers
to configure the DHCP-Server'
dhcp_dnsmasq_leasefile = 'Leasefile'
dhcp_dnsmasq_leasefile_desc = 'file where given DHCP-leases will be stored'
dhcp_dnsmasq_resolvfile = 'Resolvfile'
dhcp_dnsmasq_resolvfile_desc = 'local DNS file'
dhcp_dnsmasq_nohosts = 'Ignore /etc/hosts
'
dhcp_dnsmasq_strictorder = 'Strict order'
dhcp_dnsmasq_strictorder_desc = 'DNS-Server will be queried in the order of the resolvfile'
dhcp_dnsmasq_logqueries = 'Log queries'
dhcp_dnsmasq_noresolv = 'Ignore resolve file'
dhcp_dnsmasq_dnsforwardmax = 'concurrent queries'
dhcp_dnsmasq_port = 'DNS-Port'
dhcp_dnsmasq_ednspacket_max = 'max. EDNS0 paket size'
dhcp_dnsmasq_dhcpleasemax = 'max. DHCP-Leases'
dhcp_dnsmasq_addnhosts = 'additional hostfile'
dhcp_dnsmasq_queryport = 'query port'
dhcp_dnsmasq_enabletftp = 'Enable TFTP-Server'
dhcp_dnsmasq_tftproot = 'TFTP-Server Root'
dhcp_dnsmasq_dhcpboot = 'Network Boot Image'
a_n_switch = 'Switch'
a_n_c@ @ @ @ @ @ @ @ @ @ onntrack = 'Active Connections'
a_n_conntrack_desc = 'This page gives an overview over currently active network connections.'
a_n_routes = 'Routes'
a_n_routes4 = 'IPv4 Routes'
a_n_routes6 = 'IPv6 Routes'
a_network1 = 'In this area you find all network-related settings.'
a_network2 = 'On most routers the network switch can be freely configured and splitted up into several VLANs.'
a_network3 = 'Interfaces and PPPoE / PPTP-Settings allow a custom organisation of the network and connections to other networks like the internet.'
a_network4 = 'With DHCP devices in your local network can be automatically configured for network communication.'
a_network5 = 'Firewall and portforwarding can be used to secure your network while providing services to external networks.'
a_n_switch1 = 'The network ports on your router can be combined to several VLANs in which computers can communicate directly with each other. VLANs are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network.'
network_switch_desc = 'Ports belonging to a VLAN are separated with spaces. The port with the highest number (usually 5) is oftern the connection to the internal network interface of the router. On devices with 5 ports often the one with the lowest number (0) is the predefined Uplink port.'
a_n_ifaces1 = 'On this page you can configure the network interfaces. You can bridge several interfaces by ticking the "bridge interfaces" field and enter the names of several network interfaces separated by spaces. You can also use VLAN notation INTERFACE.VLANNR (e.g.: eth0.1).'
a_n_i_bridge = 'Bridge interfaces'
a_n_i_bridge1 = 'creates a bridge over specified interface(s)'
dhcp_desc = 'With DHCP network members can automatically receive their network settings (IP-address, netmask, DNS-server, ...).'
dhcp_dhcp_leasetime = 'Leasetime'
dhcp_dhcp_dynamicdhcp = 'Dynamic DHCP'
dhcp_dhcp_ignore = 'Ignore interface'
dhcp_dhcp_ignore_desc = 'disable DHCP for this interface'
dhcp_dhcp_force = 'Force'
dhcp_dhcp_start_desc = 'first address (last octet)'
dhcp_dhcp_limit_desc = 'number of leased addresses -1'
dhcp_dhcp_dhcpoption = 'DHCP-Options'
dhcp_dhcp_dhcpoption_desc = 'See "dnsmasq --help dhcp" for a list of available options.'
dhcp_leases = 'Leases'
luci_ethers = 'Static Leases'
dhcp_timeremain = 'Leasetime remaining'
dhcp_leases_active = 'Active Leases'
a_n_ptp = 'Point-to-Point Connections'
a_n_ptp1 = 'Point-to-Point connections with PPPoE or PPTP are often used to connect a device over DSL or similar technologies to an internet access point.'
network_interface_prereq = 'You need to install "comgt" for UMTS/GPRS, "ppp-mod-pppoe" for PPPoE, "ppp-mod-pppoa" for PPPoA or "pptp" for PPtP support'
network_interface_prereq_mini = 'You need to install "ppp-mod-pppoe" for PPPoE or "pptp" for PPtP support'
network_interface_server = 'PPTP-Server'
network_interface_demand = 'Automatic Disconnect'
network_interface_demand_desc = 'Time (in seconds) after which an unused connection will be closed'
network_interface_keepalive = 'Keep-Alive'
network_interface_keepalive_desc = 'Number of failed connection tests to initiate automatic reconnect'
network_interface_device = 'Modem device'
network_interface_device_desc = 'The device node of your modem, e.g. /dev/ttyUSB0'
network_interface_defaultroute = 'Replace default route'
network_interface_defaultroute_desc = 'Let pppd replace the current default route to use the PPP interface after successful connect'
network_interface_peerdns = 'Use peer DNS'
network_interface_peerdns_desc = 'Configure the local DNS server to use the name servers adverticed by the PPP peer'
network_interface_ipv6 = 'Enable IPv6 on PPP link'
network_interface_connect = 'Connect script'
network_interface_connect_desc = 'Let pppd run this script after establishing the PPP link'
network_interface_disconnect = 'Disconnect script'
network_interface_disconnect_desc = 'Let pppd run this script before tearing down the PPP link'
network_interface_pppd_options = 'Additional pppd options'
network_interface_pppd_options_desc = 'Specify additional command line arguments for pppd here'
network_interface_apn = 'Access point (APN)'
network_interface_pincode = 'PIN code'
network_interface_pincode_desc = 'Make sure that you provide the correct pin code here or you might lock your sim card!'
network_interface_service = 'Service type'
network_interface_maxwait = 'Setup wait time'
network_interface_maxwait_desc = 'Seconds to wait for the modem to become ready before attempting to connect'
network_interface_encaps = 'PPPoA Encapsulation'
a_n_r_routes1 = 'Routes specify over which interface and gateway a certain host or network can be reached.'
a_n_routes_static = 'Static Routes'
a_n_routes_static4 = 'Static IPv4 Routes'
a_n_routes_static6 = 'Static IPv6 Routes'
a_n_routes_kernel4 = 'Active IPv4-Routes'
a_n_routes_kernel6 = 'Active IPv6-Routes'
a_n_r_target1 = 'Host-IP or Network'
a_n_r_target6 = 'IPv6-Address or Network (CIDR)'
a_n_r_netmask1 = 'if target is a network'
m_n_inet = 'Internet Connection'
m_n_local = 'Local Network'
m_n_route = 'Route'
m_n_brdige = 'Bridge'
m_w_ap = 'Provide (Access Point)'
m_w_adhoc = 'Independent (Ad-Hoc)'
m_w_client = 'Join (Client)'
m_w_wds = 'Distributed (WDS)'
m_w_clientmode = 'Clientmode'
system_system_logsize = 'System log buffer size'
system_system_logip = 'External system log server'
system_system_conloglevel = 'Log output level'
system_system_conloglevel_desc = 'Level of log messages on the console'
m_i_processor = 'Processor'
m_i_memory = 'Memory'
m_i_systemtime = 'Local Time'
m_i_uptime = 'Uptime'
m_n_d_firstaddress = 'First leased address'
m_n_d_numleases = 'Number of leased addresses'
routingtable = 'Routing table'
wlanscan = 'Wifi scan'
frequency = 'Frequency'
power = 'Power'
noise = 'Noise'
signal = 'Signal'
link = 'Link'
frag = 'Frag.'
rts = 'RTS'
bitrate = 'Bitrate'
m_n_keepalive = 'automatically reconnect'
m_n_dialondemand = 'disconnect when idle for'
m_n_pptp_server = 'PPTP-Server'
leds = 'LED Configuration'
leds_desc = 'Customizes the behaviour of the device LEDs if possible.'
system_led_name = 'LED Name'
system_led_sysfs = 'LED Device'
system_led_default = 'Default state'
system_led_default_desc = 'ticked = on'
system_led_trigger = 'Trigger'
system_led_trigger_none = 'None'
system_led_trigger_defaulton = 'Default On'
system_led_trigger_timer = 'Timer'
system_led_trigger_heartbeat = 'Heartbeat (Load Average)'
system_led_trigger_netdev = 'Network Device'
system_led_delayoff = 'Off-State Delay'
system_led_delayoff_desc = 'Time (in ms) the LED is off'
system_led_delayon = 'On-State Delay'
system_led_delayon_desc = 'Time (in ms) the LED is on'
system_led_dev = 'Device'
system_led_mode = 'Trigger Mode'
system_led_mode_link = 'Link On'
system_led_mode_tx = 'Transmit'
system_led_mode_rx = 'Receive'
network_interface_up = 'Active'
network_interface_hwaddr = 'MAC-Address'
network_interface_hwaddr_desc = 'Hardware Address'
network_interface_txrx = 'Traffic'
network_interface_txrx_desc = 'transmitted / received'
network_interface_err = 'Errors'
network_interface_err_desc = 'TX / RX'
network_interface_fwzone = 'Create / Assign firewall-zone'
network_interface_fwzone_desc = 'This interface does not belong to any firewall zone yet.'
process_head = 'Processes'
process_descr = 'This list gives an overview over currently running system processes and their status.'
process_pid = 'PID'
process_owner = 'Owner'
process_command = 'Command'
process_cpu = 'CPU usage (%)'
process_mem = 'Memory usage (%)'
process_hup = 'Hang Up'
process_term = 'Terminate'
process_kill = 'Kill'
mem_cached = 'cached'
mem_buffered = 'buffered'
mem_free = 'free'
a_s_crontab = 'Scheduled Tasks'
a_s_crontab1 = 'This is the system crontab in which scheduled tasks can be defined.'
a_w_nasid = 'NAS ID'
a_w_cacert = 'Path to CA-Certificate'
a_w_eaptype = 'EAP-Method'
a_w_tlsprivkey = 'Path to Private Key'
a_w_tlsprivkeypwd = 'Password of Private Key'
a_w_peapauth = 'PEAP-Authentication'
a_w_peapidentity = 'PEAP-Identity'
a_w_peappassword = 'PEAP-Password'
a_w_create = 'Create Network'
hostnames = 'Hostnames'
hostnames_entries = 'Host entries'
hostnames_hostname = 'Hostname'
hostnames_address = 'IP address'
luci_components = "LuCI Components"
m_n_mssfix = "Clamp Segment Size"
m_n_mssfix_desc = "Fixes problems with unreachable websites, submitting forms or other unexpected behaviour for some ISPs."
--[[
UCI Validation Layer - Dependency helper
(c) 2008 Jo-Philipp Wich
(c) 2008 Steven Barth
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
$Id: dependencies.lua 3260 2008-09-13 09:09:38Z Cyrus $
]]--
local uvl = require "luci.uvl"
local ERR = require "luci.uvl.errors"
local util = require "luci.util"
local table = require "table"
local type, unpack = type, unpack
local ipairs, pairs = ipairs, pairs
module "luci.uvl.dependencies"
function _parse_reference( r, c, s, o )
local ref = { }
local vars = {
config = c,
section = s,
option = o
}
for v in r:gmatch("[^.]+") do
ref[#ref+1] = (v:gsub( "%$(.+)", vars ))
end
if #ref < 2 then
table.insert(ref, 1, s or '$section')
end
if #ref < 3 then
table.insert(ref, 1, c or '$config')
end
return ref
end
function _serialize_dependency( dep, v )
local str
for k, v in util.spairs( dep,
function(a,b)
a = ( type(dep[a]) ~= "boolean" and "_" or "" ) .. a
b = ( type(dep[b]) ~= "boolean" and "_" or "" ) .. b
return a < b
end
) do
str = ( str and str .. " and " or "" ) .. k ..
( type(v) ~= "boolean" and "=" .. v or "" )
end
return str
end
function check( self, object, nodeps )
local derr = ERR.DEPENDENCY(object)
if not self.depseen[object:cid()] then
self.depseen[object:cid()] = true
else
return false, derr:child(ERR.DEP_RECURSIVE(object))
end
if object:scheme('depends') then
local ok = true
local valid = false
for _, dep in ipairs(object:scheme('depends')) do
local subcondition = true
for k, v in pairs(dep) do
-- XXX: better error
local ref = _parse_reference( k, unpack(object.cref) )
if not ref then
return false, derr:child(ERR.SME_BADDEP(object,k))
end
local option = uvl.option( self, object.c, unpack(ref) )
valid, err = self:_validate_option( option, true )
if valid then
if not (
( type(v) == "boolean" and option:value() ) or
( ref[3] and option:value() ) == v
) then
subcondition = false
local depstr = _serialize_dependency( dep, v )
derr:child(
type(v) == "boolean"
and ERR.DEP_NOVALUE(option, depstr)
or ERR.DEP_NOTEQUAL(option, {depstr, v})
)
break
end
else
subcondition = false
local depstr = _serialize_dependency( dep, v )
derr:child(ERR.DEP_NOTVALID(option, depstr):child(err))
break
end
end
if subcondition then
ok = true
break
else
ok = false
end
end
if not ok then
return false, derr
end
else
return true
end
if object:scheme("type") == "enum" and
object:scheme("enum_depends")[object:value()]
then
local ok = true
local valid = false
local enum = object:enum()
local eerr = ERR.DEP_BADENUM(enum)
for _, dep in ipairs(enum:scheme('enum_depends')[object:value()]) do
local subcondition = true
for k, v in pairs(dep) do
-- XXX: better error
local ref = _parse_reference( k, unpack(object.cref) )
if not ref then
return false, derr:child(eerr:child(ERR.SME_BADDEP(enum,k)))
end
local option = luci.uvl.option( self, object.c, unpack(ref) )
valid, err = self:_validate_option( option, true )
if valid then
if not (
( type(v) == "boolean" and object.config[ref[2]][ref[3]] ) or
( ref[3] and object:config() ) == v
) then
subcondition = false
local depstr = _serialize_dependency( dep, v )
eerr:child(
type(v) == "boolean"
and ERR.DEP_NOVALUE(option, depstr)
or ERR.DEP_NOTEQUAL(option, {depstr, v})
)
break
end
else
subcondition = false
local depstr = _serialize_dependency( dep, v )
eerr:child(ERR.DEP_NOTVALID(option, depstr):child(err))
break
end
end
if subcondition then
return true
else
ok = false
end
end
if not ok then
return false, derr:child(eerr)
end
end
return true
end
. " .. uci.lua filebrowser.lua services.lua
status.lua #
system.lua index.lua p network.lua --[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth
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
$Id: index.lua 4041 2009-01-16 12:39:50Z Cyrus $
]]--
module("luci.controller.admin.index", package.seeall)
function index()
luci.i18n.loadc("admin-core")
local i18n = luci.i18n.translate
local root = node()
if not root.target then
root.target = alias("admin")
root.index = true
end
entry({"about"}, template("about")).i18n = "admin-core"
local page = node("admin")
page.target = alias("admin", "index")
page.title = i18n("administration", "Administration")
page.order = 10
page.i18n = "admin-core"
page.sysauth = "root"
page.sysauth_authenticator = "htmlauth"
page.ucidata = true
page.index = true
local page = node("admin", "index")
page.target = template("admin_index/index")
page.title = i18n("overview", "Übersicht")
page.order = 10
page.index = true
local page = node("admin", "index", "luci")
page.target = cbi("admin_index/luci")
page.title = i18n("a_i_ui", "Oberfläche")
page.order = 10
entry({"admin", "index", "components"}, call("redir_components"), i18n("luci_components", "LuCI Components"), 20)
entry({"admin", "index", "logout"}, call("action_logout"), i18n("logout"), 90)
end
function redir_components()
luci.http.redirect(luci.dispatcher.build_url("admin", "system", "packages")..'?update=1&query=luci')
end
function action_logout()
local dsp = require "luci.dispatcher"
local sauth = require "luci.sauth"
if dsp.context.authsession then
sauth.kill(dsp.context.authsession)
dsp.context.urltoken.stok = nil
end
luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
luci.http.redirect(luci.dispatcher.build_url())
end
. " .. luci_fw.lua ELF 4 4 , , , <