Merge branch 'develop' into ent-12721-nuevo-modo-de-licencia-trial

This commit is contained in:
Daniel Maya 2024-02-13 16:07:15 +01:00
commit b38ba492d1
243 changed files with 6443 additions and 1872 deletions

View File

@ -585,7 +585,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.775-240112
Version: 7.0NG.775-240213
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240112';
use constant AGENT_BUILD => '240213';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1860,7 +1860,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {
@ -3678,9 +3678,21 @@ sub write_module_xml ($@) {
return;
}
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
# Is it an extraction log module?
if($module->{'type'} eq "log"){
my $output = join('', @data);
if ($output eq "") {
return;
}
$Xml .="<log_module>\n";
$Xml .= " <source><![CDATA[" . $module->{'name'} . "]]></source>\n";
$Xml .= " <type><![CDATA[" . $module->{'type'} . "]]></type>\n";
$Xml .= " <encoding>base64</encoding>\n";
$Xml .= " <data><![CDATA[" . $output . "]]></data>\n";
$Xml .= "</log_module>\n";
return;
}
# Critical section
@ -3690,7 +3702,7 @@ sub write_module_xml ($@) {
" <name><![CDATA[" . $module->{'name'} . "]]></name>\n" .
" <description><![CDATA[" . $module->{'description'} . "]]></description>\n" .
" <type>" . $module->{'type'} . "</type>\n";
# Interval
$Xml .= " <module_interval>" . $module->{'interval'} . "</module_interval>\n";
@ -3889,7 +3901,8 @@ sub module_logger ($) {
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
$module->{'filter'},
$module->{'type'}
);
return $status;
@ -3926,20 +3939,25 @@ my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
my ($module_name, $log_file, $reg_exp, $module_type) = @_;
if(!$str_name){
if(!$module_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
if(!$log_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
if(!$module_type){
log_message("module_logger", "Missing module type");
return;
}
if(!$reg_exp){
$reg_exp = '.*';
}
my $idx_dir = '/tmp/';
@ -3947,9 +3965,6 @@ sub grep_logs {
my $idx_pos = 0;
my $idx_size = 0;
my $idx_ino = '';
my $module_name = $str_name;
my $log_file = $str_file;
my $reg_exp = $str_regex;
# Check that log file exists
if (! -e $log_file) {
@ -3975,7 +3990,7 @@ sub grep_logs {
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
my $output = create_log($module_name, @data);
my $output = create_log($module_name, $module_type, @data);
return $output;
}
@ -4090,27 +4105,32 @@ sub grep_logs {
}
sub create_log {
my ($module_name, @data) = @_;
my ($module_name, $module_type, @data) = @_;
# No data
if ($#data < 0) {
return;
}
# Log module
my $output = "<log_module>\n";
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
$output .= "<encoding>base64</encoding>\n";
$output .= "<data><![CDATA[";
$output .= &$encode_sub(join('', @data), '');
$output .= "]]></data>\n";
$output .= "</log_module>\n";
my $data_content = process_log_monitoring($module_type, @data);
return $output;
return $data_content;
}
}
sub process_log_monitoring {
my ($module_type, @data) = @_;
my $output = "";
if ($module_type eq "log"){
$output = &$encode_sub(join('', @data), '');
} elsif ($module_type eq "generic_data") {
$output = scalar @data;
} elsif ($module_type eq "generic_proc"){
$output = scalar @data > 0 ? 1 : 0;
} elsif ($module_type eq "generic_data_string" || $module_type eq "async_string"){
$output = join('', @data);
}
return $output;
}
################################################################################
# TERM Handler
################################################################################
@ -4283,6 +4303,10 @@ sub init_module ($) {
$module->{'alert_template'} = undef;
$module->{'filter'} = undef;
$module->{'absoluteinterval'} = undef;
$module->{'each_ff'} = undef;
$module->{'min_ff_event_normal'} = undef;
$module->{'min_ff_event_warning'} = undef;
$module->{'min_ff_event_critical'} = undef;
}
################################################################################

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240112
%define release 240213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240112
%define release 240213
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240112
%define release 240213
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version
@ -13,23 +13,22 @@ Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Vendor: ArticaST <http://www.artica.es>
Vendor: PandoraFMS <https://pandorafms.com>
Source0: %{source_name}-%{version}.tar.gz
URL: http://pandorafms.org
URL: https://pandorafms.com
Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Packager: PandoraFMS <info@pandorafms.com>
Prefix: /usr/share
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
BuildArch: x86_64
Requires(pre): shadow-utils
Requires(post): chkconfig /bin/ln
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires(post): /bin/ln
Requires(preun): /bin/rm /usr/sbin/userdel
Requires: coreutils unzip
Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk
Requires: perl-interpreter
Requires: perl-IO-Compress
Requires: libnsl
Requires: libxcrypt-compat
AutoReq: 0
Provides: %{name}-%{version}
@ -50,7 +49,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
mkdir -p $RPM_BUILD_ROOT/usr/bin/
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
@ -58,7 +57,7 @@ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
@ -119,21 +118,11 @@ then
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
# Enable the services on SystemD
systemctl daemon-reload
systemctl enable pandora_agent_daemon.service
else
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on
fi
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun
# Upgrading
@ -141,8 +130,7 @@ if [ "$1" = "1" ]; then
exit 0
fi
/sbin/chkconfig --del pandora_agent_daemon
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
systemctl stop pandora_agent_daemon.service > /dev/null 2>&1 || :
# Remove symbolic links
pushd /etc/pandora
@ -162,7 +150,6 @@ exit 0
%defattr(755,root,root)
/usr/bin/pandora_agent_exec
/usr/bin/tentacle_client
/etc/rc.d/init.d/pandora_agent_daemon
%defattr(644,root,root)
/usr/share/man/man1/pandora_agent.1.gz

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240112
%define release 240213
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240112
%define release 240213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240112"
PI_BUILD="240213"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,9 +1,9 @@
bin_PROGRAMS = PandoraAgent
if DEBUG
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_CXXFLAGS=-g -O0
else
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_CXXFLAGS=-O2
endif

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240112}
{240213}
ViewReadme
{Yes}

View File

@ -236,6 +236,8 @@ Module_Kind
Pandora_Module::parseModuleKindFromString (string kind) {
if (kind == module_exec_str) {
return MODULE_EXEC;
} else if (kind == module_exec_powershell_str) {
return MODULE_EXEC_POWERSHELL;
} else if (kind == module_proc_str) {
return MODULE_PROC;
} else if (kind == module_service_str) {

View File

@ -94,7 +94,8 @@ namespace Pandora_Modules {
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
MODULE_PLUGIN, /**< Plugin */
MODULE_PING, /**< Ping module */
MODULE_SNMPGET /**< SNMP get module */
MODULE_SNMPGET, /**< SNMP get module */
MODULE_EXEC_POWERSHELL /**< The module run a custom powershell command */
} Module_Kind;
/**
@ -109,24 +110,25 @@ namespace Pandora_Modules {
regex_t regexp;
} Condition;
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_powershell_str = "module_exec_powershell";
/**
* Pandora module super-class exception.

View File

@ -0,0 +1,91 @@
/* Pandora exec module. These modules exec a powershell command.
Copyright (c) 2006-2023 Pandora FMS.
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; either version 2, or (at your option)
any later version.
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.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "pandora_module_exec_powershell.h"
#include "../pandora_strutils.h"
#include <iostream>
#include <stdexcept>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#define EXEC_OK 0
#define EXEC_ERR -1
#define BUFSIZE 4096
using namespace Pandora;
using namespace Pandora_Strutils;
using namespace Pandora_Modules;
/**
* Creates a Pandora_Module_Exec_Powershell object.
*
* @param name Module name
* @param exec Command to be executed.
*/
Pandora_Module_Exec_Powershell::Pandora_Module_Exec_Powershell(string name, string exec)
: Pandora_Module (name) {
string escaped_exec;
for (char c : exec) {
if (c == '"' || c == '\\') {
escaped_exec += '\\';
}
escaped_exec += c;
}
this->module_exec = "powershell -C \"" + escaped_exec + "\"";
this->setKind (module_exec_powershell_str);
}
void Pandora_Module_Exec_Powershell::run() {
string output_result;
this->has_output = false;
FILE* pipe = popen(this->module_exec.c_str(), "r");
if (!pipe) {
pandoraLog ("Error while executing command.", GetLastError ());
return;
}
char buffer[BUFSIZE];
while (fgets(buffer, BUFSIZE, pipe) != NULL) {
output_result += buffer;
}
int result = pclose(pipe);
if (result == EXEC_ERR) {
pandoraLog ("Error while closing command process.", GetLastError ());
return;
}
if (result != EXEC_OK) {
pandoraLog ("Error invalid powershell command.", GetLastError ());
return;
}
this->has_output = true;
this->setOutput (output_result);
}

View File

@ -0,0 +1,43 @@
/* Pandora exec module. These modules exec a powershell command
Copyright (c) 2006-2023 Pandora FMS.
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; either version 2, or (at your option)
any later version.
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.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#define __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#include "pandora_module.h"
namespace Pandora_Modules {
/**
* Module to execute a powershell command.
*
* Any custom order that want to be executed can be put in
* the <code>util</code> directory into the Pandora agent path.
*/
class Pandora_Module_Exec_Powershell : public Pandora_Module {
private:
string module_exec;
public:
Pandora_Module_Exec_Powershell (string name, string exec);
void run ();
};
}
#endif

View File

@ -22,6 +22,7 @@
#include "pandora_module_factory.h"
#include "pandora_module.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -129,6 +130,7 @@ using namespace Pandora_Strutils;
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
#define TOKEN_EXEC_POWERSHELL ("module_exec_powershell ")
string
parseLine (string line, string token) {
@ -158,7 +160,7 @@ Pandora_Module *
Pandora_Module_Factory::getModuleFromDefinition (string definition) {
list<string> tokens;
list<string>::iterator iter;
string module_name, module_type, module_exec;
string module_name, module_type, module_exec, module_exec_powershell;
string module_min, module_max, module_description;
string module_interval, module_absoluteinterval;
string module_proc, module_service;
@ -268,6 +270,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_user_session = "";
macro = "";
module_wait_timeout = "";
module_exec_powershell = "";
stringtok (tokens, definition, "\n");
@ -302,6 +305,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
if (module_exec_powershell == "") {
module_exec_powershell = parseLine (line, TOKEN_EXEC_POWERSHELL);
}
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
@ -626,6 +632,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
if (module_exec_powershell != "") {
pos_macro = module_exec_powershell.find(macro_name);
if (pos_macro != string::npos){
module_exec_powershell.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_proc != "") {
pos_macro = module_proc.find(macro_name);
if (pos_macro != string::npos){
@ -1155,6 +1168,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_exec_powershell != "") {
module = new Pandora_Module_Exec_Powershell (module_name, module_exec_powershell);
} else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name,
module_proc);

View File

@ -48,7 +48,7 @@ Pandora_Module_Freedisk_Percent::Pandora_Module_Freedisk_Percent (string name, s
void
Pandora_Module_Freedisk_Percent::run () {
long res;
double res;
try {
Pandora_Module::run ();
@ -59,7 +59,7 @@ Pandora_Module_Freedisk_Percent::run () {
try {
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
this->setOutput (longtostr (res));
this->setOutput(std::to_string(res));
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
this->has_output = false;
}

View File

@ -21,6 +21,7 @@
#include "pandora_module_factory.h"
#include "pandora_module_list.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -235,6 +236,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Plugin *module_plugin;
Pandora_Module_Ping *module_ping;
Pandora_Module_SNMPGet *module_snmpget;
Pandora_Module_Exec_Powershell *module_exec_powershell;
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
@ -244,6 +246,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_exec = (Pandora_Module_Exec *) module;
modules->push_back (module_exec);
break;
case MODULE_EXEC_POWERSHELL:
module_exec_powershell = (Pandora_Module_Exec_Powershell *) module;
modules->push_back (module_exec_powershell);
break;
case MODULE_PROC:
module_proc = (Pandora_Module_Proc *) module;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.775 Build 240112")
#define PANDORA_VERSION ("7.0NG.775 Build 240213")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.775(Build 240112))"
VALUE "ProductVersion", "(7.0NG.775(Build 240213))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -188,11 +188,11 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
* from WMI database.
*/
unsigned long
double
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
CDhInitialize init;
CDispPtr wmi_svc, quickfixes;
double free_space = 0, size = 0;
double free_space = 0, size = 0;
string query;
query = "SELECT Size, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\"";
@ -202,7 +202,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
L".ExecQuery(%T)",
query.c_str ()));
FOR_EACH (quickfix, quickfixes, NULL) {
dhGetValue (L"%e", &free_space, quickfix,
L".FreeSpace");
@ -213,7 +213,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
return 0;
}
return (unsigned long) (free_space * 100 / size);
return (free_space * 100 / size);
} NEXT_THROW (quickfix);
} catch (string errstr) {
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());

View File

@ -44,7 +44,7 @@ namespace Pandora_Wmi {
int isProcessRunning (string process_name);
int isServiceRunning (string service_name);
unsigned long getDiskFreeSpace (string disk_id);
unsigned long getDiskFreeSpacePercent (string disk_id);
double getDiskFreeSpacePercent (string disk_id);
int getCpuUsagePercentage (int cpu_id);
long getFreememory ();
long getFreememoryPercent ();

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.775-240112
Version: 7.0NG.775-240213
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -280,18 +280,17 @@ function dbmgr_extension_main()
if (is_array($result) === false) {
echo '<strong>Output: <strong>'.$result;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
return;
}
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
echo "<div class='overflow'>";
$table = new stdClass();
$table->width = '100%';

View File

@ -3,7 +3,7 @@
// Allow Grafana proxy
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers
$headers = apache_request_headers();
@ -23,7 +23,10 @@ if ($headers['X-DS-Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['X-DS-Authorization']));
// Check user login
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login.
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {

View File

@ -2,7 +2,7 @@
// Allow Grafana proxy.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers.
$headers = apache_request_headers();
@ -23,6 +23,9 @@ if ($headers['Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login
$user_in_db = process_user_login($user, $password, true);
@ -38,7 +41,7 @@ if ($headers['Authorization']) {
$result_data = [];
// Decode target data sent by datasource plugin in Grafana
$target_data = json_decode($target['target'], true);
$target_data = $target['target'];
if ($target_data['module']) {
// Get module name as target if not defined in Grafana.

View File

@ -3,7 +3,7 @@
// Allow Grafana proxy
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, X-Grafana-Org-Id, X-Grafana-NoCache, X-DS-Authorization, Authorization');
// Get all request headers
$headers = apache_request_headers();
@ -24,6 +24,9 @@ if ($headers['Authorization']) {
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
// Prevent sql injection.
$user = mysqli_real_escape_string($config['dbconnection'], $user);
// Check user login
$user_in_db = process_user_login($user, $password, true);

View File

@ -223,7 +223,7 @@ function mainInsertData()
'',
empty($agent_id)
);
$table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] = html_print_input_text('date', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] .= '&nbsp;';
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
@ -283,8 +283,14 @@ function mainInsertData()
secondText: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'});
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('#text-date').datepicker ({
dateFormat: '<?php echo DATE_FORMAT_JS; ?>',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
firstDay: "<?php echo $config['datepicker_first_day']; ?>",
});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
});

View File

@ -128,6 +128,6 @@ if (empty($data)) {
}
echo '{
"label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'",
"data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']]
"label": "'.htmlspecialchars(($graph_title ?? ''), ENT_QUOTES).'",
"data": [["'.time().'", '.htmlspecialchars(($data ?? ''), ENT_QUOTES).']]
}';

View File

@ -1,11 +1,11 @@
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
pandorafms.oracle=abdfd7280f76276f696115cabdac731e
pandorafms.db2=122f2abff0ec1d668c35ee0911483021
pandorafms.sap.deset=9bb72b7f7497a8b543f25cd71f96878f
pandorafms.gcp.ce=6743d39452f8e1ad85d0d56a30843973
pandorafms.aws.ec2=07416081f11d92a7d5d9441dabb5c5cb
pandorafms.aws.s3=eff053a212ea112e2a37efd9debbe6a0
pandorafms.aws.rds=47d7b02019329e1698f96db4959f9516
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3
pandorafms.azure.mc=04a1072d1ece8583645ad88204fbeed3

View File

@ -0,0 +1,66 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tmerge_error` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`step` int(10) default 0,
`msg` LONGTEXT default "",
`action` text default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_error` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `tmerge_steps` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`total` int(10) default 0,
`step` int(10) default 0,
`debug` varchar(1024) default "",
`action` varchar(100) default "",
`affected` varchar(100) default "",
`query` mediumtext default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_steps` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `tmerge_queries` (
`steps` int(10) NOT NULL auto_increment,
`action` varchar(100) default "",
`affected` varchar(100) default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
`query` LONGTEXT NOT NULL default "",
PRIMARY KEY (`steps`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;
ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
ALTER TABLE `treport_content_template` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `id_name` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `ip` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `type` text NULL;
ALTER TABLE `tsesion_filter` MODIFY COLUMN `user` text NULL;
ALTER TABLE `tncm_agent_data`
ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;
ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ;
ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`;
UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
SET @widget_id = NULL;
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php');
COMMIT;

View File

@ -397,21 +397,23 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$modal_box .= '<a href="https://discord.com/invite/xVt2ruSxmr" target="_blank">'.__('Join discord community').'</a>';
$modal_box .= '</div>';
$modal_help = html_print_div(
[
'id' => 'modal-help-content',
'content' => html_print_image(
'images/help@header.svg',
true,
[
'title' => __('Help'),
'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user',
]
).$modal_box,
],
true,
);
if ($config['activate_feedback'] === '1') {
$modal_help = html_print_div(
[
'id' => 'modal-help-content',
'content' => html_print_image(
'images/help@header.svg',
true,
[
'title' => __('Help'),
'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user',
]
).$modal_box,
],
true,
);
}
// User.
@ -1019,11 +1021,14 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
ok: '<?php echo __('Close'); ?>',
overlay: true,
overlayExtraClass: 'welcome-overlay',
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
width: 1000,
},
oncancel: {
page: 'include/ajax/welcome_window',
@ -1041,6 +1046,34 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
}
})
}
},
onload: () => {
$(document).ready(function () {
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
$(buttonpane).append(`
<div class="welcome-wizard-buttons">
<label>
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
<?php echo __('Do not show anymore'); ?>
</label>
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
</div>
`);
var closeWizard = $("button.close-wizard-button");
$(closeWizard).click(function (e) {
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
if (checkbox === 1) {
$(cancel).click();
} else {
$(close).click()
}
});
});
}
});
});

View File

@ -100,7 +100,7 @@ if ($initial && users_is_admin()) {
);
}
if (check_acl($config['id_user'], 0, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW') && empty($sec2)) {
$welcome = !$initial;
try {
$welcome_window = new WelcomeWindow($welcome);

View File

@ -399,12 +399,12 @@ if ($new_agent === true) {
// Ip adress.
$tableAgent->data['caption_ip_address'] = __('IP Address');
$tableAgent->rowclass['ip_address'] = 'w540px';
$tableAgent->rowclass['ip_address'] = 'w400px';
$tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px');
$tableAgent->data['ip_address'][1] = html_print_button(__('Check unique IP'), 'check_unique_ip', false, '', ['class' => 'secondary w130px'], true);
$tableAgent->data['message_check_ip'][0] = html_print_div(['id' => 'message_check_ip'], true);
$tableAgent->rowclass['additional_ip_address'] = 'subinput';
$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
$tableAgent->data['additional_ip_address'][1] = __('Unique IP');
$tableAgent->cellclass['additional_ip_address'][1] = 'w120px';
$tableAgent->data['additional_ip_address'][2] = html_print_input(
[
@ -500,21 +500,42 @@ $tableAgent->data['primary_group'][0] .= ui_print_group_icon(
);
$tableAgent->data['primary_group'][0] .= '</span>';
$tableAgent->data['caption_interval'][0] = __('Interval');
// $tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent->rowclass['interval'] = 'w540px';
$tableAgent->data['interval'][0] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w33p'
);
$broker = false;
if (enterprise_installed()) {
// CHECK BROKER FOR SHOW INTERVAL.
enterprise_include('include/functions_config_agents.php');
// Read configuration file.
$files = config_agents_get_agent_config_filenames($id_agente);
$file_name = $files['conf'];
if (empty($file_name) === false) {
$agent_config = file_get_contents($file_name);
$encoding = 'UTF-8';
$agent_config_utf8 = mb_convert_encoding($agent_config, 'UTF-8', $encoding);
if ($agent_config_utf8 !== false) {
$agent_config = $agent_config_utf8;
}
$broker = str_contains($agent_config, '#broker active');
}
}
if ($broker === false) {
$tableAgent->data['caption_interval'][0] = __('Interval');
// $tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent->rowclass['interval'] = 'w540px';
$tableAgent->data['interval'][0] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w33p'
);
}
if ($intervalo < SECONDS_5MINUTES) {
$tableAgent->data['interval'][0] .= clippy_context_help('interval_agent_min');
@ -653,6 +674,19 @@ if (enterprise_installed()) {
}
}
if ($id_os === '1') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/Syslog/', $row['raw']) === 1) {
if ($row['disabled'] === 1) {
$enable_log_collector = 0;
} else {
$enable_log_collector = 1;
}
}
}
}
if ($id_os === '9') {
$modules = $agent_plugin->getModules();
foreach ($modules as $key => $row) {
@ -1130,17 +1164,12 @@ foreach ($fields as $field) {
}
if ((bool) $field['is_password_type'] === true) {
$customContent = html_print_input_text_extended(
$customContent = html_print_input_password(
'customvalue_'.$field['id_field'],
$custom_value,
'customvalue_'.$field['id_field'],
'',
30,
100,
$view_mode,
'',
'',
true,
45,
255,
true
);
} else if ($field['is_link_enabled']) {
@ -1301,6 +1330,7 @@ ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript">
let unique_ip_trigger = false;
// Show/Hide custom field row.
function show_custom_field_row(id){
if( $('#field-'+id).css('display') == 'none'){
@ -1464,23 +1494,40 @@ ui_require_jquery_file('bgiframe');
$("#text-agente").prop('readonly', true);
// Disable fixed ip button if empty.
if($("#text-direccion").val() == '') {
$("#fixed_ip").prop('disabled',true);
}
$("#text-direccion").on('input',function(e){
if($("#text-direccion").val() == '') {
$("#fixed_ip").prop('disabled',true);
} else {
$("#fixed_ip").prop('disabled',false);
$("#text-direccion").on('change',function(e){
const unique_ip_token = '<?php echo $config['unique_ip']; ?>';
unique_ip_trigger = false;
if (unique_ip_token == 1) {
check_unique_ip();
}
});
check_basic_options();
$('#id_os').on('change', function(){
check_basic_options();
})
});
$('#button-check_unique_ip').on('click', function() {
check_unique_ip();
});
$('#form_agent').on('submit', function(e) {
if (unique_ip_trigger) {
e.preventDefault();
const form = this;
confirmDialog(
{
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('This IP address is in use. Are you sure you want to save it?'); ?>',
ok: '<?php echo __('Yes'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
form.submit();
}
}
);
}
});
});
function check_basic_options(){
@ -1490,4 +1537,40 @@ ui_require_jquery_file('bgiframe');
$('#basic_options').addClass('invisible');
}
}
function check_unique_ip() {
const direccion = $('#text-direccion').val();
let ip_all = <?php echo json_encode($ip_all); ?>;
if (ip_all) {
ip_all = Object.keys(ip_all);
}
$.ajax({
method: "POST",
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
dataType: 'json',
data: {
page: "include/ajax/agent",
check_unique_ip: 1,
direccion,
ip_all
},
success: function(data) {
if (data.success) {
$('#message_check_ip').attr('class', 'success');
} else {
$('#message_check_ip').attr('class', 'error');
}
if(data.exist_ip) {
unique_ip_trigger = true;
} else {
unique_ip_trigger = false;
}
$('#message_check_ip').html(data.message);
}
});
}
</script>

View File

@ -102,7 +102,6 @@ $alias_as_name = 0;
$direccion_agente = get_parameter('direccion', '');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
$unique_ip = 0;
$intervalo = SECONDS_5MINUTES;
$ff_interval = 0;
$quiet_module = 0;
@ -186,7 +185,6 @@ if ($create_agent) {
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0);
// Safe_output only validate ip.
$direccion_agente = trim(io_safe_output($direccion_agente));
@ -269,12 +267,7 @@ if ($create_agent) {
$nombre_agente = $alias;
}
if ($unique_ip && $direccion_agente != '') {
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
$exists_ip = db_get_row_sql($sql);
}
if (!$exists_alias && !$exists_ip) {
if (!$exists_alias) {
$id_agente = db_process_sql_insert(
'tagente',
[
@ -371,8 +364,6 @@ if ($create_agent) {
$agent_creation_error = __('Could not be created');
if ($exists_alias) {
$agent_creation_error = __('Could not be created, because name already exists');
} else if ($exists_ip) {
$agent_creation_error = __('Could not be created, because IP already exists');
}
}
}
@ -962,7 +953,6 @@ if ($update_agent) {
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0);
// Safe_output only validate ip.
$direccion_agente = trim(io_safe_output($direccion_agente));
@ -1097,18 +1087,11 @@ if ($update_agent) {
// If there is an agent with the same name, but a different ID.
}
if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') {
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
$exists_ip = db_get_row_sql($sql);
}
$old_group = agents_get_agent_group($id_agente);
if ($grupo <= 0) {
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
} else if ($old_group !== $grupo && group_allow_more_agents($grupo, true, 'update') === false) {
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
} else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address'));
} else {
// If different IP is specified than previous, add the IP.
if ($direccion_agente != ''
@ -1316,8 +1299,11 @@ if ($update_agent) {
}
$modules = $agent->getModules();
foreach ($modules as $key => $row) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1
|| ($id_os === 1 && preg_match('/Syslog/', $row['raw']) === 1)
) {
if ($enable_log_collector === 1) {
if ($row['disabled'] === 1) {
$agent->enableModule($row['module_name'], $row);

View File

@ -275,21 +275,27 @@ $(document).ready (function () {
$('#configure_field-3').show();
dialog_message("#message_no_set_password");
$('#configure_field-1').hide();
$('#configure_field-2-0').hide();
}
else{
$('#configure_field-3').hide();
$('#configure_field-1').show();
$('#configure_field-2-0').show();
}
});
$('input[type=checkbox][name=is_password_type]').change(function () {
if( $('input[type=checkbox][name=is_password_type]').prop('checked')){
$('#configure_field-1').hide();
dialog_message("#message_no_set_combo");
$('#configure_field-3').hide();
$('#configure_field-2-1').hide();
}
else{
if($('input[type=checkbox][name=is_combo_enable]').prop('checked') === true) {
$('#configure_field-3').show();
}
$('#configure_field-1').show();
$('#configure_field-2-1').show();
}
});
});

View File

@ -131,9 +131,13 @@ if ($add_inventory_module) {
}
}
// Load inventory module data for updating
// Load inventory module data for updating.
if ($load_inventory_module) {
$sql = 'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = '.$load_inventory_module;
$sql = sprintf(
'SELECT * FROM tagent_module_inventory WHERE id_module_inventory = %s AND id_agente = %d',
$load_inventory_module,
$id_agente
);
$row = db_get_row_sql($sql);
if (!empty($row)) {

View File

@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
$search_string_entities = io_safe_input($search_string);
$basic_where = sprintf(
"(REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%') AND",
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
$search_string,
$search_string_entities,
$search_string,

View File

@ -150,7 +150,7 @@ if (is_ajax()) {
$component = db_get_row('tlocal_component', 'id', $id_component);
foreach ($component as $index => $element) {
$component[$index] = html_entity_decode(
$element,
(isset($element) === true) ? $element : '',
ENT_QUOTES,
'UTF-8'
);

View File

@ -505,7 +505,7 @@ $tableBasicThresholds->data['caption_switch_warning_inverse_string'][0] = html_p
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_str_warning">('.__('Str.').')</span>';
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
'str_warning',
str_replace('"', '', $str_warning),
str_replace('"', '', (isset($str_warning) === true) ? $str_warning : ''),
'',
10,
1024,
@ -602,7 +602,7 @@ $tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div(
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_str_critical">('.__('Str.').')</span>';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'str_critical',
str_replace('"', '', $str_critical),
str_replace('"', '', (isset($str_critical) === true) ? $str_critical : ''),
'',
10,
1024,
@ -1131,13 +1131,13 @@ if (isset($id_agente) === true && (int) $moduletype === MODULE_DATA) {
$tableCron->data['cron_to_select'][0] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
}
$table_advanced->rowclass['cron_section'] = 'table_section full_section';
$table_advanced->rowclass['cron_section'] = 'table_section full_section mrgn_top_mod_0px';
$table_advanced->data['cron_section'] = html_print_table($tableCron, true);
$table_advanced->data['title_3'] = html_print_subtitle_table(__('Thresholds and state changes'));
$table_advanced->rowclass['caption_min_max_values'] = 'w50p pdd_t_10px';
$table_advanced->rowclass['min_max_values'] = 'w50p';
$table_advanced->rowclass['min_max_values'] = 'w50p pdd_b_10px';
$table_advanced->data['caption_min_max_values'][0] = __('Min. Value');
$table_advanced->data['caption_min_max_values'][1] = __('Max. Value');
@ -1214,7 +1214,7 @@ $tableDynamicThreshold->data['adv_dynamic_threshold_twotailed'][0] = html_print_
$disabledBecauseInPolicy
);
$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section';
$table_advanced->rowclass['dynamic_threshold_table'] = 'table_section full_section mrgn_top_mod_0px';
$table_advanced->data['dynamic_threshold_table'] = html_print_table($tableDynamicThreshold, true);
$tableFFThreshold = new stdClass();
@ -1304,10 +1304,15 @@ $tableFFThreshold->data['ff_thresholds_each'][2] = html_print_input_text(
$classdisabledBecauseInPolicy
);
$table_advanced->rowclass['gap_flipflop'] = 'mrgn_top_btn_10px_imp';
$table_advanced->data['gap_flipflop'] = html_print_input_hidden('gap_flipflop', 0);
$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section';
$table_advanced->rowclass['flipflop_thresholds_table'] = 'table_section full_section mrgn_top_mod_0px';
$table_advanced->data['flipflop_thresholds_table'] = html_print_table($tableFFThreshold, true);
$table_advanced->rowclass['gap_ff'] = 'mrgn_top_btn_10px_imp';
$table_advanced->data['gap_ff'] = html_print_input_hidden('gap_ff', 0);
$table_advanced->rowclass['caption_ff_interval_timeout'] = 'w50p';
$table_advanced->rowclass['ff_interval_timeout'] = 'w50p';
$table_advanced->cellclass['caption_ff_interval_timeout'][0] = 'w50p';

View File

@ -60,7 +60,12 @@ $data[1] = html_print_select_from_sql(
$disabledBecauseInPolicy
);
// Store the macros in base64 into a hidden control to move between pages
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
$data[1] .= html_print_input_hidden(
'macros',
(isset($macros) === true) ? base64_encode($macros) : '',
true
);
$table_simple->colspan['plugin_1'][2] = 2;
if (!empty($id_plugin)) {

View File

@ -497,7 +497,12 @@ foreach ($actions as $action) {
$pagination = '';
if (isset($data)) {
html_print_table($table);
$pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', false, '');
$show_count = false;
if (is_metaconsole() === true) {
$show_count = true;
}
$pagination = ui_pagination($total_actions, $url, 0, 0, true, 'offset', $show_count, '');
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
}

View File

@ -1080,7 +1080,12 @@ foreach ($commands as $command) {
if (isset($data) === true && count($table->data) > 0) {
html_print_table($table);
$pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, '');
$show_count = false;
if (is_metaconsole() === true) {
$show_count = true;
}
$pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', $show_count, '');
} else {
ui_print_info_message(
[

View File

@ -493,6 +493,11 @@ foreach ($templates as $template) {
$pagination = '';
if (isset($data) === true) {
$show_count = false;
if (is_metaconsole() === true) {
$show_count = true;
}
html_print_table($table);
$pagination = ui_pagination(
$total_templates,
@ -501,7 +506,7 @@ if (isset($data) === true) {
0,
true,
'offset',
false,
$show_count,
''
);
} else {

View File

@ -308,13 +308,18 @@ $table->head[0] = __('Actions');
$table->style[0] = 'font-weight: bold; text-align: left;';
if (count($actions) == 1 && isset($actions[0])) {
$table->head[1] = __('Every time that the alert is fired');
$table->data[0][0] = $actions[0]['name'];
$table->data[0][1] = html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
if (!empty($actions[0]['name'])) {
$table->head[1] = __('Every time that the alert is fired');
$table->data[0][0] = $actions[0]['name'];
$table->data[0][1] = html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
} else {
$table->colspan[0] = 2;
$table->data[0] = __('No action defined.');
}
} else {
foreach ($actions as $kaction => $action) {
$table->data[$kaction][0] = $action['name'];

View File

@ -88,7 +88,17 @@ if ($multiple_delete) {
['id_filter' => $id]
);
if ($result === false) {
if ($result !== false) {
db_process_sql_delete(
'tfavmenu_user',
[
'id_element' => $id,
'section' => 'Events',
'id_user' => $config['id_user'],
]
);
$result = true;
} else {
break;
}
}
@ -210,7 +220,7 @@ foreach ($filters as $filter) {
true,
[
'title' => __('Delete'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
).'</a>';
}

View File

@ -285,20 +285,25 @@ if (enterprise_installed()) {
$data = [];
$data[0] = html_print_label_input_block(
'<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
'<div id="server_to_exec_value" class="invisible" >'.html_print_select(
'<div id="server_to_exec_value" class="w100p margin-top-10 invisible" >'.html_print_select(
$servers_to_exec,
'server_to_exec',
$event_response['server_to_exec'],
'',
'',
'',
true
true,
false,
true,
'w100p',
false,
'width: 100%'
).'</div>'
);
$data[1] = html_print_label_input_block(
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
'<div id="command_timeout_value" class="invisible">'.html_print_input_text(
'<div id="command_timeout_value" class=" w100p margin-top-10 invisible">'.html_print_input_text(
'command_timeout',
$event_response['command_timeout'],
'',
@ -358,18 +363,18 @@ $('#type').change(function() {
$('#new_window option[value="0"]')
.prop('selected', true);
$('#new_window').attr('disabled','disabled');
$('#server_to_exec_label').css('display','');
$('#server_to_exec_value').css('display','');
$('#command_timeout_label').css('display','');
$('#command_timeout_value').css('display','');
$('#server_to_exec_label').show();
$('#server_to_exec_value').show();
$('#command_timeout_label').show();
$('#command_timeout_value').show();
break;
case 'url':
$('#new_window').removeAttr('disabled');
$('#server_to_exec_label').css('display','none');
$('#server_to_exec_value').css('display','none');
$('#command_timeout_label').css('display','none');
$('#command_timeout_value').css('display','none');
$('#server_to_exec_label').hide();
$('#server_to_exec_value').hide();
$('#command_timeout_label').hide();
$('#command_timeout_value').hide();
break;
}

View File

@ -15,7 +15,7 @@ check_login();
global $config;
if (! check_acl($config['id_user'], 0, 'PM')) {
if (users_is_admin($config['id_user']) === false) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access extensions list'

View File

@ -68,7 +68,7 @@ foreach ($layer_ids as $layer_id) {
$layer_list[] = [
'id' => (strpos($layer_id, 'new_') === false) ? (int) $layer_id : null,
'layer_name' => $trimmed_name,
'layer_visible' => ($layers[$layer_id]['visible'] === 'true'),
'layer_visible' => ($layers[$layer_id]['visible'] == 'true' || $layers[$layer_id]['visible'] === '1'),
'layer_group' => (int) $layers[$layer_id]['agents_from_group'],
'layer_agent_list' => $layers[$layer_id]['agents'],
'layer_group_list' => $layers[$layer_id]['groups'],
@ -562,8 +562,6 @@ $table->data[9][1] = html_print_input_text('map_default_altitude', $map_default_
html_print_table($table);
$user_groups = users_get_groups($config['user'], 'AR', false);
echo '<fieldset class="margin-bottom-10"><legend>'.__('Layers').'</legend>';
$table->width = '100%';
@ -589,7 +587,7 @@ $table->data[1][0] = '<div id="form_layer" class="invisible">
</tr>
<tr>
<td>'.__('Show agents from group').':</td>
<td colspan="3">'.html_print_select($user_groups, 'layer_group_form', '-1', '', __('none'), '-1', true).'</td>
<td colspan="3">'.html_print_select_groups($config['id_user'], 'AR', true, 'layer_group_form', '', '', __('none'), '-1', true).'</td>
</tr>
<tr>
<td colspan="4"><hr /></td>
@ -923,11 +921,25 @@ function setLayerEditorData (data) {
var $layerFormAgentsListItems = $("tr.agents_list_item");
var $layerFormGroupsListItems = $("tr.groups_list_item");
$.ajax({
url: 'ajax.php',
data: {
page: 'operation/gis_maps/ajax',
opt: 'get_group_name',
id_group: data.agentsFromGroup
},
type: 'POST',
async: false,
dataType: 'json',
success: function (name) {
var newOption = new Option(name, data.agentsFromGroup, true, true);
$layerFormAgentsFromGroupSelect.append(newOption).trigger('change');
},
});
$layerFormIdInput.val(data.id);
$layerFormNameInput.val(data.name);
$layerFormVisibleCheckbox.prop("checked", data.visible);
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected');
$(`#layer_group_form`).trigger('change');
$layerFormAgentInput.val("");
$layerFormAgentButton.prop("disabled", true);
$layerFormAgentsListItems.remove();

View File

@ -46,6 +46,7 @@ require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_massive_operations.php';
enterprise_include_once('include/functions_agents.php');
/**
@ -71,12 +72,15 @@ function process_manage_delete($id_agents)
$array_id = explode('|', $id_agent);
try {
$node = new Node((int) $array_id[0]);
$node->connect();
$agent = new Agent((int) $array_id[1]);
$success = $agent->delete();
$node->disconnect();
$api_call_delete = $node->callApi(
'delete_agent',
'set',
(int) $array_id[1],
null,
['2'],
null,
true
);
$success = agent_delete_from_metaconsole(
$array_id[1],

View File

@ -319,9 +319,8 @@ if ($update_agents) {
$secondary_groups_removed
);
$agents_values = agents_get_agent((int) $array_id[1]);
$agents_values = db_get_row_filter('tagente', ['id_agente' => (int) $array_id[1]]);
$node->disconnect();
if (empty($values) === false) {
update_agents_in_metaconsole(
(int) $array_id[1],

View File

@ -768,7 +768,7 @@ $table_critical->tdid[0][0] = 'edit1-3-min';
$table_critical->data[0][0] = html_print_label_input_block(
__('Min.'),
html_print_input_text(
'min_warning',
'min_critical',
'',
'',
false,
@ -781,7 +781,7 @@ $table_critical->tdid[0][1] = 'edit1-3-max';
$table_critical->data[0][1] = html_print_label_input_block(
__('Max.'),
html_print_input_text(
'max_warning',
'max_critical',
'',
'',
false,
@ -1500,7 +1500,7 @@ $table->data[39][0] = html_print_label_input_block(
'',
'',
true
).html_print_input_hidden('macros', base64_encode($macros), true)
).html_print_input_hidden('macros', base64_encode(($macros ?? '')), true)
);
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
@ -1529,7 +1529,7 @@ $array_os = [
'windows' => __('Windows'),
];
$table->data[40][0] = html_print_label_input_block(
__('rget OS'),
__('Target OS'),
html_print_select(
$array_os,
'custom_string_2',

View File

@ -518,7 +518,18 @@ if ($access_console_node === true) {
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
}
}
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) {
$menu_godmode['gextensions']['text'] = __('Admin tools');
$menu_godmode['gextensions']['sec2'] = 'godmode/extensions';
$menu_godmode['gextensions']['id'] = 'god-extensions';
@ -535,8 +546,6 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
$sub['tools/diagnostics']['id'] = 'diagnostic_info';
enterprise_hook('omnishell');
enterprise_hook('ipam_submenu');
$sub['godmode/setup/news']['text'] = __('Site news');
$sub['godmode/setup/news']['id'] = 'site_news';
}
@ -558,9 +567,15 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
}
}
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
if (((bool) check_acl($config['id_user'], 0, 'PM') === true && $access_console_node === true) || $show_ipam === true) {
enterprise_hook('ipam_submenu');
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
}
$menu_godmode['gextensions']['sub'] = $sub;
}
@ -638,16 +653,18 @@ if ($access_console_node === true) {
}
// Complete the submenu.
$extension_view = [];
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
$extension_submenu = array_merge($extension_view, $sub2);
if (users_is_admin($config['id_user']) === true) {
$extension_view = [];
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
$extension_submenu = array_merge($extension_view, $sub2);
$sub['godmode/extensions']['sub2'] = $extension_submenu;
$sub['godmode/extensions']['text'] = __('Extension manager');
$sub['godmode/extensions']['id'] = 'extension_manager';
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
$sub['godmode/extensions']['sub2'] = $extension_submenu;
$sub['godmode/extensions']['text'] = __('Extension manager');
$sub['godmode/extensions']['id'] = 'extension_manager';
$sub['godmode/extensions']['type'] = 'direct';
$sub['godmode/extensions']['subtype'] = 'nolink';
}
if (is_array($menu_godmode['gextensions']['sub']) === true) {
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
@ -770,11 +787,14 @@ $("#conf_wizard").click(function() {
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
ok: '<?php echo __('Close wizard'); ?>',
overlay: true,
overlayExtraClass: 'welcome-overlay',
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
width: 1000,
},
oncancel: {
page: 'include/ajax/welcome_window',
@ -792,6 +812,34 @@ $("#conf_wizard").click(function() {
}
})
}
},
onload: () => {
$(document).ready(function () {
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
$(buttonpane).append(`
<div class="welcome-wizard-buttons">
<label>
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
<?php echo __('Do not show anymore'); ?>
</label>
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
</div>
`);
var closeWizard = $("button.close-wizard-button");
$(closeWizard).click(function (e) {
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
if (checkbox === 1) {
$(cancel).click();
} else {
$(close).click()
}
});
});
}
});
});

View File

@ -394,11 +394,11 @@ html_print_action_buttons(
$('[id^=checkbox-all_delete]').change(function(){
if ($("#checkbox-all_delete").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
$(".check_delete").prop("checked", true);
$(".custom_checkbox_input").prop("checked", true);
}
else{
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
$(".check_delete").prop("checked", false);
$(".custom_checkbox_input").prop("checked", false);
}
});
});

View File

@ -30,7 +30,7 @@ if (!$report_w && !$report_m) {
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_groups.php';
ui_require_css_file('custom_graph');
$editGraph = (bool) get_parameter('edit_graph', 0);
$action = get_parameter('action', '');
@ -41,113 +41,6 @@ if (isset($_GET['get_agent'])) {
}
}
switch ($action) {
case 'sort_items':
$resultOperationDB = null;
$position_to_sort = (int) get_parameter('position_to_sort', 1);
$ids_serialize = (string) get_parameter('ids_items_to_sort', '');
$move_to = (string) get_parameter('move_to', 'after');
$countItems = db_get_sql(
'
SELECT COUNT(id_gs)
FROM tgraph_source
WHERE id_graph = '.$id_graph
);
if (($countItems < $position_to_sort) || ($position_to_sort < 1)) {
$resultOperationDB = false;
} else if (!empty($ids_serialize)) {
$ids = explode('|', $ids_serialize);
$items = db_get_all_rows_sql(
'SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
if ($items === false) {
$items = [];
}
// Clean the repeated order values.
$order_temp = 1;
foreach ($items as $item) {
db_process_sql_update(
'tgraph_source',
['`field_order`' => $order_temp],
['id_gs' => $item['id_rc']]
);
$order_temp++;
}
$items = db_get_all_rows_sql(
'SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
if ($items === false) {
$items = [];
}
$temp = [];
$temp = [];
foreach ($items as $item) {
// Remove the contents from the block to sort.
if (array_search($item['id_gs'], $ids) === false) {
$temp[$item['field_order']] = $item['id_gs'];
}
}
$items = $temp;
$sorted_items = [];
foreach ($items as $pos => $id_unsort) {
if ($pos == $position_to_sort) {
if ($move_to == 'after') {
$sorted_items[] = $id_unsort;
}
foreach ($ids as $id) {
$sorted_items[] = $id;
}
if ($move_to != 'after') {
$sorted_items[] = $id_unsort;
}
} else {
$sorted_items[] = $id_unsort;
}
}
$items = $sorted_items;
foreach ($items as $order => $id) {
db_process_sql_update(
'tgraph_source',
['`field_order`' => ($order + 1)],
['id_gs' => $id]
);
}
$resultOperationDB = true;
} else {
$resultOperationDB = false;
}
break;
}
if ($editGraph) {
$graphRows = db_get_all_rows_sql(
'SELECT t1.*,
@ -257,41 +150,6 @@ $table->data[0][1] = html_print_label_input_block(
);
$SortItems = "<form action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=".$id_graph."' method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
$SortItems .= html_print_table($table, true);
$SortItems .= html_print_input_hidden('action', 'sort_items', true);
$SortItems .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Sort'),
'srcbutton',
false,
[
'class' => 'mini',
'icon' => 'search',
'mode' => 'secondary',
],
true
),
],
true
);
$SortItems .= '</form>';
ui_toggle(
$SortItems,
'<span class="subsection_header_title">'.__('Sort items').'</span>',
'',
'',
false,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph max_floating_element_size'
);
// Configuration form.
echo '<span id ="none_text" class="invisible">'.__('None').'</span>';
echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
@ -300,10 +158,11 @@ echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters
echo '<tr>';
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
[
'type' => 'select_multiple_modules_filtered',
'uniqId' => 'modules',
'class' => 'flex flex-row',
'searchBar' => true,
'type' => 'select_multiple_modules_filtered',
'uniqId' => 'modules',
'class' => 'flex flex-row',
'searchBar' => false,
'placeholderAgents' => __('Search agent name'),
]
).'</td>';
echo '</tr><tr>';
@ -340,6 +199,7 @@ echo '</form>';
// Modules table.
if ($count_module_array > 0) {
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters info_table'>";
echo '<thead>';
echo '<tr>
<th>'.__('P.').'</th>
<th>'.__('Agent').'</th>
@ -348,6 +208,8 @@ if ($count_module_array > 0) {
<th>'.__('Weight').'</th>
<th>'.__('Delete').'</th>
<th>'.__('Sort').'</th>';
echo '</thead>';
echo '<tbody>';
$color = 0;
for ($a = 0; $a < $count_module_array; $a++) {
// Calculate table line color.
@ -359,7 +221,7 @@ if ($count_module_array > 0) {
$color = 1;
}
echo "<tr><td class='$tdcolor'>$position_array[$a]</td>";
echo "<tr><td class='position $tdcolor'>$position_array[$a]</td>";
echo "<td class='$tdcolor'>".$agent_array[$a].'</td>';
echo "<td class='$tdcolor'>";
echo modules_get_agentmodule_name($module_array[$a]).'</td>';
@ -410,9 +272,30 @@ if ($count_module_array > 0) {
echo '</td>';
echo '<td>';
echo '<td style="display: grid;">';
echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true);
echo html_print_input_image(
'up',
'images/arrow-up-white.png',
'up',
($config['style'] !== 'pandora_black') ? 'filter: invert(100%)' : '',
true,
[
'class' => 'invert_filter main_menu_icon',
'onclick' => 'reorder(\'up\', \''.$idgs_array[$a].'\', this)',
],
);
echo html_print_input_image(
'down',
'images/arrow-down-white.png',
'down',
($config['style'] !== 'pandora_black') ? 'filter: invert(100%)' : '',
true,
[
'class' => 'invert_filter main_menu_icon',
'onclick' => 'reorder(\'down\', \''.$idgs_array[$a].'\', this)',
]
);
echo '</td>';
@ -420,6 +303,8 @@ if ($count_module_array > 0) {
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
@ -464,7 +349,7 @@ function added_ids_sorted_items_to_hidden_input() {
var ids = '';
var first = true;
$("input.selected_check:checked").each(function(i, val) {
$("input.custom_checkbox_input:checked").each(function(i, val) {
if (!first)
ids = ids + '|';
first = false;
@ -482,4 +367,65 @@ function added_ids_sorted_items_to_hidden_input() {
return true;
}
}
function reorder(action, idElement, element) {
var tr = $(element).parent().parent();
switch (action) {
case "up":
changePosition(action, idElement)
.then((data) => {
if(data.success) {
$(tr).find('.position').html(parseInt($(tr).find('.position').html()) - 1);
$($(tr).prev()).find('.position').html(parseInt($($(tr).prev()).find('.position').html()) + 1);
$(tr).prev().insertAfter(tr);
}
})
.catch((err) => {
console.log(err);
})
break;
case "down":
changePosition(action, idElement)
.then((data) => {
if(data.success) {
$(tr).find('.position').html(parseInt($(tr).find('.position').html()) + 1);
$($(tr).next()).find('.position').html(parseInt(($(tr).next()).find('.position').html()) - 1);
$(tr).next().insertBefore(tr);
}
})
.catch((err) => {
console.log(err);
})
break;
default:
break;
}
}
function changePosition(order, idElement) {
return new Promise(function(resolve, reject) {
$.ajax({
method: "POST",
url: "<?php echo ui_get_full_url('ajax.php'); ?>",
dataType: "json",
data: {
page: "include/ajax/graph.ajax",
sort_items: 1,
order,
id_graph: <?php echo $id_graph; ?>,
id: idElement
},
success: function(data) {
resolve(data);
},
error: function(error) {
reject(error);
}
});
});
}
</script>

View File

@ -247,7 +247,7 @@ if ($add_module === true) {
$id_agent_modules = db_get_all_rows_sql($sql);
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
if (is_array($id_agent_modules) === true && count($id_agent_modules) > 0 && $id_agent_modules != '') {
$sql_order = sprintf(
'SELECT `field_order`
FROM tgraph_source

View File

@ -250,6 +250,12 @@ if ($delete_layout || $copy_layout) {
$result = db_process_sql_insert('tlayout', $values);
$auditMessage = ((bool) $result !== false) ? 'Copy visual console' : 'Fail try to copy visual console';
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('%s %s #%s', $auditMessage, $visualConsoleName, $id_layout)
);
$idNewVisualConsole = $result;
if ($result) {

View File

@ -1058,7 +1058,11 @@ switch ($action) {
$resolution = $item['top_n'];
// Interval resolution.
$max_values = $item['top_n_value'];
// Max values.
$es = json_decode($item['external_source'], true);
$top_n_type = $es['top_n_type'];
$display_graph = $es['display_graph'];
$display_summary = $es['display_summary'];
$display_data_table = $es['display_data_table'];
break;
case 'permissions_report':
@ -1703,6 +1707,75 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_top_n_type" class="datos">
<td class="bolder"><?php echo __('Type'); ?></td>
<td >
<?php
$types = [
0 => __('Show aggregate by destination port'),
1 => __('Show InBound/Outbound traffic per SrcIP/DestIP'),
];
html_print_select(
$types,
'top_n_type',
$top_n_type,
''
);
?>
</td>
</tr>
<tr id="row_display_graph" class="datos">
<td class="bolder">
<?php
echo __('Display graph');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_graph',
1,
($display_graph ?? true)
);
?>
</td>
</tr>
<tr id="row_display_summary_table" class="datos">
<td class="bolder">
<?php
echo __('Display summary table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_summary',
1,
($display_summary ?? true)
);
?>
</td>
</tr>
<tr id="row_display_data_table" class="datos">
<td class="bolder">
<?php
echo __('Display data table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_data_table',
1,
($display_data_table ?? true)
);
?>
</td>
</tr>
<tr id="row_period_service_level" class="datos">
<td class="bolder">
<?php
@ -7420,6 +7493,10 @@ function chooseType() {
$("#row_alert_templates").hide();
$("#row_alert_actions").hide();
$("#row_servers").hide();
$("#row_top_n_type").hide();
$("#row_display_graph").hide();
$("#row_display_summary_table").hide();
$("#row_display_data_table").hide();
$("#row_servers_all_opt").hide();
$("#row_servers_all").hide();
$("#row_multiple_servers").hide();
@ -8374,6 +8451,10 @@ function chooseType() {
$("#row_max_values").show();
$("#row_resolution").show();
$("#row_servers").show();
$("#row_top_n_type").show();
$("#row_display_graph").show();
$("#row_display_summary_table").show();
$("#row_display_data_table").show();
$("#row_historical_db_check").hide();
break;

View File

@ -626,7 +626,7 @@ switch ($action) {
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $report['name'], $idReport)
);
ui_print_result_message(
@ -1259,6 +1259,10 @@ switch ($action) {
$reports_table .= html_print_table($table, true);
$reports_table .= '<br></div>';
echo $reports_table;
$show_count = false;
if (is_metaconsole() === true) {
$show_count = true;
}
$tablePagination = ui_pagination(
$total_reports,
@ -1267,7 +1271,7 @@ switch ($action) {
$pagination,
true,
'offset',
false
$show_count
);
} else {
ui_print_info_message(
@ -1461,7 +1465,7 @@ switch ($action) {
$auditMessage = ($resultOperationDB === true) ? 'Update report' : 'Fail try to update report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $new_values['name'], $idReport),
);
} else {
$resultOperationDB = false;
@ -1513,7 +1517,7 @@ switch ($action) {
]
);
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report #%s', $idOrResult) : 'Fail try to create report';
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report %s #%s', $reportName, $idOrResult) : 'Fail try to create report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessage
@ -1874,6 +1878,13 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;
@ -2958,6 +2969,12 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;

View File

@ -300,7 +300,7 @@ switch ($activeTab) {
ui_update_name_fav_element($idVisualConsole, 'Visual_Console', $values['name']);
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Update visual console #%s', $idVisualConsole)
sprintf('Update visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -320,7 +320,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Fail update visual console #%s', $idVisualConsole)
sprintf('Fail update visual console %s #%s', $values['name'], $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,
@ -339,7 +339,7 @@ switch ($activeTab) {
if ($idVisualConsole !== false) {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Create visual console #%s', $idVisualConsole)
sprintf('Create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -359,7 +359,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
'Fail try to create visual console'
sprintf('Fail try to create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,

View File

@ -247,7 +247,7 @@ if ($favorite_array == false) {
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$favourite_v['id'];
}
echo "<a href='".$url."' title='Visual console".$favourite_v['name']."' alt='".$favourite_v['name']."'><li>";
echo "<a href='".$url."' title='".io_safe_output($favourite_v['name'])."' alt='".io_safe_output($favourite_v['name'])."'><li>";
echo "<div class='icon_img'>";
echo html_print_image(
'images/'.groups_get_icon($favourite_v['id_group']),
@ -256,7 +256,7 @@ if ($favorite_array == false) {
);
echo '</div>';
echo "<div class='text'>";
echo $favourite_v['name'];
echo io_safe_output($favourite_v['name']);
echo '</div>';
echo '</li></a>';
}

View File

@ -521,7 +521,7 @@ $(document).ready (function () {
function (data) {
$(".white-box-content").html(data);
$("#submit-add").click(function (e) {
$("#button-add").click(function (e) {
add_credential_boxes();
});
@ -550,7 +550,7 @@ $(document).ready (function () {
$(".white-box-content").html(data2);
// Insert credential
$("#submit-add").click(function (e) {
$("#button-add").click(function (e) {
save_credential_boxes();
})
},
@ -609,7 +609,7 @@ $(document).ready (function () {
function (data) {
$(".white-box-content").html(data);
$("#submit-update").click(function (e) {
$("#button-update").click(function (e) {
update_credential_boxes(datas);
});
},

View File

@ -215,7 +215,7 @@ if ($create != '') {
// =====================================================================
if ($filemanager) {
if ($edit_file) {
$location_file = get_parameter('location_file', '');
$location_file = io_safe_output(get_parameter('location_file', ''));
$filename = array_pop(explode('/', $location_file));
$file = file_get_contents($location_file);
echo '<h4>'.__('Edit file').' '.$filename.'</h4>';
@ -250,7 +250,7 @@ if ($filemanager) {
echo '</form>';
} else {
if ($update_file) {
$location_file = get_parameter('location_file', '');
$location_file = io_safe_output(get_parameter('location_file', ''));
$contentFile = io_safe_output(get_parameter('content_file', ''));
$compatibility = get_parameter('compatibility', 'unix');
$is_win_compatible = strpos($contentFile, "\r\n");
@ -262,7 +262,12 @@ if ($filemanager) {
$contentFile = str_replace("\n", "\r\n", $contentFile);
}
$result = file_put_contents($location_file, $contentFile);
if (empty($location_file) === false
&& strpos($location_file, realpath('attachment/plugin')) !== false
&& file_exists($location_file) === true
) {
$result = file_put_contents($location_file, $contentFile);
}
}
$id_plugin = (int) get_parameter('id_plugin', 0);

View File

@ -115,7 +115,7 @@ foreach ($servers as $server) {
$table->cellclass[] = [
3 => 'progress_bar',
8 => 'table_action_buttons',
9 => 'table_action_buttons',
];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';

View File

@ -48,7 +48,7 @@ if ($idOS > 0) {
} else {
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$icon = get_parameter('icon', 'os@svg.svg');
}
$icon_upload = get_parameter('icon_upload', null);
@ -246,7 +246,7 @@ $iconData[] = html_print_select(
'icon',
$icon,
'show_icon_OS();',
__('None'),
'',
0,
true
);
@ -356,6 +356,8 @@ function get_list_os_icons_dir()
}
}
$return['os@svg.svg'] = __('None');
return $return;
}

View File

@ -88,6 +88,14 @@ switch ($tab) {
break;
case 'manage_os':
$id_os = get_parameter('id_os', '');
if ($id_os !== '') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('Create OS');
}
break;
case 'list':
if ($action === 'edit') {
$headerTitle = __('Edit OS');

View File

@ -559,7 +559,7 @@ $table_cr_settings->data[4][0] = html_print_label_input_block(
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/itsm/">';
html_print_image(
'images/pandoraITSM_logo.png',
false,
@ -570,8 +570,8 @@ echo '<br />';
echo '<div class="ITSM_title">';
echo __('Pandora ITSM');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
echo 'https://pandorafms.com/es/itsm/';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/itsm/">';
echo 'https://pandorafms.com/itsm/';
echo '</a>';
echo '</div>';

View File

@ -527,9 +527,12 @@ $table->data[$i++][] = html_print_label_input_block(
true
)
);
$help_tip = ui_print_help_tip(
__('No events or alerts will be generated, but data will still be received.'),
true
);
$table->data[$i][] = html_print_label_input_block(
__('Event storm protection'),
__('Event storm protection').$help_tip,
html_print_checkbox_switch(
'event_storm_protection',
1,
@ -957,60 +960,6 @@ echo '<legend>'.__('Mail configuration').'</legend>';
);
echo '</form>';
/**
* Print the modal window for the summary of each alerts group
*
* @param string $id Id.
*
* @return void
*/
function print_email_test_modal_window($id)
{
// Email config table.
$table_mail_test = new stdClass();
$table_mail_test->width = '100%';
$table_mail_test->class = 'filter-table-adv';
$table_mail_test->data = [];
$table_mail_test->data[0][] = html_print_label_input_block(
__('Address'),
html_print_input_text(
'email_test_address',
'',
'',
35,
100,
true
)
);
$table_mail_test->data[1][] = '&nbsp&nbsp<span id="email_test_sent_message" class="invisible"><b>Email sent</b></span><span id="email_test_failure_message" class=invisible"><b>Email could not be sent</b></span>';
// $table_mail_test->colspan[2][0] = 2;
$submitButton = html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_button(
__('Send'),
'email_test',
false,
'',
[
'icon' => 'cog',
'mode' => 'mini',
],
true
),
],
true
);
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>';
}
?>
<script type="text/javascript">
function show_timezone () {
@ -1030,62 +979,6 @@ function show_timezone () {
});
}
function show_email_test(id) {
$('#email_test_sent_message').hide();
$('#email_test_failure_message').hide();
$("#email_test_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
width: 450,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
function perform_email_test () {
$('#email_test_sent_message').hide();
$('#email_test_failure_message').hide();
var test_address = $('#text-email_test_address').val();
params = {
email_smtpServer : $('#text-email_smtpServer').val(),
email_smtpPort : $('#text-email_smtpPort').val(),
email_username : $('#text-email_username').val(),
email_password : $('#password-email_password').val(),
email_encryption : $( "#email_encryption option:selected" ).val(),
email_from_dir : $('#text-email_from_dir').val(),
email_from_name : $('#text-email_from_name').val()
};
$.ajax({
type: "POST",
url: "ajax.php",
data : {
page: "godmode/setup/setup_general",
test_address: test_address,
params: params
},
dataType: "json",
success: function(data) {
if (parseInt(data) === 1) {
$('#email_test_sent_message').show();
$('#email_test_failure_message').hide();
} else {
$('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
}
},
error: function() {
$('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
},
});
}
$(document).ready (function () {
$("#zone").attr("hidden", true);
@ -1143,8 +1036,6 @@ $(document).ready (function () {
}
})
$('#button-email_test').click(perform_email_test);
$("#right_iblacklist").click (function () {
jQuery.each($("select[name='inventory_changes_blacklist_out[]'] option:selected"), function (key, value) {
imodule_name = $(value).html();

View File

@ -83,6 +83,23 @@ $table->data[3][] = html_print_label_input_block(
html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true)
);
$table->data[4][] = html_print_label_input_block(
__('Netflow interval').ui_print_help_tip(__('It is necessary to restart the server if the value is changed.'), true),
html_print_select(
[
'600' => __('10 min'),
'1800' => __('30 min'),
'3600' => __('60 min'),
],
'netflow_interval',
$config['netflow_interval'],
'',
'',
0,
true
)
);
$table->data[4][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(

View File

@ -386,7 +386,7 @@ if (empty($result) === false) {
$data[4] = $output;
$phone_large = io_safe_output($tag['phone']);
$phone_small = substr($phone_large, 0, 24);
$phone_small = substr(($phone_large ?? ''), 0, 24);
if ($phone_large == $phone_small) {
$output = $phone_large;
} else {

View File

@ -424,10 +424,13 @@ if ($create_user === true) {
$values['data_section'] = $dashboard;
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
$values['data_section'] = $visual_console;
} else if ($values['section'] === HOME_SCREEN_OTHER) {
$values['data_section'] = get_parameter('data_section_other');
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section_external');
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section');
}
if (is_metaconsole() === true) {
$values['metaconsole_section'] = $values['section'];
$values['metaconsole_data_section'] = $values['data_section'];
}
// $values['section'] = $homeScreenValues[$values['section']];
@ -724,10 +727,8 @@ if ($update_user) {
$values['data_section'] = $dashboard;
} else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) {
$values['data_section'] = $visual_console;
} else if ($values['section'] === HOME_SCREEN_OTHER) {
$values['data_section'] = get_parameter('data_section_other');
} else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section_external');
} else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) {
$values['data_section'] = get_parameter('data_section');
}
// $values['section'] = $homeScreenValues[$values['section']];
@ -769,7 +770,7 @@ if ($update_user) {
$id_user = (string) get_parameter('id_user', '');
if ($password_new != '') {
if ($config['auth'] !== 'mysql') {
if ($config['auth'] !== 'mysql' && $values['local_user'] === false) {
ui_print_error_message(__('It is not possible to change the password because external authentication is being used'));
} else {
$correct_password = false;
@ -1556,6 +1557,7 @@ if (empty($doubleAuthElementsContent) === false) {
$autorefresh_list_out = [];
if (is_metaconsole() === false || is_centralized() === true) {
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
$autorefresh_list_out['operation/agentes/ver_agente'] = 'Agent view';
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';
$autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map';
@ -1579,7 +1581,7 @@ $autorefresh_list_out['operation/events/events'] = 'Events';
if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) {
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
$autorefresh_list = json_decode(($select[0]['autorefresh_white_list'] ?? ''));
if ($autorefresh_list === null || $autorefresh_list === 0) {
$autorefresh_list = [];
$autorefresh_list[0] = __('None');

View File

@ -689,7 +689,7 @@ foreach ($info as $user_id => $user_info) {
// User profiles.
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
$user_profiles = db_get_all_rows_sql(
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5'
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'"'
);
} else {
$user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
@ -778,17 +778,25 @@ foreach ($info as $user_id => $user_info) {
if ($user_profiles !== false) {
$total_profile = 0;
$data[4] .= '<div class="text_end">';
$data[4] .= '<div class="flex-column-start">';
foreach ($user_profiles as $row) {
$total_profile++;
if ($total_profile > 5) {
$data[4] .= "<div class='invisible checkhide_".str_replace(' ', '_', io_safe_output($row['id_usuario']))."'>";
}
$data[4] .= "<div class='float-left'>";
$data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / </div>';
$data[4] .= "<div class='float-left pdd_l_5px'>";
$data[4] .= ' / ';
$data[4] .= groups_get_name($row['id_grupo'], true);
$data[4] .= '</div>';
if ($total_profile == 0 && count($user_profiles) >= 5) {
$data[4] .= '<span onclick="showGroups(`'.$row['id_usuario'].'`)">'.html_print_image(
if ($total_profile > 5) {
$data[4] .= '</div>';
}
if ($total_profile == 1 && count($user_profiles) > 5) {
$data[4] .= '<span class="show-profiles" onclick="showGroups(`'.str_replace(' ', '_', io_safe_output($row['id_usuario'])).'`)">'.html_print_image(
'images/zoom.png',
true,
[
@ -803,10 +811,6 @@ foreach ($info as $user_id => $user_info) {
true
);
}
$data[4] .= '<br/>';
$total_profile++;
}
if (isset($user_info['not_delete']) === true) {
@ -1023,8 +1027,13 @@ foreach ($info as $user_id => $user_info) {
array_push($table->data, $data);
}
$show_count = false;
if (is_metaconsole() === true) {
$show_count = true;
}
html_print_table($table);
$tablePagination = ui_pagination(count($info), false, 0, 0, true, 'offset', false, 'dataTables_paginate paging_simple_numbers');
$tablePagination = ui_pagination(count($info), false, 0, 0, true, 'offset', $show_count, 'dataTables_paginate paging_simple_numbers');
unset($table);
if ($is_management_allowed === true) {
if ($config['admin_can_add_user'] !== false) {
@ -1052,43 +1061,13 @@ if ($is_management_allowed === true) {
?>
<script type="text/javascript">
function showGroups(id_user) {
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') {
var request = $.ajax({
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
type: 'GET',
dataType: 'json',
data: {
page: 'godmode/users/user_list',
get_user_profile_group: 1,
id_user: id_user
},
success: function (data, textStatus, xhr) {
let count = 1;
data.forEach( function(valor, indice, array) {
if (count >= 6) {
let main_div = $(`#profiles_${id_user}`);
main_div.append(
`<div id="left_${id_user}_${count}" class='float-left'>${valor.id_perfil} / </div>`,
`<div id="right_${id_user}_${count}" class='float-left pdd_l_5px'>${valor.id_grupo}</div>`,
`<br/><br/>`
);
}
count ++;
});
},
error: function (e, textStatus) {
console.error(textStatus);
}
});
$(`#hidden-show_groups_${id_user}`).val('1');
$(`#profiles_${id_user}`).show();
} else if ($(`#hidden-show_groups_${id_user}`).val() === '1') {
$(`#hidden-show_groups_${id_user}`).val('0');
$(`#profiles_${id_user}`).hide();
} else {
$(`#hidden-show_groups_${id_user}`).val('1');
$(`#profiles_${id_user}`).show();
}
$('.checkhide_'+id_user).each(function(){
if ($(this).hasClass('invisible') === true) {
$(this).removeClass('invisible');
} else {
$(this).addClass('invisible');
}
});
}
</script>

View File

@ -84,8 +84,7 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 400, true);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
@ -118,7 +117,7 @@ $customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
$user_info['data_section'],
'',
60,
255,
999,
true
);
$customHomeScreenDataField = '';
@ -986,7 +985,7 @@ html_print_table($userManagementTable);
$vcard_data = [];
$vcard_data['version'] = '3.0';
$vcard_data['firstName'] = $user_info['fullname'];
$vcard_data['firstName'] = io_safe_output($user_info['fullname']);
$vcard_data['lastName'] = '';
$vcard_data['middleName'] = '';
$vcard_data['workPhone'] = $user_info['phone'];

View File

@ -37,6 +37,20 @@ class Applications extends Wizard
*/
public $mode;
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Class of styles.
*
* @var string
*/
public $class;
/**
* Constructor.

View File

@ -37,6 +37,20 @@ class Custom extends Wizard
*/
public $mode;
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Class of styles.
*
* @var string
*/
public $class;
/**
* Constructor.

View File

@ -47,6 +47,13 @@ ui_require_javascript_file('simTree');
class DiscoveryTaskList extends HTML
{
/**
* Task properties.
*
* @var array
*/
public $task;
/**
* Constructor.

View File

@ -1109,7 +1109,7 @@ class HostDevices extends Wizard
'return' => true,
'selected' => explode(
',',
$this->task['id_network_profile']
(isset($this->task['id_network_profile']) === true) ? $this->task['id_network_profile'] : ''
),
'nothing_value' => 0,
'nothing' => __('None'),

View File

@ -97,6 +97,13 @@ class Wizard
*/
public $access = 'AR';
/**
* Root url.
*
* @var string
*/
public $rootUrl;
/**
* Setter for breadcrum
@ -550,7 +557,7 @@ class Wizard
}
echo '<ul class="bigbuttonlist">';
array_map('self::printBigButtonElement', $list_data);
array_map(['Wizard', 'printBigButtonElement'], $list_data);
echo '</ul>';
if ($return === true) {

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="12px" viewBox="0 0 16 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>F1630B1D-C694-489C-8C8F-E98AF57D4F04</title>
<g id="Welcome-wizard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Pandora-FMS---Welcome-Wizard-2023---1a-Welcome-wizard" transform="translate(-905, -629)" fill="#FFFFFF">
<g id="Popup" transform="translate(460, 200)">
<g id="Content" transform="translate(20, 96)">
<g id="Form" transform="translate(0, 292)">
<g id="Principal-por-defecto" transform="translate(305, 26)">
<g id="Group-2" transform="translate(38, 11)">
<g id="check" transform="translate(82, 4)">
<path d="M6,12 C5.5,12 5,11.8 4.6,11.4 L0.6,7.4 C-0.2,6.6 -0.2,5.4 0.6,4.6 C1.4,3.8 2.7,3.8 3.4,4.6 L6,7.2 L12.6,0.6 C13.4,-0.2 14.6,-0.2 15.4,0.6 C16.2,1.4 16.2,2.6 15.4,3.4 L7.4,11.4 C7,11.8 6.5,12 6,12 Z"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>F911E81E-C05E-4E17-B88A-07CFEEBD0229</title>
<g id="Support" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Pandora-ITSM---Soporte---4d2-Contact-info-popup" transform="translate(-410, -34)">
<g id="Content" transform="translate(10, 10)">
<g id="popup-close" transform="translate(400, 24)">
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
<path d="M2.46745396,2.46745396 C3.09072592,1.84418201 4.10124942,1.84418201 4.72452137,2.46745396 L10,7.743 L15.2754786,2.46745396 C15.8987506,1.84418201 16.9092741,1.84418201 17.532546,2.46745396 C18.1168635,3.05177142 18.1533833,3.97644668 17.6421056,4.60330886 L17.532546,4.72452137 L12.257,10 L17.532546,15.2754786 L17.6421056,15.3966911 C18.1533833,16.0235533 18.1168635,16.9482286 17.532546,17.532546 C16.9092741,18.155818 15.8987506,18.155818 15.2754786,17.532546 L10,12.257 L4.72452137,17.532546 C4.10124942,18.155818 3.09072592,18.155818 2.46745396,17.532546 C1.88313651,16.9482286 1.84661667,16.0235533 2.35789444,15.3966911 L2.46745396,15.2754786 L7.743,10 L2.46745396,4.72452137 L2.35789444,4.60330886 C1.84661667,3.97644668 1.88313651,3.05177142 2.46745396,2.46745396 Z" id="Path-6" fill="#FFFFFF"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon congrats</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#82B92E" offset="0%"></stop>
<stop stop-color="#2EB9A2" offset="100%"></stop>
</linearGradient>
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
</defs>
<g id="Icons/Dark/40/Alert-icon-congrats" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#DBEFBD"></path>
<g id="Status-check" transform="translate(10, 10)">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
<path d="M18.7598238,0.82381606 C19.3047414,0.278898443 20.1882274,0.278898443 20.733145,0.82381606 C21.2562659,1.34693697 21.2771907,2.18208252 20.7959195,2.7301654 L20.733145,2.79713731 L9.36847673,14.1618056 C8.84535581,14.6849265 8.01021026,14.7058513 7.46212738,14.2245801 L7.39515548,14.1618056 L4.74907546,11.5157256 C4.20415784,10.9708079 4.20415784,10.0873219 4.74907546,9.54240432 C5.27219637,9.0192834 6.10734192,8.99835857 6.6554248,9.47962981 L6.72239671,9.54240432 L8.38186047,11.2018605 L18.7598238,0.82381606 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon disable</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#666666" offset="0%"></stop>
<stop stop-color="#999999" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Icons/Dark/40/Alert-icon-disable" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
<g id="Group">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#EAEAEA"></path>
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
</g>
<rect id="Rectangle" fill="#FFFFFF" x="14" y="19" width="12" height="3" rx="1"></rect>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon error</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#F72222" offset="0%"></stop>
<stop stop-color="#E12D81" offset="100%"></stop>
</linearGradient>
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
</defs>
<g id="Icons/Dark/40/Alert-icon-error" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FBDADA"></path>
<g id="Path" transform="translate(10, 10)">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
<path d="M8.29983345,6.3436419 L8.36636552,6.40600414 L10.0000673,8.03953994 L11.6336345,6.40600414 C12.1749733,5.86466529 13.052657,5.86466529 13.5939959,6.40600414 C14.1136812,6.92568943 14.1344686,7.75535013 13.6563581,8.29983345 L13.5939959,8.36636552 L11.9605948,10.0000673 L13.5939959,11.6336345 C14.1353347,12.1749733 14.1353347,13.052657 13.5939959,13.5939959 C13.0743106,14.1136812 12.2446499,14.1344686 11.7001665,13.6563581 L11.6336345,13.5939959 L10.0000673,11.9605948 L8.36636552,13.5939959 C7.82502667,14.1353347 6.94734298,14.1353347 6.40600414,13.5939959 C5.88631884,13.0743106 5.86553143,12.2446499 6.3436419,11.7001665 L6.40600414,11.6336345 L8.03953994,10.0000673 L6.40600414,8.36636552 C5.86466529,7.82502667 5.86466529,6.94734298 6.40600414,6.40600414 C6.90403588,5.9079724 7.68674989,5.86812986 8.23033079,6.28647652 L8.29983345,6.3436419 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon favorite</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#814CCB" offset="0%"></stop>
<stop stop-color="#B66BD9" offset="100%"></stop>
</linearGradient>
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
</defs>
<g id="Icons/Dark/40/Alert-icon-favorite" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
<g id="Status-check" transform="translate(10, 10)">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
<path d="M14.2568899,6.39303483 C13.7790757,5.7960199 13.0840733,5.44776119 12.3890709,5.39800995 L12.3021956,5.39800995 C11.4334425,5.39800995 10.6515648,5.89552239 10.130313,6.69154229 C9.65249878,5.64676617 8.74030808,5 7.74124208,5 C7.74124208,5 7.69780443,5 7.69780443,5 C6.95936434,5 6.22092425,5.34825871 5.74311008,5.99502488 C5.22185825,6.5920398 4.96123233,7.43781095 5.00466999,8.28358209 C5.09154529,9.7761194 5.74311008,10.5223881 6.35123721,11.1691542 C7.04623964,11.9651741 7.69780443,12.6119403 7.48061617,14.5024876 C7.48061617,14.800995 7.61092912,15 7.82811739,15 C7.91499269,15 7.95843034,15 8.0887433,14.9502488 C12.6062591,13.358209 14.99533,11.2189055 14.99533,8.83084577 L14.99533,8.78109453 C15.0387677,7.8358209 14.7781418,7.039801 14.2568899,6.39303483 Z M7.82811739,14.7014925 L7.82811739,14.4527363 C7.82811739,14.4527363 7.82811739,14.4527363 7.82811739,14.4527363 L7.82811739,14.7014925 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon heads up</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#FAD961" offset="0%"></stop>
<stop stop-color="#F5A623" offset="100%"></stop>
</linearGradient>
<path d="M0,14.605519 L0,5.39448104 C0,1.5951272 4.59496118,0 10,0 C15.4050388,0 20,1.5951272 20,5.39448104 L20,14.605519 C20,18.4048728 15.4050388,20 10,20 C4.59496118,20 0,18.4048728 0,14.605519 Z" id="path-2"></path>
</defs>
<g id="Icons/Dark/40/Alert-icon-heads-up" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FFEDCF"></path>
<g id="Status-check" transform="translate(10, 10)">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<use id="Mask" fill="url(#linearGradient-1)" xlink:href="#path-2"></use>
<path d="M8.00083253,4.5536125 L8.34039759,10.5036125 C8.3562818,10.7820375 8.59715418,11 8.88888351,11 L11.1111166,11 C11.402846,11 11.6437183,10.7820375 11.6596026,10.5036125 L11.9991676,4.5536125 C12.0163335,4.252875 11.7658025,4 11.4506817,4 L8.54927267,4 C8.2341519,4 7.98366659,4.252875 8.00083253,4.5536125 L8.00083253,4.5536125 Z M10,12 C8.89543478,12 8,12.8954348 8,14 C8,15.1045652 8.89543478,16 10,16 C11.1045652,16 12,15.1045652 12,14 C12,12.8954348 11.1045652,12 10,12 Z" id="Path-4" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon information</title>
<defs>
<linearGradient x1="0%" y1="50%" x2="100%" y2="0%" id="linearGradient-1">
<stop stop-color="#0086FF" offset="0%"></stop>
<stop stop-color="#004EFF" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Icons/Dark/40/Alert-icon-information" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#D6E2FF"></path>
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
<path d="M22.5713807,24.7563706 C22.5312282,24.8064951 21.5738418,26 19.9765248,26 C19.9125317,26 19.8472839,25.9986453 19.7832908,25.9945811 C19.1458697,25.9539397 18.618868,25.6491285 18.2963932,25.1356911 C17.9011419,24.5057481 17.847187,23.6278921 18.1445665,22.6633342 L18.6540015,21.0092259 C18.9363238,20.0839548 18.6665491,19.9362907 18.5209963,19.8577172 C18.4820985,19.8360417 18.420615,19.8238493 18.345329,19.8238493 C18.0303828,19.8238493 17.5962338,20.0243473 17.4569548,20.1029208 C17.3264591,20.1760755 17.1620848,20.1381434 17.0667225,20.0121548 C16.9751246,19.8834568 16.9776342,19.7046343 17.0755059,19.5813551 C17.1169132,19.5285212 18.163388,18.2334126 19.8648506,18.3431446 C20.4985074,18.3824313 21.0255091,18.6858877 21.3479839,19.1979704 C21.74449,19.8279134 21.7996997,20.7071242 21.5035749,21.6743915 L20.9941399,23.3284998 C20.7093081,24.2524162 20.9815923,24.401435 21.1271451,24.4800085 C21.1522405,24.4935557 21.2049406,24.511167 21.2990481,24.511167 C21.6177586,24.511167 22.0519076,24.310669 22.1924414,24.2334502 C22.3254466,24.1575861 22.4873114,24.1982276 22.5814189,24.3255709 C22.671762,24.4542689 22.6692525,24.6330914 22.5713807,24.7563706 Z M20.2693902,14 C21.2410593,14.0022763 22.0318205,14.7944306 22.0340961,15.7641368 C22.0340961,16.7349811 21.2433349,17.5271355 20.270528,17.5294118 C19.2988589,17.5271355 18.5069599,16.7349811 18.5046843,15.765275 C18.5046843,14.7921543 19.2965833,14 20.2693902,14 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon popular</title>
<defs>
<linearGradient x1="100%" y1="0%" x2="0%" y2="50%" id="linearGradient-1">
<stop stop-color="#E4EE3B" offset="0%"></stop>
<stop stop-color="#DFAA1E" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Icons/Dark/40/Alert-icon-popular" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
<g id="Group">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#FFFAB8"></path>
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
<path d="M24.9626788,18.7571206 C24.8787507,18.5056935 24.6666091,18.3253374 24.4094678,18.2860519 L21.7991261,17.8949828 L20.6241331,15.4007119 C20.5073481,15.1535705 20.2684209,15 20.0002082,15 C19.7319955,15 19.4930684,15.1535705 19.3762834,15.4007119 L18.2184331,17.8860543 L15.5909487,18.2860519 C15.3338073,18.3253374 15.1220229,18.5056935 15.0377377,18.7571206 C14.9516667,19.0153333 15.0152378,19.2953317 15.2038081,19.4878305 L17.104154,21.432819 L16.6552281,24.1742313 C16.6105855,24.4481583 16.7212991,24.716371 16.9448692,24.87387 C17.1598679,25.0263691 17.4362949,25.041369 17.6662935,24.9145841 L19.9837798,23.620306 L22.334123,24.9145841 C22.5648359,25.041369 22.8405485,25.0256548 23.0555472,24.87387 C23.2791174,24.716371 23.3901881,24.4481583 23.3451884,24.1742313 L22.8955482,21.4292476 L24.7966084,19.4878305 C24.9851787,19.2953317 25.0487497,19.0153333 24.9626788,18.7571206 Z" id="XMLID_328_" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons/Dark/40/Alert icon question</title>
<defs>
<linearGradient x1="0%" y1="50%" x2="100%" y2="0%" id="linearGradient-1">
<stop stop-color="#3F5393" offset="0%"></stop>
<stop stop-color="#1F76B7" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Icons/Dark/40/Alert-icon-question" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E9DFF7"></path>
<g id="Group">
<path d="M0,29.2110379 L0,10.7889621 C0,3.19025441 9.18992236,0 20,0 C30.8100776,0 40,3.19025441 40,10.7889621 L40,29.2110379 C40,36.8097456 30.8100776,40 20,40 C9.18992236,40 0,36.8097456 0,29.2110379 Z" id="Path-3" fill="#E2E7F3"></path>
<path d="M10,24.605519 L10,15.394481 C10,11.5951272 14.5949612,10 20,10 C25.4050388,10 30,11.5951272 30,15.394481 L30,24.605519 C30,28.4048728 25.4050388,30 20,30 C14.5949612,30 10,28.4048728 10,24.605519 Z" id="Path-3" fill="url(#linearGradient-1)"></path>
<path d="M22.5458333,19.7352941 L20.6666667,20.9705882 L20.6666667,21.0588235 C20.6666667,21.6323529 20.2083333,22.1176471 19.6666667,22.1176471 C19.125,22.1176471 18.6666667,21.6323529 18.6666667,21.0588235 L18.6666667,20.3529412 C18.6666667,20 18.8333333,19.6470588 19.1666667,19.4264706 L21.5416667,17.9264706 C21.8333333,17.75 22,17.4411765 22,17.0882353 C22,16.5588235 21.5458333,16.1176471 21.0458333,16.1176471 L18.9166667,16.1176471 C18.3791667,16.1176471 18,16.5588235 18,17.0882353 C18,17.6617647 17.5416667,18.1470588 17,18.1470588 C16.4583333,18.1470588 16,17.6617647 16,17.0882353 C16,15.3676471 17.2916667,14 18.8791667,14 L21.0083333,14 C22.7083333,14 24,15.3676471 24,17.0882353 C24,18.1470588 23.4583333,19.1617647 22.5458333,19.7352941 Z M19.6666667,26 C18.9166667,26 18.3333333,25.3823529 18.3333333,24.5882353 C18.3333333,23.7941176 18.8791667,23.1764706 19.6666667,23.1764706 C20.3791667,23.1764706 21,23.7941176 21,24.5882353 C21,25.3823529 20.3791667,26 19.6666667,26 Z" id="Path-3" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -39,6 +39,7 @@ $get_agent_filters = get_parameter('get_agent_filters', 0);
$save_agent_filter = get_parameter('save_agent_filter', 0);
$update_agent_filter = get_parameter('update_agent_filter', 0);
$delete_agent_filter = get_parameter('delete_agent_filter', 0);
$check_unique_ip = (bool) get_parameter('check_unique_ip', 0);
if (https_is_running()) {
header('Content-type: application/json');
@ -1020,4 +1021,29 @@ $(document).ready(function() {
return;
}
if ($check_unique_ip === true) {
$direccion_agente = (string) get_parameter_post('direccion', '');
$ip_all = get_parameter_post('ip_all', '');
if (empty($direccion_agente) === true) {
echo json_encode(['success' => false, 'message' => __('Please enter an IP address.')]);
return;
}
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
$exists_ip = db_get_row_sql($sql);
if ($exists_ip !== false) {
if (is_array($ip_all) === true && in_array($direccion_agente, $ip_all) === true) {
echo json_encode(['success' => true, 'message' => __('Success! but this IP is already in the list.')]);
} else {
echo json_encode(['success' => false, 'message' => __('This IP is already being used'), 'exist_ip' => true]);
}
} else {
echo json_encode(['success' => true, 'message' => __('Success! this IP is available to be used.')]);
}
return;
}
return;

View File

@ -41,7 +41,20 @@ if ($method === 'draw') {
$length = get_parameter('length', $config['block_size']);
$orderBy = get_datatable_order(true);
$sort_field = $orderBy['field'];
switch ($orderBy['field']) {
case 'groups':
$sort_field = 'nombre';
break;
case 'favorite':
$sort_field = 'active';
break;
default:
$sort_field = $orderBy['field'];
break;
}
$order = $orderBy['direction'];
$pagination = '';
@ -104,12 +117,25 @@ if ($method === 'draw') {
$where_name = 'name LIKE "%'.$filter['free_search'].'%"';
}
if (is_user_admin($config['id_user']) === false) {
$group_list = \users_get_groups(
$config['id_ser'],
'RR',
true
);
}
$where_group = '';
if (empty($filter['group']) === false && $filter['group'] !== '0') {
$where_group = sprintf('id_group = %s', $filter['group']);
if (empty($where_name) === false) {
$where_group = 'AND '.$where_group;
}
} else if (empty($group_list) === false) {
$where_group = sprintf('id_group IN (%s)', implode(',', array_keys($group_list)));
if (empty($where_name) === false) {
$where_group = 'AND '.$where_group;
}
}
$where = '';
@ -121,7 +147,7 @@ if ($method === 'draw') {
);
}
$sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination;
$sql = 'SELECT * FROM tdashboard LEFT JOIN tgrupo ON tgrupo.id_grupo = tdashboard.id_group '.$where.' ORDER BY '.$sort_field.' '.$order.$pagination;
$dashboards = db_get_all_rows_sql($sql);
$count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where);
foreach ($dashboards as $dashboard) {

View File

@ -98,6 +98,8 @@ $draw_events_graph = get_parameter('drawEventsGraph', false);
// User private filter.
$current_filter = get_parameter('current_filter', 0);
$private_filter_event = get_parameter('private_filter_event', 0);
// Asteroids.
$playAsteroids = (bool) get_parameter('playAsteroids', false);
if ($get_comments === true) {
global $config;
@ -1333,6 +1335,15 @@ if ($perform_event_response === true) {
}
$command = $event_response['target'];
// Prevent OS command injection.
$prev_command = get_events_get_response_target($event_id, $event_response, $server_id);
if ($command !== $prev_command) {
echo __('unauthorized');
return;
}
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
if (enterprise_installed() === true) {
if ($event_response !== false
@ -2531,15 +2542,12 @@ if ($drawConsoleSound === true) {
$output .= '<div id="progressbar_time"></div>';
$output .= '<div class="buttons-sound-modal">';
$output .= '<div class="container-button-play">';
$output .= html_print_input(
[
'label' => __('Start'),
'type' => 'button',
'name' => 'start-search',
'attributes' => [ 'class' => 'play secondary' ],
'return' => true,
],
'div',
$output .= html_print_button(
__('Start'),
'start-search',
false,
'',
['icon' => 'play'],
true
);
$output .= '</div>';
@ -2763,6 +2771,17 @@ if ($draw_row_response_info === true) {
return;
}
// Asteroids.
if ($playAsteroids === true) {
echo ui_require_css_file('asteroids', 'include/styles/', true);
echo ui_require_javascript_file('asteroids', 'include/asteroids/', true);
$output = '<div id="asteroids">Asteroids game goes here!</div>';
echo $output;
return;
}
if ($update_event_custom_id) {
$event_custom_id = get_parameter('event_custom_id');
$event_id = get_parameter('event_id');
@ -2814,4 +2833,4 @@ if ((bool) $draw_events_graph === true) {
$output = event_print_graph($filter);
echo $output;
return;
}
}

View File

@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph');
$print_custom_graph = (bool) get_parameter('print_custom_graph', false);
$print_sparse_graph = (bool) get_parameter('print_sparse_graph');
$get_graphs = (bool) get_parameter('get_graphs_container');
$sort_items = (bool) get_parameter('sort_items');
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
@ -337,3 +339,104 @@ if ($get_graphs) {
return;
}
}
if ($sort_items === true) {
$order = (string) get_parameter('order');
$id = (string) get_parameter('id', '');
$idGraph = (string) get_parameter('id_graph', '');
$total = db_get_num_rows('SELECT * FROM tgraph_source WHERE id_graph = '.$idGraph.'');
$item = db_get_row_sql(
'SELECT id_gs, field_order
FROM tgraph_source
WHERE id_gs = '.$id.'
ORDER BY field_order'
);
switch ($order) {
case 'up':
if (($item['field_order'] - 1) < 1) {
echo json_encode(['success' => false]);
return;
}
$prevItem = db_get_row_sql(
'SELECT id_gs, field_order
FROM tgraph_source
WHERE id_graph = '.$idGraph.'
AND field_order = '.($item['field_order'] - 1).'
ORDER BY field_order'
);
db_process_sql_begin();
$resultItem = db_process_sql_update(
'tgraph_source',
['field_order' => ($item['field_order'] - 1)],
['id_gs' => $item['id_gs']],
false
);
$resultPrevItem = db_process_sql_update(
'tgraph_source',
['field_order' => ($prevItem['field_order'] + 1)],
['id_gs' => $prevItem['id_gs']],
false
);
if ($resultItem !== false && $resultPrevItem !== false) {
db_process_sql_commit();
echo json_encode(['success' => true]);
return;
} else {
db_process_sql_rollback();
echo json_encode(['success' => false]);
return;
}
break;
case 'down':
if (($item['field_order'] + 1) > $total) {
echo json_encode(['success' => false]);
return;
}
$nextItem = db_get_row_sql(
'SELECT id_gs, field_order
FROM tgraph_source
WHERE id_graph = '.$idGraph.'
AND field_order = '.($item['field_order'] + 1).'
ORDER BY field_order'
);
db_process_sql_begin();
$resultItem = db_process_sql_update(
'tgraph_source',
['field_order' => ($item['field_order'] + 1)],
['id_gs' => $item['id_gs']],
false
);
$resultNextItem = db_process_sql_update(
'tgraph_source',
['field_order' => ($nextItem['field_order'] - 1)],
['id_gs' => $nextItem['id_gs']],
false
);
if ($resultItem !== false && $resultNextItem !== false) {
db_process_sql_commit();
echo json_encode(['success' => true]);
return;
} else {
db_process_sql_rollback();
echo json_encode(['success' => false]);
return;
}
break;
default:
echo json_encode(['success' => false]);
break;
}
}

View File

@ -250,6 +250,7 @@ if (is_ajax() === true) {
if ($getInfo === true) {
enterprise_include_once('include/functions_agents.php');
include_once $config['homedir'].'/include/functions_graph.php';
$id = get_parameter('id', 0);
$id_server = get_parameter('id_server', 0);
if (empty($id_server) === false) {

View File

@ -26,7 +26,8 @@
* ============================================================================
*/
check_login();
require_once $config['homedir'].'/include/functions_inventory.php';
check_login();
if (is_ajax() === true) {
$id_agent = get_parameter('id_agent', '0');

View File

@ -1875,6 +1875,8 @@ if (check_login()) {
$table_id = get_parameter('table_id', '');
$search = get_parameter('search', '');
$search_agent = get_parameter('search_agent', '');
$groupId = (int) get_parameter('groupId', 0);
$module_name = get_parameter('module_name', '');
$status = get_parameter('status', '');
$start = get_parameter('start', 0);
@ -1886,13 +1888,36 @@ if (check_login()) {
$nodes = get_parameter('nodes', 0);
$disabled_modules = (bool) get_parameter('disabled_modules', false);
$groups_array = [];
if ($groupId === 0) {
if (users_can_manage_group_all('AR') === false) {
$groups_array = users_get_groups(false, 'AR', false);
}
} else {
$groups_array = [$groupId];
}
$where = '1=1';
$recordsTotal = 0;
if (empty($groups_array) === false) {
$where .= sprintf(
' AND (tagente.id_grupo IN (%s)
OR tagent_secondary_group.id_group IN(%s))',
implode(',', $groups_array),
implode(',', $groups_array)
);
}
if (empty($search) === false) {
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
}
if (empty($search_agent) === false) {
$where .= ' AND tagente.alias LIKE "%%'.$search_agent.'%%"';
}
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
@ -1900,12 +1925,24 @@ if (check_login()) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
array_push($expl, '1', '2', '3', '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false) {
if (str_contains($status, '5') === true) {
$expl = explode(',', $status);
$exist = array_search('5', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false || $status === '0') {
$where .= sprintf(
' AND tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
@ -1967,6 +2004,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s
ORDER BY %s
LIMIT %d, %d',
@ -1984,6 +2023,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2011,6 +2052,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2043,6 +2086,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2148,24 +2193,25 @@ if (check_login()) {
);
switch ((int) $row['estado']) {
case 0:
case AGENT_MODULE_STATUS_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true);
break;
case 1:
case 6:
case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_MODULE_STATUS_NOT_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true);
break;
case 2:
case AGENT_MODULE_STATUS_WARNING:
$status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true);
break;
case 3:
case AGENT_MODULE_STATUS_UNKNOWN:
$status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true);
break;
case 5:
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
$status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true);
break;

View File

@ -380,5 +380,7 @@ if (session_status() !== PHP_SESSION_DISABLED) {
// Could give a warning if no session file is created. Ignore.
@session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
}

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