Merge branch 'develop' into 'ent-9043-cambiar-mensaje-error-no-poder-mostrar-fichero-file-manager'

# Conflicts:
#   pandora_console/index.php
This commit is contained in:
José González 2022-06-28 14:39:37 +00:00
commit 2d69ea4be5
493 changed files with 230889 additions and 185697 deletions

View File

@ -256,6 +256,8 @@ console_dependencies=" \
poppler-data \ poppler-data \
php-yaml \ php-yaml \
mod_ssl \ mod_ssl \
libzstd \
openldap-clients \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"

View File

@ -307,6 +307,8 @@ console_dependencies=" \
poppler-data \ poppler-data \
php-yaml \ php-yaml \
mod_ssl \ mod_ssl \
libzstd \
openldap-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/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.762 # Version 7.0NG.763
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.762-220606 Version: 7.0NG.763-220628
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.762-220606" pandora_version="7.0NG.763-220628"
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

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then if [ "$#" -ge 2 ]; then
VERSION="$2" VERSION="$2"
else else
VERSION="7.0NG.762" VERSION="7.0NG.763"
fi fi
# Path for the generated DMG file # Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false"> <choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/> <pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.762" onConclusion="none">pandorafms_src.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.763" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications"> <choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/> <pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.762" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.763" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" /> <!-- <installation-check script="check()" />
<script> <script>
<![CDATA[ <![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string> <key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.762</string> <key>CFBundleVersion</key> <string>7.0NG.763</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.762 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.763 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.762</string> <key>CFBundleShortVersionString</key> <string>7.0NG.763</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string> <key>NSMainNibFile</key><string>MainMenu</string>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.763
%define release 220606 %define release 220628
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.763
%define release 220606 %define release 220628
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.762 # Version 7.0NG.763
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

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

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.762 Build 220606") #define PANDORA_VERSION ("7.0NG.763 Build 220628")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.762(Build 220606))" VALUE "ProductVersion", "(7.0NG.763(Build 220628))"
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.762-220606 Version: 7.0NG.763-220628
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.762-220606" pandora_version="7.0NG.763-220628"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -14,7 +14,8 @@
}, },
"require": { "require": {
"mpdf/mpdf": "^8.0.15", "mpdf/mpdf": "^8.0.15",
"swiftmailer/swiftmailer": "^6.0" "swiftmailer/swiftmailer": "^6.0",
"amphp/parallel-functions": "^1.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -23,7 +24,10 @@
"PandoraFMS\\": "include/lib", "PandoraFMS\\": "include/lib",
"PandoraFMS\\Enterprise\\": "enterprise/include/lib", "PandoraFMS\\Enterprise\\": "enterprise/include/lib",
"UpdateManager\\": "update_manager_client/lib/UpdateManager" "UpdateManager\\": "update_manager_client/lib/UpdateManager"
} },
"files": [
"include/global_config.php"
]
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {

View File

@ -4,8 +4,551 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "1ca1e8936d9ffb13f23a5b5cefbf02ad", "content-hash": "643ac0dc8a8e1f129104399054f8dd0c",
"packages": [ "packages": [
{
"name": "amphp/amp",
"version": "v2.6.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/amp.git",
"reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
"reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1",
"ext-json": "*",
"jetbrains/phpstorm-stubs": "^2019.3",
"phpunit/phpunit": "^7 | ^8 | ^9",
"psalm/phar": "^3.11@dev",
"react/promise": "^2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"files": [
"lib/functions.php",
"lib/Internal/functions.php"
],
"psr-4": {
"Amp\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Lowrey",
"email": "rdlowrey@php.net"
},
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Bob Weinand",
"email": "bobwei9@hotmail.com"
},
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
}
],
"description": "A non-blocking concurrency framework for PHP applications.",
"homepage": "https://amphp.org/amp",
"keywords": [
"async",
"asynchronous",
"awaitable",
"concurrency",
"event",
"event-loop",
"future",
"non-blocking",
"promise"
],
"support": {
"irc": "irc://irc.freenode.org/amphp",
"issues": "https://github.com/amphp/amp/issues",
"source": "https://github.com/amphp/amp/tree/v2.6.2"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2022-02-20T17:52:18+00:00"
},
{
"name": "amphp/byte-stream",
"version": "v1.8.1",
"source": {
"type": "git",
"url": "https://github.com/amphp/byte-stream.git",
"reference": "acbd8002b3536485c997c4e019206b3f10ca15bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd",
"reference": "acbd8002b3536485c997c4e019206b3f10ca15bd",
"shasum": ""
},
"require": {
"amphp/amp": "^2",
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1.4",
"friendsofphp/php-cs-fixer": "^2.3",
"jetbrains/phpstorm-stubs": "^2019.3",
"phpunit/phpunit": "^6 || ^7 || ^8",
"psalm/phar": "^3.11.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"files": [
"lib/functions.php"
],
"psr-4": {
"Amp\\ByteStream\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
}
],
"description": "A stream abstraction to make working with non-blocking I/O simple.",
"homepage": "http://amphp.org/byte-stream",
"keywords": [
"amp",
"amphp",
"async",
"io",
"non-blocking",
"stream"
],
"support": {
"irc": "irc://irc.freenode.org/amphp",
"issues": "https://github.com/amphp/byte-stream/issues",
"source": "https://github.com/amphp/byte-stream/tree/v1.8.1"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2021-03-30T17:13:30+00:00"
},
{
"name": "amphp/parallel",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/amphp/parallel.git",
"reference": "fbc128383c1ffb3823866f71b88d8c4722a25ce9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/parallel/zipball/fbc128383c1ffb3823866f71b88d8c4722a25ce9",
"reference": "fbc128383c1ffb3823866f71b88d8c4722a25ce9",
"shasum": ""
},
"require": {
"amphp/amp": "^2",
"amphp/byte-stream": "^1.6.1",
"amphp/parser": "^1",
"amphp/process": "^1",
"amphp/serialization": "^1",
"amphp/sync": "^1.0.1",
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1.1",
"phpunit/phpunit": "^8 || ^7"
},
"type": "library",
"autoload": {
"files": [
"lib/Context/functions.php",
"lib/Sync/functions.php",
"lib/Worker/functions.php"
],
"psr-4": {
"Amp\\Parallel\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Stephen Coakley",
"email": "me@stephencoakley.com"
}
],
"description": "Parallel processing component for Amp.",
"homepage": "https://github.com/amphp/parallel",
"keywords": [
"async",
"asynchronous",
"concurrent",
"multi-processing",
"multi-threading"
],
"support": {
"issues": "https://github.com/amphp/parallel/issues",
"source": "https://github.com/amphp/parallel/tree/v1.4.1"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2021-10-25T19:16:02+00:00"
},
{
"name": "amphp/parallel-functions",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/amphp/parallel-functions.git",
"reference": "af9795d51abfafc3676cbe7e17965479491abaad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/parallel-functions/zipball/af9795d51abfafc3676cbe7e17965479491abaad",
"reference": "af9795d51abfafc3676cbe7e17965479491abaad",
"shasum": ""
},
"require": {
"amphp/amp": "^2.0.3",
"amphp/parallel": "^1.1",
"opis/closure": "^3.0.7",
"php": ">=7"
},
"require-dev": {
"amphp/phpunit-util": "^1.0",
"friendsofphp/php-cs-fixer": "^2.9",
"phpunit/phpunit": "^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Amp\\ParallelFunctions\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
}
],
"description": "Parallel processing made simple.",
"support": {
"issues": "https://github.com/amphp/parallel-functions/issues",
"source": "https://github.com/amphp/parallel-functions/tree/master"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2020-07-10T17:05:35+00:00"
},
{
"name": "amphp/parser",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/amphp/parser.git",
"reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/parser/zipball/f83e68f03d5b8e8e0365b8792985a7f341c57ae1",
"reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1",
"shasum": ""
},
"require": {
"php": ">=7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.3",
"phpunit/phpunit": "^6"
},
"type": "library",
"autoload": {
"psr-4": {
"Amp\\Parser\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
},
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
}
],
"description": "A generator parser to make streaming parsers simple.",
"homepage": "https://github.com/amphp/parser",
"keywords": [
"async",
"non-blocking",
"parser",
"stream"
],
"support": {
"issues": "https://github.com/amphp/parser/issues",
"source": "https://github.com/amphp/parser/tree/is-valid"
},
"time": "2017-06-06T05:29:10+00:00"
},
{
"name": "amphp/process",
"version": "v1.1.3",
"source": {
"type": "git",
"url": "https://github.com/amphp/process.git",
"reference": "f09e3ed3b0a953ccbfff1140f12be4a884f0aa83"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/process/zipball/f09e3ed3b0a953ccbfff1140f12be4a884f0aa83",
"reference": "f09e3ed3b0a953ccbfff1140f12be4a884f0aa83",
"shasum": ""
},
"require": {
"amphp/amp": "^2",
"amphp/byte-stream": "^1.4",
"php": ">=7"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1",
"phpunit/phpunit": "^6"
},
"type": "library",
"autoload": {
"files": [
"lib/functions.php"
],
"psr-4": {
"Amp\\Process\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bob Weinand",
"email": "bobwei9@hotmail.com"
},
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
}
],
"description": "Asynchronous process manager.",
"homepage": "https://github.com/amphp/process",
"support": {
"issues": "https://github.com/amphp/process/issues",
"source": "https://github.com/amphp/process/tree/v1.1.3"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2021-12-17T19:09:33+00:00"
},
{
"name": "amphp/serialization",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/amphp/serialization.git",
"reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/serialization/zipball/693e77b2fb0b266c3c7d622317f881de44ae94a1",
"reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"phpunit/phpunit": "^9 || ^8 || ^7"
},
"type": "library",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Amp\\Serialization\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Niklas Keller",
"email": "me@kelunik.com"
}
],
"description": "Serialization tools for IPC and data storage in PHP.",
"homepage": "https://github.com/amphp/serialization",
"keywords": [
"async",
"asynchronous",
"serialization",
"serialize"
],
"support": {
"issues": "https://github.com/amphp/serialization/issues",
"source": "https://github.com/amphp/serialization/tree/master"
},
"time": "2020-03-25T21:39:07+00:00"
},
{
"name": "amphp/sync",
"version": "v1.4.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/sync.git",
"reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/sync/zipball/85ab06764f4f36d63b1356b466df6111cf4b89cf",
"reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf",
"shasum": ""
},
"require": {
"amphp/amp": "^2.2",
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1.1",
"phpunit/phpunit": "^9 || ^8 || ^7"
},
"type": "library",
"autoload": {
"files": [
"src/functions.php",
"src/ConcurrentIterator/functions.php"
],
"psr-4": {
"Amp\\Sync\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Aaron Piotrowski",
"email": "aaron@trowski.com"
},
{
"name": "Stephen Coakley",
"email": "me@stephencoakley.com"
}
],
"description": "Mutex, Semaphore, and other synchronization tools for Amp.",
"homepage": "https://github.com/amphp/sync",
"keywords": [
"async",
"asynchronous",
"mutex",
"semaphore",
"synchronization"
],
"support": {
"issues": "https://github.com/amphp/sync/issues",
"source": "https://github.com/amphp/sync/tree/v1.4.2"
},
"funding": [
{
"url": "https://github.com/amphp",
"type": "github"
}
],
"time": "2021-10-25T18:29:10+00:00"
},
{ {
"name": "doctrine/lexer", "name": "doctrine/lexer",
"version": "1.2.2", "version": "1.2.2",
@ -280,6 +823,71 @@
], ],
"time": "2020-11-13T09:40:50+00:00" "time": "2020-11-13T09:40:50+00:00"
}, },
{
"name": "opis/closure",
"version": "3.6.3",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "3d81e4309d2a927abbe66df935f4bb60082805ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad",
"reference": "3d81e4309d2a927abbe66df935f4bb60082805ad",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0 || ^8.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.6.x-dev"
}
},
"autoload": {
"files": [
"functions.php"
],
"psr-4": {
"Opis\\Closure\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"homepage": "https://opis.io/closure",
"keywords": [
"anonymous functions",
"closure",
"function",
"serializable",
"serialization",
"serialize"
],
"support": {
"issues": "https://github.com/opis/closure/issues",
"source": "https://github.com/opis/closure/tree/3.6.3"
},
"time": "2022-01-27T09:35:39+00:00"
},
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
"version": "v9.99.100", "version": "v9.99.100",

View File

@ -1665,3 +1665,4 @@ godmode/um_client/vendor/sebastian/object-enumerator/tests
godmode/um_client/vendor/sebastian/object-enumerator godmode/um_client/vendor/sebastian/object-enumerator
godmode/um_client/vendor/sebastian godmode/um_client/vendor/sebastian
godmode/um_client/vendor godmode/um_client/vendor
update_manager_client/resources/styles/pandora.css

View File

@ -1,5 +1,76 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0; ALTER TABLE `tuser_double_auth` DROP FOREIGN KEY `tuser_double_auth_ibfk_1`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_user` DROP FOREIGN KEY `tnotification_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_source_user` DROP FOREIGN KEY `tnotification_source_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tnotification_source_group_user` DROP FOREIGN KEY `tnotification_source_group_user_ibfk_2`, MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tvisual_console_elements_cache` DROP FOREIGN KEY `tvisual_console_elements_cache_ibfk_3`, MODIFY COLUMN `user_id` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `tusuario` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tuser_double_auth` ADD CONSTRAINT `tuser_double_auth_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE;
ALTER TABLE `tnotification_user` ADD CONSTRAINT `tnotification_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tnotification_source_user` ADD CONSTRAINT `tnotification_source_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tnotification_source_group_user` ADD CONSTRAINT `tnotification_source_group_user_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tvisual_console_elements_cache` ADD CONSTRAINT `tvisual_console_elements_cache_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `tusuario` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `tattachment` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tevento` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tincidencia` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tnota` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tsesion` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `ttrap` MODIFY COLUMN `id_usuario` VARCHAR(255) DEFAULT '';
ALTER TABLE `tusuario_perfil` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treset_pass_history` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tmensajes` MODIFY COLUMN `id_usuario_origen` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tgraph` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treport` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tplanned_downtime` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tnetwork_map` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tpassword_history` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL;
ALTER TABLE `tupdate_journal` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tmap` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tdashboard` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `treport_template` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tmetaconsole_event` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tmetaconsole_event_history` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `treset_pass` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `tuser_task_scheduled` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
ALTER TABLE `tbackup` MODIFY COLUMN `id_user` VARCHAR(255) DEFAULT '';
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` TINYINT NOT NULL DEFAULT 0;
ALTER TABLE `tservice` ADD COLUMN `asynchronous` TINYINT NOT NULL DEFAULT 0;
ALTER TABLE `tservice` ADD COLUMN `rca` TEXT;
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
ALTER TABLE `tevent_alert` ADD COLUMN `field1_recovery` TEXT AFTER `recovery_notify`;
ALTER TABLE `tevent_alert` ADD COLUMN `field4_recovery` TEXT AFTER `field3_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field5_recovery` TEXT AFTER `field4_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field6_recovery` TEXT AFTER `field5_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field7_recovery` TEXT AFTER `field6_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field8_recovery` TEXT AFTER `field7_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field9_recovery` TEXT AFTER `field8_recovery`;
ALTER TABLE `tevent_alert` ADD COLUMN `field10_recovery` TEXT AFTER `field9_recovery`;
ALTER TABLE `tagente` ADD COLUMN `satellite_server` INT NOT NULL default 0;
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `satellite_server` INT NOT NULL default 0;
ALTER TABLE `tmetaconsole_setup` DROP COLUMN `last_event_replication`;
DELETE FROM `tconfig` WHERE `token` LIKE 'event_replication';
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_interval';
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_limit';
DELETE FROM `tconfig` WHERE `token` LIKE 'replication_mode';
DELETE FROM `tconfig` WHERE `token` LIKE 'show_events_in_local';
UPDATE tconfig SET value='' WHERE token='lts_name';
SET @st_oum763 = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tautoconfig' AND table_schema = DATABASE() AND column_name = 'disabled') > 0,
"SELECT 1",
"ALTER TABLE `tautoconfig` ADD COLUMN `disabled` TINYINT DEFAULT 0"
));
PREPARE pr_oum763 FROM @st_oum763;
EXECUTE pr_oum763;
DEALLOCATE PREPARE pr_oum763;
COMMIT; COMMIT;

View File

@ -412,8 +412,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`auth_token` text default '', `auth_token` text default '',
`id_group` int(10) unsigned NOT NULL default 0, `id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL, `api_password` text NOT NULL,
`disabled` tinyint(1) unsigned NOT NULL default '0', `disabled` tinyint(1) unsigned NOT NULL default '0'
`last_event_replication` bigint(20) default '0'
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to store metaconsole sources' COMMENT = 'Table to store metaconsole sources'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;

View File

@ -954,7 +954,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("a.autorefresh").click (function () { $("a.autorefresh").click (function () {
$("a.autorefresh_txt").toggle (); $("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle (); $("#combo_refr").toggle();
$("select#ref").change (function () { $("select#ref").change (function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");

View File

@ -288,7 +288,7 @@ foreach ($sessions as $session) {
array_push($table->data, $data); array_push($table->data, $data);
} }
$activity .= html_print_table($table, true); $activity = html_print_table($table, true);
unset($table); unset($table);
ui_toggle( ui_toggle(

View File

@ -26,6 +26,8 @@
* ============================================================================ * ============================================================================
*/ */
use function PHPSTORM_META\map;
// Begin. // Begin.
if (isset($config['id_user']) === false) { if (isset($config['id_user']) === false) {
include 'general/login_page.php'; include 'general/login_page.php';
@ -57,52 +59,22 @@ if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_men
// Start of full lateral menu. // Start of full lateral menu.
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass); echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
$custom_logo = 'images/custom_logo/'.$config['custom_logo']; // Header logo.
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed']; html_print_div(
[
if (defined('PANDORA_ENTERPRISE') === false) { 'class' => 'logo_green',
$logo_title = get_product_name().' Opensource'; 'content' => html_print_anchor(
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png'; [
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png'; 'href' => ui_get_full_url('index.php'),
} else { 'content' => html_print_header_logo_image(
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) { $menuCollapsed,
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo; true
} ),
],
$logo_title = get_product_name().' Enterprise'; true
} ),
]
echo '<div class="logo_green"><a href="index.php?sec=main">'; );
if (isset($config['custom_logo']) === true) {
echo html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed']) === true) {
echo html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
echo '</a></div>';
require 'operation/menu.php'; require 'operation/menu.php';
require 'godmode/menu.php'; require 'godmode/menu.php';

View File

@ -245,8 +245,11 @@ if (!$new_agent && $alias != '') {
} }
// Remote configuration available. // Remote configuration available.
$remote_agent = false;
if (isset($filename)) { if (isset($filename)) {
if (file_exists($filename['md5'])) { if (file_exists($filename['md5'])) {
$remote_agent = true;
$agent_name = agents_get_name($id_agente); $agent_name = agents_get_name($id_agente);
$agent_name = io_safe_output($agent_name); $agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false); $agent_md5 = md5($agent_name, false);
@ -427,6 +430,42 @@ $table_server .= html_print_select(
true true
).'<div class="label_select_child_icons"></div></div></div>'; ).'<div class="label_select_child_icons"></div></div></div>';
$table_satellite = '';
if ($remote_agent === true) {
// Satellite server selector.
$satellite_servers = db_get_all_rows_filter(
'tserver',
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
[
'id_server',
'name',
]
);
$satellite_names = [];
if (empty($satellite_servers) === false) {
foreach ($satellite_servers as $s_server) {
$satellite_names[$s_server['id_server']] = $s_server['name'];
}
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>';
$table_satellite .= '<div class="label_select_parent">';
$table_satellite .= html_print_input(
[
'type' => 'select',
'fields' => $satellite_names,
'name' => 'satellite_server',
'selected' => $satellite_server,
'nothing' => __('None'),
'nothinf_value' => 0,
'return' => true,
]
).'<div class="label_select_child_icons"></div></div></div>';
}
}
// Description. // Description.
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').'</p>'; $table_description = '<div class="label_select"><p class="input_label">'.__('Description').'</p>';
$table_description .= html_print_textarea( $table_description .= html_print_textarea(
@ -443,7 +482,7 @@ $table_description .= html_print_textarea(
echo '<div class="first_row"> echo '<div class="first_row">
<div class="box-shadow agent_options '.$agent_options_update.' white_box"> <div class="box-shadow agent_options '.$agent_options_update.' white_box">
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div> <div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div> <div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_satellite.$table_description.'</div>
</div>'; </div>';
if (!$new_agent && $alias != '') { if (!$new_agent && $alias != '') {
echo $table_qr_code; echo $table_qr_code;
@ -523,7 +562,6 @@ if (enterprise_installed()) {
$table_adv_cascade .= $cps_html; $table_adv_cascade .= $cps_html;
} }
$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').'</label>'; $table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').'</label>';
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
@ -536,6 +574,11 @@ $params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent);
$params['selectbox_id'] = 'cascade_protection_module'; $params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['cascade_protection'] = true; $params['cascade_protection'] = true;
if ($id_agente !== 0) {
// Deletes the agent's offspring.
$params['delete_offspring_agents'] = $id_agente;
}
$table_adv_parent .= '<div class="label_simple_items">'; $table_adv_parent .= '<div class="label_simple_items">';
$table_adv_parent .= ui_print_agent_autocomplete_input($params); $table_adv_parent .= ui_print_agent_autocomplete_input($params);
if (enterprise_installed()) { if (enterprise_installed()) {

View File

@ -155,6 +155,7 @@ $alert_d7 = 1;
$alert_recovery = 0; $alert_recovery = 0;
$alert_priority = 0; $alert_priority = 0;
$server_name = ''; $server_name = '';
$satellite_server = 0;
$grupo = 0; $grupo = 0;
$id_os = 9; $id_os = 9;
// Windows. // Windows.
@ -985,6 +986,7 @@ if ($update_agent) {
$old_values = db_get_row('tagente', 'id_agente', $id_agente); $old_values = db_get_row('tagente', 'id_agente', $id_agente);
$fields = db_get_all_fields_in_table('tagent_custom_fields'); $fields = db_get_all_fields_in_table('tagent_custom_fields');
$secondary_groups = (string) get_parameter('secondary_hidden', ''); $secondary_groups = (string) get_parameter('secondary_hidden', '');
$satellite_server = (int) get_parameter('satellite_server', 0);
if ($fields === false) { if ($fields === false) {
$fields = []; $fields = [];
@ -1092,6 +1094,7 @@ if ($update_agent) {
'quiet' => $quiet, 'quiet' => $quiet,
'cps' => $cps, 'cps' => $cps,
'safe_mode_module' => $safe_mode_module, 'safe_mode_module' => $safe_mode_module,
'satellite_server' => $satellite_server,
]; ];
if ($config['metaconsole_agent_cache'] == 1) { if ($config['metaconsole_agent_cache'] == 1) {
@ -1230,6 +1233,7 @@ if ($id_agente) {
$cps = $agent['cps']; $cps = $agent['cps'];
$safe_mode_module = $agent['safe_mode_module']; $safe_mode_module = $agent['safe_mode_module'];
$safe_mode = ($safe_mode_module) ? 1 : 0; $safe_mode = ($safe_mode_module) ? 1 : 0;
$satellite_server = (int) $agent['satellite_server'];
} }
$update_module = (bool) get_parameter('update_module'); $update_module = (bool) get_parameter('update_module');

View File

@ -539,6 +539,12 @@ if ($id_downtime > 0) {
// only action to postpone on once type is enabled and the other are disabled. // only action to postpone on once type is enabled and the other are disabled.
$disabled_in_execution = (int) $running; $disabled_in_execution = (int) $running;
$return_all_group = false;
if (users_can_manage_group_all('AW') === true || $disabled) {
$return_all_group = true;
}
$table = new StdClass(); $table = new StdClass();
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';
@ -557,7 +563,7 @@ $table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false, false,
$access, $access,
true, $return_all_group,
'id_group', 'id_group',
$id_group, $id_group,
'', '',
@ -793,7 +799,7 @@ $table->width = '100%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Group filter'); $table->data[0][0] = __('Group filter');
$table->data[0][1] = html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;'); $table->data[0][1] = html_print_select_groups(false, $access, $return_all_group, 'filter_group', $filter_group, '', '', '', true, false, true, '', false, 'min-width:180px;margin-right:15px;');
$table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, ''); $table->data[0][2] = __('Recursion').'&nbsp&nbsp'.html_print_checkbox('recursion', 1, $recursion, true, false, '');
$table->data[1][0] = __('Available agents'); $table->data[1][0] = __('Available agents');

View File

@ -261,7 +261,7 @@ $table->data[2][1] = html_print_select_from_sql(
'id_command', 'id_command',
$id_command, $id_command,
'', '',
__('None'), '',
0, 0,
true, true,
false, false,

View File

@ -140,7 +140,7 @@ function process_manage_delete($id_agents)
} }
$id_group = (int) get_parameter('id_group'); $id_group = (is_metaconsole() === true) ? get_parameter('id_group', '') : (int) get_parameter('id_group');
$id_agents = get_parameter('id_agents'); $id_agents = get_parameter('id_agents');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$delete = (bool) get_parameter_post('delete'); $delete = (bool) get_parameter_post('delete');
@ -282,15 +282,15 @@ $table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true); $table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>'; $table->data[3][0] .= '</span>';
$agents = agents_get_group_agents( $agents = [];
array_keys(users_get_groups($config['id_user'], 'AW', false)), if (is_metaconsole() === false) {
['disabled' => 2], $agents = agents_get_group_agents(
'none', array_keys(users_get_groups($config['id_user'], 'AW', false)),
false, ['disabled' => 2],
false, 'none'
is_metaconsole(), );
'|' }
);
$table->data[3][1] = html_print_select( $table->data[3][1] = html_print_select(
$agents, $agents,

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* 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 * modify it under the terms of the GNU General Public License
@ -89,9 +89,9 @@ if ($update) {
$agents_ = []; $agents_ = [];
} }
// If the option to select all of one group or module type is checked // If the option to select all of one group or module type is checked.
if ($force) { if ($force) {
if ($force == 'type') { if ($force === 'type') {
$type_condition = ''; $type_condition = '';
if ($module_type != 0) { if ($module_type != 0) {
$type_condition = "AND tam.id_tipo_modulo = $module_type"; $type_condition = "AND tam.id_tipo_modulo = $module_type";
@ -109,7 +109,7 @@ if ($update) {
$agents_ = []; $agents_ = [];
} }
// Create an array of agent ids // Create an array of agent ids.
$agents_ = extract_column($agents_, 'id_agente'); $agents_ = extract_column($agents_, 'id_agente');
foreach ($agents_ as $id_agent) { foreach ($agents_ as $id_agent) {
@ -136,7 +136,7 @@ if ($update) {
if ($success == 0) { if ($success == 0) {
$error_msg = __('Error updating the modules from a module type'); $error_msg = __('Error updating the modules from a module type');
} }
} else if ($force == 'group') { } else if ($force === 'group') {
$agents_ = array_keys(agents_get_group_agents($group_select, false, 'none')); $agents_ = array_keys(agents_get_group_agents($group_select, false, 'none'));
foreach ($agents_ as $id_agent) { foreach ($agents_ as $id_agent) {
@ -2226,28 +2226,30 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$values['quiet'] = get_parameter('quiet_select'); $values['quiet'] = get_parameter('quiet_select');
} }
$filter_modules = false; // Whether to update module tag info.
if (!is_numeric($module_name) or ($module_name != 0)) {
$filter_modules['nombre'] = $module_name;
}
// Whether to update module tag info
$update_tags = get_parameter('id_tag', false); $update_tags = get_parameter('id_tag', false);
if (array_search(0, $agents_select) !== false) { if (array_search(0, $agents_select) !== false) {
// Apply at All agents. if (is_numeric($module_name) === false || ($module_name !== 0)) {
$modules = db_get_all_rows_filter( $filterModules = sprintf('AND tam.nombre = \'%s\'', $module_name);
'tagente_modulo', } else {
$filter_modules, $filterModules = '';
[ }
'id_agente_modulo',
'id_tipo_modulo', // Apply at All agents (within valid groups).
] $modules = db_get_all_rows_sql(
sprintf(
'SELECT tam.id_agente_modulo, tam.id_tipo_modulo
FROM tagente_modulo tam INNER JOIN tagente ta
ON ta.id_agente = tam.id_agente
WHERE ta.id_grupo IN (%s) %s;',
implode(',', array_keys(users_get_groups())),
$filterModules
)
); );
} else { } else {
if ($module_name == '0') { if ($module_name === '0') {
// Any module // Any module.
$modules = db_get_all_rows_filter( $modules = db_get_all_rows_filter(
'tagente_modulo', 'tagente_modulo',
['id_agente' => $agents_select], ['id_agente' => $agents_select],
@ -2275,12 +2277,12 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
return false; return false;
} }
if (($module_status == 'unknown') && ($module_name == '0')) { if (($module_status === 'unknown') && ($module_name == '0')) {
$modules_to_delete = []; $modules_to_delete = [];
foreach ($modules as $mod_id) { foreach ($modules as $mod_id) {
$mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]); $mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]);
// Unknown, not init and no data modules // Unknown, not init and no data modules.
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id; $modules_to_delete[$mod_id] = $mod_id;
} }

View File

@ -525,21 +525,21 @@ $menu_godmode['links']['sub'] = $sub;
// Update Manager // Update Manager
if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) { if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) {
$menu_godmode['messages']['text'] = __('Update manager'); $menu_godmode['messages']['text'] = __('Warp Update');
$menu_godmode['messages']['id'] = 'god-um_messages'; $menu_godmode['messages']['id'] = 'god-um_messages';
$menu_godmode['messages']['sec2'] = ''; $menu_godmode['messages']['sec2'] = '';
$sub = []; $sub = [];
$sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update Manager offline'); $sub['godmode/update_manager/update_manager&tab=offline']['text'] = __('Update offline');
$sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline'; $sub['godmode/update_manager/update_manager&tab=offline']['id'] = 'Offline';
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online'); $sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online'; $sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';
$sub['godmode/update_manager/update_manager&tab=setup']['text'] = __('Update Manager options'); $sub['godmode/update_manager/update_manager&tab=setup']['text'] = __('Options');
$sub['godmode/update_manager/update_manager&tab=setup']['id'] = 'Options'; $sub['godmode/update_manager/update_manager&tab=setup']['id'] = 'Options';
$sub['godmode/update_manager/update_manager&tab=history']['text'] = __('Update Manager journal'); $sub['godmode/update_manager/update_manager&tab=history']['text'] = __('Warp journal');
$sub['godmode/update_manager/update_manager&tab=history']['id'] = 'Journal'; $sub['godmode/update_manager/update_manager&tab=history']['id'] = 'Journal';
$menu_godmode['messages']['sub'] = $sub; $menu_godmode['messages']['sub'] = $sub;

View File

@ -178,6 +178,7 @@ switch ($type) {
break; break;
} }
$query_filter = [];
if (empty($query_filter) === false) { if (empty($query_filter) === false) {
$query_filter = json_decode($query_filter, true); $query_filter = json_decode($query_filter, true);
} }

View File

@ -135,6 +135,7 @@ $current_month = true;
// Only avg is selected by default for the simple graphs. // Only avg is selected by default for the simple graphs.
$fullscale = false; $fullscale = false;
$percentil = false; $percentil = false;
$image_threshold = false;
$time_compare_overlapped = false; $time_compare_overlapped = false;
// Added for events items. // Added for events items.
@ -307,6 +308,7 @@ switch ($action) {
case 'simple_graph': case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0; $percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
$image_threshold = (isset($style['image_threshold']) === true) ? (bool) $style['image_threshold'] : false;
$graph_render = $item['graph_render']; $graph_render = $item['graph_render'];
// The break hasn't be forgotten. // The break hasn't be forgotten.
case 'simple_baseline_graph': case 'simple_baseline_graph':
@ -606,6 +608,7 @@ switch ($action) {
$event_graph_by_criticity = $style['event_graph_by_criticity']; $event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
$filter_search = $style['event_filter_search']; $filter_search = $style['event_filter_search'];
$filter_exclude = $style['event_filter_exclude']; $filter_exclude = $style['event_filter_exclude'];
@ -631,6 +634,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break; break;
case 'event_report_module': case 'event_report_module':
@ -665,6 +669,7 @@ switch ($action) {
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$custom_data_events = $style['custom_data_events'];
break; break;
case 'general': case 'general':
@ -2501,6 +2506,23 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_image_threshold" class="datos">
<td class="bolder">
<?php
echo __('Show threshold');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'image_threshold',
1,
$image_threshold
);
?>
</td>
</tr>
<tr id="row_time_compare_overlapped" class="datos"> <tr id="row_time_compare_overlapped" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -2911,6 +2933,23 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_custom_data_events" class="datos">
<td class="bolder">
<?php
echo __('Show custom data');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'custom_data_events',
true,
$custom_data_events
);
?>
</td>
</tr>
<tr id="row_event_graphs" class="datos"> <tr id="row_event_graphs" class="datos">
<td class="bolder"><?php echo __('Event graphs'); ?></td> <td class="bolder"><?php echo __('Event graphs'); ?></td>
<td> <td>
@ -5945,6 +5984,7 @@ function chooseType() {
$("#row_show_graph").hide(); $("#row_show_graph").hide();
$("#row_max_min_avg").hide(); $("#row_max_min_avg").hide();
$("#row_fullscale").hide(); $("#row_fullscale").hide();
$("#row_image_threshold").hide();
$("#row_graph_render").hide(); $("#row_graph_render").hide();
$("#row_macros_definition").hide(); $("#row_macros_definition").hide();
$("#row_render_definition").hide(); $("#row_render_definition").hide();
@ -5974,6 +6014,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").hide(); $("#row_event_graph_by_criticity").hide();
$("#row_event_graph_by_validated").hide(); $("#row_event_graph_by_validated").hide();
$("#row_extended_events").hide(); $("#row_extended_events").hide();
$("#row_custom_data_events").hide();
$("#row_netflow_filter").hide(); $("#row_netflow_filter").hide();
$("#row_max_values").hide(); $("#row_max_values").hide();
$("#row_resolution").hide(); $("#row_resolution").hide();
@ -6044,6 +6085,7 @@ function chooseType() {
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show(); $("#row_event_graph_by_validated").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show(); $("#row_filter_search").show();
$("#row_filter_exclude").show(); $("#row_filter_exclude").show();
@ -6077,6 +6119,7 @@ function chooseType() {
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show(); $("#row_time_compare_overlapped").show();
$("#row_fullscale").show(); $("#row_fullscale").show();
$("#row_image_threshold").show();
$("#row_graph_render").show(); $("#row_graph_render").show();
$("#row_percentil").show(); $("#row_percentil").show();
@ -6371,6 +6414,7 @@ function chooseType() {
$("#row_event_graph_by_validated").show(); $("#row_event_graph_by_validated").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_filter_search").show(); $("#row_filter_search").show();
$("#row_filter_exclude").show(); $("#row_filter_exclude").show();
@ -6389,7 +6433,7 @@ function chooseType() {
$("#row_event_graphs").show(); $("#row_event_graphs").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_extended_events").show(); $("#row_custom_data_events").show();
$("#row_event_graph_by_user").show(); $("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();
@ -6414,6 +6458,7 @@ function chooseType() {
$("#row_event_graphs").show(); $("#row_event_graphs").show();
$("#row_event_type").show(); $("#row_event_type").show();
$("#row_extended_events").show(); $("#row_extended_events").show();
$("#row_custom_data_events").show();
$("#row_event_graph_by_user").show(); $("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();

View File

@ -2224,12 +2224,18 @@ switch ($action) {
$filter_event_status $filter_event_status
); );
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
$style['event_graph_by_agent'] = $event_graph_by_agent; $style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search; $style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude; $style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') { if ($label != '') {
@ -2249,6 +2255,9 @@ switch ($action) {
$style['fullscale'] = (int) get_parameter( $style['fullscale'] = (int) get_parameter(
'fullscale' 'fullscale'
); );
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {
@ -2957,6 +2966,11 @@ switch ($action) {
'' ''
); );
$custom_data_events = get_parameter_switch(
'custom_data_events',
0
);
// Added for events items. // Added for events items.
$style['show_summary_group'] = $show_summary_group; $style['show_summary_group'] = $show_summary_group;
@ -2976,6 +2990,7 @@ switch ($action) {
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
$style['event_filter_search'] = $event_filter_search; $style['event_filter_search'] = $event_filter_search;
$style['event_filter_exclude'] = $event_filter_exclude; $style['event_filter_exclude'] = $event_filter_exclude;
$style['custom_data_events'] = $custom_data_events;
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
@ -2994,6 +3009,9 @@ switch ($action) {
$style['fullscale'] = (int) get_parameter( $style['fullscale'] = (int) get_parameter(
'fullscale' 'fullscale'
); );
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {

View File

@ -337,7 +337,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Name'); $data[0] = __('Name');
$data[1] = '<input type="text" name="form_name" size=100 value="'.$form_name.'">'; $data[1] = '<input type="text" class="text_input" name="form_name" size=100 value="'.$form_name.'">';
$table->colspan['plugin_name'][1] = 3; $table->colspan['plugin_name'][1] = 3;
$table->data['plugin_name'] = $data; $table->data['plugin_name'] = $data;
@ -399,7 +399,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true); $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf" size=100 value="'.$form_execute.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>';
if ($locked) { if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']); $data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
} }
@ -411,7 +411,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plug-in parameters'); $data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>';
if ($locked) { if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']); $data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
} }
@ -484,13 +484,13 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>"; $datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro'", true); $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true);
if ($locked) { if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']); $datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
} }
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>"; $datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro'", true); $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true);
if ($locked) { if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']); $datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
} }

View File

@ -114,11 +114,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
echo "'>"; echo "'>";
echo '<tr> echo '<tr>
<td class="datos">'.__('Link name').'</td> <td class="datos">'.__('Link name').'</td>
<td class="datos"><input type="text" name="name" size="35" value="'.$nombre.'"></td>'; <td class="datos"><input type="text" class="text_input" name="name" size="50" value="'.$nombre.'"></td>';
echo '</tr><tr> echo '</tr><tr>
<td class="datos2">'.__('Link').'</td> <td class="datos2">'.__('Link').'</td>
<td class="datos2"> <td class="datos2">
<input type="text" name="link" size="50" value="'.$link.'"></td>'; <input type="text" class="text_input" name="link" size="50" value="'.$link.'"></td>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo "<table width='100%'>"; echo "<table width='100%'>";

View File

@ -181,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = []; $data = [];
$data[0] = __('Subject').'<br>'; $data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >'; $data[0] .= '<input type="text" class="text_input" name="subject" size="35" value="'.$subject.'" >';
$data[1] = __('Group').'<br>'; $data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">'; $data[1] .= '<div class="w250px">';

View File

@ -663,6 +663,16 @@ $tip = ui_print_help_tip(
true true
); );
$table_other->data[$i][0] = __('WMI binary');
$table_other->data[$i++][1] = html_print_input_text(
'wmiBinary',
$config['wmiBinary'],
'',
50,
50,
true
);
if (enterprise_installed() === true) { if (enterprise_installed() === true) {
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip; $table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
$table_other->data[$i++][1] = html_print_input( $table_other->data[$i++][1] = html_print_input(

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
// Load global vars // Load global vars.
global $config; global $config;
check_login(); check_login();
@ -181,7 +181,8 @@ $backgrounds_list = array_merge($backgrounds_list_jpg, $backgrounds_list_png);
$backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif); $backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif);
asort($backgrounds_list); asort($backgrounds_list);
if (!enterprise_installed()) { $open = false;
if (enterprise_installed() === false) {
$open = true; $open = true;
} }
@ -953,7 +954,7 @@ $options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select( $table_chars->data[$row][1] = html_print_select(
$options_full_escale, $options_full_escale,
'full_scale_option', 'full_scale_option',
$config['full_scale_option'], (isset($config['full_scale_option']) === true) ? $config['full_scale_option'] : 0,
'', '',
'', '',
0, 0,
@ -973,7 +974,7 @@ $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
$table_chars->data[$row][1] = html_print_select( $table_chars->data[$row][1] = html_print_select(
$options_soft_graphs, $options_soft_graphs,
'type_mode_graph', 'type_mode_graph',
$config['type_mode_graph'], (isset($config['type_mode_graph']) === true) ? $config['type_mode_graph'] : 0,
'', '',
'', '',
0, 0,
@ -1053,13 +1054,31 @@ $table_vc->data[$row][1] = html_print_extended_select_for_time(
$row++; $row++;
$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console'); $table_vc->data[$row][0] = __('Default interval for refresh on Visual Console');
$table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false); $table_vc->data[$row][1] = html_print_select(
$values,
'vc_refr',
(int) $config['vc_refr'],
'',
'N/A',
0,
true,
false,
false
);
$row++; $row++;
$vc_favourite_view_array[0] = __('Classic view'); $vc_favourite_view_array[0] = __('Classic view');
$vc_favourite_view_array[1] = __('View of favorites'); $vc_favourite_view_array[1] = __('View of favorites');
$table_vc->data[$row][0] = __('Type of view of visual consoles'); $table_vc->data[$row][0] = __('Type of view of visual consoles');
$table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config['vc_favourite_view'], '', '', 0, true); $table_vc->data[$row][1] = html_print_select(
$vc_favourite_view_array,
'vc_favourite_view',
$config['vc_favourite_view'],
'',
'',
0,
true
);
$row++; $row++;
$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu'); $table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu');
@ -1067,7 +1086,23 @@ $table_vc->data[$row][1] = "<input type ='number' value=".$config['vc_menu_items
$row++; $row++;
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console'); $table_vc->data[$row][0] = __('Default line thickness for the Visual Console');
$table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', (int) $config['vc_line_thickness'], '', 5, 5, true); $table_vc->data[$row][1] = html_print_input_text(
'vc_line_thickness',
(int) $config['vc_line_thickness'],
'',
5,
5,
true
);
$table_vc->data[$row][0] = __('Mobile view not allow visual console orientation');
$table_vc->data[$row][1] = html_print_checkbox_switch(
'mobile_view_orientation_vc',
1,
(bool) $config['mobile_view_orientation_vc'],
true
);
$row++;
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -1133,7 +1168,17 @@ $interval_description = [
'tiny' => 'Short', 'tiny' => 'Short',
]; ];
$table_report->data[$row][0] = __('Interval description'); $table_report->data[$row][0] = __('Interval description');
$table_report->data[$row][1] = html_print_select($interval_description, 'interval_description', $config['interval_description'], '', '', '', true, false, false); $table_report->data[$row][1] = html_print_select(
$interval_description,
'interval_description',
(isset($config['interval_description']) === true) ? $config['interval_description'] : 'large',
'',
'',
'',
true,
false,
false
);
$row++; $row++;

File diff suppressed because it is too large Load Diff

View File

@ -203,20 +203,22 @@ if (is_ajax() !== true) {
var clientMode = '<?php echo $mode; ?>'; var clientMode = '<?php echo $mode; ?>';
</script> </script>
<?php <?php
$server_version = (string) db_get_value_sql( if (function_exists('db_get_value_sql') === true) {
'SELECT `version` FROM `tserver` ORDER BY `master` DESC' $server_version = (string) db_get_value_sql(
); 'SELECT `version` FROM `tserver` ORDER BY `master` DESC'
if ($server_version !== false );
&& preg_match('/NG\.(\d\.*\d*?) /', $server_version, $matches) > 0 if ($server_version !== false
) { && preg_match('/NG\.(\d\.*\d*?) /', $server_version, $matches) > 0
if ((float) $matches[1] !== (float) $current_package) { ) {
ui_print_warning_message( if ((float) $matches[1] !== floor((float) $current_package)) {
__( ui_print_warning_message(
'Master server version %s does not match console version %s.', __(
(float) $matches[1], 'Master server version %s does not match console version %s.',
(float) $current_package (float) $matches[1],
) (float) $current_package
); )
);
}
} }
} }
@ -313,7 +315,7 @@ if (is_array($config) === true) {
if ($mode === Manager::MODE_ONLINE if ($mode === Manager::MODE_ONLINE
&& ($puid === null || $puid === 'OFFLINE') && ($puid === null || $puid === 'OFFLINE')
) { ) {
ui_print_error_message(__('Update manager online requires registration.')); ui_print_error_message(__('Update online requires registration.'));
} }
if ($mode === Manager::MODE_OFFLINE) { if ($mode === Manager::MODE_OFFLINE) {

View File

@ -1,21 +1,36 @@
<?php <?php
/**
* Update manager.
*
* @category Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 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 // Begin.
// ==================================================
// 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; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
check_login(); check_login();
// The ajax is in // The ajax is in include/ajax/update_manager.php.
// include/ajax/update_manager.php
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
@ -36,59 +51,65 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online'); $tab = get_parameter('tab', 'online');
$buttons['setup'] = [ $buttons['setup'] = [
'active' => ($tab == 'setup') ? true : false, 'active' => ($tab === 'setup') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup'
).'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'</a>', ).'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['history'] = [ $buttons['history'] = [
'active' => ($tab == 'history') ? true : false, 'active' => ($tab === 'history') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=histo' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=histo'
).'ry">'.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'</a>', ).'ry">'.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['offline'] = [ $buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false, 'active' => ($tab === 'offline') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offli' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offli'
).'ne">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'</a>', ).'ne">'.html_print_image('images/box.png', true, ['title' => __('Offline update'), 'class' => 'invert_filter']).'</a>',
]; ];
$buttons['online'] = [ $buttons['online'] = [
'active' => ($tab == 'online') ? true : false, 'active' => ($tab === 'online') ? true : false,
'text' => '<a href="'.ui_get_full_url( 'text' => '<a href="'.ui_get_full_url(
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=onlin' 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=onlin'
).'e">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager'), 'class' => 'invert_filter']).'</a>', ).'e">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update'), 'class' => 'invert_filter']).'</a>',
]; ];
switch ($tab) { switch ($tab) {
case 'history': case 'history':
$title = __('Update manager » Journal'); $title = __('Journal');
break; break;
case 'setup': case 'setup':
$title = __('Update manager » Setup'); $title = __('Setup');
break; break;
case 'offline': case 'offline':
$title = __('Update manager » Offline'); $title = __('Offline');
break; break;
case 'online': case 'online':
default: default:
$title = __('Update manager » Online'); $title = __('Online');
break; break;
} }
ui_print_page_header( ui_print_standard_header(
$title, $title,
'images/gm_setup.png', 'images/gm_setup.png',
false, false,
'', '',
true, true,
$buttons $buttons,
[
[
'link' => '',
'label' => 'Warp Update',
],
]
); );
switch ($tab) { switch ($tab) {
@ -107,6 +128,39 @@ switch ($tab) {
case 'online': case 'online':
default: default:
if (is_metaconsole() === false && has_metaconsole() === true) {
$meta_puid = null;
$server_id = $config['metaconsole_node_id'];
$dbh = (object) $config['dbconnection'];
// Connect to metaconsole.
$result_code = metaconsole_load_external_db(
[
'dbhost' => $config['replication_dbhost'],
'dbuser' => $config['replication_dbuser'],
'dbpass' => io_output_password($config['replication_dbpass']),
'dbname' => $config['replication_dbname'],
]
);
if ($result_code < 0) {
break;
}
$value = db_get_value('value', 'tconfig', 'token', 'pandora_uid');
$meta_puid = $value;
// Return connection to node.
metaconsole_restore_db();
if ($meta_puid === false || $meta_puid === null) {
ui_print_warning_message(__('Please register on metaconsole first.'));
break;
}
}
$mode = \UpdateManager\UI\Manager::MODE_ONLINE; $mode = \UpdateManager\UI\Manager::MODE_ONLINE;
include $config['homedir'].'/godmode/um_client/index.php'; include $config['homedir'].'/godmode/um_client/index.php';
break; break;

View File

@ -268,17 +268,18 @@ $table->style[$i] = 'font-weight: bolder;width:250px';
$url_update_manager = update_manager_get_url(); $url_update_manager = update_manager_get_url();
$table->data[$i][0] = __('URL update manager:'); $table->data[$i][0] = __('Warp Update URL');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'url_update_manager', 'url_update_manager',
$url_update_manager, $url_update_manager,
__('URL update manager'), __('URL update manager'),
80, 80,
255, 255,
true,
true true
); );
$table->data[$i][0] = __('Use secured update manager:'); $table->data[$i][0] = __('Use secured Warp Update');
$table->data[$i++][1] = html_print_input( $table->data[$i++][1] = html_print_input(
[ [
'type' => 'switch', 'type' => 'switch',
@ -287,7 +288,7 @@ $table->data[$i++][1] = html_print_input(
] ]
); );
$table->data[$i][0] = __('Proxy server:'); $table->data[$i][0] = __('Proxy server');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_server', 'update_manager_proxy_server',
$update_manager_proxy_server, $update_manager_proxy_server,
@ -297,7 +298,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy port:'); $table->data[$i][0] = __('Proxy port');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_port', 'update_manager_proxy_port',
$update_manager_proxy_port, $update_manager_proxy_port,
@ -307,7 +308,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy user:'); $table->data[$i][0] = __('Proxy user');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'update_manager_proxy_user', 'update_manager_proxy_user',
$update_manager_proxy_user, $update_manager_proxy_user,
@ -317,7 +318,7 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Proxy password:'); $table->data[$i][0] = __('Proxy password');
$table->data[$i++][1] = html_print_input_password( $table->data[$i++][1] = html_print_input_password(
'update_manager_proxy_password', 'update_manager_proxy_password',
$update_manager_proxy_password, $update_manager_proxy_password,
@ -327,7 +328,7 @@ $table->data[$i++][1] = html_print_input_password(
true true
); );
$table->data[$i][0] = __('Allow no-consecutive patches:'); $table->data[$i][0] = __('Allow no-consecutive patches');
$table->data[$i++][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'allow_offline_patches', 'name' => 'allow_offline_patches',
@ -336,7 +337,7 @@ $table->data[$i++][1] = html_print_switch(
] ]
); );
$table->data[$i][0] = __('Limit to LTS updates:'); $table->data[$i][0] = __('Limit to LTS updates');
$table->data[$i++][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'lts_updates', 'name' => 'lts_updates',
@ -346,11 +347,11 @@ $table->data[$i++][1] = html_print_switch(
); );
$table->data[$i][0] = __('Registration ID:'); $table->data[$i][0] = __('Registration ID');
$table->data[$i++][1] = '<i>'.$config['pandora_uid'].'</i>'; $table->data[$i++][1] = '<i>'.($config['pandora_uid'] ?? __('Not registred yet')).'</i>';
if (update_manager_verify_registration() === true && users_is_admin()) { if (update_manager_verify_registration() === true && users_is_admin()) {
$table->data[$i][0] = __('Cancel registration:'); $table->data[$i][0] = __('Cancel registration');
$table->data[$i][1] = '<a href="'; $table->data[$i][1] = '<a href="';
if ((bool) is_metaconsole() === true) { if ((bool) is_metaconsole() === true) {
$table->data[$i][1] .= ui_get_full_url( $table->data[$i][1] .= ui_get_full_url(
@ -367,7 +368,7 @@ if (update_manager_verify_registration() === true && users_is_admin()) {
if (license_free()) { if (license_free()) {
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1; $config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
$table->data[$i][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true); $table->data[$i][0] = __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true);
$table->data[$i][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'&nbsp;&nbsp;'; $table->data[$i][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'&nbsp;&nbsp;';
$table->data[$i++][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); $table->data[$i++][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
} }

View File

@ -860,7 +860,7 @@ if (!$new_user) {
'', '',
'', '',
20, 20,
100, 255,
!$new_user || $view_mode, !$new_user || $view_mode,
'', '',
[ [

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -86,6 +86,8 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$addedItems = json_decode($addedItems); $addedItems = json_decode($addedItems);
$all = (string) get_parameter('all', 'all'); $all = (string) get_parameter('all', 'all');
$delete_offspring_agents = (int) get_parameter('delete_offspring_agents', 0);
if ($addedItems != null) { if ($addedItems != null) {
foreach ($addedItems as $item) { foreach ($addedItems as $item) {
echo $item."|\n"; echo $item."|\n";
@ -111,21 +113,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
$data = []; $data = [];
// Get agents for only the alias // Get agents for only the alias.
$filter_alias = $filter; $filter_alias = $filter;
switch ($config['dbtype']) { $filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
case 'mysql':
$filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_alias[] = '(UPPER(alias) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_alias, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_alias, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -142,19 +132,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
// Get agents for only the name. // Get agents for only the name.
$filter_agents = $filter; $filter_agents = $filter;
switch ($config['dbtype']) { $filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) LIKE "%'.$string.'%")';
case 'mysql':
$filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_agents[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_agents, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_agents, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -169,21 +147,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the address // Get agents for only the address.
$filter_address = $filter; $filter_address = $filter;
switch ($config['dbtype']) { $filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
case 'mysql':
$filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_address[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_address, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_address, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -198,21 +164,9 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the description // Get agents for only the description.
$filter_description = $filter; $filter_description = $filter;
switch ($config['dbtype']) { $filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
case 'mysql':
$filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
break;
case 'postgresql':
$filter_description[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) NOT LIKE \'%'.$string.'%\' AND UPPER(comentarios) LIKE \'%'.$string.'%\')';
break;
case 'oracle':
$filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_description, ['id_agente', 'nombre', 'direccion', 'alias']); $agents = agents_get_agents($filter_description, ['id_agente', 'nombre', 'direccion', 'alias']);
if ($agents !== false) { if ($agents !== false) {
@ -227,6 +181,18 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
if (empty($data) === false && $delete_offspring_agents !== 0) {
// Gets offspring and deletes them, including himself.
$agents_offspring = agents_get_offspring($delete_offspring_agents);
if (empty($agents_offspring) === false) {
foreach ($data as $key => $value) {
if (isset($agents_offspring[$value['id']]) === true) {
unset($data[$key]);
}
}
}
}
echo json_encode($data); echo json_encode($data);
return; return;
} else if ($search_agents && is_metaconsole()) { } else if ($search_agents && is_metaconsole()) {

View File

@ -410,7 +410,7 @@ if (check_login()) {
$table_modules->head = []; $table_modules->head = [];
$table_modules->head[0] = __('Module name'); $table_modules->head[0] = __('Module name');
$table_modules->head[1] = __('Data'); $table_modules->head[1] = __('Data');
$table_modules->head[2] = __('Treshold'); $table_modules->head[2] = __('Threshold');
$table_modules->head[3] = __('Current interval'); $table_modules->head[3] = __('Current interval');
$table_modules->head[4] = __('Timestamp'); $table_modules->head[4] = __('Timestamp');
$table_modules->head[5] = __('Status'); $table_modules->head[5] = __('Status');

File diff suppressed because it is too large Load Diff

View File

@ -278,6 +278,13 @@ class AgentWizard extends HTML
*/ */
private $extraArguments = ''; private $extraArguments = '';
/**
* Binary of wmic.
*
* @var string
*/
private $wmiBinary = '';
/** /**
* Constructor * Constructor
@ -291,7 +298,7 @@ class AgentWizard extends HTML
// Check access. // Check access.
check_login(); check_login();
if (!check_acl($config['id_user'], 0, 'AR')) { if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer' 'Trying to access event viewer'
@ -311,6 +318,7 @@ class AgentWizard extends HTML
$this->idAgent = get_parameter('id_agente', ''); $this->idAgent = get_parameter('id_agente', '');
$this->idPolicy = get_parameter('id', ''); $this->idPolicy = get_parameter('id', '');
$this->targetIp = get_parameter('targetIp', ''); $this->targetIp = get_parameter('targetIp', '');
$this->wmiBinary = $config['wmiBinary'];
if (empty($this->idAgent) === false) { if (empty($this->idAgent) === false) {
$array_aux = db_get_all_rows_sql( $array_aux = db_get_all_rows_sql(
@ -1044,7 +1052,7 @@ class AgentWizard extends HTML
$oidExplore = '.1.3.6.1.2.1.1.2.0'; $oidExplore = '.1.3.6.1.2.1.1.2.0';
} }
// Explore general or interfaces // Explore general or interfaces.
$receivedOid = $this->snmpWalkValues( $receivedOid = $this->snmpWalkValues(
$oidExplore, $oidExplore,
false, false,
@ -1080,7 +1088,7 @@ class AgentWizard extends HTML
// Capture the parameters. // Capture the parameters.
// Call WMI Explorer function. // Call WMI Explorer function.
$this->wmiCommand = wmi_compose_query( $this->wmiCommand = wmi_compose_query(
'wmic', $this->wmiBinary,
$this->usernameWMI, $this->usernameWMI,
$this->passwordWMI, $this->passwordWMI,
$this->targetIp, $this->targetIp,
@ -1090,19 +1098,26 @@ class AgentWizard extends HTML
// the host is Windows (and allow WMI). // the host is Windows (and allow WMI).
$commandQuery = $this->wmiCommand; $commandQuery = $this->wmiCommand;
$commandQuery .= ' "SELECT Caption FROM Win32_ComputerSystem"'; $commandQuery .= ' "SELECT Caption FROM Win32_ComputerSystem"';
// Execute the wmic command. // Declare the vars.
$result = []; $result = [];
exec($commandQuery, $result); $returnVar = 0;
$execCorrect = true;
$tmpError = ''; $tmpError = '';
$execCorrect = true;
// Look for the response if we have ERROR messages. // Execute the command.
foreach ($result as $info) { exec($commandQuery, $result, $returnVar);
if (preg_match('/ERROR:/', $info) !== 0) { // Only is valid if return code is 0.
$execCorrect = false; if ($returnVar === 0) {
$tmpError = strrchr($info, 'ERROR:'); // Look for the response if we have ERROR messages.
break; foreach ($result as $info) {
if (preg_match('/ERROR:/', $info) !== 0) {
$execCorrect = false;
$tmpError = strrchr($info, 'ERROR:');
break;
}
} }
} else {
$tmpError = sprintf('Return Code %s', $returnVar);
$execCorrect = false;
} }
// FOUND ERRORS: TIMEOUT. // FOUND ERRORS: TIMEOUT.
@ -1181,7 +1196,7 @@ class AgentWizard extends HTML
$table->head[1] = '<b>'.__('Server').'</b>'; $table->head[1] = '<b>'.__('Server').'</b>';
$table->head[2] = '<b>'.__('Type').'</b>'; $table->head[2] = '<b>'.__('Type').'</b>';
$table->head[3] = '<b>'.__('Description').'</b>'; $table->head[3] = '<b>'.__('Description').'</b>';
$table->head[4] = '<b>'.__('Treshold').'</b>'; $table->head[4] = '<b>'.__('Threshold').'</b>';
$table->data = []; $table->data = [];
@ -2806,7 +2821,7 @@ class AgentWizard extends HTML
// Unpack the query filters. // Unpack the query filters.
$queryFilters = json_decode($module['query_filters'], true); $queryFilters = json_decode($module['query_filters'], true);
// Name of query filter field. // Name of query filter field.
$fieldValueName = $fieldSet[$queryFilters['field']]; $fieldValueName = (empty($fieldSet[$queryFilters['field']]) === false) ? $fieldSet[$queryFilters['field']] : '1';
// Evaluate type of scan and execution. // Evaluate type of scan and execution.
if ($module['scan_type'] == SCAN_TYPE_FIXED) { if ($module['scan_type'] == SCAN_TYPE_FIXED) {
@ -2841,13 +2856,13 @@ class AgentWizard extends HTML
// If name of the module have a macro. // If name of the module have a macro.
$moduleBlocks[$k]['name'] = $this->macroFilter( $moduleBlocks[$k]['name'] = $this->macroFilter(
$module['name'], io_safe_output($module['name']),
$columnsList, $columnsList,
$rowList $rowList
); );
// Description can have macros too. // Description can have macros too.
$moduleBlocks[$k]['description'] = $this->macroFilter( $moduleBlocks[$k]['description'] = $this->macroFilter(
$module['description'], io_safe_output($module['description']),
$columnsList, $columnsList,
$rowList $rowList
); );
@ -2859,7 +2874,7 @@ class AgentWizard extends HTML
); );
foreach ($columnsList as $columnKey => $columnValue) { foreach ($columnsList as $columnKey => $columnValue) {
$macros['macros']['_'.$columnValue.'_'] = $rowList[$columnKey]; $macros['macros']['_'.trim($columnValue).'_'] = $rowList[trim($columnKey)];
} }
$moduleBlocks[$k]['macros'] = json_encode($macros); $moduleBlocks[$k]['macros'] = json_encode($macros);
@ -2892,6 +2907,7 @@ class AgentWizard extends HTML
$dataCombined = array_combine($columnsList, $rowList); $dataCombined = array_combine($columnsList, $rowList);
// Change the macros for values. // Change the macros for values.
foreach ($dataCombined as $macroKey => $macroValue) { foreach ($dataCombined as $macroKey => $macroValue) {
$macroKey = trim($macroKey);
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) { if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
$valueOperation = preg_replace( $valueOperation = preg_replace(
'/_'.$macroKey.'_/', '/_'.$macroKey.'_/',
@ -2937,19 +2953,19 @@ class AgentWizard extends HTML
$rowList = explode('|', $rowContent); $rowList = explode('|', $rowContent);
// If name of the module have a macro. // If name of the module have a macro.
$newModule['name'] = $this->macroFilter( $newModule['name'] = $this->macroFilter(
$module['name'], io_safe_output($module['name']),
$columnsList, $columnsList,
$rowList $rowList
); );
// Description can have macros too. // Description can have macros too.
$newModule['description'] = $this->macroFilter( $newModule['description'] = $this->macroFilter(
$module['description'], io_safe_output($module['description']),
$columnsList, $columnsList,
$rowList $rowList
); );
$newModule['query_filters'] = $this->macroFilter( $newModule['query_filters'] = $this->macroFilter(
$module['query_filters'], io_safe_output($module['query_filters']),
$columnsList, $columnsList,
$rowList $rowList
); );
@ -2995,6 +3011,7 @@ class AgentWizard extends HTML
); );
// Change the macros for values. // Change the macros for values.
foreach ($dataCombined as $macroKey => $macroValue) { foreach ($dataCombined as $macroKey => $macroValue) {
$macroKey = trim($macroKey);
if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) { if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) {
$valueOperation = preg_replace( $valueOperation = preg_replace(
'/_'.$macroKey.'_/', '/_'.$macroKey.'_/',
@ -3022,39 +3039,48 @@ class AgentWizard extends HTML
} }
} }
// Create the final table with all of data received. // If we not retrieve information (P.E. connection refused).
foreach ($moduleBlocks as $module) { if (empty($moduleBlocks) === true) {
// Prepare the blocks. If its new, create a new index. $this->message['type'][] = 'warning';
if (key_exists($module['group'], $blockTables) === false) { $this->message['message'][] = __(
$blockTables[$module['group']] = [ 'No information could be retrieved.'
'name' => $module['group_name'], );
'data' => [], $this->showMessage();
]; } else {
// Create the final table with all of data received.
foreach ($moduleBlocks as $module) {
// Prepare the blocks. If its new, create a new index.
if (key_exists($module['group'], $blockTables) === false) {
$blockTables[$module['group']] = [
'name' => $module['group_name'],
'data' => [],
];
}
// Add the module info in the block.
$blockTables[$module['group']]['data'][] = $module;
if (isset($blockTables[$module['group']]['activeModules']) === false
&& (int) $module['module_enabled'] === 1
) {
$blockTables[$module['group']]['activeModules'] = 2;
} else if (isset($blockTables[$module['group']]['activeModules']) === true
&& (int) $module['module_enabled'] === 0
) {
$blockTables[$module['group']]['activeModules'] = 1;
}
} }
// Add the module info in the block. // General Default monitoring.
$blockTables[$module['group']]['data'][] = $module; html_print_div(
if (isset($blockTables[$module['group']]['activeModules']) === false [
&& (int) $module['module_enabled'] === 1 'class' => 'wizard wizard-result',
) { 'style' => 'margin-top: 20px;',
$blockTables[$module['group']]['activeModules'] = 2; 'content' => $this->toggleTableModules($blockTables),
} else if (isset($blockTables[$module['group']]['activeModules']) === true ]
&& (int) $module['module_enabled'] === 0 );
) { // Add Create Modules form.
$blockTables[$module['group']]['activeModules'] = 1; $this->createModulesForm();
}
} }
// General Default monitoring.
html_print_div(
[
'class' => 'wizard wizard-result',
'style' => 'margin-top: 20px;',
'content' => $this->toggleTableModules($blockTables),
]
);
// Add Create Modules form.
$this->createModulesForm();
} }
@ -3559,7 +3585,8 @@ class AgentWizard extends HTML
$this->targetPort, $this->targetPort,
$this->server, $this->server,
$this->extraArguments, $this->extraArguments,
(($full_output === false) ? '-Oa -On' : '-Oa') (($full_output === false) ? '-On' : '-Oa'),
''
); );
if ($pure === true) { if ($pure === true) {
@ -3572,7 +3599,12 @@ class AgentWizard extends HTML
if ($full_output === true) { if ($full_output === true) {
$output[] = $key.' = '.$oid_unit; $output[] = $key.' = '.$oid_unit;
} else { } else {
preg_match('/\.\d+$/', $key, $index); $index = [];
$index[] = preg_replace('/^'.$oid.'/', '', $key);
if (empty($index) === true) {
preg_match('/\.\d+$/', $key, $index);
}
$tmp = explode(': ', $oid_unit); $tmp = explode(': ', $oid_unit);
$output[$index[0]] = str_replace('"', '', ($tmp[1] ?? '')); $output[$index[0]] = str_replace('"', '', ($tmp[1] ?? ''));
} }
@ -5536,13 +5568,13 @@ class AgentWizard extends HTML
string $unit='', string $unit='',
?int $type=0 ?int $type=0
) { ) {
$output = '';
try { try {
// Avoid non-numeric or arithmetic chars for security reasons. // Avoid non-numeric or arithmetic chars for security reasons.
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) { if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation)); throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
} else { } else {
// Get the result of the operation and set it. // Get the result of the operation and set it.
$output = '';
eval('$output = '.$operation.';'); eval('$output = '.$operation.';');
// If this module has unit, attach to current value. // If this module has unit, attach to current value.
$output = $this->replacementUnit( $output = $this->replacementUnit(
@ -5717,7 +5749,7 @@ class AgentWizard extends HTML
$(this).removeClass('hidden'); $(this).removeClass('hidden');
return; return;
} }
if (this.id.match(regex)) { if (this.id.match(regex)) {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
} else { } else {
@ -5729,7 +5761,7 @@ class AgentWizard extends HTML
$(this).addClass('hidden'); $(this).addClass('hidden');
} }
} }
if (filter_up == true) { if (filter_up == true) {
if ($(this).attr('operstatus') != 1) { if ($(this).attr('operstatus') != 1) {
$(this).addClass('hidden'); $(this).addClass('hidden');

View File

@ -245,7 +245,7 @@ class AgentsAlerts extends HTML
); );
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->id = 'table_agent_module'; $table->id = 'table_agent_module';
$table->data = []; $table->data = [];
@ -537,7 +537,7 @@ class AgentsAlerts extends HTML
'alerts_agents' 'alerts_agents'
); );
echo '<table cellpadding="4" cellspacing="4" border="0" class="agents_modules_table table">'; echo '<table cellpadding="4" cellspacing="4" border="0" class="info_table">';
echo '<tr>'; echo '<tr>';
echo '<th class="header_table_principal_cell">'.__('Agents').' / '.__('Alerts').'</th>'; echo '<th class="header_table_principal_cell">'.__('Agents').' / '.__('Alerts').'</th>';
@ -576,10 +576,11 @@ class AgentsAlerts extends HTML
'images/arrow_left_green.png', 'images/arrow_left_green.png',
true, true,
[ [
'style' => 'float: right;', 'style' => 'display:flex;justify-content: center',
'title' => __('Previous alerts'), 'title' => __('Previous alerts'),
] ]
), ),
'style' => 'display:flex;justify-content: center',
] ]
); );
echo '</th>'; echo '</th>';
@ -612,9 +613,9 @@ class AgentsAlerts extends HTML
$outputLine = html_print_div( $outputLine = html_print_div(
[ [
'id' => 'line_header_'.$id, 'id' => 'line_header_'.$id,
'class' => 'rotate_text_module position_text_module', 'class' => 'position_text_module',
'style' => '', 'style' => '',
'content' => '<div title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>', 'content' => '<div style="font-size: 7.5pt !important" title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>',
], ],
true true
); );
@ -657,7 +658,7 @@ class AgentsAlerts extends HTML
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>'; echo '<tr>';
// Name of the agent. // Name of the agent.
echo '<td class="bolder" style="text-align: right" >'.$alias['alias'].'</td>'; echo '<td style="text-align: left;font-weight: bold;color: #3f3f3f;">'.$alias['alias'].'</td>';
// Alerts of the agent. // Alerts of the agent.
foreach ($templates as $tid => $tname) { foreach ($templates as $tid => $tname) {
$anyfired = 0; $anyfired = 0;
@ -669,18 +670,6 @@ class AgentsAlerts extends HTML
echo '<td class="center">'; echo '<td class="center">';
if (isset($agent_alerts[$alias['alias']][$tid])) { if (isset($agent_alerts[$alias['alias']][$tid])) {
foreach ($agent_alerts[$alias['alias']][$tid] as $alert) {
if ((int) $alert['times_fired'] > 0) {
$anyfired = true;
}
}
if ($anyfired) {
$cellstyle = 'background:'.COL_ALERTFIRED.';';
} else {
$cellstyle = 'background:'.COL_NORMAL.';';
}
$uniqid = uniqid(); $uniqid = uniqid();
html_print_anchor( html_print_anchor(
@ -689,8 +678,7 @@ class AgentsAlerts extends HTML
'content' => html_print_div( 'content' => html_print_div(
[ [
'id' => 'line_header_'.$temp['id'], 'id' => 'line_header_'.$temp['id'],
'class' => 'status_rounded_rectangles text_inside', 'style' => 'font-size: 13pt;',
'style' => $cellstyle,
'content' => count($agent_alerts[$alias['alias']][$tid]), 'content' => count($agent_alerts[$alias['alias']][$tid]),
], ],
true true

View File

@ -260,6 +260,8 @@ class CalendarManager
*/ */
public function deleteCalendar() public function deleteCalendar()
{ {
global $config;
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
try { try {
$calendar = new Calendar($id); $calendar = new Calendar($id);
@ -278,6 +280,22 @@ class CalendarManager
return; return;
} }
if (is_numeric($id) === true) {
if ((bool) check_acl(
$config['id_user'],
$calendar->id_group(),
'LM'
) === false
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access calendar delete'
);
include 'general/noaccess.php';
exit;
}
}
// Remove. // Remove.
$calendar->delete(); $calendar->delete();
$this->message = \ui_print_success_message( $this->message = \ui_print_success_message(
@ -480,6 +498,35 @@ class CalendarManager
$new = true; $new = true;
} }
$group_id = null;
if ($new === true) {
if (is_numeric(get_parameter('id_group')) === true) {
$group_id = get_parameter('id_group');
}
} else {
if (is_numeric($calendar->id_group()) === true) {
$group_id = $calendar->id_group();
}
}
if (is_numeric($group_id) === true) {
// Check for permissions before rendering edit view or performing save action.
if ((bool) check_acl(
$config['id_user'],
$group_id,
'LM'
) === false
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access calendar editor'
);
include 'general/noaccess.php';
exit;
}
}
$action = get_parameter('action'); $action = get_parameter('action');
if ($action === 'save') { if ($action === 'save') {
$success = false; $success = false;
@ -604,19 +651,23 @@ class CalendarManager
$is_management_allowed = \is_management_allowed(); $is_management_allowed = \is_management_allowed();
if ((bool) $data === true) { if ((bool) $data === true) {
$manage = check_acl( $user_id = $config['id_user'];
$config['id_user'],
0,
'LM',
true
);
$data = array_reduce( $data = array_reduce(
$data, $data,
function ($carry, $item) use ($manage, $is_management_allowed) { function ($carry, $item) use ($user_id, $is_management_allowed) {
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// Transforms array of arrays $data into an array // Transforms array of arrays $data into an array
// of objects, making a post-process of certain fields. // of objects, making a post-process of certain fields.
// Users must only be able to manage items that belong to their groups.
// IMPORTANT: if user does not have permission over 'All' group, items belonging to such
// group must be listed but they must not allow for edition.
$manage = check_acl_restricted_all(
$user_id,
$item['id_group'],
'LM'
);
$tmp = (object) $item; $tmp = (object) $item;
if ((bool) $manage === true) { if ((bool) $manage === true) {

View File

@ -1528,7 +1528,7 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.UPLOAD_MAX_FILESIZE'); $this->cleanNotifications('NOTIF.PHP.UPLOAD_MAX_FILESIZE');
} }
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') { if ($PHPmemory_limit < $PHPmemory_limit_min && (int) $PHPmemory_limit !== -1) {
$url = 'http://php.net/manual/en/ini.core.php#ini.memory-limit'; $url = 'http://php.net/manual/en/ini.core.php#ini.memory-limit';
if ($config['language'] == 'es') { if ($config['language'] == 'es') {
$url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit'; $url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit';
@ -2145,8 +2145,8 @@ class ConsoleSupervisor
[ [
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
'title' => __('This instance is not registered in the Update manager section'), 'title' => __('This instance is not registered in the Update manager section'),
'message' => __('Click <a class="bolder underline" href="javascript: force_run_register();"> here</a> to start the registration process'), 'message' => __('Click here to start the registration process'),
'url' => 'javascript: force_run_register();', 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
] ]
); );
} else { } else {
@ -2166,7 +2166,7 @@ class ConsoleSupervisor
// Check default password for "admin". // Check default password for "admin".
$admin_with_default_pass = db_get_value_sql( $admin_with_default_pass = db_get_value_sql(
'SELECT count(*) FROM tusuario 'SELECT count(*) FROM tusuario
WHERE WHERE
id_user="admin" id_user="admin"
AND password="1da7ee7d45b96d0e1f45ee4ee23da560" AND password="1da7ee7d45b96d0e1f45ee4ee23da560"
AND is_admin=1 AND is_admin=1
@ -2441,11 +2441,11 @@ class ConsoleSupervisor
config_update_value('last_um_check', $future, true); config_update_value('last_um_check', $future, true);
$messages = update_manager_get_messages(); $messages = update_manager_get_messages();
if (is_array($messages) === true) { if (is_array($messages) === true) {
$source_id = get_notification_source_id( $source_id = get_notification_source_id(
'Official&#x20;communication' 'Official&#x20;communication'
); );
foreach ($messages as $message) { foreach ($messages as $message) {
if (isset($message['url']) === false) { if (isset($message['url']) === false) {
$message['url'] = '#'; $message['url'] = '#';
@ -2476,8 +2476,8 @@ class ConsoleSupervisor
// List all servers except satellite server. // List all servers except satellite server.
$server_version_list = db_get_all_rows_sql( $server_version_list = db_get_all_rows_sql(
sprintf( sprintf(
'SELECT `name`, `version` 'SELECT `name`, `version`
FROM tserver FROM tserver
WHERE server_type != %d WHERE server_type != %d
GROUP BY `version`', GROUP BY `version`',
SERVER_TYPE_ENTERPRISE_SATELLITE SERVER_TYPE_ENTERPRISE_SATELLITE
@ -2490,7 +2490,7 @@ class ConsoleSupervisor
foreach ($server_version_list as $server) { foreach ($server_version_list as $server) {
if (strpos( if (strpos(
$server['version'], $server['version'],
$config['current_package'] (string) floor($config['current_package'])
) === false ) === false
) { ) {
$missed++; $missed++;
@ -2511,6 +2511,8 @@ class ConsoleSupervisor
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
] ]
); );
break;
} }
} }
} }
@ -2741,7 +2743,7 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.%'); $this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.%');
} }
$items_min = $config['sync_queue_items_max']; $items_min = (isset($config['sync_queue_items_max']) === true) ? $config['sync_queue_items_max'] : 0;
if (is_numeric($items_min) !== true && $items_min <= 0) { if (is_numeric($items_min) !== true && $items_min <= 0) {
$items_min = self::MIN_SYNC_QUEUE_LENGTH; $items_min = self::MIN_SYNC_QUEUE_LENGTH;
} }

View File

@ -777,6 +777,7 @@ class HTML
) { ) {
$form = ($data['form'] ?? null); $form = ($data['form'] ?? null);
$inputs = ($data['inputs'] ?? []); $inputs = ($data['inputs'] ?? []);
$blocks = ($data['blocks'] ?? []);
$rawInputs = ($data['rawInputs'] ?? null); $rawInputs = ($data['rawInputs'] ?? null);
$js = ($data['js'] ?? null); $js = ($data['js'] ?? null);
$rawjs = ($data['js_block'] ?? null); $rawjs = ($data['js_block'] ?? null);
@ -843,34 +844,59 @@ class HTML
$output_submit = ''; $output_submit = '';
$output = ''; $output = '';
if ($print_white_box === true) { if (empty($blocks) === false) {
$output .= '<div class="white_box">'; $output .= '<div class="container-block-column">';
} foreach ($blocks as $valueblock) {
$output .= '<ul class="wizard">';
foreach ($inputs[$valueblock] as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
}
}
$output .= '<ul class="wizard">'; $output .= '</ul>';
foreach ($inputs as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
} }
}
$output .= '</ul>';
// There is possible add raw inputs for this form.
if (empty($rawInputs) === false) {
$output .= $rawInputs;
}
if ($print_white_box === true) {
$output .= '</div>'; $output .= '</div>';
} else {
if ($print_white_box === true) {
$output .= '<div class="white_box">';
}
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
}
}
$output .= '</ul>';
// There is possible add raw inputs for this form.
if (empty($rawInputs) === false) {
$output .= $rawInputs;
}
if ($print_white_box === true) {
$output .= '</div>';
}
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
} }
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true); $output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';

View File

@ -336,7 +336,7 @@ class OrderInterpreter extends Wizard
), ),
], ],
[ [
'name' => __('Update Manager'), 'name' => __('Warp Update'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/menu/um_messages.menu_gray.png' 'images/menu/um_messages.menu_gray.png'
), ),
@ -404,10 +404,10 @@ class OrderInterpreter extends Wizard
'.$value['name'].'</a><br>'; '.$value['name'].'</a><br>';
} }
$iterator ++; $iterator++;
if ($iterator > 10) { if ($iterator > 10) {
$more_results ++; $more_results++;
} }
} }
} }

View File

@ -523,6 +523,14 @@ class TreeService extends Tree
continue 2; continue 2;
} }
$title = get_parameter('title', '');
if (empty($title) === true) {
$tmp['title'] = '';
} else {
$tmp['title'] = $title.'/';
}
$tmp['title'] .= $service->name();
$tmp['id'] = (int) $item->service()->id(); $tmp['id'] = (int) $item->service()->id();
$tmp['name'] = $item->service()->name(); $tmp['name'] = $item->service()->name();
$tmp['alias'] = $item->service()->name(); $tmp['alias'] = $item->service()->name();

View File

@ -309,7 +309,7 @@ class WelcomeWindow extends Wizard
{ {
global $config; global $config;
return $config['welcome_id_agent']; return (isset($config['welcome_id_agent']) === true) ? $config['welcome_id_agent'] : '';
} }

View File

@ -20,8 +20,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC220606'; $build_version = 'PC220628';
$pandora_version = 'v7.0NG.762'; $pandora_version = 'v7.0NG.763';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -294,7 +294,11 @@ define('SERVICE_ELEMENT_DYNAMIC', 'dynamic');
define('SERVICE_MODE_MANUAL', 0); define('SERVICE_MODE_MANUAL', 0);
define('SERVICE_MODE_SMART', 1); define('SERVICE_MODE_SMART', 1);
// New installation Product Logo.
define('HEADER_LOGO_DEFAULT_CLASSIC', 'logo-default-pandorafms.png');
define('HEADER_LOGO_DEFAULT_COLLAPSED', 'logo-default-pandorafms-collapsed.png');
define('HEADER_LOGO_BLACK_CLASSIC', 'logo-black-pandorafms.png');
define('HEADER_LOGO_BLACK_COLLAPSED', 'logo-default-pandorafms-collapsed.png');
// Status images. // Status images.
// For modules. // For modules.
@ -802,7 +806,7 @@ define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management'); define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management'); define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management'); define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Update Manager'); define('AUDIT_LOG_UMC', 'Warp Manager');
// MIMEs. // MIMEs.
define( define(

View File

@ -1993,7 +1993,8 @@ function get_snmpwalk(
$snmp_port='', $snmp_port='',
$server_to_exec=0, $server_to_exec=0,
$extra_arguments='', $extra_arguments='',
$format='-Oa' $format='-Oa',
$load_mibs='-m ALL'
) { ) {
global $config; global $config;
@ -2057,15 +2058,15 @@ function get_snmpwalk(
case '3': case '3':
switch ($snmp3_security_level) { switch ($snmp3_security_level) {
case 'authNoPriv': case 'authNoPriv':
$command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' '.$load_mibs.' '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
case 'noAuthNoPriv': case 'noAuthNoPriv':
$command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' '.$load_mibs.' '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
default: default:
$command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' '.$load_mibs.' '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
} }
break; break;
@ -2074,7 +2075,7 @@ function get_snmpwalk(
case '2c': case '2c':
case '1': case '1':
default: default:
$command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' '.$format.' -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' '.$load_mibs.' '.$extra_arguments.' '.$format.' -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
} }
@ -2398,9 +2399,9 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
* LM - Alert Management * LM - Alert Management
* PM - Pandora Management * PM - Pandora Management
* *
* @param integer $id_user User id * @param integer $id_user User id.
* @param integer $id_group Agents group id to check from * @param integer $id_group Agents group id to check from.
* @param string $access Access privilege * @param string $access Access privilege.
* @param boolean $onlyOneGroup Flag to check acl for specified group only (not to roots up, or check acl for 'All' group when $id_group is 0). * @param boolean $onlyOneGroup Flag to check acl for specified group only (not to roots up, or check acl for 'All' group when $id_group is 0).
* *
* @return boolean 1 if the user has privileges, 0 if not. * @return boolean 1 if the user has privileges, 0 if not.
@ -2408,7 +2409,7 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true)
function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=false) function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=false)
{ {
if (empty($id_user)) { if (empty($id_user)) {
// User ID needs to be specified // User ID needs to be specified.
trigger_error('Security error: check_acl got an empty string for user id', E_USER_WARNING); trigger_error('Security error: check_acl got an empty string for user id', E_USER_WARNING);
return 0; return 0;
} else if (is_user_admin($id_user)) { } else if (is_user_admin($id_user)) {
@ -4260,7 +4261,9 @@ function get_product_name()
$stored_name = enterprise_hook('enterprise_get_product_name'); $stored_name = enterprise_hook('enterprise_get_product_name');
if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) { if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) {
if ($config['rb_product_name_alt']) { if (isset($config['rb_product_name_alt']) === true
&& empty($config['rb_product_name_alt']) === false
) {
return $config['rb_product_name_alt']; return $config['rb_product_name_alt'];
} }
@ -5986,6 +5989,56 @@ function send_test_email(
} }
/**
* Return array of ancestors of item, given array.
*
* @param integer $item From index.
* @param array $data Array data.
* @param string $key Pivot key (identifies the parent).
* @param string|null $extract Extract certain column or index.
* @param array $visited Cycle detection.
*
* @return array Array of ancestors.
*/
function get_ancestors(
int $item,
array $data,
string $key,
?string $extract=null,
array &$visited=[]
) :array {
if (isset($visited[$item]) === true) {
return [];
}
$visited[$item] = 1;
if (isset($data[$item]) === false) {
return [];
}
if (isset($data[$item][$key]) === false) {
if ($extract !== null) {
return [$data[$item][$extract]];
}
return [$item];
}
if ($extract !== null) {
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$data[$item][$extract]]
);
}
return array_merge(
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
[$item]
);
}
if (function_exists('str_contains') === false) { if (function_exists('str_contains') === false) {

View File

@ -2598,10 +2598,9 @@ function agents_delete_agent($id_agents, $disableACL=false)
'tagente_modulo', 'tagente_modulo',
$filter $filter
); );
if (is_array($rows) === true) { if (is_array($rows) === true) {
foreach ($rows as $row) { foreach ($rows as $row) {
$modules[] = PandoraFMS\Module::build($row); $modules[] = PandoraFMS\Module::build($row, '\PandoraFMS\Module', true);
} }
} }
@ -4268,3 +4267,30 @@ function get_status_data_agent_modules($id_group, $agents=[], $modules=[])
return $res; return $res;
} }
function agents_get_offspring(int $id_agent)
{
$return = [];
// Get parent.
$agents = db_get_all_rows_filter(
'tagente',
[
'id_parent' => $id_agent,
'disabled' => 0,
],
'id_agente'
);
if ($agents !== false) {
foreach ($agents as $agent) {
if ((int) $agent['id_agente'] !== 0) {
$return += agents_get_offspring((int) $agent['id_agente']);
}
}
}
$return += [$id_agent => 0];
return $return;
}

View File

@ -118,6 +118,9 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
$sql .= ' AND t3.id_agente = '.$id_agent; $sql .= ' AND t3.id_agente = '.$id_agent;
} }
// Only enabled agent.
$sql .= ' AND t3.disabled = 0';
$row_alerts = db_get_all_rows_sql($sql); $row_alerts = db_get_all_rows_sql($sql);
if ($total) { if ($total) {
@ -2873,9 +2876,6 @@ function alerts_get_alert_fired($filters=[], $groupsBy=[])
global $config; global $config;
$table = 'tevento'; $table = 'tevento';
if (is_metaconsole() === true) {
$table = 'tmetaconsole_event';
}
$filter_date = ''; $filter_date = '';
if (isset($filters['period']) === true if (isset($filters['period']) === true

View File

@ -53,8 +53,10 @@ enterprise_include_once('include/functions_clusters.php');
enterprise_include_once('include/functions_alerts.php'); enterprise_include_once('include/functions_alerts.php');
// Clases. // Clases.
use PandoraFMS\Agent;
use PandoraFMS\Module; use PandoraFMS\Module;
use PandoraFMS\Enterprise\Cluster; use PandoraFMS\Enterprise\Cluster;
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\SpecialDay; use PandoraFMS\SpecialDay;
@ -386,23 +388,6 @@ function api_get_test_agent_cache()
} }
// Returs the string OK if a connection to the event replication DB can be established.
function api_get_test_event_replication_db()
{
if (defined('METACONSOLE')) {
return;
}
$status = enterprise_hook('events_test_replication_db', []);
if ($status === ENTERPRISE_NOT_HOOK) {
echo 'ERR';
return;
}
echo $status;
}
// -------------------------DEFINED OPERATIONS FUNCTIONS----------------- // -------------------------DEFINED OPERATIONS FUNCTIONS-----------------
@ -1469,22 +1454,22 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
// Check parameters. // Check parameters.
if ($idGroup == 0) { if ($idGroup == 0) {
$agent_update_error = __('The agent could not be modified. For security reasons, use a group other than 0.'); $agent_update_error = __('The agent could not be modified. For security reasons, use a group other than 0.');
returnError('generic error', $agent_update_error); returnError($agent_update_error);
return; return;
} }
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"'); $server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"');
if ($alias == '' && $alias_as_name === 0) { if ($alias == '' && $alias_as_name === 0) {
returnError('alias_not_specified', 'No agent alias specified'); returnError('No agent alias specified');
return; return;
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$idGroup) === false) { } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$idGroup) === false) {
returnError('id_grupo_not_exist', 'The group doesn`t exist.'); returnError('The group doesn`t exist.');
return; return;
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$idOS) === false) { } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$idOS) === false) {
returnError('id_os_not_exist', 'The OS doesn`t exist.'); returnError('The OS doesn`t exist.');
return; return;
} else if ($server_name === false) { } else if ($server_name === false) {
returnError('server_not_exist', 'The '.get_product_name().' Server doesn`t exist.'); returnError('The '.get_product_name().' Server doesn`t exist.');
return; return;
} }
@ -1525,6 +1510,14 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
returnError('The user cannot access to parent agent.'); returnError('The user cannot access to parent agent.');
return; return;
} }
$agents_offspring = agents_get_offspring($id_agent);
if (empty($agents_offspring) === false) {
if (isset($agents_offspring[$idParent]) === true) {
returnError('The parent cannot be a offspring');
return;
}
}
} }
$values_old = db_get_row_filter( $values_old = db_get_row_filter(
@ -1751,6 +1744,14 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
returnError('The user cannot access to parent agent.'); returnError('The user cannot access to parent agent.');
return; return;
} }
$agents_offspring = agents_get_offspring($id_agent);
if (empty($agents_offspring) === false) {
if (isset($agents_offspring[$data]) === true) {
returnError('The parent cannot be a offspring');
return;
}
}
break; break;
default: default:
@ -1826,18 +1827,18 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
/** /**
* Create a new agent, and print the id for new agent. * Create a new agent, and print the id for new agent.
* *
* @param $thrash1 Don't use. * @param $id_node Id_node target (if metaconsole)
* @param $thrash2 Don't use. * @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <agent_name>;<ip>;<id_parent>;<id_group>; * @param array $other it's array, $other as param is <agent_name>;<ip>;<id_parent>;<id_group>;
* <cascade_protection>;<interval_sec>;<id_os>;<id_server>;<custom_id>;<learning_mode>;<disabled>;<description> in this order * <cascade_protection>;<interval_sec>;<id_os>;<id_server>;<custom_id>;<learning_mode>;<disabled>;<description> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>) * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example: * example:
* *
* api.php?op=set&op2=new_agent&other=pepito|1.1.1.1|0|4|0|30|8|10||0|0|nose%20nose&other_mode=url_encode_separator_| * api.php?op=set&op2=new_agent&other=pepito|1.1.1.1|0|4|0|30|8|10||0|0|nose%20nose&other_mode=url_encode_separator_|
* *
* @param $thrash3 Don't use. * @param $thrash3 Don't use.
*/ */
function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
{ {
global $config; global $config;
@ -1846,158 +1847,117 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return; return;
} }
if (defined('METACONSOLE')) {
return;
}
if ((int) $other['data'][3] == 0) { if ((int) $other['data'][3] == 0) {
returnError('For security reasons, the agent was not created. Use a group other than 0.'); returnError('For security reasons, the agent was not created. Use a group other than 0.');
return; return;
} }
$alias = io_safe_input( try {
trim( $agent = new Agent();
preg_replace(
'/[\/\\\|%#&$]/', if (is_metaconsole() === true) {
'', if ($id_node <= 0) {
preg_replace( throw new Exception('No node id specified');
'/x20;/', }
' ',
$other['data'][0] $node = new Node($id_node);
$id_agente = $node->callApi(
'new_agent',
'set',
null,
null,
$other['data'],
null
);
} else {
$alias = io_safe_input(
trim(
preg_replace(
'/[\/\\\|%#&$]/',
'',
preg_replace(
'/x20;/',
' ',
$other['data'][0]
)
)
) )
)
)
);
$direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2];
$grupo = (int) $other['data'][3];
$cascade_protection = (int) $other['data'][4];
$cascade_protection_module = (int) $other['data'][5];
$intervalo = (string) $other['data'][6];
$id_os = (int) $other['data'][7];
$server_name = (string) $other['data'][8];
$custom_id = (string) $other['data'][9];
$modo = (int) $other['data'][10];
$disabled = (int) $other['data'][11];
$comentarios = (string) $other['data'][12];
$alias_as_name = (int) $other['data'][13];
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
if ($cascade_protection == 1) {
if (($id_parent != 0) && (db_get_value_sql(
'SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = '.$id_parent.' AND id_agente_modulo = '.$cascade_protection_module
) === false)
) {
returnError('Cascade protection is not applied because it is not a parent module.');
return;
}
} else {
$cascadeProtectionModule = 0;
}
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
// Check if agent exists (BUG WC-50518-2).
if ($alias == '' && $alias_as_name === 0) {
returnError('No agent alias specified');
} else if (agents_get_agent_id($nombre_agente)) {
returnError('The agent name already exists in DB.');
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
returnError('The group does not exist.');
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
returnError('Agent cannot be created due to the maximum agent limit for this group');
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
returnError('The OS does not exist.');
} else if ($server_name === false) {
returnError('The '.get_product_name().' Server does not exist.');
} else {
if ($alias_as_name === 1) {
$exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
$nombre_agente = $alias;
}
$exists_ip = false;
if ($config['unique_ip'] && $direccion_agente != '') {
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
}
if (!$exists_alias && !$exists_ip) {
$id_agente = db_process_sql_insert(
'tagente',
[
'nombre' => $nombre_agente,
'alias' => $alias,
'alias_as_name' => $alias_as_name,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
'comentarios' => $comentarios,
'modo' => $modo,
'id_os' => $id_os,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'id_parent' => $id_parent,
'custom_id' => $custom_id,
'os_version' => '',
'agent_version' => '',
'timezone_offset' => 0,
'icon_path' => '',
'url_address' => '',
'update_module_count' => $update_module_count,
]
); );
enterprise_hook('update_agent', [$id_agente]);
} else {
$id_agente = false;
}
if ($id_agente !== false) { $direccion_agente = io_safe_input($other['data'][1]);
// Create address for this agent in taddress. $id_parent = (int) $other['data'][2];
if ($direccion_agente != '') { $grupo = (int) $other['data'][3];
agents_add_address($id_agente, $direccion_agente); $cascade_protection = (int) $other['data'][4];
$cascade_protection_module = (int) $other['data'][5];
$intervalo = (string) $other['data'][6];
$id_os = (int) $other['data'][7];
$server_name = (string) $other['data'][8];
$custom_id = (string) $other['data'][9];
$modo = (int) $other['data'][10];
$disabled = (int) $other['data'][11];
$comentarios = (string) html_entity_decode($other['data'][12]);
$alias_as_name = (int) $other['data'][13];
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
$agent->nombre($alias);
$agent->alias($alias);
$agent->alias_as_name($alias_as_name);
$agent->direccion($direccion_agente);
$agent->id_grupo($grupo);
$agent->intervalo($intervalo);
$agent->comentarios($comentarios);
$agent->modo($modo);
$agent->id_os($id_os);
$agent->disabled($disabled);
$agent->cascade_protection($cascade_protection);
$agent->cascade_protection_module($cascade_protection_module);
$agent->server_name($server_name);
$agent->id_parent($id_parent);
$agent->custom_id($custom_id);
$agent->timezone_offset(0);
$agent->update_module_count($update_module_count);
if ($cascade_protection == 1) {
if ($id_parent != 0) {
try {
$parent = new Agent($id_parent);
} catch (\Exception $e) {
returnError('Cascade protection is not applied because it is not a parent module.');
}
}
} }
$info = '{"Name":"'.$nombre_agente.'", $server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
"IP":"'.$direccion_agente.'",
"Group":"'.$grupo.'",
"Interval":"'.$intervalo.'",
"Comments":"'.$comentarios.'",
"Mode":"'.$modo.'",
"ID_parent:":"'.$id_parent.'",
"Server":"'.$server_name.'",
"ID os":"'.$id_os.'",
"Disabled":"'.$disabled.'",
"Custom ID":"'.$custom_id.'",
"Cascade protection":"'.$cascade_protection.'",
"Cascade protection module":"'.$cascade_protection_module.'"}';
$unsafe_alias = io_safe_output($alias); // Check if agent exists (BUG WC-50518-2).
db_pandora_audit( if ($alias == '' && $alias_as_name === 0) {
AUDIT_LOG_AGENT_MANAGEMENT, returnError('No agent alias specified');
'Created agent '.$unsafe_alias, } else if (agents_get_agent_id($nombre_agente)) {
false, returnError('The agent name already exists in DB.');
true, } else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
$info returnError('The group does not exist.');
); } else if (group_allow_more_agents($grupo, true, 'create') === false) {
} else { returnError('Agent cannot be created due to the maximum agent limit for this group');
$id_agente = 0; } else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
returnError('The OS does not exist.');
if ($exists_alias) { } else if ($server_name === false) {
$agent_creation_error = 'Could not be created because name already exists'; returnError('The '.get_product_name().' Server does not exist.');
} else if ($exists_ip) {
$agent_creation_error = 'Could not be created because IP already exists';
} else { } else {
$agent_creation_error = 'Could not be created for unknown reason'; if ($alias_as_name === 1) {
} $exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
$nombre_agente = $alias;
}
returnError($agent_creation_error); $exists_ip = false;
return;
if ($config['unique_ip'] && $direccion_agente != '') {
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
}
$agent->save((bool) $alias_as_name);
$id_agente = $agent->id_agente();
$agent->updateFromCache();
}
} }
returnData( returnData(
@ -2007,6 +1967,9 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
'data' => $id_agente, 'data' => $id_agente,
] ]
); );
} catch (\Exception $e) {
returnError($e->getMessage());
return;
} }
} }
@ -5100,7 +5063,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
function api_set_new_network_component($id, $thrash1, $other, $thrash2) function api_set_new_network_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }
@ -5202,7 +5165,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }
@ -5482,7 +5445,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
{ {
global $config; global $config;
if (is_metaconsole() === true) { if (defined('METACONSOLE')) {
return; return;
} }
@ -10912,11 +10875,6 @@ function api_set_event_validate_filter_pro($trash1, $trash2, $other, $trash3)
return; return;
} }
$table_events = 'tevento';
if (is_metaconsole()) {
$table_events = 'tmetaconsole_event';
}
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
if ($other['data'] != '') { if ($other['data'] != '') {
returnError('Parameter error.'); returnError('Parameter error.');
@ -10982,7 +10940,7 @@ function api_set_event_validate_filter_pro($trash1, $trash2, $other, $trash3)
} }
$count = db_process_sql_update( $count = db_process_sql_update(
$table_events, 'tevento',
['estado' => 1], ['estado' => 1],
$filterString $filterString
); );
@ -11008,12 +10966,6 @@ function api_set_event_validate_filter($trash1, $trash2, $other, $trash3)
} }
$simulate = false; $simulate = false;
$table_events = 'tevento';
if (is_metaconsole()) {
$table_events = 'tmetaconsole_event';
}
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
if ($other['data'] != '') { if ($other['data'] != '') {
returnError('Parameter error.'); returnError('Parameter error.');
@ -11048,14 +11000,14 @@ function api_set_event_validate_filter($trash1, $trash2, $other, $trash3)
} }
if ($simulate) { if ($simulate) {
$rows = db_get_all_rows_filter($table_events, $filterString); $rows = db_get_all_rows_filter('tevento', $filterString);
if ($rows !== false) { if ($rows !== false) {
returnData('string', count($rows)); returnData('string', count($rows));
return; return;
} }
} else { } else {
$count = db_process_sql_update( $count = db_process_sql_update(
$table_events, 'tevento',
['estado' => 1], ['estado' => 1],
$filterString $filterString
); );
@ -11325,9 +11277,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
global $config; global $config;
$table_events = 'tevento'; $table_events = 'tevento';
if (is_metaconsole() === true) {
$table_events = 'tmetaconsole_event';
}
// By default. // By default.
$status = 3; $status = 3;
@ -11545,21 +11494,19 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
} }
if ($group_rep == 0) { if ($group_rep == 0) {
switch ($config['dbtype']) { if ($filter['total']) {
case 'mysql': $sql = 'SELECT COUNT(*)
if ($filter['total']) {
$sql = 'SELECT COUNT(*)
FROM '.$table_events.' FROM '.$table_events.'
WHERE 1=1 '.$sql_post; WHERE 1=1 '.$sql_post;
} else if ($filter['more_criticity']) { } else if ($filter['more_criticity']) {
$sql = 'SELECT criticity $sql = 'SELECT criticity
FROM '.$table_events.' FROM '.$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY criticity DESC ORDER BY criticity DESC
LIMIT 1'; LIMIT 1';
} else { } else {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t2.nombre (SELECT t2.nombre
FROM tgrupo t2 FROM tgrupo t2
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_name, WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_name,
@ -11569,8 +11516,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM '.$table_events.$alert_join.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC'; ORDER BY utimestamp DESC';
} else { } else {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t1.alias (SELECT t1.alias
FROM tagente t1 FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name, WHERE t1.id_agente = tevento.id_agente) AS agent_name,
@ -11589,109 +11536,19 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM '.$table_events.$alert_join.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC'; ORDER BY utimestamp DESC';
} }
}
break;
case 'postgresql':
// TODO TOTAL
$sql = 'SELECT *,
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
(SELECT t2.nombre
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
(SELECT t2.icon
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_icon,
(SELECT tmodule.name
FROM tmodule
WHERE id_module IN (
SELECT tagente_modulo.id_modulo
FROM tagente_modulo
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM tevento
WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC';
break;
case 'oracle':
// TODO TOTAL
$set = [];
$sql = 'SELECT *,
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS alias,
(SELECT t1.nombre
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
(SELECT t2.nombre
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
(SELECT t2.icon
FROM tgrupo t2
WHERE t2.id_grupo = tevento.id_grupo) AS group_icon,
(SELECT tmodule.name
FROM tmodule
WHERE id_module IN (
SELECT tagente_modulo.id_modulo
FROM tagente_modulo
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM tevento
WHERE 1=1 '.$sql_post.' ORDER BY utimestamp DESC';
$sql = oracle_recode_query($sql, $set);
break;
} }
} else { } else {
switch ($config['dbtype']) { db_process_sql('SET group_concat_max_len = 9999999');
case 'mysql':
db_process_sql('SET group_concat_max_len = 9999999');
$sql = "SELECT *, MAX(id_evento) AS id_evento, $sql = "SELECT *, MAX(id_evento) AS id_evento,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment, GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
MIN(estado) AS min_estado, MAX(estado) AS max_estado, MIN(estado) AS min_estado, MAX(estado) AS max_estado,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_last
FROM ".$table_events.' FROM ".$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC'; ORDER BY timestamp_last DESC';
break;
case 'postgresql':
$sql = "SELECT *, MAX(id_evento) AS id_evento,
array_to_string(array_agg(DISTINCT user_comment), '') AS user_comment,
MIN(estado) AS min_estado, MAX(estado) AS max_estado,
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
FROM ".$table_events.'
WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC';
break;
case 'oracle':
$set = [];
// TODO: Remove duplicate user comments
$sql = 'SELECT a.*, b.event_rep, b.timestamp_rep
FROM (SELECT *
FROM tevento
WHERE 1=1 '.$sql_post.") a,
(SELECT MAX (id_evento) AS id_evento,
to_char(evento) AS evento, id_agentmodule,
COUNT(*) AS event_rep, MIN(estado) AS min_estado,
MAX(estado) AS max_estado,
LISTAGG(user_comment, '') AS user_comment,
MAX(utimestamp) AS timestamp_rep
FROM ".$table_events.'
WHERE 1=1 '.$sql_post.'
GROUP BY to_char(evento), id_agentmodule) b
WHERE a.id_evento=b.id_evento AND
to_char(a.evento)=to_char(b.evento) AND
a.id_agentmodule=b.id_agentmodule';
$sql = oracle_recode_query($sql, $set);
break;
}
} }
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
@ -11822,17 +11679,9 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
} }
} }
// In meta or node.
if (is_metaconsole() === true) {
$table = 'tmetaconsole_event';
} else {
$table = 'tevento';
}
// TODO. Stablish security for prevent sql injection?
// Update the row // Update the row
$result = db_process_sql_update( $result = db_process_sql_update(
$table, 'tevento',
$paramsSerialize, $paramsSerialize,
[ 'id_evento' => $id_event ] [ 'id_evento' => $id_event ]
); );
@ -11903,15 +11752,7 @@ function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null
$filterString = otherParameter2Filter($other, false, $use_agent_name); $filterString = otherParameter2Filter($other, false, $use_agent_name);
} }
if (is_metaconsole()) { $dataRows = db_get_all_rows_filter('tevento', $filterString);
if ((int) $node_id !== 0) {
$filterString .= ' AND server_id = '.$node_id;
}
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
} else {
$dataRows = db_get_all_rows_filter('tevento', $filterString);
}
$last_error = error_get_last(); $last_error = error_get_last();
if (empty($dataRows)) { if (empty($dataRows)) {
@ -13128,18 +12969,20 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType)
{ {
global $config; global $config;
$table_events = 'tevento'; $sql = sprintf(
if (defined('METACONSOLE')) { 'SELECT *
$table_events = 'tmetaconsole_event'; FROM tevento
} WHERE id_evento= %d',
$id_event
);
$sql = 'SELECT *
FROM '.$table_events."
WHERE id_evento=$id_event";
$event_data = db_get_row_sql($sql); $event_data = db_get_row_sql($sql);
// Check the access to group // Check the access to group
if (!empty($event_data['id_grupo']) && $event_data['id_grupo'] > 0 && !$event_data['id_agente']) { if (!empty($event_data['id_grupo'])
&& $event_data['id_grupo'] > 0
&& !$event_data['id_agente']
) {
if (!check_acl($config['id_user'], $event_data['id_grupo'], 'ER')) { if (!check_acl($config['id_user'], $event_data['id_grupo'], 'ER')) {
returnError('forbidden', $returnType); returnError('forbidden', $returnType);
return; return;
@ -13147,8 +12990,14 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType)
} }
// Check the access to agent // Check the access to agent
if (!empty($event_data['id_agente']) && $event_data['id_agente'] > 0) { if (!empty($event_data['id_agente'])
if (!util_api_check_agent_and_print_error($event_data['id_agente'], $returnType)) { && $event_data['id_agente'] > 0
) {
if (!util_api_check_agent_and_print_error(
$event_data['id_agente'],
$returnType
)
) {
return; return;
} }
} }
@ -13436,13 +13285,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($other['data'][18] != '') { if ($other['data'][18] != '') {
$values['id_extra'] = $other['data'][18]; $values['id_extra'] = $other['data'][18];
if (is_metaconsole()) { $sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
$table_event = 'tmetaconsole_event';
} else {
$table_event = 'tevento';
}
$sql_validation = 'SELECT id_evento FROM '.$table_event.' where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
$validation = db_get_all_rows_sql($sql_validation); $validation = db_get_all_rows_sql($sql_validation);
if ($validation) { if ($validation) {
foreach ($validation as $val) { foreach ($validation as $val) {
@ -13484,9 +13327,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
$res = events_comment( $res = events_comment(
$return, $return,
$user_comment, $user_comment,
'Added comment', 'Added comment'
is_metaconsole(),
$config['history_db_enabled']
); );
if ($other['data'][13] != '') { if ($other['data'][13] != '') {
// owner user // owner user
@ -13496,9 +13337,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
events_change_owner( events_change_owner(
$return, $return,
$owner_user, $owner_user,
true, true
is_metaconsole(),
$config['history_db_enabled']
); );
} }
} }
@ -13554,9 +13393,7 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
$status = events_comment( $status = events_comment(
$id, $id,
$comment, $comment,
'Added comment', 'Added comment'
$meta,
$history
); );
if (is_error($status)) { if (is_error($status)) {
returnError( returnError(
@ -13719,17 +13556,12 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy
return; return;
} }
$table_events = 'tevento';
if (is_metaconsole()) {
$table_events = 'tmetaconsole_event';
}
$data['type'] = 'string'; $data['type'] = 'string';
$check_id = db_get_value('id_evento', $table_events, 'id_evento', $id); $check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
if ($check_id) { if ($check_id) {
// event exists // event exists
$status = db_get_value('estado', $table_events, 'id_evento', $id); $status = db_get_value('estado', 'tevento', 'id_evento', $id);
if ($status == 1) { if ($status == 1) {
// event already validated // event already validated
$data['data'] = 'Event already validated.'; $data['data'] = 'Event already validated.';
@ -13743,7 +13575,7 @@ function api_set_validate_event_by_id($id, $trash1=null, $trash2=null, $returnTy
'estado' => 1, 'estado' => 1,
]; ];
$result = db_process_sql_update($table_events, $values, ['id_evento' => $id]); $result = db_process_sql_update('tevento', $values, ['id_evento' => $id]);
if ($result === false) { if ($result === false) {
$data['data'] = 'The event could not be validated.'; $data['data'] = 'The event could not be validated.';
@ -14867,7 +14699,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
'type_graph' => $config['type_module_charts'], 'type_graph' => $config['type_module_charts'],
'fullscale' => false, 'fullscale' => false,
'return_img_base_64' => true, 'return_img_base_64' => true,
'image_treshold' => $graph_threshold, 'image_threshold' => $graph_threshold,
'graph_font_size' => $graph_font_size, 'graph_font_size' => $graph_font_size,
]; ];
@ -17510,7 +17342,7 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A
* Function for get event id and node id, then we get in return the Metaconsole event ID. * Function for get event id and node id, then we get in return the Metaconsole event ID.
* *
* @param [string] $server_id id server (Node) * @param [string] $server_id id server (Node)
* @param [string] $console_event_id console Id node event in tmetaconsole_event * @param [string] $console_event_id console Id node event in tevent
* @param [string] $trash2 don't use * @param [string] $trash2 don't use
* @param [string] $returnType * @param [string] $returnType
* *
@ -17521,19 +17353,54 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A
*/ */
function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType) function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
{ {
global $config; try {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node = new Node($server_id);
$node->connect();
}
// Get grouped comments.
$mc_event_id = db_get_all_rows_sql(
sprintf(
'SELECT id_evento
FROM tevento
WHERE id_evento = %d
',
$console_event_id
)
);
if (is_metaconsole()) {
$mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id ");
if ($mc_event_id !== false) { if ($mc_event_id !== false) {
returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]); returnData(
$returnType,
[
'type' => 'string',
'data' => $mc_event_id,
]
);
} else { } else {
returnError('id_not_found', 'string'); returnError('id_not_found', 'string');
} }
} else { } catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
returnError('forbidden', 'string'); returnError('forbidden', 'string');
return; } finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
} }
return;
} }
@ -17581,20 +17448,14 @@ function api_get_is_centralized($server_id, $thrash1, $thrash2, $returnType)
function api_set_event_in_progress($event_id, $trash2, $returnType) function api_set_event_in_progress($event_id, $trash2, $returnType)
{ {
global $config; global $config;
if (is_metaconsole()) {
$table = 'tmetaconsole_event';
} else {
$table = 'tevento';
}
$event = db_process_sql_update( $event = db_process_sql_update(
$table, 'tevento',
['estado' => 2], ['estado' => 2],
['id_evento' => $event_id] ['id_evento' => $event_id]
); );
if ($event !== false) { if ($event !== false) {
returnData('string', ['data' => $event]); returnData('string', ['data' => $event]);
} else { } else {
returnError('id_not_found', 'string'); returnError('id_not_found', 'string');
} }

View File

@ -409,32 +409,6 @@ function config_update_config()
$error_update[] = __('Size of collection'); $error_update[] = __('Size of collection');
} }
if (config_update_value('event_replication', (int) get_parameter('event_replication'), true) === false) {
$error_update[] = __('Events replication');
}
if ((int) get_parameter('event_replication') === 1) {
if (config_update_value('replication_interval', (int) get_parameter('replication_interval'), true) === false) {
$error_update[] = __('Replication interval');
}
if (config_update_value('replication_limit', (int) get_parameter('replication_limit'), true) === false) {
$error_update[] = __('Replication limit');
}
if (config_update_value('replication_mode', (string) get_parameter('replication_mode'), true) === false) {
$error_update[] = __('Replication mode');
}
if (config_update_value('show_events_in_local', (string) get_parameter('show_events_in_local'), true) === false) {
$error_update[] = __('Show events list in local console (read only)');
}
}
if (config_update_value('replication_dbengine', (string) get_parameter('replication_dbengine'), true) === false) {
$error_update[] = __('Replication DB engine');
}
if (config_update_value('replication_dbhost', (string) get_parameter('replication_dbhost'), true) === false) { if (config_update_value('replication_dbhost', (string) get_parameter('replication_dbhost'), true) === false) {
$error_update[] = __('Replication DB host'); $error_update[] = __('Replication DB host');
} }
@ -928,6 +902,10 @@ function config_update_config()
$error_update[] = __('SNMP walk binary path (fallback for v1)'); $error_update[] = __('SNMP walk binary path (fallback for v1)');
} }
if (config_update_value('wmiBinary', get_parameter('wmiBinary'), true) === false) {
$error_update[] = __('Default WMI Binary');
}
$pjs = get_parameter('phantomjs_cache_interval'); $pjs = get_parameter('phantomjs_cache_interval');
switch ($pjs) { switch ($pjs) {
case $config['phantomjs_cache_interval']: case $config['phantomjs_cache_interval']:
@ -1183,6 +1161,10 @@ function config_update_config()
$error_update[] = __('Default line thickness for the Visual Console'); $error_update[] = __('Default line thickness for the Visual Console');
} }
if (config_update_value('mobile_view_orientation_vc', (int) get_parameter('mobile_view_orientation_vc'), true) === false) {
$error_update[] = __('Mobile view not allow visual console orientation');
}
if (config_update_value('ser_menu_items', (int) get_parameter('ser_menu_items', 10), true) === false) { if (config_update_value('ser_menu_items', (int) get_parameter('ser_menu_items', 10), true) === false) {
$error_update[] = __('Default line menu items for the Services'); $error_update[] = __('Default line menu items for the Services');
} }
@ -1607,7 +1589,7 @@ function config_update_config()
'port' => $config['history_db_port'], 'port' => $config['history_db_port'],
'name' => $config['history_db_name'], 'name' => $config['history_db_name'],
'user' => $config['history_db_user'], 'user' => $config['history_db_user'],
'pass' => $config['history_db_pass'], 'pass' => io_output_password($config['history_db_pass']),
] ]
); );
@ -1619,48 +1601,47 @@ function config_update_config()
$dbm->process(); $dbm->process();
} else if ($dbm->check() !== true) { } else if ($dbm->check() !== true) {
$errors[] = $dbm->getLastError(); $errors[] = $dbm->getLastError();
config_update_value('history_db_enabled', false);
}
if ($dbm->check() === true) {
// Historical configuration tokens (stored in historical db).
if ($dbm->setConfigToken(
'days_purge',
get_parameter('history_dbh_purge')
) !== true
) {
$error_update[] = __('Historical database purge');
}
if ($dbm->setConfigToken(
'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0)
) !== true
) {
$error_update[] = __('Historical database partitions');
}
if ($dbm->setConfigToken(
'event_purge',
get_parameter('history_dbh_events_purge')
) !== true
) {
$error_update[] = __('Historical database events purge');
}
if ($dbm->setConfigToken(
'string_purge',
get_parameter('history_dbh_string_purge')
) !== true
) {
$error_update[] = __('Historical database string purge');
}
// Disable history db in history db.
$dbm->setConfigToken('history_db_enabled', 0);
} }
} }
// Historical configuration tokens (stored in historical db).
if (Config::set(
'days_purge',
get_parameter('history_dbh_purge'),
true
) !== true
) {
$error_update[] = __('Historical database purge');
}
if (Config::set(
'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0),
true
) !== true
) {
$error_update[] = __('Historical database partitions');
}
if (Config::set(
'event_purge',
get_parameter('history_dbh_events_purge'),
true
) !== true
) {
$error_update[] = __('Historical database events purge');
}
if (Config::set(
'string_purge',
get_parameter('history_dbh_string_purge'),
true
) !== true
) {
$error_update[] = __('Historical database string purge');
}
// Disable history db in history db.
Config::set('history_db_enabled', 0, true);
break; break;
case 'ehorus': case 'ehorus':
@ -2054,6 +2035,10 @@ function config_process_config()
config_update_value('max_execution_event_response', 10); config_update_value('max_execution_event_response', 10);
} }
if (!isset($config['max_number_of_events_per_node'])) {
config_update_value('max_number_of_events_per_node', 100000);
}
if (!isset($config['max_macro_fields'])) { if (!isset($config['max_macro_fields'])) {
config_update_value('max_macro_fields', 10); config_update_value('max_macro_fields', 10);
} }
@ -2088,6 +2073,10 @@ function config_process_config()
config_update_value('snmpwalk_fallback', 'snmpwalk'); config_update_value('snmpwalk_fallback', 'snmpwalk');
} }
if (isset($config['wmiBinary']) === false) {
config_update_value('wmiBinary', 'pandorawmic');
}
if (!isset($config['event_purge'])) { if (!isset($config['event_purge'])) {
config_update_value('event_purge', 15); config_update_value('event_purge', 15);
} }
@ -2132,22 +2121,6 @@ function config_process_config()
config_update_value('policy_add_max_agents', 200); config_update_value('policy_add_max_agents', 200);
} }
if (!isset($config['event_replication'])) {
config_update_value('event_replication', 0);
}
if (!isset($config['replication_interval'])) {
config_update_value('replication_interval', 10);
}
if (!isset($config['replication_limit'])) {
config_update_value('replication_limit', 50);
}
if (!isset($config['replication_dbengine'])) {
config_update_value('replication_dbengine', 'mysql');
}
if (!isset($config['replication_dbhost'])) { if (!isset($config['replication_dbhost'])) {
config_update_value('replication_dbhost', ''); config_update_value('replication_dbhost', '');
} }
@ -2168,18 +2141,10 @@ function config_process_config()
config_update_value('replication_dbport', ''); config_update_value('replication_dbport', '');
} }
if (!isset($config['replication_mode'])) {
config_update_value('replication_mode', 'only_validated');
}
if (!isset($config['metaconsole_agent_cache'])) { if (!isset($config['metaconsole_agent_cache'])) {
config_update_value('metaconsole_agent_cache', 0); config_update_value('metaconsole_agent_cache', 0);
} }
if (!isset($config['show_events_in_local'])) {
config_update_value('show_events_in_local', 0);
}
if (!isset($config['log_collector'])) { if (!isset($config['log_collector'])) {
config_update_value('log_collector', 0); config_update_value('log_collector', 0);
} }
@ -2357,12 +2322,12 @@ function config_process_config()
config_update_value('custom_favicon', ''); config_update_value('custom_favicon', '');
} }
if (!isset($config['custom_logo'])) { if (isset($config['custom_logo']) === false) {
config_update_value('custom_logo', 'pandora_logo_head_4.png'); config_update_value('custom_logo', HEADER_LOGO_DEFAULT_CLASSIC);
} }
if (!isset($config['custom_logo_collapsed'])) { if (isset($config['custom_logo_collapsed']) === false) {
config_update_value('custom_logo_collapsed', 'pandora_logo_green_collapsed.png'); config_update_value('custom_logo_collapsed', HEADER_LOGO_DEFAULT_COLLAPSED);
} }
if (is_metaconsole()) { if (is_metaconsole()) {
@ -3066,6 +3031,10 @@ function config_process_config()
config_update_value('vc_line_thickness', 2); config_update_value('vc_line_thickness', 2);
} }
if (isset($config['mobile_view_orientation_vc']) === false) {
config_update_value('mobile_view_orientation_vc', 0);
}
if (!isset($config['agent_size_text_small'])) { if (!isset($config['agent_size_text_small'])) {
config_update_value('agent_size_text_small', 18); config_update_value('agent_size_text_small', 18);
} }

