Merge remote-tracking branch 'origin/develop' into ent-3878-Report-type-summation-not-working-properly

This commit is contained in:
Luis Calvo 2019-09-16 11:02:18 +02:00
commit a04268b33c
217 changed files with 5491 additions and 3323 deletions

View File

@ -1,170 +1,183 @@
var max_events; var max_events;
var bg; var bg;
$(document).ready(function(){ $(document).ready(function() {
max_events=localStorage["events"]; max_events = localStorage["events"];
if(localStorage["events"]==undefined){ if (localStorage["events"] == undefined) {
localStorage["events"]="20"; localStorage["events"] = "20";
} }
bg=chrome.extension.getBackgroundPage(); bg = chrome.extension.getBackgroundPage();
// Display the information // Display the information
if (bg.fetchEvents().length == 0) { if (bg.fetchEvents().length == 0) {
showError("Error in fetching data!! Check your internet connection"); showError("No events");
} else { } else {
showEvents(); showEvents();
} }
// Adding buttons listeners // Adding buttons listeners
document.getElementById("m_refresh").addEventListener("click", mrefresh); document.getElementById("m_refresh").addEventListener("click", mrefresh);
// Added listener to background messages // Added listener to background messages
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){ chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
switch (message.text) { switch (message.text) {
case "FETCH_EVENTS": case "FETCH_EVENTS":
setSpinner(); setSpinner();
//$('div.b').hide(); //$('div.b').hide();
break; break;
case "FETCH_EVENTS_SUCCESS": case "FETCH_EVENTS_SUCCESS":
unsetSpinner(); unsetSpinner();
showEvents(); showEvents();
break; break;
case "FETCH_EVENTS_DATA_ERROR": case "FETCH_EVENTS_DATA_ERROR":
unsetSpinner(); unsetSpinner();
showError("Error in fetching data!! Check your internet connection"); showError("Error in fetching data!! Check your internet connection");
break; break;
case "FETCH_EVENTS_URL_ERROR": case "FETCH_EVENTS_URL_ERROR":
unsetSpinner(); unsetSpinner();
showError("Configure ip address,API password, user name and password with correct values"); showError(
break; "Configure ip address,API password, user name and password with correct values"
default: );
console.log("Unrecognized message: ", message.text); break;
break; default:
} console.log("Unrecognized message: ", message.text);
}); break;
}
});
}); });
function setSpinner () { function setSpinner() {
$('#refr_img_id').attr("src", "images/spinny.gif"); $("#refr_img_id").attr("src", "images/spinny.gif");
} }
function unsetSpinner() { function unsetSpinner() {
$('#refr_img_id').attr("src", "images/refresh.png"); $("#refr_img_id").attr("src", "images/refresh.png");
} }
function clearError() { function clearError() {
$('.error').hide(); $(".error").hide();
$('.error a').text(""); $(".error a").text("");
$('.result').css('height', null); $(".result").css("height", null);
} }
function showError(text){ function showError(text) {
$('.error a').text(text); $(".error a").text(text);
$('.error').show(); $(".error").show();
$('.result').height(420); $(".result").height(420);
} }
function showEvents(){ function showEvents() {
clearError();
$("#events").empty();
var e_refr = document.getElementById("event_temp");
if (e_refr) {
wrapper.removeChild(e_refr);
}
var allEvents = bg.fetchEvents();
var notVisitedEvents = bg.fetchNotVisited();
var eve = document.createElement("div");
eve.id = "event_temp";
eve.setAttribute("class", "b");
clearError(); var i = 0;
$('#events').empty(); if (allEvents.length > 0) {
var e_refr = document.getElementById('event_temp'); while (i < max_events && i < allEvents.length) {
if(e_refr){ var eve_title = document.createElement("div");
wrapper.removeChild(e_refr); eve_title.id = "e_" + i + "_" + allEvents[i]["id"];
} var img = document.createElement("img");
var allEvents = bg.fetchEvents(); img.src = "images/plus.png";
var notVisitedEvents = bg.fetchNotVisited(); img.className = "pm";
var eve=document.createElement('div'); img.id = "i_" + i + "_" + allEvents[i]["id"];
eve.id="event_temp"; eve_title.appendChild(img);
eve.setAttribute("class","b"); var div_empty = document.createElement("img");
var a = document.createElement("a");
var i=0; var temp_style;
if(allEvents.length>0){
while(i<max_events && i<allEvents.length){
var eve_title=document.createElement('div');
eve_title.id = 'e_' + i + '_' + allEvents[i]['id'];
var img = document.createElement('img');
img.src = 'images/plus.png';
img.className ='pm';
img.id='i_' + i + '_' + allEvents[i]['id'];
eve_title.appendChild(img);
var div_empty = document.createElement('img');
var a = document.createElement('a');
var temp_style;
var agent_url = (allEvents[i]["agent"] == 0)
? localStorage["ip_address"]
+ "/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
+ allEvents[i]['agent'];
a.setAttribute("href",agent_url);
a.target = "_blank";
a.className = 'a_2_mo';
a.innerText = allEvents[i]['title'];
eve_title.setAttribute("class","event sev-" + allEvents[i]['severity']);
if (notVisitedEvents[allEvents[i]['id']] === true) { var agent_url =
eve_title.style.fontWeight = 600; allEvents[i]["agent"] == 0
} ? localStorage["ip_address"] +
"/index.php?sec=eventos&sec2=operation/events/events"
eve_title.appendChild(a); : localStorage["ip_address"] +
eve.appendChild(eve_title); "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" +
allEvents[i]["agent"];
var time=allEvents[i]['date'].split(" "); a.setAttribute("href", agent_url);
var time_text = time[0]+" "+time[1]; a.target = "_blank";
a.className = "a_2_mo";
var p = document.createElement('p');
var id = (allEvents[i]['module']==0)
? "."
: " in the module with Id "+ allEvents[i]['module'] + ".";
p.innerText = allEvents[i]['type']+" : "+allEvents[i]['source']+". Event occured at "+ time_text+id;
p.id = 'p_' + i;
eve_title.appendChild(p);
i++;
}
$('#events').append(eve);
$('img.pm').click(showHide); a.innerText = allEvents[i]["title"];
$('div.b').show(); eve_title.setAttribute("class", "event sev-" + allEvents[i]["severity"]);
} else {
showError("Error in fetching data!! Check your internet connection"); if (notVisitedEvents[allEvents[i]["id"]] === true) {
} eve_title.style.fontWeight = 600;
}
localStorage["new_events"]=0;
bg.updateBadge(); eve_title.appendChild(a);
eve.appendChild(eve_title);
var time = allEvents[i]["date"].split(" ");
var time_text = time[0] + " " + time[1];
var p = document.createElement("p");
var id =
allEvents[i]["module"] == 0
? "."
: " in the module with Id " + allEvents[i]["module"] + ".";
p.innerText =
allEvents[i]["type"] +
" : " +
allEvents[i]["source"] +
". Event occured at " +
time_text +
id;
p.id = "p_" + i;
eve_title.appendChild(p);
i++;
}
$("#events").append(eve);
$("img.pm").click(showHide);
$("div.b").show();
} else {
showError("No events");
}
localStorage["new_events"] = 0;
bg.updateBadge();
} }
function showHide() { function showHide() {
var id = $(this).attr('id'); var id = $(this).attr("id");
// Image id has the form i_<position>_<eventId> // Image id has the form i_<position>_<eventId>
var nums = id.split('_'); var nums = id.split("_");
var pid = "p_" + nums[1]; var pid = "p_" + nums[1];
// Mark as visited if visited // Mark as visited if visited
if($(this).parent().css('font-weight') == '600') { if (
bg.removeNotVisited(nums[2]); $(this)
$(this).parent().css('font-weight', ''); .parent()
} .css("font-weight") == "600"
) {
bg.removeNotVisited(nums[2]);
$(this)
.parent()
.css("font-weight", "");
}
// Toggle information // Toggle information
if($('#' + pid).css('display') == 'none') { if ($("#" + pid).css("display") == "none") {
$('#' + pid).slideDown(); $("#" + pid).slideDown();
$(this).attr({src: 'images/minus.png'}); $(this).attr({ src: "images/minus.png" });
} } else {
else { $("#" + pid).slideUp();
$('#' + pid).slideUp(); $(this).attr({ src: "images/plus.png" });
$(this).attr({src: 'images/plus.png'}); }
}
} }
function mrefresh(){ function mrefresh() {
localStorage["new_events"]=0; localStorage["new_events"] = 0;
bg.updateBadge(); bg.updateBadge();
clearError(); clearError();
bg.resetInterval(); bg.resetInterval();
bg.main(); bg.main();
} }

View File

@ -1,30 +1,30 @@
{ {
"name": "__MSG_name__", "name": "__MSG_name__",
"version": "2.1", "version": "2.2",
"manifest_version": 2, "manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension", "description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com", "homepage_url": "http://pandorafms.com",
"browser_action": { "browser_action": {
"default_title": "__MSG_default_title__", "default_title": "__MSG_default_title__",
"default_icon": "images/icon.png", "default_icon": "images/icon.png",
"default_popup": "popup.html" "default_popup": "popup.html"
}, },
"background": { "background": {
"page": "background.html" "page": "background.html"
}, },
"icons": { "icons": {
"128": "images/icon128.png", "128": "images/icon128.png",
"16": "images/icon16.png", "16": "images/icon16.png",
"32": "images/icon32.png", "32": "images/icon32.png",
"48": "images/icon48.png" "48": "images/icon48.png"
}, },
"options_page": "options.html", "options_page": "options.html",
"permissions": [ "permissions": [
"tabs", "tabs",
"notifications", "notifications",
"http://*/*", "http://*/*",
"https://*/*", "https://*/*",
"background" "background"
], ],
"default_locale": "en" "default_locale": "en"
} }

50
pandora_agents/Dockerfile Normal file
View File

