mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Removed and fixes some dependencies
This commit is contained in:
parent
4b0767ca2e
commit
e597e83e15
22 changed files with 641 additions and 1078 deletions
|
|
@ -18,6 +18,9 @@ pragma_once_lua_utils_gui = true
|
|||
|
||||
local clock_start = os.clock()
|
||||
|
||||
require "gui_utils"
|
||||
require "alert_severity_utils"
|
||||
|
||||
local format_utils = require "format_utils"
|
||||
local dns_utils = require "dns_utils"
|
||||
local http_utils = require "http_utils"
|
||||
|
|
@ -129,37 +132,6 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function noHtml(s)
|
||||
if s == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
local gsub, char = string.gsub, string.char
|
||||
local entityMap = {
|
||||
lt = "<",
|
||||
gt = ">",
|
||||
amp = "&",
|
||||
quot = '"',
|
||||
apos = "'"
|
||||
}
|
||||
local entitySwap = function(orig, n, s)
|
||||
return (n == '' and entityMap[s]) or (n == "#" and tonumber(s)) and string.char(s) or
|
||||
(n == "#x" and tonumber(s, 16)) and string.char(tonumber(s, 16)) or orig
|
||||
end
|
||||
|
||||
local function unescape(str)
|
||||
return (gsub(str, '(&(#?x?)([%d%a]+);)', entitySwap))
|
||||
end
|
||||
|
||||
local cleaned = s:gsub("<[aA] .->(.-)</[aA]>", "%1"):gsub("<abbr .->(.-)</abbr>", "%1"):gsub("<span .->(.-)</span>",
|
||||
"%1"):gsub("<button .->(.-)</button>", "%1"):gsub("%s*<[iI].->(.-)</[iI]>", "%1"):gsub("<.->(.-)</.->", "%1") -- note: keep as last as this does not handle nested tags
|
||||
:gsub("^%s*(.-)%s*$", "%1"):gsub(' ', " ")
|
||||
|
||||
return unescape(cleaned)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function addGoogleMapsScript()
|
||||
local g_maps_key = ntop.getCache('ntopng.prefs.google_apis_browser_key')
|
||||
if g_maps_key ~= nil and g_maps_key ~= "" then
|
||||
|
|
@ -1685,16 +1657,6 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
function map_score_to_severity(score)
|
||||
if score ~= nil then
|
||||
return ntop.mapScoreToSeverity(score)
|
||||
end
|
||||
|
||||
return ntop.mapScoreToSeverity(0)
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
-- Note that ifname can be set by Lua.cpp so don't touch it if already defined
|
||||
if ((ifname == nil) and (_GET ~= nil)) then
|
||||
ifname = _GET["ifid"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue