--
-- (C) 2013-20 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local plugins_utils = require("plugins_utils")
local user_scripts = require("user_scripts")
local page_utils = require("page_utils")
sendHTTPContentTypeHeader('text/html')
page_utils.set_active_menu_entry(page_utils.menu_entries.plugins)
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
-- print[[
]]
local ifid = interface.getId()
local edition = _GET["edition"] or ""
-- #######################################################
if(isAdministrator() and (_POST["action"] == "reload")) then
local plugins_utils = require("plugins_utils")
plugins_utils.loadPlugins()
user_scripts.loadDefaultConfig()
end
-- #######################################################
local function printPlugins()
local plugins = plugins_utils.getLoadedPlugins()
print[[Loaded Plugins
| Plugin | Description | Source Location | Availability |
]]
for _, plugin in pairsByField(plugins, "title", asc) do
local available = ""
-- Availability
if(plugin.edition == "enterprise") then
available = "Enterprise"
if((edition ~= "") and (edition ~= "enterprise")) then goto skip end
elseif(plugin.edition == "pro") then
available = "Pro"
if((edition ~= "") and (edition ~= "pro")) then goto skip end
else
available = "Community"
if((edition ~= "") and (edition ~= "community")) then goto skip end
end
print(string.format([[| %s | %s | %s | %s |
]], plugin.title, plugin.description, plugin.path, available))
::skip::
end
print[[
]]
end
-- #######################################################
print[[
]]
if isAdministrator() then
print[[
]]
end
print[[
]]
printPlugins()
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")