@ -0,0 +1,50 @@
FROM centos:centos7
MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Add Pandora FMS agent installer
ADD unix /tmp/pandora_agent/unix
# Install dependencies
RUN yum -y install \
epel-release \
unzip \
perl \
sed \
"perl(Sys::Syslog)"
# Install Pandora FMS agent
RUN cd /tmp/pandora_agent/unix \
&& chmod +x pandora_agent_installer \
&& ./pandora_agent_installer --install
# Set default variables
ENV SERVER_IP '127.0.0.1'
ENV REMOTE_CONFIG '0'
ENV GROUP 'Servers'
ENV DEBUG '0'
ENV AGENT_NAME 'agent_docker'
ENV AGENT_ALIAS 'agent_docker'
ENV TIMEZONE 'UTC'
ENV SECONDARY_GROUPS ''
# Create the entrypoint script.
RUN echo -e '#/bin/bash\n \
sed -i "s/^server_ip.*$/server_ip $SERVER_IP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^remote_config.*$/remote_config $REMOTE_CONFIG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^group.*$/group $GROUP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^debug.*$/debug $DEBUG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_name.*$/agent_name $AGENT_NAME/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_alias.*$/agent_alias $AGENT_ALIAS/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^# secondary_groups.*$/secondary_groups $SECONDARY_GROUPS/g" /etc/pandora/pandora_agent.conf\n \
if [ $TIMEZONE != "" ]; then\n \
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
fi\n \
/etc/init.d/pandora_agent_daemon start\n \
rm -f $0\n \
tail -f /var/log/pandora/pandora_agent.log' \
>> /entrypoint.sh && \
chmod +x /entrypoint.sh
# Entrypoint + CMD
ENTRYPOINT ["bash"]
CMD ["/entrypoint.sh"]

View File

@ -0,0 +1,18 @@
#!/bin/bash
source /root/code/pandorafms/extras/build_vars.sh
# Set tag for docker build
if [ "$1" == "nightly" ]; then
LOCAL_VERSION="latest"
else
LOCAL_VERSION=$VERSION
fi
# Build image with code
docker build --rm=true --pull --no-cache -t pandorafms/pandorafms-agent:$LOCAL_VERSION -f $CODEHOME/pandora_agents/Dockerfile $CODEHOME/pandora_agents/
# Push image
docker push pandorafms/pandorafms-agent:$LOCAL_VERSION
# Delete local image
docker image rm -f pandorafms/pandorafms-agent:$LOCAL_VERSION

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, AIX version # Version 7.0NG.738, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, FreeBSD Version # Version 7.0NG.738, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, HP-UX Version # Version 7.0NG.738, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, GNU/Linux # Version 7.0NG.738, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, GNU/Linux # Version 7.0NG.738, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, Solaris Version # Version 7.0NG.738, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.736 # Version 7.0NG.738
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.736, AIX version # Version 7.0NG.738, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.736 # Version 7.0NG.738
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.736, HPUX Version # Version 7.0NG.738, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736 # Version 7.0NG.738
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736 # Version 7.0NG.738
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736 # Version 7.0NG.738
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.736, Solaris version # Version 7.0NG.738, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, AIX version # Version 7.0NG.738, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.736-190712 Version: 7.0NG.738-190916
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.736-190712" pandora_version="7.0NG.738-190916"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, GNU/Linux # Version 7.0NG.738, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, FreeBSD Version # Version 7.0NG.738, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, HP-UX Version # Version 7.0NG.738, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, GNU/Linux # Version 7.0NG.738, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, GNU/Linux # Version 7.0NG.738, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, NetBSD Version # Version 7.0NG.738, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.736, Solaris Version # Version 7.0NG.738, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.736'; use constant AGENT_VERSION => '7.0NG.738';
use constant AGENT_BUILD => '190712'; use constant AGENT_BUILD => '190916';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.736 %define version 7.0NG.738
%define release 190712 %define release 190916
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.736 %define version 7.0NG.738
%define release 190712 %define release 190916
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.736" PI_VERSION="7.0NG.738"
PI_BUILD="190712" PI_BUILD="190916"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.736 # Version 7.0NG.738
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.736} {Pandora FMS Windows Agent v7.0NG.738}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190712} {190916}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -1214,7 +1214,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_source, module_source,
module_eventtype, module_eventtype,
module_eventcode, module_eventcode,
module_pattern); module_pattern,
module_application);
} else if (module_wmiquery != "") { } else if (module_wmiquery != "") {
module = new Pandora_Module_WMIQuery (module_name, module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn); module_wmiquery, module_wmicolumn);

View File

@ -53,7 +53,7 @@ static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
* @param name Module name. * @param name Module name.
* @param service_name Service internal name to check. * @param service_name Service internal name to check.
*/ */
Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern) Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application)
: Pandora_Module (name) { : Pandora_Module (name) {
int i; int i;
vector<wstring> query; vector<wstring> query;
@ -93,6 +93,13 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
query.push_back(ss.str()); query.push_back(ss.str());
} }
// Set the application
if (application != "") {
wstringstream ss;
ss << L"*[System/Provider[@Name='" << application.c_str() << L"']]";
query.push_back(ss.str());
}
// Fill the filter // Fill the filter
if (query.size() == 0) { if (query.size() == 0) {
this->filter = L"*"; this->filter = L"*";
@ -579,4 +586,4 @@ Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEv
} }
return pBuffer; return pBuffer;
} }

View File

@ -75,7 +75,7 @@ namespace Pandora_Modules {
LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId); LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
public: public:
Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern); Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application);
void run (); void run ();
}; };
} }

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.736(Build 190712)") #define PANDORA_VERSION ("7.0NG.738(Build 190916)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.736(Build 190712))" VALUE "ProductVersion", "(7.0NG.738(Build 190916))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.736-190712 Version: 7.0NG.738-190916
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.736-190712" pandora_version="7.0NG.738-190916"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -44,24 +44,16 @@ $groups = groups_get_all();
// Add the All group to the beginning to be always the first // Add the All group to the beginning to be always the first
// Use this instead array_unshift to keep the array keys // Use this instead array_unshift to keep the array keys
$groups = ([0 => __('All')] + $groups); $groups = ([0 => __('All')] + $groups);
$html = ''; $groups_selected = [];
$style = 'style="padding: 2px 10px; display: inline-block;"';
foreach ($groups as $id => $name) { foreach ($groups as $id => $name) {
$checked = in_array($id, $file['groups']); if (in_array($id, $file['groups'])) {
$all_checked = false; $groups_selected[] = $id;
if ($id === 0) {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, false, '', 'class="chkb_all"', true);
$all_checked = $checked;
} else {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, $all_checked, '', 'class="chkb_group"', true);
} }
$html .= "<div $style>$name&nbsp;$checkbox</div>";
} }
$row = []; $row = [];
$row[0] = __('Groups'); $row[0] = __('Groups');
$row[1] = $html; $row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', '');
$table->data[] = $row; $table->data[] = $row;
$table->colspan[][1] = 3; $table->colspan[][1] = 3;

View File

@ -193,7 +193,7 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
global $config; global $config;
$attachment_path = io_safe_output($config['attachment_store']); $attachment_path = io_safe_output($config['attachment_store']);
$files_repo_path = $attachment_path.'/'.'files_repo'; $files_repo_path = $attachment_path.'/files_repo';
$result = []; $result = [];
$result['status'] = false; $result['status'] = false;

View File

@ -0,0 +1 @@
operation/servers/recon_view.php

View File

@ -10,4 +10,42 @@ ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEF
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct'; ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
COMMIT; ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -0,0 +1,12 @@
START TRANSACTION;
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `talert_commands` WHERE `id` = 11;
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
COMMIT;

View File

@ -0,0 +1,7 @@
START TRANSACTION;
UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `width` = 0 && image NOT LIKE '%dot%' && ((`type` IN (0,5)) ||
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
COMMIT;

View File

@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`type` varchar(30) default 'simple_graph', `type` varchar(30) default 'simple_graph',
`period` int(11) NOT NULL default 0, `period` int(11) NOT NULL default 0,
`order` int (11) NOT NULL default 0, `order` int (11) NOT NULL default 0,
`description` mediumtext, `description` mediumtext,
`text_agent` text, `text_agent` text,
`text` TEXT, `text` TEXT,
`external_source` Text, `external_source` Text,
@ -1225,6 +1225,8 @@ ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
DELETE FROM `talert_commands` WHERE `id` = 11;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmap` -- Table `tmap`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1241,7 +1243,7 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 31);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
@ -1249,6 +1251,11 @@ UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.ph
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tconfig_os` -- Table `tconfig_os`
@ -1446,6 +1453,7 @@ ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0'; ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0'; ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
@ -2219,3 +2227,44 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
-- Table `treport_content_sla_combined` -- Table `treport_content_sla_combined`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL; ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tagent_repository`
-- ---------------------------------------------------------------------
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tdeployment_hosts`
-- ----------------------------------------------------------------------
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -670,21 +670,49 @@ if ($config['menu_type'] == 'classic') {
<?php <?php
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr'] || $do_refresh === true) {
if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true;
}
?> ?>
var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
$("#header_autorefresh").css('padding-right', '5px'); $("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>; if(autorefresh_draw == true) {
var t = new Date(); var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); var until_time='';
$("#refrcounter").countdown ({
until: t, function events_refresh() {
layout: '%M%nn%M:%S%nn%S', until_time = new Date();
labels: ['', '', '', '', '', '', ''], until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
onExpiry: function () {
$("#refrcounter").countdown ({
until: until_time,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
dt_events.draw(false);
}
});
}
// Start the countdown when page is loaded (first time).
events_refresh();
// Repeat countdown according to refresh_interval.
setInterval(events_refresh, refresh_interval);
} else {
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({
until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
href = href + refr_time; href = href + refr_time;
$(document).attr ("location", href); $(document).attr ("location", href);
} }
}); });
}
<?php <?php
} }
?> ?>
@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') {
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("select#ref").change (function () { $("select#ref").change (function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + this.value);
}); if(autorefresh_draw == true){
inputs = $("#events_form :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
})
var newValue = btoa(JSON.stringify(values));
<?php
// Check if the url has the parameter fb64.
if ($_GET['fb64']) {
$fb64 = $_GET['fb64'];
?>
var fb64 = '<?php echo $fb64; ?>';
// Check if the filters have changed.
if(fb64 !== newValue){
href = href.replace(fb64, newValue);
}
$(document).attr("location", href+ '&refr=' + this.value);
<?php
} else {
?>
$(document).attr("location", href+'&fb64=' + newValue + '&refr=' + this.value);
<?php
}
?>
} else {
$(document).attr ("location", href + this.value);
}
});
return false; return false;
}); });

View File

