savezone.lua.svn-base
来自「嵌入式无线路由系统openwrt的web配置工具」· SVN-BASE 代码 · 共 35 行
SVN-BASE
35 行
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson()if (data ~= nil and data['values'] ~= nil) then file = 'firewall' if (data['id'] == nil) then uci.init(file) data['id'] = uci.add(file, 'zone') else uci.init(file, data['id'], 'zone') end fields = { name = 1, input = 1, output = 1, forward = 1, masq = 1 } network = {} ifnames = {} for field, value in pairs(data['values']) do if (fields[ field ] ~= nil) then uci.setvalue(file, data['id'], field, value) elseif (value ~= '') then table.insert(network, value) table.insert(ifnames, field) end end uci.setvalue(file, data['id'], 'network', table.concat(network, ' ')) uci.setvalue(file, data['id'], 'ifnames', table.concat(ifnames, ' ')) uci.commit(file)end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?