resolve merge conflcit

This commit is contained in:
marcos 2021-05-27 09:57:06 +02:00
commit 403f326f55
213 changed files with 27858 additions and 20858 deletions

View File

@ -117,7 +117,7 @@ check_pre_pandora
check_repo_connection check_repo_connection
# Systemd # Systemd
execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G # Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)' execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
@ -247,7 +247,17 @@ server_dependencies=" \
perl-Time-HiRes \ perl-Time-HiRes \
nfdump \ nfdump \
net-snmp-utils \ net-snmp-utils \
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm" perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(Geo::IP) \
perl(IO::Socket::INET6) \
perl(XML::Twig) \
expect \
openssh-clients \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# SDK VMware perl dependencies # SDK VMware perl dependencies
@ -262,10 +272,10 @@ vmware_dependencies=" \
execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle # Instant client Oracle
oracle_dependencier=" \ oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client" execute_cmd "yum install -y $oracle_dependencies" "Installing Oracle Instant client"
# Disabling SELINUX and firewalld # Disabling SELINUX and firewalld
setenforce 0 setenforce 0
@ -475,7 +485,7 @@ net.core.optmem_max = 81920
EO_KO EO_KO
execute_cmd "sysctl --system" "Applying Kernel optimization" [ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
# Fix pandora_server.{log,error} permissions to allow Console check them # Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:apache /var/log/pandora chown pandora:apache /var/log/pandora

View File

@ -11,7 +11,7 @@ RUN dnf install -y --setopt=tsflags=nodocs \
RUN dnf module reset -y php && dnf module install -y php:remi-7.3 RUN dnf module reset -y php && dnf module install -y php:remi-7.3
RUN dnf config-manager --set-enabled powertools RUN dnf config-manager --set-enabled powertools
# Install console # Install console dependencies
RUN dnf install -y --setopt=tsflags=nodocs \ RUN dnf install -y --setopt=tsflags=nodocs \
php \ php \
php-mcrypt \php-cli \ php-mcrypt \php-cli \
@ -91,9 +91,9 @@ RUN dnf install -y --setopt=tsflags=nodocs \
php-yaml php-yaml
RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/ RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/
# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts # Not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts
# Install server # Install server dependencies
RUN dnf install -y --setopt=tsflags=nodocs \ RUN dnf install -y --setopt=tsflags=nodocs \
GeoIP \ GeoIP \
@ -256,16 +256,18 @@ RUN dnf install -y --setopt=tsflags=nodocs \
nmap \ nmap \
net-snmp-utils \ net-snmp-utils \
sudo \ sudo \
expect \
openssh-clients \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos8/wmi-1.3.14-4.el7.art.x86_64.rpm http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm
# install utils # Install utils
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
# SDK VMware perl dependencies # SDK VMware perl dependencies
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
# Instant client Oracle # Instant client Oracle
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
# Install Phantom
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs

View File

@ -160,9 +160,9 @@ echo "Updating Pandora Server version..."
sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$SERVER_FILE" sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$SERVER_FILE"
sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$SERVER_FILE" sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$SERVER_FILE"
echo "Updating DB maintenance script version..." echo "Updating DB maintenance script version..."
sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SERVER_DB_FILE" sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION Build $BUILD\";/" "$SERVER_DB_FILE"
echo "Updating CLI script version..." echo "Updating CLI script version..."
sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SERVER_CLI_FILE" sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION Build $BUILD\";/" "$SERVER_CLI_FILE"
sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE" sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE"
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE" sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE"
sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE" sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE"
@ -197,7 +197,7 @@ echo "Updating Pandora Unix Agent version..."
sed -i -e "s/\s*use\s*constant\s*AGENT_VERSION =>.*/use constant AGENT_VERSION => '$VERSION';/" "$AGENT_UNIX_FILE" sed -i -e "s/\s*use\s*constant\s*AGENT_VERSION =>.*/use constant AGENT_VERSION => '$VERSION';/" "$AGENT_UNIX_FILE"
sed -i -e "s/\s*use\s*constant\s*AGENT_BUILD =>.*/use constant AGENT_BUILD => '$BUILD';/" "$AGENT_UNIX_FILE" sed -i -e "s/\s*use\s*constant\s*AGENT_BUILD =>.*/use constant AGENT_BUILD => '$BUILD';/" "$AGENT_UNIX_FILE"
echo "Updating Pandora Windows Agent version..." echo "Updating Pandora Windows Agent version..."
sed -i -e "s/\s*#define\s*PANDORA_VERSION\s*.*/#define PANDORA_VERSION (\"$VERSION(Build $BUILD)\")/" "$AGENT_WIN_FILE" sed -i -e "s/\s*#define\s*PANDORA_VERSION\s*.*/#define PANDORA_VERSION (\"$VERSION Build $BUILD\")/" "$AGENT_WIN_FILE"
sed -i -e "s/{Pandora FMS Windows Agent v.*}/{Pandora FMS Windows Agent v$VERSION}/" "$AGENT_WIN_MPI_FILE" sed -i -e "s/{Pandora FMS Windows Agent v.*}/{Pandora FMS Windows Agent v$VERSION}/" "$AGENT_WIN_MPI_FILE"
NUMERIC_VERSION=$(echo $VERSION | sed -e "s/\([0-9]*\.[0-9]*\).*/\1/") NUMERIC_VERSION=$(echo $VERSION | sed -e "s/\([0-9]*\.[0-9]*\).*/\1/")
sed -i -n "1h;1!H;\${;g;s/[\r\n]InstallVersion[\r\n]{\S*}/\nInstallVersion\n{$NUMERIC_VERSION.0.0}/g;p;}" "$AGENT_WIN_MPI_FILE" sed -i -n "1h;1!H;\${;g;s/[\r\n]InstallVersion[\r\n]{\S*}/\nInstallVersion\n{$NUMERIC_VERSION.0.0}/g;p;}" "$AGENT_WIN_MPI_FILE"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.754-210420 Version: 7.0NG.754-210527
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.754'; use constant AGENT_VERSION => '7.0NG.754';
use constant AGENT_BUILD => '210420'; use constant AGENT_BUILD => '210527';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1229,7 +1229,8 @@ use constant MAX_LOOP_COUNTER => 1000000000;
# Print usage information and exit. # Print usage information and exit.
################################################################################ ################################################################################
sub print_usage () { sub print_usage () {
print "\nUsage: $0 <Pandora home>\n\n"; print "Pandora FMS Agent for Linux v" . AGENT_VERSION . " Build " . AGENT_BUILD . "\n\n";
print "Usage: $0 <Pandora home>\n\n";
print "\tPandora home is the directory where pandora_agent.conf is located,\n"; print "\tPandora home is the directory where pandora_agent.conf is located,\n";
print "\tby default /etc/pandora.\n\n"; print "\tby default /etc/pandora.\n\n";
exit 1; exit 1;
@ -2330,9 +2331,6 @@ sub launch_tentacle_proxy () {
#Execute tentacle server as a daemon #Execute tentacle server as a daemon
my $new_process = "tentacle_server -a ".$Conf{'proxy_address'}." -p ".$Conf{'proxy_port'}." -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'}; my $new_process = "tentacle_server -a ".$Conf{'proxy_address'}." -p ".$Conf{'proxy_port'}." -b ".$Conf{'server_ip'}." -g ".$Conf{'server_port'}." -c ".$Conf{'proxy_max_connection'}." -t ".$Conf{'proxy_timeout'};
$new_process .= ' -C' if ($Conf{'server_ssl'} eq '1');
log_message ('setup', 'Proxy mode enabled'); log_message ('setup', 'Proxy mode enabled');
exec ($new_process); exec ($new_process);
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.754 %define version 7.0NG.754
%define release 210420 %define release 210527
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.754 %define version 7.0NG.754
%define release 210420 %define release 210527
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.754" PI_VERSION="7.0NG.754"
PI_BUILD="210420" PI_BUILD="210527"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0
@ -152,8 +152,8 @@ uninstall () {
fi fi
# Stops the agent on uninstall # Stops the agent on uninstall
if [ -f $PANDORA_BASE/etc/init.d/pandora_agent_daemon ]; then if [ -f /etc/init.d/pandora_agent_daemon ]; then
$PANDORA_BASE/etc/init.d/pandora_agent_daemon stop 12> /dev/null /etc/init.d/pandora_agent_daemon stop 12> /dev/null
else else
echo "$PANDORA_BASE/etc/init.d/pandora_agent_daemon not found to stop agent" echo "$PANDORA_BASE/etc/init.d/pandora_agent_daemon not found to stop agent"
fi fi

View File

@ -3,7 +3,7 @@
######################################################################## ########################################################################
# Pandora FMS - Remote Event Tool (via WEB API) # Pandora FMS - Remote Event Tool (via WEB API)
######################################################################## ########################################################################
# Copyright (c) 2013 Artica Soluciones Tecnologicas S.L # Copyright (c) 2021 Artica Soluciones Tecnologicas S.L
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2 # modify it under the terms of the GNU General Public License version 2
@ -12,6 +12,7 @@
# Includes list # Includes list
use strict; use strict;
use LWP::Simple; use LWP::Simple;
use LWP::UserAgent;
use MIME::Base64; use MIME::Base64;
use lib '/usr/lib/perl5'; use lib '/usr/lib/perl5';
use PandoraFMS::Tools; use PandoraFMS::Tools;
@ -33,12 +34,12 @@ sub help_screen{
Where options:\n Where options:\n
-u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass> -u <credentials> : API credentials separated by comma: <api_pass>,<user>,<pass>
-name <event_name> : Free text -name <event_name> : Free text (surrounded by single-quotes, for security reasons)
-group <id_group> : Group ID (use 0 for 'all') -group <id_group> : Group ID (use 0 for 'all')
-agent : Agent ID
Optional parameters: Optional parameters:
[-agent <id_agent] : Agent ID
[-status <status>] : 0 New, 1 Validated, 2 In process [-status <status>] : 0 New, 1 Validated, 2 In process
[-user <id_user>] : User comment (use in combination with -comment option) [-user <id_user>] : User comment (use in combination with -comment option)
[-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased [-type <event_type>] : unknown, alert_fired, alert_recovered, alert_ceased
@ -57,7 +58,7 @@ Optional parameters:
[-c_instructions <critical_instructions>] [-c_instructions <critical_instructions>]
[-w_instructions <warning_instructions>] [-w_instructions <warning_instructions>]
[-u_instructions <unknown_instructions>] [-u_instructions <unknown_instructions>]
[-user_comment <comment>] [-user_comment <comment>] : Free text (surrounded by single-quotes, for security reasons)
[-owner_user <owner event>] : Use the login name, not the descriptive [-owner_user <owner event>] : Use the login name, not the descriptive
[-source <source>] : (By default 'Pandora') [-source <source>] : (By default 'Pandora')
[-tag <tags>] : Tag (must exist in the system to be imported) [-tag <tags>] : Tag (must exist in the system to be imported)
@ -65,6 +66,7 @@ Optional parameters:
[-id_extra <id extra>] : Id extra [-id_extra <id extra>] : Id extra
[-agent_name <Agent name>] : Agent name, Not to be confused with the alias. [-agent_name <Agent name>] : Agent name, Not to be confused with the alias.
[-force_create_agent<0 o 1>] : Force the creation of agent through an event this will create when it is 1. [-force_create_agent<0 o 1>] : Force the creation of agent through an event this will create when it is 1.
[-separator '<char/s>'] : If you use the vertical bar `|` in the event name, you must set other character for send the info. This must be surrounded by single-quotes
[-server_id <server_id>] : The pandora node server_id\n\n"; [-server_id <server_id>] : The pandora node server_id\n\n";
print "Example of event generation:\n\n"; print "Example of event generation:\n\n";
@ -88,7 +90,7 @@ Optional parameters:
############################################################################## ##############################################################################
sub tool_api_init () { sub tool_api_init () {
print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2015 Artica ST\n"; print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2021 Artica ST\n";
print "This program is Free Software, licensed under the terms of GPL License v2\n"; print "This program is Free Software, licensed under the terms of GPL License v2\n";
print "You can download latest versions and documentation at http://www.pandorafms.org\n\n"; print "You can download latest versions and documentation at http://www.pandorafms.org\n\n";
@ -120,7 +122,7 @@ sub tool_api_main () {
my $db_user; my $db_user;
my $db_pass; my $db_pass;
my @db_info; my @db_info;
my $id_agent; my $id_agent = '0';
my $id_user = ''; my $id_user = '';
my $status = ''; my $status = '';
my $id_agent_module = ''; my $id_agent_module = '';
@ -141,6 +143,7 @@ sub tool_api_main () {
my $call_api; my $call_api;
my $custom_data = ""; my $custom_data = "";
my $server_id = 0; my $server_id = 0;
my $separator = '|';
#~ help or api path (required) #~ help or api path (required)
if ($ARGV[0] eq '-h') { if ($ARGV[0] eq '-h') {
@ -185,12 +188,18 @@ sub tool_api_main () {
if ($line eq '-agent') { if ($line eq '-agent') {
$id_agent = $ARGV[$i + 1]; $id_agent = $ARGV[$i + 1];
# If not defined, send 0 for API.
if ($id_agent eq undef) {
$id_agent = '0';
}
} }
if ($line eq '-group') { if ($line eq '-group') {
$id_group = $ARGV[$i + 1]; $id_group = $ARGV[$i + 1];
} }
if ($line eq '-name') { if ($line eq '-name') {
$event_name = $ARGV[$i + 1]; $event_name = $ARGV[$i + 1];
$event_name =~ s/#/%23/g;
} }
if ($line eq '-type') { if ($line eq '-type') {
$event_type = $ARGV[$i + 1]; $event_type = $ARGV[$i + 1];
@ -250,50 +259,49 @@ sub tool_api_main () {
if ($line eq '-server_id') { if ($line eq '-server_id') {
$server_id = $ARGV[$i + 1]; $server_id = $ARGV[$i + 1];
} }
if ($line eq '-separator') {
$separator = $ARGV[$i + 1];
}
$i++; $i++;
} }
if ($event_name eq "") { if ($event_name eq "") {
print "[ERROR] Missing id agent! Read help info:\n\n"; print "[ERROR] Missing event name! Read help info:\n\n";
help_screen (); help_screen ();
} }
if ($id_group eq "") { if ($id_group eq "") {
print "[ERROR] Missing event group! Read help info:\n\n"; print "[ERROR] Missing event group! Read help info:\n\n";
help_screen (); help_screen ();
} }
if ($id_agent eq "" && $agent_name eq "") {
print "[ERROR] Missing id agent! and agent_name Read help info:\n\n";
help_screen ();
}
$data_event = $event_name . $data_event = $event_name .
"|" . $id_group . $separator . $id_group .
"|" . $id_agent . $separator . $id_agent .
"|" . $status . $separator . $status .
"|" . $id_user . $separator . $id_user .
"|" . $event_type . $separator . $event_type .
"|" . $severity . $separator . $severity .
"|" . $id_agent_module . $separator . $id_agent_module .
"|" . $id_alert_am . $separator . $id_alert_am .
"|" . $critical_instructions . $separator . $critical_instructions .
"|" . $warning_instructions . $separator . $warning_instructions .
"|" . $unknown_instructions . $separator . $unknown_instructions .
"|" . $user_comment . $separator . $user_comment .
"|" . $owner_user . $separator . $owner_user .
"|" . $source . $separator . $source .
"|" . $tags . $separator . $tags .
"|" . $custom_data . $separator . $custom_data .
"|" . $server_id . $separator . $server_id .
"|" . $id_extra . $separator . $id_extra .
"|" . $agent_name . $separator . $agent_name .
"|" . $force_create_agent; $separator . $force_create_agent;
$call_api = $api_path . '?' . $call_api = $api_path . '?' .
'op=set&' . 'op=set&' .
'op2=create_event&' . 'op2=create_event&' .
'other=' . $data_event .'&' . 'other=' . $data_event .'&' .
'other_mode=url_encode_separator_|&' . 'other_mode=url_encode_separator_'.$separator.'&' .
'apipass=' . $api_pass . '&' . 'apipass=' . $api_pass . '&' .
'user=' . $db_user . '&' . 'user=' . $db_user . '&' .
'pass=' . $db_pass; 'pass=' . $db_pass;
@ -321,7 +329,8 @@ sub tool_api_main () {
exit; exit;
} }
else { else {
my $content = get($call_api); my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
my $content = $ua->get($call_api);
if ($option eq '-create_event') { if ($option eq '-create_event') {
if ($content eq undef) { if ($content eq undef) {
@ -329,7 +338,7 @@ sub tool_api_main () {
help_screen(); help_screen();
} }
else { else {
print "Event ID: $content"; print "Event ID: $content->{'_content'}";
} }
} }
elsif ($option eq '-validate_event') { elsif ($option eq '-validate_event') {

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{210420} {210527}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -115,8 +115,8 @@ main (int argc, char *argv[]) {
return 0; return 0;
} else if (_stricmp(argv[i], HELP_CMDLINE_PARAM) == 0) { } else if (_stricmp(argv[i], HELP_CMDLINE_PARAM) == 0) {
/* Help parameter */ /* Help parameter */
cout << "Pandora agent for Windows. "; cout << "Pandora agent for Windows ";
cout << "Version " << getPandoraAgentVersion () << endl; cout << "v" << getPandoraAgentVersion () << endl << endl;
cout << "Usage: " << argv[0] << " [OPTION]" << endl << endl; cout << "Usage: " << argv[0] << " [OPTION]" << endl << endl;
cout << "Available options are:" << endl; cout << "Available options are:" << endl;
cout << "\t" << SERVICE_INSTALL_CMDLINE_PARAM; cout << "\t" << SERVICE_INSTALL_CMDLINE_PARAM;

View File

@ -81,6 +81,7 @@ Pandora_Module::Pandora_Module (string name) {
this->module_ff_type = ""; this->module_ff_type = "";
this->module_alert_template = ""; this->module_alert_template = "";
this->module_crontab = ""; this->module_crontab = "";
this->module_wait_timeout = 500;
} }
/** /**
@ -1722,3 +1723,18 @@ Pandora_Module::isIntensive () {
return true; return true;
} }
/**
* Set the WaitForSingleObject timeout.
*
* @param timeout Timeout in milliseconds.
*/
void
Pandora_Module::setWaitTimeout (int timeout) {
if (timeout < 0) {
return;
}
this->module_wait_timeout = timeout;
}

View File

@ -216,6 +216,7 @@ namespace Pandora_Modules {
string getDataOutput (Pandora_Data *data); string getDataOutput (Pandora_Data *data);
void cleanDataList (); void cleanDataList ();
int module_wait_timeout;
public: public:
Pandora_Module (string name); Pandora_Module (string name);
virtual ~Pandora_Module (); virtual ~Pandora_Module ();
@ -231,6 +232,7 @@ namespace Pandora_Modules {
int getInterval (); int getInterval ();
int getIntensiveInterval (); int getIntensiveInterval ();
void setTimeout (int timeout); void setTimeout (int timeout);
void setWaitTimeout (int timeout);
int getTimeout (); int getTimeout ();
string getSave (); string getSave ();
bool getAsync (); bool getAsync ();

View File

@ -172,7 +172,7 @@ Pandora_Module_Exec::run () {
string output; string output;
int tickbase = GetTickCount(); int tickbase = GetTickCount();
while ( (dwRet = WaitForSingleObject (pi.hProcess, 500)) != WAIT_ABANDONED ) { while ( (dwRet = WaitForSingleObject (pi.hProcess, this->module_wait_timeout)) != WAIT_ABANDONED ) {
PeekNamedPipe (out_read, buffer, BUFSIZE, &read, &avail, NULL); PeekNamedPipe (out_read, buffer, BUFSIZE, &read, &avail, NULL);
if (avail > 0) { if (avail > 0) {
ReadFile (out_read, buffer, BUFSIZE, &read, NULL); ReadFile (out_read, buffer, BUFSIZE, &read, NULL);
@ -180,11 +180,6 @@ Pandora_Module_Exec::run () {
output += (char *) buffer; output += (char *) buffer;
} }
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
if (dwRet == WAIT_OBJECT_0) { if (dwRet == WAIT_OBJECT_0) {
break; break;
} else if(this->getTimeout() < GetTickCount() - tickbase) { } else if(this->getTimeout() < GetTickCount() - tickbase) {
@ -220,6 +215,10 @@ Pandora_Module_Exec::run () {
} }
// Command output mode // Command output mode
else if (!output.empty()) { else if (!output.empty()) {
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
this->setOutput (output); this->setOutput (output);
} else { } else {
this->setOutput (""); this->setOutput ("");
@ -471,4 +470,3 @@ void Pandora_Module_Exec::changeOutputEncoding(string * string_change){
} }
} }

View File

@ -124,6 +124,7 @@ using namespace Pandora_Strutils;
#define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template") #define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ") #define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
string string
parseLine (string line, string token) { parseLine (string line, string token) {
@ -178,7 +179,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding, module_alert_template, module_ff_type; string module_native_encoding, module_alert_template, module_ff_type;
string macro; string macro, module_wait_timeout;
Pandora_Module *module; Pandora_Module *module;
bool numeric; bool numeric;
Module_Type type; Module_Type type;
@ -260,6 +261,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_alert_template = ""; module_alert_template = "";
module_user_session = ""; module_user_session = "";
macro = ""; macro = "";
module_wait_timeout = "";
stringtok (tokens, definition, "\n"); stringtok (tokens, definition, "\n");
@ -291,6 +293,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") { if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC); module_exec = parseLine (line, TOKEN_EXEC);
} }
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
if (module_proc == "") { if (module_proc == "") {
module_proc = parseLine (line, TOKEN_PROC); module_proc = parseLine (line, TOKEN_PROC);
} }
@ -1130,6 +1135,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != "") { if (module_timeout != "") {
module->setTimeout (atoi (module_timeout.c_str ())); module->setTimeout (atoi (module_timeout.c_str ()));
} }
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_proc != "") { } else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name, module = new Pandora_Module_Proc (module_name,
@ -1230,6 +1238,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != ""){ if (module_timeout != ""){
module->setTimeout(atoi(module_timeout.c_str())); module->setTimeout(atoi(module_timeout.c_str()));
} }
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_ping != "") { } else if (module_ping != "") {
if (module_ping_count == "") { if (module_ping_count == "") {
module_ping_count = "1"; module_ping_count = "1";

View File

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

View File

@ -423,7 +423,7 @@ Pandora_Windows_Service::killTentacleProxy() {
int int
Pandora_Windows_Service::launchTentacleProxy() { Pandora_Windows_Service::launchTentacleProxy() {
string server_ip, server_port, proxy_max_connections, proxy_timeout, server_ssl; string server_ip, server_port, proxy_max_connections, proxy_timeout;
string proxy_cmd, proxy_address, proxy_port; string proxy_cmd, proxy_address, proxy_port;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFO si; STARTUPINFO si;
@ -451,15 +451,6 @@ Pandora_Windows_Service::launchTentacleProxy() {
server_port = "41121"; server_port = "41121";
} }
server_ssl = conf->getValue("server_ssl");
if (server_ssl == "1") {
proxy_cmd = "tentacle_server.exe -C";
}
else {
proxy_cmd = "tentacle_server.exe";
}
// Proxy address. // Proxy address.
proxy_address = conf->getValue("proxy_address"); proxy_address = conf->getValue("proxy_address");
if (proxy_address == "") { if (proxy_address == "") {
@ -472,7 +463,7 @@ Pandora_Windows_Service::launchTentacleProxy() {
proxy_port = "41121"; proxy_port = "41121";
} }
proxy_cmd += " -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout + " -a " + proxy_address + " -p " + proxy_port; proxy_cmd = "tentacle_server.exe -b " + server_ip + " -g " + server_port + " -c " + proxy_max_connections + " -t " + proxy_timeout + " -a " + proxy_address + " -p " + proxy_port;
ZeroMemory (&si, sizeof (si)); ZeroMemory (&si, sizeof (si));
ZeroMemory (&pi, sizeof (pi)); ZeroMemory (&pi, sizeof (pi));

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.754-210420 Version: 7.0NG.754-210527
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -31,18 +31,18 @@ require 'vendor/autoload.php';
define('AJAX', true); define('AJAX', true);
if (!defined('__PAN_XHPROF__')) { if (defined('__PAN_XHPROF__') === false) {
define('__PAN_XHPROF__', 0); define('__PAN_XHPROF__', 0);
} }
if (__PAN_XHPROF__ === 1) { if (__PAN_XHPROF__ === 1) {
if (function_exists('tideways_xhprof_enable')) { if (function_exists('tideways_xhprof_enable') === true) {
tideways_xhprof_enable(); tideways_xhprof_enable();
} }
} }
if ((! file_exists('include/config.php')) if (file_exists('include/config.php') === false
|| (! is_readable('include/config.php')) || is_readable('include/config.php') === false
) { ) {
exit; exit;
} }
@ -57,11 +57,11 @@ require_once 'include/auth/mysql.php';
if (isset($config['console_log_enabled']) === true if (isset($config['console_log_enabled']) === true
&& $config['console_log_enabled'] == 1 && $config['console_log_enabled'] == 1
) { ) {
ini_set('log_errors', 1); ini_set('log_errors', true);
ini_set('error_log', $config['homedir'].'/log/console.log'); ini_set('error_log', $config['homedir'].'/log/console.log');
} else { } else {
ini_set('log_errors', 0); ini_set('log_errors', false);
ini_set('error_log', null); ini_set('error_log', '');
} }
// Sometimes input is badly retrieved from caller... // Sometimes input is badly retrieved from caller...
@ -98,9 +98,11 @@ if (isset($_GET['loginhash']) === true) {
} }
} }
// Another auth class example: PandoraFMS\Dashboard\Manager.
$auth_class = io_safe_output( $auth_class = io_safe_output(
get_parameter('auth_class', 'PandoraFMS\Dashboard\Manager') get_parameter('auth_class', 'PandoraFMS\User')
); );
$public_hash = get_parameter('auth_hash', false); $public_hash = get_parameter('auth_hash', false);
$public_login = false; $public_login = false;
// Check user. // Check user.
@ -124,7 +126,7 @@ if (class_exists($auth_class) === false || $public_hash === false) {
ob_start(); ob_start();
// Enterprise support. // Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php') === true) {
include_once ENTERPRISE_DIR.'/load_enterprise.php'; include_once ENTERPRISE_DIR.'/load_enterprise.php';
} }
@ -142,12 +144,12 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
); );
} }
if (is_metaconsole()) { if (is_metaconsole() === true) {
// Backward compatibility. // Backward compatibility.
define('METACONSOLE', true); define('METACONSOLE', true);
} }
if (file_exists($page)) { if (file_exists($page) === true) {
include_once $page; include_once $page;
} else { } else {
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>'; echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
@ -172,7 +174,7 @@ if (isset($config['force_instant_logout']) === true
header_remove('Set-Cookie'); header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if ($config['auth'] == 'saml') { if ($config['auth'] === 'saml') {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('PandoraFMS'); $as = new SimpleSAML_Auth_Simple('PandoraFMS');
$as->logout(); $as->logout();

View File

@ -196,6 +196,7 @@ function mainModuleGroups()
ON ta.id_agente = tam.id_agente ON ta.id_agente = tam.id_agente
WHERE ta.disabled = 0 WHERE ta.disabled = 0
AND tam.disabled = 0 AND tam.disabled = 0
AND tam.id_modulo <> 0
AND tam.delete_pending = 0 AND tam.delete_pending = 0
AND ta.id_grupo IN (%s) AND ta.id_grupo IN (%s)
GROUP BY tam.id_agente_modulo GROUP BY tam.id_agente_modulo

View File

@ -42,6 +42,10 @@ function pandora_realtime_graphs()
global $config; global $config;
check_login(); check_login();
if ($config['style'] === 'pandora_black') {
ui_require_css_file('pandora_black', 'include/styles/', true);
}
$id_network = get_parameter('id_network', 0); $id_network = get_parameter('id_network', 0);
$action = get_parameter('action', 'list'); $action = get_parameter('action', 'list');
@ -66,8 +70,8 @@ function pandora_realtime_graphs()
$long_index = []; $long_index = [];
$no_data_image = ''; $no_data_image = '';
$canvas = '<div id="graph_container">'; $canvas = '<div id="graph_container" class="graph_container">';
$canvas .= '<div id="chartLegend"></div>'; $canvas .= '<div id="chartLegend" class="chartLegend"></div>';
$width = 800; $width = 800;
$height = 300; $height = 300;
@ -239,7 +243,9 @@ function pandora_realtime_graphs()
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/pandora_snmp_browser.js').'"></script>'; echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/pandora_snmp_browser.js').'"></script>';
echo '<script type="text/javascript" src="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.js').'"></script>'; echo '<script type="text/javascript" src="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.js').'"></script>';
if ($config['style'] !== 'pandora_black') {
echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.css').'"></style>'; echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.css').'"></style>';
}
// Store servers timezone offset to be retrieved from js. // Store servers timezone offset to be retrieved from js.
set_js_value('timezone_offset', date('Z', time())); set_js_value('timezone_offset', date('Z', time()));

View File

@ -1096,9 +1096,14 @@ function resource_registration_extension_main()
} }
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA); $xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
if ($xml === false) {
ui_print_error_message(
__('Error uploading resource. Check if the selected file is a valid resource template in .ptr format')
);
} else {
process_upload_xml($xml); process_upload_xml($xml);
} }
}
extensions_add_godmode_menu_option(__('Resource registration'), 'PM', 'gagente', '', 'v1r1'); extensions_add_godmode_menu_option(__('Resource registration'), 'PM', 'gagente', '', 'v1r1');

View File

@ -74,7 +74,12 @@ enterprise/extensions/ipam
enterprise/extensions/disabled/visual_console_manager.php enterprise/extensions/disabled/visual_console_manager.php
enterprise/extensions/visual_console_manager.php enterprise/extensions/visual_console_manager.php
pandora_console/extensions/net_tools.php pandora_console/extensions/net_tools.php
enterprise/godmode/agentes/module_manager_editor_web.php
enterprise/include/ajax/web_server_module_debug.php
enterprise/include/class/WebServerModuleDebug.class.php
enterprise/include/styles/WebServerModuleDebug.css
include/lib/WSManager.php include/lib/WSManager.php
include/lib/WebSocketServer.php include/lib/WebSocketServer.php
include/lib/WebSocketUser.php include/lib/WebSocketUser.php
operation/network/network_explorer.php operation/network/network_explorer.php
operation/vsual_console/pure_ajax.php

View File

@ -20,10 +20,17 @@ ALTER TABLE `tevent_rule` MODIFY COLUMN `group_recursion` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT; ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT; ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT; ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring&#x20;Event"; UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring&#x20;Event";
UPDATE `tskin` SET `name` = 'Default&#x20;theme' , `relative_path` = 'pandora.css' WHERE `id` = 1; UPDATE `tskin` SET `name` = 'Default&#x20;theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
UPDATE `tskin` SET `name` = 'Black&#x20;theme' , `relative_path` = 'Black&#x20;theme' , `description` = 'Black&#x20;theme' WHERE `id` = 2; UPDATE `tskin` SET `name` = 'Black&#x20;theme' , `relative_path` = 'Black&#x20;theme' , `description` = 'Black&#x20;theme' WHERE `id` = 2;
UPDATE `tevent_rule` SET `criticity` = NULL, `operator_criticity` = NULL WHERE `criticity` = 99;
UPDATE `tevent_rule` SET `id_grupo` = NULL, `operator_id_grupo` = NULL WHERE `id_grupo` = 0;
UPDATE `tevent_rule` SET `id_tag` = NULL, `operator_id_tag` = NULL WHERE `id_tag` = 0;
UPDATE `tevent_rule` SET `operator_criticity` = '==' WHERE `criticity` != 99 AND `criticity` IS NOT NULL AND `criticity` != '';
UPDATE `tevent_rule` SET `operator_id_grupo` = '==' WHERE `id_grupo` != 0 AND `id_grupo` IS NOT NULL AND `id_grupo` != '';
UPDATE `tevent_rule` SET `operator_id_tag` = '==' WHERE `id_tag` != 0 AND `id_tag` IS NOT NULL AND `id_tag` != '';
COMMIT; COMMIT;

View File

@ -0,0 +1,24 @@
START TRANSACTION;
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60);
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45);
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`;
SET @st_oum755 = (SELECT IF(
(SELECT COUNT(*) FROM tconfig WHERE token LIKE 'meta_custom_logo' AND value like 'logo_pandora_metaconsola.png') > 0,
"UPDATE `tconfig` set value = 'pandoraFMS_metaconsole_full.svg' WHERE token LIKE 'meta_custom_logo'",
"SELECT 1"
));
PREPARE pr_oum755 FROM @st_oum755;
EXECUTE pr_oum755;
DEALLOCATE PREPARE pr_oum755;
COMMIT;

View File

@ -1019,7 +1019,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`); ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`);
ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`); ALTER TABLE `tmetaconsole_event` ADD INDEX `tme_timestamp_idx` (`timestamp`);
@ -1072,7 +1072,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_estado_idx` (`estado`); ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_estado_idx` (`estado`);
ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_timestamp_idx` (`timestamp`); ALTER TABLE `tmetaconsole_event_history` ADD INDEX `tmeh_timestamp_idx` (`timestamp`);
@ -1334,6 +1334,11 @@ ALTER TABLE talert_snmp_action ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp_action ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp_action ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field16` TEXT NOT NULL AFTER `al_field15`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field17` TEXT NOT NULL AFTER `al_field16`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field18` TEXT NOT NULL AFTER `al_field17`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field19` TEXT NOT NULL AFTER `al_field18`;
ALTER TABLE `talert_snmp_action` ADD COLUMN `al_field20` TEXT NOT NULL AFTER `al_field19`;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Table `tserver` -- Table `tserver`
@ -1506,6 +1511,7 @@ ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10); ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL; ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL; ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tusuario` -- Table `tusuario`
@ -1526,6 +1532,8 @@ ALTER TABLE `tusuario` MODIFY COLUMN `default_event_filter` int(10) unsigned NOT
ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT, ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT,
DROP FOREIGN KEY `fk_id_filter`, DROP FOREIGN KEY `fk_id_filter`,
DROP INDEX `fk_id_filter`; DROP INDEX `fk_id_filter`;
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_user` VARCHAR(60);
ALTER TABLE `tusuario` ADD COLUMN `integria_user_level_pass` VARCHAR(45);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1548,7 +1556,7 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `debug_content` varchar(200);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos` -- Table `tagente_datos`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente_datos MODIFY `datos` double(22,5); ALTER TABLE tagente_datos MODIFY `datos` double(50,5);
ALTER TABLE `tagente_datos` DROP INDEX `data_index1`, ADD INDEX `data_index1` (`id_agente_modulo`, `utimestamp`); ALTER TABLE `tagente_datos` DROP INDEX `data_index1`, ADD INDEX `data_index1` (`id_agente_modulo`, `utimestamp`);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1559,7 +1567,7 @@ ALTER TABLE `tagente_datos_string` MODIFY COLUMN `datos` mediumtext NOT NULL, DR
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos_inc` -- Table `tagente_datos_inc`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente_datos_inc MODIFY `datos` double(22,5); ALTER TABLE tagente_datos_inc MODIFY `datos` double(50,5);
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tnetwork_component` -- Table `tnetwork_component`
@ -2333,7 +2341,7 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tevento` -- Table `tevento`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tevento` ADD COLUMN `data` double(50,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0'; ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
@ -4024,3 +4032,6 @@ DELETE FROM `tconfig` WHERE `token` = 'ipam_installed';
DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id'; DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id';
ALTER TABLE `tperfil` DROP COLUMN `incident_view`;
ALTER TABLE `tperfil` DROP COLUMN `incident_edit`;
ALTER TABLE `tperfil` DROP COLUMN `incident_management`;

View File

@ -53,8 +53,8 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
<?php <?php
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
echo "<div id='create_master_window' class='invisible'></div>"; echo "<div id='create_master_window' style='display: none'></div>";
echo "<div id='msg' class='invisible'></div>"; echo "<div id='msg' style='display: none'></div>";
?> ?>
<input onclick="show_create_ha_cluster();" type="submit" class="button_task ui_toggle" value="<?php echo __('Add new node'); ?>" /> <input onclick="show_create_ha_cluster();" type="submit" class="button_task ui_toggle" value="<?php echo __('Add new node'); ?>" />
<?php <?php

View File

@ -15,14 +15,14 @@ global $config;
check_login(); check_login();
ui_require_css_file('first_task'); ui_require_css_file('first_task');
?> ?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no planned downtime defined yet.') ]); ?> <?php ui_print_info_message(['no_close' => true, 'message' => __('There are no scheduled downtime defined yet.') ]); ?>
<div class="new_task"> <div class="new_task">
<div class="image_task"> <div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?> <?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div> </div>
<div class="text_task"> <div class="text_task">
<h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task"> <h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<?php <?php
echo __( echo __(
"%s contains a scheduled downtime management system. "%s contains a scheduled downtime management system.
@ -34,7 +34,7 @@ ui_require_css_file('first_task');
?> ?>
</p> </p>
<form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post"> <form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" /> <input type="submit" class="button_task" value="<?php echo __('Create Scheduled Downtime'); ?>" />
</form> </form>
</div> </div>
</div> </div>

View File

@ -88,7 +88,6 @@ if (check_acl($config['id_user'], 0, 'AW')
|| check_acl($config['id_user'], 0, 'LM') || check_acl($config['id_user'], 0, 'LM')
|| check_acl($config['id_user'], 0, 'UM') || check_acl($config['id_user'], 0, 'UM')
|| check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LW')
|| check_acl($config['id_user'], 0, 'IW')
|| check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EW')
|| check_acl($config['id_user'], 0, 'DW') || check_acl($config['id_user'], 0, 'DW')
) { ) {

View File

@ -39,7 +39,7 @@ $offset = (int) get_parameter('offset', 0);
// See if id_agente is set (either POST or GET, otherwise -1 // See if id_agente is set (either POST or GET, otherwise -1
$id_agent = (int) get_parameter('id_agente'); $id_agent = (int) get_parameter('id_agente');
$groups = users_get_groups($config['id_user'], 'IR'); $groups = users_get_groups($config['id_user'], 'AR');
$filter = ' AND id_agent = '.$id_agent; $filter = ' AND id_agent = '.$id_agent;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent; $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
@ -55,7 +55,7 @@ $params = [
agents_get_name($id_agent), agents_get_name($id_agent),
]; ];
$result = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents', $params, false, 'json', ','); $result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true); $result = json_decode($result, true);

View File

@ -1004,9 +1004,9 @@ echo '<div class="action-buttons agent_manager" style="width: '.$table->width.'"
// The context help about the learning mode. // The context help about the learning mode.
if ($modo == 0) { if ($modo == 0) {
echo "<span id='modules_not_learning_mode_context_help pdd_r_10px' '>"; echo "<span id='modules_not_learning_mode_context_help' class='pdd_r_10px'>";
} else { } else {
echo "<span id='modules_not_learning_mode_context_help invisible'>"; echo "<span id='modules_not_learning_mode_context_help' class='invisible'>";
} }
echo clippy_context_help('modules_not_learning_mode'); echo clippy_context_help('modules_not_learning_mode');

View File

@ -746,9 +746,9 @@ if ($agents !== false) {
if ($in_planned_downtime) { if ($in_planned_downtime) {
ui_print_help_tip( ui_print_help_tip(
__('Agent in planned downtime'), __('Agent in scheduled downtime'),
false, false,
$config['image']['minireloj_16'] 'images/minireloj-16.png'
); );
echo '</em>'; echo '</em>';

View File

@ -1,22 +1,38 @@
<?php <?php
/**
* Module Manager main script.
*
* @category Module
* @package Pandora FMS
* @subpackage Agent Configuration
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // You can redefine $url and unset $id_agente to reuse the form. Dirty (hope temporal) hack.
// ================================================== $url_id_agente = (isset($id_agente) === true) ? '&id_agente='.$id_agente : '';
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list $url = sprintf(
// This program is free software; you can redistribute it and/or 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module%s',
// modify it under the terms of the GNU General Public License $url_id_agente
// as published by the Free Software Foundation for version 2. );
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You can redefine $url and unset $id_agente to reuse the form. Dirty (hope temporal) hack
if (isset($id_agente)) {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente;
} else {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module';
}
enterprise_include('godmode/agentes/module_manager.php'); enterprise_include('godmode/agentes/module_manager.php');
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
@ -56,7 +72,7 @@ echo __('Search').' '.html_print_input_text(
); );
html_print_input_hidden('search', 1); html_print_input_hidden('search', 1);
// Search string filter form. // Search string filter form.
if (($policy_page) || (isset($agent))) { if (($policy_page !== false) || (isset($agent) === true)) {
echo '<form id="" method="post" action="">'; echo '<form id="" method="post" action="">';
} else { } else {
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
@ -73,25 +89,31 @@ echo '</form>';
$network_available = db_get_sql( $network_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
FROM tserver FROM tserver
WHERE server_type = 1' WHERE server_type = '.SERVER_TYPE_NETWORK
); );
// POSTGRESQL AND ORACLE COMPATIBLE. // POSTGRESQL AND ORACLE COMPATIBLE.
$wmi_available = db_get_sql( $wmi_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
FROM tserver FROM tserver
WHERE server_type = 6' WHERE server_type = '.SERVER_TYPE_WMI
); );
// POSTGRESQL AND ORACLE COMPATIBLE. // POSTGRESQL AND ORACLE COMPATIBLE.
$plugin_available = db_get_sql( $plugin_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
FROM tserver FROM tserver
WHERE server_type = 4' WHERE server_type = '.SERVER_TYPE_PLUGIN
); );
// POSTGRESQL AND ORACLE COMPATIBLE. // POSTGRESQL AND ORACLE COMPATIBLE.
$prediction_available = db_get_sql( $prediction_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
FROM tserver FROM tserver
WHERE server_type = 5' WHERE server_type = '.SERVER_TYPE_PREDICTION
);
// POSTGRESQL AND ORACLE COMPATIBLE.
$web_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_WEB
); );
// POSTGRESQL AND ORACLE COMPATIBLE. // POSTGRESQL AND ORACLE COMPATIBLE.
// Development mode to use all servers. // Development mode to use all servers.
@ -122,6 +144,10 @@ if ($prediction_available) {
$modules['predictionserver'] = __('Create a new prediction server module'); $modules['predictionserver'] = __('Create a new prediction server module');
} }
if ($web_available) {
$modules['webserver'] = __('Create a new web Server module');
}
if (enterprise_installed()) { if (enterprise_installed()) {
set_enterprise_module_types($modules); set_enterprise_module_types($modules);
} }
@ -298,6 +324,7 @@ if ($module_action === 'delete') {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
default:
$result = db_process_sql_delete( $result = db_process_sql_delete(
'tagente_estado', 'tagente_estado',
['id_agente_modulo' => $id_agent_module_del] ['id_agente_modulo' => $id_agent_module_del]
@ -388,10 +415,8 @@ if ($module_action === 'delete') {
} }
} }
// Check for errors. // Check for errors.
if ($error != 0) { if ((int) $error == 0) {
} else {
$count_correct_delete_modules++; $count_correct_delete_modules++;
} }
} }
@ -489,6 +514,7 @@ switch ($sortField) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
default:
$order[] = [ $order[] = [
'field' => 'tagente_modulo.nombre', 'field' => 'tagente_modulo.nombre',
'order' => 'ASC', 'order' => 'ASC',
@ -509,6 +535,7 @@ switch ($sortField) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
default:
$order[] = [ $order[] = [
'field' => 'tagente_modulo.nombre', 'field' => 'tagente_modulo.nombre',
'order' => 'DESC', 'order' => 'DESC',
@ -523,6 +550,10 @@ switch ($sortField) {
break; break;
} }
break; break;
default:
// Do none.
break;
} }
break; break;
@ -543,6 +574,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Do none.
break;
} }
break; break;
@ -563,6 +598,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Do none.
break;
} }
break; break;
@ -583,6 +622,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Do none.
break;
} }
break; break;
@ -598,6 +641,7 @@ switch ($sortField) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
default:
$order[] = [ $order[] = [
'field' => 'nombre', 'field' => 'nombre',
'order' => 'ASC', 'order' => 'ASC',
@ -622,7 +666,7 @@ if (!empty($order)) {
$first = true; $first = true;
foreach ($order as $ord) { foreach ($order as $ord) {
if ($first) { if ($first === true) {
$first = false; $first = false;
} else { } else {
$order_sql .= ','; $order_sql .= ',';
@ -635,7 +679,10 @@ foreach ($order as $ord) {
$limit = (int) $config['block_size']; $limit = (int) $config['block_size'];
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$params = ($checked) ? 'tagente_modulo.*, tmodule_group.*' : implode( if ((bool) $checked === true) {
$params = 'tagente_modulo.*, tmodule_group.*';
} else {
$params = implode(
',', ',',
[ [
'tagente_modulo.id_agente_modulo', 'tagente_modulo.id_agente_modulo',
@ -660,6 +707,7 @@ $params = ($checked) ? 'tagente_modulo.*, tmodule_group.*' : implode(
'id_policy_module', 'id_policy_module',
] ]
); );
}
$where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente); $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
@ -686,7 +734,11 @@ if (isset($config['paginate_module'])) {
if ($paginate_module) { if ($paginate_module) {
if (!isset($limit_sql)) { if (!isset($limit_sql)) {
$limit_sql = " LIMIT $offset, $limit "; $limit_sql = sprintf(
'LIMIT %s, %s',
$offset,
$limit
);
} }
} else { } else {
$limit_sql = ''; $limit_sql = '';
@ -732,7 +784,13 @@ if ($modules === false) {
} }
// Prepare pagination. // Prepare pagination.
$url = '?'.'sec=gagente&'.'tab=module&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$id_agente.'&'.'sort_field='.$sortField.'&'.'&sort='.$sort.'&'.'search_string='.urlencode($search_string); $url = sprintf(
'?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=%s&sort_field=%s&sort=%s&search_string=%s',
$id_agente,
$sortField,
$sort,
urlencode($search_string)
);
if ($paginate_module) { if ($paginate_module) {
ui_pagination($total_modules, $url); ui_pagination($total_modules, $url);
@ -1072,6 +1130,7 @@ foreach ($modules as $module) {
[ [
'alt' => __('Enable module'), 'alt' => __('Enable module'),
'title' => __('Enable module'), 'title' => __('Enable module'),
'class' => 'invert_filter_important',
] ]
).'</a>'; ).'</a>';
} else { } else {

View File

@ -682,6 +682,22 @@ switch ($moduletype) {
include 'module_manager_editor_wmi.php'; include 'module_manager_editor_wmi.php';
break; break;
case 'webserver':
case MODULE_WEB:
$moduletype = MODULE_WEB;
// Remove content of $ip_target when it is ip_agent because
// it is used as HTTP auth (server) ....ONLY IN NEW MODULE!!!
if (empty($id_agent_module)
&& ($ip_target === agents_get_address($id_agente))
) {
$ip_target = '';
}
$categories = [9];
include 'module_manager_editor_common.php';
include 'module_manager_editor_web.php';
break;
// WARNING: type 7 is reserved on enterprise. // WARNING: type 7 is reserved on enterprise.
default: default:
if (enterprise_include( if (enterprise_include(

View File

@ -115,7 +115,12 @@ function add_component_selection($id_network_component_type)
'', '',
'---'.__('Manual setup').'---', '---'.__('Manual setup').'---',
0, 0,
true true,
false,
true,
'',
false,
'width: 460px; '
); );
$data[1] .= '</span>'; $data[1] .= '</span>';
$data[1] .= ' <span id="component_loading" class="invisible">'; $data[1] .= ' <span id="component_loading" class="invisible">';
@ -1569,10 +1574,6 @@ $(document).ready (function () {
}); });
disabled_two_tailed(disabledBecauseInPolicy); disabled_two_tailed(disabledBecauseInPolicy);
$('#checkbox-dynamic_two_tailed').change (function() {
disabled_two_tailed(disabledBecauseInPolicy);
});
//Dynamic_options_advance; //Dynamic_options_advance;
$('.hide_dinamic').hide(); $('.hide_dinamic').hide();
@ -1641,15 +1642,10 @@ function disabled_status (disabledBecauseInPolicy) {
} }
function disabled_two_tailed (disabledBecauseInPolicy) { function disabled_two_tailed (disabledBecauseInPolicy) {
if($('#checkbox-dynamic_two_tailed').prop('checked')){ if (disabledBecauseInPolicy == 1){
$('#text-dynamic_max').prop('readonly', false); $('#text-dynamic_max')
$('#text-dynamic_max').removeClass('readonly'); .prop('readonly', true)
} .addClass('readonly');
else{
if (disabledBecauseInPolicy == 0){
$('#text-dynamic_max').prop('readonly', true);
$('#text-dynamic_max').addClass('readonly');
}
} }
} }

View File

@ -0,0 +1,469 @@
<?php
/**
* Web Module Editor for Module Manager.
*
* @category Module manager
* @package Pandora FMS
* @subpackage Module manager
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
enterprise_include_once('include/functions_policies.php');
$disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
$classdisabledBecauseInPolicy = '';
$page = get_parameter('page', '');
if (strstr($page, 'policy_modules') === false) {
if ($config['enterprise_installed']) {
if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1;
} else {
$disabledBecauseInPolicy = 0;
}
} else {
$disabledBecauseInPolicy = false;
}
if ($disabledBecauseInPolicy) {
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
$classdisabledBecauseInPolicy = 'readonly';
}
}
global $id_agente;
$extra_title = __('Web server module');
// Div for modal.
html_print_div(
[
'id' => 'modal',
'style' => 'display: none;',
]
);
require_once $config['homedir'].'/include/ajax/web_server_module_debug.php';
define('ID_NETWORK_COMPONENT_TYPE', 7);
if (!$tcp_port && !$id_agent_module) {
$tcp_port = 80;
}
// plugin_server is the browser id
if ($plugin_user == '' && !$id_agent_module) {
$plugin_user = get_product_name().' / Webcheck';
}
// plugin_server is the referer
if ($plugin_pass == '' && !$id_agent_module) {
$plugin_pass = 1;
}
if (empty($update_module_id)) {
// Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else {
// TODO: Print network component if available
}
$data = [];
$data[0] = __('Web checks');
$adopt = false;
if (isset($id_agent_module)) {
$adopt = enterprise_hook('policies_is_module_adopt', [$id_agent_module]);
}
$id_policy_module = (int) get_parameter('id_policy_module', '');
if ($id_policy_module) {
$module = enterprise_hook('policies_get_module', [$id_policy_module]);
$plugin_parameter = $module['plugin_parameter'];
}
if ((bool) $adopt === false) {
$data[1] = html_print_textarea(
'plugin_parameter',
15,
65,
$plugin_parameter,
$disabledTextBecauseInPolicy,
true,
'resizev'
);
} else {
$data[1] = html_print_textarea(
'plugin_parameter',
15,
65,
$plugin_parameter,
false,
true
);
}
$table_simple->colspan['web_checks'][1] = 2;
// Disable debug button if module has not started.
if ($id_agent_module > 0
&& db_get_value_filter(
'debug_content',
'tagente_modulo',
['id_agente_modulo' => $id_agent_module]
) !== null
) {
$disableDebug = false;
$hintDebug = __('Debug remotely this module');
} else {
$disableDebug = true;
$hintDebug = __('Debug this module once it has been initialized');
}
$suc_err_check = ' <span id="check_conf_suc" class="checks invisible">'.html_print_image('/images/ok.png', true).'</span>';
$suc_err_check .= ' <span id="check_conf_err" class="checks invisible">'.html_print_image('/images/error_red.png', true).'</span>';
$data[2] = html_print_button(
__('Load basic'),
'btn_loadbasic',
false,
'',
'class="sub config"',
true
).ui_print_help_tip(__('Load a basic structure on Web Checks'), true);
$data[2] .= '<br><br>'.html_print_button(
__('Check'),
'btn_checkconf',
false,
'',
'class="sub upd"',
true
).ui_print_help_tip(__('Check the correct structure of the WebCheck'), true).$suc_err_check;
$data[2] .= '<br><br>'.html_print_button(
__('Debug'),
'btn_debugModule',
$disableDebug,
'',
'class="sub config" onClick="loadDebugWindow()"',
true
).ui_print_help_tip($hintDebug, true);
push_table_simple($data, 'web_checks');
$http_checks_type = [
0 => 'Anyauth',
1 => 'NTLM',
2 => 'DIGEST',
3 => 'BASIC',
];
$data = [];
$data[0] = __('Check type');
$data[1] = html_print_select($http_checks_type, 'tcp_port', $tcp_port, false, '', '', true, false, false);
push_table_advanced($data, 'web_0');
$data = [];
$data[0] = __('Requests');
$data[1] = html_print_input_text('plugin_pass', $plugin_pass, '', 10, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$data[2] = '';
$data[3] = __('Agent browser id');
$data[4] = html_print_input_text('plugin_user', $plugin_user, '', 30, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
push_table_advanced($data, 'web_1');
$data = [];
$data[0] = __('HTTP auth (login)');
$data[1] = html_print_input_text('http_user', $plugin_parameter_http_user, '', 10, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$data[2] = '';
$data[3] = __('HTTP auth (password)');
$data[4] = html_print_input_password('http_pass', $plugin_parameter_http_pass, '', 30, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
push_table_advanced($data, 'web_2');
$data = [];
$data[0] = __('Proxy URL');
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 30, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$data[2] = $data[3] = $data[4] = '';
push_table_advanced($data, 'web_3');
$data = [];
$data[0] = __('Proxy auth (login)');
$data[1] = html_print_input_text('tcp_send', $tcp_send, '', 30, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$data[2] = '';
$data[3] = __('Proxy auth (pass)');
$data[4] = html_print_input_password('tcp_rcv', $tcp_rcv, '', 30, 0, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
push_table_advanced($data, 'web_4');
$data = [];
$data[0] = __('Proxy auth (server)');
$data[1] = html_print_input_text('ip_target', $ip_target, '', 30, 100, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
$data[2] = '';
$data[3] = __('Proxy auth (realm)');
$data[4] = html_print_input_text('snmp_community', $snmp_community, '', 30, 100, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
push_table_advanced($data, 'web_5');
// Add some strings to be used from javascript
$texts = [
'lines_before_begin' => __('First line must be "task_begin"'),
'missed_begin' => __('Webchecks configuration is empty'),
'missed_end' => __('Last line must be "task_end"'),
'lines_after_end' => __('Last line must be "task_end"'),
'unknown_token' => __("There is a line with a unknown token 'token_fail'."),
'missed_get_post' => __("There isn't get or post"),
'correct' => __('Web checks are built correctly'),
];
foreach ($texts as $code => $text) {
echo '<span class="invisible" id="'.$code.'">'.$text.'</span>';
}
?>
<script type="text/javascript">
var supported_tokens = [
"task_begin",
"post",
"variable_name",
"variable_value",
"cookie",
"resource",
"get",
"check_string",
"check_not_string",
"get_content_advanced",
"get_content",
"debug",
"task_end",
"head",
"http_auth_user",
"http_auth_pass"
];
$(document).ready(function() {
var plugin_parameter = $("#textarea_plugin_parameter");
var http_auth_user = $('#text-http_user');
var http_auth_pass = $('#password-http_pass');
$(plugin_parameter).keyup(function() {
// Check and fill textbox.
if ($(plugin_parameter).val() == '') {
$('#button-btn_loadbasic').removeAttr('disabled');
} else {
$('#button-btn_loadbasic').attr('disabled', 'disabled');
}
// Update http_auth_user from conf data
var http_auth_user_value = get_module_token_from_config('http_auth_user', plugin_parameter, "\n");
if (http_auth_user_value != "") {
http_auth_user.val(http_auth_user_value);
}
// Update http_auth_pass from conf data
var http_auth_pass_value = get_module_token_from_config('http_auth_pass', plugin_parameter, "\n");
if (http_auth_pass_value != "") {
http_auth_pass.val(http_auth_pass_value);
}
});
$('#button-btn_loadbasic').click(function() {
if ($(plugin_parameter).val() != '') {
return;
}
$(plugin_parameter).val(
'task_begin\ncookie 0\nresource 0\ntask_end');
$('#button-btn_loadbasic').attr('disabled', 'disabled');
// Hide success and error indicators
$('.checks').hide();
});
$('#button-btn_checkconf').click(function() {
var msg_error = '';
if (plugin_parameter.val() == '') {
msg_error = 'missed_begin';
} else {
var lines = plugin_parameter.val().split("\n");
var started = false;
var ended = false;
var lines_after_end = false;
var lines_before_begin = false;
var token_fail = false;
var token_get_post = false;
var token_check = true;
var str_token_fail = '';
for (i = 0; i < lines.length; i++) {
if (lines[i].match(/^\s*$/)) {
// Empty line
continue;
} else if (!started) {
if (lines[i].match(/^task_begin\s*$/)) {
started = true;
} else {
// Found a not empty line before task_begin
lines_before_begin = true;
break;
}
}
if (lines[i].match(/^task_end\s*$/)) {
ended = true;
continue;
}
//Check token is correct
if (!lines[i].match(/^([\s])*[#]/)) {
var token = lines[i].match(/^([^\s]+)\s*/);
if (typeof(token) == 'object') {
token = token[1];
if ((!token_get_post) && (token == 'get' || token == 'post' || token == 'header')) {
token_get_post = true;
continue;
}
if (token == 'check_string') {
if (token_get_post) {
token_check = true;
continue;
} else {
token_check = false;
continue;
}
}
if ($.inArray(token, supported_tokens) == -1) {
token_fail = true;
str_token_fail = token;
break;
}
}
}
}
}
var msg_error = '';
if (token_fail) {
var temp_msg = $("#unknown_token").html();
temp_msg = temp_msg.replace(/['](.*)[']/, "'" + str_token_fail + "'");
$("#unknown_token").html(temp_msg);
msg_error = 'unknown_token';
} else if (lines_before_begin) {
msg_error = 'lines_before_begin';
} else if (!started) {
msg_error = 'missed_begin';
} else if (!ended) {
msg_error = 'missed_end';
} else if (lines_after_end) {
msg_error = 'lines_after_end';
} else if (!token_check) {
msg_error = 'missed_get_post';
} else {
msg_error = 'correct';
}
if (msg_error == 'correct') {
$('#check_conf_suc').find('img').eq(0)
.attr('title', $('#' + msg_error).html());
$('#check_conf_err').hide();
$('#check_conf_suc').show();
} else {
$('#check_conf_err').find('img').eq(0)
.attr('title', $('#' + msg_error).html());
$('#check_conf_suc').hide();
$('#check_conf_err').show();
}
});
$(plugin_parameter).trigger('keyup');
http_auth_user.keyup(function() {
config = plugin_parameter.val();
if (config.search("http_auth_user") == -1) {
var http_auth_user_end =
"http_auth_user " + this.value + "\n" + "task_end" + "\n";
plugin_parameter.val(config.replace(/^task_end.*$/m, http_auth_user_end));
} else {
plugin_parameter.val(
config.replace(/^http_auth_user.*$/m, "http_auth_user " + this.value)
);
// Hide success and error indicators
$(".checks").hide();
}
});
http_auth_pass.keyup(function() {
config = plugin_parameter.val();
if (config.search("http_auth_pass") == -1) {
var http_auth_pass_end =
"http_auth_pass " + this.value + "\n" + "task_end" + "\n";
plugin_parameter.val(config.replace(/^task_end.*$/m, http_auth_pass_end));
} else {
plugin_parameter.val(
config.replace(/^http_auth_pass.*$/m, "http_auth_pass " + this.value)
);
// Hide success and error indicators
$(".checks").hide();
}
});
});
function get_module_token_from_config(token_name, plugin_parameter, separator) {
var return_var = "";
if(token_name == null || token_name == '') {
return '';
}
data = plugin_parameter.val().split(separator);
len = data.length;
for (i = 0; i < len; i++) {
if (data[i][0] == "#") continue;
tokens = data[i].split(" ");
if (tokens.length == 0) continue;
token = tokens.shift();
if (token == token_name ) return_var = tokens.join(" ");
}
return_var = $.trim(return_var);
return return_var;
}
</script>

View File

@ -64,7 +64,7 @@ $buttons = [
// Header. // Header.
ui_print_page_header( ui_print_page_header(
__('Planned Downtime'), __('Scheduled Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
false, false,
'', '',
@ -308,12 +308,12 @@ if ($create_downtime || $update_downtime) {
); );
} else { } else {
ui_print_error_message( ui_print_error_message(
__('Each planned downtime must have a different name') __('Each scheduled downtime must have a different name')
); );
} }
} else { } else {
ui_print_error_message( ui_print_error_message(
__('Planned downtime must have a name') __('Scheduled downtime must have a name')
); );
} }
} else if ($update_downtime) { } else if ($update_downtime) {
@ -345,7 +345,7 @@ if ($create_downtime || $update_downtime) {
$values = []; $values = [];
if (trim(io_safe_output($name)) == '') { if (trim(io_safe_output($name)) == '') {
ui_print_error_message( ui_print_error_message(
__('Planned downtime must have a name') __('Scheduled downtime must have a name')
); );
} }
@ -1489,14 +1489,14 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(this).css ("width", "180px"); $(this).css ("width", "180px");
}); });
// Warning message about the problems caused updating a past planned downtime // Warning message about the problems caused updating a past scheduled downtime
var type_execution = "<?php echo $type_execution; ?>"; var type_execution = "<?php echo $type_execution; ?>";
var datetime_from = <?php echo json_encode(strtotime($once_date_from.' '.$once_time_from)); ?>; var datetime_from = <?php echo json_encode(strtotime($once_date_from.' '.$once_time_from)); ?>;
var datetime_now = <?php echo json_encode($utimestamp); ?>; var datetime_now = <?php echo json_encode($utimestamp); ?>;
var create = <?php echo json_encode($create); ?>; var create = <?php echo json_encode($create); ?>;
if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) { if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) {
$("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) { $("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you edit this planned downtime, the data of future SLA reports may be altered'); ?>")) { if (!confirm("<?php echo __('WARNING: If you edit this scheduled downtime, the data of future SLA reports may be altered'); ?>")) {
e.preventDefault(); e.preventDefault();
} }
}); });

View File

@ -196,5 +196,5 @@ if (!empty($downtimes)) {
echo chr(13); echo chr(13);
} }
} else { } else {
echo '<div class="nf">'.__('No planned downtime').'</div>'; echo '<div class="nf">'.__('No scheduled downtime').'</div>';
} }