@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
} }
if (isset($login_failed)) { if (isset($login_failed)) {
$nick = get_parameter_post('nick');
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
$attemps = ($config['number_attempts'] - $fails);
echo '<div id="login_failed" title="'.__('Login failed').'">'; echo '<div id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -386,6 +389,12 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>'; echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>'; echo '<p>'.$config['auth_error'].'</p>';
echo '</div>'; echo '</div>';
if ($config['enable_pass_policy']) {
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
}
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>'; echo '</div>';
@ -680,5 +689,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#final_process_correct").dialog('close'); $("#final_process_correct").dialog('close');
}); });
}); });
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -172,6 +172,7 @@ unset($table);
echo '<div id="right">'; echo '<div id="right">';
// News. // News.
require_once 'general/news_dialog.php';
$options = []; $options = [];
$options['id_user'] = $config['id_user']; $options['id_user'] = $config['id_user'];
$options['modal'] = false; $options['modal'] = false;
@ -188,6 +189,7 @@ if (!empty($news)) {
$comparation_suffix = __('ago'); $comparation_suffix = __('ago');
} }
$output_news = '<div id="news_board" class="new">'; $output_news = '<div id="news_board" class="new">';
foreach ($news as $article) { foreach ($news as $article) {
$image = false; $image = false;

View File

@ -77,6 +77,7 @@ if (is_ajax()) {
} }
$get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0); $get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
$get_common_modules = (bool) get_parameter('get_common_modules', 1);
if ($get_modules_json_for_multiple_snmp) { if ($get_modules_json_for_multiple_snmp) {
include_once 'include/graphs/functions_utils.php'; include_once 'include/graphs/functions_utils.php';
@ -100,7 +101,16 @@ if (is_ajax()) {
if ($out === false) { if ($out === false) {
$out = $oid_snmp; $out = $oid_snmp;
} else { } else {
$out = array_intersect($out, $oid_snmp); $commons = array_intersect($out, $oid_snmp);
if ($get_common_modules) {
// Common modules is selected (default)
$out = $commons;
} else {
// All modules is selected
$array1 = array_diff($out, $oid_snmp);
$array2 = array_diff($oid_snmp, $out);
$out = array_merge($commons, $array1, $array2);
}
} }
$oid_snmp = []; $oid_snmp = [];
@ -201,7 +211,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">'; $table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
if ($id_agente) { if ($id_agente) {
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />'; $table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" readonly value="'.$id_agente.'" />';
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'; $table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
$table_agent_name .= html_print_image( $table_agent_name .= html_print_image(
'images/zoom.png', 'images/zoom.png',
@ -372,13 +382,13 @@ $table_server = '<div class="label_select"><p class="input_label">'.__('Server')
$table_server .= '<div class="label_select_parent">'; $table_server .= '<div class="label_select_parent">';
if ($new_agent) { if ($new_agent) {
// Set first server by default. // Set first server by default.
$servers_get_names = servers_get_names(); $servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names); $array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names); $server_name = reset($array_keys_servers_get_names);
} }
$table_server .= html_print_select( $table_server .= html_print_select(
servers_get_names(), $servers,
'server_name', 'server_name',
$server_name, $server_name,
'', '',
@ -514,8 +524,10 @@ if (enterprise_installed()) {
); );
$safe_mode_modules = []; $safe_mode_modules = [];
$safe_mode_modules[0] = __('Any'); $safe_mode_modules[0] = __('Any');
foreach ($sql_modules as $m) { if (is_array($sql_modules)) {
$safe_mode_modules[$m['id_module']] = $m['name']; foreach ($sql_modules as $m) {
$safe_mode_modules[$m['id_module']] = $m['name'];
}
} }
$table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip( $table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip(
@ -792,20 +804,20 @@ $table_adv_options .= '
'.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.' '.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
</div>'; </div>';
if (enterprise_installed()) {
echo '<div class="ui_toggle">'; echo '<div class="ui_toggle">';
ui_toggle( ui_toggle(
$table_adv_options, $table_adv_options,
__('Advanced options'), __('Advanced options'),
'', '',
'', '',
true, true,
false, false,
'white_box white_box_opened', 'white_box white_box_opened',
'no-border flex' 'no-border flex'
); );
echo '</div>'; echo '</div>';
}
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
@ -813,7 +825,7 @@ $table->class = 'custom_fields_table';
$table->head = [ $table->head = [
0 => __('Click to display').ui_print_help_tip( 0 => __('Click to display').ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'), __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
true true
), ),
]; ];
@ -919,18 +931,48 @@ foreach ($fields as $field) {
$i += 2; $i += 2;
} }
if (!empty($fields)) { if (enterprise_installed()) {
if (!empty($fields)) {
echo '<div class="ui_toggle">';
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border'
);
echo '</div>';
}
} else {
echo '<div class="ui_toggle">'; echo '<div class="ui_toggle">';
ui_toggle( ui_toggle(
html_print_table($table, true), $table_adv_options,
__('Custom fields'), __('Advanced options'),
'', '',
'', '',
true, true,
false, false,
'white_box white_box_opened', 'white_box white_box_opened',
'no-border' 'no-border flex'
); );
if (!empty($fields)) {
ui_toggle(
html_print_table($table, true),
__('Custom fields'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border'
);
}
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
echo '</div>'; echo '</div>';
} }
@ -1162,6 +1204,19 @@ ui_require_jquery_file('bgiframe');
} }
$(document).ready (function() { $(document).ready (function() {
var previous_primary_group_select;
$("#grupo").on('focus', function () {
previous_primary_group_select = this.value;
}).change(function() {
if ($("#secondary_groups_selected option[value="+$("#grupo").val()+"]").length) {
alert("<?php echo __('Secondary group cannot be primary too.'); ?>");
$("#grupo").val(previous_primary_group_select);
} else {
previous_primary_group_select = this.value;
}
});
$("select#id_os").pandoraSelectOS (); $("select#id_os").pandoraSelectOS ();
var checked = $("#checkbox-cascade_protection").is(":checked"); var checked = $("#checkbox-cascade_protection").is(":checked");
@ -1210,7 +1265,7 @@ ui_require_jquery_file('bgiframe');
128, 128,
128 128
); );
$("#text-agente").prop('disabled', true); $("#text-agente").prop('readonly', true);
}); });
</script> </script>

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category SNMP interfaces.
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once 'include/functions_modules.php'; require_once 'include/functions_modules.php';
@ -36,10 +52,10 @@ $snmp3_privacy_method = get_parameter('snmp3_privacy_method');
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass')); $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
$tcp_port = (string) get_parameter('tcp_port'); $tcp_port = (string) get_parameter('tcp_port');
// See if id_agente is set (either POST or GET, otherwise -1 // See if id_agente is set (either POST or GET, otherwise -1.
$id_agent = $idAgent; $id_agent = $idAgent;
// Get passed variables // Get passed variables.
$snmpwalk = (int) get_parameter('snmpwalk', 0); $snmpwalk = (int) get_parameter('snmpwalk', 0);
$create_modules = (int) get_parameter('create_modules', 0); $create_modules = (int) get_parameter('create_modules', 0);
@ -47,7 +63,7 @@ $interfaces = [];
$interfaces_ip = []; $interfaces_ip = [];
if ($snmpwalk) { if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces // OID Used is for SNMP MIB-2 Interfaces.
$snmpis = get_snmpwalk( $snmpis = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -63,7 +79,7 @@ if ($snmpwalk) {
$tcp_port, $tcp_port,
$server_to_exec $server_to_exec
); );
// ifXTable is also used // IfXTable is also used.
$ifxitems = get_snmpwalk( $ifxitems = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -80,7 +96,7 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Get the interfaces IPV4/IPV6 // Get the interfaces IPV4/IPV6.
$snmp_int_ip = get_snmpwalk( $snmp_int_ip = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -97,12 +113,12 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Build a [<interface id>] => [<interface ip>] array // Build a [<interface id>] => [<interface ip>] array.
if (!empty($snmp_int_ip)) { if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) { foreach ($snmp_int_ip as $key => $value) {
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>" // The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>" // or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
// The value is something like INTEGER: <interface id> // The value is something like INTEGER: <interface id>.
$data = explode(': ', $value); $data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false; $interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@ -110,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1]; $interface_ip = $matches[1];
} }
// Get the first ip // Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) { if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip; $interfaces_ip[$interface_id] = $interface_ip;
} }
@ -119,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip); unset($snmp_int_ip);
} }
$snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems)); $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$interfaces = []; $interfaces = [];
// We get here only the interface part of the MIB, not full mib // We get here only the interface part of the MIB, not full mib.
foreach ($snmpis as $key => $snmp) { foreach ($snmpis as $key => $snmp) {
$data = explode(': ', $snmp, 2); $data = explode(': ', $snmp, 2);
$keydata = explode('::', $key); $keydata = explode('::', $key);
$keydata2 = explode('.', $keydata[1]); $keydata2 = explode('.', $keydata[1]);
// Avoid results without index and interfaces without name // Avoid results without index and interfaces without name.
if (!isset($keydata2[1]) || !isset($data[1])) { if (!isset($keydata2[1]) || !isset($data[1])) {
continue; continue;
} }
@ -239,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id; $oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array); $oid = implode('.', $oid_array);
// Get the name // Get the name.
$name_array = explode('::', $oid_array[0]); $name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1]; $name = $ifname.'_'.$name_array[1];
// Clean the name // Clean the name.
$name = str_replace('"', '', $name); $name = str_replace('"', '', $name);
// Proc moduletypes // Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) { if (preg_match('/Status/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) { } else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) { } else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} } else if (preg_match('/Alias/', $name_array[1])) {
// String moduletypes.
// String moduletypes
else if (preg_match('/Alias/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) { } else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17; $module_type = 17;
@ -266,15 +280,11 @@ if ($create_modules) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) { } else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} } else if (preg_match('/s$/', $name_array[1])) {
// Specific counters (ends in s).
// Specific counters (ends in s)
else if (preg_match('/s$/', $name_array[1])) {
$module_type = 16; $module_type = 16;
} } else {
// Otherwise, numeric.
// Otherwise, numeric
else {
$module_type = 15; $module_type = 15;
} }
@ -330,7 +340,7 @@ if ($create_modules) {
$output_oid = ''; $output_oid = '';
exec('ssh pandora_exec_proxy@'.$row['ip_address'].' snmptranslate -On '.$oid, $output_oid, $rc); exec('snmptranslate -On '.$oid, $output_oid, $rc);
$conf_oid = $output_oid[0]; $conf_oid = $output_oid[0];
$oid = $conf_oid; $oid = $conf_oid;
@ -397,7 +407,9 @@ if ($create_modules) {
} }
if ($done > 0) { if ($done > 0) {
ui_print_success_message(__('Successfully modules created')." ($done)"); ui_print_success_message(
__('Successfully modules created').' ('.$done.')'
);
} }
if (!empty($errors)) { if (!empty($errors)) {
@ -407,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) { foreach ($errors as $code => $number) {
switch ($code) { switch ($code) {
case ERR_EXIST: case ERR_EXIST:
$msg .= '<br>'.__('Another module already exists with the same name')." ($number)"; $msg .= '<br>'.__('Another module already exists with the same name').' ('.$number.')';
break; break;
case ERR_INCOMPLETE: case ERR_INCOMPLETE:
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)"; $msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break; break;
case ERR_DB: case ERR_DB:
case ERR_GENERIC: case ERR_GENERIC:
default: default:
$msg .= '<br>'.__('Processing error')." ($number)"; $msg .= '<br>'.__('Processing error').' ('.$number.')';
break; break;
} }
} }
@ -426,10 +438,10 @@ if ($create_modules) {
} }
} }
// Create the interface list for the interface // Create the interface list for the interface.
$interfaces_list = []; $interfaces_list = [];
foreach ($interfaces as $interface) { foreach ($interfaces as $interface) {
// Get the interface name, removing " " characters and avoid "blank" interfaces // Get the interface name, removing " " characters and avoid "blank" interfaces.
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') { if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
$ifname = $interface['ifDescr']['value']; $ifname = $interface['ifDescr']['value'];
} else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') { } else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
@ -442,7 +454,7 @@ foreach ($interfaces as $interface) {
} }
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>"; echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
$table->width = '100%'; $table->width = '100%';
$table->cellpadding = 0; $table->cellpadding = 0;
@ -464,12 +476,14 @@ if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php'); enterprise_include_once('include/functions_satellite.php');
$rows = get_proxy_servers(); $rows = get_proxy_servers();
// Check if satellite server has remote configuration enabled.
$satellite_remote = config_agents_has_remote_configuration($id_agent);
foreach ($rows as $row) { foreach ($rows as $row) {
if ($row['server_type'] != 13) { if ($row['server_type'] != 13) {
$s_type = ' (Standard)'; $s_type = ' (Standard)';
} else { } else {
// Check if satellite server has remote configuration enabled
$satellite_remote = config_agents_has_remote_configuration($id_agent);
$id_satellite = $row['id_server']; $id_satellite = $row['id_server'];
$s_type = ' (Satellite)'; $s_type = ' (Satellite)';
} }
@ -484,8 +498,7 @@ $table->data[1][4] = html_print_select(
$servers_to_exec, $servers_to_exec,
'server_to_exec', 'server_to_exec',
$server_to_exec, $server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.') 'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
',
'', '',
'', '',
true true
@ -509,7 +522,7 @@ html_print_table($table);
unset($table); unset($table);
// SNMP3 OPTIONS // SNMP3 OPTIONS.
$table->width = '100%'; $table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>'; $table->data[2][1] = '<b>'.__('Auth user').'</b>';
@ -564,7 +577,7 @@ echo '</form>';
if (!empty($interfaces_list)) { if (!empty($interfaces_list)) {
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>"; echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
echo '<span id="form_interfaces">'; echo '<span id="form_interfaces">';
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp'); $id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@ -589,13 +602,30 @@ if (!empty($interfaces_list)) {
$table->width = '100%'; $table->width = '100%';
// Agent selector // Agent selector.
$table->data[0][0] = '<b>'.__('Interfaces').'</b>'; $table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$table->data[0][1] = ''; $table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>'; $table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;'); $table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
$table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][1] = __('When selecting interfaces');
$table->data[1][1] .= '<br>';
$table->data[1][1] .= html_print_select(
[
1 => __('Show common modules'),
0 => __('Show all modules'),
],
'modules_selection_mode',
1,
false,
'',
'',
true,
false,
false
);
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
@ -619,12 +649,10 @@ ui_require_jquery_file('bgiframe');
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
var inputActive = true; var inputActive = true;
$('#server_to_exec option').trigger('change'); $('#server_to_exec option').trigger('change');
$(document).data('text_for_module', $("#none_text").html()); $(document).data('text_for_module', $("#none_text").html());
$("#id_snmp").change(snmp_changed_by_multiple_snmp); $("#id_snmp").change(snmp_changed_by_multiple_snmp);
@ -645,10 +673,16 @@ $(document).ready (function () {
$("#form_interfaces").hide (); $("#form_interfaces").hide ();
}); });
// When select interfaces changes
$("#modules_selection_mode").change (function() {
$("#id_snmp").trigger('change');
});
}); });
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
var idSNMP = Array(); var idSNMP = Array();
var get_common_modules = $("#modules_selection_mode option:selected").val();
jQuery.each ($("#id_snmp option:selected"), function (i, val) { jQuery.each ($("#id_snmp option:selected"), function (i, val) {
idSNMP.push($(val).val()); idSNMP.push($(val).val());
@ -660,6 +694,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
jQuery.post ('ajax.php', jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager", {"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1, "get_modules_json_for_multiple_snmp": 1,
"get_common_modules" : get_common_modules,
"id_snmp[]": idSNMP, "id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val() "id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
}, },

View File

@ -1358,7 +1358,11 @@ if ($update_module || $create_module) {
$parent_module_id = (int) get_parameter('parent_module_id'); $parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter('ip_target'); $ip_target = (string) get_parameter('ip_target');
if ($ip_target == '') { // No autofill if the module is a webserver module.
if ($ip_target == ''
&& $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY
&& $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA
) {
$ip_target = 'auto'; $ip_target = 'auto';
} }
@ -1381,11 +1385,7 @@ if ($update_module || $create_module) {
$ff_type = (int) get_parameter('ff_type'); $ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff'); $each_ff = (int) get_parameter('each_ff');
$ff_timeout = (int) get_parameter('ff_timeout'); $ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit_select'); $unit = (string) get_parameter('unit');
if ($unit == 'none') {
$unit = (string) get_parameter('unit_text');
}
$id_tag = (array) get_parameter('id_tag_selected'); $id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops'); $serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions'); $critical_instructions = (string) get_parameter('critical_instructions');
@ -1559,8 +1559,14 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -1757,8 +1763,14 @@ if ($create_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -2095,8 +2107,7 @@ if ($delete_module) {
} }
} }
// MODULE DUPLICATION // MODULE DUPLICATION.
// ==================.
if (!empty($duplicate_module)) { if (!empty($duplicate_module)) {
// DUPLICATE agent module ! // DUPLICATE agent module !
$id_duplicate_module = $duplicate_module; $id_duplicate_module = $duplicate_module;
@ -2142,8 +2153,46 @@ if (!empty($duplicate_module)) {
} }
} }
// UPDATE GIS // MODULE ENABLE/DISABLE.
// ==========. if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully enabled'),
__('Could not be enabled')
);
}
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully disabled'),
__('Could not be disabled')
);
}
// UPDATE GIS.
$updateGIS = get_parameter('update_gis', 0); $updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) { if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data'); $updateGisData = get_parameter('update_gis_data');
@ -2231,8 +2280,11 @@ switch ($tab) {
break; break;
case 'alert': case 'alert':
// Because $id_agente is set, it will show only agent alerts. /*
// This var is for not display create button on alert list. * Because $id_agente is set, it will show only agent alerts
* This var is for not display create button on alert list
*/
$dont_display_alert_create_bttn = true; $dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php'; include 'godmode/alerts/alert_list.php';
break; break;

View File

@ -443,6 +443,14 @@ ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modific
if ($agents !== false) { if ($agents !== false) {
// Urls to sort the table. // Urls to sort the table.
// Agent name size and description for Chinese and Japanese languages are adjusted
$agent_font_size = '7';
$description_font_size = '6.5';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = '15';
$description_font_size = '11';
}
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled'; $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
$url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled'; $url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled';
$url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled'; $url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled';
@ -529,7 +537,7 @@ if ($agents !== false) {
} else { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span style="font-size: 7pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>'; id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
} }
echo '</strong>'; echo '</strong>';
@ -629,7 +637,7 @@ if ($agents !== false) {
// Group icon and name // Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>'; echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description // Description
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;').'</td>'; echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>';
// Action // Action
// When there is only one element in page it's necesary go back page. // When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) { if ((count($agents) == 1) && ($offset >= $config['block_size'])) {

View File

@ -141,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
$page = get_parameter('page', ''); $page = get_parameter('page', '');
if (strstr($page, 'policy_modules') === false && $id_agent_module) { $in_policies_page = strstr($page, 'policy_modules');
if ($in_policies_page === false && $id_agent_module) {
if ($config['enterprise_installed']) { if ($config['enterprise_installed']) {
if (policies_is_module_linked($id_agent_module) == 1) { if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1; $disabledBecauseInPolicy = 1;
@ -250,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
}
$in_policy = strstr($page, 'policy_modules'); $in_policy = strstr($page, 'policy_modules');
if (!$in_policy) { if (!$in_policy) {
// Cannot select the current module to be itself parent // Cannot select the current module to be itself parent
@ -280,17 +288,6 @@ if (!$in_policy) {
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help'); $table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true); $table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) {
if ($id_agent_module) {
$edit = false;
} else {
$edit = true;
}
} else {
// Run into a policy
$edit = true;
}
if (!$edit) { if (!$edit) {
$sql = sprintf( $sql = sprintf(
'SELECT id_tipo, nombre 'SELECT id_tipo, nombre

View File

@ -232,10 +232,17 @@ $table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true); $table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); $table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
$returnAllGroup = users_can_manage_group_all();
// If the user can't manage All group but the filter is for All group, the user should see All group in the select.
if ($returnAllGroup === false && $id_group_filter == 0) {
$returnAllGroup = true;
}
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = html_print_select_groups(
$config['id_user'], $config['id_user'],
$access, $access,
users_can_manage_group_all(), $returnAllGroup,
'id_group_filter', 'id_group_filter',
$id_group_filter, $id_group_filter,
'', '',

View File

@ -93,10 +93,11 @@ if ($strict_acl) {
users_can_manage_group_all() users_can_manage_group_all()
); );
} else { } else {
// All users should see the filters with the All group.
$groups_user = users_get_groups( $groups_user = users_get_groups(
$config['id_user'], $config['id_user'],
$access, $access,
users_can_manage_group_all(), true,
true true
); );
} }

View File

@ -143,12 +143,12 @@ $table->data[3] = $data;
$data = []; $data = [];
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true); $data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true);
$data[1] = html_print_input_text( $data[1] = html_print_textarea(
'target', 'target',
3,
1,
$event_response['target'], $event_response['target'],
'', 'style="min-height:initial;"',
100,
255,
true true
); );

View File

@ -369,7 +369,7 @@ echo '</div>';
text = err.message; text = err.message;
failed = 1; failed = 1;
} }
if (!failed && data['error']) { if (!failed && data['error'] != undefined) {
title = "<?php echo __('Failed'); ?>"; title = "<?php echo __('Failed'); ?>";
text = data['error']; text = data['error'];
failed = 1; failed = 1;
@ -522,12 +522,10 @@ echo '</div>';
function calculate_inputs() { function calculate_inputs() {
if ($('#product :selected').val() == "CUSTOM") { if ($('#product :selected').val() == "CUSTOM") {
$('#div-username label').text('<?php echo __('Username'); ?>'); $('#div-username label').text('<?php echo __('User'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>'); $('#div-password label').text('<?php echo __('Password'); ?>');
$('#div-extra_1 label').text('<?php echo __('Extra'); ?>'); $('#div-extra_1').hide();
$('#div-extra_2 label').text('<?php echo __('Extra (2)'); ?>'); $('#div-extra_2').hide();
$('#div-extra_1').show();
$('#div-extra_2').show();
} else if ($('#product :selected').val() == "AWS") { } else if ($('#product :selected').val() == "AWS") {
$('#div-username label').text('<?php echo __('Access key ID'); ?>'); $('#div-username label').text('<?php echo __('Access key ID'); ?>');
$('#div-password label').text('<?php echo __('Secret access key'); ?>'); $('#div-password label').text('<?php echo __('Secret access key'); ?>');
@ -557,8 +555,8 @@ echo '</div>';
success: function(data) { success: function(data) {
$('#form_new').html(data); $('#form_new').html(data);
$('#id_group').val(0); $('#id_group').val(0);
// By default AWS. // By default CUSTOM.
$('#product').val('AWS'); $('#product').val('CUSTOM');
calculate_inputs(); calculate_inputs();
$('#product').on('change', function() { $('#product').on('change', function() {
@ -590,9 +588,6 @@ echo '</div>';
text: 'OK', text: 'OK',
click: function(e) { click: function(e) {
var values = {}; var values = {};
console.log($('#form_new'));
$('#form_new :input').each(function() { $('#form_new :input').each(function() {
values[this.name] = btoa($(this).val()); values[this.name] = btoa($(this).val());
}); });

View File

@ -273,6 +273,9 @@ $table->data[1][1] = html_print_select(
true true
); );
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent'); $table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">'; $table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true); $table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -354,6 +357,11 @@ $(document).ready (function () {
/* Hide source agent */ /* Hide source agent */
var selected_agent = $("#source_id_agent").val(); var selected_agent = $("#source_id_agent").val();
$("#destiny_id_agent option[value='" + selected_agent + "']").remove(); $("#destiny_id_agent option[value='" + selected_agent + "']").remove();
},
callbackAfter:function() {
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#destiny_id_agent'), $("#text-filter_agents"), textNoData);
} }
}); });
@ -455,13 +463,14 @@ $(document).ready (function () {
$("#fieldset_destiny").hide (); $("#fieldset_destiny").hide ();
$("span.without_modules, span.without_alerts").show (); $("span.without_modules, span.without_alerts").show ();
$("span.with_modules, span.with_alerts, #target_table-operations").hide (); $("span.with_modules, span.with_alerts, #target_table-operations, #target_table-form_modules_filter").hide ();
} }
else { else {
if (no_modules) { if (no_modules) {
$("span.without_modules").show (); $("span.without_modules").show ();
$("span.with_modules").hide (); $("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck (); $("#checkbox-copy_modules").uncheck ();
$("#target_table-form_modules_filter").hide ();
} }
else { else {
$("span.without_modules").hide (); $("span.without_modules").hide ();
@ -479,7 +488,7 @@ $(document).ready (function () {
$("span.with_alerts").show (); $("span.with_alerts").show ();
$("#checkbox-copy_alerts").check (); $("#checkbox-copy_alerts").check ();
} }
$("#fieldset_destiny, #target_table-operations").show (); $("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
} }
$("#fieldset_targets").show (); $("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable (); $("#target_modules, #target_alerts").enable ();

View File

@ -501,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true true
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;'; $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $table->data['form_agents_3'][0] = __('Agents');
@ -763,6 +768,9 @@ $(document).ready (function () {
.html (value["alias"]); .html (value["alias"]);
$("#id_agents").append (option); $("#id_agents").append (option);
}); });
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
}, },
"json" "json"
); );

View File

@ -170,6 +170,8 @@ if ($update_agents) {
$n_edited = 0; $n_edited = 0;
$result = false; $result = false;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) { if (!empty($values)) {
$group_old = false; $group_old = false;
$disabled_old = false; $disabled_old = false;
@ -196,6 +198,18 @@ if ($update_agents) {
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name); $result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
} }
// Update the configuration files.
if ($result && ($old_interval_value != $values['intervalo'])) {
enterprise_hook(
'config_agents_update_config_token',
[
$id_agent,
'interval',
$values['intervalo'],
]
);
}
if ($disabled_old !== false && $disabled_old != $values['disabled']) { if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook( enterprise_hook(
'config_agents_update_config_token', 'config_agents_update_config_token',
@ -686,7 +700,7 @@ if ($fields === false) {
foreach ($fields as $field) { foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>'; $data[0] = '<b>'.$field['name'].'</b>';
$data[0] .= ui_print_help_tip( $data[0] .= ui_print_help_tip(
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'), __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
true true
); );
$combo = []; $combo = [];

View File

@ -473,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true true
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;'; $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $table->data['form_agents_3'][0] = __('Agents');
@ -1638,6 +1643,9 @@ $(document).ready (function () {
.html(value["alias"]); .html(value["alias"]);
$("#id_agents").append (option); $("#id_agents").append (option);
}); });
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
}, },
"json" "json"
); );
@ -1922,11 +1930,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
case 'unit_select': case 'unit_select':
if ($value != -1) { if ($value != -1) {
if ($value == 'none') { $values['unit'] = (string) get_parameter('unit');
$values['unit'] = (string) get_parameter('unit_text');
} else {
$values['unit'] = $value;
}
} }
break; break;

View File

@ -24,23 +24,24 @@ $menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$sub = []; $sub = [];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Discovery Main'); $sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery'; $sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list'); $sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist'; $sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
$sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications'); $sub2 = [];
$sub['godmode/servers/discovery&wiz=app']['id'] = 'app'; $sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud'); $sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
$sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud'; $sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
$sub['godmode/servers/discovery&wiz=ctask']['text'] = __('Console task');
$sub['godmode/servers/discovery&wiz=ctask']['id'] = 'ctask';
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices'); $sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd'; $sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
// Add to menu. // Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery'); $menu_godmode['discovery']['text'] = __('Discovery');
@ -128,6 +129,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/modules/manage_network_templates']['id'] = 'Module templates'; $sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
enterprise_hook('inventory_submenu'); enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu'); enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
} }
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {

View File

@ -854,7 +854,10 @@ $class = 'databox filters';
} }
?> ?>
<?php <?php
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.'); if (!isset($text)) {
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
}
echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>'; echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>';
?> ?>
</td> </td>
@ -866,7 +869,18 @@ $class = 'databox filters';
</td> </td>
<td style=""> <td style="">
<?php <?php
html_print_input_text('name', $name, '', 80, 100); html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
?> ?>
</td> </td>
</tr> </tr>
@ -924,7 +938,18 @@ $class = 'databox filters';
</td> </td>
<td style=""> <td style="">
<?php <?php
echo html_print_input_text('label', $label, '', 50, 255, true); echo html_print_input_text(
'label',
$label,
'',
50,
255,
true,
false,
false,
'',
'fullwidth'
);
?> ?>
</td> </td>
</tr> </tr>
@ -1293,7 +1318,7 @@ $class = 'databox filters';
if (metaconsole_load_external_db($connection) == NOERR) { if (metaconsole_load_external_db($connection) == NOERR) {
$agent_name = db_get_value_filter( $agent_name = db_get_value_filter(
'nombre', 'alias',
'tagente', 'tagente',
['id_agente' => $idAgent] ['id_agente' => $idAgent]
); );

View File

@ -267,7 +267,7 @@ if ($moduleFilter != 0) {
// Filter report items created from metaconsole in normal console list and the opposite // Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) { if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\'))'; $where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
} else { } else {
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))'; $where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
} }
@ -342,7 +342,7 @@ if ($items) {
$table->size[0] = '5px'; $table->size[0] = '5px';
$table->size[1] = '15%'; $table->size[1] = '15%';
$table->size[4] = '8%'; $table->size[4] = '8%';
$table->size[6] = '90px'; $table->size[6] = '120px';
$table->size[7] = '30px'; $table->size[7] = '30px';
$table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>'; $table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';

View File

@ -1,4 +1,22 @@
<script type="text/javascript"> <script type="text/javascript">
function dialog_message(message_id) {
$(message_id)
.css("display", "inline")
.dialog({
modal: true,
show: "blind",
hide: "blind",
width: "400px",
buttons: {
Close: function() {
$(this).dialog("close");
}
}
});
}
function check_all_checkboxes() { function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) { if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true); $(".check_delete").prop("checked", true);
@ -578,7 +596,7 @@ switch ($action) {
break; break;
} }
if (! $delete) { if (! $delete && !empty($type_access_selected)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access report builder deletion' 'Trying to access report builder deletion'
@ -1344,6 +1362,16 @@ switch ($action) {
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = []; $values = [];
$server_name = get_parameter('server_id');
if (is_metaconsole() && $server_name != '') {
$id_meta = metaconsole_get_id_server($server_name);
$connection = metaconsole_get_connection_by_id(
$id_meta
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
@ -1352,14 +1380,36 @@ switch ($action) {
$label = get_parameter('label', ''); $label = get_parameter('label', '');
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name. // Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name'); $name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro( $values['name'] = reporting_label_macro(
$items_label, $items_label,
$name_it $name_it
@ -1715,13 +1765,6 @@ switch ($action) {
); );
$values['id_group'] = get_parameter('combo_group'); $values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter('server_name'); $values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') { if ($values['server_name'] == '') {
$values['server_name'] = get_parameter( $values['server_name'] = get_parameter(
@ -1983,22 +2026,11 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
if (is_metaconsole()) {
metaconsole_restore_db();
}
if ($good_format) { if ($good_format) {
switch ($config['dbtype']) {
case 'oracle':
if (isset($values['type'])) {
$values[db_escape_key_identifier(
'type'
)] = $values['type'];
unset($values['type']);
}
break;
default:
// Default.
break;
}
$resultOperationDB = db_process_sql_update( $resultOperationDB = db_process_sql_update(
'treport_content', 'treport_content',
$values, $values,
@ -2011,21 +2043,62 @@ switch ($action) {
case 'save': case 'save':
$values = []; $values = [];
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$label = get_parameter('label', ''); $label = get_parameter('label', '');
// Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null); $values['recursion'] = get_parameter('recursion', null);
$values['show_extended_events'] = get_parameter('include_extended_events', null); $values['show_extended_events'] = get_parameter(
'include_extended_events',
null
);
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name.
$name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
if (is_metaconsole()) {
metaconsole_restore_db();
}
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro( $values['name'] = reporting_label_macro(
$items_label, $items_label,
$name_it $name_it
@ -2230,18 +2303,6 @@ switch ($action) {
break; break;
} }
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') { if ($values['server_name'] == '') {
$values['server_name'] = get_parameter( $values['server_name'] = get_parameter(
'combo_server' 'combo_server'

View File

@ -171,7 +171,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)]['icon'] = html_print_image( $table->data[($i + 1)]['icon'] = html_print_image(
'images/camera.png', 'images/camera.png',
true, true,
['title' => __('Static Graph')] ['title' => __('Static Image')]
); );
break; break;

View File

@ -42,7 +42,19 @@ function get_wiz_class($str)
return 'ConsoleTasks'; return 'ConsoleTasks';
default: default:
// Ignore. // Main, show header.
ui_print_page_header(
__('Discovery'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
''
);
return null; return null;
} }
} }
@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php'); $classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
if (enterprise_installed()) { if (enterprise_installed()) {
$ent_classes = glob( $ent_classes = glob(
$config['homedir'].'/enterprise/godmode/wizards/*.class.php' $config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
); );
if ($ent_classes === false) { if ($ent_classes === false) {
$ent_classes = []; $ent_classes = [];
@ -130,7 +142,7 @@ if ($classname_selected === null) {
} }
} }
// Show hints if there is no task // Show hints if there is no task.
if (get_parameter('discovery_hint', 0)) { if (get_parameter('discovery_hint', 0)) {
ui_require_css_file('discovery-hint'); ui_require_css_file('discovery-hint');
ui_print_info_message(__('You must create a task first')); ui_print_info_message(__('You must create a task first'));

View File

@ -70,7 +70,7 @@ if (is_ajax()) {
$table->head[0] = __('Agent'); $table->head[0] = __('Agent');
$table->head[1] = __('Module'); $table->head[1] = __('Module');
foreach ($modules as $mod) { foreach ($modules as $mod) {
$agent_name = '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente'].'">'.modules_get_agentmodule_agent_name( $agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
$mod['id_agente_modulo'] $mod['id_agente_modulo']
).'</a>'; ).'</a>';
@ -1215,4 +1215,3 @@ ui_require_javascript_file('pandora_modules');
</script> </script>

View File

@ -152,12 +152,12 @@ foreach ($servers as $server) {
$data[8] = ''; $data[8] = '';
if ($server['type'] == 'recon') { if ($server['type'] == 'recon') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=operation/servers/recon_view">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/firts_task/icono_grande_reconserver.png', 'images/firts_task/icono_grande_reconserver.png',
true, true,
[ [
'title' => __('Manage recon tasks'), 'title' => __('Manage Discovery tasks'),
'style' => 'width:21px;height:21px;', 'style' => 'width:21px;height:21px;',
] ]
); );
@ -165,7 +165,7 @@ foreach ($servers as $server) {
} }
if ($server['type'] == 'data') { if ($server['type'] == 'data') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
true, true,
@ -173,7 +173,7 @@ foreach ($servers as $server) {
); );
$data[8] .= '</a>'; $data[8] .= '</a>';
} else if ($server['type'] == 'enterprise snmp') { } else if ($server['type'] == 'enterprise snmp') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
true, true,
@ -182,7 +182,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
} }
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/config.png', 'images/config.png',
true, true,
@ -191,7 +191,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) { if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/remote_configuration.png', 'images/remote_configuration.png',
true, true,
@ -201,7 +201,7 @@ foreach ($servers as $server) {
$names_servers[$safe_server_name] = false; $names_servers[$safe_server_name] = false;
} }
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/cross.png', 'images/cross.png',
true, true,

View File

@ -86,7 +86,7 @@ $buttons = [];
// Draws header. // Draws header.
$buttons['general'] = [ $buttons['general'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general').'">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
]; ];
if (enterprise_installed()) { if (enterprise_installed()) {
@ -95,37 +95,37 @@ if (enterprise_installed()) {
$buttons['auth'] = [ $buttons['auth'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth').'">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
]; ];
$buttons['perf'] = [ $buttons['perf'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf').'">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
]; ];
$buttons['vis'] = [ $buttons['vis'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis').'">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
]; ];
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) { if ($config['activate_netflow']) {
$buttons['net'] = [ $buttons['net'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net').'">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
]; ];
} }
} }
$buttons['ehorus'] = [ $buttons['ehorus'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
]; ];
// FIXME: Not definitive icon // FIXME: Not definitive icon
$buttons['notifications'] = [ $buttons['notifications'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
]; ];
$help_header = ''; $help_header = '';

View File

@ -1,5 +1,13 @@
<?php <?php
/** /**
* General setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________ * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ | * | __/| _ | | _ || _ | _| _ | | ___| |__ |
@ -18,8 +26,36 @@
* ============================================================================ * ============================================================================
*/ */
// File begin.
/**
* Return sounds path.
*
* @return string Path.
*/
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}
// Begin.
global $config; global $config;
check_login(); check_login();
$table = new StdClass(); $table = new StdClass();
@ -33,35 +69,18 @@ $table->style[0] = 'font-weight:bold';
$table->size[1] = '70%'; $table->size[1] = '70%';
// Current config["language"] could be set by user, not taken from global setup ! // Current config["language"] could be set by user, not taken from global setup !
switch ($config['dbtype']) { $current_system_lang = db_get_sql(
case 'mysql': 'SELECT `value` FROM tconfig WHERE `token` = "language"'
$current_system_lang = db_get_sql( );
'SELECT `value`
FROM tconfig WHERE `token` = "language"'
);
break;
case 'postgresql':
$current_system_lang = db_get_sql(
'SELECT "value"
FROM tconfig WHERE "token" = \'language\''
);
break;
case 'oracle':
$current_system_lang = db_get_sql(
'SELECT value
FROM tconfig WHERE token = \'language\''
);
break;
}
if ($current_system_lang == '') { if ($current_system_lang == '') {
$current_system_lang = 'en'; $current_system_lang = 'en';
} }
$table->data[0][0] = __('Language code'); $i = 0;
$table->data[0][1] = html_print_select_from_sql(
$table->data[$i][0] = __('Language code');
$table->data[$i++][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage', 'SELECT id_language, name FROM tlanguage',
'language', 'language',
$current_system_lang, $current_system_lang,
@ -71,68 +90,67 @@ $table->data[0][1] = html_print_select_from_sql(
true true
); );
$table->data[1][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true); $table->data[$i][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
$table->data[$i++][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
$table->data[1][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true); $table->data[$i][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[2][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true); $table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[2][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true); $table->data[$i][0] = __('Time source');
$table->data[6][0] = __('Auto login (hash) password');
$table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[9][0] = __('Time source');
$sources['system'] = __('System'); $sources['system'] = __('System');
$sources['sql'] = __('Database'); $sources['sql'] = __('Database');
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true); $table->data[$i++][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
$table->data[10][0] = __('Automatic check for updates'); $table->data[$i][0] = __('Automatic check for updates');
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true); $table->data[$i++][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>"; echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>'; echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>'; echo '</div>';
$table->data[11][0] = __('Enforce https'); $table->data[$i][0] = __('Enforce https');
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[12][0] = __('Use cert of SSL'); $table->data[$i][0] = __('Use cert of SSL');
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->rowstyle[13] = 'display: none;'; $table->rowstyle[$i] = 'display: none;';
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true); $table->rowid[$i] = 'ssl-path-tr';
$table->data[13][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true); $table->data[$i][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
$table->data[$i++][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true); $table->data[$i][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
$table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true); $table->data[$i++][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[15][0] = __('IP list with API access'); $table->data[$i][0] = __('IP list with API access');
if (isset($_POST['list_ACL_IPs_for_API'])) { if (isset($_POST['list_ACL_IPs_for_API'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else { } else {
$list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])); $list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']));
} }
$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); $table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true); $table->data[$i][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); $table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[17][0] = __('Enable GIS features'); $table->data[$i][0] = __('Enable GIS features');
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true); $table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[19][0] = __('Enable Netflow'); $table->data[$i][0] = __('Enable Netflow');
$rbt_disabled = false; $rbt_disabled = false;
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$rbt_disabled = true; $rbt_disabled = true;
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true); $table->data[$i][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
} }
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[21][0] = __('Enable Network Traffic Analyzer'); $table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[21][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'activate_nta', 'name' => 'activate_nta',
'value' => $config['activate_nta'], 'value' => $config['activate_nta'],
@ -171,11 +189,11 @@ foreach ($timezones as $timezone) {
} }
} }
$table->data[23][0] = __('Timezone setup').' '.ui_print_help_tip( $table->data[$i][0] = __('Timezone setup').' '.ui_print_help_tip(
__('Must have the same time zone as the system or database to avoid mismatches of time.'), __('Must have the same time zone as the system or database to avoid mismatches of time.'),
true true
); );
$table->data[23][1] = html_print_input_text_extended( $table->data[$i][1] = html_print_input_text_extended(
'timezone_text', 'timezone_text',
$config['timezone'], $config['timezone'],
'text-timezone_text', 'text-timezone_text',
@ -187,47 +205,63 @@ $table->data[23][1] = html_print_input_text_extended(
'readonly', 'readonly',
true true
); );
$table->data[23][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>'; $table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true); $table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true); $table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$sounds = get_sounds(); $sounds = get_sounds();
$table->data[24][0] = __('Sound for Alert fired'); $table->data[$i][0] = __('Sound for Alert fired');
$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$table->data[24][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[24][1] .= '<div id="layer_sound_alert"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_alert"></div>';
$table->data[25][0] = __('Sound for Monitor critical'); $table->data[$i][0] = __('Sound for Monitor critical');
$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$table->data[25][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[25][1] .= '<div id="layer_sound_critical"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_critical"></div>';
$table->data[26][0] = __('Sound for Monitor warning'); $table->data[$i][0] = __('Sound for Monitor warning');
$table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[26][1] .= '<div id="layer_sound_warning"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_warning"></div>';
$table->data[28][0] = __('Public URL'); $table->data[$i][0] = __('Public URL');
$table->data[28][0] .= ui_print_help_tip( $table->data[$i][0] .= ui_print_help_tip(
__('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'), __('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'),
true true
); );
$table->data[28][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true); $table->data[$i++][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
$table->data[29][0] = __('Referer security'); $table->data[$i][0] = __('Force use Public URL');
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true); $table->data[$i][0] .= ui_print_help_tip(__('Force using defined public URL).', get_product_name()), true);
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true); $table->data[$i++][1] = html_print_switch(
[
'name' => 'force_public_url',
'value' => $config['force_public_url'],
]
);
$table->data[30][0] = __('Event storm protection'); echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true); echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true); echo '</div>';
$table->data[$i][0] = __('Public URL host exclusions');
$table->data[$i++][1] = html_print_textarea('public_url_exclusions', 2, 25, $config['public_url_exclusions'], 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('Referer security');
$table->data[$i][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
$table->data[$i++][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i][0] = __('Event storm protection');
$table->data[$i][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
$table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true); $table->data[$i][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true); $table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true); $table->data[$i][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
$table->data[32][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'server_log_dir', 'server_log_dir',
$config['server_log_dir'], $config['server_log_dir'],
'', '',
@ -236,8 +270,8 @@ $table->data[32][1] = html_print_input_text(
true true
); );
$table->data[33][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true); $table->data[$i][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
$table->data[33][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'max_log_size', 'max_log_size',
$config['max_log_size'], $config['max_log_size'],
'', '',
@ -251,8 +285,8 @@ $modes_tutorial = [
'on_demand' => __('On demand'), 'on_demand' => __('On demand'),
'expert' => __('Expert'), 'expert' => __('Expert'),
]; ];
$table->data['tutorial_mode'][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true); $table->data[$i][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
$table->data['tutorial_mode'][1] = html_print_select( $table->data[$i++][1] = html_print_select(
$modes_tutorial, $modes_tutorial,
'tutorial_mode', 'tutorial_mode',
$config['tutorial_mode'], $config['tutorial_mode'],
@ -263,11 +297,11 @@ $table->data['tutorial_mode'][1] = html_print_select(
); );
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1; $config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true); $table->data[$i][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true); $table->data[$i++][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true); $table->data[$i][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
$table->data[35][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'limit_parameters_massive', 'limit_parameters_massive',
$config['limit_parameters_massive'], $config['limit_parameters_massive'],
'', '',
@ -276,17 +310,17 @@ $table->data[35][1] = html_print_input_text(
true true
); );
$table->data[36][0] = __('Include agents manually disabled'); $table->data[$i][0] = __('Include agents manually disabled');
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true); $table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true); $table->data[$i][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true); $table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[38][0] = __('Set alias as name by default in agent creation'); $table->data[$i][0] = __('Set alias as name by default in agent creation');
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); $table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true); $table->data[$i][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); $table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">'; echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
@ -352,44 +386,50 @@ $(document).ready (function () {
}); });
if ($("input[name=use_cert]").is(':checked')) { if ($("input[name=use_cert]").is(':checked')) {
$('#setup_general-13').show(); $('#ssl-path-tr').show();
} }
$("input[name=use_cert]").change(function () { $("input[name=use_cert]").change(function () {
if( $(this).is(":checked") ) if( $(this).is(":checked") )
$('#setup_general-13').show(); $('#ssl-path-tr').show();
else else
$('#setup_general-13').hide(); $('#ssl-path-tr').hide();
}); });
$("input[name=https]").change(function (){ $("input[name=https]").change(function (){
if($("input[name=https]").prop('checked')) { if($("input[name=https]").prop('checked')) {
$("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({ $("#dialog").dialog({
modal: true, modal: true,
buttons:{ width: 500,
"<?php echo __('Close'); ?>": function(){ buttons:[
$(this).dialog("close"); {
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
} }
} ]
});
}
})
$("input[name=force_public_url]").change(function (){
if($("input[name=force_public_url]").prop('checked')) {
$("#force_public_url_dialog").dialog({
modal: true,
width: 500,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
}
]
}); });
} }
}) })
}); });
</script> </script>
<?php
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}

View File

@ -100,7 +100,15 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, 'unified_filters_id' => $new_unified_id,
]; ];
if ($values['description'] == '') {
$result = false;
$msg = __('Description is empty');
} else if ($values['filter'] == '') {
$result = false;
$msg = __('Filter is empty');
} else {
$result = db_process_sql_insert('tsnmp_filter', $values); $result = db_process_sql_insert('tsnmp_filter', $values);
}
} else { } else {
for ($i = 0; $i < $index_post; $i++) { for ($i = 0; $i < $index_post; $i++) {
$filter = get_parameter('filter_'.$i); $filter = get_parameter('filter_'.$i);
@ -109,12 +117,28 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, 'unified_filters_id' => $new_unified_id,
]; ];
$result = db_process_sql_insert('tsnmp_filter', $values); if ($values['filter'] != '' && $values['description'] != '') {
$result = db_process_sql_insert('tsnmp_filter', $values);
}
}
if ($result === null) {
if ($values['description'] != '') {
$result = false;
$msg = __('Filters are empty');
} else {
$result = false;
$msg = __('Description is empty');
}
} }
} }
if ($result === false) { if ($result === false) {
ui_print_error_message(__('There was a problem creating the filter')); if (!isset($msg)) {
$msg = __('There was a problem creating the filter');
}
ui_print_error_message($msg);
} else { } else {
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
} }
@ -215,8 +239,10 @@ if ($edit_filter > -2) {
$result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC'); $result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
$aglomerate_result = []; $aglomerate_result = [];
foreach ($result_unified as $res) { if (is_array($result_unified) === true) {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC'); foreach ($result_unified as $res) {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC');
}
} }
$table = new stdClass(); $table = new stdClass();
@ -282,7 +308,8 @@ if ($edit_filter > -2) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
var id = "<?php echo $index; ?>"; // +1 because there is already a defined 'filter' field.
var id = parseInt("<?php echo $index; ?>")+1;
var homeurl = "<?php echo $config['homeurl']; ?>"; var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () { $(document).ready (function () {

View File

@ -31,6 +31,10 @@ $delete = (int) get_parameter('delete_tag', 0);
$tag_name = (string) get_parameter('tag_name', ''); $tag_name = (string) get_parameter('tag_name', '');
$tab = (string) get_parameter('tab', 'list'); $tab = (string) get_parameter('tab', 'list');
if ($delete != 0 && is_metaconsole()) {
open_meta_frame();
}
// Metaconsole nodes // Metaconsole nodes
$servers = false; $servers = false;
if (is_metaconsole()) { if (is_metaconsole()) {
@ -316,6 +320,9 @@ echo '<table border=0 cellpadding=0 cellspacing=0 width=100%>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
if ($delete != 0 && is_metaconsole()) {
close_meta_frame();
}
// ~ enterprise_hook('close_meta_frame'); // ~ enterprise_hook('close_meta_frame');
?> ?>

View File

@ -31,6 +31,11 @@ global $config;
check_login(); check_login();
if (!enterprise_installed()) {
include 'general/noaccess.php';
exit;
}
if (! check_acl($config['id_user'], 0, 'PM') if (! check_acl($config['id_user'], 0, 'PM')
&& ! is_user_admin($config['id_user']) && ! is_user_admin($config['id_user'])
) { ) {

View File

@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online'); $tab = get_parameter('tab', 'online');
$buttons = [ $buttons['setup'] = [
'setup' => [ 'active' => ($tab == 'setup') ? true : false,
'active' => ($tab == 'setup') ? true : false, 'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>',
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>', ];
],
'offline' => [ if (enterprise_installed()) {
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false, 'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager')]).'</a>', 'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager')]).'</a>',
], ];
'online' => [ }
'active' => ($tab == 'online') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>', $buttons['online'] = [
], 'active' => ($tab == 'online') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>',
]; ];