View File

@ -235,7 +235,7 @@ function db_pandora_audit($accion, $descripcion, $user_id=false, $ip=true, $info
if (isset($config['remote_addr']) === true) { if (isset($config['remote_addr']) === true) {
$ip = $config['remote_addr']; $ip = $config['remote_addr'];
} else { } else {
if ($_SERVER['REMOTE_ADDR']) { if (isset($_SERVER['REMOTE_ADDR']) === true) {
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
} else { } else {
$ip = __('N/A'); $ip = __('N/A');

File diff suppressed because it is too large Load Diff

View File

@ -626,7 +626,7 @@ function grafico_modulo_sparse_data(
* 'show_legend' => true, * 'show_legend' => true,
* 'show_overview' => true, * 'show_overview' => true,
* 'return_img_base_64' => false, * 'return_img_base_64' => false,
* 'image_treshold' => false, * 'image_threshold' => false,
* 'graph_combined' => false, * 'graph_combined' => false,
* 'graph_render' => 0, * 'graph_render' => 0,
* 'zoom' => 1, * 'zoom' => 1,
@ -782,8 +782,8 @@ function grafico_modulo_sparse($params)
$params['return_img_base_64'] = false; $params['return_img_base_64'] = false;
} }
if (isset($params['image_treshold']) === false) { if (isset($params['image_threshold']) === false) {
$params['image_treshold'] = false; $params['image_threshold'] = false;
} }
if (isset($params['graph_combined']) === false) { if (isset($params['graph_combined']) === false) {
@ -1305,8 +1305,8 @@ function graphic_combined_module(
$params['return_img_base_64'] = false; $params['return_img_base_64'] = false;
} }
if (isset($params['image_treshold']) === false) { if (isset($params['image_threshold']) === false) {
$params['image_treshold'] = false; $params['image_threshold'] = false;
} }
if (isset($params['show_unknown']) === false) { if (isset($params['show_unknown']) === false) {
@ -3286,73 +3286,6 @@ function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_mod
} }
function graph_events_validated($width=300, $height=200, $extra_filters=[], $meta=false, $history=false)
{
global $config;
global $graphic_type;
$event_type = false;
if (array_key_exists('event_type', $extra_filters)) {
$event_type = $extra_filters['event_type'];
}
$event_severity = false;
if (array_key_exists('event_severity', $extra_filters)) {
$event_severity = $extra_filters['event_severity'];
}
$event_status = false;
if (array_key_exists('event_status', $extra_filters)) {
$event_status = $extra_filters['event_status'];
}
$event_filter_search = false;
if (array_key_exists('event_filter_search', $extra_filters)) {
$event_filter_search = $extra_filters['event_filter_search'];
}
$data_graph = events_get_count_events_validated(
['id_group' => array_keys(users_get_groups())],
null,
null,
$event_severity,
$event_type,
$event_status,
$event_filter_search
);
$colors = [];
foreach ($data_graph as $k => $v) {
if ($k == __('Validated')) {
$colors[$k] = COL_NORMAL;
} else {
$colors[$k] = COL_CRITICAL;
}
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
echo pie_graph(
$data_graph,
$width,
$height,
__('other'),
'',
$water_mark,
$config['fontpath'],
$config['font_size'],
1,
'bottom',
$colors
);
}
/** /**
* Print a pie graph with events data of group * Print a pie graph with events data of group
* *
@ -3365,13 +3298,13 @@ function grafico_eventos_grupo($width=300, $height=200, $url='', $noWaterMark=tr
global $config; global $config;
global $graphic_type; global $graphic_type;
// It was urlencoded, so we urldecode it // It was urlencoded, so we urldecode it.
$url = html_entity_decode(rawurldecode($url), ENT_QUOTES); $url = html_entity_decode(rawurldecode($url), ENT_QUOTES);
$data = []; $data = [];
$loop = 0; $loop = 0;
define('NUM_PIECES_PIE', 6); define('NUM_PIECES_PIE', 6);
// Hotfix for the id_agente_modulo // Hotfix for the id_agente_modulo.
$url = str_replace( $url = str_replace(
'SELECT id_agente_modulo', 'SELECT id_agente_modulo',
'SELECT_id_agente_modulo', 'SELECT_id_agente_modulo',
@ -3386,22 +3319,24 @@ function grafico_eventos_grupo($width=300, $height=200, $url='', $noWaterMark=tr
'INSERT ', 'INSERT ',
'EXEC', 'EXEC',
]; ];
// remove bad strings from the query so queries like ; DELETE FROM don't pass // remove bad strings from the query so queries like ; DELETE FROM don't pass.
$url = str_ireplace($badstrings, '', $url); $url = str_ireplace($badstrings, '', $url);
// Hotfix for the id_agente_modulo // Hotfix for the id_agente_modulo.
$url = str_replace( $url = str_replace(
'SELECT_id_agente_modulo', 'SELECT_id_agente_modulo',
'SELECT id_agente_modulo', 'SELECT id_agente_modulo',
$url $url
); );
$event_table = 'tevento'; // Add tags condition to filter.
$field_extra = ''; $tags_condition = tags_get_acl_tags(
$groupby_extra = ''; $config['id_user'],
0,
// Add tags condition to filter 'ER',
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND'); 'event_condition',
'AND'
);
if ($time_limit && $config['event_view_hr']) { if ($time_limit && $config['event_view_hr']) {
$tags_condition .= ' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; $tags_condition .= ' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')';
@ -3409,14 +3344,14 @@ function grafico_eventos_grupo($width=300, $height=200, $url='', $noWaterMark=tr
// This will give the distinct id_agente, give the id_grupo that goes // This will give the distinct id_agente, give the id_grupo that goes
// with it and then the number of times it occured. GROUP BY statement // with it and then the number of times it occured. GROUP BY statement
// is required if both DISTINCT() and COUNT() are in the statement // is required if both DISTINCT() and COUNT() are in the statement.
$sql = sprintf( $sql = sprintf(
'SELECT DISTINCT(id_agente) AS id_agente, 'SELECT DISTINCT(id_agente) AS id_agente,
COUNT(id_agente) AS count'.$field_extra.' COUNT(id_agente) AS count
FROM '.$event_table.' te LEFT JOIN tagent_secondary_group tasg FROM tevento te LEFT JOIN tagent_secondary_group tasg
ON te.id_grupo = tasg.id_group ON te.id_grupo = tasg.id_group
WHERE 1=1 %s %s WHERE 1=1 %s %s
GROUP BY id_agente'.$groupby_extra.' GROUP BY id_agente
ORDER BY count DESC LIMIT 8', ORDER BY count DESC LIMIT 8',
$url, $url,
$tags_condition $tags_condition
@ -3456,7 +3391,7 @@ function grafico_eventos_grupo($width=300, $height=200, $url='', $noWaterMark=tr
$data[$name] = $system_events; $data[$name] = $system_events;
} }
// Sort the data // Sort the data.
arsort($data); arsort($data);
if ($noWaterMark) { if ($noWaterMark) {
$water_mark = [ $water_mark = [

View File

@ -1685,7 +1685,9 @@ function html_print_select_multiple_modules_filtered(array $data):string
); );
} }
if ($data['mAgents'] !== null) { if (empty($data['mAgents']) === false
&& empty($data['mModuleGroup'] === false)
) {
$all_modules = get_modules_agents( $all_modules = get_modules_agents(
$data['mModuleGroup'], $data['mModuleGroup'],
explode(',', $data['mAgents']), explode(',', $data['mAgents']),
@ -2690,7 +2692,9 @@ function html_print_input_password(
} }
if ($class) { if ($class) {
$attr['class'] = $class; $attr['class'] = $class.' '.'password_input';
} else {
$attr['class'] = 'password_input';
} }
if ($disabled === false) { if ($disabled === false) {
@ -2761,7 +2765,9 @@ function html_print_input_text(
} }
if ($class != '') { if ($class != '') {
$attr['class'] = $class; $attr['class'] = $class.' '.'text_input';
} else {
$attr['class'] = 'text_input';
} }
if ($onChange != '') { if ($onChange != '') {
@ -4237,6 +4243,82 @@ function html_print_image(
} }
/**
* Function for print the logo in menu header.
*
* @param boolean $menuCollapsed If true, the menu is collapsed.
* @param boolean $return If true, the formed element is returned.
*
* @return mixed.
*/
function html_print_header_logo_image(bool $menuCollapsed, bool $return=false)
{
global $config;
if (defined('PANDORA_ENTERPRISE') === false) {
if ($config['style'] === 'pandora_black') {
$custom_logo = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
$custom_logo_collapsed = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_COLLAPSED;
} else if ($config['style'] === 'pandora') {
$custom_logo = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
$custom_logo_collapsed = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_COLLAPSED;
}
$logo_title = get_product_name().' Opensource';
} else {
// Handle default logos when change theme.
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
}
$logo_title = get_product_name().' Enterprise';
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo) === true) {
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
}
}
if (isset($config['custom_logo']) === true) {
$output = html_print_image(
$custom_logo,
true,
[
'border' => '0',
'width' => '215',
'alt' => $logo_title,
'class' => 'logo_full',
'style' => ($menuCollapsed === true) ? 'display:none' : 'display:block',
]
);
}
if (isset($config['custom_logo_collapsed']) === true) {
$output .= html_print_image(
$custom_logo_collapsed,
true,
[
'border' => '0',
'width' => '60',
'alt' => $logo_title,
'class' => 'logo_icon',
'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none',
]
);
}
if ($return === false) {
echo $output;
} else {
return $output;
}
}
/** /**
* Render an input text element. Extended version, use html_print_input_text() to simplify. * Render an input text element. Extended version, use html_print_input_text() to simplify.
* *
@ -4478,7 +4560,7 @@ function html_print_autocomplete_modules(
100, 100,
false, false,
'', '',
['style' => 'background: url('.$module_icon.') no-repeat right; '.$text_color.''] ['style' => 'border: none; padding: 2px 5px; margin-bottom: 4px; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$module_icon.') no-repeat right; '.$text_color.'']
); );
html_print_input_hidden($name.'_hidden', $id_agent_module); html_print_input_hidden($name.'_hidden', $id_agent_module);
@ -4844,7 +4926,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'image': case 'image':
$output .= html_print_input_image( $output .= html_print_input_image(
$data['name'], ((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'], $data['src'],
$data['value'], $data['value'],
((isset($data['style']) === true) ? $data['style'] : ''), ((isset($data['style']) === true) ? $data['style'] : ''),

View File

@ -1133,7 +1133,7 @@ function modules_get_table_data(?int $id_agent_module, ?int $id_type)
function modules_get_raw_data($id_agent_module, $date_init, $date_end) function modules_get_raw_data($id_agent_module, $date_init, $date_end)
{ {
$table = modules_get_table_data($id_agent_module); $table = modules_get_table_data($id_agent_module, null);
$datelimit = ($date_init - $date_end); $datelimit = ($date_init - $date_end);
$search_in_history_db = db_search_in_history_db($datelimit); $search_in_history_db = db_search_in_history_db($datelimit);
@ -4213,7 +4213,7 @@ function modules_get_min_max_data($id_agent_module, $time_init=0)
$data[0]['max'] = $min_max['max']; $data[0]['max'] = $min_max['max'];
} else { } else {
// Search limits of the last two days. // Search limits of the last two days.
$table = modules_get_table_data($id_agent_module); $table = modules_get_table_data($id_agent_module, null);
$data = db_get_all_rows_sql( $data = db_get_all_rows_sql(
'SELECT min(datos) as min, max(datos) as max 'SELECT min(datos) as min, max(datos) as max
FROM '.$table.' FROM '.$table.'

View File

@ -84,10 +84,7 @@ function get_notification_targets(int $id_message)
if (is_array($ret)) { if (is_array($ret)) {
foreach ($ret as $row) { foreach ($ret as $row) {
array_push( array_push($targets['users'], get_user_fullname($row['id_user']));
$targets['users'],
get_user_fullname($row['id_user'])
);
} }
} }
@ -227,8 +224,10 @@ function check_notification_readable(int $id_message)
* *
* @return array [users] and [groups] with the targets. * @return array [users] and [groups] with the targets.
*/ */
function get_notification_source_targets(int $id_source, ?string $subtype=null) function get_notification_source_targets(
{ int $id_source,
?string $subtype=null
) {
$ret = []; $ret = [];
$filter = ''; $filter = '';
@ -484,7 +483,8 @@ function notifications_add_group_to_source($source_id, $groups)
continue; continue;
} }
$res = $res && db_process_sql_insert( $res = $res &&
db_process_sql_insert(
'tnotification_source_group', 'tnotification_source_group',
[ [
'id_group' => $group, 'id_group' => $group,
@ -525,7 +525,8 @@ function notifications_add_users_to_source($source_id, $users)
continue; continue;
} }
$res = $res && db_process_sql_insert( $res = $res &&
db_process_sql_insert(
'tnotification_source_user', 'tnotification_source_user',
[ [
'id_user' => $user, 'id_user' => $user,
@ -551,7 +552,13 @@ function notifications_add_users_to_source($source_id, $users)
function notifications_get_group_source_not_configured($source_id) function notifications_get_group_source_not_configured($source_id)
{ {
$groups_selected = notifications_get_group_sources_for_select($source_id); $groups_selected = notifications_get_group_sources_for_select($source_id);
$all_groups = users_get_groups_for_select(false, 'AR', false, true, $groups_selected); $all_groups = users_get_groups_for_select(
false,
'AR',
false,
true,
$groups_selected
);
return array_diff($all_groups, $groups_selected); return array_diff($all_groups, $groups_selected);
} }
@ -566,12 +573,10 @@ function notifications_get_group_source_not_configured($source_id)
*/ */
function notifications_get_user_source_not_configured($source_id) function notifications_get_user_source_not_configured($source_id)
{ {
$users_selected = array_keys(notifications_get_user_sources_for_select($source_id)); $users_selected = array_keys(
$users = get_users( notifications_get_user_sources_for_select($source_id)
'id_user',
['!id_user' => $users_selected],
['id_user']
); );
$users = get_users('id_user', ['!id_user' => $users_selected], ['id_user']);
return index_array($users, 'id_user', 'id_user'); return index_array($users, 'id_user', 'id_user');
} }
@ -587,8 +592,8 @@ function notifications_get_user_source_not_configured($source_id)
function notifications_build_user_enable_return($status, $enabled) function notifications_build_user_enable_return($status, $enabled)
{ {
return [ return [
'status' => ((bool) $status === true) ? 1 : 0, 'status' => (bool) $status === true ? 1 : 0,
'enabled' => ((bool) $enabled === true) ? 1 : 0, 'enabled' => (bool) $enabled === true ? 1 : 0,
]; ];
} }
@ -625,16 +630,11 @@ function notifications_get_user_label_status($source, $user, $label)
$common_groups = array_intersect( $common_groups = array_intersect(
array_keys(users_get_groups($user)), array_keys(users_get_groups($user)),
array_keys( array_keys(notifications_get_group_sources_for_select($source['id']))
notifications_get_group_sources_for_select($source['id'])
)
); );
// No group found, return no permissions. // No group found, return no permissions.
$value = empty($common_groups) ? false : $source[$label]; $value = empty($common_groups) ? false : $source[$label];
return notifications_build_user_enable_return( return notifications_build_user_enable_return($value, false);
$value,
false
);
} }
@ -681,13 +681,7 @@ function notifications_get_counters()
{ {
$num_notifications = 0; $num_notifications = 0;
$last_id = 0; $last_id = 0;
$last_message = messages_get_overview( $last_message = messages_get_overview('timestamp', 'DESC', false, false, 1);
'timestamp',
'DESC',
false,
false,
1
);
if (!empty($last_message)) { if (!empty($last_message)) {
$num_notifications = messages_get_count(); $num_notifications = messages_get_count();
$last_id = $last_message[0]['id_mensaje']; $last_id = $last_message[0]['id_mensaje'];
@ -718,7 +712,9 @@ function notifications_get_counters()
function notifications_print_ball($num_notifications, $last_id) function notifications_print_ball($num_notifications, $last_id)
{ {
$no_notifications = (int) $num_notifications === 0; $no_notifications = (int) $num_notifications === 0;
$class_status = ($no_notifications) ? 'notification-ball-no-messages' : 'notification-ball-new-messages'; $class_status = $no_notifications
? 'notification-ball-no-messages'
: 'notification-ball-new-messages';
return sprintf( return sprintf(
'<div '<div
%s %s
@ -728,7 +724,7 @@ function notifications_print_ball($num_notifications, $last_id)
> >
%s %s
</div>', </div>',
($no_notifications) ? '' : 'onclick="addNotifications(event)"', $no_notifications ? '' : 'onclick="addNotifications(event)"',
$class_status, $class_status,
$last_id, $last_id,
$num_notifications $num_notifications
@ -799,7 +795,7 @@ function notifications_print_global_source_configuration($source)
'type' => 'switch', 'type' => 'switch',
'id' => 'nt-'.$source['id'].'.'.$type.'-subtype', 'id' => 'nt-'.$source['id'].'.'.$type.'-subtype',
'class' => 'elem-clickable', 'class' => 'elem-clickable',
'value' => (isset($blacklist[$type]) === false), 'value' => isset($blacklist[$type]) === false,
'return' => true, 'return' => true,
] ]
); );
@ -833,14 +829,11 @@ function notifications_print_global_source_configuration($source)
* *
* @return string HTML with the generated selector * @return string HTML with the generated selector
*/ */
function notifications_print_source_select_box( function notifications_print_source_select_box($info_selec, $id, $source_id)
$info_selec, {
$id, $title = $id === 'users' ? __('Notified users') : __('Notified groups');
$source_id $add_title = $id === 'users' ? __('Add users') : __('Add groups');
) { $delete_title = $id === 'users' ? __('Delete users') : __('Delete groups');
$title = ($id === 'users') ? __('Notified users') : __('Notified groups');
$add_title = ($id === 'users') ? __('Add users') : __('Add groups');
$delete_title = ($id === 'users') ? __('Delete users') : __('Delete groups');
// Generate the HTML. // Generate the HTML.
return sprintf( return sprintf(
@ -873,11 +866,7 @@ function notifications_print_source_select_box(
true, true,
[ [
'title' => $add_title, 'title' => $add_title,
'onclick' => sprintf( 'onclick' => sprintf("add_source_dialog('%s', '%s')", $id, $source_id),
"add_source_dialog('%s', '%s')",
$id,
$source_id
),
] ]
), ),
html_print_image( html_print_image(
@ -1062,7 +1051,6 @@ function notifications_print_dropdown()
function notifications_print_dropdown_element($message_info) function notifications_print_dropdown_element($message_info)
{ {
$action = ''; $action = '';
switch ($message_info['description']) { switch ($message_info['description']) {
case 'Official&#x20;communication': case 'Official&#x20;communication':
$action = 'show_modal(this.id);'; $action = 'show_modal(this.id);';

View File

@ -67,6 +67,7 @@ define('REPORT_STATUS_DOWNTIME', 4);
define('REPORT_STATUS_IGNORED', 5); define('REPORT_STATUS_IGNORED', 5);
// Clases. // Clases.
use PandoraFMS\Event;
use PandoraFMS\Module; use PandoraFMS\Module;
@ -810,7 +811,7 @@ function reporting_make_reporting_data(
break; break;
} }
$report['contents'][] = $report_control; $report['contents'][] = $report_control;
break; break;
case 'event_report_module': case 'event_report_module':
@ -826,7 +827,7 @@ function reporting_make_reporting_data(
break; break;
} }
$report['contents'][] = $report_control; $report['contents'][] = $report_control;
break; break;
case 'event_report_group': case 'event_report_group':
@ -1943,6 +1944,8 @@ function reporting_event_report_group(
$event_filter = $content['style']; $event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group']; $return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter. // Filter.
$show_summary_group = $event_filter['show_summary_group']; $show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode($event_filter['filter_event_severity'], true); $filter_event_severity = json_decode($event_filter['filter_event_severity'], true);
@ -1957,7 +1960,10 @@ function reporting_event_report_group(
$event_graph_by_criticity = $event_filter['event_graph_by_criticity']; $event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated']; $event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
if (isset($content['recursion']) && $content['recursion'] == 1 && $content['id_group'] != 0) { if (isset($content['recursion'])
&& $content['recursion'] == 1
&& $content['id_group'] != 0
) {
$propagate = db_get_value( $propagate = db_get_value(
'propagate', 'propagate',
'tgrupo', 'tgrupo',
@ -1978,6 +1984,10 @@ function reporting_event_report_group(
} }
} }
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
$data = events_get_agent( $data = events_get_agent(
false, false,
$content['period'], $content['period'],
@ -2023,27 +2033,26 @@ function reporting_event_report_group(
$return['chart']['by_user_validator'] = null; $return['chart']['by_user_validator'] = null;
$return['chart']['by_criticity'] = null; $return['chart']['by_criticity'] = null;
$return['chart']['validated_vs_unvalidated'] = null; $return['chart']['validated_vs_unvalidated'] = null;
$server_name = $content['server_name'];
$metaconsole_dbtable = false;
if (is_metaconsole() === true && empty($server_name) === true) {
$metaconsole_dbtable = true;
}
if ($event_graph_by_agent) { if ($event_graph_by_agent) {
$data_graph = events_get_count_events_by_agent( $data_graph_by_agent = [];
$content['id_group'], if (empty($data) === false) {
$content['period'], foreach ($data as $value) {
$report['datetime'], $k = $value['alias'];
$filter_event_severity, if (is_metaconsole() === true) {
$filter_event_type, $k = '('.$value['server_name'].') '.$value['alias'];
$filter_event_status, }
$filter_event_filter_search,
$metaconsole_dbtable, if (isset($data_graph_by_agent[$k]) === true) {
$filter_event_filter_exclude $data_graph_by_agent[$k]++;
); } else {
$data_graph_by_agent[$k] = 1;
}
}
}
$return['chart']['by_agent'] = pie_graph( $return['chart']['by_agent'] = pie_graph(
$data_graph, $data_graph_by_agent,
500, 500,
150, 150,
__('other'), __('other'),
@ -2056,20 +2065,9 @@ function reporting_event_report_group(
} }
if ($event_graph_by_user_validator) { if ($event_graph_by_user_validator) {
$data_graph = events_get_count_events_validated_by_user( $data_graph_by_user = events_get_count_events_validated_by_user($data);
['id_group' => $content['id_group']],
$content['period'],
$report['datetime'],
$filter_event_severity,
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['by_user_validator'] = pie_graph( $return['chart']['by_user_validator'] = pie_graph(
$data_graph, $data_graph_by_user,
500, 500,
150, 150,
__('other'), __('other'),
@ -2082,21 +2080,22 @@ function reporting_event_report_group(
} }
if ($event_graph_by_criticity) { if ($event_graph_by_criticity) {
$data_graph = events_get_count_events_by_criticity( $data_graph_by_criticity = [];
['id_group' => $content['id_group']], if (empty($data) === false) {
$content['period'], foreach ($data as $value) {
$report['datetime'], $k = get_priority_name($value['criticity']);
$filter_event_severity, if (isset($data_graph_by_criticity[$k]) === true) {
$filter_event_type, $data_graph_by_criticity[$k]++;
$filter_event_status, } else {
$filter_event_filter_search, $data_graph_by_criticity[$k] = 1;
$metaconsole_dbtable }
); }
}
$colors = get_criticity_pie_colors($data_graph); $colors = get_criticity_pie_colors($data_graph_by_criticity);
$return['chart']['by_criticity'] = pie_graph( $return['chart']['by_criticity'] = pie_graph(
$data_graph, $data_graph_by_criticity,
500, 500,
150, 150,
__('other'), __('other'),
@ -2111,20 +2110,24 @@ function reporting_event_report_group(
} }
if ($event_graph_validated_vs_unvalidated) { if ($event_graph_validated_vs_unvalidated) {
$data_graph = events_get_count_events_validated( $data_graph_by_status = [];
['id_group' => $content['id_group']], if (empty($data) === false) {
$content['period'], $status = [
$report['datetime'], 1 => __('Validated'),
$filter_event_severity, 0 => __('Not validated'),
$filter_event_type, ];
$filter_event_status, foreach ($data as $value) {
$filter_event_filter_search, $k = $status[$value['estado']];
$metaconsole_dbtable, if (isset($data_graph_by_status[$k]) === true) {
$filter_event_filter_exclude $data_graph_by_status[$k]++;
); } else {
$data_graph_by_status[$k] = 1;
}
}
}
$return['chart']['validated_vs_unvalidated'] = pie_graph( $return['chart']['validated_vs_unvalidated'] = pie_graph(
$data_graph, $data_graph_by_status,
500, 500,
150, 150,
__('other'), __('other'),
@ -2136,10 +2139,6 @@ function reporting_event_report_group(
); );
} }
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
// Total events. // Total events.
if ($return['data'] != '') { if ($return['data'] != '') {
$return['total_events'] = count($return['data']); $return['total_events'] = count($return['data']);
@ -2246,6 +2245,8 @@ function reporting_event_report_module(
$event_filter = $content['style']; $event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group']; $return['show_summary_group'] = $event_filter['show_summary_group'];
$return['show_custom_data'] = (isset($event_filter['custom_data_events']) === true) ? (bool) $event_filter['custom_data_events'] : false;
// Filter. // Filter.
$show_summary_group = $event_filter['show_summary_group']; $show_summary_group = $event_filter['show_summary_group'];
$filter_event_severity = json_decode( $filter_event_severity = json_decode(
@ -3662,15 +3663,29 @@ function reporting_groups_nodes($content)
if (empty($id_group)) { if (empty($id_group)) {
$events = []; $events = [];
} else { } else {
$sql_where = sprintf( // ID group.
' WHERE id_grupo IN (%s) AND estado<>1 ', if (empty($id_group) === false) {
implode(',', $id_group) $filters['id_group_filter'] = $id_group;
); }
$events = events_get_events_grouped(
$sql_where, // Status.
if (empty($filter_event_status) === false) {
$filters['status'] = EVENT_NO_VALIDATED;
}
// Grouped.
$filters['group_rep'] = 1;
$events = Event::search(
[
'te.*',
'ta.alias',
],
$filters,
0, 0,
1000, 1000,
false 'desc',
'te.utimestamp'
); );
} }
@ -3779,18 +3794,22 @@ function reporting_event_report_agent(
$filter_event_status = json_decode($style['filter_event_status'], true); $filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search']; $filter_event_filter_search = $style['event_filter_search'];
$filter_event_filter_exclude = $style['event_filter_exclude']; $filter_event_filter_exclude = $style['event_filter_exclude'];
$show_custom_data = (isset($style['custom_data_events']) === true) ? (bool) $style['custom_data_events'] : false;
$return['show_custom_data'] = $show_custom_data;
// Graph. // Graph.
$event_graph_by_user_validator = $style['event_graph_by_user_validator']; $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity']; $event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
$return['data'] = reporting_get_agents_detailed_event( $return['data'] = reporting_get_agents_detailed_event(
$content['id_agent'], $content['id_agent'],
$content['period'], $content['period'],
$report['datetime'], $report['datetime'],
true,
true,
$history, $history,
$show_summary_group, $show_summary_group,
$filter_event_severity, $filter_event_severity,
@ -3798,13 +3817,10 @@ function reporting_event_report_agent(
$filter_event_status, $filter_event_status,
$filter_event_filter_search, $filter_event_filter_search,
$filter_event_filter_exclude, $filter_event_filter_exclude,
$id_server $id_server,
$show_custom_data
); );
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
reporting_set_conf_charts( reporting_set_conf_charts(
$width, $width,
$height, $height,
@ -3826,28 +3842,10 @@ function reporting_event_report_agent(
$return['chart']['by_criticity'] = null; $return['chart']['by_criticity'] = null;
$return['chart']['validated_vs_unvalidated'] = null; $return['chart']['validated_vs_unvalidated'] = null;
$server_name = $content['server_name'];
if (is_metaconsole() && $server_name != '') {
$metaconsole_dbtable = true;
} else {
$metaconsole_dbtable = false;
}
if ($event_graph_by_user_validator) { if ($event_graph_by_user_validator) {
$data_graph = events_get_count_events_validated_by_user( $data_graph_by_user = events_get_count_events_validated_by_user($return['data']);
['id_agent' => $content['id_agent']],
$content['period'],
$report['datetime'],
$filter_event_severity,
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$return['chart']['by_user_validator'] = pie_graph( $return['chart']['by_user_validator'] = pie_graph(
$data_graph, $data_graph_by_user,
500, 500,
150, 150,
__('other'), __('other'),
@ -3860,22 +3858,22 @@ function reporting_event_report_agent(
} }
if ($event_graph_by_criticity) { if ($event_graph_by_criticity) {
$data_graph = events_get_count_events_by_criticity( $data_graph_by_criticity = [];
['id_agent' => $content['id_agent']], if (empty($return['data']) === false) {
$content['period'], foreach ($return['data'] as $value) {
$report['datetime'], $k = get_priority_name($value['criticity']);
$filter_event_severity, if (isset($data_graph_by_criticity[$k]) === true) {
$filter_event_type, $data_graph_by_criticity[$k]++;
$filter_event_status, } else {
$filter_event_filter_search, $data_graph_by_criticity[$k] = 1;
$metaconsole_dbtable, }
$filter_event_filter_exclude }
); }
$colors = get_criticity_pie_colors($data_graph); $colors = get_criticity_pie_colors($data_graph_by_criticity);
$return['chart']['by_criticity'] = pie_graph( $return['chart']['by_criticity'] = pie_graph(
$data_graph, $data_graph_by_criticity,
500, 500,
150, 150,
__('other'), __('other'),
@ -3890,20 +3888,24 @@ function reporting_event_report_agent(
} }
if ($event_graph_validated_vs_unvalidated) { if ($event_graph_validated_vs_unvalidated) {
$data_graph = events_get_count_events_validated( $data_graph_by_status = [];
['id_agent' => $content['id_agent']], if (empty($return['data']) === false) {
$content['period'], $status = [
$report['datetime'], 1 => __('Validated'),
$filter_event_severity, 0 => __('Not validated'),
$filter_event_type, ];
$filter_event_status, foreach ($return['data'] as $value) {
$filter_event_filter_search, $k = $status[$value['estado']];
$metaconsole_dbtable, if (isset($data_graph_by_status[$k]) === true) {
$filter_event_filter_exclude $data_graph_by_status[$k]++;
); } else {
$data_graph_by_status[$k] = 1;
}
}
}
$return['chart']['validated_vs_unvalidated'] = pie_graph( $return['chart']['validated_vs_unvalidated'] = pie_graph(
$data_graph, $data_graph_by_status,
500, 500,
150, 150,
__('other'), __('other'),
@ -6954,7 +6956,7 @@ function sla_truncate($num, $accurancy=2)
* *
* @param integer $value Value. * @param integer $value Value.
* @param integer $min Treshold min SLA. * @param integer $min Treshold min SLA.
* @param boolean $max Treshold max SLA. * @param integer $max Treshold max SLA.
* @param boolean $inverse_interval Treshold inverse SLA. * @param boolean $inverse_interval Treshold inverse SLA.
* *
* @return boolean Returns the interval in downtime (false if no matches). * @return boolean Returns the interval in downtime (false if no matches).
@ -10157,6 +10159,11 @@ function reporting_simple_graph(
$fullscale = (bool) $content['style']['fullscale']; $fullscale = (bool) $content['style']['fullscale'];
} }
$image_threshold = false;
if (isset($content['style']['image_threshold'])) {
$image_threshold = (bool) $content['style']['image_threshold'];
}
$return['chart'] = ''; $return['chart'] = '';
// Get chart. // Get chart.
@ -10211,6 +10218,7 @@ function reporting_simple_graph(
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
'return_img_base_64' => true, 'return_img_base_64' => true,
'graph_render' => $content['graph_render'], 'graph_render' => $content['graph_render'],
'image_threshold' => $image_threshold,
]; ];
if ($only_image === false) { if ($only_image === false) {
@ -10452,14 +10460,14 @@ function reporting_get_module_detailed_event(
$event['data'] = []; $event['data'] = [];
} }
// total_events // Total events.
if (isset($event['data'])) { if (isset($event['data'])) {
$event['total_events'] = count($event['data']); $event['total_events'] = count($event['data']);
} else { } else {
$event['total_events'] = 0; $event['total_events'] = 0;
} }
// graphs // Graphs.
if (!empty($force_width_chart)) { if (!empty($force_width_chart)) {
$width = $force_width_chart; $width = $force_width_chart;
} }
@ -10469,20 +10477,9 @@ function reporting_get_module_detailed_event(
} }
if ($event_graph_by_user_validator) { if ($event_graph_by_user_validator) {
$data_graph = events_get_count_events_validated_by_user( $data_graph_by_user = events_get_count_events_validated_by_user($event['data']);
['id_agentmodule' => $id_module],
$period,
$date,
$filter_event_severity,
$filter_event_type,
$filter_event_status,
$filter_event_filter_search,
$metaconsole_dbtable,
$filter_event_filter_exclude
);
$event['chart']['by_user_validator'] = pie_graph( $event['chart']['by_user_validator'] = pie_graph(
$data_graph, $data_graph_by_user,
500, 500,
150, 150,
__('other'), __('other'),
@ -10495,22 +10492,22 @@ function reporting_get_module_detailed_event(
} }
if ($event_graph_by_criticity) { if ($event_graph_by_criticity) {
$data_graph = events_get_count_events_by_criticity( $data_graph_by_criticity = [];
['id_agentmodule' => $id_module], if (empty($event['data']) === false) {
$period, foreach ($event['data'] as $value) {
$date, $k = get_priority_name($value['criticity']);
$filter_event_severity, if (isset($data_graph_by_criticity[$k]) === true) {
$filter_event_type, $data_graph_by_criticity[$k]++;
$filter_event_status, } else {
$filter_event_filter_search, $data_graph_by_criticity[$k] = 1;
$metaconsole_dbtable, }
$filter_event_filter_exclude }
); }
$colors = get_criticity_pie_colors($data_graph); $colors = get_criticity_pie_colors($data_graph_by_criticity);
$event['chart']['by_criticity'] = pie_graph( $event['chart']['by_criticity'] = pie_graph(
$data_graph, $data_graph_by_criticity,
500, 500,
150, 150,
__('other'), __('other'),
@ -10525,20 +10522,24 @@ function reporting_get_module_detailed_event(
} }
if ($event_graph_validated_vs_unvalidated) { if ($event_graph_validated_vs_unvalidated) {
$data_graph = events_get_count_events_validated( $data_graph_by_status = [];
['id_agentmodule' => $id_module], if (empty($event['data']) === false) {
$period, $status = [
$date, 1 => __('Validated'),
$filter_event_severity, 0 => __('Not validated'),
$filter_event_type, ];
$filter_event_status, foreach ($event['data'] as $value) {
$filter_event_filter_search, $k = $status[$value['estado']];
$metaconsole_dbtable, if (isset($data_graph_by_status[$k]) === true) {
$filter_event_filter_exclude $data_graph_by_status[$k]++;
); } else {
$data_graph_by_status[$k] = 1;
}
}
}
$event['chart']['validated_vs_unvalidated'] = pie_graph( $event['chart']['validated_vs_unvalidated'] = pie_graph(
$data_graph, $data_graph_by_status,
500, 500,
150, 150,
__('other'), __('other'),
@ -10585,8 +10586,6 @@ function reporting_get_agents_detailed_event(
$id_agents, $id_agents,
$period=0, $period=0,
$date=0, $date=0,
$return=false,
$only_data=false,
$history=false, $history=false,
$show_summary_group=false, $show_summary_group=false,
$filter_event_severity=false, $filter_event_severity=false,
@ -10594,14 +10593,12 @@ function reporting_get_agents_detailed_event(
$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 $id_server=0,
$show_custom_data=false
) { ) {
global $config; global $config;
if ($only_data) { $return_data = [];
$return_data = [];
}
$id_agents = (array) safe_int($id_agents, 1); $id_agents = (array) safe_int($id_agents, 1);
if (!is_numeric($date)) { if (!is_numeric($date)) {
@ -10612,8 +10609,6 @@ function reporting_get_agents_detailed_event(
$date = get_system_time(); $date = get_system_time();
} }
$events = [];
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$event = events_get_agent( $event = events_get_agent(
$id_agent, $id_agent,
@ -10637,112 +10632,38 @@ function reporting_get_agents_detailed_event(
$event = []; $event = [];
} }
if ($only_data) { $nevents = count($event);
$nevents = count($event); for ($i = ($nevents - 1); $i >= 0; $i--) {
for ($i = ($nevents - 1); $i >= 0; $i--) { $e = $event[$i];
$e = $event[$i]; if ($show_summary_group) {
if ($show_summary_group) { $return_data[] = [
$return_data[] = [ 'status' => $e['estado'],
'status' => $e['estado'], 'count' => $e['event_rep'],
'count' => $e['event_rep'], 'name' => $e['evento'],
'name' => $e['evento'], 'type' => $e['event_type'],
'type' => $e['event_type'], 'criticity' => $e['criticity'],
'criticity' => $e['criticity'], 'validated_by' => $e['id_usuario'],
'validated_by' => $e['id_usuario'], 'timestamp' => $e['timestamp_last'],
'timestamp' => $e['timestamp_rep'], 'id_evento' => $e['id_evento'],
'id_evento' => $e['id_evento'], 'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
]; ];
} else { } else {
$return_data[] = [ $return_data[] = [
'status' => $e['estado'], 'status' => $e['estado'],
'name' => $e['evento'], 'name' => $e['evento'],
'type' => $e['event_type'], 'type' => $e['event_type'],
'criticity' => $e['criticity'], 'criticity' => $e['criticity'],
'validated_by' => $e['id_usuario'], 'validated_by' => $e['id_usuario'],
'timestamp' => $e['timestamp'], 'timestamp' => $e['timestamp'],
'id_evento' => $e['id_evento'], 'id_evento' => $e['id_evento'],
]; 'id_usuario' => $e['id_usuario'],
} 'custom_data' => ($show_custom_data === true) ? $e['custom_data'] : '',
} ];
} else {
if (!empty($event)) {
array_push($events, $event);
} }
} }
} }
if ($only_data) { return $return_data;
return $return_data;
}
if ($events) {
$note = '';
if (count($events) >= 1000) {
$note .= '* '.__('Maximum of events shown').' (1000)<br>';
}
foreach ($events as $eventRow) {
foreach ($eventRow as $k => $event) {
// First pass along the class of this row.
$table->cellclass[$k][1] = $table->cellclass[$k][2] = $table->cellclass[$k][4] = $table->cellclass[$k][5] = $table->cellclass[$k][6] = get_priority_class($event['criticity']);
$data = [];
// Colored box.
switch ($event['estado']) {
case 0:
$img_st = 'images/star.png';
$title_st = __('New event');
break;
case 1:
$img_st = 'images/tick.png';
$title_st = __('Event validated');
break;
case 2:
$img_st = 'images/hourglass.png';
$title_st = __('Event in process');
break;
}
$data[] = html_print_image(
$img_st,
true,
[
'class' => 'image_status invert filter',
'width' => 16,
'title' => $title_st,
]
);
$data[] = $event['event_rep'];
$data[] = ui_print_truncate_text(
io_safe_output($event['evento']),
140,
false,
true
);
// $data[] = $event['event_type'];
$data[] = events_print_type_img($event['event_type'], true);
$data[] = get_priority_name($event['criticity']);
if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) {
$data[] = '<i>'.__('System').'</i>';
} else {
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']);
$data[] = io_safe_output($user_name);
}
$data[] = '<font style="font-size: 6pt;">'.date($config['date_format'], $event['timestamp_rep']).'</font>';
array_push($table->data, $data);
}
}
}
if ($events) {
return html_print_table($table, $return).$note;
}
} }
@ -14739,8 +14660,10 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if ($modules_is_string === false) { if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) { if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null; $max_value_critical = null;
if ((bool) $content['dinamic_proc'] === true) { if ($agentmodule_info['min_critical'] == 0) {
$max_value_critical = 0.01; if ((bool) $content['dinamic_proc'] === true) {
$max_value_critical = 0.01;
}
} }
} else { } else {
$max_value_critical = $agentmodule_info['max_critical']; $max_value_critical = $agentmodule_info['max_critical'];

View File

@ -1025,6 +1025,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
global $config; global $config;
$show_extended_events = $item['show_extended_events']; $show_extended_events = $item['show_extended_events'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) { if ($item['total_events']) {
$table1 = new stdClass(); $table1 = new stdClass();
@ -1060,23 +1061,33 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head[6] = __('Timestamp'); $table1->head[6] = __('Timestamp');
} }
if ($show_custom_data === true) {
$table1->head[8] = __('Custom data');
}
foreach ($item['data'] as $k => $event) { foreach ($item['data'] as $k => $event) {
// First pass along the class of this row. // First pass along the class of this row.
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->cellclass[$k][1] = $table1->cellclass[$k][2] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = $table1->cellclass[$k][7] = get_priority_class($event['criticity']); $table1->cellclass[$k][1] = get_priority_class($event['criticity']);
$table1->cellclass[$k][2] = get_priority_class($event['criticity']);
$table1->cellclass[$k][4] = get_priority_class($event['criticity']);
$table1->cellclass[$k][5] = get_priority_class($event['criticity']);
$table1->cellclass[$k][6] = get_priority_class($event['criticity']);
$table1->cellclass[$k][7] = get_priority_class($event['criticity']);
$table1->cellclass[$k][8] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$k][1] = $table1->cellclass[$k][3] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = get_priority_class($event['criticity']); $table1->cellclass[$k][1] = get_priority_class($event['criticity']);
$table1->cellclass[$k][3] = get_priority_class($event['criticity']);
$table1->cellclass[$k][4] = get_priority_class($event['criticity']);
$table1->cellclass[$k][5] = get_priority_class($event['criticity']);
$table1->cellclass[$k][6] = get_priority_class($event['criticity']);
$table1->cellclass[$k][7] = get_priority_class($event['criticity']);
} }
$data = []; $data = [];
// Colored box. // Colored box.
switch ($event['estado']) { switch ($event['estado']) {
case 0:
$img_st = 'images/star.png';
$title_st = __('New event');
break;
case 1: case 1:
$img_st = 'images/tick.png'; $img_st = 'images/tick.png';
$title_st = __('Event validated'); $title_st = __('Event validated');
@ -1086,6 +1097,12 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$img_st = 'images/hourglass.png'; $img_st = 'images/hourglass.png';
$title_st = __('Event in process'); $title_st = __('Event in process');
break; break;
default:
case 0:
$img_st = 'images/star.png';
$title_st = __('New event');
break;
} }
$data[] = html_print_image( $data[] = html_print_image(
@ -1112,26 +1129,52 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$data[] = events_print_type_img($event['event_type'], true); $data[] = events_print_type_img($event['event_type'], true);
if (!empty($event['id_agente'])) { if (empty($event['alias']) === false) {
$data[] = agents_get_alias($event['id_agente']); $alias = $event['alias'];
if (is_metaconsole() === true) {
$alias = '('.$event['server_name'].') '.$event['alias'];
}
$data[] = $alias;
} else { } else {
$data[] = __('%s System', get_product_name()); $data[] = __('%s System', get_product_name());
} }
$data[] = get_priority_name($event['criticity']); $data[] = get_priority_name($event['criticity']);
if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) { if (empty($event['id_usuario']) === true
&& $event['estado'] == EVENT_VALIDATE
) {
$data[] = '<i>'.__('System').'</i>'; $data[] = '<i>'.__('System').'</i>';
} else { } else {
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); $user_name = db_get_value(
'fullname',
'tusuario',
'id_user',
$event['id_usuario']
);
$data[] = io_safe_output($user_name); $data[] = io_safe_output($user_name);
} }
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$data[] = '<font class="font_6pt">'.date($config['date_format'], $event['timestamp_rep']).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], $event['timestamp_last']).'</font>';
} else { } else {
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
} }
if ($show_custom_data === true) {
$custom_data_text = '';
if (empty($event['custom_data']) === false) {
$custom_data = json_decode($event['custom_data'], true);
if (empty($custom_data) === false) {
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
}
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data); array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -1246,10 +1289,10 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
function reporting_html_event_report_module($table, $item, $pdf=0) function reporting_html_event_report_module($table, $item, $pdf=0)
{ {
global $config; global $config;
$show_extended_events = $item['show_extended_events']; $show_extended_events = $item['show_extended_events'];
$show_summary_group = $item['show_summary_group']; $show_summary_group = $item['show_summary_group'];
$show_custom_data = (bool) $item['show_custom_data'];
if ($item['total_events']) { if ($item['total_events']) {
if (!empty($item['failed'])) { if (!empty($item['failed'])) {
$table->colspan['events']['cell'] = 3; $table->colspan['events']['cell'] = 3;
@ -1279,6 +1322,10 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
} }
if ($show_custom_data === true) {
$table1->head[6] = __('Custom data');
}
if (is_array($item['data']) || is_object($item['data'])) { if (is_array($item['data']) || is_object($item['data'])) {
$item_data = array_reverse($item['data']); $item_data = array_reverse($item['data']);
} }
@ -1287,9 +1334,17 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
foreach ($item_data as $i => $event) { foreach ($item_data as $i => $event) {
$data = []; $data = [];
if ($show_summary_group) { if ($show_summary_group) {
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] = $table1->cellclass[$i][3] = $table1->cellclass[$i][4] = $table1->cellclass[$i][5] = get_priority_class($event['criticity']); $table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$i][1] = $table1->cellclass[$i][3] = $table1->cellclass[$i][4] = get_priority_class($event['criticity']); $table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']);
} }
// Colored box. // Colored box.
@ -1326,11 +1381,21 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$data[3] = get_priority_name($event['criticity']); $data[3] = get_priority_name($event['criticity']);
if ($show_summary_group) { if ($show_summary_group) {
$data[4] = $event['event_rep']; $data[4] = $event['event_rep'];
$data[5] = date($config['date_format'], $event['timestamp_rep']); $data[5] = date($config['date_format'], $event['timestamp_last']);
} else { } else {
$data[4] = date($config['date_format'], strtotime($event['timestamp'])); $data[4] = date($config['date_format'], strtotime($event['timestamp']));
} }
if ($show_custom_data === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[6] = $custom_data_text;
}
$table1->data[] = $data; $table1->data[] = $data;
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -2341,6 +2406,13 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->align[0] = 'center'; $table1->align[0] = 'center';
$table1->align[1] = 'center'; $table1->align[1] = 'center';
$table1->align[3] = 'center'; $table1->align[3] = 'center';
if ((bool) $item['show_custom_data'] === true) {
if ($item['show_summary_group']) {
$table1->align[7] = 'left';
} else {
$table1->align[6] = 'left';
}
}
$table1->data = []; $table1->data = [];
@ -2355,12 +2427,24 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head[4] = __('Severity'); $table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by'); $table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp'); $table1->head[6] = __('Timestamp');
if ((bool) $item['show_custom_data'] === true) {
$table1->head[7] = __('Custom data');
}
foreach ($item['data'] as $i => $event) { foreach ($item['data'] as $i => $event) {
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->cellclass[$i][1] = $table1->cellclass[$i][2] = $table1->cellclass[$i][4] = $table1->cellclass[$i][5] = $table1->cellclass[$i][6] = get_priority_class($event['criticity']); $table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']);
$table1->cellclass[$i][7] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$i][1] = $table1->cellclass[$i][3] = $table1->cellclass[$i][4] = $table1->cellclass[$i][5] = get_priority_class($event['criticity']); $table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']);
} }
$data = []; $data = [];
@ -2415,11 +2499,21 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
} }
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$data[] = '<font class="font_6pt">'.date($config['date_format'], $event['timestamp']).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
} else { } else {
$data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>'; $data[] = '<font class="font_6pt">'.date($config['date_format'], strtotime($event['timestamp'])).'</font>';
} }
if ((bool) $item['show_custom_data'] === true) {
$custom_data = json_decode($event['custom_data'], true);
$custom_data_text = '';
foreach ($custom_data as $key => $value) {
$custom_data_text .= $key.' = '.$value.'<br>';
}
$data[] = $custom_data_text;
}
array_push($table1->data, $data); array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) { if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
@ -5898,7 +5992,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
} }
function reporting_get_event_histogram_meta($width) function reporting_get_event_histogram_meta($width, $events)
{ {
global $config; global $config;
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
@ -5941,21 +6035,6 @@ function reporting_get_event_histogram_meta($width)
EVENT_CRIT_CRITICAL => COL_CRITICAL, EVENT_CRIT_CRITICAL => COL_CRITICAL,
]; ];
$user_groups = users_get_groups($config['id_user'], 'ER');
$user_groups_ids = array_keys($user_groups);
if (empty($user_groups)) {
$groups_condition = ' AND 1 = 0 ';
} else {
$groups_condition = ' AND id_grupo IN ('.implode(',', $user_groups_ids).') ';
}
if (!check_acl($config['id_user'], 0, 'PM')) {
$groups_condition .= ' AND id_grupo != 0';
}
$status_condition = ' AND estado = 0 ';
$cont = 0; $cont = 0;
for ($i = 0; $i < $interval; $i++) { for ($i = 0; $i < $interval; $i++) {
$bottom = ($datelimit + ($periodtime * $i)); $bottom = ($datelimit + ($periodtime * $i));
@ -5979,23 +6058,12 @@ function reporting_get_event_histogram_meta($width)
$top = ($datelimit + ($periodtime * ($i + 1))); $top = ($datelimit + ($periodtime * ($i + 1)));
$time_condition = 'utimestamp > '.$bottom.' AND utimestamp < '.$top;
$sql = sprintf(
'SELECT criticity,utimestamp
FROM tmetaconsole_event
WHERE %s %s %s
ORDER BY criticity DESC',
$time_condition,
$groups_condition,
$status_condition
);
$events = db_get_all_rows_sql($sql);
$events_criticity = []; $events_criticity = [];
if (is_array($events)) { if (is_array($events)) {
foreach ($events as $key => $value) { foreach ($events as $value) {
array_push($events_criticity, $value['criticity']); if ($value['utimestamp'] >= $bottom && $value['utimestamp'] < $top) {
array_push($events_criticity, $value['criticity']);
}
} }
} }

View File

@ -34,15 +34,22 @@
* *
* @param boolean $id_user * @param boolean $id_user
* @param boolean $user_strict * @param boolean $user_strict
* @param [type] $acltags * @param array $acltags
* @param boolean $returnAllGroup * @param boolean $returnAllGroup
* @param string $mode * @param string $mode
* @param array $agent_filter * @param array $agent_filter
* @param array $module_filter * @param array $module_filter
* @return void * @return void
*/ */
function tactical_get_data($id_user=false, $user_strict=false, $acltags, $returnAllGroup=false, $mode='group', $agent_filter=[], $module_filter=[]) function tactical_get_data(
{ $id_user=false,
$user_strict=false,
$acltags=[],
$returnAllGroup=false,
$mode='group',
$agent_filter=[],
$module_filter=[]
) {
global $config; global $config;
if ($id_user == false) { if ($id_user == false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
@ -504,10 +511,12 @@ function tactical_status_modules_agents($id_user=false, $user_strict=false, $acc
function tactical_monitor_alerts($strict_user=false) function tactical_monitor_alerts($strict_user=false)
{ {
global $config;
$groups = users_get_groups($config['id_user'], 'AR', false); $groups = users_get_groups($config['id_user'], 'AR', false);
$id_groups = array_keys($groups); $id_groups = array_keys($groups);
if (empty($id_groups)) { $where_clause = '';
if (empty($id_groups) === true) {
$where_clause .= ' AND (1 = 0) '; $where_clause .= ' AND (1 = 0) ';
} else { } else {
$where_clause .= sprintf( $where_clause .= sprintf(

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