View File

@ -44,7 +44,7 @@ if ($migrate_malformed) {
if ($migration_result['status'] == false) { if ($migration_result['status'] == false) {
ui_print_error_message( ui_print_error_message(
__('An error occurred while migrating the malformed planned downtimes').'. '.__('Please run the migration again or contact with the administrator') __('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
); );
echo '<br>'; echo '<br>';
} }
@ -80,7 +80,7 @@ if ($stop_downtime) {
$result = planned_downtimes_stop($downtime); $result = planned_downtimes_stop($downtime);
if ($result === false) { if ($result === false) {
ui_print_error_message(__('An error occurred stopping the planned downtime')); ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
} else { } else {
echo $result['message']; echo $result['message'];
} }
@ -103,7 +103,7 @@ if ($delete_downtime) {
// The downtime shouldn't be running!! // The downtime shouldn't be running!!
if ($downtime['executed']) { if ($downtime['executed']) {
ui_print_error_message(__('This planned downtime is running')); ui_print_error_message(__('This scheduled downtime is running'));
} else { } else {
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]); $result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
@ -362,7 +362,7 @@ else if (!$downtimes) {
echo '</form>'; echo '</form>';
// Info message. // Info message.
echo '<div class="nf">'.__('No planned downtime').'</div>'; echo '<div class="nf">'.__('No scheduled downtime').'</div>';
echo '<div class="action-buttons w100p" >'; echo '<div class="action-buttons w100p" >';
@ -572,13 +572,13 @@ $(document).ready (function () {
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("a#delete_downtime").click(function (e) { $("a#delete_downtime").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you delete this planned downtime, it will not be taken into account in future SLA reports'); ?>")) { if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
e.preventDefault(); e.preventDefault();
} }
}); });
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) { if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) { if (confirm("<?php echo __('WARNING: There are malformed scheduled downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1"; window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
} }
} }

View File

@ -469,4 +469,3 @@ if (is_central_policies_on_node() === false) {
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?>

View File

@ -43,7 +43,7 @@ if (is_ajax()) {
if ($get_integria_ticket_custom_types) { if ($get_integria_ticket_custom_types) {
$ticket_type_id = get_parameter('ticket_type_id'); $ticket_type_id = get_parameter('ticket_type_id');
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_fields', $ticket_type_id, false, 'json'); $api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json');
echo $api_call; echo $api_call;
return; return;
@ -91,6 +91,7 @@ if ($al_action !== false) {
true true
); );
} }
$is_in_group = true; $is_in_group = true;
} }
@ -177,7 +178,7 @@ $table->data[0][1] = html_print_input_text(
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
if (io_safe_output($name) == 'Monitoring Event') { if (io_safe_output($name) == 'Monitoring Event') {
@ -213,7 +214,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false, false,
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
).'</div>'; ).'</div>';
$table->colspan[1][1] = 2; $table->colspan[1][1] = 2;
@ -247,7 +248,7 @@ $table->data[2][1] = html_print_select_from_sql(
true, true,
false, false,
false, false,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[2][1] .= ' '; $table->data[2][1] .= ' ';
if ($is_central_policies_on_node === false if ($is_central_policies_on_node === false
@ -274,7 +275,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
false, false,
true, true,
'', '',
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
false, false,
'', '',
false, false,
@ -306,11 +307,21 @@ $table->data[5][2] = html_print_textarea(
true true
); );
$table->data[6][0] = __('Create workunit on recovery').ui_print_help_tip( // Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table->data[$integriaIdName][0] = __('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
true true
); );
$table->data[6][1] = html_print_checkbox_switch_extended('create_wu_integria', 1, $create_wu_integria, false, '', $disabled_attr, true); $table->data[$integriaIdName][1] = html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = html_print_image( $table->data['field'.$i][0] = html_print_image(
@ -344,7 +355,7 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
} }
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'">';
$table_html = html_print_table($table, true); $table_html = html_print_table($table, true);
echo $table_html; echo $table_html;
@ -392,6 +403,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
$(document).ready (function () { $(document).ready (function () {
var original_command; var original_command;
var origicommand_descriptionnal_command; var origicommand_descriptionnal_command;
var integriaWorkUnitName = "<?php echo $integriaIdName; ?>";
if (<?php echo (int) $id_command; ?>) { if (<?php echo (int) $id_command; ?>) {
original_command = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_command($id_command)))); ?>"; original_command = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_command($id_command)))); ?>";
@ -593,6 +605,13 @@ $(document).ready (function () {
} }
// Allow create workunit if Integria IMS Ticket is selected.
if (data['id'] == '14') {
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
} else {
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
}
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>'); var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
// Change the selected group // Change the selected group

View File

@ -609,7 +609,7 @@ if ($step == 2) {
1, 1,
$monday, $monday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Tue'); $table->data[0][1] .= __('Tue');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -617,7 +617,7 @@ if ($step == 2) {
1, 1,
$tuesday, $tuesday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Wed'); $table->data[0][1] .= __('Wed');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -625,7 +625,7 @@ if ($step == 2) {
1, 1,
$wednesday, $wednesday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Thu'); $table->data[0][1] .= __('Thu');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -633,7 +633,7 @@ if ($step == 2) {
1, 1,
$thursday, $thursday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Fri'); $table->data[0][1] .= __('Fri');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -641,7 +641,7 @@ if ($step == 2) {
1, 1,
$friday, $friday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Sat'); $table->data[0][1] .= __('Sat');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -649,7 +649,7 @@ if ($step == 2) {
1, 1,
$saturday, $saturday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][1] .= __('Sun'); $table->data[0][1] .= __('Sun');
$table->data[0][1] .= html_print_checkbox( $table->data[0][1] .= html_print_checkbox(
@ -657,7 +657,7 @@ if ($step == 2) {
1, 1,
$sunday, $sunday,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[0][2] = __('Use special days list'); $table->data[0][2] = __('Use special days list');
@ -666,7 +666,7 @@ if ($step == 2) {
1, 1,
$special_day, $special_day,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[1][0] = __('Time from'); $table->data[1][0] = __('Time from');
@ -687,7 +687,7 @@ if ($step == 2) {
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[1][2] = __('Time to'); $table->data[1][2] = __('Time to');
$table->data[1][3] = html_print_input_text( $table->data[1][3] = html_print_input_text(
@ -707,7 +707,7 @@ if ($step == 2) {
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->colspan['threshold'][1] = 3; $table->colspan['threshold'][1] = 3;
@ -723,7 +723,7 @@ if ($step == 2) {
false, false,
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[3][0] = __('Min. number of alerts'); $table->data[3][0] = __('Min. number of alerts');
@ -744,7 +744,7 @@ if ($step == 2) {
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[3][2] = __('Reset counter for non-sustained alerts'); $table->data[3][2] = __('Reset counter for non-sustained alerts');
@ -757,7 +757,7 @@ if ($step == 2) {
1, 1,
$min_alerts_reset_counter, $min_alerts_reset_counter,
true, true,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
'', '',
false, false,
$create_template == 1 ? 'checked=checked' : '' $create_template == 1 ? 'checked=checked' : ''
@ -781,7 +781,7 @@ if ($step == 2) {
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[4][2] = __('Disable event'); $table->data[4][2] = __('Disable event');
@ -790,7 +790,7 @@ if ($step == 2) {
1, 1,
$disable_event, $disable_event,
true, true,
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[5][0] = __('Default action'); $table->data[5][0] = __('Default action');
@ -818,7 +818,7 @@ if ($step == 2) {
true, true,
false, false,
false, false,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
false, false,
false, false,
0 0
@ -840,7 +840,7 @@ if ($step == 2) {
false, false,
false, false,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>'; $table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
$table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true); $table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
@ -949,7 +949,7 @@ if ($step == 2) {
false, false,
false, false,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->colspan[0][1] = 2; $table->colspan[0][1] = 2;
@ -975,7 +975,7 @@ if ($step == 2) {
0, 0,
'', '',
false, false,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
"removeTinyMCE('textarea_field".$i."')", "removeTinyMCE('textarea_field".$i."')",
'', '',
true true
@ -988,7 +988,7 @@ if ($step == 2) {
0, 0,
'', '',
true, true,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
"addTinyMCE('textarea_field".$i."')", "addTinyMCE('textarea_field".$i."')",
'', '',
true true
@ -1004,7 +1004,7 @@ if ($step == 2) {
'class="fields" min-height-40px', 'class="fields" min-height-40px',
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
// Recovery. // Recovery.
@ -1016,7 +1016,7 @@ if ($step == 2) {
0, 0,
'', '',
false, false,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
"removeTinyMCE('textarea_field".$i."_recovery')", "removeTinyMCE('textarea_field".$i."_recovery')",
'', '',
true true
@ -1029,7 +1029,7 @@ if ($step == 2) {
0, 0,
'', '',
true, true,
$is_central_policies_on_node | $disabled, ($is_central_policies_on_node | $disabled),
"addTinyMCE('textarea_field".$i."_recovery')", "addTinyMCE('textarea_field".$i."_recovery')",
'', '',
true true
@ -1045,7 +1045,7 @@ if ($step == 2) {
'class="fields min-height-40px"', 'class="fields min-height-40px"',
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
} }
} else { } else {
@ -1102,7 +1102,7 @@ if ($step == 2) {
'', '',
'', '',
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
@ -1134,7 +1134,7 @@ if ($step == 2) {
false, false,
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
).'</div>'; ).'</div>';
@ -1147,7 +1147,7 @@ if ($step == 2) {
'', '',
true, true,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
$table->data[2][0] = __('Priority'); $table->data[2][0] = __('Priority');
@ -1162,7 +1162,7 @@ if ($step == 2) {
false, false,
false, false,
'', '',
$is_central_policies_on_node | $disabled ($is_central_policies_on_node | $disabled)
); );
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {

View File

@ -200,11 +200,7 @@ $table->data[5] = $data;
if ($event_response_id == 0) { if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right_align">'; echo '<div class="w100p right_align">';
} else {
echo '<div class="w100p right">';
}
html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']); html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']);
echo '</div>'; echo '</div>';
@ -212,11 +208,7 @@ if ($event_response_id == 0) {
} else { } else {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right_align">'; echo '<div class="w100p right_align">';
} else {
echo '<div class="w100p right">';
}
html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']); html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']);
echo '</div>'; echo '</div>';

View File

@ -15,7 +15,7 @@ global $config;
check_login(); check_login();
$gis_w = check_acl($config['id_user'], 0, 'MW'); $gis_w = check_acl($config['id_user'], 0, 'MW', false, true, true);
$gis_m = check_acl($config['id_user'], 0, 'MM'); $gis_m = check_acl($config['id_user'], 0, 'MM');
$access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW'); $access = ($gis_w == true) ? 'MW' : (($gis_m == true) ? 'MM' : 'MW');
@ -44,7 +44,7 @@ $sec2 = safe_url_extraclean($sec2);
$sec = get_parameter_get('sec'); $sec = get_parameter_get('sec');
$sec = safe_url_extraclean($sec); $sec = safe_url_extraclean($sec);
// Layers // Layers.
$layer_ids = get_parameter('layer_ids', []); $layer_ids = get_parameter('layer_ids', []);
$layers = get_parameter('layers', []); $layers = get_parameter('layers', []);
$layer_list = []; $layer_list = [];
@ -84,9 +84,10 @@ switch ($action) {
$map_default_latitude = get_parameter('map_default_latitude'); $map_default_latitude = get_parameter('map_default_latitude');
$map_default_altitude = get_parameter('map_default_altitude'); $map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id'); $map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom'); $map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list')); $map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
foreach ($map_connection_list_temp as $index => $value) { foreach ($map_connection_list_temp as $index => $value) {
@ -99,14 +100,14 @@ switch ($action) {
$map_connection_default = get_parameter('map_connection_default'); $map_connection_default = get_parameter('map_connection_default');
$map_connection_list = []; $map_connection_list = [];
foreach ($map_connection_list_temp as $idMapConnection) { foreach ($listConnectionTemp as $idMapConnection) {
$default = 0; $default = 0;
if ($map_connection_default == $idMapConnection) { if ($map_connection_default == $idMapConnection['id_tmap_connection']) {
$default = 1; $default = 1;
} }
$map_connection_list[] = [ $map_connection_list[] = [
'id_conection' => $idMapConnection, 'id_conection' => $idMapConnection['id_tmap_connection'],
'default' => $default, 'default' => $default,
]; ];
} }
@ -124,7 +125,7 @@ switch ($action) {
$map_levels_zoom $map_levels_zoom
); );
if (empty($invalidFields) && get_parameter('map_connection_list') != '') { if (empty($invalidFields)) {
$idMap = gis_save_map( $idMap = gis_save_map(
$map_name, $map_name,
$map_initial_longitude, $map_initial_longitude,
@ -139,12 +140,17 @@ switch ($action) {
$map_connection_list, $map_connection_list,
$layer_list $layer_list
); );
if ($idMap) {
$mapCreatedOk = true; $mapCreatedOk = true;
$next_action = 'update_saved'; $next_action = 'update_saved';
} else { } else {
$next_action = 'save_new'; $next_action = 'save_new';
$mapCreatedOk = false; $mapCreatedOk = false;
} }
} else {
$next_action = 'save_new';
$mapCreatedOk = false;
}
ui_print_result_message( ui_print_result_message(
$mapCreatedOk, $mapCreatedOk,
@ -168,7 +174,7 @@ switch ($action) {
$map_group_id = ''; $map_group_id = '';
$map_connection_list = []; $map_connection_list = [];
$layer_list = []; $layer_list = [];
$map_levels_zoom = 0; $map_levels_zoom = 16;
break; break;
case 'edit_map': case 'edit_map':
@ -188,9 +194,12 @@ switch ($action) {
$map_default_latitude = get_parameter('map_default_latitude'); $map_default_latitude = get_parameter('map_default_latitude');
$map_default_altitude = get_parameter('map_default_altitude'); $map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id'); $map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom'); $map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list')); $map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
foreach ($map_connection_list_temp as $index => $value) { foreach ($map_connection_list_temp as $index => $value) {
$cleanValue = trim($value); $cleanValue = trim($value);
if ($cleanValue == '') { if ($cleanValue == '') {
@ -201,14 +210,14 @@ switch ($action) {
$map_connection_default = get_parameter('map_connection_default'); $map_connection_default = get_parameter('map_connection_default');
$map_connection_list = []; $map_connection_list = [];
foreach ($map_connection_list_temp as $idMapConnection) { foreach ($listConnectionTemp as $idMapConnection) {
$default = 0; $default = 0;
if ($map_connection_default == $idMapConnection) { if ($map_connection_default == $idMapConnection['id_tmap_connection']) {
$default = 1; $default = 1;
} }
$map_connection_list[] = [ $map_connection_list[] = [
'id_conection' => $idMapConnection, 'id_conection' => $idMapConnection['id_tmap_connection'],
'default' => $default, 'default' => $default,
]; ];
} }
@ -226,7 +235,7 @@ switch ($action) {
$map_levels_zoom $map_levels_zoom
); );
if (empty($invalidFields) && get_parameter('map_connection_list') != '') { if (empty($invalidFields)) {
// TODO // TODO
gis_update_map( gis_update_map(
$idMap, $idMap,
@ -263,7 +272,7 @@ switch ($action) {
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action; $url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
$buttons['gis_maps_list'] = [ $buttons['gis_maps_list'] = [
'active' => true, 'active' => false,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image( 'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png', 'images/list.png',
true, true,
@ -275,7 +284,7 @@ $buttons['gis_maps_list'] = [
]; ];
if ($idMap) { if ($idMap) {
$buttons['view_gis'] = [ $buttons['view_gis'] = [
'active' => true, 'active' => false,
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image( 'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
'images/op_gis.png', 'images/op_gis.png',
true, true,
@ -457,7 +466,7 @@ $table->data[1][0] = __('Add Map connection').$iconError;
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'> $table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
<tr> <tr>
<td > <td >
".html_print_select($listConnection, 'map_connection', '', '', '', '0', true)." ".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
</td> </td>
<td > <td >
<a href='javascript: addConnectionMap();'>".html_print_image( <a href='javascript: addConnectionMap();'>".html_print_image(
@ -481,7 +490,7 @@ if (users_can_manage_group_all('MM') === true) {
$table->data[2][0] = __('Group'); $table->data[2][0] = __('Group');
$table->data[2][1] = html_print_select_groups( $table->data[2][1] = html_print_select_groups(
false, false,
'IW', 'AR',
$return_all_group, $return_all_group,
'map_group_id', 'map_group_id',
$map_group_id, $map_group_id,
@ -504,7 +513,11 @@ $table->data[2][1] = html_print_select_groups(
); );
$table->data[3][0] = __('Default zoom'); $table->data[3][0] = __('Default zoom');
$table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden('map_levels_zoom', $map_levels_zoom, true); $table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden(
'map_levels_zoom',
$map_levels_zoom,
true
);
$table->data[4][0] = __('Center Latitude').':'; $table->data[4][0] = __('Center Latitude').':';
$table->data[4][1] = html_print_input_text('map_initial_latitude', $map_initial_latitude, '', 8, 8, true); $table->data[4][1] = html_print_input_text('map_initial_latitude', $map_initial_latitude, '', 8, 8, true);
@ -571,6 +584,9 @@ $params['hidden_input_idagent_name'] = 'agent_id';
$params['input_name'] = 'agent_alias'; $params['input_name'] = 'agent_alias';
$params['value'] = ''; $params['value'] = '';
$params['javascript_function_action_after_select'] = 'active_button_add_agent'; $params['javascript_function_action_after_select'] = 'active_button_add_agent';
$params['javascript_is_function_select'] = true;
$params['disabled_javascript_on_blur_function'] = false;
$table->data[1][1] .= ui_print_agent_autocomplete_input($params); $table->data[1][1] .= ui_print_agent_autocomplete_input($params);
@ -585,7 +601,7 @@ $table->data[1][1] .= '</td>
</td> </td>
</tr>'; </tr>';
// Group items // Group items.
$group_select = html_print_select_groups($config['id_user'], 'AR', false, 'layer_group_id', '', '', '', 0, true); $group_select = html_print_select_groups($config['id_user'], 'AR', false, 'layer_group_id', '', '', '', 0, true);
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -597,8 +613,10 @@ $params['input_name'] = 'agent_alias_for_data';
$params['value'] = ''; $params['value'] = '';
$params['javascript_function_action_after_select'] = 'toggleAddGroupBtn'; $params['javascript_function_action_after_select'] = 'toggleAddGroupBtn';
$params['selectbox_group'] = 'layer_group_id'; $params['selectbox_group'] = 'layer_group_id';
// Filter by group $params['javascript_is_function_select'] = true;
$params['disabled_javascript_on_blur_function'] = true;
// Filter by group.
$params['disabled_javascript_on_blur_function'] = false;
$agent_for_group_input = ui_print_agent_autocomplete_input($params); $agent_for_group_input = ui_print_agent_autocomplete_input($params);
$add_group_btn = html_print_button(__('Add'), 'add_group', true, '', 'class="sub add"', true); $add_group_btn = html_print_button(__('Add'), 'add_group', true, '', 'class="sub add"', true);

View File

@ -63,7 +63,7 @@ if (is_ajax() === true) {
$group = [ $group = [
'id_grupo' => 0, 'id_grupo' => 0,
'nombre' => 'None', 'nombre' => 'None',
'icon' => '', 'icon' => 'world',
'parent' => 0, 'parent' => 0,
'disabled' => 0, 'disabled' => 0,
'custom_id' => null, 'custom_id' => null,

View File

@ -20,15 +20,6 @@ require_once $config['homedir'].'/include/functions_html.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'IW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access event viewer'
);
include 'general/noaccess.php';
return;
}
// id report // id report
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');

View File

@ -319,7 +319,7 @@ if ($edit_graph) {
'view' => [ 'view' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">'.html_print_image( 'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$id_graph.'">'.html_print_image(
'images/operation.png', 'images/eye.png',
true, true,
[ [
'title' => __('View graph'), 'title' => __('View graph'),

View File

@ -194,22 +194,22 @@ if ($delete_layout || $copy_layout) {
} }
if ($copy_layout) { if ($copy_layout) {
// Number of inserts // Number of inserts.
$ninsert = (int) 0; $ninsert = (int) 0;
// Return from DB the source layout // Return from DB the source layout.
$layout_src = db_get_all_rows_filter( $layout_src = db_get_all_rows_filter(
'tlayout', 'tlayout',
['id' => $id_layout] ['id' => $id_layout]
); );
// Name of dst // Name of dst.
$name_dst = get_parameter( $name_dst = get_parameter(
'name_dst', 'name_dst',
$layout_src[0]['name'].' copy' $layout_src[0]['name'].' copy'
); );
// Create the new Console // Create the new Console.
$idGroup = $layout_src[0]['id_group']; $idGroup = $layout_src[0]['id_group'];
$background = $layout_src[0]['background']; $background = $layout_src[0]['background'];
$height = $layout_src[0]['height']; $height = $layout_src[0]['height'];
@ -222,7 +222,10 @@ if ($delete_layout || $copy_layout) {
'background' => $background, 'background' => $background,
'height' => $height, 'height' => $height,
'width' => $width, 'width' => $width,
'background_color' => $layout_src[0]['background_color'],
'is_favourite' => $layout_src[0]['is_favourite'],
]; ];
$result = db_process_sql_insert('tlayout', $values); $result = db_process_sql_insert('tlayout', $values);
$idNewVisualConsole = $result; $idNewVisualConsole = $result;

View File

@ -3326,6 +3326,9 @@ function print_SLA_list($width, $action, $idItem=null)
<input id="hidden-id_agent_sla" name="id_agent_sla" value="" type="hidden"> <input id="hidden-id_agent_sla" name="id_agent_sla" value="" type="hidden">
<input id="hidden-id_server" name="id_server" value="" type="hidden"> <input id="hidden-id_server" name="id_server" value="" type="hidden">
<?php <?php
// Set autocomplete image.
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black') ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
// Params for agent autocomplete input.
$params = []; $params = [];
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'agent_sla'; $params['input_name'] = 'agent_sla';
@ -3335,6 +3338,8 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_sla'; $params['selectbox_id'] = 'id_agent_module_sla';
$params['add_none_module'] = false; $params['add_none_module'] = false;
$params['check_only_empty_javascript_on_blur_function'] = true;
$params['icon_image'] = $autocompleteImage;
if ($meta) { if ($meta) {
$params['use_input_id_server'] = true; $params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server'; $params['input_id_server_id'] = 'hidden-id_server';
@ -3370,6 +3375,7 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover'; $params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false; $params['add_none_module'] = false;
$params['icon_image'] = $autocompleteImage;
if ($meta) { if ($meta) {
$params['use_input_id_server'] = true; $params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server'; $params['input_id_server_id'] = 'hidden-id_server';
@ -3739,6 +3745,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
$params['use_input_id_server'] = true; $params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server'; $params['input_id_server_id'] = 'hidden-id_server';
$params['disabled_javascript_on_blur_function'] = true; $params['disabled_javascript_on_blur_function'] = true;
$params['javascript_is_function_select'] = true;
} }
ui_print_agent_autocomplete_input($params); ui_print_agent_autocomplete_input($params);
@ -4733,8 +4740,10 @@ function addSLARow() {
var serviceId = $("select#id_service>option:selected").val(); var serviceId = $("select#id_service>option:selected").val();
var serviceName = $("select#id_service>option:selected").text(); var serviceName = $("select#id_service>option:selected").text();
if (((idAgent != '') && (slaMin != '') && (slaMax != '') if ((((idAgent != '') && (idAgent > 0))
&& (slaLimit != '')) || serviceId != '') { && ((idModule != '') && (idModule > 0)))
|| serviceId != null)
{
if (nameAgent != '') { if (nameAgent != '') {
//Truncate nameAgent //Truncate nameAgent
var params = []; var params = [];
@ -4891,6 +4900,7 @@ function addSLARow() {
$("input[name=id_agent_failover]").val(''); $("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val(''); $("input[name=id_server]").val('');
$("input[name=agent_sla]").val(''); $("input[name=agent_sla]").val('');
$("input[name=agent_sla]").css("background","url('<?php echo $autocompleteImage; ?>') right center no-repeat")
$("input[name=agent_failover]").val(''); $("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty(); $("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true'); $("#id_agent_module_sla").attr('disabled', 'true');

View File

@ -742,7 +742,7 @@ switch ($action) {
} }
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM')) { if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM') || check_acl($config['id_user'], 0, 'RR')) {
$return_all_group = true; $return_all_group = true;
} else { } else {
$return_all_group = false; $return_all_group = false;
@ -3209,7 +3209,7 @@ if ($enterpriseEnable) {
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$idReport.'&pure='.$pure.'">'.html_print_image( 'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$idReport.'&pure='.$pure.'">'.html_print_image(
'images/operation.png', 'images/eye.png',
true, true,
[ [
'title' => __('View report'), 'title' => __('View report'),

View File

@ -14,6 +14,8 @@
global $config; global $config;
global $statusProcessInDB; global $statusProcessInDB;
use PandoraFMS\User;
check_login(); check_login();
require_once $config['homedir'].'/include/functions_visual_map.php'; require_once $config['homedir'].'/include/functions_visual_map.php';
@ -753,8 +755,8 @@ if (!defined('METACONSOLE')) {
$url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$idVisualConsole.'&refr='.$view_refresh; $url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$idVisualConsole.'&refr='.$view_refresh;
} }
// Hash for auto-auth in public link // Hash for auto-auth in public link.
$hash = md5($config['dbpass'].$idVisualConsole.$config['id_user']); $hash = User::generatePublicHash();
$buttons = []; $buttons = [];

View File

@ -386,10 +386,10 @@ function check_process (id_server) {
parameters, parameters,
function (data) { function (data) {
if (data['correct']) { if (data['correct']) {
$("#check_exec_server img").attr("src", <?php echo 'images/dot_green.png'; ?>); $("#check_exec_server img").attr("src", "images/dot_green.png");
} }
else { else {
$("#check_exec_server img").attr("src", <?php echo 'images/dot_red.png'; ?>); $("#check_exec_server img").attr("src", "images/dot_red.png");
$("#check_error_message").empty(); $("#check_error_message").empty();
$("#check_error_message").append("<span>" + data['message'] + "</span>"); $("#check_error_message").append("<span>" + data['message'] + "</span>");
} }

View File

@ -279,25 +279,25 @@ if ($mapConnectionData != null) {
} }
// Open Street Map Connection. // Open Street Map Connection.
$optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.htmlentities( $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.htmlentities(
__('Tile Server URL'), __('Tile Server URL'),
ENT_QUOTES, ENT_QUOTES,
'UTF-8' 'UTF-8'
).':</td>'.'<td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text( ).':</td><td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text(
'url', 'url',
$mapConnectionDataUrl, $mapConnectionDataUrl,
'', '',
45, 45,
90, 90,
true true
).'</td>'.'</tr>'.'</table>'; ).'</td></tr></table>';
// Google Maps Connection. // Google Maps Connection.
$gmaps_types['G_PHYSICAL_MAP'] = __('Google Physical'); $gmaps_types['G_PHYSICAL_MAP'] = __('Google Physical');
$gmaps_types['G_HYBRID_MAP'] = __('Google Hybrid'); $gmaps_types['G_HYBRID_MAP'] = __('Google Hybrid');
$gmaps_types['G_SATELITE_MAP'] = __('Google Satelite'); $gmaps_types['G_SATELITE_MAP'] = __('Google Satelite');
// TODO: Use label tags for the forms. // TODO: Use label tags for the forms.
$optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%">'.'<tr class="row_0">'.'<td>'.__('Google Map Type').':</td>'.'<td><input id="type" type="hidden" name="type" value="Gmap" />'.trim( $optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%"><tr class="row_0"><td>'.__('Google Map Type').':</td><td><input id="type" type="hidden" name="type" value="Gmap" />'.trim(
html_print_select( html_print_select(
$gmaps_types, $gmaps_types,
'gmap_type', 'gmap_type',
@ -305,56 +305,98 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
'', '',
'', '',
0, 0,
true true,
false,
true,
'',
false,
false,
false,
false,
false,
'',
false,
false,
false,
false,
false
) )
).'</td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Google Maps Key').':</td>'.'</tr>'.'<tr class="row_3">'.'<td colspan="2">'.html_print_input_text( ).'</td></tr><tr class="row_2"><td>'.__('Google Maps Key').':</td></tr><tr class="row_3"><td colspan="2">'.html_print_input_text(
'gmap_key', 'gmap_key',
$gmap_key, $gmap_key,
'', '',
90, 90,
128, 128,
true true
).'</td>'.'</tr>'.'</table>'; ).'</td></tr></table>';
// Image Map Connection. // Image Map Connection.
$optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('Image URL').':</td>'.'<td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text( $optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.__('Image URL').':</td><td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text(
'url', 'url',
$mapConnectionDataUrl, $mapConnectionDataUrl,
'', '',
45, 45,
90, 90,
true true
).'</td>'.'</tr>'.'<tr class="row_1">'.'<td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Left').':</td>'.'<td>'.html_print_input_text( ).'</td></tr><tr class="row_1"><td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td></tr><tr class="row_2"><td>'.__('Left').':</td><td>'.html_print_input_text(
'bb_left', 'bb_left',
$bb_left, $bb_left,
'', '',
25, 25,
25, 25,
true true
).'</td>'.'<td>'.__('Bottom').':</td>'.'<td>'.html_print_input_text( ).'</td><td>'.__('Bottom').':</td><td>'.html_print_input_text(
'bb_bottom', 'bb_bottom',
$bb_bottom, $bb_bottom,
'', '',
25, 25,
25, 25,
true true
).'</td>'.'</tr>'.'<tr class="row_3">'.'<td>'.__('Right').':</td>'.'<td>'.html_print_input_text( ).'</td></tr><tr class="row_3"><td>'.__('Right').':</td><td>'.html_print_input_text(
'bb_right', 'bb_right',
$bb_right, $bb_right,
'', '',
25, 25,
25, 25,
true true
).'</td>'.'<td>'.__('Top').':</td>'.'<td>'.html_print_input_text( ).'</td><td>'.__('Top').':</td><td>'.html_print_input_text(
'bb_top', 'bb_top',
$bb_top, $bb_top,
'', '',
25, 25,
25, 25,
true true
).'</td>'.'</tr>'.'<tr class="row_4">'.'<td colspan="4"><strong>'.__('Image Size').':</strong></td>'.'</tr>'.'<tr class="row_5">'.'<td>'.__('Width').':</td>'.'<td>'.html_print_input_text('image_width', $image_width, '', 25, 25, true).'</td>'.'<td>'.__('Height').':</td>'.'<td>'.html_print_input_text('image_height', $image_height, '', 25, 25, true).'</td>'.'</tr>'.'</table>'; ).'</td></tr><tr class="row_4"><td colspan="4"><strong>'.__('Image Size').':</strong></td></tr><tr class="row_5"><td>'.__('Width').':</td><td>'.html_print_input_text(
'image_width',
$image_width,
'',
25,
25,
true
).'</td><td>'.__('Height').':</td><td>'.html_print_input_text(
'image_height',
$image_height,
'',
25,
25,
true
).'</td></tr></table>';
// WMS Server Connection. // WMS Server Connection.
$optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('WMS Server URL').'</td>'.'<td>'.'<input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 90, 255, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td>'.__('Layers').'</td>'.'<td>'.html_print_input_text('layers', $layers, '', 90, 255, true).'</td>'.'</tr>'.'</table>'; $optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.__('WMS Server URL').'</td><td><input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
90,
255,
true
).'</td></tr><tr class="row_1"><td>'.__('Layers').'</td><td>'.html_print_input_text(
'layers',
$layers,
'',
90,
255,
true
).'</td></tr></table>';
if ($mapConnectionData != null) { if ($mapConnectionData != null) {
switch ($mapConnection_type) { switch ($mapConnection_type) {
@ -383,7 +425,7 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
echo "<div id='form_map_connection_type'>".$optionsConnectionTypeTable.'</div>'; echo "<div id='form_map_connection_type'>".$optionsConnectionTypeTable.'</div>';
echo '<h4>'.__('Preview to select the center of the map and the default position of an agent without gis data').'</h4><br>'; echo '<h4>'.__('Preview to select the center of the map and the default position of an agent without gis data').'</h4><br>';
html_print_button(__('Load preview map'), 'button_refresh', false, 'refreshMapView();', 'class="sub"'); html_print_button(__('Load preview map'), 'button_refresh', false, 'refreshMapView();', 'class="sub next"');
echo '<br /><br />'; echo '<br /><br />';
echo "<div id='map' class='map_gis_step2'></div>"; echo "<div id='map' class='map_gis_step2'></div>";
@ -472,7 +514,7 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
); );
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons w90p left">'; echo '<div class="action-buttons w90p float-left">';
html_print_submit_button(__('Save'), '', false, 'class="sub save wand"'); html_print_submit_button(__('Save'), '', false, 'class="sub save wand"');
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
@ -649,7 +691,6 @@ function selMapConnectionType() {
$('#form_map_connection_type').html('<?php echo $optionsConnectionOSMTable; ?>').hide(); $('#form_map_connection_type').html('<?php echo $optionsConnectionOSMTable; ?>').hide();
break; break;
case 'Gmap': case 'Gmap':
// TODO: Validate there is a key, and use it
$('#form_map_connection_type').html('<?php echo $optionsConnectionGmapTable; ?>').hide(); $('#form_map_connection_type').html('<?php echo $optionsConnectionGmapTable; ?>').hide();
break; break;
case 'Static_Image': case 'Static_Image':

View File

@ -34,9 +34,11 @@ check_login();
if (is_ajax()) { if (is_ajax()) {
$test_address = get_parameter('test_address', ''); $test_address = get_parameter('test_address', '');
$params = get_parameter('params', '');
$res = send_test_email( $res = send_test_email(
$test_address $test_address,
$params
); );
echo $res; echo $res;
@ -420,7 +422,7 @@ $table->data[$i++][1] = html_print_select(
$config['past_planned_downtimes'] = isset( $config['past_planned_downtimes'] = isset(
$config['past_planned_downtimes'] $config['past_planned_downtimes']
) ? $config['past_planned_downtimes'] : 1; ) ? $config['past_planned_downtimes'] : 1;
$table->data[$i][0] = __('Allow create planned downtimes in the past'); $table->data[$i][0] = __('Allow create scheduled downtimes in the past');
$table->data[$i++][1] = html_print_checkbox_switch( $table->data[$i++][1] = html_print_checkbox_switch(
'past_planned_downtimes', 'past_planned_downtimes',
1, 1,
@ -641,8 +643,8 @@ echo '<legend>'.__('Mail configuration').'</legend>';
$table_mail_test->width = '100%'; $table_mail_test->width = '100%';
$table_mail_test->class = 'databox filters'; $table_mail_test->class = 'databox filters';
$table_mail_test->data = []; $table_mail_test->data = [];
$table_mail_test->style[0] = 'font-weight: bold'; $table_mail_test->style[0] = 'font-weight: bold;';
$table_mail_test->colspan[1][0] = 2; $table_mail_test->style[1] = 'font-weight: bold;display: flex;height: 54px;align-items: center;';
$table_mail_test->data[0][0] = __('Address'); $table_mail_test->data[0][0] = __('Address');
$table_mail_test->data[0][1] = html_print_input_text( $table_mail_test->data[0][1] = html_print_input_text(
@ -661,7 +663,9 @@ echo '<legend>'.__('Mail configuration').'</legend>';
'', '',
'class="sub next"', 'class="sub next"',
true true
).'&nbsp&nbsp<span id="email_test_sent_message" class="invisible">Email sent</span><span id="email_test_failure_message" class=invisible">Email could not be sent</span>'; );
$table_mail_test->data[1][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>';
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).'</div>'; echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).'</div>';
} }
@ -703,22 +707,41 @@ function show_email_test(id) {
} }
function perform_email_test () { function perform_email_test () {
$('#email_test_sent_message').hide();
$('#email_test_failure_message').hide();
var test_address = $('#text-email_test_address').val(); 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({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
data: "page=godmode/setup/setup_general&test_address="+test_address, data : {
dataType: "html", page: "godmode/setup/setup_general",
test_address: test_address,
params: params
},
dataType: "json",
success: function(data) { success: function(data) {
if (parseInt(data) === 1) { if (parseInt(data) === 1) {
$('#email_test_sent_message').show(); $('#email_test_sent_message').show();
$('#email_test_failure_message').hide();
} else { } else {
$('#email_test_failure_message').show(); $('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
} }
}, },
error: function() { error: function() {
$('#email_test_failure_message').show(); $('#email_test_failure_message').show();
$('#email_test_sent_message').hide();
}, },
}); });
} }

View File

@ -41,8 +41,10 @@ if (is_ajax()) {
$integria_pass = get_parameter('integria_pass', ''); $integria_pass = get_parameter('integria_pass', '');
$integria_api_hostname = get_parameter('api_hostname', ''); $integria_api_hostname = get_parameter('api_hostname', '');
$integria_api_pass = get_parameter('api_pass', ''); $integria_api_pass = get_parameter('api_pass', '');
$user_level_conf = get_parameter('user_level_conf', 0);
$user_level_conf_bool = $user_level_conf === 'true' ? true : false;
$login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', []); $login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', [], false, '', '', $user_level_conf_bool);
if ($login_result != false) { if ($login_result != false) {
echo json_encode(['login' => 1]); echo json_encode(['login' => 1]);
@ -53,7 +55,7 @@ if (is_ajax()) {
return; return;
} }
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []); $has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false && $config['integria_enabled']) { if ($has_connection === false && $config['integria_enabled']) {
ui_print_error_message(__('Integria IMS API is not reachable')); ui_print_error_message(__('Integria IMS API is not reachable'));
@ -86,7 +88,7 @@ if (get_parameter('update_config', 0) == 1) {
); );
} }
$ticket_types = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', '', false, 'json'); $ticket_types = integria_api_call(null, null, null, null, 'get_types', '', false, 'json');
$types_string = ''; $types_string = '';
@ -216,19 +218,19 @@ $integria_users_values = [];
$integria_types_values = []; $integria_types_values = [];
$integria_status_values = []; $integria_status_values = [];
$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', []); $integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups', []);
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values); get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', []); $integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status', []);
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values); get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', []); $integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities', []);
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values); get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); $integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv); $csv_array = explode("\n", $integria_users_csv);
@ -238,7 +240,7 @@ foreach ($csv_array as $csv_line) {
} }
} }
$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', []); $integria_types_csv = integria_api_call(null, null, null, null, 'get_types', []);
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values); get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
@ -267,6 +269,12 @@ $table_remote->class = 'databox filters';
$table_remote->size['name'] = '30%'; $table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold'; $table_remote->style['name'] = 'font-weight: bold';
// Enable eHorus user configuration.
$row = [];
$row['name'] = ('Integria configuration at user level');
$row['control'] = html_print_checkbox_switch('integria_user_level_conf', 1, $config['integria_user_level_conf'], true);
$table_remote->data['integria_user_level_conf'] = $row;
// Integria user. // Integria user.
$row = []; $row = [];
$row['name'] = __('User'); $row['name'] = __('User');
@ -282,7 +290,7 @@ $table_remote->data['integria_pass'] = $row;
// Integria hostname. // Integria hostname.
$row = []; $row = [];
$row['name'] = __('API Hostname'); $row['name'] = __('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true);
$row['control'] = html_print_input_text('integria_hostname', $config['integria_hostname'], '', 30, 100, true); $row['control'] = html_print_input_text('integria_hostname', $config['integria_hostname'], '', 30, 100, true);
$table_remote->data['integria_hostname'] = $row; $table_remote->data['integria_hostname'] = $row;
@ -329,22 +337,20 @@ $row['control'] = html_print_input_text(
true, true,
false, false,
false false
).ui_print_help_icon('alert_macros', true); );
$table_alert_settings->data['custom_response_incident_title'] = $row; $table_alert_settings->data['custom_response_incident_title'] = $row;
// Alert incident description. // Alert incident description.
$row = []; $row = [];
$row['name'] = __('Description'); $row['name'] = __('Ticket body');
$row['control'] = html_print_input_text( $row['control'] = html_print_textarea(
'incident_content', 'incident_content',
7,
25,
$config['incident_content'], $config['incident_content'],
'', '',
50, true
100, );
true,
false,
false
).ui_print_help_icon('alert_macros', true);
$table_alert_settings->data['custom_response_incident_content'] = $row; $table_alert_settings->data['custom_response_incident_content'] = $row;
// Alert default group. // Alert default group.
@ -452,22 +458,21 @@ $row['control'] = html_print_input_text(
true, true,
false, false,
false false
).ui_print_help_icon('response_macros', true); );
$table_cr_settings->data['custom_response_incident_title'] = $row; $table_cr_settings->data['custom_response_incident_title'] = $row;
// Custom response incident description. // Custom response incident description.
$row = []; $row = [];
$row['name'] = __('Description'); $row['name'] = __('Ticket body');
$row['control'] = html_print_input_text( $row['control'] = html_print_textarea(
'cr_incident_content', 'cr_incident_content',
7,
25,
$config['cr_incident_content'], $config['cr_incident_content'],
'', '',
50, true
100, );
true,
false,
false
).ui_print_help_icon('response_macros', true);
$table_cr_settings->data['custom_response_incident_content'] = $row; $table_cr_settings->data['custom_response_incident_content'] = $row;
// Custom response default group. // Custom response default group.
@ -599,7 +604,7 @@ if ($has_connection != false) {
// Form alert default settings. // Form alert default settings.
echo '<div id="form_alert_settings">'; echo '<div id="form_alert_settings">';
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Alert default values').'</legend>'; echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings); html_print_table($table_alert_settings);
@ -609,7 +614,7 @@ if ($has_connection != false) {
// Form custom response default settings. // Form custom response default settings.
echo '<div id="form_custom_response_settings">'; echo '<div id="form_custom_response_settings">';
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Event custom response default values').'</legend>'; echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings); html_print_table($table_cr_settings);
@ -632,6 +637,29 @@ echo '</form>';
<script type="text/javascript"> <script type="text/javascript">
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
{
$('#integria-remote-setup-integria_user').hide();
$('#integria-remote-setup-integria_pass').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="integria_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) { if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
$('#form_remote').hide(); $('#form_remote').hide();
$('#form_custom_response_settings').hide(); $('#form_custom_response_settings').hide();
@ -723,6 +751,7 @@ echo '</form>';
var integria_pass = $('input[name=integria_pass]').val(); var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val(); var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val(); var api_pass = $('input[name=integria_api_pass]').val();
var user_level_conf = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
var data = { var data = {
page: 'godmode/setup/setup_integria', page: 'godmode/setup/setup_integria',
@ -731,6 +760,7 @@ echo '</form>';
integria_pass: integria_pass, integria_pass: integria_pass,
api_hostname: api_hostname, api_hostname: api_hostname,
api_pass: api_pass, api_pass: api_pass,
user_level_conf: user_level_conf,
} }
// AJAX call to check API connection. // AJAX call to check API connection.

View File

@ -24,15 +24,6 @@ require_once 'include/functions_ui.php';
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'IR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access netflow setup'
);
include 'general/noaccess.php';
return;
}
$update = (bool) get_parameter('update'); $update = (bool) get_parameter('update');
$table->width = '100%'; $table->width = '100%';

View File

@ -585,126 +585,10 @@ if ($update_alert || $duplicate_alert) {
// Duplicate alert snmp // Duplicate alert snmp
if ($duplicate_alert) { if ($duplicate_alert) {
$sql = sprintf( $values_duplicate = $alert;
'insert into talert_snmp ( if (!empty($values_duplicate)) {
id_alert, al_field1, al_field2, al_field3, unset($values_duplicate['id_as']);
al_field4, al_field5, al_field6, al_field7, $result = db_process_sql_insert('talert_snmp', $values_duplicate);
al_field8, al_field9, al_field10, al_field11,
al_field12, al_field13, al_field14, al_field15,
al_field16, al_field17, al_field18, al_field19,
al_field20, description, alert_type, agent, custom_oid,
oid, time_threshold, times_fired, last_fired,
max_alerts, min_alerts, internal_counter, priority,
'.db_escape_key_identifier('_snmp_f1_').',
'.db_escape_key_identifier('_snmp_f2_').',
'.db_escape_key_identifier('_snmp_f3_').',
'.db_escape_key_identifier('_snmp_f4_').',
'.db_escape_key_identifier('_snmp_f5_').',
'.db_escape_key_identifier('_snmp_f6_').',
'.db_escape_key_identifier('_snmp_f7_').',
'.db_escape_key_identifier('_snmp_f8_').',
'.db_escape_key_identifier('_snmp_f9_').',
'.db_escape_key_identifier('_snmp_f10_').',
'.db_escape_key_identifier('_snmp_f11_').',
'.db_escape_key_identifier('_snmp_f12_').',
'.db_escape_key_identifier('_snmp_f13_').',
'.db_escape_key_identifier('_snmp_f14_').',
'.db_escape_key_identifier('_snmp_f15_').',
'.db_escape_key_identifier('_snmp_f16_').',
'.db_escape_key_identifier('_snmp_f17_').',
'.db_escape_key_identifier('_snmp_f18_').',
'.db_escape_key_identifier('_snmp_f19_').',
'.db_escape_key_identifier('_snmp_f20_').",
trap_type, single_value, position, disable_event, id_group,
order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8,
order_9, order_10, order_11, order_12, order_13, order_14, order_15,
order_16, order_17, order_18, order_19, order_20)
VALUES
(%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s',
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d,
%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
$id_alert,
$al_field1,
$al_field2,
$al_field3,
$al_field4,
$al_field5,
$al_field6,
$al_field7,
$al_field8,
$al_field9,
$al_field10,
$al_field11,
$al_field12,
$al_field13,
$al_field14,
$al_field15,
$al_field16,
$al_field17,
$al_field18,
$al_field19,
$al_field20,
$description,
$alert_type,
$source_ip,
$custom_value,
$oid,
$time_threshold,
$times_fired,
$last_fired,
$max_alerts,
$min_alerts,
$internal_counter,
$priority,
$custom_oid_data_1,
$custom_oid_data_2,
$custom_oid_data_3,
$custom_oid_data_4,
$custom_oid_data_5,
$custom_oid_data_6,
$custom_oid_data_7,
$custom_oid_data_8,
$custom_oid_data_9,
$custom_oid_data_10,
$custom_oid_data_11,
$custom_oid_data_12,
$custom_oid_data_13,
$custom_oid_data_14,
$custom_oid_data_15,
$custom_oid_data_16,
$custom_oid_data_17,
$custom_oid_data_18,
$custom_oid_data_19,
$custom_oid_data_20,
$trap_type,
$single_value,
$position,
$disable_event,
$group,
$order_1,
$order_2,
$order_3,
$order_4,
$order_5,
$order_6,
$order_7,
$order_8,
$order_9,
$order_10,
$order_11,
$order_12,
$order_13,
$order_14,
$order_15,
$order_16,
$order_17,
$order_18,
$order_19,
$order_20
);
$result = db_process_sql($sql);
if (!$result) { if (!$result) {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as"); db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as");
@ -713,6 +597,10 @@ if ($duplicate_alert) {
db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as"); db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as");
ui_print_success_message(__('Successfully Duplicate')); ui_print_success_message(__('Successfully Duplicate'));
} }
} else {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as");
ui_print_error_message(__('There was a problem duplicating the alert'));
}
} }
// Header // Header

View File

@ -94,7 +94,7 @@ is not working on the metaconsole and there is no time to fix it -->
var mr_available_header = "<?php echo __('There are db changes'); ?>\n"; var mr_available_header = "<?php echo __('There are db changes'); ?>\n";
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n"; var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n"; var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n"; var text3_mr_file = "<?php echo __('Scheduled downtime'); ?>\n";
var language = "<?php echo $config['language']; ?>"; var language = "<?php echo $config['language']; ?>";
var docsUrl = (language === "es") var docsUrl = (language === "es")

View File

@ -85,11 +85,6 @@ if ($id_profile || $new_profile) {
// Name // Name
$name = ''; $name = '';
// Incidents
$incident_view = 0;
$incident_edit = 0;
$incident_management = 0;
// Agents // Agents
$agent_view = 0; $agent_view = 0;
$agent_edit = 0; $agent_edit = 0;
@ -148,11 +143,6 @@ if ($id_profile || $new_profile) {
// Name // Name
$name = $profile['name']; $name = $profile['name'];
// Incidents
$incident_view = (bool) $profile['incident_view'];
$incident_edit = (bool) $profile['incident_edit'];
$incident_management = (bool) $profile['incident_management'];
// Agents // Agents
$agent_view = (bool) $profile['agent_view']; $agent_view = (bool) $profile['agent_view'];
$agent_edit = (bool) $profile['agent_edit']; $agent_edit = (bool) $profile['agent_edit'];
@ -197,7 +187,7 @@ if ($id_profile || $new_profile) {
); );
enterprise_include_once('include/functions_audit.php'); enterprise_include_once('include/functions_audit.php');
$info = 'Name: '.$name.' Incident view: '.$incident_view.' Incident edit: '.$incident_edit.' Incident management: '.$incident_management.' Agent view: '.$agent_view.' Agent edit: '.$agent_edit.' Agent disable: '.$agent_disable.' Alert edit: '.$alert_edit.' Alert management: '.$alert_management.' User management: '.$user_management.' DB management: '.$db_management.' Event view: '.$event_view.' Event edit: '.$event_edit.' Event management: '.$event_management.' Report view: '.$report_view.' Report edit: '.$report_edit.' Report management: '.$report_management.' Network map view: '.$map_view.' Network map edit: '.$map_edit.' Network map management: '.$map_management.' Visual console view: '.$vconsole_view.' Visual console edit: '.$vconsole_edit.' Visual console management: '.$vconsole_management.' '.get_product_name().' Management: '.$pandora_management; $info = 'Name: '.$name.' Agent view: '.$agent_view.' Agent edit: '.$agent_edit.' Agent disable: '.$agent_disable.' Alert edit: '.$alert_edit.' Alert management: '.$alert_management.' User management: '.$user_management.' DB management: '.$db_management.' Event view: '.$event_view.' Event edit: '.$event_edit.' Event management: '.$event_management.' Report view: '.$report_view.' Report edit: '.$report_edit.' Report management: '.$report_management.' Network map view: '.$map_view.' Network map edit: '.$map_edit.' Network map management: '.$map_management.' Visual console view: '.$vconsole_view.' Visual console edit: '.$vconsole_edit.' Visual console management: '.$vconsole_management.' '.get_product_name().' Management: '.$pandora_management;
enterprise_hook('audit_pandora_enterprise', [$id_audit, $info]); enterprise_hook('audit_pandora_enterprise', [$id_audit, $info]);
@ -319,21 +309,6 @@ if ($id_profile || $new_profile) {
$table->data['VM'] = $row; $table->data['VM'] = $row;
$table->data[] = '<hr>'; $table->data[] = '<hr>';
// Incidents
$row = [];
$row['name'] = __('View incidents');
$row['input'] = html_print_checkbox('incident_view', 1, $incident_view, true);
$table->data['IR'] = $row;
$row = [];
$row['name'] = __('Edit incidents');
$row['input'] = html_print_checkbox('incident_edit', 1, $incident_edit, true, false, 'autoclick_profile_users(\'incident_edit\', \'incident_view\', \'false\')');
$table->data['IW'] = $row;
$row = [];
$row['name'] = __('Manage incidents');
$row['input'] = html_print_checkbox('incident_management', 1, $incident_management, true, false, 'autoclick_profile_users(\'incident_management\', \'incident_view\', \'incident_edit\');');
$table->data['IM'] = $row;
$table->data[] = '<hr>';
$disable_option = 'javascript: return false;'; $disable_option = 'javascript: return false;';
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) { if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
$disable_option = ''; $disable_option = '';

View File

@ -439,6 +439,12 @@ if ($create_user) {
if ($result) { if ($result) {
$res = save_pass_history($id, $password_new); $res = save_pass_history($id, $password_new);
} else {
$is_err = true;
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} }
db_pandora_audit( db_pandora_audit(

View File

@ -107,11 +107,6 @@ if ($delete_profile) {
if ($create_profile || $update_profile) { if ($create_profile || $update_profile) {
$name = get_parameter('name'); $name = get_parameter('name');
// Incidents
$incident_view = (bool) get_parameter('incident_view');
$incident_edit = (bool) get_parameter('incident_edit');
$incident_management = (bool) get_parameter('incident_management');
// Agents // Agents
$agent_view = (bool) get_parameter('agent_view'); $agent_view = (bool) get_parameter('agent_view');
$agent_edit = (bool) get_parameter('agent_edit'); $agent_edit = (bool) get_parameter('agent_edit');
@ -152,9 +147,6 @@ if ($create_profile || $update_profile) {
$values = [ $values = [
'name' => $name, 'name' => $name,
'incident_view' => $incident_view,
'incident_edit' => $incident_edit,
'incident_management' => $incident_management,
'agent_view' => $agent_view, 'agent_view' => $agent_view,
'agent_edit' => $agent_edit, 'agent_edit' => $agent_edit,
'agent_disable' => $agent_disable, 'agent_disable' => $agent_disable,
@ -183,10 +175,7 @@ if ($update_profile) {
if ($name) { if ($name) {
$ret = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]); $ret = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);
if ($ret !== false) { if ($ret !== false) {
$info = '{"Name":"'.$incident_view.'", $info = '{"Name":"'.$name.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'", "Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'", "Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'", "Agent disable":"'.$agent_disable.'",
@ -234,10 +223,7 @@ if ($create_profile) {
if ($ret !== false) { if ($ret !== false) {
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
$info = '{"Name":"'.$incident_view.'", $info = '{"Name":"'.$name.'",
"Incident view":"'.$incident_view.'",
"Incident edit":"'.$incident_edit.'",
"Incident management":"'.$incident_management.'",
"Agent view":"'.$agent_view.'", "Agent view":"'.$agent_view.'",
"Agent edit":"'.$agent_edit.'", "Agent edit":"'.$agent_edit.'",
"Agent disable":"'.$agent_disable.'", "Agent disable":"'.$agent_disable.'",
@ -289,9 +275,6 @@ $table->align = [];
$table->head['profiles'] = __('Profiles'); $table->head['profiles'] = __('Profiles');
$table->head['IR'] = 'IR';
$table->head['IW'] = 'IW';
$table->head['IM'] = 'IM';
$table->head['AR'] = 'AR'; $table->head['AR'] = 'AR';
$table->head['AW'] = 'AW'; $table->head['AW'] = 'AW';
$table->head['AD'] = 'AD'; $table->head['AD'] = 'AD';
@ -317,9 +300,6 @@ $table->head['operations'] = '<span title="Operations">'.__('Op.').'</span>';
$table->align = array_fill(1, 11, 'center'); $table->align = array_fill(1, 11, 'center');
$table->size['profiles'] = '200px'; $table->size['profiles'] = '200px';
$table->size['IR'] = '10px';
$table->size['IW'] = '10px';
$table->size['IM'] = '10px';
$table->size['AR'] = '10px'; $table->size['AR'] = '10px';
$table->size['AW'] = '10px'; $table->size['AW'] = '10px';
$table->size['AD'] = '10px'; $table->size['AD'] = '10px';
@ -358,9 +338,6 @@ $img = html_print_image(
foreach ($profiles as $profile) { foreach ($profiles as $profile) {
$data['profiles'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.$profile['name'].'</a>'; $data['profiles'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.$profile['name'].'</a>';
$data['IR'] = ($profile['incident_view'] ? $img : '');
$data['IW'] = ($profile['incident_edit'] ? $img : '');
$data['IM'] = ($profile['incident_management'] ? $img : '');
$data['AR'] = ($profile['agent_view'] ? $img : ''); $data['AR'] = ($profile['agent_view'] ? $img : '');
$data['AW'] = ($profile['agent_edit'] ? $img : ''); $data['AW'] = ($profile['agent_edit'] ? $img : '');
$data['AD'] = ($profile['agent_disable'] ? $img : ''); $data['AD'] = ($profile['agent_disable'] ? $img : '');

View File

@ -233,8 +233,7 @@ if (defined('METACONSOLE')) {
$disable_user = get_parameter('disable_user', false); $disable_user = get_parameter('disable_user', false);
if ((bool) get_parameter('user_del', false) === true) {
if (isset($_GET['user_del'])) {
// delete user // delete user
$id_user = get_parameter('delete_user', 0); $id_user = get_parameter('delete_user', 0);
// Only allow delete user if is not the actual user // Only allow delete user if is not the actual user
@ -312,13 +311,13 @@ if (isset($_GET['user_del'])) {
$result = false; $result = false;
} }
if ($disable_user == 1) { if ($disable_user === 1) {
ui_print_result_message( ui_print_result_message(
$result, $result,
__('Successfully disabled'), __('Successfully disabled'),
__('There was a problem disabling user') __('There was a problem disabling user')
); );
} else { } else if ($disable_user === 0) {
ui_print_result_message( ui_print_result_message(
$result, $result,
__('Successfully enabled'), __('Successfully enabled'),
@ -562,7 +561,7 @@ foreach ($info as $user_id => $user_info) {
$iterator++; $iterator++;
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) { if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.$user_id.'</a>'; $data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
} else { } else {
$data[0] = $user_id; $data[0] = $user_id;
} }
@ -642,19 +641,126 @@ foreach ($info as $user_id => $user_info) {
$table->cellclass[][6] = 'action_buttons'; $table->cellclass[][6] = 'action_buttons';
$data[6] = ''; $data[6] = '';
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) { if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
if (!isset($user_info['not_delete'])) { // Disable / Enable user.
if (isset($user_info['not_delete']) === false) {
if ($user_info['disabled'] == 0) { if ($user_info['disabled'] == 0) {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=1&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable'), 'class' => 'invert_filter']).'</a>'; $toDoString = __('Disable');
$toDoAction = '1';
$toDoImage = 'images/lightbulb.png';
} else { } else {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=0&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>'; $toDoString = __('Enable');
} $toDoAction = '0';
$toDoImage = 'images/lightbulb_off.png';
} }
$data[6] .= '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit'), 'class' => 'invert_filter']).'</a>'; $data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && !isset($user_info['not_delete'])) { $data[6] .= html_print_input_hidden(
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>'; 'id',
if (defined('METACONSOLE')) { $user_info['id_user'],
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['class' => 'invert_filter', 'title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>'; true
);
$data[6] .= html_print_input_hidden(
'disable_user',
$toDoAction,
true
);
$data[6] .= html_print_input_image(
'submit_disable_enable',
$toDoImage,
'',
'',
true,
[
'data-title' => $toDoString,
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
}
// Edit user.
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
$data[6] .= html_print_input_hidden(
'id_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'edit_user',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_edit_user',
'images/config.png',
'',
'padding:0',
true,
[
'data-title' => __('Edit'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && isset($user_info['not_delete']) === false) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_user',
'images/cross.png',
'',
'padding:0',
true,
[
'data-title' => __('Delete'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if (is_metaconsole() === true) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_hidden(
'delete_all',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_all',
'images/cross_double.png',
'',
'',
true,
[
'data-title' => __('Delete from all consoles'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
} }
} else { } else {
$data[6] .= ''; $data[6] .= '';

View File

@ -898,7 +898,7 @@ class HostDevices extends Wizard
], ],
[ [
'label' => '<b>'.__('Networks (current)').':</b>'.ui_print_help_tip( 'label' => '<b>'.__('Networks (current)').':</b>'.ui_print_help_tip(
__('Plese upload a new file to overwrite this content.'), __('Please upload a new file to overwrite this content.'),
true true
), ),
'arguments' => [ 'arguments' => [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 566 B

View File

@ -27,12 +27,28 @@ ob_clean();
// * q // * q
// * id_group // * id_group
$search_agents = (bool) get_parameter('search_agents'); $search_agents = (bool) get_parameter('search_agents');
$get_agents_interfaces = (bool) get_parameter('get_agents_interfaces');
$id_agents = get_parameter('id_agents', []);
$get_agents_group = (bool) get_parameter('get_agents_group', false); $get_agents_group = (bool) get_parameter('get_agents_group', false);
$force_local = (bool) get_parameter('force_local', false); $force_local = (bool) get_parameter('force_local', false);
if (https_is_running()) { if (https_is_running()) {
header('Content-type: application/json'); header('Content-type: application/json');
} }
if ($get_agents_interfaces) {
$agents_interfaces = agents_get_network_interfaces($id_agents);
// Include alias per agent.
foreach ($agents_interfaces as $key => $value) {
$agent_alias = agents_get_alias($key);
$agents_interfaces[$key]['agent_alias'] = $agent_alias;
}
echo json_encode($agents_interfaces);
return;
}
if ($get_agents_group) { if ($get_agents_group) {
$id_group = (int) get_parameter('id_group', -1); $id_group = (int) get_parameter('id_group', -1);
$mode = (string) get_parameter('mode', 'json'); $mode = (string) get_parameter('mode', 'json');

View File

@ -257,6 +257,11 @@ if ($save_event_filter) {
$values['id_extra'] = get_parameter('id_extra'); $values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment'); $values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event'); $values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter( $exists = (bool) db_get_value_filter(
'id_filter', 'id_filter',
'tevent_filter', 'tevent_filter',
@ -305,6 +310,10 @@ if ($update_event_filter) {
$values['user_comment'] = get_parameter('user_comment'); $values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event'); $values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') { if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]'; $values['tag_with'] = '[]';
} }
@ -371,6 +380,13 @@ if ($get_filter_values) {
} }
} }
if (is_metaconsole()) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']])); $event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
} }
@ -402,6 +418,8 @@ if ($load_filter_modal) {
); );
echo '<div id="load-filter-select" class="load-filter-modal">'; echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter">';
$table = new StdClass; $table = new StdClass;
$table->id = 'load_filter_form'; $table->id = 'load_filter_form';
$table->width = '100%'; $table->width = '100%';
@ -441,13 +459,15 @@ if ($load_filter_modal) {
__('Load filter'), __('Load filter'),
'load_filter', 'load_filter',
false, false,
'class="sub upd" onclick="load_form_filter();"', 'class="sub upd"',
true true
); );
$data[1] .= html_print_input_hidden('load_filter', 1, true);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
html_print_table($table); html_print_table($table);
echo '</form>';
echo '</div>'; echo '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -460,7 +480,8 @@ function show_filter() {
width: 450 width: 450
}); });
} }
//aki
function load_form_filter() { function load_form_filter() {
jQuery.post ( jQuery.post (
"<?php echo ui_get_full_url('ajax.php', false, false, false); ?>", "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
@ -471,7 +492,6 @@ function load_form_filter() {
}, },
function (data) { function (data) {
jQuery.each (data, function (i, val) { jQuery.each (data, function (i, val) {
console.log(val);
if (i == 'id_name') if (i == 'id_name')
$("#hidden-id_name").val(val); $("#hidden-id_name").val(val);
if (i == 'id_group'){ if (i == 'id_group'){
@ -517,6 +537,10 @@ function load_form_filter() {
$("#text-user_comment").val(val); $("#text-user_comment").val(val);
if (i == 'id_source_event') if (i == 'id_source_event')
$("#text-id_source_event").val(val); $("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
if (i == 'server_name')
$("#select2-server_id-container").text(val);
if(i == 'date_from') if(i == 'date_from')
$("#text-date_from").val(val); $("#text-date_from").val(val);
if(i == 'date_to') if(i == 'date_to')
@ -747,7 +771,8 @@ function save_new_filter() {
"source": $("#text-source").val(), "source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(), "id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(), "user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val() "id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
}, },
function (data) { function (data) {
$("#info_box").hide(); $("#info_box").hide();
@ -817,7 +842,8 @@ function save_update_filter() {
"source": $("#text-source").val(), "source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(), "id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(), "user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val() "id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
}, },
function (data) { function (data) {

View File

@ -35,7 +35,7 @@ if (check_login()) {
$search_term = get_parameter('search_term', ''); $search_term = get_parameter('search_term', '');
if ($get_users) { if ($get_users) {
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []); $integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv); $csv_array = explode("\n", $integria_users_csv);

View File

@ -0,0 +1,74 @@
<?php
/**
* Web Server Module Debug ajax controller.
*
* @category Web Server Module Debug
* @package Pandora FMS
* @subpackage Module Debug
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
global $id_agent_module;
// Module Debug Class.
require_once $config['homedir'].'/include/class/WebServerModuleDebug.class.php';
// This page.
$ajaxPage = $config['homedir'].'/include/ajax/web_server_module_debug';
// Control call flow for debug window.
try {
// Return of id of the agent module in AJAX.
if (is_ajax()) {
$id_agent_module = get_parameter('idAgentModule');
}
// User access and validation is being processed on class constructor.
$obj = new WebServerModuleDebug($ajaxPage, $id_agent_module);
} catch (Exception $e) {
if (is_ajax()) {
echo json_encode(['error' => '[WebServerModuleDebug]'.$e->getMessage() ]);
exit;
} else {
echo '[WebServerModuleDebug]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax()) {
$method = get_parameter('method');
if (method_exists($obj, $method) === true) {
$obj->{$method}();
} else {
$obj->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$obj->run();
}

View File

@ -2085,7 +2085,13 @@ class AgentWizard extends HTML
$tmp->ip_target($this->targetIp); $tmp->ip_target($this->targetIp);
$tmp->id_modulo(MODULE_PLUGIN); $tmp->id_modulo(MODULE_PLUGIN);
if (empty($candidate['macros']) === true) { if ($this->wizardSection === 'snmp_interfaces_explorer'
&& empty($candidate['macros']) === false
) {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
} else {
$fieldsPlugin = db_get_value_sql( $fieldsPlugin = db_get_value_sql(
sprintf( sprintf(
'SELECT macros FROM tplugin WHERE id=%d', 'SELECT macros FROM tplugin WHERE id=%d',
@ -2115,10 +2121,6 @@ class AgentWizard extends HTML
$tmp->id_plugin($infoMacros['server_plugin']); $tmp->id_plugin($infoMacros['server_plugin']);
$tmp->macros(json_encode($fieldsPlugin)); $tmp->macros(json_encode($fieldsPlugin));
} else {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
} }
} }
} }
@ -4313,15 +4315,6 @@ class AgentWizard extends HTML
'form="form-create-modules"' 'form="form-create-modules"'
); );
// Execution type module.
$data[6] .= html_print_input_hidden(
'module-execution_type-'.$uniqueId,
$module['execution_type'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
// WMI Query class. // WMI Query class.
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
'module-query_class-'.$uniqueId, 'module-query_class-'.$uniqueId,

View File

@ -488,7 +488,7 @@ class AgentsAlerts extends HTML
$nagents = count(agents_get_agents($filter_count)); $nagents = count(agents_get_agents($filter_count));
if ($agents == false) { if ($agents === false || empty($agents_with_alerts) === true) {
ui_print_info_message( ui_print_info_message(
[ [
'no_close' => true, 'no_close' => true,
@ -765,7 +765,7 @@ class AgentsAlerts extends HTML
// Start Header form. // Start Header form.
$headerForm = [ $headerForm = [
'action' => ui_get_full_url(), 'action' => ui_get_full_url('index.php?sec=view&sec2=extensions/agents_alerts'),
'id' => 'form-header-filters', 'id' => 'form-header-filters',
'method' => 'POST', 'method' => 'POST',
'class' => 'modal flex flex-row', 'class' => 'modal flex flex-row',

View File

@ -286,8 +286,12 @@ class Diagnostics extends Wizard
$return .= '</div>'; $return .= '</div>';
} }
if ($this->pdf === true) {
return $return;
} else {
return false; return false;
} }
}
/** /**
@ -1599,7 +1603,7 @@ class Diagnostics extends Wizard
} }
} }
return true; return $result;
} }

View File

@ -462,6 +462,12 @@ class ExternalTools extends HTML
$ids[] = join(',', $address); $ids[] = join(',', $address);
} }
// Must be an a IP at least for work.
if (empty($ids) === true) {
ui_print_message(__('The agent doesn`t have an IP yet'), 'error', true);
return;
}
$ips = db_get_all_rows_sql( $ips = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT ip FROM taddress WHERE id_a IN (%s)', 'SELECT ip FROM taddress WHERE id_a IN (%s)',
@ -469,18 +475,6 @@ class ExternalTools extends HTML
) )
); );
// Must be an a IP at least for work.
if (empty($ips) === true) {
html_print_div(
[
'class' => 'error',
'style' => 'margin-top:5px',
'content' => __('The agent hasn\'t got IP'),
]
);
return;
}
// Make the data for show in table. // Make the data for show in table.
$ipsSelect = array_reduce( $ipsSelect = array_reduce(
$ips, $ips,

View File

@ -867,6 +867,7 @@ class HTML
} }
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {
@ -1002,6 +1003,7 @@ class HTML
$output .= '</div>'; $output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {
@ -1073,6 +1075,7 @@ class HTML
$output .= '</div>'; $output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) { if ($rawjs) {

View File

@ -2840,13 +2840,7 @@ class NetworkMap
*/ */
public function loadSimpleInterface() public function loadSimpleInterface()
{ {
$output = '<div id="open_version_dialog" class="invisible">'; $output = '';
$output .= __(
'In the Open version of %s can not be edited nodes or map',
get_product_name()
);
$output .= '</div>';
$output .= '<div id="dialog_node_edit" class="invisible" title="'; $output .= '<div id="dialog_node_edit" class="invisible" title="';
$output .= __('Edit node').'">'; $output .= __('Edit node').'">';
$output .= '<div class="left w100p">'; $output .= '<div class="left w100p">';
@ -2896,6 +2890,12 @@ class NetworkMap
$id = 'dialog_node_edit'; $id = 'dialog_node_edit';
if (!enterprise_installed()) { if (!enterprise_installed()) {
$id = 'open_version_dialog'; $id = 'open_version_dialog';
$output = '<div id="open_version" style="display: none" title="'.__('Warning').'">';
$output .= '<div class="center mrgn_top_20px w90p font_13px">'.__(
'In the Open version of %s can not be edited nodes or map',
get_product_name()
);
$output .= '</div></div>';
} }
$output .= '<div id="'.$id.'" class="invisible" title="'; $output .= '<div id="'.$id.'" class="invisible" title="';
@ -3207,7 +3207,7 @@ class NetworkMap
$table->data[0][0] = __('Group'); $table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups( $table->data[0][1] = html_print_select_groups(
false, false,
'IW', 'AR',
false, false,
'group_for_show_agents', 'group_for_show_agents',
-1, -1,

View File

@ -424,7 +424,7 @@ class OrderInterpreter extends Wizard
} }
if ($iterator === 0) { if ($iterator === 0) {
echo __('No results found'); echo __('Press enter to search');
} }
echo '</div>'; echo '</div>';

View File

@ -1020,7 +1020,7 @@ class Tree
$agent_search_filter = $this->getAgentSearchFilter(); $agent_search_filter = $this->getAgentSearchFilter();
$agent_status_filter = $this->getAgentStatusFilter(); $agent_status_filter = $this->getAgentStatusFilter();
$module_search_filter = $this->getModuleSearchFilter(); $module_search_filter = $this->getModuleSearchFilter();
$module_status_filter = $this->getModuleStatusFilter(); $module_status_filter = $this->getModuleStatusFilterFromTestado($this->filter['statusModule']);
$condition = $this->L2condition; $condition = $this->L2condition;
$condition_inside = $this->L2conditionInside; $condition_inside = $this->L2conditionInside;

View File

@ -0,0 +1,407 @@
<?php
/**
* WebServer Module debug feature.
*
* @category Class
* @package Pandora FMS
* @subpackage Web Server Module
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2020 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
/**
* Class WebServerModuleDebug.
*/
class WebServerModuleDebug extends Wizard
{
/**
* Controller Url.
*
* @var string
*/
private $ajaxController;
/**
* Timeout for HTTP requests.
*
* @var integer
*/
private $requestTimeout;
/**
* CURL Query.
*
* @var string
*/
private $query;
/**
* Id of the current module.
*
* @var integer
*/
private $idAgentModule;
/**
* Class constructor.
*
* @param string $ajaxController Ajax Page Controller.
* @param integer $idAgentModule Id of the module.
*/
public function __construct(string $ajaxController, int $idAgentModule)
{
global $config;
// Check access.
check_login();
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access event viewer'
);
if (is_ajax()) {
echo json_encode(['error' => 'noaccess']);
}
include 'general/noaccess.php';
exit;
}
// Parameter assigments.
$this->ajaxController = $ajaxController;
$this->query = '';
$this->idAgentModule = $idAgentModule;
// Hardcoded request timeout.
$this->requestTimeout = 15;
return $this;
}
/**
* Run Module Debug window.
*
* @return void
*/
public function run()
{
// Added all necessary basic files for QueryResult.
ui_require_css_file('ace');
ui_require_javascript_file('ace', 'include/javascript/ace/');
// Load Javascript.
$this->loadJS();
// CSS.
ui_require_css_file('wizard');
ui_require_css_file('discovery');
// Specific CSS for this feature.
ui_require_css_file('WebServerModuleDebug', '/include/styles/', true);
}
/**
* Show the modal with the QueryResult.
*
* @return void
*/
public function showWebServerDebug()
{
// Show QueryResult editor.
ui_query_result_editor('webserverdebug');
// Spinner for wait loads.
html_print_div(
[
'id' => 'WebServerDebugSpinner',
'style' => 'visibility: hidden;',
'content' => __('Performing query. Please wait.').'&nbsp;'.html_print_image('images/spinner.gif', true),
]
);
?>
<script type="text/javascript">
$(document).ready(function(){
// Query section
var query = ace.edit("webserverdebug_editor");
let queryDefined = "<?php echo $this->defineQuery(); ?>";
let queryRegex = /([-]+[a-zA-Z]\s)|(([-]{2})+[a-z]+[-]*[a-z]*)/g;
query.setValue(queryDefined.replace(queryRegex, "\n$&"));
query.clearSelection();
// Result section
var results = ace.edit("webserverdebug_view");
var text = '';
results.setTheme("ace/theme/textmate");
results.session.setMode("ace/mode/json");
results.renderer.setShowGutter(false);
results.setReadOnly(true);
results.setShowPrintMargin(false);
$("#submit-execute_query").click(function() {
// Show the spinner.
showSpinner(true);
// Empty the results container.
results.setValue("");
// Get the entire text.
text = query.getValue();
// There are not values in the query section.
if (text === null || text === undefined) {
results.setValue('<?php echo __('No results'); ?>');
results.clearSelection();
// Hide spinner.
showSpinner(false);
return;
}
// Clean the carriage jumps.
text = text.split("\n").join("");
// Call to the method for execute the command.
$.ajax({
method: "post",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: {
page: "<?php echo $this->ajaxController; ?>",
method: "executeCommand",
text: text,
idAgentModule: "<?php echo $this->idAgentModule; ?>",
},
datatype: "json",
success: function(result) {
results.setValue(result);
},
error: function(e) {
results.setValue('<?php echo __('Error performing execution'); ?>');
},
complete: function() {
results.clearSelection();
showSpinner(false);
}
});
});
});
</script>
<?php
}
/**
* Definition of the query
*
* @return string
*/
private function defineQuery()
{
// Get the value of the debug_content.
$outputDebugQuery = db_get_value_filter(
'debug_content',
'tagente_modulo',
[
'id_agente_modulo' => $this->idAgentModule,
]
);
$this->query = ($outputDebugQuery !== false) ? $outputDebugQuery : __('Please, wait for a first execution of module');
return $this->query;
}
/**
* Perform the cURL execution.
*
* @return void
* @throws Exception $e Error message.
*/
public function executeCommand()
{
try {
$executionForPerform = io_safe_output(get_parameter('text'));
// If the execution comes empty.
if (empty($executionForPerform) === true) {
throw new Exception('Execution failed');
}
// For security reasons, only allow the 'curl' command.
$executionForPerform = strstr($executionForPerform, 'curl');
// Avoid pipes or concatenation of commands.
$unallowedChars = [
'|',
'&',
'||',
'&&',
';',
'\n',
];
$executionForPerform = str_replace(
$unallowedChars,
' ',
$executionForPerform
);
// Set execution timeout.
$executionForPerform .= sprintf(
$executionForPerform.' -m %d',
$this->requestTimeout
);
// Perform the execution.
system($executionForPerform, $returnCode);
// If execution does not got well.
if ($returnCode != 0) {
switch ($returnCode) {
case '2':
throw new Exception('Failed to initialize. Review the syntax.');
case '3':
throw new Exception('URL malformed. The syntax was not correct.');
case '5':
throw new Exception('Couldn\'t resolve proxy. The given proxy host could not be resolved.');
case '6':
throw new Exception('Couldn\'t resolve host. The given remote host could not be resolved.');
case '7':
throw new Exception('Failed to connect to host.');
default:
throw new Exception('Failed getting data.');
}
}
} catch (Exception $e) {
// Show execution error message.
echo __($e->getMessage());
}
exit;
}
/**
* Loads JS and return code.
*
* @return string
*/
public function loadJS()
{
$str = '';
ob_start();
?>
<script type="text/javascript">
$(document).ready(function(){
$('#button-btn_debugModule').click(function() {
load_modal({
target: $("#modal"),
form: "add_module_form",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
ajax_callback: showMsg,
modal: {
title: "<?php echo __('Debug'); ?>",
},
extradata: [
{
name: "idAgentModule",
value: "<?php echo $this->idAgentModule; ?>"
}],
onshow: {
page: "<?php echo $this->ajaxController; ?>",
width: 800,
method: "showWebServerDebug"
}
});
});
});
/**
* Toggle the visibility of spinner.
*/
function showSpinner(setVisibility) {
var spinner = $('#WebServerDebugSpinner');
if (setVisibility) {
spinner.css('visibility', 'visible');
} else {
spinner.css('visibility', 'hidden');
}
}
/**
* Process ajax responses and shows a dialog with results.
*/
function showMsg(data) {
var title = "<?php echo __('Success'); ?>";
var text = "";
var failed = 0;
try {
data = JSON.parse(data);
text = data["result"];
} catch (err) {
title = "<?php echo __('Failed'); ?>";
text = err.message;
failed = 1;
}
if (!failed && data["error"] != undefined) {
title = "<?php echo __('Failed'); ?>";
text = data["error"];
failed = 1;
}
if (data["report"] != undefined) {
data["report"].forEach(function(item) {
text += "<br>" + item;
});
}
$("#msg").empty();
$("#msg").html(text);
$("#msg").dialog({
width: 450,
position: {
my: "center",
at: "center",
of: window,
collision: "fit"
},
title: title
});
}
</script>
<?php
// Get the JS script.
$str = ob_get_clean();
// Return the loaded JS.
echo $str;
return $str;
}
}

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC210420'; $build_version = 'PC210527';
$pandora_version = 'v7.0NG.754'; $pandora_version = 'v7.0NG.754';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -2281,9 +2281,6 @@ function check_login($output=true)
* Check access privileges to resources * Check access privileges to resources
* *
* Access can be: * Access can be:
* IR - Incident/report Read
* IW - Incident/report Write
* IM - Incident/report Management
* AR - Agent Read * AR - Agent Read
* AW - Agent Write * AW - Agent Write
* LW - Alert Write * LW - Alert Write
@ -2374,9 +2371,6 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
* Check access privileges to resources (write or management is not allowed for 'all' group ) * Check access privileges to resources (write or management is not allowed for 'all' group )
* *
* Access can be: * Access can be:
* IR - Incident/report Read
* IW - Incident/report Write
* IM - Incident/report Management
* AR - Agent Read * AR - Agent Read
* AW - Agent Write * AW - Agent Write
* LW - Alert Write * LW - Alert Write
@ -2445,18 +2439,6 @@ function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=fa
function get_acl_column($access) function get_acl_column($access)
{ {
switch ($access) { switch ($access) {
case 'IR':
return 'incident_view';
break;
case 'IW':
return 'incident_edit';
break;
case 'IM':
return 'incident_management';
break;
case 'AR': case 'AR':
return 'agent_view'; return 'agent_view';
@ -2552,10 +2534,7 @@ function get_users_acl($id_user)
$rowdup = $users_acl_cache[$id_user]; $rowdup = $users_acl_cache[$id_user];
} else { } else {
$query = sprintf( $query = sprintf(
"SELECT sum(tperfil.incident_view) as incident_view, "SELECT sum(tperfil.agent_view) as agent_view,
sum(tperfil.incident_edit) as incident_edit,
sum(tperfil.incident_management) as incident_management,
sum(tperfil.agent_view) as agent_view,
sum(tperfil.agent_edit) as agent_edit, sum(tperfil.agent_edit) as agent_edit,
sum(tperfil.alert_edit) as alert_edit, sum(tperfil.alert_edit) as alert_edit,
sum(tperfil.alert_management) as alert_management, sum(tperfil.alert_management) as alert_management,
@ -5961,26 +5940,56 @@ function get_data_multiplier($unit)
* Send test email to check email setups. * Send test email to check email setups.
* *
* @param string $to Target email account. * @param string $to Target email account.
* @param array $params Array with connection data.
* Available fields:
* 'email_smtpServer',
* 'email_smtpPort',
* 'email_username',
* 'email_password',
* 'email_encryption',
* 'email_from_dir',
* 'email_from_name',
* *
* @return integer Status of the email send task. * @return integer Status of the email send task.
*/ */
function send_test_email( function send_test_email(
string $to string $to,
array $params=null
) { ) {
global $config; global $config;
$valid_params = [
'email_smtpServer',
'email_smtpPort',
'email_username',
'email_password',
'email_encryption',
'email_from_dir',
'email_from_name',
];
if (empty($params) === true) {
foreach ($valid_params as $token) {
$params[$token] = $config[$token];
}
} else {
if (array_diff($valid_params, array_keys($params)) === false) {
return false;
}
}
$result = false; $result = false;
try { try {
$transport = new Swift_SmtpTransport( $transport = new Swift_SmtpTransport(
$config['email_smtpServer'], $params['email_smtpServer'],
$config['email_smtpPort'] $params['email_smtpPort']
); );
$transport->setUsername($config['email_username']); $transport->setUsername($params['email_username']);
$transport->setPassword($config['email_password']); $transport->setPassword($params['email_password']);
if ($config['email_encryption']) { if ($params['email_encryption']) {
$transport->setEncryption($config['email_encryption']); $transport->setEncryption($params['email_encryption']);
} }
$mailer = new Swift_Mailer($transport); $mailer = new Swift_Mailer($transport);
@ -5989,8 +5998,8 @@ function send_test_email(
$message->setFrom( $message->setFrom(
[ [
$config['email_from_dir'] => io_safe_output( $params['email_from_dir'] => io_safe_output(
$config['email_from_name'] $params['email_from_name']
), ),
] ]
); );

View File

@ -2755,7 +2755,7 @@ function alerts_ui_update_or_create_actions($update=true)
$al_action = alerts_get_alert_action($id); $al_action = alerts_get_alert_action($id);
if ($al_action !== false) { if ($al_action !== false) {
if ($al_action['id_group'] == 0) { if ($al_action['id_group'] == 0) {
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Alert Management' 'Trying to access Alert Management'

View File

@ -1,16 +1,33 @@
<?php <?php
// Pandora FMS- http://pandorafms.com /**
// ================================================== * Functions for API.
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Functions.
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU Lesser General Public License * @subpackage API.
// as published by the Free Software Foundation; version 2 * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// 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. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config; global $config;
// Set character encoding to UTF-8 - fixes a lot of multibyte character headaches // Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
@ -486,7 +503,7 @@ function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db)
$returnAllColumns = ( $other['data'][2] == '1' ? true : false); $returnAllColumns = ( $other['data'][2] == '1' ? true : false);
} }
$groups = users_get_groups($user_in_db, 'IR', $returnAllGroup, $returnAllColumns); $groups = users_get_groups($user_in_db, 'AR', $returnAllGroup, $returnAllColumns);
$data_groups = []; $data_groups = [];
foreach ($groups as $id => $group) { foreach ($groups as $id => $group) {
@ -1614,6 +1631,302 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
} }
/**
* Update an agent by indicating a pair of field - value separated by comma.
*
* @param integer $id_agent Id (or alias) agent to upadate.
* @param boolean $use_agent_alias Use alias instead of id.
* @param array $params Pair of parameter/value separated by comma. Available fields are:
* 'alias',
* 'direccion',
* 'id_parent',
* 'id_grupo',
* 'cascade_protection',
* 'cascade_protection_module',
* 'intervalo',
* 'id_os',
* 'server_name',
* 'custom_id',
* 'modo',
* 'disabled',
* 'comentarios'
*
* eg . http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_agent_field&id=pandora&other=id_os,1|alias,pandora|direccion,192.168.10.16|id_parent,1cascade_protection,1|cascade_protection_module,1|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
*/
function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
{
global $config;
$return = false;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
return;
}
// Check the agent.
if ((bool) $use_agent_alias === true) {
$agents_by_alias = agents_get_agent_id_by_alias($id_agent);
if (empty($agents_by_alias) === false) {
foreach ($agents_by_alias as $agent) {
if (agents_check_access_agent($agent['id_agente'], 'AW') === true) {
$agents[] = $agent['id_agente'];
}
}
if (empty($agents) === true) {
returnError('forbidden', 'string');
return;
}
} else {
returnError('Alias does not match any agent.');
return;
}
} else {
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AW')) {
return;
}
$agents[] = $id_agent;
}
// Serialize the data for update.
if ($params['type'] === 'array') {
// Keys available to change.
$available_fields = [
'alias',
'direccion',
'id_parent',
'id_grupo',
'cascade_protection',
'cascade_protection_module',
'intervalo',
'id_os',
'server_name',
'custom_id',
'modo',
'disabled',
'comentarios',
];
foreach ($params['data'] as $key_value) {
list($key, $value) = explode(',', $key_value, 2);
if (in_array($key, $available_fields) === true) {
$fields[$key] = $value;
}
}
}
if (empty($fields) === true) {
returnError('Selected field not available. Please, select one the fields avove');
return;
}
// Check fields.
foreach ($fields as $field => $data) {
switch ($field) {
case 'alias':
if (empty($data)) {
returnError('No agent alias specified');
return;
}
break;
case 'id_grupo':
if (db_get_value_sql('SELECT FROM tgrupo WHERE id_grupo = '.$data) === false) {
returnError('The group doesn`t exist.');
return;
}
break;
case 'id_os':
if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$data) === false) {
returnError('The OS doesn`t exist.');
return;
}
break;
case 'server_name':
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$data.'"');
if ($server_name === false) {
returnError('The server doesn`t exist.');
return;
}
break;
case 'cascade_protection':
if ($data == 1) {
if (($field['id_parent'] != 0) && (db_get_value_sql(
'SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = '.$fields['id_parent'].' AND id_agente_modulo = '.$fields['cascade_protection_module']
) === false)
) {
returnError('Cascade protection is not applied because it is not a parent module');
}
} else {
unset($fields['cascade_protection']);
}
break;
case 'id_grupo':
// Check ACL group.
if (!check_acl($config['id_user'], $data, 'AW')) {
returnError('forbidden', 'string');
return;
}
if ($data == 0) {
$agent_update_error = 'The agent could not be modified. For security reasons, use a group other than 0.';
returnError($agent_update_error);
return;
}
break;
case 'id_parent':
$parentCheck = agents_check_access_agent($data);
if (is_null($parentCheck) === true) {
returnError('The parent agent does not exist.');
return;
}
if ($parentCheck === false) {
returnError('The user cannot access to parent agent.');
return;
}
break;
default:
// Default empty.
break;
}
}
// Var applied in case there is more than one agent.
$return = false;
$applied = 0;
foreach ($agents as $agent) {
$values_old = db_get_row_filter(
'tagente',
['id_agente' => $agent],
[
'id_grupo',
'disabled',
]
);
$tpolicy_group_old = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$values_old['id_grupo']
);
$return = db_process_sql_update(
'tagente',
$fields,
['id_agente' => $agent]
);
if ((count($agents) > 1) && $return !== 0) {
$applied += 1;
}
if ($return && !isset($field['direccion'])) {
// register ip for this agent in 'taddress'.
agents_add_address($agent, $field['direccion']);
}
if ($return) {
// Update config file
if (isset($field['disabled']) && $values_old['disabled'] != $field['disabled']) {
enterprise_hook(
'config_agents_update_config_token',
[
$agent,
'standby',
$field['disabled'],
]
);
}
if ($tpolicy_group_old) {
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$agent
);
if ($tpolicy_agents_old) {
$result2 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 1],
[
'id_agent' => $agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
$tpolicy_group = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$field['id_grupo']
);
if ($tpolicy_group) {
foreach ($tpolicy_group as $key => $value) {
$tpolicy_agents = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$agent
);
if (!$tpolicy_agents) {
db_process_sql_insert(
'tpolicy_agents',
[
'id_policy' => $value['id_policy'],
'id_agent' => $agent,
]
);
} else {
$result3 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 0],
[
'id_agent' => $agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
}
}
if (count($agents) > 1) {
returnData(
'string',
[
'type' => 'string',
'data' => __('Updated %d/%d agents', $applied, count($agents)),
]
);
} else {
returnData(
'string',
[
'type' => 'string',
'data' => __('Agent updated.'),
]
);
}
}
/** /**
* Create a new agent, and print the id for new agent. * Create a new agent, and print the id for new agent.
* *
@ -1682,7 +1995,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
// Check if agent exists (BUG WC-50518-2). // Check if agent exists (BUG WC-50518-2).
if ($alias == '' && $alias_as_name === 0) { if ($alias == '' && $alias_as_name === 0) {
returnError('No agent alias specified'); returnError('No agent alias specified');
} else if (agents_get_agent_id($server_name)) { } else if (agents_get_agent_id($nombre_agente)) {
returnError('The agent name already exists in DB.'); returnError('The agent name already exists in DB.');
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) { } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
returnError('The group does not exist.'); returnError('The group does not exist.');
@ -2004,13 +2317,13 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
foreach ($servers as $server) { foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) { if (metaconsole_connect($server) == NOERR) {
if ($other['data'][0] === '1') { if ($agent_by_alias) {
$idAgent = agents_get_agent_id_by_alias($id); $idAgent = agents_get_agent_id_by_alias($id);
} else { } else {
$idAgent[0] = agents_get_agent_id($id, true); $idAgent[0] = agents_get_agent_id($id, true);
} }
if (!empty($idAgent)) { if (empty($idAgent) === false) {
$result = agents_delete_agent($idAgent[0], true); $result = agents_delete_agent($idAgent[0], true);
} }
@ -2121,10 +2434,10 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
} }
$ag_groups = implode(',', (array) $ag_groups); $ag_groups = implode(',', (array) $ag_groups);
}
$where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))'; $where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))';
} }
}
if (isset($other['data'][3])) { if (isset($other['data'][3])) {
// Filter by alias // Filter by alias
@ -6717,7 +7030,7 @@ function api_set_stop_downtime($id, $thrash1, $other, $thrash3)
$data = db_get_row_sql($sql); $data = db_get_row_sql($sql);
if ($data['type_execution'] == 'periodically' && $data['executed'] == 1) { if ($data['type_execution'] == 'periodically' && $data['executed'] == 1) {
returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running planned downtime cannot be stopped.')); returnError('error_stop_downtime', __('Error stopping downtime. Periodical and running scheduled downtime cannot be stopped.'));
return; return;
} }
@ -7203,7 +7516,7 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
} }
if (empty($agents)) { if (empty($agents)) {
returnError('No agents to create planned downtime items'); returnError('No agents to create scheduled downtime items');
} else { } else {
if (!empty($returned['bad_modules'])) { if (!empty($returned['bad_modules'])) {
$bad_modules = __("and this modules are doesn't exists or not applicable a this agents: ").implode(', ', $returned['bad_modules']); $bad_modules = __("and this modules are doesn't exists or not applicable a this agents: ").implode(', ', $returned['bad_modules']);
@ -7228,6 +7541,305 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
} }
/**
* Edit planned Downtime.
* e.g.: api.php?op=set&op2=planned_downtimes_edit&apipass=1234&user=admin&pass=pandora&id=2&other=testing2|test2|2021/05/10|2021/06/12|19:03:03|19:55:00|0|0|0|0|0|0|0|0|1|31|quiet|once|weekly&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The second index contains a list of module names.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_edit($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
$values = [];
if (!empty($other['data'][0])) {
$values['name'] = io_safe_input($other['data'][0]);
}
if (!empty($other['data'][1])) {
$values['description'] = io_safe_input($other['data'][1]);
}
if (!empty($other['data'][2]) && !empty($other['data'][4])) {
$date_from = strtotime(html_entity_decode($other['data'][2].' '.$other['data'][4]));
$values['date_from'] = io_safe_input($date_from);
}
if (!empty($other['data'][4])) {
$values['periodically_time_from'] = io_safe_input($other['data'][4]);
}
if (!empty($other['data'][3]) && !empty($other['data'][5])) {
$date_to = strtotime(html_entity_decode($other['data'][3].' '.$other['data'][5]));
$values['date_to'] = io_safe_input($date_to);
}
if (!empty($other['data'][5])) {
$values['periodically_time_to'] = io_safe_input($other['data'][5]);
}
if ($other['data'][6] != '') {
$values['id_group'] = io_safe_input($other['data'][6]);
}
if ($other['data'][7] != '') {
$values['monday'] = io_safe_input($other['data'][7]);
}
if ($other['data'][8] != '') {
$values['tuesday'] = io_safe_input($other['data'][8]);
}
if ($other['data'][9] != '') {
$values['wednesday'] = io_safe_input($other['data'][9]);
}
if ($other['data'][10] != '') {
$values['thursday'] = io_safe_input($other['data'][10]);
}
if ($other['data'][11] != '') {
$values['friday'] = io_safe_input($other['data'][11]);
}
if ($other['data'][12] != '') {
$values['saturday'] = io_safe_input($other['data'][12]);
}
if ($other['data'][13] != '') {
$values['sunday'] = io_safe_input($other['data'][13]);
}
if (!empty($other['data'][14])) {
$values['periodically_day_from'] = io_safe_input($other['data'][14]);
}
if (!empty($other['data'][15])) {
$values['periodically_day_to'] = io_safe_input($other['data'][15]);
}
if (!empty($other['data'][16])) {
$values['type_downtime'] = io_safe_input($other['data'][16]);
}
if (!empty($other['data'][17])) {
$values['type_execution'] = io_safe_input($other['data'][17]);
}
if (!empty($other['data'][18])) {
$values['type_periodicity'] = io_safe_input($other['data'][18]);
}
$res = db_process_sql_update('tplanned_downtime', $values, ['id' => $id]);
if ($res === false) {
returnError('Planned downtime could not be updated');
} else {
returnData(
'string',
[
'type' => 'string',
'data' => __('Planned downtime updated'),
]
);
}
}
/**
* Delete agents in planned Downtime.
* e.g.: pi.php?op=set&op2=planned_downtimes_delete_agents&apipass=1234&user=admin&pass=pandora&id=4&other=1;2;3&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_delete_agents($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']);
$agents = explode(';', $agents);
$results = false;
foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
$result = db_process_sql_delete('tplanned_downtime_agents', ['id_agent' => $agent]);
db_process_sql_delete('tplanned_downtime_modules', ['id_agent' => $agent]);
if ($result == false) {
returnError(" Agent $agent could not be deleted.");
} else {
$results = true;
}
} else {
returnError(" Agent $agent is not in planned downtime.");
}
}
if ($results) {
returnData(
'string',
[
'type' => 'string',
'data' => __(' Agents deleted'),
]
);
}
}
}
/**
* Add agents planned Downtime.
* e.g.: api.php?op=set&op2=planned_downtimes_add_agents&apipass=1234&user=admin&pass=pandora&id=4&other=1;2;3&other_mode=url_encode_separator_|
*
* @param $id id of planned downtime.
* @param $thrash1 Don't use.
* @param array $other
* The first index contains a list of agent Ids.
* The list separator is the character ';'.
* @param $thrash3 Don't use.
*/
function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
returnError('forbidden', 'string');
return;
}
if ($id == '') {
returnError(
'id cannot be left blank.'
);
return;
}
if (db_get_value('id', 'tplanned_downtime', 'id', $id) === false) {
returnError(
'id does not exist'
);
return;
}
if ($other['data'] == '') {
returnError(
'data cannot be left blank.'
);
return;
}
if (!empty($other['data'][0])) {
$agents = io_safe_input($other['data']);
$agents = explode(';', $agents);
$results = false;
foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
$res = db_process_sql_insert(
'tplanned_downtime_agents',
[
'id_agent' => $agent,
'id_downtime' => $id,
'all_modules' => 0,
'manually_disabled' => 0,
]
);
if ($res) {
$results = true;
}
} else {
returnError(" Agent $agent is already at the planned downtime.");
}
}
if ($results) {
returnData(
'string',
[
'type' => 'string',
'data' => __(' Agents added'),
]
);
}
}
}
/** /**
* Update data module in policy. And return id from new module. * Update data module in policy. And return id from new module.
* *
@ -8412,6 +9024,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
$values['contact'] = $safe_other_data[6]; $values['contact'] = $safe_other_data[6];
$values['other'] = $safe_other_data[7]; $values['other'] = $safe_other_data[7];
$values['max_agents'] = $safe_other_data[8]; $values['max_agents'] = $safe_other_data[8];
$values['password'] = $safe_other_data[9];
$id_group = groups_create_group($group_name, $values); $id_group = groups_create_group($group_name, $values);
@ -11248,10 +11861,10 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
return; return;
} }
$group = $other['data'][0]; $group = (int) $other['data'][0];
$profile = $other['data'][1]; $profile = $other['data'][1];
if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) { if ($group !== 0 && db_get_value('id_grupo', 'tgrupo', 'id_grupo', $group) === false) {
returnError('There is not any group with the ID provided.'); returnError('There is not any group with the ID provided.');
return; return;
} }
@ -11358,9 +11971,6 @@ function api_get_user_profiles_info($thrash1, $thrash2, $thrash3, $returnType)
[ [
'id_perfil', 'id_perfil',
'name', 'name',
'incident_view as IR',
'incident_edit as IW',
'incident_management as IM',
'agent_view as AR', 'agent_view as AR',
'agent_edit as AW', 'agent_edit as AW',
'agent_disable as AD', 'agent_disable as AD',
@ -11413,29 +12023,26 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp
$values = [ $values = [
'name' => (string) $other['data'][0], 'name' => (string) $other['data'][0],
'incident_view' => (bool) $other['data'][1] ? 1 : 0, 'agent_view' => (bool) $other['data'][1] ? 1 : 0,
'incident_edit' => (bool) $other['data'][2] ? 1 : 0, 'agent_edit' => (bool) $other['data'][2] ? 1 : 0,
'incident_management' => (bool) $other['data'][3] ? 1 : 0, 'agent_disable' => (bool) $other['data'][3] ? 1 : 0,
'agent_view' => (bool) $other['data'][4] ? 1 : 0, 'alert_edit' => (bool) $other['data'][4] ? 1 : 0,
'agent_edit' => (bool) $other['data'][5] ? 1 : 0, 'alert_management' => (bool) $other['data'][5] ? 1 : 0,
'agent_disable' => (bool) $other['data'][6] ? 1 : 0, 'user_management' => (bool) $other['data'][6] ? 1 : 0,
'alert_edit' => (bool) $other['data'][7] ? 1 : 0, 'db_management' => (bool) $other['data'][7] ? 1 : 0,
'alert_management' => (bool) $other['data'][8] ? 1 : 0, 'event_view' => (bool) $other['data'][8] ? 1 : 0,
'user_management' => (bool) $other['data'][9] ? 1 : 0, 'event_edit' => (bool) $other['data'][9] ? 1 : 0,
'db_management' => (bool) $other['data'][10] ? 1 : 0, 'event_management' => (bool) $other['data'][10] ? 1 : 0,
'event_view' => (bool) $other['data'][11] ? 1 : 0, 'report_view' => (bool) $other['data'][11] ? 1 : 0,
'event_edit' => (bool) $other['data'][12] ? 1 : 0, 'report_edit' => (bool) $other['data'][12] ? 1 : 0,
'event_management' => (bool) $other['data'][13] ? 1 : 0, 'report_management' => (bool) $other['data'][13] ? 1 : 0,
'report_view' => (bool) $other['data'][14] ? 1 : 0, 'map_view' => (bool) $other['data'][14] ? 1 : 0,
'report_edit' => (bool) $other['data'][15] ? 1 : 0, 'map_edit' => (bool) $other['data'][15] ? 1 : 0,
'report_management' => (bool) $other['data'][16] ? 1 : 0, 'map_management' => (bool) $other['data'][16] ? 1 : 0,
'map_view' => (bool) $other['data'][17] ? 1 : 0, 'vconsole_view' => (bool) $other['data'][17] ? 1 : 0,
'map_edit' => (bool) $other['data'][18] ? 1 : 0, 'vconsole_edit' => (bool) $other['data'][18] ? 1 : 0,
'map_management' => (bool) $other['data'][19] ? 1 : 0, 'vconsole_management' => (bool) $other['data'][19] ? 1 : 0,
'vconsole_view' => (bool) $other['data'][20] ? 1 : 0, 'pandora_management' => (bool) $other['data'][20] ? 1 : 0,
'vconsole_edit' => (bool) $other['data'][21] ? 1 : 0,
'vconsole_management' => (bool) $other['data'][22] ? 1 : 0,
'pandora_management' => (bool) $other['data'][23] ? 1 : 0,
]; ];
$return = db_process_sql_insert('tperfil', $values); $return = db_process_sql_insert('tperfil', $values);
@ -11475,29 +12082,26 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
$values = [ $values = [
'name' => $other['data'][0] == '' ? $profile['name'] : (string) $other['data'][0], 'name' => $other['data'][0] == '' ? $profile['name'] : (string) $other['data'][0],
'incident_view' => $other['data'][1] == '' ? $profile['incident_view'] : (bool) $other['data'][1] ? 1 : 0, 'agent_view' => $other['data'][1] == '' ? $profile['agent_view'] : (bool) $other['data'][1] ? 1 : 0,
'incident_edit' => $other['data'][2] == '' ? $profile['incident_edit'] : (bool) $other['data'][2] ? 1 : 0, 'agent_edit' => $other['data'][2] == '' ? $profile['agent_edit'] : (bool) $other['data'][2] ? 1 : 0,
'incident_management' => $other['data'][3] == '' ? $profile['incident_management'] : (bool) $other['data'][3] ? 1 : 0, 'agent_disable' => $other['data'][3] == '' ? $profile['agent_disable'] : (bool) $other['data'][3] ? 1 : 0,
'agent_view' => $other['data'][4] == '' ? $profile['agent_view'] : (bool) $other['data'][4] ? 1 : 0, 'alert_edit' => $other['data'][4] == '' ? $profile['alert_edit'] : (bool) $other['data'][4] ? 1 : 0,
'agent_edit' => $other['data'][5] == '' ? $profile['agent_edit'] : (bool) $other['data'][5] ? 1 : 0, 'alert_management' => $other['data'][5] == '' ? $profile['alert_management'] : (bool) $other['data'][5] ? 1 : 0,
'agent_disable' => $other['data'][6] == '' ? $profile['agent_disable'] : (bool) $other['data'][6] ? 1 : 0, 'user_management' => $other['data'][6] == '' ? $profile['user_management'] : (bool) $other['data'][6] ? 1 : 0,
'alert_edit' => $other['data'][7] == '' ? $profile['alert_edit'] : (bool) $other['data'][7] ? 1 : 0, 'db_management' => $other['data'][7] == '' ? $profile['db_management'] : (bool) $other['data'][7] ? 1 : 0,
'alert_management' => $other['data'][8] == '' ? $profile['alert_management'] : (bool) $other['data'][8] ? 1 : 0, 'event_view' => $other['data'][8] == '' ? $profile['event_view'] : (bool) $other['data'][8] ? 1 : 0,
'user_management' => $other['data'][9] == '' ? $profile['user_management'] : (bool) $other['data'][9] ? 1 : 0, 'event_edit' => $other['data'][9] == '' ? $profile['event_edit'] : (bool) $other['data'][9] ? 1 : 0,
'db_management' => $other['data'][10] == '' ? $profile['db_management'] : (bool) $other['data'][10] ? 1 : 0, 'event_management' => $other['data'][10] == '' ? $profile['event_management'] : (bool) $other['data'][10] ? 1 : 0,
'event_view' => $other['data'][11] == '' ? $profile['event_view'] : (bool) $other['data'][11] ? 1 : 0, 'report_view' => $other['data'][11] == '' ? $profile['report_view'] : (bool) $other['data'][11] ? 1 : 0,
'event_edit' => $other['data'][12] == '' ? $profile['event_edit'] : (bool) $other['data'][12] ? 1 : 0, 'report_edit' => $other['data'][12] == '' ? $profile['report_edit'] : (bool) $other['data'][12] ? 1 : 0,
'event_management' => $other['data'][13] == '' ? $profile['event_management'] : (bool) $other['data'][13] ? 1 : 0, 'report_management' => $other['data'][13] == '' ? $profile['report_management'] : (bool) $other['data'][13] ? 1 : 0,
'report_view' => $other['data'][14] == '' ? $profile['report_view'] : (bool) $other['data'][14] ? 1 : 0, 'map_view' => $other['data'][14] == '' ? $profile['map_view'] : (bool) $other['data'][14] ? 1 : 0,
'report_edit' => $other['data'][15] == '' ? $profile['report_edit'] : (bool) $other['data'][15] ? 1 : 0, 'map_edit' => $other['data'][15] == '' ? $profile['map_edit'] : (bool) $other['data'][15] ? 1 : 0,
'report_management' => $other['data'][16] == '' ? $profile['report_management'] : (bool) $other['data'][16] ? 1 : 0, 'map_management' => $other['data'][16] == '' ? $profile['map_management'] : (bool) $other['data'][16] ? 1 : 0,
'map_view' => $other['data'][17] == '' ? $profile['map_view'] : (bool) $other['data'][17] ? 1 : 0, 'vconsole_view' => $other['data'][17] == '' ? $profile['vconsole_view'] : (bool) $other['data'][17] ? 1 : 0,
'map_edit' => $other['data'][18] == '' ? $profile['map_edit'] : (bool) $other['data'][18] ? 1 : 0, 'vconsole_edit' => $other['data'][18] == '' ? $profile['vconsole_edit'] : (bool) $other['data'][18] ? 1 : 0,
'map_management' => $other['data'][19] == '' ? $profile['map_management'] : (bool) $other['data'][19] ? 1 : 0, 'vconsole_management' => $other['data'][19] == '' ? $profile['vconsole_management'] : (bool) $other['data'][19] ? 1 : 0,
'vconsole_view' => $other['data'][20] == '' ? $profile['vconsole_view'] : (bool) $other['data'][20] ? 1 : 0, 'pandora_management' => $other['data'][20] == '' ? $profile['pandora_management'] : (bool) $other['data'][20] ? 1 : 0,
'vconsole_edit' => $other['data'][21] == '' ? $profile['vconsole_edit'] : (bool) $other['data'][21] ? 1 : 0,
'vconsole_management' => $other['data'][22] == '' ? $profile['vconsole_management'] : (bool) $other['data'][22] ? 1 : 0,
'pandora_management' => $other['data'][23] == '' ? $profile['pandora_management'] : (bool) $other['data'][23] ? 1 : 0,
]; ];
$return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]); $return = db_process_sql_update('tperfil', $values, ['id_perfil' => $id_profile]);
@ -11545,101 +12149,6 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
} }
/**
* Create new incident in Pandora.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <title>;<description>;
* <origin>;<priority>;<state>;<group> in this order and separator char
* (after text ; ) and separator (pass in param othermode as
* othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=set&op2=new_incident&other=titulo|descripcion%20texto|Logfiles|2|10|12&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use.
*/
function api_set_new_incident($thrash1, $thrash2, $other, $thrash3)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'IW')) {
returnError('forbidden', 'string');
return;
}
$title = $other['data'][0];
$description = $other['data'][1];
$origin = $other['data'][2];
$priority = $other['data'][3];
$id_creator = 'API';
$state = $other['data'][4];
$group = $other['data'][5];
$values = [
'inicio' => 'NOW()',
'actualizacion' => 'NOW()',
'titulo' => $title,
'descripcion' => $description,
'id_usuario' => 'API',
'origen' => $origin,
'estado' => $state,
'prioridad' => $priority,
'id_grupo' => $group,
'id_creator' => $id_creator,
];
$idIncident = db_process_sql_insert('tincidencia', $values);
if ($idIncident === false) {
returnError('A new incident could not be created.');
} else {
returnData('string', ['type' => 'string', 'data' => $idIncident]);
}
}
/**
* Add note into a incident.
*
* @param $id string Username author of note.
* @param $id2 integer ID of incident.
* @param $other string Note.
* @param $thrash2 Don't use.
*/
function api_set_new_note_incident($id, $id2, $other, $thrash2)
{
global $config;
if (defined('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, 'IW')) {
returnError('forbidden', 'string');
return;
}
$values = [
'id_usuario' => $id,
'id_incident' => $id2,
'nota' => $other['data'],
];
$idNote = db_process_sql_insert('tnota', $values);
if ($idNote === false) {
returnError('A new incident could not be created+.');
} else {
returnData('string', ['type' => 'string', 'data' => $idNote]);
}
}
/** /**
* Disable a module, given agent and module name. * Disable a module, given agent and module name.
* *
@ -12608,8 +13117,10 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$error_msg = ''; $error_msg = '';
if ($other['data'][2] != '') { if ($other['data'][2] != '') {
// Id agent assignment. If come from pandora_revent, id_agent can be 0.
$id_agent = $other['data'][2]; $id_agent = $other['data'][2];
if (is_metaconsole()) { // To the next if is metaconsole and id_agent is not none.
if (is_metaconsole() === true && $id_agent > 0) {
// On metaconsole, connect with the node to check the permissions // On metaconsole, connect with the node to check the permissions
if (empty($values['server_id'])) { if (empty($values['server_id'])) {
$agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent); $agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent);
@ -12632,7 +13143,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$values['id_agente'] = $id_agent; $values['id_agente'] = $id_agent;
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) { if ((int) $id_agent > 0 && util_api_check_agent_and_print_error($id_agent, 'string', 'AR') === false) {
if (is_metaconsole()) { if (is_metaconsole()) {
metaconsole_restore_db(); metaconsole_restore_db();
} }

View File

@ -200,8 +200,20 @@ function config_update_config()
$error_update[] = __('Use cert.'); $error_update[] = __('Use cert.');
} }
if (!config_update_value('attachment_store', (string) get_parameter('attachment_store'))) { $attachment_store = (string) get_parameter('attachment_store');
if (file_exists($attachment_store) === false
|| is_writable($attachment_store) === false
) {
$error_update[] = __('Attachment store'); $error_update[] = __('Attachment store');
$error_update[] .= __(
"Path doesn't exists or is not writable"
);
} else {
if (config_update_value('attachment_store', $attachment_store) === false) {
$error_update[] = __(
'Attachment store.'
);
}
} }
if (!config_update_value('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API'))) { if (!config_update_value('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API'))) {
@ -307,7 +319,7 @@ function config_update_config()
} }
if (!config_update_value('past_planned_downtimes', get_parameter('past_planned_downtimes'))) { if (!config_update_value('past_planned_downtimes', get_parameter('past_planned_downtimes'))) {
$error_update[] = __('Allow create planned downtimes in the past'); $error_update[] = __('Allow create scheduled downtimes in the past');
} }
if (!config_update_value('limit_parameters_massive', get_parameter('limit_parameters_massive'))) { if (!config_update_value('limit_parameters_massive', get_parameter('limit_parameters_massive'))) {
@ -1020,6 +1032,14 @@ function config_update_config()
$error_update[] = __('Custom subtitle header'); $error_update[] = __('Custom subtitle header');
} }
if (!config_update_value('meta_custom_title_header', (string) get_parameter('meta_custom_title_header'))) {
$error_update[] = __('Meta custom title header');
}
if (!config_update_value('meta_custom_subtitle_header', (string) get_parameter('meta_custom_subtitle_header'))) {
$error_update[] = __('Meta custom subtitle header');
}
if (!config_update_value('custom_title1_login', (string) get_parameter('custom_title1_login'))) { if (!config_update_value('custom_title1_login', (string) get_parameter('custom_title1_login'))) {
$error_update[] = __('Custom title1 login'); $error_update[] = __('Custom title1 login');
} }
@ -1048,10 +1068,6 @@ function config_update_config()
$error_update[] = __('Copyright notice'); $error_update[] = __('Copyright notice');
} }
if (!config_update_value('meta_custom_logo', (string) get_parameter('meta_custom_logo'))) {
$error_update[] = __('Custom logo metaconsole');
}
if (!config_update_value('meta_custom_logo_white_bg', (string) get_parameter('meta_custom_logo_white_bg'))) { if (!config_update_value('meta_custom_logo_white_bg', (string) get_parameter('meta_custom_logo_white_bg'))) {
$error_update[] = __('Custom logo metaconsole (white background)'); $error_update[] = __('Custom logo metaconsole (white background)');
} }
@ -1630,6 +1646,10 @@ function config_update_config()
break; break;
case 'integria': case 'integria':
if (!config_update_value('integria_user_level_conf', (int) get_parameter('integria_user_level_conf', 0))) {
$error_update[] = __('Integria user login');
}
if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) { if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) {
$error_update[] = __('Enable Integria IMS'); $error_update[] = __('Enable Integria IMS');
} }
@ -2275,6 +2295,20 @@ function config_process_config()
config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png'); config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png');
} }
if (is_metaconsole()) {
if (!isset($config['meta_custom_logo'])) {
config_update_value('meta_custom_logo', 'pandoraFMS_metaconsole_full.svg');
}
if (!isset($config['meta_custom_logo_collapsed'])) {
config_update_value('meta_custom_logo_collapsed', 'pandoraFMS_metaconsole_collapse.svg');
}
if (!isset($config['meta_menu_type'])) {
config_update_value('meta_menu_type', 'classic');
}
}
if (!isset($config['custom_logo_white_bg'])) { if (!isset($config['custom_logo_white_bg'])) {
config_update_value('custom_logo_white_bg', 'pandora_logo_head_white_bg.png'); config_update_value('custom_logo_white_bg', 'pandora_logo_head_white_bg.png');
} }
@ -2311,6 +2345,14 @@ function config_process_config()
config_update_value('custom_subtitle_header', __('the Flexible Monitoring System')); config_update_value('custom_subtitle_header', __('the Flexible Monitoring System'));
} }
if (!isset($config['meta_custom_title_header'])) {
config_update_value('meta_custom_title_header', __('PandoraFMS Metaconsole'));
}
if (!isset($config['meta_custom_subtitle_header'])) {
config_update_value('meta_custom_subtitle_header', __('Centralized operation console'));
}
if (!isset($config['custom_title1_login'])) { if (!isset($config['custom_title1_login'])) {
config_update_value('custom_title1_login', __('PANDORA FMS')); config_update_value('custom_title1_login', __('PANDORA FMS'));
} }
@ -2343,10 +2385,6 @@ function config_process_config()
config_update_value('meta_custom_support_url', 'https://support.pandorafms.com'); config_update_value('meta_custom_support_url', 'https://support.pandorafms.com');
} }
if (!isset($config['meta_custom_logo'])) {
config_update_value('meta_custom_logo', 'logo_pandora_metaconsola.png');
}
if (!isset($config['meta_custom_logo_white_bg'])) { if (!isset($config['meta_custom_logo_white_bg'])) {
config_update_value('pandora_logo_head_white_bg', 'pandora_logo_head_white_bg.png'); config_update_value('pandora_logo_head_white_bg', 'pandora_logo_head_white_bg.png');
} }
@ -3232,6 +3270,10 @@ function config_process_config()
} }
// Integria. // Integria.
if (!isset($config['integria_user_level_conf'])) {
config_update_value('integria_user_level_conf', 0);
}
if (!isset($config['integria_enabled'])) { if (!isset($config['integria_enabled'])) {
config_update_value('integria_enabled', 0); config_update_value('integria_enabled', 0);
} }

View File

@ -1092,8 +1092,15 @@ function events_get_all(
// User comment. // User comment.
if (!empty($filter['user_comment'])) { if (!empty($filter['user_comment'])) {
// For filter field.
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND lower(te.user_comment) like lower("%%%s%%") ', ' AND lower(te.user_comment) like lower("%%%s%%") ',
io_safe_input($filter['user_comment'])
);
// For show comments on event details.
$sql_filters[] = sprintf(
' OR lower(te.user_comment) like lower("%%%s%%") ',
$filter['user_comment'] $filter['user_comment']
); );
} }
@ -3006,15 +3013,11 @@ function events_get_agent(
) { ) {
global $config; global $config;
if (!is_numeric($date)) { if (is_numeric($date) === false) {
$date = time_w_fixed_tz($date); $date = time_w_fixed_tz($date);
} }
if (is_metaconsole() && $events_group === false) { if (empty($date) === true) {
$id_server = true;
}
if (empty($date)) {
$date = get_system_time(); $date = get_system_time();
} }
@ -3149,10 +3152,6 @@ function events_get_agent(
} }
} }
if (is_metaconsole() && $id_server) {
$sql_where .= ' AND server_id = '.$id_server;
}
if ($show_summary_group) { if ($show_summary_group) {
return events_get_events_grouped( return events_get_events_grouped(
$sql_where, $sql_where,
@ -3166,7 +3165,7 @@ function events_get_agent(
} else { } else {
return events_get_events_no_grouped( return events_get_events_no_grouped(
$sql_where, $sql_where,
(is_metaconsole() === true && $id_server === false) ? true : false, (is_metaconsole() === true && (int) $id_server === 0) ? true : false,
$history $history
); );
} }
@ -3743,7 +3742,7 @@ function events_page_responses($event, $childrens_ids=[])
['id_group' => $id_groups] ['id_group' => $id_groups]
); );
if (empty($event_responses)) { if (empty($event_responses) || (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM'))) {
$data[1] = '<i>'.__('N/A').'</i>'; $data[1] = '<i>'.__('N/A').'</i>';
} else { } else {
$responses = []; $responses = [];
@ -3789,7 +3788,7 @@ function events_page_responses($event, $childrens_ids=[])
$('.params_rows').remove(); $('.params_rows').remove();
$('#responses_table') $('#responses_table')
.append('<tr class=\"params_rows\"><td>".__('Description')."</td><td class=\"left height_30px\" colspan=\"2\">'+description+'</td></tr>'); .append('<tr class=\"params_rows\"><td>".__('Description')."</td><td class=\"height_30px\" colspan=\"2\">'+description+'</td></tr>');
if (params.length == 1 && params[0] == '') { if (params.length == 1 && params[0] == '') {
return; return;
@ -4313,6 +4312,8 @@ function events_page_details($event, $server='')
$serverstring = ''; $serverstring = '';
} }
$table_class = 'table_modal_alternate';
// Details. // Details.
$table_details = new stdClass; $table_details = new stdClass;
$table_details->width = '100%'; $table_details->width = '100%';
@ -4320,7 +4321,7 @@ function events_page_details($event, $server='')
$table_details->head = []; $table_details->head = [];
$table_details->cellspacing = 0; $table_details->cellspacing = 0;
$table_details->cellpadding = 0; $table_details->cellpadding = 0;
$table_details->class = 'table_modal_alternate'; $table_details->class = $table_class;
/* /*
* Useless switch. * Useless switch.
@ -4517,7 +4518,7 @@ function events_page_details($event, $server='')
$link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)"; $link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)";
$data[1] = '<a href="javascript:'.$link.'">'; $data[1] = '<a href="javascript:'.$link.'">';
$data[1] .= html_print_image('images/chart_curve.png', true); $data[1] .= html_print_image('images/chart_curve.png', true, ['class' => 'invert_filter']);
$data[1] .= '</a>'; $data[1] .= '</a>';
$table_details->data[] = $data; $table_details->data[] = $data;
} }
@ -4537,13 +4538,19 @@ function events_page_details($event, $server='')
$data[1] .= html_print_image( $data[1] .= html_print_image(
'images/bell.png', 'images/bell.png',
true, true,
['title' => __('Go to data overview')] [
'title' => __('Go to data overview'),
'class' => 'invert_filter',
]
); );
} else { } else {
$data[1] .= html_print_image( $data[1] .= html_print_image(
'images/bell_pause.png', 'images/bell_pause.png',
true, true,
['title' => __('Go to data overview')] [
'title' => __('Go to data overview'),
'class' => 'invert_filter',
]
); );
} }

View File

@ -971,7 +971,7 @@ function gis_save_map(
] ]
); );
// Angent // Angent
if ((isset($layer['layer_agent_list'])) and (count($layer['layer_agent_list']) > 0)) { if ((isset($layer['layer_agent_list'])) && (count($layer['layer_agent_list']) > 0)) {
foreach ($layer['layer_agent_list'] as $agent) { foreach ($layer['layer_agent_list'] as $agent) {
db_process_sql_insert( db_process_sql_insert(
'tgis_map_layer_has_tagente', 'tgis_map_layer_has_tagente',
@ -984,7 +984,7 @@ function gis_save_map(
} }
// Group // Group
if ((isset($layer['layer_group_list'])) and (count($layer['layer_group_list']) > 0)) { if ((isset($layer['layer_group_list'])) && (count($layer['layer_group_list']) > 0)) {
foreach ($layer['layer_group_list'] as $group) { foreach ($layer['layer_group_list'] as $group) {
db_process_sql_insert( db_process_sql_insert(
'tgis_map_layer_groups', 'tgis_map_layer_groups',
@ -1386,55 +1386,55 @@ function gis_validate_map_data(
echo "<style type='text/css'>"; echo "<style type='text/css'>";
// validateMap // ValidateMap.
if ($map_name == '') { if ($map_name == '') {
echo 'input[name=map_name] {background: #FF5050;}'; echo 'input[name=map_name] {background: #FF5050;}';
$invalidFields['map_name'] = true; $invalidFields['map_name'] = true;
} }
// validate zoom level // Validate zoom level.
if (($map_zoom_level == '') || ($map_zoom_level > $map_levels_zoom)) { if (($map_zoom_level == '') || ($map_zoom_level > $map_levels_zoom)) {
echo 'input[name=map_zoom_level] {background: #FF5050;}'; echo 'input[name=map_zoom_level] {background: #FF5050;}';
$invalidFields['map_zoom_level'] = true; $invalidFields['map_zoom_level'] = true;
} }
// validate map_initial_longitude // Validate map_initial_longitude.
if ($map_initial_longitude == '') { if ($map_initial_longitude == '') {
echo 'input[name=map_initial_longitude] {background: #FF5050;}'; echo 'input[name=map_initial_longitude] {background: #FF5050;}';
$invalidFields['map_initial_longitude'] = true; $invalidFields['map_initial_longitude'] = true;
} }
// validate map_initial_latitude // Validate map_initial_latitude.
if ($map_initial_latitude == '') { if ($map_initial_latitude == '') {
echo 'input[name=map_initial_latitude] {background: #FF5050;}'; echo 'input[name=map_initial_latitude] {background: #FF5050;}';
$invalidFields['map_initial_latitude'] = true; $invalidFields['map_initial_latitude'] = true;
} }
// validate map_initial_altitude // Validate map_initial_altitude.
if ($map_initial_altitude == '') { if ($map_initial_altitude == '') {
echo 'input[name=map_initial_altitude] {background: #FF5050;}'; echo 'input[name=map_initial_altitude] {background: #FF5050;}';
$invalidFields['map_initial_altitude'] = true; $invalidFields['map_initial_altitude'] = true;
} }
// validate map_default_longitude // Validate map_default_longitude.
if ($map_default_longitude == '') { if ($map_default_longitude == '') {
echo 'input[name=map_default_longitude] {background: #FF5050;}'; echo 'input[name=map_default_longitude] {background: #FF5050;}';
$invalidFields['map_default_longitude'] = true; $invalidFields['map_default_longitude'] = true;
} }
// validate map_default_latitude // Validate map_default_latitude.
if ($map_default_latitude == '') { if ($map_default_latitude == '') {
echo 'input[name=map_default_latitude] {background: #FF5050;}'; echo 'input[name=map_default_latitude] {background: #FF5050;}';
$invalidFields['map_default_latitude'] = true; $invalidFields['map_default_latitude'] = true;
} }
// validate map_default_altitude // Validate map_default_altitude.
if ($map_default_altitude == '') { if ($map_default_altitude == '') {
echo 'input[name=map_default_altitude] {background: #FF5050;}'; echo 'input[name=map_default_altitude] {background: #FF5050;}';
$invalidFields['map_default_altitude'] = true; $invalidFields['map_default_altitude'] = true;
} }
// validate map_default_altitude // Validate map_default_altitude.
if ($map_connection_list == '') { if ($map_connection_list == '') {
$invalidFields['map_connection_list'] = true; $invalidFields['map_connection_list'] = true;
} }

View File

@ -2978,9 +2978,9 @@ function grafico_incidente_prioridad()
{ {
global $config; global $config;
$integria_ticket_count_by_priority_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['prioridad', 30], false, '', '|;|'); $integria_ticket_count_by_priority_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['prioridad', 30], false, '', '|;|');
$integria_priorities_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', '', false, 'json'); $integria_priorities_map_json = integria_api_call(null, null, null, null, 'get_incident_priorities', '', false, 'json');
$integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true); $integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true);
$integria_priorities_map = json_decode($integria_priorities_map_json, true); $integria_priorities_map = json_decode($integria_priorities_map_json, true);
@ -3023,9 +3023,9 @@ function graph_incidents_status()
{ {
global $config; global $config;
$integria_ticket_count_by_status_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['estado', 30], false, '', '|;|'); $integria_ticket_count_by_status_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['estado', 30], false, '', '|;|');
$integria_status_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', '', false, 'json'); $integria_status_map_json = integria_api_call(null, null, null, null, 'get_incidents_status', '', false, 'json');
$integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true); $integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true);
$integria_status_map = json_decode($integria_status_map_json, true); $integria_status_map = json_decode($integria_status_map_json, true);
@ -3068,9 +3068,9 @@ function graphic_incident_group()
{ {
global $config; global $config;
$integria_ticket_count_by_group_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_grupo', 30], false, '', '|;|'); $integria_ticket_count_by_group_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_grupo', 30], false, '', '|;|');
$integria_group_map_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', '', false, 'json'); $integria_group_map_json = integria_api_call(null, null, null, null, 'get_groups', '', false, 'json');
$integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true); $integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true);
$integria_group_map = json_decode($integria_group_map_json, true); $integria_group_map = json_decode($integria_group_map_json, true);
@ -3114,7 +3114,7 @@ function graphic_incident_user()
{ {
global $config; global $config;
$integria_ticket_count_by_user_json = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_tickets_count', ['id_usuario', 30], false, '', '|;|'); $integria_ticket_count_by_user_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_usuario', 30], false, '', '|;|');
$integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true); $integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true);
@ -3682,16 +3682,9 @@ function graph_custom_sql_graph(
} }
} }
if ($id != null) {
$historical_db = db_get_value_sql(
'SELECT historical_db from treport_content where id_rc ='.$content['id_rc']
);
} else {
$historical_db = $content['historical_db']; $historical_db = $content['historical_db'];
} if ($content['external_source'] != '') {
$sql = io_safe_output($content['external_source']);
if ($report_content['external_source'] != '') {
$sql = io_safe_output($report_content['external_source']);
} else { } else {
$sql = db_get_row( $sql = db_get_row(
'treport_custom_sql', 'treport_custom_sql',

View File

@ -577,6 +577,14 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
$group['parent'] = 0; $group['parent'] = 0;
} }
if (is_array($tree[$group['parent']]) === false) {
$str = $tree[$group['parent']];
$tree[$group['parent']] = [
'nombre' => $tree[$group['parent']],
'id_grupo' => $group['parent'],
];
}
$tree[$group['parent']]['hash_branch'] = 1; $tree[$group['parent']]['hash_branch'] = 1;
$tree[$group['parent']]['branch'][$key] = &$tree[$key]; $tree[$group['parent']]['branch'][$key] = &$tree[$key];
} }
@ -756,14 +764,18 @@ function groups_create_group($group_name, $rest_values)
$values = array_merge($rest_values, $array_tmp); $values = array_merge($rest_values, $array_tmp);
if (!isset($values['propagate'])) { if (isset($values['propagate']) === false) {
$values['propagate'] = 0; $values['propagate'] = 0;
} }
if (!isset($values['disabled'])) { if (isset($values['disabled']) === false) {
$values['disabled'] = 0; $values['disabled'] = 0;
} }
if (isset($values['max_agents']) === false) {
$values['max_agents'] = 0;
}
$check = db_get_value('nombre', 'tgrupo', 'nombre', $group_name); $check = db_get_value('nombre', 'tgrupo', 'nombre', $group_name);
if (!$check) { if (!$check) {

View File

@ -1939,7 +1939,7 @@ function html_print_extended_select_for_time(
html_print_select( html_print_select(
$units, $units,
$uniq_name.'_units', $uniq_name.'_units',
1, '60',
''.$script, ''.$script,
$nothing, $nothing,
$nothing_value, $nothing_value,
@ -2765,6 +2765,8 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
'lang', 'lang',
'tabindex', 'tabindex',
'title', 'title',
'data-title',
'data-use_title_for_force_title',
'xml:lang', 'xml:lang',
'onclick', 'onclick',
'ondblclick', 'ondblclick',
@ -4304,10 +4306,14 @@ function html_print_sort_arrows($params, $order_tag, $up='up', $down='down')
/** /**
* Print an input hidden with a new csrf token generated * Print an input hidden with a new csrf token generated
*
* @param boolean $return If it is true return a string with the output instead to echo the output.
*
* @return void
*/ */
function html_print_csrf_hidden() function html_print_csrf_hidden(bool $return=false)
{ {
html_print_input_hidden('csrf_code', generate_csrf_code()); return html_print_input_hidden('csrf_code', generate_csrf_code(), $return);
} }
@ -5082,6 +5088,9 @@ function html_print_input_multicheck(array $data):string
* @param string $default The default value to show in the ajax control. * @param string $default The default value to show in the ajax control.
* @param boolean $return If it is true return a string with the output instead to echo the output. * @param boolean $return If it is true return a string with the output instead to echo the output.
* @param string $size Size. * @param string $size Size.
* @param boolean $disable Disable the button (optional, button enabled by default).
* @param boolean $required Attribute required.
* @param string $class Text inpunt class.
* *
* @return mixed If the $return is true, return the output as string. * @return mixed If the $return is true, return the output as string.
*/ */
@ -5091,7 +5100,8 @@ function html_print_autocomplete_users_from_integria(
$return=false, $return=false,
$size='30', $size='30',
$disable=false, $disable=false,
$required=false $required=false,
$class=null
) { ) {
global $config; global $config;
@ -5108,6 +5118,10 @@ function html_print_autocomplete_users_from_integria(
$attrs['required'] = 'required'; $attrs['required'] = 'required';
} }
if (empty($class) === false) {
$attrs['class'] = $class;
}
html_print_input_text_extended( html_print_input_text_extended(
$name, $name,
$default, $default,

View File

@ -21,6 +21,7 @@ global $config;
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_html.php'; require_once $config['homedir'].'/include/functions_html.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions.php';
@ -78,22 +79,10 @@ function integriaims_tabs($active_tab, $view=false)
} }
$onheader = []; $onheader = [];
if (check_acl($config['id_user'], 0, 'IR') && $view) {
$onheader['view'] = $view_tab; $onheader['view'] = $view_tab;
}
if (check_acl($config['id_user'], 0, 'PM')) {
$onheader['configure'] = $setup_tab; $onheader['configure'] = $setup_tab;
}
if (check_acl($config['id_user'], 0, 'IR')) {
$onheader['list'] = $list_tab; $onheader['list'] = $list_tab;
}
if (check_acl($config['id_user'], 0, 'IW')) {
$onheader['create'] = $create_tab; $onheader['create'] = $create_tab;
}
return $onheader; return $onheader;
} }
@ -137,7 +126,7 @@ function integriaims_get_details($details, $detail_index=false)
break; break;
} }
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], $operation); $api_call = integria_api_call(null, null, null, null, $operation);
$result = []; $result = [];
get_array_from_csv_data_pair($api_call, $result); get_array_from_csv_data_pair($api_call, $result);
@ -165,8 +154,42 @@ function integriaims_get_details($details, $detail_index=false)
* *
* @return boolean True if API request succeeded, false if API request failed. * @return boolean True if API request succeeded, false if API request failed.
*/ */
function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params='', $show_credentials_error_msg=false, $return_type='', $token='') function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api_pass=null, $operation, $params='', $show_credentials_error_msg=false, $return_type='', $token='', $user_level_conf=null)
{ {
global $config;
if ($user_level_conf === null) {
$user_level_conf = (bool) $config['integria_user_level_conf'];
}
$user_info = users_get_user_by_id($config['id_user']);
// API access data.
if ($api_hostname === null) {
$api_hostname = $config['integria_hostname'];
}
if ($api_pass === null) {
$api_pass = $config['integria_api_pass'];
}
// Integria user and password.
if ($user === null || $user_level_conf === true) {
$user = $config['integria_user'];
if ($user_level_conf === true) {
$user = $user_info['integria_user_level_user'];
}
}
if ($user_pass === null || $user_level_conf === true) {
$user_pass = $config['integria_pass'];
if ($user_level_conf === true) {
$user_pass = $user_info['integria_user_level_pass'];
}
}
if (is_array($params)) { if (is_array($params)) {
$params = implode($token, $params); $params = implode($token, $params);
} }
@ -188,7 +211,7 @@ function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operati
} }
// Build URL for API request. // Build URL for API request.
$url = $api_hostname.'/integria/include/api.php'; $url = $api_hostname.'/include/api.php';
// ob_start(); // ob_start();
// $out = fopen('php://output', 'w'); // $out = fopen('php://output', 'w');
@ -352,10 +375,10 @@ function get_tickets_integriaims($tickets_filters)
// API call. // API call.
$result_api_call_list = integria_api_call( $result_api_call_list = integria_api_call(
$config['integria_hostname'], null,
$config['integria_user'], null,
$config['integria_pass'], null,
$config['integria_api_pass'], null,
'get_incidents', 'get_incidents',
[ [
$incident_text, $incident_text,

View File

@ -590,3 +590,32 @@ function io_output_password($password)
return io_safe_output($plaintext); return io_safe_output($plaintext);
} }
/**
* Clean html tags symbols for prevent use JS
*
* @param string $string String for safe.
*
* @return string
*/
function io_safe_html_tags(string $string)
{
// Must have safe output for work properly.
$string = io_safe_output($string);
if (strpos($string, '<') !== false && strpos($string, '>') !== false) {
$output = strstr($string, '<', true);
$tmpOutput = strstr($string, '<');
$output .= strstr(substr($tmpOutput, 1), '>', true);
$tmpOutput = strstr($string, '>');
$output .= substr($tmpOutput, 1);
// If the string still contains tags symbols.
if (strpos($string, '<') !== false && strpos($string, '>') !== false) {
$output = io_safe_html_tags($output);
}
} else {
$output = $string;
}
return $output;
}

View File

@ -152,7 +152,6 @@ function menu_print_menu(&$menu)
$first_sub_sec2 = ''; $first_sub_sec2 = '';
foreach ($main['sub'] as $subsec2 => $sub) { foreach ($main['sub'] as $subsec2 => $sub) {
// hd($sub, true);
$count_sub++; $count_sub++;
// Init some variables. // Init some variables.

View File

@ -1,22 +1,32 @@
<?php <?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/** /**
* @package Include * Functions for modules.
* @subpackage Modules *
* @category Functions script.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/ */
// Begin.
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
@ -208,7 +218,16 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
$new_module = $module; $new_module = $module;
// Rewrite different values // Rewrite different values
if ($module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_PROC
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_STRING
|| $module['id_tipo_modulo'] == MODULE_TYPE_REMOTE_CMD_INC
) {
$new_module['ip_target'] = $module['ip_target'];
} else {
$new_module['ip_target'] = agents_get_address($id_destiny_agent); $new_module['ip_target'] = agents_get_address($id_destiny_agent);
}
$new_module['policy_linked'] = 0; $new_module['policy_linked'] = 0;
$new_module['id_policy_module'] = 0; $new_module['id_policy_module'] = 0;
@ -567,7 +586,7 @@ function modules_update_agent_module(
* Creates a module in an agent. * Creates a module in an agent.
* *
* @param integer $id_agent Agent id. * @param integer $id_agent Agent id.
* @param integer $name Module name id. * @param string $name Module name id.
* @param array $values Extra values for the module. * @param array $values Extra values for the module.
* @param boolean $disableACL Disable the ACL checking, for default false. * @param boolean $disableACL Disable the ACL checking, for default false.
* @param mixed $tags Array with tag's ids or false. * @param mixed $tags Array with tag's ids or false.
@ -575,35 +594,36 @@ function modules_update_agent_module(
* @return New module id if the module was created. False if not. * @return New module id if the module was created. False if not.
*/ */
function modules_create_agent_module( function modules_create_agent_module(
$id_agent, int $id_agent,
$name, string $name,
$values=false, array $values=[],
$disableACL=false, bool $disableACL=false,
$tags=false $tags=false
) { ) {
global $config; global $config;
if (!$disableACL) { if ((bool) $disableACL === false) {
if (!users_is_admin() && (empty($id_agent) if ((bool) users_is_admin() === false
|| !users_access_to_agent($id_agent, 'AW')) && (empty($id_agent) === true
|| users_access_to_agent($id_agent, 'AW') === false)
) { ) {
return false; return false;
} }
} }
if (empty($name)) { if (empty($name) === true) {
return ERR_INCOMPLETE; return ERR_INCOMPLETE;
} }
// Check for non valid characters in module name. // Check for non valid characters in module name.
if (mb_ereg_match('[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]', io_safe_output($name)) !== false) { if (mb_ereg_match(
'[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]',
io_safe_output($name)
) !== false
) {
return ERR_GENERIC; return ERR_GENERIC;
} }
if (! is_array($values)) {
$values = [];
}
$values['nombre'] = $name; $values['nombre'] = $name;
$values['id_agente'] = (int) $id_agent; $values['id_agente'] = (int) $id_agent;
@ -616,29 +636,39 @@ function modules_create_agent_module(
] ]
); );
if ($exists) { if ($exists === true) {
return ERR_EXIST; return ERR_EXIST;
} }
// Encrypt passwords. // Encrypt passwords.
if (isset($values['plugin_pass'])) { if (isset($values['plugin_pass']) === true) {
// Avoid two times encryption // Avoid two times encryption.
$plugin_pass = io_safe_output($values['plugin_pass']); $plugin_pass = io_safe_output($values['plugin_pass']);
$values['plugin_pass'] = io_input_password($plugin_pass); $values['plugin_pass'] = io_input_password($plugin_pass);
} }
// Encrypt SNMPv3 passwords. // Encrypt SNMPv3 passwords.
if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15 if (isset($values['id_tipo_modulo']) === true
&& $values['id_tipo_modulo'] <= 18) && ((int) $values['id_tipo_modulo'] >= MODULE_TYPE_REMOTE_SNMP
&& isset($values['tcp_send']) && ($values['tcp_send'] == 3) && (int) $values['id_tipo_modulo'] <= MODULE_TYPE_REMOTE_SNMP_PROC)
&& isset($values['custom_string_2']) && isset($values['tcp_send']) === true
&& ((int) $values['tcp_send'] === 3)
&& isset($values['custom_string_2']) === true
) { ) {
$values['custom_string_2'] = io_input_password( $values['custom_string_2'] = io_input_password(
$values['custom_string_2'] $values['custom_string_2']
); );
} }
// Only for Web server modules.
if (isset($values['id_tipo_modulo']) === true
&& ($values['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
&& $values['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING)
) {
$values['debug_content'] = io_safe_input($values['debug_content']);
}
$id_agent_module = db_process_sql_insert('tagente_modulo', $values); $id_agent_module = db_process_sql_insert('tagente_modulo', $values);
if ($id_agent_module === false) { if ($id_agent_module === false) {
@ -646,7 +676,7 @@ function modules_create_agent_module(
} }
$return_tag = true; $return_tag = true;
if (($tags !== false) || (empty($tags))) { if (($tags !== false) || (empty($tags) === true)) {
$return_tag = tags_insert_module_tag($id_agent_module, $tags); $return_tag = tags_insert_module_tag($id_agent_module, $tags);
} }
@ -659,10 +689,10 @@ function modules_create_agent_module(
return ERR_DB; return ERR_DB;
} }
if (isset($values['id_tipo_modulo']) if (isset($values['id_tipo_modulo']) === true
&& ($values['id_tipo_modulo'] == 21 && ((int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_PROC
|| $values['id_tipo_modulo'] == 22 || (int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_DATA
|| $values['id_tipo_modulo'] == 23) || (int) $values['id_tipo_modulo'] === MODULE_TYPE_ASYNC_STRING)
) { ) {
// Async modules start in normal status. // Async modules start in normal status.
$status = AGENT_MODULE_STATUS_NORMAL; $status = AGENT_MODULE_STATUS_NORMAL;
@ -706,8 +736,8 @@ function modules_create_agent_module(
} }
// Update module status count if the module is not created disabled. // Update module status count if the module is not created disabled.
if (!isset($values['disabled']) || $values['disabled'] == 0) { if (isset($values['disabled']) === false || (int) $values['disabled'] === 0) {
if ($status == 0) { if ((int) $status === AGENT_MODULE_STATUS_NORMAL) {
db_process_sql( db_process_sql(
'UPDATE tagente 'UPDATE tagente
SET total_count=total_count+1, normal_count=normal_count+1 SET total_count=total_count+1, normal_count=normal_count+1
@ -2362,7 +2392,7 @@ function modules_get_agentmodule_data_for_humans($module)
} }
} else { } else {
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']); $data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
if ($data_macro) { if ($data_macro !== false) {
$salida = $data_macro; $salida = $data_macro;
} else { } else {
$salida = ui_print_module_string_value( $salida = ui_print_module_string_value(

View File

@ -120,7 +120,7 @@ function netflow_check_filter_group($id_sg)
$id_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id_sg); $id_group = db_get_value('id_group', 'tnetflow_filter', 'id_sg', $id_sg);
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
// Get group list that user has access. // Get group list that user has access.
$groups_user = users_get_groups($config['id_user'], 'IW', $own_info['is_admin'], true); $groups_user = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
$groups_id = []; $groups_id = [];
$has_permission = false; $has_permission = false;

View File

@ -1500,7 +1500,7 @@ function networkmap_delete_relations($id_map)
function get_networkmaps($id) function get_networkmaps($id)
{ {
$groups = array_keys(users_get_groups(null, 'IW')); $groups = array_keys(users_get_groups(null, 'MW'));
$filter = []; $filter = [];
$filter['id_group'] = $groups; $filter['id_group'] = $groups;

View File

@ -239,7 +239,7 @@ function get_notification_source_targets(int $id_source, ?string $subtype=null)
} }
$filter = sprintf( $filter = sprintf(
' AND ns.`subtype_blacklist` NOT LIKE "%%%s%%"', ' AND (ns.`subtype_blacklist` IS NULL OR ns.`subtype_blacklist` NOT LIKE "%%%s%%") ',
$subtype $subtype
); );
} }

View File

@ -95,12 +95,12 @@ function planned_downtimes_update($values, $downtime_id=0, $check_dates=true)
$name_exists = (bool) db_get_value('id', 'tplanned_downtime', 'name', $values['name']); $name_exists = (bool) db_get_value('id', 'tplanned_downtime', 'name', $values['name']);
if ($name_exists) { if ($name_exists) {
$result['message'] = ui_print_error_message(__('Each planned downtime must have a different name'), '', true); $result['message'] = ui_print_error_message(__('Each scheduled downtime must have a different name'), '', true);
return $result; return $result;
} }
} else { } else {
$result['message'] = ui_print_error_message(__('Planned downtime must have a name'), '', true); $result['message'] = ui_print_error_message(__('Scheduled downtime must have a name'), '', true);
return $result; return $result;
} }
@ -811,13 +811,13 @@ function planned_downtimes_created($values)
} else { } else {
return [ return [
'return' => false, 'return' => false,
'message' => __('Each planned downtime must have a different name'), 'message' => __('Each scheduled downtime must have a different name'),
]; ];
} }
} else { } else {
return [ return [
'return' => false, 'return' => false,
'message' => __('Planned downtime must have a name'), 'message' => __('Scheduled downtime must have a name'),
]; ];
} }
@ -904,16 +904,16 @@ function delete_planned_downtimes($filter)
$downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute'); $downtime_execute = db_get_row_filter('tplanned_downtime', ['id' => $filter['id_downtime']], 'execute');
if ($downtime_execute) { if ($downtime_execute) {
$return = __("This planned downtime are executed now. Can't delete in this moment."); $return = __("This scheduled downtime are executed now. Can't delete in this moment.");
} else { } else {
$delete = db_process_sql_delete( $delete = db_process_sql_delete(
'tplanned_downtime', 'tplanned_downtime',
['id' => $filter['id_downtime']] ['id' => $filter['id_downtime']]
); );
if ($delete) { if ($delete) {
$return = __('Deleted this planned downtime successfully.'); $return = __('Deleted this scheduled downtime successfully.');
} else { } else {
$return = __('Problems for deleted this planned downtime.'); $return = __('Problems for deleted this scheduled downtime.');
} }
} }

View File

@ -42,6 +42,7 @@ require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_reporting.php'); enterprise_include_once('include/functions_reporting.php');
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('include/functions_inventory.php'); enterprise_include_once('include/functions_inventory.php');
enterprise_include_once('include/functions_cron.php');
require_once $config['homedir'].'/include/functions_forecast.php'; require_once $config['homedir'].'/include/functions_forecast.php';
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_netflow.php'; require_once $config['homedir'].'/include/functions_netflow.php';
@ -1836,6 +1837,7 @@ function reporting_event_report_group(
$content['name'] = __('Event Report Group'); $content['name'] = __('Event Report Group');
} }
$id_meta = 0;
if (is_metaconsole() === true && empty($content['server_name']) === false) { if (is_metaconsole() === true && empty($content['server_name']) === false) {
$id_meta = metaconsole_get_id_server($content['server_name']); $id_meta = metaconsole_get_id_server($content['server_name']);
$server = metaconsole_get_connection_by_id($id_meta); $server = metaconsole_get_connection_by_id($id_meta);
@ -1927,7 +1929,7 @@ function reporting_event_report_group(
true, true,
false, false,
false, false,
false, $id_meta,
$filter_event_filter_exclude $filter_event_filter_exclude
); );
@ -2175,10 +2177,6 @@ function reporting_event_report_module(
); );
} }
if (is_metaconsole()) {
metaconsole_restore_db();
}
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['show_extended_events'] = $content['show_extended_events']; $return['show_extended_events'] = $content['show_extended_events'];
$return['date'] = reporting_get_date_text($report, $content); $return['date'] = reporting_get_date_text($report, $content);
@ -2240,7 +2238,7 @@ function reporting_event_report_module(
$return['data'] = array_reverse($data); $return['data'] = array_reverse($data);
} }
if ($config['metaconsole']) { if (is_metaconsole() === true) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
@ -3241,10 +3239,6 @@ function reporting_event_report_agent(
); );
} }
if ($config['metaconsole']) {
metaconsole_restore_db();
}
$label = (isset($content['style']['label'])) ? $content['style']['label'] : ''; $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if ($label != '') { if ($label != '') {
$label = reporting_label_macro( $label = reporting_label_macro(
@ -3291,9 +3285,14 @@ function reporting_event_report_agent(
$filter_event_type, $filter_event_type,
$filter_event_status, $filter_event_status,
$filter_event_filter_search, $filter_event_filter_search,
$filter_event_filter_exclude $filter_event_filter_exclude,
$id_server
); );
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
reporting_set_conf_charts( reporting_set_conf_charts(
$width, $width,
$height, $height,
@ -9579,12 +9578,21 @@ function reporting_get_module_detailed_event(
* It construct a table object with all the grouped events happened in an agent * It construct a table object with all the grouped events happened in an agent
* during a period of time. * during a period of time.
* *
* @param mixed Agent id(s) to get the report from. * @param mixed $id_agents Agent id(s) to get the report from.
* @param int Period of time (in seconds) to get the report. * @param integer $period Period of time (in seconds) to get the report.
* @param int Beginning date (unixtime) of the report * @param integer $date Beginning date (unixtime) of the report.
* @param bool Flag to return or echo the report table (echo by default). * @param boolean $return Flag to return or echo the report table (echo by default).
* @param boolean $only_data Only data.
* @param boolean $history History.
* @param boolean $show_summary_group Show summary group.
* @param boolean $filter_event_severity Filter.
* @param boolean $filter_event_type Filter.
* @param boolean $filter_event_status Filter.
* @param boolean $filter_event_filter_search Filter.
* @param boolean $filter_event_filter_exclude Filter.
* @param integer $id_server Id server.
* *
* @return A table object (XHTML) * @return array table object (XHTML)
*/ */
function reporting_get_agents_detailed_event( function reporting_get_agents_detailed_event(
$id_agents, $id_agents,
@ -9598,7 +9606,8 @@ function reporting_get_agents_detailed_event(
$filter_event_type=false, $filter_event_type=false,
$filter_event_status=false, $filter_event_status=false,
$filter_event_filter_search=false, $filter_event_filter_search=false,
$filter_event_filter_exclude=false $filter_event_filter_exclude=false,
$id_server=0
) { ) {
global $config; global $config;
@ -9633,7 +9642,7 @@ function reporting_get_agents_detailed_event(
false, false,
false, false,
false, false,
false, $id_server,
$filter_event_filter_exclude $filter_event_filter_exclude
); );
@ -13948,3 +13957,69 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
/**
* Email template for sending reports.
*
* @param string $subjectEmail Subject of email.
* @param string $bodyEmail Body of email.
* @param string $scheduled Id of schedule report.
* @param string $reportName Report name.
* @param string $email Serialized list of destination emails.
* @param array $attachments Attachments.
*
* @return void
*/
function reporting_email_template(
string $subjectEmail='',
string $bodyEmail='',
string $scheduled='',
string $reportName='',
string $email='',
array $attachments=null
) {
// Subject.
$subject = (empty($subjectEmail) === true) ? '[Pandora] '.__('Reports') : $subjectEmail;
// Body.
if (empty($bodyEmail) === true) {
$body = __('Greetings').',';
$body .= '<p />';
$body .= __('Attached to this email there\'s a PDF file of the').' ';
$body .= $scheduled.' '.__('report');
$body .= ' <strong>"'.$reportName.'"</strong>';
$body .= '<p />';
$body .= __('Generated at').' '.date('Y/m/d H:i:s');
$body .= '<p />';
$body .= __('Thanks for your time.');
$body .= '<p />';
$body .= __('Best regards, Pandora FMS');
$body .= '<p />';
$body .= '<em>'.__('This is an automatically generated email from Pandora FMS, please do not reply.').'</em>';
} else {
$bodyEmail = str_replace(
[
"\r\n",
"\r",
'&#x0d;&#x0a;',
],
"\n",
$bodyEmail
);
$body = '<p>'.implode("</p>\n<p>", explode("\n", $bodyEmail)).'</p>';
}
// Extract list of emails.
$destinationEmails = explode(',', io_safe_output($email));
foreach ($destinationEmails as $destination) {
$destination = trim($destination);
// Skip the empty 'to'.
if (empty($destination) === false) {
send_email_attachment($destination, $body, $subject, $attachments);
} else {
db_pandora_audit('ERROR:', 'Cron jobs mail, empty destination email.');
}
}
}

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