View File

@ -256,6 +256,52 @@ if ($create_user) {
$password_confirm = ''; $password_confirm = '';
$new_user = true; $new_user = true;
} else { } else {
$have_number = false;
$have_simbols = false;
if ($config['enable_pass_policy']) {
if ($config['pass_needs_numbers']) {
$nums = preg_match('/([[:alpha:]])*(\d)+(\w)*/', $password_confirm);
if ($nums == 0) {
ui_print_error_message(__('Password must contain numbers'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} else {
$have_number = true;
}
}
if ($config['pass_needs_symbols']) {
$symbols = preg_match('/(\w)*(\W)+(\w)*/', $password_confirm);
if ($symbols == 0) {
ui_print_error_message(__('Password must contain symbols'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} else {
$have_simbols = true;
}
}
if ($config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
if ($have_number && $have_simbols) {
$result = create_user($id, $password_new, $values);
}
} else if ($config['pass_needs_symbols'] && !$config['pass_needs_numbers']) {
if ($have_simbols) {
$result = create_user($id, $password_new, $values);
}
} else if (!$config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
if ($have_number) {
$result = create_user($id, $password_new, $values);
}
}
} else {
$result = create_user($id, $password_new, $values);
}
$info = '{"Id_user":"'.$values['id_user'].'","FullName":"'.$values['fullname'].'","Firstname":"'.$values['firstname'].'","Lastname":"'.$values['lastname'].'","Email":"'.$values['email'].'","Phone":"'.$values['phone'].'","Comments":"'.$values['comments'].'","Is_admin":"'.$values['is_admin'].'","Language":"'.$values['language'].'","Timezone":"'.$values['timezone'].'","Block size":"'.$values['block_size'].'"'; $info = '{"Id_user":"'.$values['id_user'].'","FullName":"'.$values['fullname'].'","Firstname":"'.$values['firstname'].'","Lastname":"'.$values['lastname'].'","Email":"'.$values['email'].'","Phone":"'.$values['phone'].'","Comments":"'.$values['comments'].'","Is_admin":"'.$values['is_admin'].'","Language":"'.$values['language'].'","Timezone":"'.$values['timezone'].'","Block size":"'.$values['block_size'].'"';
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@ -264,7 +310,10 @@ if ($create_user) {
$info .= '}'; $info .= '}';
} }
$result = create_user($id, $password_new, $values); $can_create = false;
if ($result) { if ($result) {
$res = save_pass_history($id, $password_new); $res = save_pass_history($id, $password_new);
} }
@ -575,6 +624,10 @@ if ($delete_profile) {
); );
} }
if ($values) {
$user_info = $values;
}
$table = new stdClass(); $table = new stdClass();
$table->id = 'user_configuration_table'; $table->id = 'user_configuration_table';
$table->width = '100%'; $table->width = '100%';

View File

@ -418,6 +418,7 @@ class DiscoveryTaskList extends Wizard
$table->align[9] = 'left'; $table->align[9] = 'left';
foreach ($recon_tasks as $task) { foreach ($recon_tasks as $task) {
$no_operations = false;
$data = []; $data = [];
$server_name = servers_get_name($task['id_recon_server']); $server_name = servers_get_name($task['id_recon_server']);
@ -552,6 +553,17 @@ class DiscoveryTaskList extends Wizard
$data[6] .= __('Discovery.App.Oracle'); $data[6] .= __('Discovery.App.Oracle');
break; break;
case DISCOVERY_DEPLOY_AGENTS:
// Internal deployment task.
$no_operations = true;
$data[6] = html_print_image(
'images/deploy.png',
true,
['title' => __('Agent deployment')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Agent.Deployment');
break;
case DISCOVERY_HOSTDEVICES: case DISCOVERY_HOSTDEVICES:
default: default:
if ($task['id_recon_script'] == 0) { if ($task['id_recon_script'] == 0) {
@ -595,71 +607,75 @@ class DiscoveryTaskList extends Wizard
$data[8] = __('Not executed yet'); $data[8] = __('Not executed yet');
} }
if ($task['disabled'] != 2) { if (!$no_operations) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">'; if ($task['disabled'] != 2) {
$data[9] .= html_print_image( $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
'images/eye.png', $data[9] .= html_print_image(
true 'images/eye.png',
);
$data[9] .= '</a>';
}
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
);
$data[9] .= '</a>';
}
if (check_acl(
$config['id_user'],
$task['id_group'],
'PM'
)
) {
if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
$tipam_task_id
)
).'">'.html_print_image(
'images/config.png',
true true
).'</a>'; );
$data[9] .= '<a href="'.ui_get_full_url( $data[9] .= '</a>';
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id }
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png', if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true true
).'</a>'; );
$data[9] .= '</a>';
}
if (check_acl(
$config['id_user'],
$task['id_group'],
'PM'
)
) {
if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
$tipam_task_id
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
} else {
// Check if is a H&D, Cloud or Application or IPAM.
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
}
} else { } else {
// Check if is a H&D, Cloud or Application or IPAM. $data[9] = '';
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
} }
} else { } else {
$data[9] = ''; $data[9] = '-';
} }
$table->cellclass[][9] = 'action_buttons'; $table->cellclass[][9] = 'action_buttons';

