2) Slight code cleanup in pbx.lua
return (exten:match("[#*+0-9NXZ]+$") ~= nil)
end
return (exten:match("[#*+0-9NXZ]+$") ~= nil)
end
--- Gets rid of leading and trailing whitespace.
-function trim(s)
- return (s:gsub("^%s*(.-)%s*$", "%1"))
-end
-
m = Map (modulename, translate("Call Routing"),
translate("This is where you indicate which Google/SIP accounts are used to call what \
m = Map (modulename, translate("Call Routing"),
translate("This is where you indicate which Google/SIP accounts are used to call what \
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
- val = trim(value[index])
+ val = luci.util.trim(value[index])
if is_valid_extension(val) == true then
newvalue[nindex] = val
nindex = nindex + 1
if is_valid_extension(val) == true then
newvalue[nindex] = val
nindex = nindex + 1
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
- val = trim(value[index])
+ val = luci.util.trim(value[index])
if is_valid_extension(val) == true then
newvalue[nindex] = val
nindex = nindex + 1
if is_valid_extension(val) == true then
newvalue[nindex] = val
nindex = nindex + 1
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
- trimuser = trim(value[index])
+ trimuser = luci.util.trim(value[index])
if allvalidusers[trimuser] == true then
newvalue[nindex] = trimuser
nindex = nindex + 1
if allvalidusers[trimuser] == true then
newvalue[nindex] = trimuser
nindex = nindex + 1
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
newvalue = {}
nindex = 1
for index, field in ipairs(value) do
- trimuser = trim(value[index])
+ trimuser = luci.util.trim(value[index])
if allvalidusers[trimuser] == true then
newvalue[nindex] = trimuser
nindex = nindex + 1
if allvalidusers[trimuser] == true then
newvalue[nindex] = trimuser
nindex = nindex + 1
cookedvalue = {}
cindex = 1
for index, field in ipairs(value) do
cookedvalue = {}
cindex = 1
for index, field in ipairs(value) do
- cooked = string.gsub(trim(value[index]), "%W", "_")
+ cooked = string.gsub(luci.util.trim(value[index]), "%W", "_")
if validoutaccounts[cooked] ~= nil then
cookedvalue[cindex] = cooked
cindex = cindex + 1
if validoutaccounts[cooked] ~= nil then
cookedvalue[cindex] = cooked
cindex = cindex + 1
translate("The number(s) specified above will be able to dial out with this user's providers.\
Invalid usernames are dropped silently, please verify that the entry was accepted."))
function user.write(self, section, value)
translate("The number(s) specified above will be able to dial out with this user's providers.\
Invalid usernames are dropped silently, please verify that the entry was accepted."))
function user.write(self, section, value)
+ trimuser = luci.util.trim(value)
if allvalidusers[trimuser] == true then
Value.write(self, section, trimuser)
end
if allvalidusers[trimuser] == true then
Value.write(self, section, trimuser)
end
end
-- Split input into separate lines.
end
-- Split input into separate lines.
lines = mysplit(string, "\n")
-- Split lines into separate words.
splitlines = {}
for lpos,line in ipairs(lines) do
lines = mysplit(string, "\n")
-- Split lines into separate words.
splitlines = {}
for lpos,line in ipairs(lines) do
- splitlines[lpos] = mysplit(line)
+ splitlines[lpos] = mysplit(line, " ")
end
-- For each split line, if the word at all indices specified
end
-- For each split line, if the word at all indices specified