View File

@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php'; require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
enterprise_include_once('include/class/CSVImportAgents.class.php'); enterprise_include_once('include/class/CSVImportAgents.class.php');
enterprise_include_once('include/class/DeploymentCenter.class.php');
enterprise_include_once('include/functions_hostdevices.php'); enterprise_include_once('include/functions_hostdevices.php');
/** /**
@ -127,6 +128,12 @@ class HostDevices extends Wizard
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png', 'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'), 'label' => __('Import CSV'),
]; ];
$buttons[] = [
'url' => $this->url.'&mode=deploy',
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
'label' => __('Agent deployment'),
];
} }
$buttons[] = [ $buttons[] = [
@ -149,11 +156,30 @@ class HostDevices extends Wizard
), ),
'label' => __('Discovery'), 'label' => __('Discovery'),
], ],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
),
'label' => __('Host & Devices'),
'selected' => true,
],
], ],
true true
); );
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(
__('Host & devices'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
$this->printBigButtonsList($buttons); $this->printBigButtonsList($buttons);
return; return;
@ -167,6 +193,14 @@ class HostDevices extends Wizard
); );
return $csv_importer->runCSV(); return $csv_importer->runCSV();
} }
if ($mode === 'deploy') {
$deployObject = new DeploymentCenter(
$this->page,
$this->breadcrum
);
return $deployObject->run();
}
} }
if ($mode === 'customnetscan') { if ($mode === 'customnetscan') {
@ -785,6 +819,7 @@ class HostDevices extends Wizard
}).change();'; }).change();';
$this->printFormAsGrid($form); $this->printFormAsGrid($form);
$this->printGoBackButton($this->url.'&page='.($this->page - 1));
} }
} }
@ -877,6 +912,7 @@ class HostDevices extends Wizard
]; ];
$this->printFormAsList($form); $this->printFormAsList($form);
$this->printGoBackButton($this->url.'&mode=netscan&task='.$this->task['id_rt'].'&page='.($this->page - 1));
} }
if ($this->page == 2) { if ($this->page == 2) {

View File

@ -296,241 +296,20 @@ class Wizard
*/ */
public function printInput($data) public function printInput($data)
{ {
global $config;
include_once $config['homedir'].'/include/functions_html.php';
if (is_array($data) === false) { if (is_array($data) === false) {
return ''; return '';
} }
switch ($data['type']) { $input = html_print_input(($data + ['return' => true]), 'div', true);
case 'text': if ($input === false) {
return html_print_input_text( return '';
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : true),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
);
case 'image':
return html_print_input_image(
$data['name'],
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'text_extended':
return html_print_input_text_extended(
$data['name'],
$data['value'],
$data['id'],
$data['alt'],
$data['size'],
$data['maxlength'],
$data['disabled'],
$data['script'],
$data['attributes'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['password']) === true) ? $data['password'] : false),
((isset($data['function']) === true) ? $data['function'] : '')
);
case 'password':
return html_print_input_password(
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['class']) === true) ? $data['class'] : '')
);
case 'text':
return html_print_input_text(
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
);
case 'image':
return html_print_input_image(
$data['name'],
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'hidden':
return html_print_input_hidden(
$data['name'],
$data['value'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : false)
);
case 'hidden_extended':
return html_print_input_hidden_extended(
$data['name'],
$data['value'],
$data['id'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : false)
);
case 'color':
return html_print_input_color(
$data['name'],
$data['value'],
((isset($data['class']) === true) ? $data['class'] : false),
((isset($data['return']) === true) ? $data['return'] : false)
);
case 'file':
return html_print_input_file(
$data['name'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'select':
return html_print_select(
$data['fields'],
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['option_style']) === true) ? $data['option_style'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['modal']) === true) ? $data['modal'] : false),
((isset($data['message']) === true) ? $data['message'] : ''),
((isset($data['select_all']) === true) ? $data['select_all'] : false)
);
case 'select_from_sql':
return html_print_select_from_sql(
$data['sql'],
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
);
case 'select_groups':
return html_print_select_groups(
((isset($data['id_user']) === true) ? $data['id_user'] : false),
((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['option_style']) === true) ? $data['option_style'] : false),
((isset($data['id_group']) === true) ? $data['id_group'] : false),
((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
);
case 'submit':
return '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false)
).'</div>';
case 'checkbox':
return html_print_checkbox(
$data['name'],
$data['value'],
((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
);
case 'switch':
return html_print_switch($data);
case 'interval':
return html_print_extended_select_for_time(
$data['name'],
$data['value'],
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['style']) === true) ? $data['selected'] : false),
((isset($data['unique']) === true) ? $data['unique'] : false)
);
case 'textarea':
return html_print_textarea(
$data['name'],
$data['rows'],
$data['columns'],
((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : '')
);
default:
// Ignore.
break;
} }
return ''; return $input;
} }
@ -556,6 +335,7 @@ class Wizard
], ],
'inputs' => [ 'inputs' => [
[ [
'class' => 'w100p',
'arguments' => [ 'arguments' => [
'name' => 'submit', 'name' => 'submit',
'label' => __('Go back'), 'label' => __('Go back'),
@ -594,13 +374,24 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; if ($input['wrapper']) {
$output .= '<ul class="wizard">'; $output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
} else {
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
}
$output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlock($input, $return); $output .= $this->printBlock($input, $return);
} }
$output .= '</ul></li>'; // Close block.
if ($input['wrapper']) {
$output .= '</ul></'.$input['wrapper'].'>';
} else {
$output .= '</ul></li>';
}
} else { } else {
if ($input['arguments']['type'] != 'hidden') { if ($input['arguments']['type'] != 'hidden') {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['id'].'" class="'.$class.'">';
@ -648,7 +439,7 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsGrid($input, $return); $output .= $this->printBlockAsGrid($input, $return);
} }
@ -751,7 +542,7 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsList($input, $return); $output .= $this->printBlockAsList($input, $return);
} }
@ -797,10 +588,11 @@ class Wizard
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -844,6 +636,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;
@ -869,10 +664,11 @@ class Wizard
$rows = $data['rows']; $rows = $data['rows'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -895,45 +691,47 @@ class Wizard
$first_block_printed = false; $first_block_printed = false;
foreach ($rows as $row) { if (is_array($rows)) {
if ($row['new_form_block'] == true) { foreach ($rows as $row) {
if ($first_block_printed === true) { if ($row['new_form_block'] == true) {
// If first form block has been placed, then close it before starting a new one. if ($first_block_printed === true) {
$output .= '</div>'; // If first form block has been placed, then close it before starting a new one.
$output .= '<div class="white_box" style="margin-top: 30px;">'; $output .= '</div>';
} else { $output .= '<div class="white_box" style="margin-top: 30px;">';
$output .= '<div class="white_box">'; } else {
$output .= '<div class="white_box">';
}
$first_block_printed = true;
} }
$first_block_printed = true; $output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
}
$output .= '<div class="edit_discovery_info" style="'.$row['style'].'">'; foreach ($row['columns'] as $column) {
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
foreach ($row['columns'] as $column) { $output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">'; foreach ($column['inputs'] as $input) {
if (is_array($input)) {
foreach ($column['inputs'] as $input) { if ($input['arguments']['type'] != 'submit') {
if (is_array($input)) { $output .= $this->printBlockAsGrid($input, true);
if ($input['arguments']['type'] != 'submit') { } else {
$output .= $this->printBlockAsGrid($input, true); $output_submit .= $this->printBlockAsGrid($input, true);
}
} else { } else {
$output_submit .= $this->printBlockAsGrid($input, true); $output .= $input;
} }
} else {
$output .= $input;
} }
$output .= '</div>';
} }
$output .= '</div>'; $output .= '</div>';
} }
$output .= '</div>';
} }
$output .= '</div>'; $output .= '</div>';
@ -941,6 +739,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;
@ -964,10 +765,11 @@ class Wizard
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -1001,6 +803,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More