Merge remote-tracking branch 'origin/develop' into ent-2133-14061-recursividad-en-la-vista-de-eventos-accelya
Conflicts: pandora_console/extras/mr/58.sql
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, AIX version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, FreeBSD Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, HP-UX Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, GNU/Linux
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, GNU/Linux
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, Solaris Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -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.764
|
# Version 7.0NG.765
|
||||||
# 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
|
||||||
|
@ -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.764, AIX version
|
# Version 7.0NG.765, AIX version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -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.764
|
# Version 7.0NG.765
|
||||||
# FreeBSD/IPSO version
|
# FreeBSD/IPSO version
|
||||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||||
|
|
||||||
|
@ -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.764, HPUX Version
|
# Version 7.0NG.765, HPUX Version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764
|
# Version 7.0NG.765
|
||||||
# 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764
|
# Version 7.0NG.765
|
||||||
# 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764
|
# Version 7.0NG.765
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
||||||
|
@ -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.764, Solaris version
|
# Version 7.0NG.765, Solaris version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, AIX version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.764-220929
|
Version: 7.0NG.765-221018
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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.764-220929"
|
pandora_version="7.0NG.765-221018"
|
||||||
|
|
||||||
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
|
||||||
|
@ -31,7 +31,7 @@ fi
|
|||||||
if [ "$#" -ge 2 ]; then
|
if [ "$#" -ge 2 ]; then
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
else
|
else
|
||||||
VERSION="7.0NG.764"
|
VERSION="7.0NG.765"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Path for the generated DMG file
|
# Path for the generated DMG 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.764" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.765" 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.764" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.765" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||||
<!-- <installation-check script="check()" />
|
<!-- <installation-check script="check()" />
|
||||||
<script>
|
<script>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -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.764</string>
|
<key>CFBundleVersion</key> <string>7.0NG.765</string>
|
||||||
<key>CFBundleGetInfoString</key> <string>7.0NG.764 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
<key>CFBundleGetInfoString</key> <string>7.0NG.765 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||||
<key>CFBundleShortVersionString</key> <string>7.0NG.764</string>
|
<key>CFBundleShortVersionString</key> <string>7.0NG.765</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>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, GNU/Linux
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, FreeBSD Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, HP-UX Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, GNU/Linux
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, GNU/Linux
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, NetBSD Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.764, Solaris Version
|
# Version 7.0NG.765, 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
|
||||||
|
@ -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.764';
|
use constant AGENT_VERSION => '7.0NG.765';
|
||||||
use constant AGENT_BUILD => '220929';
|
use constant AGENT_BUILD => '221018';
|
||||||
|
|
||||||
# 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;
|
||||||
|
@ -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.764
|
%define version 7.0NG.765
|
||||||
%define release 220929
|
%define release 221018
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -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.764
|
%define version 7.0NG.765
|
||||||
%define release 220929
|
%define release 221018
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -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.764"
|
PI_VERSION="7.0NG.765"
|
||||||
PI_BUILD="220929"
|
PI_BUILD="221018"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -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.764
|
# Version 7.0NG.765
|
||||||
# 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
|
||||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||||||
{Yes}
|
{Yes}
|
||||||
|
|
||||||
AppName
|
AppName
|
||||||
{Pandora FMS Windows Agent v7.0NG.764}
|
{Pandora FMS Windows Agent v7.0NG.765}
|
||||||
|
|
||||||
ApplicationID
|
ApplicationID
|
||||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{220929}
|
{221018}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -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.764 Build 220929")
|
#define PANDORA_VERSION ("7.0NG.765 Build 221018")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -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.764(Build 220929))"
|
VALUE "ProductVersion", "(7.0NG.765(Build 221018))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.764-220929
|
Version: 7.0NG.765-221018
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -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.764-220929"
|
pandora_version="7.0NG.765-221018"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2;
|
||||||
|
ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT '';
|
||||||
|
|
||||||
ALTER TABLE `tevent_filter` ADD COLUMN `search_recursive_groups` INT NOT NULL DEFAULT 0;
|
ALTER TABLE `tevent_filter` ADD COLUMN `search_recursive_groups` INT NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
@ -187,7 +187,7 @@ if (!$double_auth_enabled
|
|||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
// Don't allow close the dialog with X button
|
// Don't allow close the dialog with X button
|
||||||
$('.ui-dialog-titlebar-close').css('display', 'none');
|
// $('.ui-dialog-titlebar-close').css('display', 'none');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -181,7 +181,7 @@ $module_macros = [];
|
|||||||
// Create agent.
|
// Create agent.
|
||||||
if ($create_agent) {
|
if ($create_agent) {
|
||||||
$mssg_warning = 0;
|
$mssg_warning = 0;
|
||||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
|
||||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||||
@ -935,7 +935,7 @@ if ($update_agent) {
|
|||||||
$mssg_warning = 0;
|
$mssg_warning = 0;
|
||||||
$id_agente = (int) get_parameter_post('id_agente');
|
$id_agente = (int) get_parameter_post('id_agente');
|
||||||
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
||||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
$alias_safe_output = strip_tags(io_safe_output(get_parameter('alias', '')));
|
||||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
|
||||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||||
@ -1047,7 +1047,7 @@ if ($update_agent) {
|
|||||||
// If there is an agent with the same name, but a different ID.
|
// If there is an agent with the same name, but a different ID.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($unique_ip && $direccion_agente != '') {
|
if ($direccion_agente !== $address_list && (bool) $unique_ip === true && $direccion_agente != '') {
|
||||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||||
$exists_ip = db_get_row_sql($sql);
|
$exists_ip = db_get_row_sql($sql);
|
||||||
}
|
}
|
||||||
|
@ -669,13 +669,12 @@ $table_advanced->data[2][3] = __('Max. Value');
|
|||||||
$table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
$table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||||
$table_advanced->colspan[2][4] = 3;
|
$table_advanced->colspan[2][4] = 3;
|
||||||
|
|
||||||
|
|
||||||
$table_advanced->data[3][0] = __('Dynamic Threshold Interval');
|
$table_advanced->data[3][0] = __('Dynamic Threshold Interval');
|
||||||
$table_advanced->data[3][1] = html_print_extended_select_for_time(
|
$table_advanced->data[3][1] = html_print_extended_select_for_time(
|
||||||
'dynamic_interval',
|
'dynamic_interval',
|
||||||
$dynamic_interval,
|
$dynamic_interval,
|
||||||
'',
|
'',
|
||||||
'None',
|
__('None'),
|
||||||
'0',
|
'0',
|
||||||
10,
|
10,
|
||||||
true,
|
true,
|
||||||
|
@ -285,13 +285,13 @@ if (is_ajax()) {
|
|||||||
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
|
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => 'field'.$i.'_value[]',
|
'name' => 'field'.$i.'_value[]',
|
||||||
'value' => ''
|
'value' => '',
|
||||||
]
|
]
|
||||||
).'</div>';
|
).'</div>';
|
||||||
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
|
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => 'field'.$i.'_recovery_value[]',
|
'name' => 'field'.$i.'_recovery_value[]',
|
||||||
'value' => ''
|
'value' => '',
|
||||||
]
|
]
|
||||||
).'</div>';
|
).'</div>';
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ if (is_ajax()) {
|
|||||||
$filter,
|
$filter,
|
||||||
[
|
[
|
||||||
'name',
|
'name',
|
||||||
'id_report'
|
'id_report',
|
||||||
],
|
],
|
||||||
$return_all_group,
|
$return_all_group,
|
||||||
'RR'
|
'RR'
|
||||||
@ -419,7 +419,7 @@ if (is_ajax()) {
|
|||||||
$filter,
|
$filter,
|
||||||
[
|
[
|
||||||
'name',
|
'name',
|
||||||
'id_report'
|
'id_report',
|
||||||
],
|
],
|
||||||
$return_all_group,
|
$return_all_group,
|
||||||
'RR'
|
'RR'
|
||||||
|
@ -358,7 +358,7 @@ if (!is_user_admin($config['id_user'])) {
|
|||||||
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
|
$filter['id_group'] = array_keys(users_get_groups(false, 'LM'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total']);
|
$total_templates = alerts_get_alert_templates($filter, ['COUNT(*) AS total'], true);
|
||||||
$total_templates = $total_templates[0]['total'];
|
$total_templates = $total_templates[0]['total'];
|
||||||
|
|
||||||
$templates = alerts_get_alert_templates(
|
$templates = alerts_get_alert_templates(
|
||||||
|
@ -881,6 +881,7 @@ if (($create != '') || ($view != '')) {
|
|||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
]
|
]
|
||||||
).'</a> ';
|
).'</a> ';
|
||||||
|
if ((bool) $row['no_delete'] === false) {
|
||||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image(
|
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true,
|
true,
|
||||||
@ -889,6 +890,7 @@ if (($create != '') || ($view != '')) {
|
|||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
]
|
]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,17 @@ foreach ($servers as $server) {
|
|||||||
$data[8] .= '</a>';
|
$data[8] .= '</a>';
|
||||||
|
|
||||||
if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) {
|
if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) {
|
||||||
|
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
|
||||||
|
$data[8] .= html_print_image(
|
||||||
|
'images/agent.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Manage satellite hosts'),
|
||||||
|
'class' => 'invert_filter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$data[8] .= '</a>';
|
||||||
|
|
||||||
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
|
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
|
||||||
$data[8] .= html_print_image(
|
$data[8] .= html_print_image(
|
||||||
'images/remote_configuration.png',
|
'images/remote_configuration.png',
|
||||||
|
@ -509,6 +509,10 @@ if ($create_user) {
|
|||||||
if (!empty($json_profile)) {
|
if (!empty($json_profile)) {
|
||||||
$json_profile = json_decode(io_safe_output($json_profile), true);
|
$json_profile = json_decode(io_safe_output($json_profile), true);
|
||||||
foreach ($json_profile as $key => $profile) {
|
foreach ($json_profile as $key => $profile) {
|
||||||
|
if (is_array($profile) === false) {
|
||||||
|
$profile = json_decode($profile, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
$group2 = $profile['group'];
|
$group2 = $profile['group'];
|
||||||
$profile2 = $profile['profile'];
|
$profile2 = $profile['profile'];
|
||||||
@ -532,6 +536,14 @@ if ($create_user) {
|
|||||||
|
|
||||||
$result_profile = profile_create_user_profile($id, $profile2, $group2, false, $tags, $no_hierarchy);
|
$result_profile = profile_create_user_profile($id, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||||
|
|
||||||
|
if ($result_profile === false) {
|
||||||
|
$is_err = true;
|
||||||
|
$user_info = $values;
|
||||||
|
$password_new = '';
|
||||||
|
$password_confirm = '';
|
||||||
|
$new_user = true;
|
||||||
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$result_profile,
|
$result_profile,
|
||||||
__('Profile added successfully'),
|
__('Profile added successfully'),
|
||||||
@ -824,6 +836,10 @@ if ($add_profile && empty($json_profile)) {
|
|||||||
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
|
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
|
||||||
);
|
);
|
||||||
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
|
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||||
|
if ($return === false) {
|
||||||
|
$is_err = true;
|
||||||
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
$return,
|
$return,
|
||||||
__('Profile added successfully'),
|
__('Profile added successfully'),
|
||||||
@ -1492,12 +1508,12 @@ if ($config['admin_can_add_user']) {
|
|||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
html_print_input_hidden('json_profile', '');
|
html_print_input_hidden('json_profile', $json_profile);
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
|
||||||
profile_print_profile_table($id);
|
profile_print_profile_table($id, io_safe_output($json_profile));
|
||||||
|
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
|
|
||||||
@ -1613,12 +1629,17 @@ $(document).ready (function () {
|
|||||||
switch_ehorus_conf();
|
switch_ehorus_conf();
|
||||||
});
|
});
|
||||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||||
|
|
||||||
var img_delete = '<?php echo $delete_image; ?>';
|
var img_delete = '<?php echo $delete_image; ?>';
|
||||||
var id_user = '<?php echo io_safe_output($id); ?>';
|
var id_user = '<?php echo io_safe_output($id); ?>';
|
||||||
var is_metaconsole = '<?php echo $meta; ?>';
|
var is_metaconsole = '<?php echo $meta; ?>';
|
||||||
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
|
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
|
||||||
|
var is_err = '<?php echo $is_err; ?>';
|
||||||
var data = [];
|
var data = [];
|
||||||
|
var aux = 0;
|
||||||
|
|
||||||
|
if(json_profile.val() != '') {
|
||||||
|
var data = JSON.parse(json_profile.val());
|
||||||
|
}
|
||||||
|
|
||||||
$('input:image[name="add"]').click(function (e) {
|
$('input:image[name="add"]').click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -1641,10 +1662,14 @@ $(document).ready (function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id_user === '') {
|
if (id_user == '' || is_err == 1) {
|
||||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||||
data.push(new_json);
|
data.push(new_json);
|
||||||
json_profile.val('['+data+']');
|
json_profile.val(JSON.stringify(data));
|
||||||
|
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
|
||||||
|
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
|
||||||
|
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
|
||||||
|
|
||||||
$('#table_profiles tr:last').before(
|
$('#table_profiles tr:last').before(
|
||||||
`<tr>
|
`<tr>
|
||||||
<td>${profile_text}</td>
|
<td>${profile_text}</td>
|
||||||
@ -1654,6 +1679,10 @@ $(document).ready (function () {
|
|||||||
<td>${img_delete}</td>
|
<td>${img_delete}</td>
|
||||||
</tr>`
|
</tr>`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
getGroupIcon(group, $(`#img_group_${aux}`));
|
||||||
|
aux++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.form.submit();
|
this.form.submit();
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,6 @@ global $config;
|
|||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
enterprise_hook('open_meta_frame');
|
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_profile.php';
|
require_once $config['homedir'].'/include/functions_profile.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
require_once $config['homedir'].'/include/functions_groups.php';
|
require_once $config['homedir'].'/include/functions_groups.php';
|
||||||
@ -52,8 +50,47 @@ if (is_ajax()) {
|
|||||||
$method = get_parameter('method');
|
$method = get_parameter('method');
|
||||||
$group_id = get_parameter('group_id');
|
$group_id = get_parameter('group_id');
|
||||||
$group_recursion = (bool) get_parameter('group_recursion', 0);
|
$group_recursion = (bool) get_parameter('group_recursion', 0);
|
||||||
|
$get_user_profile_group = (bool) get_parameter('get_user_profile_group', false);
|
||||||
|
|
||||||
$return_all = false;
|
$return_all = false;
|
||||||
|
|
||||||
|
if ($get_user_profile_group === true) {
|
||||||
|
$id_user = get_parameter('id_user');
|
||||||
|
|
||||||
|
$user_is_admin = users_is_admin();
|
||||||
|
|
||||||
|
$user_profiles = [];
|
||||||
|
|
||||||
|
if ($user_is_admin === false) {
|
||||||
|
$group_um = users_get_groups_UM($config['id_user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// User profiles.
|
||||||
|
if ($user_is_admin || $id_user == $config['id_user'] || isset($group_um[0])) {
|
||||||
|
$user_profiles = db_get_all_rows_field_filter(
|
||||||
|
'tusuario_perfil',
|
||||||
|
'id_usuario',
|
||||||
|
$id_user
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$user_profiles_aux = users_get_user_profile($id_user);
|
||||||
|
foreach ($group_um as $key => $value) {
|
||||||
|
if (isset($user_profiles_aux[$key]) === true) {
|
||||||
|
$user_profiles[$key] = $user_profiles_aux[$key];
|
||||||
|
unset($user_profiles_aux[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($user_profiles as $key => $value) {
|
||||||
|
$user_profiles[$key]['id_perfil'] = profile_get_name($value['id_perfil']);
|
||||||
|
$user_profiles[$key]['id_grupo'] = groups_get_name($value['id_grupo'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($user_profiles);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($group_id == -1) {
|
if ($group_id == -1) {
|
||||||
$sql = 'SELECT tusuario.id_user FROM tusuario
|
$sql = 'SELECT tusuario.id_user FROM tusuario
|
||||||
LEFT OUTER JOIN tusuario_perfil
|
LEFT OUTER JOIN tusuario_perfil
|
||||||
@ -95,6 +132,8 @@ if (is_ajax()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
$sortField = get_parameter('sort_field');
|
$sortField = get_parameter('sort_field');
|
||||||
$sort = get_parameter('sort', 'none');
|
$sort = get_parameter('sort', 'none');
|
||||||
$tab = get_parameter('tab', 'user');
|
$tab = get_parameter('tab', 'user');
|
||||||
@ -265,6 +304,7 @@ $delete_user = (bool) get_parameter('user_del', false);
|
|||||||
if ($delete_user === true) {
|
if ($delete_user === true) {
|
||||||
// Delete user.
|
// Delete user.
|
||||||
$id_user = get_parameter('delete_user', 0);
|
$id_user = get_parameter('delete_user', 0);
|
||||||
|
if ($id_user !== 0) {
|
||||||
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
if (users_is_admin($id_user) === true && users_is_admin() === false) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
AUDIT_LOG_ACL_VIOLATION,
|
AUDIT_LOG_ACL_VIOLATION,
|
||||||
@ -331,6 +371,9 @@ if ($delete_user === true) {
|
|||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('There was a problem deleting the user'));
|
ui_print_error_message(__('There was a problem deleting the user'));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ui_print_error_message(__('ID user cannot be empty'));
|
||||||
|
}
|
||||||
} else if (isset($_GET['profile_del'])) {
|
} else if (isset($_GET['profile_del'])) {
|
||||||
// Delete profile.
|
// Delete profile.
|
||||||
$id_profile = (int) get_parameter_post('delete_profile');
|
$id_profile = (int) get_parameter_post('delete_profile');
|
||||||
@ -586,15 +629,17 @@ $rowPair = true;
|
|||||||
$iterator = 0;
|
$iterator = 0;
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
foreach ($info as $user_id => $user_info) {
|
foreach ($info as $user_id => $user_info) {
|
||||||
|
if (empty($user_id) === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// User profiles.
|
// User profiles.
|
||||||
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||||
$user_profiles = db_get_all_rows_field_filter(
|
$user_profiles = db_get_all_rows_sql(
|
||||||
'tusuario_perfil',
|
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5'
|
||||||
'id_usuario',
|
|
||||||
$user_id
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$user_profiles_aux = users_get_user_profile($user_id);
|
$user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
|
||||||
$user_profiles = [];
|
$user_profiles = [];
|
||||||
foreach ($group_um as $key => $value) {
|
foreach ($group_um as $key => $value) {
|
||||||
if (isset($user_profiles_aux[$key]) === true) {
|
if (isset($user_profiles_aux[$key]) === true) {
|
||||||
@ -676,7 +721,6 @@ foreach ($info as $user_id => $user_info) {
|
|||||||
|
|
||||||
$data[4] .= '<div class="text_end">';
|
$data[4] .= '<div class="text_end">';
|
||||||
foreach ($user_profiles as $row) {
|
foreach ($user_profiles as $row) {
|
||||||
if ($total_profile <= 5) {
|
|
||||||
$data[4] .= "<div class='float-left'>";
|
$data[4] .= "<div class='float-left'>";
|
||||||
$data[4] .= profile_get_name($row['id_perfil']);
|
$data[4] .= profile_get_name($row['id_perfil']);
|
||||||
$data[4] .= ' / </div>';
|
$data[4] .= ' / </div>';
|
||||||
@ -685,27 +729,24 @@ foreach ($info as $user_id => $user_info) {
|
|||||||
$data[4] .= '</div>';
|
$data[4] .= '</div>';
|
||||||
|
|
||||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||||
$data[4] .= '<span onclick="showGroups()" class="pdd_l_15px">
|
$data[4] .= '<span onclick="showGroups(`'.$row['id_usuario'].'`)">'.html_print_image(
|
||||||
'.html_print_image(
|
|
||||||
'images/zoom.png',
|
'images/zoom.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'title' => __('Show'),
|
'title' => __('Show profiles'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
]
|
]
|
||||||
).'</span>';
|
).'</span>';
|
||||||
|
|
||||||
|
$data[4] .= html_print_input_hidden(
|
||||||
|
'show_groups_'.$row['id_usuario'],
|
||||||
|
-1,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[4] .= '<br />';
|
|
||||||
$data[4] .= '<br />';
|
|
||||||
$data[4] .= '</div>';
|
|
||||||
} else {
|
|
||||||
$data[4] .= "<div id='groups_list' class='invisible'>";
|
|
||||||
$data[4] .= '<div >';
|
|
||||||
$data[4] .= profile_get_name($row['id_perfil']);
|
|
||||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
|
||||||
$data[4] .= '<br/>';
|
$data[4] .= '<br/>';
|
||||||
}
|
$data[4] .= '<br/>';
|
||||||
|
|
||||||
$total_profile++;
|
$total_profile++;
|
||||||
}
|
}
|
||||||
@ -719,6 +760,8 @@ foreach ($info as $user_id => $user_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data[4] .= '</div>';
|
$data[4] .= '</div>';
|
||||||
|
$data[4] .= '<div class="invisible" id="profiles_'.$user_profiles[0]['id_usuario'].'">';
|
||||||
|
$data[4] .= '</div>';
|
||||||
} else {
|
} else {
|
||||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||||
}
|
}
|
||||||
@ -882,16 +925,46 @@ echo '</div>';
|
|||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
|
|
||||||
echo '<script type="text/javascript">
|
?>
|
||||||
function showGroups(){
|
<script type="text/javascript">
|
||||||
var groups_list = document.getElementById("groups_list");
|
function showGroups(id_user) {
|
||||||
|
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') {
|
||||||
|
var request = $.ajax({
|
||||||
|
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/users/user_list',
|
||||||
|
get_user_profile_group: 1,
|
||||||
|
id_user: id_user
|
||||||
|
},
|
||||||
|
success: function (data, textStatus, xhr) {
|
||||||
|
let count = 1;
|
||||||
|
data.forEach( function(valor, indice, array) {
|
||||||
|
if (count >= 6) {
|
||||||
|
let main_div = $(`#profiles_${id_user}`);
|
||||||
|
main_div.append(
|
||||||
|
`<div id="left_${id_user}_${count}" class='float-left'>${valor.id_perfil} / </div>`,
|
||||||
|
`<div id="right_${id_user}_${count}" class='float-left pdd_l_5px'>${valor.id_grupo}</div>`,
|
||||||
|
`<br/><br/>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
count ++;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (e, textStatus) {
|
||||||
|
console.error(textStatus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||||
|
$(`#profiles_${id_user}`).show();
|
||||||
|
} else if ($(`#hidden-show_groups_${id_user}`).val() === '1') {
|
||||||
|
$(`#hidden-show_groups_${id_user}`).val('0');
|
||||||
|
$(`#profiles_${id_user}`).hide();
|
||||||
|
} else {
|
||||||
|
$(`#hidden-show_groups_${id_user}`).val('1');
|
||||||
|
$(`#profiles_${id_user}`).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(groups_list.style.display == "none"){
|
</script>
|
||||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
|
||||||
element.style.display = "block");
|
|
||||||
}else{
|
|
||||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
|
||||||
element.style.display = "none");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
</script>';
|
|
||||||
|
@ -941,6 +941,7 @@ class HostDevices extends Wizard
|
|||||||
'return' => true,
|
'return' => true,
|
||||||
'class' => 'discovery_list_input',
|
'class' => 'discovery_list_input',
|
||||||
'simple_multiple_options' => true,
|
'simple_multiple_options' => true,
|
||||||
|
'required' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1001,6 +1002,7 @@ class HostDevices extends Wizard
|
|||||||
$("#text-interval_text").val(10);
|
$("#text-interval_text").val(10);
|
||||||
$("#hidden-interval").val('.$interval.');
|
$("#hidden-interval").val('.$interval.');
|
||||||
$("#interval_units").val('.$unit.');
|
$("#interval_units").val('.$unit.');
|
||||||
|
$("#interval_units").trigger("change");
|
||||||
}
|
}
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
|
BIN
pandora_console/images/console/icons/europemap_bad.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pandora_console/images/console/icons/europemap_ok.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pandora_console/images/console/icons/europemap_warning.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pandora_console/images/console/icons/spainmap_bad.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
pandora_console/images/console/icons/spainmap_ok.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
pandora_console/images/console/icons/spainmap_warning.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
pandora_console/images/console/icons/worldmap_bad.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pandora_console/images/console/icons/worldmap_ok.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
pandora_console/images/console/icons/worldmap_warning.png
Normal file
After Width: | Height: | Size: 14 KiB |
@ -892,34 +892,6 @@ if ($get_agent_alerts_datatable === true) {
|
|||||||
|
|
||||||
// Order and pagination metacosole.
|
// Order and pagination metacosole.
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auxiliar Ordenation function
|
|
||||||
*
|
|
||||||
* @param string $sort Direction of sort.
|
|
||||||
* @param string $sortField Field for perform the sorting.
|
|
||||||
*/
|
|
||||||
function arrayOutputSorting($sort, $sortField)
|
|
||||||
{
|
|
||||||
return function ($a, $b) use ($sort, $sortField) {
|
|
||||||
if ($sort === 'asc') {
|
|
||||||
if (is_string($a[$sortField]) === true) {
|
|
||||||
return strnatcasecmp($a[$sortField], $b[$sortField]);
|
|
||||||
} else {
|
|
||||||
return ($a[$sortField] - $b[$sortField]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (is_string($a[$sortField]) === true) {
|
|
||||||
return strnatcasecmp($b[$sortField], $a[$sortField]);
|
|
||||||
} else {
|
|
||||||
return ($a[$sortField] + $b[$sortField]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Status order.
|
// Status order.
|
||||||
if ($sortField === 'status') {
|
if ($sortField === 'status') {
|
||||||
foreach ($alerts['alerts_simple'] as $i => $alert) {
|
foreach ($alerts['alerts_simple'] as $i => $alert) {
|
||||||
|
@ -64,9 +64,9 @@ $add_comment = (bool) get_parameter('add_comment');
|
|||||||
$dialogue_event_response = (bool) get_parameter('dialogue_event_response');
|
$dialogue_event_response = (bool) get_parameter('dialogue_event_response');
|
||||||
$perform_event_response = (bool) get_parameter('perform_event_response');
|
$perform_event_response = (bool) get_parameter('perform_event_response');
|
||||||
$get_response = (bool) get_parameter('get_response');
|
$get_response = (bool) get_parameter('get_response');
|
||||||
$get_response_target = (bool) get_parameter('get_response_target');
|
$get_response_massive = (bool) get_parameter('get_response_massive');
|
||||||
$get_response_params = (bool) get_parameter('get_response_params');
|
$get_row_response_action = (bool) get_parameter('get_row_response_action');
|
||||||
$get_response_description = (bool) get_parameter('get_response_description');
|
$draw_row_response_info = (bool) get_parameter('draw_row_response_info', false);
|
||||||
$meta = get_parameter('meta', 0);
|
$meta = get_parameter('meta', 0);
|
||||||
$history = get_parameter('history', 0);
|
$history = get_parameter('history', 0);
|
||||||
$table_events = get_parameter('table_events', 0);
|
$table_events = get_parameter('table_events', 0);
|
||||||
@ -373,8 +373,8 @@ if ($save_event_filter) {
|
|||||||
$values['custom_data'] = get_parameter('custom_data');
|
$values['custom_data'] = get_parameter('custom_data');
|
||||||
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
|
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() === true) {
|
||||||
$values['server_id'] = get_parameter('server_id');
|
$values['server_id'] = implode(',', get_parameter('server_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$exists = (bool) db_get_value_filter(
|
$exists = (bool) db_get_value_filter(
|
||||||
@ -432,7 +432,7 @@ if ($update_event_filter) {
|
|||||||
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
|
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
$values['server_id'] = get_parameter('server_id');
|
$values['server_id'] = implode(',', get_parameter('server_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (io_safe_output($values['tag_with']) == '["0"]') {
|
if (io_safe_output($values['tag_with']) == '["0"]') {
|
||||||
@ -1061,87 +1061,6 @@ $(document).ready(function (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($get_response_description) {
|
|
||||||
$response_id = get_parameter('response_id');
|
|
||||||
|
|
||||||
$description = db_get_value('description', 'tevent_response', 'id', $response_id);
|
|
||||||
|
|
||||||
if ($description === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$description = io_safe_output($description);
|
|
||||||
$description = str_replace("\r\n", '<br>', $description);
|
|
||||||
|
|
||||||
echo $description;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_response_params) {
|
|
||||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
|
||||||
echo 'unauthorized';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response_id = get_parameter('response_id');
|
|
||||||
|
|
||||||
$params = db_get_value('params', 'tevent_response', 'id', $response_id);
|
|
||||||
|
|
||||||
if ($params === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(explode(',', $params));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_response_target === true) {
|
|
||||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
|
||||||
echo 'unauthorized';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response_id = (int) get_parameter('response_id');
|
|
||||||
$event_id = (int) get_parameter('event_id');
|
|
||||||
$server_id = (int) get_parameter('server_id');
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node = new Node($server_id);
|
|
||||||
$node->connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
|
||||||
|
|
||||||
if (empty($event_response) === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo events_get_response_target($event_id, $response_id);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
// Unexistent agent.
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node->disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
} finally {
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node->disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_response === true) {
|
if ($get_response === true) {
|
||||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||||
echo 'unauthorized';
|
echo 'unauthorized';
|
||||||
@ -1149,8 +1068,27 @@ if ($get_response === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response_id = get_parameter('response_id');
|
$response_id = get_parameter('response_id');
|
||||||
$server_id = (int) get_parameter('server_id');
|
$server_id = (int) get_parameter('server_id', 0);
|
||||||
|
$event_id = (int) get_parameter('event_id', 0);
|
||||||
|
$response_parameters = json_decode(
|
||||||
|
io_safe_output(
|
||||||
|
get_parameter('response_parameters', '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$event_response = db_get_row(
|
||||||
|
'tevent_response',
|
||||||
|
'id',
|
||||||
|
$response_id
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($event_response) === true) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($event_id) === false) {
|
||||||
try {
|
try {
|
||||||
if (is_metaconsole() === true
|
if (is_metaconsole() === true
|
||||||
&& $server_id > 0
|
&& $server_id > 0
|
||||||
@ -1159,10 +1097,12 @@ if ($get_response === true) {
|
|||||||
$node->connect();
|
$node->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event_response = db_get_row(
|
$event_response['target'] = events_get_response_target(
|
||||||
'tevent_response',
|
$event_id,
|
||||||
'id',
|
$event_response,
|
||||||
$response_id
|
$response_parameters,
|
||||||
|
$server_id,
|
||||||
|
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Unexistent agent.
|
// Unexistent agent.
|
||||||
@ -1180,9 +1120,6 @@ if ($get_response === true) {
|
|||||||
$node->disconnect();
|
$node->disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($event_response) === true) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($event_response);
|
echo json_encode($event_response);
|
||||||
@ -1190,11 +1127,102 @@ if ($get_response === true) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($get_response_massive === true) {
|
||||||
|
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||||
|
echo 'unauthorized';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response_id = get_parameter('response_id');
|
||||||
|
|
||||||
|
$event_response = db_get_row(
|
||||||
|
'tevent_response',
|
||||||
|
'id',
|
||||||
|
$response_id
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($event_response) === true) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$events = json_decode(
|
||||||
|
io_safe_output(
|
||||||
|
get_parameter('events', '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$response_parameters = json_decode(
|
||||||
|
io_safe_output(
|
||||||
|
get_parameter('response_parameters', '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$event_response_targets = [];
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
foreach ($events as $server_id => $idEvents) {
|
||||||
|
foreach ($idEvents as $idEvent) {
|
||||||
|
$event_response_targets[$idEvent.'|'.$server_id]['target'] = get_events_get_response_target(
|
||||||
|
$idEvent,
|
||||||
|
$event_response,
|
||||||
|
$server_id,
|
||||||
|
$response_parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($events as $idEvent) {
|
||||||
|
$event_response_targets[$idEvent]['target'] = get_events_get_response_target(
|
||||||
|
$idEvent,
|
||||||
|
$event_response,
|
||||||
|
0,
|
||||||
|
$response_parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'event_response' => $event_response,
|
||||||
|
'event_response_targets' => $event_response_targets,
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($get_row_response_action === true) {
|
||||||
|
$response_id = get_parameter('response_id');
|
||||||
|
$response = json_decode(
|
||||||
|
io_safe_output(
|
||||||
|
get_parameter('response', '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$end = (bool) get_parameter('end', false);
|
||||||
|
$index = $response['event_id'];
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$index .= '-'.$response['server_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo get_row_response_action(
|
||||||
|
$response,
|
||||||
|
$response_id,
|
||||||
|
$end,
|
||||||
|
$index
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($perform_event_response === true) {
|
if ($perform_event_response === true) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||||
echo 'unauthorized';
|
echo __('unauthorized');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1202,52 +1230,20 @@ if ($perform_event_response === true) {
|
|||||||
$response_id = get_parameter('response_id');
|
$response_id = get_parameter('response_id');
|
||||||
$event_id = (int) get_parameter('event_id');
|
$event_id = (int) get_parameter('event_id');
|
||||||
$server_id = (int) get_parameter('server_id', 0);
|
$server_id = (int) get_parameter('server_id', 0);
|
||||||
|
$response = json_decode(
|
||||||
$event_response = false;
|
io_safe_output(
|
||||||
if (empty($target) === true) {
|
get_parameter('response', '')
|
||||||
try {
|
),
|
||||||
if (is_metaconsole() === true
|
true
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node = new Node($server_id);
|
|
||||||
$node->connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_response = db_get_row(
|
|
||||||
'tevent_response',
|
|
||||||
'id',
|
|
||||||
$response_id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$event_response = $response;
|
||||||
if (empty($event_response) === true) {
|
if (empty($event_response) === true) {
|
||||||
|
echo __('No data');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$command = events_get_response_target(
|
$command = $event_response['target'];
|
||||||
$event_id,
|
|
||||||
$response_id,
|
|
||||||
$server_id
|
|
||||||
);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
// Unexistent agent.
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node->disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
} finally {
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $server_id > 0
|
|
||||||
) {
|
|
||||||
$node->disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$command = $target;
|
|
||||||
}
|
|
||||||
|
|
||||||
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
|
$command_timeout = ($event_response !== false) ? $event_response['command_timeout'] : 90;
|
||||||
if (enterprise_installed() === true) {
|
if (enterprise_installed() === true) {
|
||||||
if ($event_response !== false
|
if ($event_response !== false
|
||||||
@ -1350,78 +1346,19 @@ if ($dialogue_event_response) {
|
|||||||
$event_id = get_parameter('event_id');
|
$event_id = get_parameter('event_id');
|
||||||
$response_id = get_parameter('response_id');
|
$response_id = get_parameter('response_id');
|
||||||
$command = get_parameter('target');
|
$command = get_parameter('target');
|
||||||
$massive = get_parameter('massive');
|
$event_response = json_decode(
|
||||||
$end = get_parameter('end');
|
io_safe_output(
|
||||||
$show_execute_again_btn = get_parameter('show_execute_again_btn');
|
get_parameter('response', '')
|
||||||
$out_iterator = get_parameter('out_iterator');
|
),
|
||||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
true
|
||||||
$server_id = get_parameter('server_id');
|
);
|
||||||
|
|
||||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
|
||||||
|
|
||||||
$prompt = '<br>> ';
|
|
||||||
switch ($event_response['type']) {
|
switch ($event_response['type']) {
|
||||||
case 'command':
|
case 'command':
|
||||||
$display_command = (bool) $event_response['display_command'];
|
echo get_row_response_action(
|
||||||
$command_str = ($display_command === true) ? $command : '';
|
$event_response,
|
||||||
|
$response_id
|
||||||
if ($massive) {
|
|
||||||
echo "<div class='left'>";
|
|
||||||
echo $prompt.sprintf(
|
|
||||||
'(Event #'.$event_id.') '.__(
|
|
||||||
'Executing command: %s',
|
|
||||||
$command_str
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
echo '</div><br>';
|
|
||||||
|
|
||||||
echo "<div id='response_loading_command_".$out_iterator."' style='display: none'>";
|
|
||||||
echo html_print_image(
|
|
||||||
'images/spinner.gif',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
echo '</div><br>';
|
|
||||||
echo "<br><div id='response_out_".$out_iterator."'><br><br></div><br>";
|
|
||||||
|
|
||||||
if ($end) {
|
|
||||||
echo "<br><div id='re_exec_command_".$out_iterator."' style='display: none'><br>";
|
|
||||||
html_print_button(
|
|
||||||
__('Execute again'),
|
|
||||||
'btn_str',
|
|
||||||
false,
|
|
||||||
'execute_event_response(false);',
|
|
||||||
"class='sub next'"
|
|
||||||
);
|
|
||||||
echo "<span id='execute_again_loading' style='display: none'>";
|
|
||||||
echo html_print_image(
|
|
||||||
'images/spinner.gif',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
echo '</span>';
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "<div class='left'>";
|
|
||||||
|
|
||||||
echo $prompt.'Executing command: '.$command_str;
|
|
||||||
echo '</div><br>';
|
|
||||||
|
|
||||||
echo "<div id='response_loading_command' style='display:none'>";
|
|
||||||
echo html_print_image('images/spinner.gif', true);
|
|
||||||
echo '</div>';
|
|
||||||
echo "<br><br><br><div id='response_out' class='left'></div>";
|
|
||||||
|
|
||||||
echo "<br><div id='re_exec_command' style='display:none'><br><br>";
|
|
||||||
html_print_button(
|
|
||||||
__('Execute again'),
|
|
||||||
'btn_str',
|
|
||||||
false,
|
|
||||||
"perform_response({'target':'".$command."','event_id':".$event_id.",'server_id':".$server_id.'}, '.$response_id.');',
|
|
||||||
"class='sub next'"
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
@ -2542,3 +2479,75 @@ if ($get_events_fired) {
|
|||||||
echo io_json_mb_encode($return);
|
echo io_json_mb_encode($return);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($draw_row_response_info === true) {
|
||||||
|
$event_response = json_decode(
|
||||||
|
io_safe_output(
|
||||||
|
get_parameter('response', '')
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$massive = (bool) get_parameter('massive', false);
|
||||||
|
|
||||||
|
$output .= '';
|
||||||
|
if ($massive === true) {
|
||||||
|
$output .= '<div>';
|
||||||
|
$output .= '<h5>';
|
||||||
|
$output .= $event_response['description'];
|
||||||
|
$output .= '</h5>';
|
||||||
|
$output .= '</div>';
|
||||||
|
} else {
|
||||||
|
$output .= '<tr class="params_rows">';
|
||||||
|
$output .= '<td>';
|
||||||
|
$output .= __('Description');
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '<td class="height_30px" colspan="2">';
|
||||||
|
$output .= $event_response['description'];
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($event_response['params']) === false) {
|
||||||
|
$response_params = explode(',', $event_response['params']);
|
||||||
|
if (is_array($response_params) === true) {
|
||||||
|
if ($massive === true) {
|
||||||
|
$output .= '<div>';
|
||||||
|
} else {
|
||||||
|
$output .= '<tr class="params_rows">';
|
||||||
|
$output .= '<td class="left pdd_l_20px height_30px" colspan="3">';
|
||||||
|
$output .= __('Parameters');
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($response_params as $param) {
|
||||||
|
$param = trim(io_safe_output($param));
|
||||||
|
if ($massive === true) {
|
||||||
|
$output .= '<div>';
|
||||||
|
$output .= '<label>';
|
||||||
|
$output .= $param;
|
||||||
|
$output .= '</label>';
|
||||||
|
$output .= '<input type="text" name="values_params_'.$param.'" />';
|
||||||
|
$output .= '</div>';
|
||||||
|
} else {
|
||||||
|
$output .= '<tr class="params_rows">';
|
||||||
|
$output .= '<td style="text-align:left; padding-left:40px; font-weight: normal; font-style: italic;">';
|
||||||
|
$output .= $param;
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '<td style="text-align:left" colspan="2">';
|
||||||
|
$output .= '<input type="text" name="values_params_'.$param.'" />';
|
||||||
|
$output .= '</td>';
|
||||||
|
$output .= '</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($massive === true) {
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $output;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -1916,12 +1916,21 @@ class AgentWizard extends HTML
|
|||||||
$values['configuration_data'] = io_safe_input($cfData);
|
$values['configuration_data'] = io_safe_input($cfData);
|
||||||
} else {
|
} else {
|
||||||
$values['id_module'] = MODULE_PLUGIN;
|
$values['id_module'] = MODULE_PLUGIN;
|
||||||
|
if ((int) $infoMacros['server_plugin'] === 12) {
|
||||||
|
// Search plugin by execute.
|
||||||
|
$plugin_wmi = db_get_row_sql(
|
||||||
|
'SELECT id, macros FROM tplugin WHERE execute like "%wizard_wmi_module%"'
|
||||||
|
);
|
||||||
|
$fieldsPlugin = $plugin_wmi['macros'];
|
||||||
|
$infoMacros['server_plugin'] = $plugin_wmi['id'];
|
||||||
|
} else {
|
||||||
$fieldsPlugin = db_get_value_sql(
|
$fieldsPlugin = db_get_value_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT macros FROM tplugin WHERE id=%d',
|
'SELECT macros FROM tplugin WHERE id=%d',
|
||||||
(int) $infoMacros['server_plugin']
|
(int) $infoMacros['server_plugin']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($fieldsPlugin !== false) {
|
if ($fieldsPlugin !== false) {
|
||||||
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
||||||
@ -2360,12 +2369,21 @@ class AgentWizard extends HTML
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$tmp->id_modulo(MODULE_PLUGIN);
|
$tmp->id_modulo(MODULE_PLUGIN);
|
||||||
|
if ((int) $infoMacros['server_plugin'] === 12) {
|
||||||
|
// Search plugin by execute.
|
||||||
|
$plugin_wmi = db_get_row_sql(
|
||||||
|
'SELECT id, macros FROM tplugin WHERE execute like "%wizard_wmi_module%"'
|
||||||
|
);
|
||||||
|
$fieldsPlugin = $plugin_wmi['macros'];
|
||||||
|
$infoMacros['server_plugin'] = $plugin_wmi['id'];
|
||||||
|
} else {
|
||||||
$fieldsPlugin = db_get_value_sql(
|
$fieldsPlugin = db_get_value_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT macros FROM tplugin WHERE id=%d',
|
'SELECT macros FROM tplugin WHERE id=%d',
|
||||||
(int) $infoMacros['server_plugin']
|
(int) $infoMacros['server_plugin']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($fieldsPlugin !== false) {
|
if ($fieldsPlugin !== false) {
|
||||||
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
$fieldsPlugin = json_decode($fieldsPlugin, true);
|
||||||
|
@ -44,7 +44,7 @@ class AuditLog extends HTML
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $AJAXMethods = [ 'draw' ];
|
public $AJAXMethods = ['draw'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajax page.
|
* Ajax page.
|
||||||
@ -78,7 +78,6 @@ class AuditLog extends HTML
|
|||||||
|
|
||||||
// Set the ajax controller.
|
// Set the ajax controller.
|
||||||
$this->ajaxController = $ajaxController;
|
$this->ajaxController = $ajaxController;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,7 +231,6 @@ class AuditLog extends HTML
|
|||||||
|
|
||||||
// Load own javascript file.
|
// Load own javascript file.
|
||||||
echo $this->loadJS();
|
echo $this->loadJS();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -369,7 +367,7 @@ class AuditLog extends HTML
|
|||||||
// Javascript content.
|
// Javascript content.
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function format ( d ) {
|
function format(d) {
|
||||||
var output = '';
|
var output = '';
|
||||||
|
|
||||||
if (d.extendedInfo === '') {
|
if (d.extendedInfo === '') {
|
||||||
@ -383,23 +381,22 @@ class AuditLog extends HTML
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Add event listener for opening and closing details
|
// Add event listener for opening and closing details
|
||||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
|
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
|
||||||
var tr = $(this).closest('tr');
|
var tr = $(this).closest('tr');
|
||||||
var table = <?php echo 'dt_'.$this->tableId; ?>;
|
var table = $("#<?php echo $this->tableId; ?>").DataTable();
|
||||||
var row = table.row( tr );
|
var row = table.row(tr);
|
||||||
|
|
||||||
if ( row.child.isShown() ) {
|
if (row.child.isShown()) {
|
||||||
// This row is already open - close it
|
// This row is already open - close it
|
||||||
row.child.hide();
|
row.child.hide();
|
||||||
tr.removeClass('shown');
|
tr.removeClass('shown');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Open this row
|
// Open this row
|
||||||
row.child( format(row.data()) ).show();
|
row.child(format(row.data())).show();
|
||||||
tr.addClass('shown');
|
tr.addClass('shown');
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
} );
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
// EOF Javascript content.
|
// EOF Javascript content.
|
||||||
|
@ -594,6 +594,7 @@ class CustomNetScan extends Wizard
|
|||||||
$("#text-interval_text").val(10);
|
$("#text-interval_text").val(10);
|
||||||
$("#hidden-interval").val('.$interval.');
|
$("#hidden-interval").val('.$interval.');
|
||||||
$("#interval_units").val('.$unit.');
|
$("#interval_units").val('.$unit.');
|
||||||
|
$("#interval_units").trigger("change");
|
||||||
}
|
}
|
||||||
}).change();
|
}).change();
|
||||||
';
|
';
|
||||||
|
@ -2102,13 +2102,12 @@ class NetworkMap
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->relations) {
|
|
||||||
// Search for relations.
|
// Search for relations.
|
||||||
foreach ($this->nodes as $k => $item) {
|
foreach ($this->nodes as $k => $item) {
|
||||||
$target = $this->calculateRelations($k);
|
$target = $this->calculateRelations($k);
|
||||||
|
|
||||||
// Adopt all orphan nodes but pandora one.
|
// Adopt all orphan nodes but pandora one.
|
||||||
if (empty($target)) {
|
if (empty($target) === true) {
|
||||||
if (isset($this->noPandoraNode) === false
|
if (isset($this->noPandoraNode) === false
|
||||||
|| $this->noPandoraNode == false
|
|| $this->noPandoraNode == false
|
||||||
) {
|
) {
|
||||||
@ -2130,11 +2129,64 @@ class NetworkMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$edges = $this->relations;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($edges)) {
|
if (is_array($edges)) {
|
||||||
|
$array_aux = $edges;
|
||||||
|
$target_aux = $edges;
|
||||||
|
foreach ($edges as $key => $rel) {
|
||||||
|
foreach ($array_aux as $key2 => $rel2) {
|
||||||
|
if ($key2 <= $key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['child_type'] == 1 && $rel['parent_type'] == 1
|
||||||
|
&& $rel2['child_type'] == 1 && $rel2['parent_type'] == 1
|
||||||
|
) {
|
||||||
|
if ($rel['id_parent'] == $rel2['id_parent'] && $rel['id_child'] == $rel2['id_child']) {
|
||||||
|
if ($rel['id_parent_source_data'] == $rel2['id_parent_source_data']) {
|
||||||
|
if (modules_get_agentmodule_type($rel['id_child_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if (modules_get_agentmodule_type($rel2['id_child_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
} else if ($rel['id_child_source_data'] == $rel2['id_child_source_data']) {
|
||||||
|
if (modules_get_agentmodule_type($rel['id_parent_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if (modules_get_agentmodule_type($rel2['id_parent_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($rel['id_parent'] == $rel2['id_child'] && $rel['id_child'] == $rel2['id_parent']) {
|
||||||
|
if ($rel['id_parent_source_data'] == $rel2['id_child_source_data']
|
||||||
|
&& $rel['id_child_source_data'] == $rel2['id_parent_source_data']
|
||||||
|
) {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rel['id_parent_source_data'] == $rel2['id_child_source_data']) {
|
||||||
|
if (modules_get_agentmodule_type($rel['id_child_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if (modules_get_agentmodule_type($rel2['id_parent_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
} else if ($rel['id_child_source_data'] == $rel2['id_parent_source_data']) {
|
||||||
|
if (modules_get_agentmodule_type($rel['id_parent_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key]);
|
||||||
|
} else if (modules_get_agentmodule_type($rel2['id_child_source_data']) === 6) {
|
||||||
|
unset($target_aux[$key2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$edges = [];
|
||||||
|
foreach ($target_aux as $key => $value) {
|
||||||
|
$edges[] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($edges as $rel) {
|
foreach ($edges as $rel) {
|
||||||
$graph .= $this->createDotEdge(
|
$graph .= $this->createDotEdge(
|
||||||
[
|
[
|
||||||
@ -2628,6 +2680,79 @@ class NetworkMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerates a nodes - relationships array using graphviz dot
|
||||||
|
* schema and stores nodes&relations into $this->graph.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function recalculateCoords()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
include_once 'include/functions_os.php';
|
||||||
|
|
||||||
|
$map_filter = $this->mapOptions['map_filter'];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let graphviz place the nodes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($map_filter['empty_map']) {
|
||||||
|
$this->generateEmptyDotGraph();
|
||||||
|
} else if (!isset($this->dotGraph)) {
|
||||||
|
$this->generateDotGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
$graph = $this->calculateCoords();
|
||||||
|
|
||||||
|
if (is_array($graph) === true) {
|
||||||
|
$nodes = $graph['nodes'];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$nodes_aux = [];
|
||||||
|
|
||||||
|
// Prepare graph nodes.
|
||||||
|
foreach ($nodes as $id => $coords) {
|
||||||
|
$node_tmp['id'] = $id;
|
||||||
|
|
||||||
|
$source = $this->getNodeData($id);
|
||||||
|
|
||||||
|
$node_tmp['type'] = $source['node_type'];
|
||||||
|
$node_tmp['x'] = $coords['x'];
|
||||||
|
$node_tmp['y'] = $coords['y'];
|
||||||
|
|
||||||
|
switch ($node_tmp['type']) {
|
||||||
|
case NODE_AGENT:
|
||||||
|
$node_tmp['source_data'] = $source['id_agente'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NODE_MODULE:
|
||||||
|
$node_tmp['source_data'] = $source['id_agente_modulo'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NODE_PANDORA:
|
||||||
|
$node_tmp['source_data'] = 0;
|
||||||
|
$node_center['x'] = ($coords['x'] - MAP_X_CORRECTION);
|
||||||
|
$node_center['y'] = ($coords['y'] - MAP_Y_CORRECTION);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NODE_GENERIC:
|
||||||
|
default:
|
||||||
|
$node_tmp['source_data'] = $source['id_source'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nodes_aux[$index] = $node_tmp;
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nodes_aux;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform node information into JS data.
|
* Transform node information into JS data.
|
||||||
*
|
*
|
||||||
@ -2799,7 +2924,6 @@ class NetworkMap
|
|||||||
$output .= "var add_node_menu = '".__('Add node')."';\n";
|
$output .= "var add_node_menu = '".__('Add node')."';\n";
|
||||||
$output .= "var set_center_menu = '".__('Set center')."';\n";
|
$output .= "var set_center_menu = '".__('Set center')."';\n";
|
||||||
$output .= "var refresh_menu = '".__('Refresh')."';\n";
|
$output .= "var refresh_menu = '".__('Refresh')."';\n";
|
||||||
$output .= "var refresh_holding_area_menu = '".__('Refresh Holding area')."';\n";
|
|
||||||
$output .= "var ok_button = '".__('Proceed')."';\n";
|
$output .= "var ok_button = '".__('Proceed')."';\n";
|
||||||
$output .= "var message_to_confirm = '".__('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.')."';\n";
|
$output .= "var message_to_confirm = '".__('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.')."';\n";
|
||||||
$output .= "var warning_message = '".__('WARNING')."';\n";
|
$output .= "var warning_message = '".__('WARNING')."';\n";
|
||||||
@ -3066,8 +3190,8 @@ class NetworkMap
|
|||||||
$table->data['template_row']['node_target'] = '';
|
$table->data['template_row']['node_target'] = '';
|
||||||
$table->data['template_row']['edit'] = '';
|
$table->data['template_row']['edit'] = '';
|
||||||
|
|
||||||
$table->data['template_row']['edit'] .= '<span class="edit_icon_correct" style="display: none">'.html_print_image('images/dot_green.png', true).'</span><span class="edit_icon_fail" style="display: none" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress" style="display: none">'.html_print_image('images/spinner.gif', true).'</span><span class="edit_icon"><a class="edit_icon_link" title="'.__('Update').'" href="#">'.html_print_image('images/config.png', true, ['class' => 'invert_filter']).'</a></span>';
|
$table->data['template_row']['edit'] .= '<span class="edit_icon_correct" style="display: none">'.html_print_image('images/dot_green.png', true).'</span><span class="edit_icon_fail" style="display: none" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress" style="display: none">'.html_print_image('images/spinner.gif', true).'</span>';
|
||||||
|
// <span class="edit_icon"><a class="edit_icon_link" title="'.__('Update').'" href="#">'.html_print_image('images/config.png', true, ['class' => 'invert_filter']).'</a></span>';
|
||||||
$table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.png', true, ['class' => 'invert_filter']).'</a>';
|
$table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.png', true, ['class' => 'invert_filter']).'</a>';
|
||||||
|
|
||||||
$table->colspan['no_relations']['0'] = 5;
|
$table->colspan['no_relations']['0'] = 5;
|
||||||
@ -3278,7 +3402,7 @@ class NetworkMap
|
|||||||
$table->data[1][1] = html_print_select(
|
$table->data[1][1] = html_print_select(
|
||||||
$list_networkmaps,
|
$list_networkmaps,
|
||||||
'networkmap_to_link',
|
'networkmap_to_link',
|
||||||
'',
|
0,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
@ -3318,6 +3442,10 @@ class NetworkMap
|
|||||||
*/
|
*/
|
||||||
public function loadController(?bool $return=true)
|
public function loadController(?bool $return=true)
|
||||||
{
|
{
|
||||||
|
if (isset($this->mapOptions['refresh_time']) === false) {
|
||||||
|
$this->mapOptions['refresh_time'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if ($this->useTooltipster
|
if ($this->useTooltipster
|
||||||
@ -3359,6 +3487,7 @@ class NetworkMap
|
|||||||
node_radius: node_radius,
|
node_radius: node_radius,
|
||||||
holding_area_dimensions: networkmap_holding_area_dimensions,
|
holding_area_dimensions: networkmap_holding_area_dimensions,
|
||||||
url_background_grid: url_background_grid,
|
url_background_grid: url_background_grid,
|
||||||
|
refresh_time: '.$this->mapOptions['refresh_time'].',
|
||||||
font_size: '.$this->mapOptions['font_size'].',
|
font_size: '.$this->mapOptions['font_size'].',
|
||||||
base_url_homedir: "'.ui_get_full_url(false).'"
|
base_url_homedir: "'.ui_get_full_url(false).'"
|
||||||
});
|
});
|
||||||
@ -3366,6 +3495,26 @@ class NetworkMap
|
|||||||
init_minimap();
|
init_minimap();
|
||||||
function_open_minimap();
|
function_open_minimap();
|
||||||
|
|
||||||
|
if ('.$this->mapOptions['refresh_time'].' > 0) {
|
||||||
|
var startCountDown = function (duration, cb) {
|
||||||
|
$("div.vc-countdown").countdown("destroy");
|
||||||
|
if (!duration) return;
|
||||||
|
var t = new Date();
|
||||||
|
t.setTime(t.getTime() + duration * 1000);
|
||||||
|
$("div.vc-countdown").countdown({
|
||||||
|
until: t,
|
||||||
|
format: "MS",
|
||||||
|
layout: "(%M%nn%M:%S%nn%S '.__('Until refresh').') ",
|
||||||
|
alwaysExpire: true,
|
||||||
|
onExpiry: function () {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
startCountDown('.($this->mapOptions['refresh_time']).', false);
|
||||||
|
}
|
||||||
|
|
||||||
$(document.body).on("mouseleave",
|
$(document.body).on("mouseleave",
|
||||||
".context-menu-list",
|
".context-menu-list",
|
||||||
function(e) {
|
function(e) {
|
||||||
@ -3504,6 +3653,10 @@ class NetworkMap
|
|||||||
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
|
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output .= '<div id="spinner_networkmap" style="position: absolute; width: 100%;height: 100%; z-index:1; justify-content: center; align-items: center; display:none; background-color:rgba(0, 0, 0, 0.2);">';
|
||||||
|
$output .= html_print_image('/images/spinner.gif', true, ['style' => 'width: 22px; height: 22px']);
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
$output .= '<div style="display: '.$minimap_display.';">';
|
$output .= '<div style="display: '.$minimap_display.';">';
|
||||||
$output .= '<canvas id="minimap_'.$networkmap['id'].'"';
|
$output .= '<canvas id="minimap_'.$networkmap['id'].'"';
|
||||||
$output .= ' class="minimap">';
|
$output .= ' class="minimap">';
|
||||||
|
@ -56,6 +56,7 @@ class SatelliteAgent extends HTML
|
|||||||
'draw',
|
'draw',
|
||||||
'addAgent',
|
'addAgent',
|
||||||
'deleteAgent',
|
'deleteAgent',
|
||||||
|
'disableAgent',
|
||||||
'loadModal',
|
'loadModal',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -97,7 +98,6 @@ class SatelliteAgent extends HTML
|
|||||||
$this->satellite_name = servers_get_name($this->satellite_server);
|
$this->satellite_name = servers_get_name($this->satellite_server);
|
||||||
$this->satellite_config = (array) config_satellite_get_config_file($this->satellite_name);
|
$this->satellite_config = (array) config_satellite_get_config_file($this->satellite_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -108,27 +108,53 @@ class SatelliteAgent extends HTML
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
|
global $config;
|
||||||
// Javascript.
|
// Javascript.
|
||||||
ui_require_jquery_file('pandora');
|
ui_require_jquery_file('pandora');
|
||||||
// CSS.
|
// CSS.
|
||||||
ui_require_css_file('wizard');
|
ui_require_css_file('wizard');
|
||||||
ui_require_css_file('discovery');
|
ui_require_css_file('discovery');
|
||||||
|
|
||||||
global $config;
|
$this->createBlock();
|
||||||
|
|
||||||
// Datatables list.
|
// Datatables list.
|
||||||
try {
|
try {
|
||||||
|
$checkbox_all = html_print_checkbox(
|
||||||
|
'all_validate_box',
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$columns = [
|
$columns = [
|
||||||
|
[
|
||||||
|
'text' => 'm',
|
||||||
|
'extra' => $checkbox_all,
|
||||||
|
'class' => 'mw60px',
|
||||||
|
],
|
||||||
'name',
|
'name',
|
||||||
'address',
|
'address',
|
||||||
'actions',
|
'actions',
|
||||||
];
|
];
|
||||||
|
|
||||||
$column_names = [
|
$column_names = [
|
||||||
|
[
|
||||||
|
'text' => 'm',
|
||||||
|
'extra' => $checkbox_all,
|
||||||
|
'class' => 'w20px no-text-imp',
|
||||||
|
],
|
||||||
__('Agent Name'),
|
__('Agent Name'),
|
||||||
__('IP Adrress'),
|
__('IP Adrress'),
|
||||||
__('Actions'),
|
__('Actions'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$show_agents = [
|
||||||
|
0 => __('Everyone'),
|
||||||
|
1 => __('Only disabled'),
|
||||||
|
2 => __('Only deleted'),
|
||||||
|
3 => __('Only added'),
|
||||||
|
];
|
||||||
|
|
||||||
$this->tableId = 'satellite_agents';
|
$this->tableId = 'satellite_agents';
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
@ -154,6 +180,7 @@ class SatelliteAgent extends HTML
|
|||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
3,
|
||||||
],
|
],
|
||||||
'search_button_class' => 'sub filter float-right',
|
'search_button_class' => 'sub filter float-right',
|
||||||
'form' => [
|
'form' => [
|
||||||
@ -167,7 +194,15 @@ class SatelliteAgent extends HTML
|
|||||||
'name' => 'filter_search',
|
'name' => 'filter_search',
|
||||||
'size' => 12,
|
'size' => 12,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'label' => __('Show agents'),
|
||||||
|
'type' => 'select',
|
||||||
|
'id' => 'filter_agents',
|
||||||
|
'name' => 'filter_agents',
|
||||||
|
'fields' => $show_agents,
|
||||||
|
'return' => true,
|
||||||
|
'selected' => 0,
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
@ -188,6 +223,33 @@ class SatelliteAgent extends HTML
|
|||||||
|
|
||||||
echo $modal.$msg.$aux;
|
echo $modal.$msg.$aux;
|
||||||
|
|
||||||
|
echo '<div id="satellite_actions" class="action-buttons" style="width: 100%">';
|
||||||
|
|
||||||
|
html_print_select(
|
||||||
|
[
|
||||||
|
'0' => 'Disable / Enable selected agents',
|
||||||
|
'1' => 'Delete / Create selected agents',
|
||||||
|
],
|
||||||
|
'satellite_action',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Execute action'),
|
||||||
|
'submit_satellite_action',
|
||||||
|
false,
|
||||||
|
'class="sub next"'
|
||||||
|
);
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
echo '</br></br>';
|
||||||
|
|
||||||
// Create button.
|
// Create button.
|
||||||
echo '<div class="w100p flex-content-right">';
|
echo '<div class="w100p flex-content-right">';
|
||||||
html_print_submit_button(
|
html_print_submit_button(
|
||||||
@ -200,7 +262,6 @@ class SatelliteAgent extends HTML
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
// Load own javascript file.
|
// Load own javascript file.
|
||||||
echo $this->loadJS();
|
echo $this->loadJS();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,8 +273,7 @@ class SatelliteAgent extends HTML
|
|||||||
public function draw()
|
public function draw()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
// Initialice filter.
|
|
||||||
$filter = '1=1';
|
|
||||||
// Init data.
|
// Init data.
|
||||||
$data = [];
|
$data = [];
|
||||||
// Count of total records.
|
// Count of total records.
|
||||||
@ -228,8 +288,24 @@ class SatelliteAgent extends HTML
|
|||||||
ob_start();
|
ob_start();
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
$agents_db = db_get_all_rows_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente, alias AS name, direccion AS address,
|
||||||
|
IF(disabled = 0, INSERT("add_host", 0 , 0, ""),
|
||||||
|
IF(modo = 1, INSERT("ignore_host", 0 , 0, ""), INSERT("delete_host", 0, 0, ""))) AS type
|
||||||
|
FROM tagente WHERE `satellite_server` = %d',
|
||||||
|
$this->satellite_server
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($agents_db) === false) {
|
||||||
|
$data = $agents_db;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->satellite_config as $line) {
|
foreach ($this->satellite_config as $line) {
|
||||||
$re = '/^#*add_host \b(\S+) (\S*)$/m';
|
$re = '/^#*add_host \b(\S+) (\S*)/m';
|
||||||
|
$re_disable = '/^ignore_host \b(\S+)/m';
|
||||||
|
$re_delete = '/^delete_host \b(\S+)/m';
|
||||||
|
|
||||||
if (preg_match($re, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
|
if (preg_match($re, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
|
||||||
$agent['address'] = $matches[1][0];
|
$agent['address'] = $matches[1][0];
|
||||||
@ -239,17 +315,64 @@ class SatelliteAgent extends HTML
|
|||||||
$agent['name'] = $matches[2][0];
|
$agent['name'] = $matches[2][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($filters['filter_search']) === false) {
|
$agent['type'] = 'add_host';
|
||||||
if (empty(preg_grep('/'.$filters['filter_search'].'?/mi', array_values($agent))) === true) {
|
|
||||||
continue;
|
array_push($data, $agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (preg_match($re_disable, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
|
||||||
|
$agent['name'] = $matches[1][0];
|
||||||
|
|
||||||
|
$agent['type'] = 'ignore_host';
|
||||||
|
|
||||||
|
array_push($data, $agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (preg_match($re_delete, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
|
||||||
|
$agent['name'] = $matches[1][0];
|
||||||
|
|
||||||
|
$agent['type'] = 'delete_host';
|
||||||
|
|
||||||
array_push($data, $agent);
|
array_push($data, $agent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($data) === false) {
|
if (empty($data) === false) {
|
||||||
|
$data = $this->uniqueMultidimArray($data, ['name', 'address']);
|
||||||
|
if (empty($filters['filter_agents']) === false || empty($filters['filter_search']) === false) {
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
switch ($filters['filter_agents']) {
|
||||||
|
case 1:
|
||||||
|
if ($value['type'] !== 'ignore_host') {
|
||||||
|
unset($data[$key]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if ($value['type'] !== 'delete_host') {
|
||||||
|
unset($data[$key]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
if ($value['type'] !== 'add_host') {
|
||||||
|
unset($data[$key]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Everyone.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($filters['filter_search']) === false) {
|
||||||
|
if (empty(preg_grep('/'.$filters['filter_search'].'?/mi', array_values($value))) === true) {
|
||||||
|
unset($data[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = array_reduce(
|
$data = array_reduce(
|
||||||
$data,
|
$data,
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
@ -258,15 +381,51 @@ class SatelliteAgent extends HTML
|
|||||||
// of objects, making a post-process of certain fields.
|
// of objects, making a post-process of certain fields.
|
||||||
$tmp = (object) $item;
|
$tmp = (object) $item;
|
||||||
|
|
||||||
|
$disable = ($tmp->type === 'ignore_host');
|
||||||
|
$delete = ($tmp->type === 'delete_host');
|
||||||
|
|
||||||
|
if ($disable === true) {
|
||||||
|
$tmp->name = '<i class="italic_a">'.$tmp->name.'</i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($delete === true) {
|
||||||
|
$tmp->name = '<del>'.$tmp->name.'</del>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_agente = (isset($tmp->id_agente) === true) ? $tmp->id_agente : 0;
|
||||||
|
|
||||||
|
$tmp->actions = '';
|
||||||
|
|
||||||
|
if ($delete === false) {
|
||||||
$tmp->actions .= html_print_image(
|
$tmp->actions .= html_print_image(
|
||||||
'images/cross.png',
|
($disable === true) ? 'images/lightbulb_off.png' : 'images/lightbulb.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'border' => '0',
|
'border' => '0',
|
||||||
'class' => 'action_button_img invert_filter',
|
'class' => 'action_button_img mrgn_lft_05em invert_filter',
|
||||||
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.$tmp->name.'\')',
|
'onclick' => 'disable_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $disable.'\',\''.$id_agente.'\')',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($disable === false) {
|
||||||
|
$tmp->actions .= html_print_image(
|
||||||
|
($delete === true) ? 'images/add.png' : 'images/cross.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'class' => 'action_button_img mrgn_lft_05em invert_filter',
|
||||||
|
'onclick' => 'delete_agent(\''.$tmp->address.'\',\''.strip_tags($tmp->name).'\',\''.(int) $delete.'\',\''.$id_agente.'\')',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp->m = html_print_checkbox(
|
||||||
|
'check_'.strip_tags($tmp->name),
|
||||||
|
$tmp->address.','.strip_tags($tmp->name).','.(int) $delete.','.(int) $disable.','.$id_agente,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$carry[] = $tmp;
|
$carry[] = $tmp;
|
||||||
return $carry;
|
return $carry;
|
||||||
@ -274,8 +433,13 @@ class SatelliteAgent extends HTML
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array_slice($data, $start, $length, true);
|
if (empty($data) === true) {
|
||||||
|
$total = 0;
|
||||||
|
$data = [];
|
||||||
|
} else {
|
||||||
$total = count($data);
|
$total = count($data);
|
||||||
|
$data = array_slice($data, $start, $length, false);
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
@ -333,12 +497,6 @@ class SatelliteAgent extends HTML
|
|||||||
$values = [];
|
$values = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$return_all_group = false;
|
|
||||||
|
|
||||||
if (users_can_manage_group_all('AR') === true) {
|
|
||||||
$return_all_group = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = [
|
$form = [
|
||||||
'action' => '#',
|
'action' => '#',
|
||||||
'id' => 'modal_form',
|
'id' => 'modal_form',
|
||||||
@ -392,6 +550,16 @@ class SatelliteAgent extends HTML
|
|||||||
$values['address'] = get_parameter('address');
|
$values['address'] = get_parameter('address');
|
||||||
$values['name'] = get_parameter('name');
|
$values['name'] = get_parameter('name');
|
||||||
|
|
||||||
|
if ($this->checkAddressExists($values['address']) === true) {
|
||||||
|
$this->ajaxMsg('error', __('Error saving agent. The address already exists'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->checkNameExists($values['name']) === true) {
|
||||||
|
$this->ajaxMsg('error', __('Error saving agent. The Name already exists'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->parseSatelliteConf('save', $values) === false) {
|
if ($this->parseSatelliteConf('save', $values) === false) {
|
||||||
$this->ajaxMsg('error', __('Error saving agent'));
|
$this->ajaxMsg('error', __('Error saving agent'));
|
||||||
} else {
|
} else {
|
||||||
@ -412,11 +580,82 @@ class SatelliteAgent extends HTML
|
|||||||
{
|
{
|
||||||
$values['address'] = get_parameter('address', '');
|
$values['address'] = get_parameter('address', '');
|
||||||
$values['name'] = get_parameter('name', '');
|
$values['name'] = get_parameter('name', '');
|
||||||
|
$values['delete'] = get_parameter('delete', '');
|
||||||
|
$values['id'] = get_parameter('id', 0);
|
||||||
|
|
||||||
|
$no_msg = (bool) get_parameter('no_msg', 0);
|
||||||
|
|
||||||
|
if ((bool) $values['id'] === true) {
|
||||||
|
db_process_sql_update(
|
||||||
|
'tagente',
|
||||||
|
[
|
||||||
|
'disabled' => ($values['delete'] === '0') ? 1 : 0,
|
||||||
|
'modo' => ($values['delete'] === '0') ? 2 : 1,
|
||||||
|
],
|
||||||
|
['id_agente' => (int) $values['id']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->parseSatelliteConf('delete', $values) === false) {
|
if ($this->parseSatelliteConf('delete', $values) === false) {
|
||||||
$this->ajaxMsg('error', __('Error saving agent'));
|
if ($no_msg === false) {
|
||||||
|
$this->ajaxMsg('error', ($values['delete'] === '0') ? __('Error delete agent') : __('Error add agent'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->ajaxMsg('result', _('Host '.$values['addres'].' added.'));
|
if ($no_msg === false) {
|
||||||
|
$this->ajaxMsg(
|
||||||
|
'result',
|
||||||
|
($values['delete'] === '0')
|
||||||
|
? _('Host '.$values['address'].' deleted.')
|
||||||
|
: _('Host '.$values['address'].' added.'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable agent from satellite conf.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function disableAgent()
|
||||||
|
{
|
||||||
|
$values['address'] = get_parameter('address', '');
|
||||||
|
$values['name'] = get_parameter('name', '');
|
||||||
|
$values['disable'] = get_parameter('disable', '');
|
||||||
|
$values['id'] = get_parameter('id', 0);
|
||||||
|
|
||||||
|
$no_msg = (bool) get_parameter('no_msg', 0);
|
||||||
|
|
||||||
|
if ((bool) $values['id'] === true) {
|
||||||
|
db_process_sql_update(
|
||||||
|
'tagente',
|
||||||
|
['disabled' => ($values['disable'] === '0') ? 1 : 0],
|
||||||
|
['id_agente' => (int) $values['id']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->parseSatelliteConf('disable', $values) === false) {
|
||||||
|
if ($no_msg === false) {
|
||||||
|
$this->ajaxMsg(
|
||||||
|
'error',
|
||||||
|
($values['disable'] === '0') ? __('Error disable agent') : __('Error enable agent')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($no_msg === false) {
|
||||||
|
$this->ajaxMsg(
|
||||||
|
'result',
|
||||||
|
($values['disable'] === '0')
|
||||||
|
? _('Host '.$values['address'].' disabled.')
|
||||||
|
: _('Host '.$values['address'].' enabled.'),
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@ -427,18 +666,30 @@ class SatelliteAgent extends HTML
|
|||||||
* Parse satellite configuration .
|
* Parse satellite configuration .
|
||||||
*
|
*
|
||||||
* @param string $action Action to perform (save, delete).
|
* @param string $action Action to perform (save, delete).
|
||||||
* @param array $values.
|
* @param array $values Values.
|
||||||
* @return void
|
*
|
||||||
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function parseSatelliteConf(string $action, array $values)
|
private function parseSatelliteConf(string $action, array $values)
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'save':
|
case 'save':
|
||||||
if (isset($values['address']) === true && empty($values['address']) === false) {
|
if (isset($values['address']) === true && empty($values['address']) === false) {
|
||||||
|
$pos = preg_grep('/^\#INIT ignore_host/', $this->satellite_config);
|
||||||
|
if (empty($pos) === false) {
|
||||||
$string_hosts = 'add_host '.$values['address'].' '.$values['name']."\n";
|
$string_hosts = 'add_host '.$values['address'].' '.$values['name']."\n";
|
||||||
|
|
||||||
// Add host to conf
|
$key_pos = 0;
|
||||||
array_push($this->satellite_config, $string_hosts);
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$array1 = array_slice($this->satellite_config, 0, $key_pos);
|
||||||
|
$array2 = array_slice($this->satellite_config, $key_pos);
|
||||||
|
// Add host to conf.
|
||||||
|
$array_merge = array_merge($array1, [$string_hosts], $array2);
|
||||||
|
$this->satellite_config = $array_merge;
|
||||||
|
|
||||||
// Check config.
|
// Check config.
|
||||||
if (empty($this->satellite_config)) {
|
if (empty($this->satellite_config)) {
|
||||||
@ -446,18 +697,141 @@ class SatelliteAgent extends HTML
|
|||||||
}
|
}
|
||||||
|
|
||||||
$conf = implode('', $this->satellite_config);
|
$conf = implode('', $this->satellite_config);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'disable':
|
||||||
|
if ((bool) $values['disable'] === true) {
|
||||||
|
$pos = preg_grep('/^\#INIT ignore_host/', $this->satellite_config);
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
$string_hosts = 'add_host '.$values['address'].' '.$values['name']."\n";
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$array1 = array_slice($this->satellite_config, 0, $key_pos);
|
||||||
|
$array2 = array_slice($this->satellite_config, $key_pos);
|
||||||
|
// Add host to conf.
|
||||||
|
$array_merge = array_merge($array1, [$string_hosts], $array2);
|
||||||
|
$this->satellite_config = $array_merge;
|
||||||
|
|
||||||
|
// Remove ignore_host.
|
||||||
|
$pattern = io_safe_expreg('ignore_host '.$values['name']);
|
||||||
|
$pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
unset($this->satellite_config[$key_pos]);
|
||||||
|
}
|
||||||
|
|
||||||
$conf = implode('', $this->satellite_config);
|
$conf = implode('', $this->satellite_config);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$pos = preg_grep('/^\#INIT delete_host/', $this->satellite_config);
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
$string_hosts = 'ignore_host '.$values['name']."\n";
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$array1 = array_slice($this->satellite_config, 0, $key_pos);
|
||||||
|
$array2 = array_slice($this->satellite_config, $key_pos);
|
||||||
|
// Add host to conf.
|
||||||
|
$array_merge = array_merge($array1, [$string_hosts], $array2);
|
||||||
|
$this->satellite_config = $array_merge;
|
||||||
|
|
||||||
|
// Remove add_host.
|
||||||
|
$pattern = io_safe_expreg('add_host '.$values['address'].' '.$values['name']);
|
||||||
|
$pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
unset($this->satellite_config[$key_pos]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$conf = implode('', $this->satellite_config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'delete':
|
||||||
|
if ((bool) $values['delete'] === true) {
|
||||||
|
$pos = preg_grep('/^\#INIT ignore_host/', $this->satellite_config);
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
$string_hosts = 'add_host '.$values['address'].' '.$values['name']."\n";
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$array1 = array_slice($this->satellite_config, 0, $key_pos);
|
||||||
|
$array2 = array_slice($this->satellite_config, $key_pos);
|
||||||
|
// Add host to conf.
|
||||||
|
$array_merge = array_merge($array1, [$string_hosts], $array2);
|
||||||
|
$this->satellite_config = $array_merge;
|
||||||
|
|
||||||
|
// Remove delete_host.
|
||||||
|
$pattern = io_safe_expreg('delete_host '.$values['name']);
|
||||||
|
$pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
|
||||||
|
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($this->satellite_config[$key_pos]);
|
||||||
|
|
||||||
|
$conf = implode('', $this->satellite_config);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// Find agent to mark for deletion.
|
// Find agent to mark for deletion.
|
||||||
$pattern = io_safe_expreg($values['address'].' '.$values['name']);
|
$pattern = io_safe_expreg('add_host '.$values['address'].' '.$values['name']);
|
||||||
$re = "/add_host ($pattern)/m";
|
$pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
|
||||||
$subst = 'delete_host $1';
|
|
||||||
$conf = preg_replace($re, $subst, $conf);
|
if (empty($pos) === false) {
|
||||||
|
$key_pos = 0;
|
||||||
|
foreach ($pos as $key => $value) {
|
||||||
|
$key_pos = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($this->satellite_config[$key_pos]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$string_hosts = 'delete_host '.$values['name']."\n";
|
||||||
|
$pos = preg_grep('/delete_host/', $this->satellite_config);
|
||||||
|
if (empty($pos) === false) {
|
||||||
|
$key_pos = array_keys($pos)[(count($pos) - 1)];
|
||||||
|
$array1 = array_slice($this->satellite_config, 0, ($key_pos + 1));
|
||||||
|
$array2 = array_slice($this->satellite_config, ($key_pos + 1));
|
||||||
|
$array_merge = array_merge($array1, [$string_hosts], $array2);
|
||||||
|
$this->satellite_config = $array_merge;
|
||||||
|
}
|
||||||
|
|
||||||
|
$conf = implode('', $this->satellite_config);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -469,11 +843,37 @@ class SatelliteAgent extends HTML
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkAddressExists($address)
|
||||||
|
{
|
||||||
|
$pos_address = preg_grep('/.*_host\s('.$address.')\s.*/', $this->satellite_config);
|
||||||
|
|
||||||
|
if (empty($pos_address) === false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkNameExists($name)
|
||||||
|
{
|
||||||
|
$pos_name = preg_grep('/.*_host.*('.$name.')$/', $this->satellite_config);
|
||||||
|
|
||||||
|
if (empty($pos_name) === false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves agent to satellite cofiguration file.
|
* Saves agent to satellite cofiguration file.
|
||||||
*
|
*
|
||||||
* @param array $values
|
* @param string $new_conf Config file.
|
||||||
* @return void
|
*
|
||||||
|
* @return boolean|void
|
||||||
*/
|
*/
|
||||||
private function saveAgent(string $new_conf)
|
private function saveAgent(string $new_conf)
|
||||||
{
|
{
|
||||||
@ -506,16 +906,40 @@ class SatelliteAgent extends HTML
|
|||||||
$files['md5'] = $config['remote_config'].'/md5/'.md5($this->satellite_name).'.srv.md5';
|
$files['md5'] = $config['remote_config'].'/md5/'.md5($this->satellite_name).'.srv.md5';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save configuration
|
// Save configuration.
|
||||||
$result = file_put_contents($files['conf'], $new_conf);
|
$result = file_put_contents($files['conf'], $new_conf);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save configuration md5
|
// Save configuration md5.
|
||||||
$result = file_put_contents($files['md5'], md5($new_conf));
|
$result = file_put_contents($files['md5'], md5($new_conf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates add_host, ignore_host and delete_host blocks
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function createBlock()
|
||||||
|
{
|
||||||
|
$init = preg_grep('/^\#INIT/', $this->satellite_config);
|
||||||
|
|
||||||
|
if (empty($init) === true) {
|
||||||
|
$add_host = "#INIT add_host\n";
|
||||||
|
$ignore_host = "#INIT ignore_host\n";
|
||||||
|
$delete_host = "#INIT delete_host\n";
|
||||||
|
|
||||||
|
array_push($this->satellite_config, "\n");
|
||||||
|
array_push($this->satellite_config, $add_host);
|
||||||
|
array_push($this->satellite_config, $ignore_host);
|
||||||
|
array_push($this->satellite_config, $delete_host);
|
||||||
|
|
||||||
|
$conf = implode('', $this->satellite_config);
|
||||||
|
$this->saveAgent($conf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -538,27 +962,30 @@ class SatelliteAgent extends HTML
|
|||||||
* @param string $type Type: result || error.
|
* @param string $type Type: result || error.
|
||||||
* @param string $msg Message.
|
* @param string $msg Message.
|
||||||
* @param boolean $delete Deletion messages.
|
* @param boolean $delete Deletion messages.
|
||||||
|
* @param boolean $disable Disable messages.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function ajaxMsg($type, $msg, $delete=false)
|
private function ajaxMsg($type, $msg, $delete=false, $disable=false)
|
||||||
{
|
{
|
||||||
$msg_err = 'Failed while saving: %s';
|
$msg_err = 'Failed while saving: %s';
|
||||||
$msg_ok = 'Successfully saved agent ';
|
$msg_ok = 'Successfully saved agent ';
|
||||||
|
|
||||||
if ($delete) {
|
if ($delete === true) {
|
||||||
$msg_err = 'Failed while removing: %s';
|
$msg_err = 'Failed while removing: %s';
|
||||||
$msg_ok = 'Successfully deleted ';
|
$msg_ok = 'Successfully deleted ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disable === true) {
|
||||||
|
$msg_err = 'Failed while disabling: %s';
|
||||||
|
$msg_ok = 'Successfully disabled';
|
||||||
|
}
|
||||||
|
|
||||||
if ($type == 'error') {
|
if ($type == 'error') {
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
$type => ui_print_error_message(
|
$type => ui_print_error_message(
|
||||||
__(
|
__($msg),
|
||||||
$msg_err,
|
|
||||||
$msg
|
|
||||||
),
|
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
@ -568,10 +995,7 @@ class SatelliteAgent extends HTML
|
|||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
$type => ui_print_success_message(
|
$type => ui_print_success_message(
|
||||||
__(
|
__($msg),
|
||||||
$msg_ok,
|
|
||||||
$msg
|
|
||||||
),
|
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
@ -583,6 +1007,35 @@ class SatelliteAgent extends HTML
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes duplicate values from a multidimensional array
|
||||||
|
*
|
||||||
|
* @param array $array Input array.
|
||||||
|
* @param array $key Keys.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function uniqueMultidimArray($array, $key)
|
||||||
|
{
|
||||||
|
$temp_array = [];
|
||||||
|
$i = 0;
|
||||||
|
$key_array_name = [];
|
||||||
|
$key_array_address = [];
|
||||||
|
|
||||||
|
foreach ($array as $val) {
|
||||||
|
if (!in_array($val[$key[0]], $key_array_name) && !in_array($val[$key[1]], $key_array_address)) {
|
||||||
|
$key_array_name[$i] = $val[$key[0]];
|
||||||
|
$key_array_address[$i] = $val[$key[1]];
|
||||||
|
$temp_array[$i] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $temp_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Javascript code.
|
* Load Javascript code.
|
||||||
*
|
*
|
||||||
@ -707,11 +1160,11 @@ class SatelliteAgent extends HTML
|
|||||||
/**
|
/**
|
||||||
* Delete selected agent
|
* Delete selected agent
|
||||||
*/
|
*/
|
||||||
function delete_agent(address, name) {
|
function delete_agent(address, name, deleted, id_agente) {
|
||||||
$('#aux').empty();
|
$('#aux').empty();
|
||||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||||
$('#aux').dialog({
|
$('#aux').dialog({
|
||||||
title: '<?php echo __('Delete'); ?> ' + address,
|
title: (deleted == 0) ? '<?php echo __('Delete'); ?> '+address : '<?php echo __('Add'); ?>'+address,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||||
@ -723,7 +1176,7 @@ class SatelliteAgent extends HTML
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Delete',
|
text: (deleted == 0) ? 'Delete' : 'Add',
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -734,6 +1187,56 @@ class SatelliteAgent extends HTML
|
|||||||
method: 'deleteAgent',
|
method: 'deleteAgent',
|
||||||
address: address,
|
address: address,
|
||||||
name: name,
|
name: name,
|
||||||
|
id: id_agente,
|
||||||
|
delete: deleted,
|
||||||
|
server_remote: <?php echo $this->satellite_server; ?>,
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
showMsg(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
showMsg(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable selected agent
|
||||||
|
*/
|
||||||
|
function disable_agent(address, name, disabled, id_agente) {
|
||||||
|
$('#aux').empty();
|
||||||
|
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||||
|
$('#aux').dialog({
|
||||||
|
title: (disabled == 0) ? '<?php echo __('Disable'); ?>'+address : '<?php echo __('Enable'); ?>'+address,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||||
|
text: '<?php echo __('Cancel'); ?>',
|
||||||
|
click: function(e) {
|
||||||
|
$(this).dialog('close');
|
||||||
|
cleanupDOM();
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: (disabled == 0) ? 'Disable' : 'Enable',
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||||
|
click: function(e) {
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'enterprise/godmode/servers/agents_satellite',
|
||||||
|
method: 'disableAgent',
|
||||||
|
address: address,
|
||||||
|
disable: disabled,
|
||||||
|
id: id_agente,
|
||||||
|
name: name,
|
||||||
server_remote: <?php echo $this->satellite_server; ?>,
|
server_remote: <?php echo $this->satellite_server; ?>,
|
||||||
},
|
},
|
||||||
datatype: "json",
|
datatype: "json",
|
||||||
@ -752,9 +1255,74 @@ class SatelliteAgent extends HTML
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#submit-create").on('click', function(){
|
$("#submit-create").on('click', function() {
|
||||||
show_form();
|
show_form();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#checkbox-all_validate_box").click(function() {
|
||||||
|
const check = $("#checkbox-all_validate_box").is(":checked");
|
||||||
|
$('input[name*=check_]').prop('checked', check);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#submit-submit_satellite_action').click(function() {
|
||||||
|
const checks = $('input[name*=check_]:checked');
|
||||||
|
const action = $('#satellite_action').val();
|
||||||
|
$.each(checks, function(i, val) {
|
||||||
|
const params = val.value.split(",");
|
||||||
|
if (action === '0') {
|
||||||
|
if (params[2] === '0') {
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
async: false,
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'enterprise/godmode/servers/agents_satellite',
|
||||||
|
method: 'disableAgent',
|
||||||
|
address: params[0],
|
||||||
|
disable: params[3],
|
||||||
|
id: params[4],
|
||||||
|
name: params[1],
|
||||||
|
no_msg: 1,
|
||||||
|
server_remote: <?php echo $this->satellite_server; ?>,
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (params[3] === '0') {
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
async: false,
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'enterprise/godmode/servers/agents_satellite',
|
||||||
|
method: 'deleteAgent',
|
||||||
|
address: params[0],
|
||||||
|
name: params[1],
|
||||||
|
id: params[4],
|
||||||
|
delete: params[2],
|
||||||
|
no_msg: 1,
|
||||||
|
server_remote: <?php echo $this->satellite_server; ?>,
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var dt_satellite_agents = $("#satellite_agents").DataTable();
|
||||||
|
dt_satellite_agents.draw();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC220929';
|
$build_version = 'PC221018';
|
||||||
$pandora_version = 'v7.0NG.764';
|
$pandora_version = 'v7.0NG.765';
|
||||||
|
|
||||||
// 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();
|
||||||
|
@ -57,11 +57,17 @@ function mysql_connect_db(
|
|||||||
$port = $config['dbport'];
|
$port = $config['dbport'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ssl === null && (bool) $config['dbssl'] === true) {
|
if ($ssl === null
|
||||||
|
&& isset($config['dbssl']) === true
|
||||||
|
&& (bool) $config['dbssl'] === true
|
||||||
|
) {
|
||||||
$ssl = $config['dbsslcafile'];
|
$ssl = $config['dbsslcafile'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verify === null && (bool) $config['sslverifyservercert'] === true) {
|
if ($verify === null
|
||||||
|
&& isset($config['sslverifyservercert']) === true
|
||||||
|
&& (bool) $config['sslverifyservercert'] === true
|
||||||
|
) {
|
||||||
$verify = 'verified';
|
$verify = 'verified';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,6 +1007,30 @@ function get_parameter_post($name, $default='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get header.
|
||||||
|
*
|
||||||
|
* @param string $key Key.
|
||||||
|
* @param string|null $default Default.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
function get_header(string $key, ?string $default=null): ?string
|
||||||
|
{
|
||||||
|
static $headers;
|
||||||
|
if (!isset($headers)) {
|
||||||
|
$headers = getAllHeaders();
|
||||||
|
}
|
||||||
|
|
||||||
|
$adjust_key = ucwords(strtolower($key));
|
||||||
|
if (isset($headers[$adjust_key])) {
|
||||||
|
return $headers[$adjust_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name of a priority value.
|
* Get name of a priority value.
|
||||||
*
|
*
|
||||||
@ -6217,3 +6241,31 @@ function notify_reporting_console_node()
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxiliar Ordenation function
|
||||||
|
*
|
||||||
|
* @param string $sort Direction of sort.
|
||||||
|
* @param string $sortField Field for perform the sorting.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function arrayOutputSorting($sort, $sortField)
|
||||||
|
{
|
||||||
|
return function ($a, $b) use ($sort, $sortField) {
|
||||||
|
if ($sort === 'up' || $sort === 'asc') {
|
||||||
|
if (is_string($a[$sortField]) === true) {
|
||||||
|
return strnatcasecmp($a[$sortField], $b[$sortField]);
|
||||||
|
} else {
|
||||||
|
return ($a[$sortField] - $b[$sortField]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (is_string($a[$sortField]) === true) {
|
||||||
|
return strnatcasecmp($b[$sortField], $a[$sortField]);
|
||||||
|
} else {
|
||||||
|
return ($a[$sortField] + $b[$sortField]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -795,7 +795,7 @@ function alerts_delete_alert_template($id_alert_template)
|
|||||||
*
|
*
|
||||||
* @return mixed Array with selected alert templates or false if something goes wrong.
|
* @return mixed Array with selected alert templates or false if something goes wrong.
|
||||||
*/
|
*/
|
||||||
function alerts_get_alert_templates($filter=false, $fields=false)
|
function alerts_get_alert_templates($filter=false, $fields=false, $total=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -811,11 +811,8 @@ function alerts_get_alert_templates($filter=false, $fields=false)
|
|||||||
|
|
||||||
$templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true);
|
$templates_sql = @db_get_all_rows_filter('talert_templates', $filter, $fields, 'AND', false, true);
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
|
||||||
case 'mysql':
|
|
||||||
case 'postgresql':
|
|
||||||
$limit_sql = '';
|
$limit_sql = '';
|
||||||
if (isset($offset) && isset($limit)) {
|
if (isset($offset) && isset($limit) && $total === false) {
|
||||||
$limit_sql = " LIMIT $offset, $limit ";
|
$limit_sql = " LIMIT $offset, $limit ";
|
||||||
} else {
|
} else {
|
||||||
$limit_sql = '';
|
$limit_sql = '';
|
||||||
@ -824,18 +821,6 @@ function alerts_get_alert_templates($filter=false, $fields=false)
|
|||||||
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
|
$sql = sprintf('%s %s', $templates_sql, $limit_sql);
|
||||||
|
|
||||||
$alert_templates = db_get_all_rows_sql($sql);
|
$alert_templates = db_get_all_rows_sql($sql);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$set = [];
|
|
||||||
if (isset($offset) && isset($limit)) {
|
|
||||||
$set['limit'] = $limit;
|
|
||||||
$set['offset'] = $offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
$alert_templates = oracle_recode_query($templates_sql, $set, 'AND', false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $alert_templates;
|
return $alert_templates;
|
||||||
}
|
}
|
||||||
|
@ -1990,12 +1990,10 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
@ -2030,12 +2028,10 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
@ -2209,8 +2205,8 @@ function api_set_delete_agent($id, $thrash1, $other, $returnType)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Delete only if the centralised mode is disabled.
|
// Delete only if the centralised mode is disabled.
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false && is_management_allowed($headers['idk']) === false) {
|
if (is_management_allowed($idk) === false) {
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -5079,12 +5075,10 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -5181,12 +5175,10 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -5456,12 +5448,10 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -5628,12 +5618,10 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($name == '') {
|
if ($name == '') {
|
||||||
@ -5771,12 +5759,10 @@ function api_set_update_alert_template($id_template, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_template == '') {
|
if ($id_template == '') {
|
||||||
@ -5923,12 +5909,10 @@ function api_set_delete_alert_template($id_template, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_template == '') {
|
if ($id_template == '') {
|
||||||
@ -7117,12 +7101,10 @@ function api_set_tag($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
@ -7691,8 +7673,7 @@ function api_set_planned_downtimes_delete_agents($id, $thrash1, $other, $thrash3
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($other['data'][0])) {
|
if (!empty($other['data'][0])) {
|
||||||
$agents = io_safe_input($other['data']);
|
$agents = $other['data'];
|
||||||
$agents = explode(';', $agents);
|
|
||||||
$results = false;
|
$results = false;
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
|
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents WHERE id_agent = %d AND id_downtime = %d', $agent, $id)) !== false) {
|
||||||
@ -7768,8 +7749,7 @@ function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($other['data'][0])) {
|
if (!empty($other['data'][0])) {
|
||||||
$agents = io_safe_input($other['data']);
|
$agents = $other['data'];
|
||||||
$agents = explode(';', $agents);
|
|
||||||
$results = false;
|
$results = false;
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
|
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
|
||||||
@ -7827,12 +7807,10 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -7947,12 +7925,10 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8070,12 +8046,10 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8177,12 +8151,10 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8311,12 +8283,10 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8607,12 +8577,10 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8774,12 +8742,10 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -8939,12 +8905,10 @@ function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == '' || !$other['data'][0]) {
|
if ($other['data'][0] == '' || !$other['data'][0]) {
|
||||||
@ -8980,12 +8944,10 @@ function api_set_remove_agent_from_policy_by_name($id, $thrash1, $other, $thrash
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == '' || !$other['data'][0]) {
|
if ($other['data'][0] == '' || !$other['data'][0]) {
|
||||||
@ -9024,12 +8986,10 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group_name = $id;
|
$group_name = $id;
|
||||||
@ -9147,12 +9107,10 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) {
|
if (db_get_value('id_grupo', 'tgrupo', 'id_grupo', $id_group) === false) {
|
||||||
@ -9224,12 +9182,10 @@ function api_set_delete_group($id_group, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]);
|
$group = db_get_row_filter('tgrupo', ['id_grupo' => $id_group]);
|
||||||
@ -9541,22 +9497,22 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// if (defined ('METACONSOLE')) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||||
returnError('forbidden', 'string');
|
returnError('forbidden', 'string');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
if (empty($id) === true) {
|
||||||
if (isset($headers['idk']) === false
|
returnError('Id cannot be empty.');
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$idk = get_header('idk');
|
||||||
|
if (is_management_allowed($idk) === false) {
|
||||||
|
returnError('centralized');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
$values['fullname'] = $other['data'][0];
|
$values['fullname'] = $other['data'][0];
|
||||||
$values['firstname'] = $other['data'][1];
|
$values['firstname'] = $other['data'][1];
|
||||||
@ -9572,6 +9528,11 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
|
|||||||
$values['section'] = $other['data'][11];
|
$values['section'] = $other['data'][11];
|
||||||
$values['session_time'] = $other['data'][12];
|
$values['session_time'] = $other['data'][12];
|
||||||
|
|
||||||
|
if (empty($password) === true) {
|
||||||
|
returnError('Password cannot be empty.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!create_user($id, $password, $values)) {
|
if (!create_user($id, $password, $values)) {
|
||||||
returnError('The user could not created');
|
returnError('The user could not created');
|
||||||
} else {
|
} else {
|
||||||
@ -9607,12 +9568,10 @@ function api_set_update_user($id, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields_user = [
|
$fields_user = [
|
||||||
@ -9707,12 +9666,10 @@ function api_set_enable_disable_user($id, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == '') {
|
if ($id == '') {
|
||||||
@ -9986,12 +9943,10 @@ function api_set_new_alert_template($id, $id2, $other, $trash1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
if ($other['type'] == 'string') {
|
||||||
@ -10212,7 +10167,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
|
|||||||
$xmlTemplate,
|
$xmlTemplate,
|
||||||
io_safe_output(get_os_name($agent['id_os'])),
|
io_safe_output(get_os_name($agent['id_os'])),
|
||||||
io_safe_output($agent['os_version']),
|
io_safe_output($agent['os_version']),
|
||||||
$agent['intervalo'],
|
$agentModule['module_interval'],
|
||||||
io_safe_output($agent['agent_version']),
|
io_safe_output($agent['agent_version']),
|
||||||
date('Y/m/d H:i:s', $time),
|
date('Y/m/d H:i:s', $time),
|
||||||
io_safe_output($agent['nombre']),
|
io_safe_output($agent['nombre']),
|
||||||
@ -10409,12 +10364,10 @@ function api_set_alert_actions($id, $id2, $other, $trash1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
if ($other['type'] == 'string') {
|
||||||
@ -10565,12 +10518,10 @@ function api_set_new_module_group($id, $thrash2, $other, $trash1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||||
@ -10639,12 +10590,10 @@ function api_set_alert_commands($id, $thrash2, $other, $trash1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = db_get_value('id', 'talert_commands', 'name', $id);
|
$name = db_get_value('id', 'talert_commands', 'name', $id);
|
||||||
@ -11790,22 +11739,22 @@ function api_set_delete_user($id, $thrash1, $thrash2, $thrash3)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// if (defined ('METACONSOLE')) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (!check_acl($config['id_user'], 0, 'UM')) {
|
if (!check_acl($config['id_user'], 0, 'UM')) {
|
||||||
returnError('forbidden', 'string');
|
returnError('forbidden', 'string');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
if (empty($id) === true) {
|
||||||
if (isset($headers['idk']) === false
|
returnError('Id cannot be empty.');
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$idk = get_header('idk');
|
||||||
|
if (is_management_allowed($idk) === false) {
|
||||||
|
returnError('centralized');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (!delete_user($id)) {
|
if (!delete_user($id)) {
|
||||||
returnError('The user could not be deleted');
|
returnError('The user could not be deleted');
|
||||||
} else {
|
} else {
|
||||||
@ -11841,12 +11790,10 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = (int) $other['data'][0];
|
$group = (int) $other['data'][0];
|
||||||
@ -11902,12 +11849,10 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $other['data'][0];
|
$group = $other['data'][0];
|
||||||
@ -12017,12 +11962,10 @@ function api_set_create_user_profile_info($thrash1, $thrash2, $other, $returnTyp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = [
|
$values = [
|
||||||
@ -12078,12 +12021,10 @@ function api_set_update_user_profile_info($id_profile, $thrash1, $other, $return
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
|
||||||
@ -12145,12 +12086,10 @@ function api_set_delete_user_profile_info($id_profile, $thrash1, $thrash2, $retu
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = db_get_value('id_perfil', 'tperfil', 'id_perfil', $id_profile);
|
$profile = db_get_value('id_perfil', 'tperfil', 'id_perfil', $id_profile);
|
||||||
@ -13037,12 +12976,10 @@ function api_set_create_tag($id, $trash1, $other, $returnType)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -13368,12 +13305,6 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
|
||||||
$meta = true;
|
|
||||||
} else {
|
|
||||||
$meta = $other['data'][1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], 0, 'EW')) {
|
if (!check_acl($config['id_user'], 0, 'EW')) {
|
||||||
returnError('forbidden', 'string');
|
returnError('forbidden', 'string');
|
||||||
return;
|
return;
|
||||||
@ -13384,13 +13315,46 @@ function api_set_add_event_comment($id, $thrash2, $other, $thrash3)
|
|||||||
return;
|
return;
|
||||||
} else if ($other['type'] == 'array') {
|
} else if ($other['type'] == 'array') {
|
||||||
$comment = $other['data'][0];
|
$comment = $other['data'][0];
|
||||||
$history = $other['data'][2];
|
|
||||||
|
$node_int = 0;
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
if (isset($other['data'][1]) === true
|
||||||
|
&& empty($other['data'][1]) === false
|
||||||
|
) {
|
||||||
|
$node_int = $other['data'][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& (int) $node_int > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($node_int);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
$status = events_comment(
|
$status = events_comment(
|
||||||
$id,
|
$id,
|
||||||
$comment,
|
$comment,
|
||||||
'Added comment'
|
'Added comment'
|
||||||
);
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $node_int > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $node_int > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_error($status)) {
|
if (is_error($status)) {
|
||||||
returnError(
|
returnError(
|
||||||
'The event comment could not be added.'
|
'The event comment could not be added.'
|
||||||
@ -17130,12 +17094,10 @@ function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] != '') {
|
if ($other['data'][0] != '') {
|
||||||
@ -17191,12 +17153,10 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = getallheaders();
|
$idk = get_header('idk');
|
||||||
if (isset($headers['idk']) === false
|
if (is_management_allowed($idk) === false) {
|
||||||
&& is_management_allowed($headers['idk']) === false
|
|
||||||
) {
|
|
||||||
returnError('centralized');
|
returnError('centralized');
|
||||||
return;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT id_up
|
$sql = 'SELECT id_up
|
||||||
@ -17554,9 +17514,11 @@ function api_set_enable_disable_discovery_task($id_task, $thrash2, $other)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make report (PDF, CSV or XML) and send it via e-mail (this method is intended to be used by server's execution
|
* Make report (PDF, CSV or XML) and send it via e-mail (this method is intended to be used by server's execution
|
||||||
* of alert actions that involve sending reports by e-mail).
|
* of alert actions that involve sending reports by e-mail).
|
||||||
|
*
|
||||||
* @param [string] $server_id id server (Node)
|
* @param [string] $server_id id server (Node)
|
||||||
* @param [string] $console_event_id console Id node event in tevent
|
* @param [string] $console_event_id console Id node event in tevent
|
||||||
* @param [string] $trash2 don't use
|
* @param [string] $trash2 don't use
|
||||||
@ -17603,15 +17565,12 @@ function api_set_send_report($thrash1, $thrash2, $other, $returnType)
|
|||||||
$date_today = preg_split('/[\s,]+/', io_safe_output($date_today));
|
$date_today = preg_split('/[\s,]+/', io_safe_output($date_today));
|
||||||
$date_today = __($date_today[0]).' '.$date_today[1].' '.$date_today[2].' '.$date_today[3].' '.$date_today[4];
|
$date_today = __($date_today[0]).' '.$date_today[1].' '.$date_today[2].' '.$date_today[3].' '.$date_today[4];
|
||||||
|
|
||||||
|
|
||||||
if ($make_report_from_template === true) {
|
if ($make_report_from_template === true) {
|
||||||
$filter['id_report'] = $id_item;
|
$filter['id_report'] = $id_item;
|
||||||
|
|
||||||
$template = reports_get_report_templates(
|
$template = reports_get_report_templates(
|
||||||
$filter,
|
$filter,
|
||||||
[
|
['description'],
|
||||||
'description'
|
|
||||||
],
|
|
||||||
$return_all_group,
|
$return_all_group,
|
||||||
'RR'
|
'RR'
|
||||||
)[0];
|
)[0];
|
||||||
@ -17619,15 +17578,16 @@ function api_set_send_report($thrash1, $thrash2, $other, $returnType)
|
|||||||
$description = $template['description'];
|
$description = $template['description'];
|
||||||
|
|
||||||
// Report macros post-process.
|
// Report macros post-process.
|
||||||
$body_email = str_replace([
|
$body_email = str_replace(
|
||||||
|
[
|
||||||
'_report_description_',
|
'_report_description_',
|
||||||
'_report_generated_date_',
|
'_report_generated_date_',
|
||||||
'_report_date_'
|
'_report_date_',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$description,
|
$description,
|
||||||
$date_today,
|
$date_today,
|
||||||
$date_today
|
$date_today,
|
||||||
],
|
],
|
||||||
$body_email
|
$body_email
|
||||||
);
|
);
|
||||||
@ -17656,15 +17616,16 @@ function api_set_send_report($thrash1, $thrash2, $other, $returnType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Report macros post-process.
|
// Report macros post-process.
|
||||||
$body_email = str_replace([
|
$body_email = str_replace(
|
||||||
|
[
|
||||||
'_report_description_',
|
'_report_description_',
|
||||||
'_report_generated_date_',
|
'_report_generated_date_',
|
||||||
'_report_date_'
|
'_report_date_',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$report['description'],
|
$report['description'],
|
||||||
$date_today,
|
$date_today,
|
||||||
$date_today
|
$date_today,
|
||||||
],
|
],
|
||||||
$body_email
|
$body_email
|
||||||
);
|
);
|
||||||
@ -17851,4 +17812,3 @@ function api_set_send_report($thrash1, $thrash2, $other, $returnType)
|
|||||||
returnData($returnType, $data, ';');
|
returnData($returnType, $data, ';');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ function config_update_config()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pass':
|
case 'pass':
|
||||||
if (isset($config['enterprise_installed']) === true && (bool) $config['enterprise_installed'] === 1) {
|
if (isset($config['enterprise_installed']) === true && (bool) $config['enterprise_installed'] === true) {
|
||||||
if (config_update_value('enable_pass_policy', get_parameter('enable_pass_policy'), true) === false) {
|
if (config_update_value('enable_pass_policy', get_parameter('enable_pass_policy'), true) === false) {
|
||||||
$error_update[] = __('Enable password policy');
|
$error_update[] = __('Enable password policy');
|
||||||
}
|
}
|
||||||
@ -784,14 +784,7 @@ function config_update_config()
|
|||||||
case 'perf':
|
case 'perf':
|
||||||
// PERFORMANCE SETUP.
|
// PERFORMANCE SETUP.
|
||||||
if (config_update_value('event_purge', get_parameter('event_purge'), true) === false) {
|
if (config_update_value('event_purge', get_parameter('event_purge'), true) === false) {
|
||||||
$check_metaconsole_events_history = get_parameter('metaconsole_events_history', -1);
|
$error_update[] = __('Event purge');
|
||||||
$error_update[] = $check_metaconsole_events_history;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($check_metaconsole_events_history != -1) {
|
|
||||||
if (config_update_value('metaconsole_events_history', get_parameter('metaconsole_events_history'), true) === false) {
|
|
||||||
$error_update[] = __('Max. days before delete events');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_update_value('trap_purge', get_parameter('trap_purge'), true) === false) {
|
if (config_update_value('trap_purge', get_parameter('trap_purge'), true) === false) {
|
||||||
@ -2107,10 +2100,6 @@ function config_process_config()
|
|||||||
config_update_value('event_purge', 15);
|
config_update_value('event_purge', 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['metaconsole_events_history'])) {
|
|
||||||
config_update_value('metaconsole_events_history', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['realtimestats'])) {
|
if (!isset($config['realtimestats'])) {
|
||||||
config_update_value('realtimestats', 1);
|
config_update_value('realtimestats', 1);
|
||||||
}
|
}
|
||||||
|
@ -1385,7 +1385,7 @@ function events_get_all(
|
|||||||
// Pagination.
|
// Pagination.
|
||||||
$pagination = '';
|
$pagination = '';
|
||||||
if (is_metaconsole() === true
|
if (is_metaconsole() === true
|
||||||
&& empty($id_server) === true
|
&& (empty($id_server) === true || is_array($id_server) === true)
|
||||||
&& isset($filter['csv_all']) === false
|
&& isset($filter['csv_all']) === false
|
||||||
) {
|
) {
|
||||||
// TODO: XXX TIP. captura el error.
|
// TODO: XXX TIP. captura el error.
|
||||||
@ -1476,7 +1476,6 @@ function events_get_all(
|
|||||||
// Secondary groups.
|
// Secondary groups.
|
||||||
$event_lj = '';
|
$event_lj = '';
|
||||||
if (!$user_is_admin || ($user_is_admin && isset($groups) === true && $groups > 0)) {
|
if (!$user_is_admin || ($user_is_admin && isset($groups) === true && $groups > 0)) {
|
||||||
db_process_sql('SET group_concat_max_len = 9999999');
|
|
||||||
if ((bool) $filter['search_secondary_groups'] === true) {
|
if ((bool) $filter['search_secondary_groups'] === true) {
|
||||||
$event_lj = events_get_secondary_groups_left_join($table);
|
$event_lj = events_get_secondary_groups_left_join($table);
|
||||||
}
|
}
|
||||||
@ -1490,6 +1489,8 @@ function events_get_all(
|
|||||||
unset($fields[$idx]);
|
unset($fields[$idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db_process_sql('SET group_concat_max_len = 9999999');
|
||||||
|
|
||||||
$group_selects = sprintf(
|
$group_selects = sprintf(
|
||||||
',COUNT(id_evento) AS event_rep,
|
',COUNT(id_evento) AS event_rep,
|
||||||
%s
|
%s
|
||||||
@ -1660,7 +1661,9 @@ function events_get_all(
|
|||||||
|
|
||||||
if ($count === true
|
if ($count === true
|
||||||
&& (is_metaconsole() === false
|
&& (is_metaconsole() === false
|
||||||
|| (is_metaconsole() === true && empty($filter['server_id']) === false))
|
|| (is_metaconsole() === true
|
||||||
|
&& empty($filter['server_id']) === false
|
||||||
|
&& is_array($filter['server_id']) === false))
|
||||||
) {
|
) {
|
||||||
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
|
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
|
||||||
}
|
}
|
||||||
@ -1676,14 +1679,27 @@ function events_get_all(
|
|||||||
$metaconsole_connections = array_flip($metaconsole_connections);
|
$metaconsole_connections = array_flip($metaconsole_connections);
|
||||||
$metaconsole_connections['meta'] = 0;
|
$metaconsole_connections['meta'] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
if (is_array($id_server) === false) {
|
||||||
$only_id_server[$metaconsole_connections[$id_server]] = $id_server;
|
$only_id_server[$metaconsole_connections[$id_server]] = $id_server;
|
||||||
$metaconsole_connections = $only_id_server;
|
$metaconsole_connections = $only_id_server;
|
||||||
|
} else {
|
||||||
|
$metaConnections = [];
|
||||||
|
foreach ($id_server as $idser) {
|
||||||
|
if ((int) $idser === 0) {
|
||||||
|
$metaConnections['meta'] = 0;
|
||||||
|
} else {
|
||||||
|
$metaConnections[$metaconsole_connections[$idser]] = $idser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$metaconsole_connections = $metaConnections;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result_meta = Promise\wait(
|
$result_meta = Promise\wait(
|
||||||
parallelMap(
|
parallelMap(
|
||||||
$metaconsole_connections,
|
$metaconsole_connections,
|
||||||
function ($node_int) use ($sql) {
|
function ($node_int) use ($sql, $history) {
|
||||||
try {
|
try {
|
||||||
if (is_metaconsole() === true
|
if (is_metaconsole() === true
|
||||||
&& (int) $node_int > 0
|
&& (int) $node_int > 0
|
||||||
@ -1692,7 +1708,7 @@ function events_get_all(
|
|||||||
$node->connect();
|
$node->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = db_get_all_rows_sql($sql);
|
$res = db_get_all_rows_sql($sql, $history);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
$res = [];
|
$res = [];
|
||||||
}
|
}
|
||||||
@ -1751,7 +1767,7 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($filter['server_id']) === true) {
|
if ($count === false) {
|
||||||
if ($sort_field !== 'agent_name'
|
if ($sort_field !== 'agent_name'
|
||||||
&& $sort_field !== 'server_name'
|
&& $sort_field !== 'server_name'
|
||||||
&& $sort_field !== 'timestamp'
|
&& $sort_field !== 'timestamp'
|
||||||
@ -1823,7 +1839,7 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return db_get_all_rows_sql($sql);
|
return db_get_all_rows_sql($sql, $history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3498,7 +3514,7 @@ function events_page_responses($event)
|
|||||||
__('Execute'),
|
__('Execute'),
|
||||||
'custom_response_button',
|
'custom_response_button',
|
||||||
false,
|
false,
|
||||||
'execute_response('.$event['id_evento'].','.$server_id.')',
|
'execute_response('.$event['id_evento'].','.$server_id.',0)',
|
||||||
"class='sub next w70p'",
|
"class='sub next w70p'",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -3509,27 +3525,15 @@ function events_page_responses($event)
|
|||||||
$responses_js = "<script>
|
$responses_js = "<script>
|
||||||
$('#select_custom_response').change(function() {
|
$('#select_custom_response').change(function() {
|
||||||
var id_response = $('#select_custom_response').val();
|
var id_response = $('#select_custom_response').val();
|
||||||
var params = get_response_params(id_response);
|
table_info_response_event(id_response,".$event['id_evento'].','.$event['server_id'].");
|
||||||
var description = get_response_description(id_response);
|
|
||||||
$('.params_rows').remove();
|
|
||||||
$('#responses_table')
|
|
||||||
.append('<tr class=\"params_rows\"><td>".__('Description')."</td><td class=\"height_30px\" colspan=\"2\">'+description+'</td></tr>');
|
|
||||||
|
|
||||||
if (params.length == 1 && params[0] == '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#responses_table')
|
|
||||||
.append('<tr class=\"params_rows\"><td class=\"left pdd_l_20px height_30px\" colspan=\"3\">".__('Parameters')."</td></tr>');
|
|
||||||
|
|
||||||
for (i = 0; i < params.length; i++) {
|
|
||||||
add_row_param('responses_table',params[i]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$('#select_custom_response').trigger('change');
|
$('#select_custom_response').trigger('change');
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
$responses = '<div id="extended_event_responses_page" class="extended_event_pages">'.html_print_table($table_responses, true).$responses_js.'</div>';
|
$responses = '<div id="extended_event_responses_page" class="extended_event_pages">';
|
||||||
|
$responses .= html_print_table($table_responses, true);
|
||||||
|
$responses .= $responses_js;
|
||||||
|
$responses .= '</div>';
|
||||||
|
|
||||||
return $responses;
|
return $responses;
|
||||||
}
|
}
|
||||||
@ -3539,13 +3543,19 @@ function events_page_responses($event)
|
|||||||
* Replace macros in the target of a response and return it.
|
* Replace macros in the target of a response and return it.
|
||||||
*
|
*
|
||||||
* @param integer $event_id Event identifier.
|
* @param integer $event_id Event identifier.
|
||||||
* @param integer $response_id Event response identifier.
|
* @param array $event_response Event Response.
|
||||||
|
* @param array|null $response_parameters If parameters response values.
|
||||||
|
* @param integer|null $server_id Server Id.
|
||||||
|
* @param string|null $server_name Name server.
|
||||||
*
|
*
|
||||||
* @return string The response text with the macros applied.
|
* @return string The response text with the macros applied.
|
||||||
*/
|
*/
|
||||||
function events_get_response_target(
|
function events_get_response_target(
|
||||||
int $event_id,
|
int $event_id,
|
||||||
int $response_id
|
array $event_response,
|
||||||
|
?array $response_parameters=null,
|
||||||
|
?int $server_id=0,
|
||||||
|
?string $server_name=''
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -3558,9 +3568,36 @@ function events_get_response_target(
|
|||||||
}
|
}
|
||||||
|
|
||||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
|
||||||
$target = io_safe_output($event_response['target']);
|
$target = io_safe_output($event_response['target']);
|
||||||
|
|
||||||
|
// Replace parameters response.
|
||||||
|
if (isset($response_parameters) === true
|
||||||
|
&& empty($response_parameters) === false
|
||||||
|
) {
|
||||||
|
$response_parameters = array_reduce(
|
||||||
|
$response_parameters,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['name']] = $item['value'];
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($event_response['params']) === false) {
|
||||||
|
$response_params = explode(',', $event_response['params']);
|
||||||
|
if (is_array($response_params) === true) {
|
||||||
|
foreach ($response_params as $param) {
|
||||||
|
$param = trim(io_safe_output($param));
|
||||||
|
$target = str_replace(
|
||||||
|
'_'.$param.'_',
|
||||||
|
$response_parameters['values_params_'.$param],
|
||||||
|
$target
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace macros.
|
||||||
if (strpos($target, '_agent_alias_') !== false) {
|
if (strpos($target, '_agent_alias_') !== false) {
|
||||||
$agente_table_name = 'tagente';
|
$agente_table_name = 'tagente';
|
||||||
$filter = ['id_agente' => $event['id_agente']];
|
$filter = ['id_agente' => $event['id_agente']];
|
||||||
@ -3886,6 +3923,26 @@ function events_get_response_target(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& strpos($target, '_node_id_') !== false
|
||||||
|
) {
|
||||||
|
$target = str_replace(
|
||||||
|
'_node_id_',
|
||||||
|
$server_id,
|
||||||
|
$target
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& strpos($target, '_node_name_') !== false
|
||||||
|
) {
|
||||||
|
$target = str_replace(
|
||||||
|
'_node_name_',
|
||||||
|
$server_name,
|
||||||
|
$target
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5532,3 +5589,114 @@ function events_get_criticity_class($criticity)
|
|||||||
return 'datos_blue';
|
return 'datos_blue';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw row response events.
|
||||||
|
*
|
||||||
|
* @param array $event_response Response.
|
||||||
|
* @param integer|null $response_id Id .
|
||||||
|
* @param boolean $end End block.
|
||||||
|
* @param integer|null $index Index block.
|
||||||
|
*
|
||||||
|
* @return string Html output.
|
||||||
|
*/
|
||||||
|
function get_row_response_action(
|
||||||
|
array $event_response,
|
||||||
|
?int $response_id,
|
||||||
|
$end=false,
|
||||||
|
$index=null
|
||||||
|
) {
|
||||||
|
$output = '<div class="container-massive-events-response-cell">';
|
||||||
|
$display_command = (bool) $event_response['display_command'];
|
||||||
|
$command_str = ($display_command === true) ? $event_response['target'] : '';
|
||||||
|
|
||||||
|
// String command.
|
||||||
|
$output .= '<div class="container-massive-events-response-command">';
|
||||||
|
$output .= '<b>';
|
||||||
|
$output .= __('Event # %d', $event_response['event_id']);
|
||||||
|
if (empty($command_str) === false) {
|
||||||
|
$output .= ' ';
|
||||||
|
$output .= __('Executing command: ');
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= '</b>';
|
||||||
|
$output .= '<span>'.$command_str.'</span>';
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
// Spinner.
|
||||||
|
$output .= '<div id="response_loading_command'.$index.'" style="display:none">';
|
||||||
|
$output .= html_print_image(
|
||||||
|
'images/spinner.gif',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
// Output.
|
||||||
|
$output .= '<div id="response_out'.$index.'" class="container-massive-events-response-output"></div>';
|
||||||
|
|
||||||
|
// Butom.
|
||||||
|
$output .= '<div id="re_exec_command'.$index.'" style="display:none" class="container-massive-events-response-execute">';
|
||||||
|
$output .= html_print_button(
|
||||||
|
__('Execute again'),
|
||||||
|
'btn_str',
|
||||||
|
false,
|
||||||
|
'perform_response(\''.base64_encode(json_encode($event_response)).'\','.$response_id.',\''.trim($index).'\')',
|
||||||
|
"class='sub next'",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get evet get response target.
|
||||||
|
*
|
||||||
|
* @param integer $event_id Id event.
|
||||||
|
* @param array $event_response Response.
|
||||||
|
* @param integer $server_id Server id.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_events_get_response_target(
|
||||||
|
$event_id,
|
||||||
|
$event_response,
|
||||||
|
$server_id=0,
|
||||||
|
$response_parameters=[]
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $server_id > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($server_id);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return events_get_response_target(
|
||||||
|
$event_id,
|
||||||
|
$event_response,
|
||||||
|
$response_parameters,
|
||||||
|
$server_id,
|
||||||
|
($server_id !== 0) ? $node->server_name() : 'Metaconsole'
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $server_id > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $server_id > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1664,36 +1664,23 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Show common modules.
|
$commonModules = 0;
|
||||||
$selection = [
|
if (empty($data['mShowCommonModules']) === false) {
|
||||||
0 => __('Show common modules'),
|
$commonModules = 1;
|
||||||
1 => __('Show all modules'),
|
}
|
||||||
];
|
|
||||||
|
|
||||||
if (true) {
|
|
||||||
$output .= html_print_input(
|
$output .= html_print_input(
|
||||||
[
|
[
|
||||||
|
|
||||||
'label' => __('Only common modules'),
|
'label' => __('Only common modules'),
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'value' => 'checked',
|
'checked' => $commonModules,
|
||||||
|
'value' => $commonModules,
|
||||||
|
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||||
'id' => 'filtered-module-show-common-modules-'.$uniqId,
|
'id' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
$output .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => __('Show common modules'),
|
|
||||||
'type' => 'select',
|
|
||||||
'fields' => $selection,
|
|
||||||
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
|
||||||
'return' => true,
|
|
||||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($data['mAgents']) === false
|
if (empty($data['mAgents']) === false
|
||||||
&& empty($data['mModuleGroup'] === false)
|
&& empty($data['mModuleGroup'] === false)
|
||||||
@ -1701,7 +1688,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
$all_modules = get_modules_agents(
|
$all_modules = get_modules_agents(
|
||||||
$data['mModuleGroup'],
|
$data['mModuleGroup'],
|
||||||
explode(',', $data['mAgents']),
|
explode(',', $data['mAgents']),
|
||||||
$data['mShowCommonModules'],
|
!$commonModules,
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -1709,10 +1696,18 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
|||||||
$all_modules = [];
|
$all_modules = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mModules = $data['mModules'];
|
||||||
if (is_array($data['mModules']) === false) {
|
if (is_array($data['mModules']) === false) {
|
||||||
$result = explode(((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ','), $data['mModules']);
|
$mModules = explode(
|
||||||
} else {
|
',',
|
||||||
$result = $data['mModules'];
|
$data['mModules']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
// Clean double safe input.
|
||||||
|
foreach ($mModules as $name) {
|
||||||
|
$result[] = io_safe_output($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= html_print_input(
|
$output .= html_print_input(
|
||||||
@ -2075,7 +2070,7 @@ function html_print_extended_select_for_time(
|
|||||||
$custom_fields=false,
|
$custom_fields=false,
|
||||||
$style_icon='',
|
$style_icon='',
|
||||||
$no_change=false,
|
$no_change=false,
|
||||||
$allow_zero=false
|
$allow_zero=0
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
$admin = is_user_admin($config['id_user']);
|
$admin = is_user_admin($config['id_user']);
|
||||||
@ -2089,32 +2084,21 @@ function html_print_extended_select_for_time(
|
|||||||
$fields['-2'] = __('No change');
|
$fields['-2'] = __('No change');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $selected) {
|
if (empty($selected) === false
|
||||||
foreach ($fields as $t_key => $t_value) {
|
&& $selected !== '0'
|
||||||
if ($t_key != -1) {
|
&& isset($fields[$selected]) === false
|
||||||
if ($nothing == '') {
|
) {
|
||||||
// -1 means 'custom'
|
$allow_zero = false;
|
||||||
$selected = $t_key;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
$selected = $nothing;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow the use of the value zero.
|
|
||||||
if ($allow_zero === true) {
|
|
||||||
$selected_zero = true;
|
|
||||||
} else {
|
|
||||||
$selected_zero = ($selected != 0) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($selected !== false) && (!isset($fields[$selected]) && $selected_zero)) {
|
|
||||||
$fields[$selected] = human_time_description_raw($selected, true);
|
$fields[$selected] = human_time_description_raw($selected, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($nothing) === true
|
||||||
|
&& (empty($selected) === true
|
||||||
|
|| $selected === '0')
|
||||||
|
) {
|
||||||
|
$selected = 300;
|
||||||
|
}
|
||||||
|
|
||||||
$units = [
|
$units = [
|
||||||
1 => __('seconds'),
|
1 => __('seconds'),
|
||||||
SECONDS_1MINUTE => __('minutes'),
|
SECONDS_1MINUTE => __('minutes'),
|
||||||
@ -2180,14 +2164,23 @@ function html_print_extended_select_for_time(
|
|||||||
$uniq_name.'_units',
|
$uniq_name.'_units',
|
||||||
'1',
|
'1',
|
||||||
''.$script,
|
''.$script,
|
||||||
$nothing,
|
'',
|
||||||
$nothing_value,
|
0,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$class,
|
$class,
|
||||||
$readonly,
|
$readonly,
|
||||||
'font-size: xx-small;'.$select_style
|
'padding: 7px 3px;'.$select_style,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
echo ' <a href="javascript:">'.html_print_image(
|
echo ' <a href="javascript:">'.html_print_image(
|
||||||
'images/list.png',
|
'images/list.png',
|
||||||
@ -2202,7 +2195,7 @@ function html_print_extended_select_for_time(
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo "<script type='text/javascript'>
|
echo "<script type='text/javascript'>
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
period_select_init('".$uniq_name."', ".(($allow_zero) ? 'true' : 'null').");
|
period_select_init('".$uniq_name."', ".(($allow_zero) ? 1 : 0).");
|
||||||
period_select_events('".$uniq_name."');
|
period_select_events('".$uniq_name."');
|
||||||
});
|
});
|
||||||
function period_select_".$name."_update(seconds) {
|
function period_select_".$name."_update(seconds) {
|
||||||
@ -4956,7 +4949,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (($data['label'] ?? false) && $input_only === false) {
|
if (($data['label'] ?? false) && $input_only === false) {
|
||||||
$output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
|
$output = '<'.$wrapper.' id="'.$wrapper.'-'.($data['name'] ?? '').'" ';
|
||||||
$output .= ' class="'.($data['input_class'] ?? '').'">';
|
$output .= ' class="'.($data['input_class'] ?? '').'">';
|
||||||
$output .= '<label '.$style.' class="'.($data['label_class'] ?? '').'">';
|
$output .= '<label '.$style.' class="'.($data['label_class'] ?? '').'">';
|
||||||
$output .= ($data['label'] ?? '');
|
$output .= ($data['label'] ?? '');
|
||||||
@ -4977,7 +4970,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||||||
|
|
||||||
if (isset($data['wrapper']) === true) {
|
if (isset($data['wrapper']) === true) {
|
||||||
$output = '<'.$data['wrapper'].' '.$wrapper_attributes.' id="wr_'.$data['name'].'" ';
|
$output = '<'.$data['wrapper'].' '.$wrapper_attributes.' id="wr_'.$data['name'].'" ';
|
||||||
$output .= ' class="'.$data['input_class'].'">';
|
$output .= ' class="'.($data['input_class'] ?? '').'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (($data['type'] ?? null)) {
|
switch (($data['type'] ?? null)) {
|
||||||
@ -5097,7 +5090,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||||||
$output .= html_print_input_color(
|
$output .= html_print_input_color(
|
||||||
$data['name'],
|
$data['name'],
|
||||||
$data['value'],
|
$data['value'],
|
||||||
$data['id'],
|
($data['id'] ?? ''),
|
||||||
((isset($data['class']) === true) ? $data['class'] : false),
|
((isset($data['class']) === true) ? $data['class'] : false),
|
||||||
((isset($data['return']) === true) ? $data['return'] : false)
|
((isset($data['return']) === true) ? $data['return'] : false)
|
||||||
);
|
);
|
||||||
|
@ -3656,7 +3656,7 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||||||
$id_agents,
|
$id_agents,
|
||||||
$selection,
|
$selection,
|
||||||
false,
|
false,
|
||||||
false,
|
$useName,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3684,8 +3684,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||||||
if ($occurrences === $nodes_consulted) {
|
if ($occurrences === $nodes_consulted) {
|
||||||
// Module already present in ALL nodes.
|
// Module already present in ALL nodes.
|
||||||
$modules[] = [
|
$modules[] = [
|
||||||
'id_agente_modulo' => $module_name,
|
'id_agente_modulo' => io_safe_output($module_name),
|
||||||
'nombre' => $module_name,
|
'nombre' => io_safe_output($module_name),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3730,7 +3730,7 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||||||
function ($carry, $item) use ($useName) {
|
function ($carry, $item) use ($useName) {
|
||||||
// Only works in select mode.
|
// Only works in select mode.
|
||||||
if ($useName === true) {
|
if ($useName === true) {
|
||||||
$carry[io_safe_input($item['nombre'])] = $item['nombre'];
|
$carry[$item['id_node'].'|'.$item['nombre']] = $item['nombre'];
|
||||||
} else {
|
} else {
|
||||||
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
|
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
|
||||||
}
|
}
|
||||||
@ -3744,6 +3744,8 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
|||||||
$id_module_group,
|
$id_module_group,
|
||||||
$id_agents,
|
$id_agents,
|
||||||
$selection,
|
$selection,
|
||||||
|
false,
|
||||||
|
$useName,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -4191,6 +4193,11 @@ function modules_get_counter_by_states($state)
|
|||||||
|
|
||||||
function modules_get_state_condition($state, $prefix='tae')
|
function modules_get_state_condition($state, $prefix='tae')
|
||||||
{
|
{
|
||||||
|
// Not use empty state 0 -> AGENT_MODULE_STATUS_NORMAL.
|
||||||
|
if ($state === '') {
|
||||||
|
return '1=1';
|
||||||
|
}
|
||||||
|
|
||||||
switch ($state) {
|
switch ($state) {
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||||
|
@ -2702,7 +2702,7 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$sql_duplicate_links = 'SELECT id, id_parent, id_child
|
$sql_duplicate_links = 'SELECT *
|
||||||
FROM trel_item t1
|
FROM trel_item t1
|
||||||
WHERE t1.deleted = 0 AND t1.id_child IN (
|
WHERE t1.deleted = 0 AND t1.id_child IN (
|
||||||
SELECT t2.id_child
|
SELECT t2.id_child
|
||||||
@ -2712,7 +2712,7 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
AND t1.id_parent = t2.id_parent
|
AND t1.id_parent = t2.id_parent
|
||||||
AND t2.id_map = '.$id.')
|
AND t2.id_map = '.$id.')
|
||||||
AND t1.id_map = '.$id.'
|
AND t1.id_map = '.$id.'
|
||||||
ORDER BY id_parent, id_child';
|
ORDER BY id_parent, id_child, id_parent_source_data desc, id_child_source_data desc';
|
||||||
|
|
||||||
$rows = db_get_all_rows_sql($sql_duplicate_links);
|
$rows = db_get_all_rows_sql($sql_duplicate_links);
|
||||||
if (empty($rows) === true) {
|
if (empty($rows) === true) {
|
||||||
@ -2721,9 +2721,23 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
|
|
||||||
$pre_parent = -1;
|
$pre_parent = -1;
|
||||||
$pre_child = -1;
|
$pre_child = -1;
|
||||||
|
$pre_parent_source = -1;
|
||||||
|
$pre_child_source = -1;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if (($pre_parent === (int) $row['id_parent'])
|
if (($pre_parent === (int) $row['id_parent'])
|
||||||
&& ($pre_child === (int) $row['id_child'])
|
&& ($pre_child === (int) $row['id_child'])
|
||||||
|
) {
|
||||||
|
// Agent <-> Agent.
|
||||||
|
if ((int) $row['parent_type'] === 0 && (int) $row['child_type'] === 0) {
|
||||||
|
// Delete the duplicate row.
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
['id' => $row['id']]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Agent <-> Module or Module <-> Agent or Module <-> Module.
|
||||||
|
if ($pre_parent_source === (int) $row['id_parent_source_data']
|
||||||
|
&& $pre_child_source === (int) $row['id_child_source_data']
|
||||||
) {
|
) {
|
||||||
// Delete the duplicate row.
|
// Delete the duplicate row.
|
||||||
db_process_sql_delete(
|
db_process_sql_delete(
|
||||||
@ -2731,18 +2745,25 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
['id' => $row['id']]
|
['id' => $row['id']]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$pre_parent = $row['id_parent'];
|
$pre_parent_source = (int) $row['id_parent_source_data'];
|
||||||
$pre_child = $row['id_child'];
|
$pre_child_source = (int) $row['id_child_source_data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$pre_parent = (int) $row['id_parent'];
|
||||||
|
$pre_child = (int) $row['id_child'];
|
||||||
|
if ((int) $row['parent_type'] === 1 || (int) $row['child_type'] === 1) {
|
||||||
|
$pre_parent_source = (int) $row['id_parent_source_data'];
|
||||||
|
$pre_child_source = (int) $row['id_child_source_data'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db_process_sql($sql_duplicate_links);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
db_clean_cache();
|
db_clean_cache();
|
||||||
|
|
||||||
$sql_duplicate_links_parent_as_children = '
|
$sql_duplicate_links_parent_as_children = '
|
||||||
SELECT id, id_parent, id_child
|
SELECT *
|
||||||
FROM trel_item t1
|
FROM trel_item t1
|
||||||
WHERE t1.deleted = 0 AND t1.id_child IN (
|
WHERE t1.deleted = 0 AND t1.id_child IN (
|
||||||
SELECT t2.id_parent
|
SELECT t2.id_parent
|
||||||
@ -2765,6 +2786,22 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
if (($row['id'] != $row2['id'])
|
if (($row['id'] != $row2['id'])
|
||||||
&& ($row['id_child'] == $row2['id_parent'])
|
&& ($row['id_child'] == $row2['id_parent'])
|
||||||
&& ($row['id_parent'] == $row2['id_child'])
|
&& ($row['id_parent'] == $row2['id_child'])
|
||||||
|
&& ($row['parent_type'] == $row2['child_type'])
|
||||||
|
&& ($row['child_type'] == $row2['parent_type'])
|
||||||
|
) {
|
||||||
|
// Agent <-> Agent.
|
||||||
|
if ((int) $row2['parent_type'] === 0 && (int) $row2['child_type'] === 0) {
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
['id' => $row2['id']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
// Agent <-> Module or Module <-> Agent or Module <-> Module.
|
||||||
|
if ((int) $row['id_child_source_data'] === (int) $row2['id_parent_source_data']
|
||||||
|
&& (int) $row['id_parent_source_data'] === (int) $row2['id_child_source_data']
|
||||||
) {
|
) {
|
||||||
db_process_sql_delete(
|
db_process_sql_delete(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
@ -2775,6 +2812,27 @@ function networkmap_clean_duplicate_links($id)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Si no son del mismo tipo pero hay un parent_type = 0 y child_type = 0 borrar.
|
||||||
|
if ((int) $row['parent_type'] === 0 && (int) $row['child_type'] === 0) {
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
['id' => $row['id']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
} else if ((int) $row2['parent_type'] === 0 && (int) $row2['child_type'] === 0) {
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
['id' => $row2['id']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($found === true) {
|
if ($found === true) {
|
||||||
break;
|
break;
|
||||||
@ -3020,23 +3078,32 @@ function networkmap_delete_link(
|
|||||||
function erase_node($id)
|
function erase_node($id)
|
||||||
{
|
{
|
||||||
$node = db_get_row('titem', 'id', $id['id']);
|
$node = db_get_row('titem', 'id', $id['id']);
|
||||||
|
if ($node['type'] !== '2') {
|
||||||
$return = db_process_sql_update(
|
$return = db_process_sql_update(
|
||||||
'titem',
|
'titem',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id' => $node['id']]
|
[
|
||||||
|
'id' => (int) $node['id'],
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id_parent' => (int) $node['id']]
|
[
|
||||||
|
'id_parent' => (int) $node['id'],
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id_child' => (int) $node['id']]
|
[
|
||||||
|
'id_child' => (int) $node['id'],
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$node_modules = db_get_all_rows_filter(
|
$node_modules = db_get_all_rows_filter(
|
||||||
@ -3054,20 +3121,54 @@ function erase_node($id)
|
|||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'titem',
|
'titem',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id' => $node_module['id']]
|
[
|
||||||
|
'id' => (int) $node_module['id'],
|
||||||
|
'id_map' => (int) $node_module['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id_parent_source_data' => (int) $node_module['source_data']]
|
[
|
||||||
|
'id_parent_source_data' => (int) $node_module['source_data'],
|
||||||
|
'id_map' => (int) $node_module['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
db_process_sql_update(
|
db_process_sql_update(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
['deleted' => 1],
|
['deleted' => 1],
|
||||||
['id_child_source_data' => (int) $node_module['source_data']]
|
[
|
||||||
|
'id_child_source_data' => (int) $node_module['source_data'],
|
||||||
|
'id_map' => (int) $node_module['id_map'],
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$return = db_process_sql_delete(
|
||||||
|
'titem',
|
||||||
|
[
|
||||||
|
'id' => (int) $node['id'],
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
[
|
||||||
|
'parent_type' => 2,
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
db_process_sql_delete(
|
||||||
|
'trel_item',
|
||||||
|
[
|
||||||
|
'child_type' => 2,
|
||||||
|
'id_map' => (int) $node['id_map'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
return false;
|
return false;
|
||||||
@ -3504,6 +3605,7 @@ function update_node($node, $holding_area_x, $holding_area_y)
|
|||||||
$values = [];
|
$values = [];
|
||||||
$values['x'] = $node['x'];
|
$values['x'] = $node['x'];
|
||||||
$values['y'] = $node['y'];
|
$values['y'] = $node['y'];
|
||||||
|
$values['refresh'] = 0;
|
||||||
|
|
||||||
if ($node['state'] === 'holding_area') {
|
if ($node['state'] === 'holding_area') {
|
||||||
$networkmap_node = db_get_row_filter(
|
$networkmap_node = db_get_row_filter(
|
||||||
@ -3526,14 +3628,9 @@ function update_node($node, $holding_area_x, $holding_area_y)
|
|||||||
) {
|
) {
|
||||||
// Inside holding area.
|
// Inside holding area.
|
||||||
$return['state'] = 'holding_area';
|
$return['state'] = 'holding_area';
|
||||||
|
$values['refresh'] = 1;
|
||||||
} else {
|
} else {
|
||||||
// The user move the node out the holding area.
|
// The user move the node out the holding area.
|
||||||
db_process_sql_update(
|
|
||||||
'titem',
|
|
||||||
['refresh' => 0],
|
|
||||||
['id' => $node['id_db']]
|
|
||||||
);
|
|
||||||
|
|
||||||
$return['state'] = '';
|
$return['state'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4053,6 +4150,7 @@ function add_agent_node_in_option($id_networkmap, $id_agent, $x, $y)
|
|||||||
function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
||||||
{
|
{
|
||||||
$id_networkmap = $networkmap['id'];
|
$id_networkmap = $networkmap['id'];
|
||||||
|
$id_recon = $networkmap['source_data'];
|
||||||
|
|
||||||
$map_filter = $networkmap['filter'];
|
$map_filter = $networkmap['filter'];
|
||||||
if (is_array($map_filter) === false) {
|
if (is_array($map_filter) === false) {
|
||||||
@ -4060,11 +4158,11 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((int) $networkmap['source'] === SOURCE_TASK) {
|
if ((int) $networkmap['source'] === SOURCE_TASK) {
|
||||||
$agents = get_discovery_agents($networkmap, true);
|
$agents = get_discovery_agents($id_recon, true);
|
||||||
} else if ((int) $networkmap['source'] === SOURCE_NETWORK) {
|
} else if ((int) $networkmap['source'] === SOURCE_NETWORK) {
|
||||||
// Network map, based on direct network.
|
// Network map, based on direct network.
|
||||||
$agents = networkmap_get_nodes_from_ip_mask(
|
$agents = networkmap_get_nodes_from_ip_mask(
|
||||||
$networkmap['source_data'],
|
$id_recon,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -4274,102 +4372,85 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get L2 interface relations.
|
// foreach ($interfaces as $interface) {
|
||||||
$interfaces = modules_get_interfaces(
|
// $relations = modules_get_relations(
|
||||||
$node['source_data'],
|
// ['id_module' => $interface['id_agente_modulo']]
|
||||||
[
|
// );
|
||||||
'id_agente',
|
// if (empty($relations) === true) {
|
||||||
'id_agente_modulo',
|
// $relations = [];
|
||||||
]
|
// }
|
||||||
);
|
// foreach ($relations as $relation) {
|
||||||
if (empty($interfaces) === true) {
|
|
||||||
$interfaces = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($interfaces as $interface) {
|
|
||||||
$relations = modules_get_relations(
|
|
||||||
['id_module' => $interface['id_agente_modulo']]
|
|
||||||
);
|
|
||||||
if (empty($relations) === true) {
|
|
||||||
$relations = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($relations as $relation) {
|
|
||||||
// Get the links althought they are deleted (for to
|
// Get the links althought they are deleted (for to
|
||||||
// avoid to add)
|
// avoid to add)
|
||||||
// Check if the module is ping.
|
// Check if the module is ping.
|
||||||
if (modules_get_agentmodule_type($relation['module_a']) === '6') {
|
// if (modules_get_agentmodule_type($relation['module_a']) === '6') {
|
||||||
// The pings modules are not exist as interface
|
// The pings modules are not exist as interface
|
||||||
// the link is with the agent.
|
// the link is with the agent.
|
||||||
$node_a = db_get_value_filter(
|
// $node_a = db_get_value_filter(
|
||||||
'id',
|
// 'id',
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'source_data' => modules_get_agentmodule_agent(
|
// 'source_data' => modules_get_agentmodule_agent(
|
||||||
$relation['module_a']
|
// $relation['module_a']
|
||||||
),
|
// ),
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
$node_a = db_get_value_filter(
|
// $node_a = db_get_value_filter(
|
||||||
'id',
|
// 'id',
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'source_data' => $relation['module_a'],
|
// 'source_data' => $relation['module_a'],
|
||||||
'type' => 1,
|
// 'type' => 1,
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Check if the module is ping.
|
// Check if the module is ping.
|
||||||
if (modules_get_agentmodule_type($relation['module_b']) == 6) {
|
// if (modules_get_agentmodule_type($relation['module_b']) == 6) {
|
||||||
// The pings modules are not exist as interface
|
// The pings modules are not exist as interface
|
||||||
// the link is with the agent.
|
// the link is with the agent.
|
||||||
$node_b = db_get_value_filter(
|
// $node_b = db_get_value_filter(
|
||||||
'id',
|
// 'id',
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'source_data' => modules_get_agentmodule_agent(
|
// 'source_data' => modules_get_agentmodule_agent(
|
||||||
$relation['module_b']
|
// $relation['module_b']
|
||||||
),
|
// ),
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
$node_b = db_get_value_filter(
|
// $node_b = db_get_value_filter(
|
||||||
'id',
|
// 'id',
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'source_data' => $relation['module_b'],
|
// 'source_data' => $relation['module_b'],
|
||||||
'type' => 1,
|
// 'type' => 1,
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
// $exist = db_get_row_filter(
|
||||||
$exist = db_get_row_filter(
|
// 'trel_item',
|
||||||
'trel_item',
|
// [
|
||||||
[
|
// 'id_map' => $id_networkmap,
|
||||||
'id_map' => $id_networkmap,
|
// 'id_parent_source_data' => $relation['module_a'],
|
||||||
'id_parent_source_data' => $relation['module_a'],
|
// 'id_child_source_data' => $relation['module_b'],
|
||||||
'id_child_source_data' => $relation['module_b'],
|
// 'deleted' => 0,
|
||||||
'deleted' => 0,
|
// ]
|
||||||
]
|
// );
|
||||||
);
|
// $exist_reverse = db_get_row_filter(
|
||||||
|
// 'trel_item',
|
||||||
$exist_reverse = db_get_row_filter(
|
// [
|
||||||
'trel_item',
|
// 'id_map' => $id_networkmap,
|
||||||
[
|
// 'id_parent_source_data' => $relation['module_b'],
|
||||||
'id_map' => $id_networkmap,
|
// 'id_child_source_data' => $relation['module_a'],
|
||||||
'id_parent_source_data' => $relation['module_b'],
|
// 'deleted' => 0,
|
||||||
'id_child_source_data' => $relation['module_a'],
|
// ]
|
||||||
'deleted' => 0,
|
// );
|
||||||
]
|
// if (empty($exist) && empty($exist_reverse)) {
|
||||||
);
|
|
||||||
|
|
||||||
if (empty($exist) && empty($exist_reverse)) {
|
|
||||||
// Create the nodes for interfaces
|
// Create the nodes for interfaces
|
||||||
// Ag1 ----- I1 ------ I2 ----- Ag2
|
// Ag1 ----- I1 ------ I2 ----- Ag2
|
||||||
// * 2 interfaces nodes
|
// * 2 interfaces nodes
|
||||||
@ -4380,184 +4461,202 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
//
|
//
|
||||||
// But check if it exists the relations
|
// But check if it exists the relations
|
||||||
// agent between interface.
|
// agent between interface.
|
||||||
if ($interface['id_agente_modulo'] == $relation['module_a']) {
|
// if ($interface['id_agente_modulo'] == $relation['module_a']) {
|
||||||
$agent_a = $interface['id_agente'];
|
// $agent_a = $interface['id_agente'];
|
||||||
$agent_b = modules_get_agentmodule_agent(
|
// $agent_b = modules_get_agentmodule_agent(
|
||||||
$relation['module_b']
|
// $relation['module_b']
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
$agent_a = modules_get_agentmodule_agent(
|
// $agent_a = modules_get_agentmodule_agent(
|
||||||
$relation['module_a']
|
// $relation['module_a']
|
||||||
);
|
// );
|
||||||
$agent_b = $interface['id_agente'];
|
// $agent_b = $interface['id_agente'];
|
||||||
}
|
// }
|
||||||
|
// $item_a = db_get_value(
|
||||||
$exist_node_interface1 = db_get_row_filter(
|
// 'id',
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// 'source_data',
|
||||||
'id_map' => $id_networkmap,
|
// $agent_a
|
||||||
'type' => 1,
|
// );
|
||||||
'source_data' => $relation['module_a'],
|
// $item_b = db_get_value(
|
||||||
]
|
// 'id',
|
||||||
);
|
// 'titem',
|
||||||
|
// 'source_data',
|
||||||
if (empty($exist_node_interface1) === true) {
|
// $agent_b
|
||||||
|
// );
|
||||||
|
// hd('----------------------', true);
|
||||||
|
// hd($agent_a, true);
|
||||||
|
// hd($agent_b, true);
|
||||||
|
// foreach ($interfaces as $interface) {
|
||||||
|
// $relations = modules_get_relations(
|
||||||
|
// ['id_module' => $interface['id_agente_modulo']]
|
||||||
|
// );
|
||||||
|
// if (empty($relations) === true) {
|
||||||
|
// $relations = [];
|
||||||
|
// }
|
||||||
|
// foreach ($relations as $relation) {hd($item_a. '<->'. $item_b, true);
|
||||||
|
// hd('----------------------', true);
|
||||||
|
// continue;
|
||||||
|
// $exist_node_interface1 = db_get_row_filter(
|
||||||
|
// 'titem',
|
||||||
|
// [
|
||||||
|
// 'id_map' => $id_networkmap,
|
||||||
|
// 'type' => 0,
|
||||||
|
// 'source_data' => $relation['module_a'],
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// if (empty($exist_node_interface1) === true) {
|
||||||
// Crete the interface node
|
// Crete the interface node
|
||||||
// and create the relation between agent and
|
// and create the relation between agent and
|
||||||
// interface.
|
// interface.
|
||||||
$style = [];
|
// $style = [];
|
||||||
$style['id_agent'] = $agent_a;
|
// $style['id_agent'] = $agent_a;
|
||||||
$style['shape'] = 'circle';
|
// $style['shape'] = 'circle';
|
||||||
$style['image'] = 'images/mod_snmp_proc.png';
|
// $style['image'] = 'images/mod_snmp_proc.png';
|
||||||
$style['width'] = 50;
|
// $style['width'] = 50;
|
||||||
$style['height'] = 16;
|
// $style['height'] = 16;
|
||||||
$style['label'] = modules_get_agentmodule_name($relation['module_a']);
|
// $style['label'] = modules_get_agentmodule_name($relation['module_a']);
|
||||||
$id_int1 = db_process_sql_insert(
|
// $id_int1 = db_process_sql_insert(
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
'x' => 666,
|
// 'x' => 666,
|
||||||
'y' => 666,
|
// 'y' => 666,
|
||||||
'z' => 0,
|
// 'z' => 0,
|
||||||
'deleted' => 0,
|
// 'deleted' => 0,
|
||||||
'type' => 1,
|
// 'type' => 1,
|
||||||
'refresh' => 0,
|
// 'refresh' => 0,
|
||||||
'source' => 0,
|
// 'source' => 0,
|
||||||
'source_data' => $relation['module_a'],
|
// 'source_data' => $relation['module_a'],
|
||||||
'style' => json_encode($style),
|
// 'style' => json_encode($style),
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
$node_interface1 = db_get_row_filter(
|
// $node_interface1 = db_get_row_filter(
|
||||||
'titem',
|
// 'titem',
|
||||||
[
|
// [
|
||||||
'id_map' => $id_networkmap,
|
// 'id_map' => $id_networkmap,
|
||||||
'type' => 1,
|
// 'type' => 1,
|
||||||
'id' => $id_int1,
|
// 'id' => $id_int1,
|
||||||
]
|
// ]
|
||||||
);
|
// );
|
||||||
|
// $node_agent1 = db_get_value(
|
||||||
$node_agent1 = db_get_value(
|
// 'id',
|
||||||
'id',
|
// 'titem',
|
||||||
'titem',
|
// 'source_data',
|
||||||
'source_data',
|
// $agent_a
|
||||||
$agent_a
|
// );
|
||||||
);
|
// db_process_sql_insert(
|
||||||
|
// 'trel_item',
|
||||||
db_process_sql_insert(
|
// [
|
||||||
'trel_item',
|
// 'id_map' => $id_networkmap,
|
||||||
[
|
// 'id_parent' => $node_agent1,
|
||||||
'id_map' => $id_networkmap,
|
// 'id_child' => $node_interface1,
|
||||||
'id_parent' => $node_agent1,
|
// 'id_parent-source_data' => $agent_a,
|
||||||
'id_child' => $node_interface1,
|
// 'id_child-source_data' => $relation['module_a'],
|
||||||
'id_parent-source_data' => $agent_a,
|
// 'parent_type' => 0,
|
||||||
'id_child-source_data' => $relation['module_a'],
|
// 'child_type' => 1,
|
||||||
'parent_type' => 0,
|
// ]
|
||||||
'child_type' => 1,
|
// );
|
||||||
]
|
// } else {
|
||||||
);
|
// $node_interface1 = $exist_node_interface1;
|
||||||
} else {
|
// }
|
||||||
$node_interface1 = $exist_node_interface1;
|
// $exist_node_interface2 = db_get_row_filter(
|
||||||
}
|
// 'titem',
|
||||||
|
// [
|
||||||
$exist_node_interface2 = db_get_row_filter(
|
// 'id_map' => $id_networkmap,
|
||||||
'titem',
|
// 'type' => 1,
|
||||||
[
|
// 'source_data' => $relation['module_b'],
|
||||||
'id_map' => $id_networkmap,
|
// ]
|
||||||
'type' => 1,
|
// );
|
||||||
'source_data' => $relation['module_b'],
|
// if (empty($exist_node_interface2) === true) {
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (empty($exist_node_interface2) === true) {
|
|
||||||
// Crete the interface node
|
// Crete the interface node
|
||||||
// and create the relation between agent and
|
// and create the relation between agent and
|
||||||
// interface.
|
// interface.
|
||||||
$style = [];
|
// $style = [];
|
||||||
$style['id_agent'] = $agent_a;
|
// $style['id_agent'] = $agent_a;
|
||||||
$style['shape'] = 'circle';
|
// $style['shape'] = 'circle';
|
||||||
$style['image'] = 'images/mod_snmp_proc.png';
|
// $style['image'] = 'images/mod_snmp_proc.png';
|
||||||
$style['width'] = 50;
|
// $style['width'] = 50;
|
||||||
$style['height'] = 16;
|
// $style['height'] = 16;
|
||||||
$style['label'] = modules_get_agentmodule_name($relation['module_b']);
|
// $style['label'] = modules_get_agentmodule_name($relation['module_b']);
|
||||||
$id_int2 = db_process_sql_insert(
|
// $id_int2 = db_process_sql_insert(
|
||||||
'titem',
|
// 'titem',
|
||||||
|
// [
|
||||||
|
// 'id_map' => $id_networkmap,
|
||||||
|
// 'x' => 666,
|
||||||
|
// 'y' => 666,
|
||||||
|
// 'z' => 0,
|
||||||
|
// 'deleted' => 0,
|
||||||
|
// 'type' => 1,
|
||||||
|
// 'refresh' => 0,
|
||||||
|
// 'source' => 0,
|
||||||
|
// 'source_data' => $relation['module_b'],
|
||||||
|
// 'style' => json_encode($style),
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// $node_interface2 = db_get_row_filter(
|
||||||
|
// 'titem',
|
||||||
|
// [
|
||||||
|
// 'id_map' => $id_networkmap,
|
||||||
|
// 'type' => 1,
|
||||||
|
// 'id' => $id_int1,
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// $node_agent1 = db_get_value(
|
||||||
|
// 'id',
|
||||||
|
// 'titem',
|
||||||
|
// 'source_data',
|
||||||
|
// $agent_a
|
||||||
|
// );
|
||||||
|
// db_process_sql_insert(
|
||||||
|
// 'trel_item',
|
||||||
|
// [
|
||||||
|
// 'id_map' => $id_networkmap,
|
||||||
|
// 'id_parent' => $node_agent1,
|
||||||
|
// 'id_child' => $node_interface1,
|
||||||
|
// 'id_parent-source_data' => $agent_a,
|
||||||
|
// 'id_child-source_data' => $relation['module_b'],
|
||||||
|
// 'parent_type' => 0,
|
||||||
|
// 'child_type' => 1,
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// $node_interface2 = $exist_node_interface2;
|
||||||
|
// }
|
||||||
|
// if (empty($node_interface1) === false && empty($node_interface2) === false) {
|
||||||
|
// if (is_array($node_interface1) === true) {
|
||||||
|
// $node_interface1 = $node_interface1['id'];
|
||||||
|
// }
|
||||||
|
// if (is_array($node_interface2) === true) {
|
||||||
|
// $node_interface2 = $node_interface2['id'];
|
||||||
|
// }
|
||||||
|
// db_process_sql_insert(
|
||||||
|
// 'trel_item',
|
||||||
|
// [
|
||||||
|
// 'id_map' => $id_networkmap,
|
||||||
|
// 'id_parent' => $node_interface2,
|
||||||
|
// 'id_child' => $node_interface1,
|
||||||
|
// 'id_parent_source_data' => $relation['module_b'],
|
||||||
|
// 'id_child_source_data' => $relation['module_a'],
|
||||||
|
// 'parent_type' => 1,
|
||||||
|
// 'child_type' => 1,
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
$relations = modules_get_relations(
|
||||||
[
|
[
|
||||||
'id_map' => $id_networkmap,
|
'id_agent' => $node['source_data'],
|
||||||
'x' => 666,
|
'networkmap' => true,
|
||||||
'y' => 666,
|
|
||||||
'z' => 0,
|
|
||||||
'deleted' => 0,
|
|
||||||
'type' => 1,
|
|
||||||
'refresh' => 0,
|
|
||||||
'source' => 0,
|
|
||||||
'source_data' => $relation['module_b'],
|
|
||||||
'style' => json_encode($style),
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$node_interface2 = db_get_row_filter(
|
|
||||||
'titem',
|
|
||||||
[
|
|
||||||
'id_map' => $id_networkmap,
|
|
||||||
'type' => 1,
|
|
||||||
'id' => $id_int1,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$node_agent1 = db_get_value(
|
|
||||||
'id',
|
|
||||||
'titem',
|
|
||||||
'source_data',
|
|
||||||
$agent_a
|
|
||||||
);
|
|
||||||
|
|
||||||
db_process_sql_insert(
|
|
||||||
'trel_item',
|
|
||||||
[
|
|
||||||
'id_map' => $id_networkmap,
|
|
||||||
'id_parent' => $node_agent1,
|
|
||||||
'id_child' => $node_interface1,
|
|
||||||
'id_parent-source_data' => $agent_a,
|
|
||||||
'id_child-source_data' => $relation['module_b'],
|
|
||||||
'parent_type' => 0,
|
|
||||||
'child_type' => 1,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$node_interface2 = $exist_node_interface2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($node_interface1) === false && empty($node_interface2) === false) {
|
|
||||||
if (is_array($node_interface1) === true) {
|
|
||||||
$node_interface1 = $node_interface1['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($node_interface2) === true) {
|
|
||||||
$node_interface2 = $node_interface2['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
db_process_sql_insert(
|
|
||||||
'trel_item',
|
|
||||||
[
|
|
||||||
'id_map' => $id_networkmap,
|
|
||||||
'id_parent' => $node_interface2,
|
|
||||||
'id_child' => $node_interface1,
|
|
||||||
'id_parent_source_data' => $relation['module_b'],
|
|
||||||
'id_child_source_data' => $relation['module_a'],
|
|
||||||
'parent_type' => 1,
|
|
||||||
'child_type' => 1,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$relations = modules_get_relations(['id_agent' => $node['source_data']]);
|
|
||||||
if ($relations === false) {
|
if ($relations === false) {
|
||||||
$relations = [];
|
$relations = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Relations Module <-> Module.
|
||||||
foreach ($relations as $key => $relation) {
|
foreach ($relations as $key => $relation) {
|
||||||
$module_a = $relation['module_a'];
|
$module_a = $relation['module_a'];
|
||||||
$agent_a = modules_get_agentmodule_agent($module_a);
|
$agent_a = modules_get_agentmodule_agent($module_a);
|
||||||
@ -4584,58 +4683,26 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (empty($exist) === true && empty($exist_reverse) === true) {
|
if (empty($exist) === true && empty($exist_reverse) === true) {
|
||||||
$style = [];
|
$item_a = db_get_value(
|
||||||
$style['id_agent'] = $agent_a;
|
'id',
|
||||||
$style['shape'] = 'circle';
|
|
||||||
$style['image'] = 'images/mod_snmp_proc.png';
|
|
||||||
$style['width'] = 50;
|
|
||||||
$style['height'] = 16;
|
|
||||||
$style['label'] = modules_get_agentmodule_name($module_a);
|
|
||||||
$id_int1 = db_process_sql_insert(
|
|
||||||
'titem',
|
'titem',
|
||||||
[
|
'source_data',
|
||||||
'id_map' => $id_networkmap,
|
$agent_a
|
||||||
'x' => 666,
|
|
||||||
'y' => 666,
|
|
||||||
'z' => 0,
|
|
||||||
'deleted' => 0,
|
|
||||||
'type' => 1,
|
|
||||||
'refresh' => 0,
|
|
||||||
'source' => 0,
|
|
||||||
'source_data' => $module_a,
|
|
||||||
'style' => json_encode($style),
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$style = [];
|
$item_b = db_get_value(
|
||||||
$style['id_agent'] = $agent_b;
|
'id',
|
||||||
$style['shape'] = 'circle';
|
|
||||||
$style['image'] = 'images/mod_snmp_proc.png';
|
|
||||||
$style['width'] = 50;
|
|
||||||
$style['height'] = 16;
|
|
||||||
$style['label'] = modules_get_agentmodule_name($module_b);
|
|
||||||
$id_int2 = db_process_sql_insert(
|
|
||||||
'titem',
|
'titem',
|
||||||
[
|
'source_data',
|
||||||
'id_map' => $id_networkmap,
|
$agent_b
|
||||||
'x' => 666,
|
|
||||||
'y' => 666,
|
|
||||||
'z' => 0,
|
|
||||||
'deleted' => 0,
|
|
||||||
'type' => 1,
|
|
||||||
'refresh' => 0,
|
|
||||||
'source' => 0,
|
|
||||||
'source_data' => $module_b,
|
|
||||||
'style' => json_encode($style),
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
db_process_sql_insert(
|
db_process_sql_insert(
|
||||||
'trel_item',
|
'trel_item',
|
||||||
[
|
[
|
||||||
'id_map' => $id_networkmap,
|
'id_map' => $id_networkmap,
|
||||||
'id_parent' => $id_int1,
|
'id_parent' => $item_a,
|
||||||
'id_child' => $id_int2,
|
'id_child' => $item_b,
|
||||||
'id_parent_source_data' => $module_a,
|
'id_parent_source_data' => $module_a,
|
||||||
'id_child_source_data' => $module_b,
|
'id_child_source_data' => $module_b,
|
||||||
'parent_type' => 1,
|
'parent_type' => 1,
|
||||||
@ -4644,6 +4711,30 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get L2 interface relations.
|
||||||
|
$interfaces = modules_get_interfaces(
|
||||||
|
$node['source_data'],
|
||||||
|
[
|
||||||
|
'id_agente',
|
||||||
|
'id_agente_modulo',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if (empty($interfaces) === true) {
|
||||||
|
$interfaces = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// hd('interfaces', true);
|
||||||
|
// foreach ($interfaces as $interface) {
|
||||||
|
// $relations = modules_get_relations(
|
||||||
|
// ['id_module' => $interface['id_agente_modulo']]
|
||||||
|
// );
|
||||||
|
// if (empty($relations) === true) {
|
||||||
|
// $relations = [];
|
||||||
|
// }
|
||||||
|
// foreach ($relations as $relation) {
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ function profile_delete_profile_and_clean_users($id_profile)
|
|||||||
* @param int User id
|
* @param int User id
|
||||||
* @param bool Show the tags select or not
|
* @param bool Show the tags select or not
|
||||||
*/
|
*/
|
||||||
function profile_print_profile_table($id)
|
function profile_print_profile_table($id, $json_profile=false, $return=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -243,8 +243,24 @@ function profile_print_profile_table($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
if ($json_profile !== false && empty($json_profile) !== true) {
|
||||||
|
$profile_decoded = json_decode($json_profile);
|
||||||
|
foreach ($profile_decoded as $profile) {
|
||||||
|
if (is_object($profile) === false) {
|
||||||
|
$profile = json_decode($profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result[] = [
|
||||||
|
'id_grupo' => $profile->group,
|
||||||
|
'id_perfil' => $profile->profile,
|
||||||
|
'tags' => $profile->tags,
|
||||||
|
'hierarchy' => $profile->hierarchy,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$result = [];
|
$result = [];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($result as $profile) {
|
foreach ($result as $profile) {
|
||||||
if ($profile['id_grupo'] == -1) {
|
if ($profile['id_grupo'] == -1) {
|
||||||
@ -268,7 +284,12 @@ function profile_print_profile_table($id)
|
|||||||
if (empty($profile['tags'])) {
|
if (empty($profile['tags'])) {
|
||||||
$data['tags'] = '';
|
$data['tags'] = '';
|
||||||
} else {
|
} else {
|
||||||
|
if (is_array($profile['tags'] === false)) {
|
||||||
$tags_ids = explode(',', $profile['tags']);
|
$tags_ids = explode(',', $profile['tags']);
|
||||||
|
} else {
|
||||||
|
$tags_ids = $profile['tags'];
|
||||||
|
}
|
||||||
|
|
||||||
$tags = tags_get_tags($tags_ids);
|
$tags = tags_get_tags($tags_ids);
|
||||||
$data['tags'] = tags_get_tags_formatted($tags);
|
$data['tags'] = tags_get_tags_formatted($tags);
|
||||||
}
|
}
|
||||||
@ -276,10 +297,10 @@ function profile_print_profile_table($id)
|
|||||||
$data['hierarchy'] = $profile['no_hierarchy'] ? __('Yes') : __('No');
|
$data['hierarchy'] = $profile['no_hierarchy'] ? __('Yes') : __('No');
|
||||||
|
|
||||||
$data['actions'] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
$data['actions'] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
||||||
|
$data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true);
|
||||||
$data['actions'] .= html_print_input_hidden('delete_profile', 1, true);
|
$data['actions'] .= html_print_input_hidden('delete_profile', 1, true);
|
||||||
$data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true);
|
$data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true);
|
||||||
$data['actions'] .= html_print_input_hidden('id_user', $id, true);
|
$data['actions'] .= html_print_input_hidden('id_user', $id, true);
|
||||||
$data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true);
|
|
||||||
$data['actions'] .= '</form>';
|
$data['actions'] .= '</form>';
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
@ -345,8 +366,7 @@ function profile_print_profile_table($id)
|
|||||||
$data['actions'] .= '</form>';
|
$data['actions'] .= '</form>';
|
||||||
|
|
||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
|
html_print_table($table, $return);
|
||||||
html_print_table($table);
|
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
@ -1409,6 +1409,7 @@ function custom_fields_macros_report($macro, $key_macro)
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of the reports the user can view.
|
* Get a list of the reports the user can view.
|
||||||
*
|
*
|
||||||
@ -1481,4 +1482,3 @@ function reports_get_report_templates(
|
|||||||
|
|
||||||
return $templates;
|
return $templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3402,7 +3402,7 @@ function ui_print_datatable(array $parameters)
|
|||||||
$filter .= '</li>';
|
$filter .= '</li>';
|
||||||
|
|
||||||
$filter .= '</ul><div id="both"></div></form>';
|
$filter .= '</ul><div id="both"></div></form>';
|
||||||
if (isset($parameters['form']['no_toggle']) === false && ($parameters['form']['no_toggle'] !== true)) {
|
if (isset($parameters['form']['no_toggle']) === false) {
|
||||||
$filter = ui_toggle(
|
$filter = ui_toggle(
|
||||||
$filter,
|
$filter,
|
||||||
__('Filter'),
|
__('Filter'),
|
||||||
@ -3466,7 +3466,10 @@ function ui_print_datatable(array $parameters)
|
|||||||
foreach ($names as $column) {
|
foreach ($names as $column) {
|
||||||
if (is_array($column)) {
|
if (is_array($column)) {
|
||||||
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
|
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
|
||||||
|
if (isset($column['title']) === true) {
|
||||||
$table .= 'title="'.__($column['title']).'" ';
|
$table .= 'title="'.__($column['title']).'" ';
|
||||||
|
}
|
||||||
|
|
||||||
$table .= ' style="'.$column['style'].'">'.__($column['text']);
|
$table .= ' style="'.$column['style'].'">'.__($column['text']);
|
||||||
$table .= $column['extra'];
|
$table .= $column['extra'];
|
||||||
$table .= '</th>';
|
$table .= '</th>';
|
||||||
@ -3655,7 +3658,7 @@ function ui_print_datatable(array $parameters)
|
|||||||
order: [[ '.$order.' ]]
|
order: [[ '.$order.' ]]
|
||||||
};
|
};
|
||||||
|
|
||||||
var dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
|
dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
|
||||||
|
|
||||||
$("#'.$form_id.'_search_bt").click(function (){
|
$("#'.$form_id.'_search_bt").click(function (){
|
||||||
dt_'.$table_id.'.draw().page(0)
|
dt_'.$table_id.'.draw().page(0)
|
||||||
|
@ -838,13 +838,14 @@ function users_has_profile_without_UM($id_user, $id_groups)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function users_get_user_profile($id_user)
|
function users_get_user_profile($id_user, $limit='')
|
||||||
{
|
{
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
"SELECT * FROM tusuario_perfil
|
"SELECT * FROM tusuario_perfil
|
||||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||||
WHERE tusuario_perfil.id_usuario like '%s'",
|
WHERE tusuario_perfil.id_usuario like '%s' %s",
|
||||||
$id_user
|
$id_user,
|
||||||
|
$limit
|
||||||
);
|
);
|
||||||
|
|
||||||
$aux = db_get_all_rows_sql($sql);
|
$aux = db_get_all_rows_sql($sql);
|
||||||
|
@ -3788,7 +3788,6 @@ function visual_map_get_user_layouts(
|
|||||||
unset($filter['can_manage_group_all']);
|
unset($filter['can_manage_group_all']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = '';
|
|
||||||
if ($check_user_groups === true && !empty($groups)) {
|
if ($check_user_groups === true && !empty($groups)) {
|
||||||
if (empty($where)) {
|
if (empty($where)) {
|
||||||
$where = '';
|
$where = '';
|
||||||
|
@ -192,7 +192,8 @@ function delete_link(
|
|||||||
source_module_id,
|
source_module_id,
|
||||||
target_id,
|
target_id,
|
||||||
target_module_id,
|
target_module_id,
|
||||||
id_link
|
id_link,
|
||||||
|
table_row = null
|
||||||
) {
|
) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("delete_link=1");
|
params.push("delete_link=1");
|
||||||
@ -241,8 +242,22 @@ function delete_link(
|
|||||||
draw_elements_graph();
|
draw_elements_graph();
|
||||||
init_drag_and_drop();
|
init_drag_and_drop();
|
||||||
set_positions_graph();
|
set_positions_graph();
|
||||||
|
|
||||||
|
if (typeof table_row !== "undefined" && table_row !== null) {
|
||||||
|
$(`#relations_table-template_row_${table_row}`).animate(
|
||||||
|
{ backgroundColor: "#e6e6e6" },
|
||||||
|
500,
|
||||||
|
function() {
|
||||||
|
$(`#relations_table-template_row_${table_row}`).remove();
|
||||||
|
const rowCount = $(".relation_link_row").length;
|
||||||
|
if (rowCount === 0) {
|
||||||
|
$("#relations_table-no_relations").show();
|
||||||
|
$(`#update_relations_button`).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$("#dialog_node_edit").dialog("close");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -378,11 +393,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -419,11 +430,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -446,11 +453,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -487,11 +490,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -515,11 +514,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -556,11 +551,7 @@ function change_shape(id_db_node) {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -607,6 +598,10 @@ function update_link(row_index, id_link) {
|
|||||||
$(".edit_icon_progress_" + row_index).css("display", "");
|
$(".edit_icon_progress_" + row_index).css("display", "");
|
||||||
$(".edit_icon_" + row_index).css("display", "none");
|
$(".edit_icon_" + row_index).css("display", "none");
|
||||||
|
|
||||||
|
$(".edit_icon_" + row_index).css("display", "none");
|
||||||
|
|
||||||
|
let result = false;
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("update_link=1");
|
params.push("update_link=1");
|
||||||
params.push("networkmap_id=" + networkmap_id);
|
params.push("networkmap_id=" + networkmap_id);
|
||||||
@ -621,6 +616,7 @@ function update_link(row_index, id_link) {
|
|||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
async: false,
|
||||||
url: window.base_url_homedir + "/ajax.php",
|
url: window.base_url_homedir + "/ajax.php",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(".edit_icon_progress_" + row_index).css("display", "none");
|
$(".edit_icon_progress_" + row_index).css("display", "none");
|
||||||
@ -726,11 +722,14 @@ function update_link(row_index, id_link) {
|
|||||||
draw_elements_graph();
|
draw_elements_graph();
|
||||||
init_drag_and_drop();
|
init_drag_and_drop();
|
||||||
set_positions_graph();
|
set_positions_graph();
|
||||||
|
result = data["id_db_link"];
|
||||||
} else {
|
} else {
|
||||||
$(".edit_icon_fail_" + row_index).css("display", "");
|
$(".edit_icon_fail_" + row_index).css("display", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_link_from_id(index) {
|
function delete_link_from_id(index) {
|
||||||
@ -826,6 +825,35 @@ function edit_node(data_node, dblClick) {
|
|||||||
"update_node_name(" + node_selected.id_db + ");"
|
"update_node_name(" + node_selected.id_db + ");"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (node_selected.type === "3") {
|
||||||
|
$("#node_details-0-0").html("<strong>Link to map</strong>");
|
||||||
|
if (node_selected.networkmap_id > 0) {
|
||||||
|
$("#node_details-0-1").html(
|
||||||
|
'<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=' +
|
||||||
|
node_selected.networkmap_id +
|
||||||
|
'">' +
|
||||||
|
$(
|
||||||
|
`#edit_networkmap_to_link option[value='${node_selected.networkmap_id}']`
|
||||||
|
).text() +
|
||||||
|
"</a>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$("#node_details-0-1").html(
|
||||||
|
$(
|
||||||
|
`#edit_networkmap_to_link option[value='${node_selected.networkmap_id}']`
|
||||||
|
).text()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#node_details-1").hide();
|
||||||
|
$("#node_details-2").hide();
|
||||||
|
$("#node_details-3").hide();
|
||||||
|
} else {
|
||||||
|
$("#node_details-0-0").html("<strong>Agent</strong>");
|
||||||
|
$("#node_details-1").show();
|
||||||
|
$("#node_details-2").show();
|
||||||
|
$("#node_details-3").show();
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("get_agent_info=1");
|
params.push("get_agent_info=1");
|
||||||
params.push("id_agent=" + node_selected["id_agent"]);
|
params.push("id_agent=" + node_selected["id_agent"]);
|
||||||
@ -871,6 +899,7 @@ function edit_node(data_node, dblClick) {
|
|||||||
get_interface_data_to_table(node_selected, selected_links);
|
get_interface_data_to_table(node_selected, selected_links);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$("#dialog_node_edit").dialog(
|
$("#dialog_node_edit").dialog(
|
||||||
"option",
|
"option",
|
||||||
@ -887,6 +916,7 @@ function edit_node(data_node, dblClick) {
|
|||||||
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
||||||
$("#node_options-fictional_node_networkmap_link").css("display", "");
|
$("#node_options-fictional_node_networkmap_link").css("display", "");
|
||||||
$("#edit_networkmap_to_link").val(node_selected.networkmap_id);
|
$("#edit_networkmap_to_link").val(node_selected.networkmap_id);
|
||||||
|
$("#edit_networkmap_to_link").trigger("change");
|
||||||
$("#node_options-fictional_node_update_button").css("display", "");
|
$("#node_options-fictional_node_update_button").css("display", "");
|
||||||
$("#node_options-node_name").css("display", "none");
|
$("#node_options-node_name").css("display", "none");
|
||||||
$("#node_options-node_update_button").css("display", "none");
|
$("#node_options-node_update_button").css("display", "none");
|
||||||
@ -957,6 +987,7 @@ function get_interface_data_to_table(node_selected, selected_links) {
|
|||||||
function load_interfaces(selected_links) {
|
function load_interfaces(selected_links) {
|
||||||
//Clean
|
//Clean
|
||||||
$("#relations_table .relation_link_row").remove();
|
$("#relations_table .relation_link_row").remove();
|
||||||
|
$("#update_relations_button").remove();
|
||||||
//Show the no relations
|
//Show the no relations
|
||||||
$("#relations_table-loading").css("display", "none");
|
$("#relations_table-loading").css("display", "none");
|
||||||
$("#relations_table-no_relations").css("display", "");
|
$("#relations_table-no_relations").css("display", "");
|
||||||
@ -969,6 +1000,7 @@ function load_interfaces(selected_links) {
|
|||||||
|
|
||||||
$(template_relation_row).css("display", "");
|
$(template_relation_row).css("display", "");
|
||||||
$(template_relation_row).attr("class", "relation_link_row");
|
$(template_relation_row).attr("class", "relation_link_row");
|
||||||
|
$(template_relation_row).attr("id", `relations_table-template_row_${i}`);
|
||||||
|
|
||||||
$("select[name='interface_source']", template_relation_row)
|
$("select[name='interface_source']", template_relation_row)
|
||||||
.attr("name", "interface_source_" + i)
|
.attr("name", "interface_source_" + i)
|
||||||
@ -989,11 +1021,6 @@ function load_interfaces(selected_links) {
|
|||||||
"class",
|
"class",
|
||||||
"edit_icon_fail_" + i
|
"edit_icon_fail_" + i
|
||||||
);
|
);
|
||||||
$(".edit_icon_link", template_relation_row)
|
|
||||||
.attr("class", "edit_icon_link_" + i)
|
|
||||||
.click(function() {
|
|
||||||
update_link(i, link_each.id_db);
|
|
||||||
});
|
|
||||||
|
|
||||||
var params3 = [];
|
var params3 = [];
|
||||||
params3.push("get_intefaces=1");
|
params3.push("get_intefaces=1");
|
||||||
@ -1093,6 +1120,17 @@ function load_interfaces(selected_links) {
|
|||||||
"align",
|
"align",
|
||||||
"center"
|
"center"
|
||||||
);
|
);
|
||||||
|
$("#relations_table-template_row-edit", template_relation_row).css({
|
||||||
|
display: "flex",
|
||||||
|
"align-items": "center",
|
||||||
|
"justify-content": "center"
|
||||||
|
});
|
||||||
|
|
||||||
|
$(
|
||||||
|
"#relations_table-template_row-edit .delete_icon",
|
||||||
|
template_relation_row
|
||||||
|
).attr("id", `delete_icon_${i}`);
|
||||||
|
|
||||||
$(
|
$(
|
||||||
"#relations_table-template_row-edit .delete_icon",
|
"#relations_table-template_row-edit .delete_icon",
|
||||||
template_relation_row
|
template_relation_row
|
||||||
@ -1109,6 +1147,8 @@ function load_interfaces(selected_links) {
|
|||||||
link_each.id_module_end +
|
link_each.id_module_end +
|
||||||
"," +
|
"," +
|
||||||
link_each.id_db +
|
link_each.id_db +
|
||||||
|
"," +
|
||||||
|
i +
|
||||||
");"
|
");"
|
||||||
);
|
);
|
||||||
$("#relations_table tbody").append(template_relation_row);
|
$("#relations_table tbody").append(template_relation_row);
|
||||||
@ -1119,6 +1159,42 @@ function load_interfaces(selected_links) {
|
|||||||
|
|
||||||
template_relation_row = null;
|
template_relation_row = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (selected_links.length > 0) {
|
||||||
|
$("#relations_table")
|
||||||
|
.parent()
|
||||||
|
.append(
|
||||||
|
`<div class='action-buttons w100p'>
|
||||||
|
<input id='update_relations_button' class='sub upd' type='button' value='update relations'>
|
||||||
|
</div>`
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#update_relations_button").click(function() {
|
||||||
|
jQuery.each(selected_links, function(i, link_each) {
|
||||||
|
const new_id_db = update_link(i, link_each.id_db);
|
||||||
|
if (new_id_db !== false) {
|
||||||
|
selected_links[i]["id_db"] = new_id_db;
|
||||||
|
$(`#delete_icon_${i}`).attr(
|
||||||
|
"href",
|
||||||
|
"javascript: " +
|
||||||
|
"delete_link(" +
|
||||||
|
link_each.source.id_db +
|
||||||
|
"," +
|
||||||
|
link_each.id_module_start +
|
||||||
|
"," +
|
||||||
|
link_each.target.id_db +
|
||||||
|
"," +
|
||||||
|
link_each.id_module_end +
|
||||||
|
"," +
|
||||||
|
new_id_db +
|
||||||
|
"," +
|
||||||
|
i +
|
||||||
|
");"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_node() {
|
function add_node() {
|
||||||
@ -1303,11 +1379,6 @@ function function_close_minimap() {
|
|||||||
function delete_nodes() {
|
function delete_nodes() {
|
||||||
var selection = d3.selectAll(".node_selected");
|
var selection = d3.selectAll(".node_selected");
|
||||||
selection.each(function(d) {
|
selection.each(function(d) {
|
||||||
//Avoid to delete pandora node center
|
|
||||||
if (d.id_agent == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("id=" + d.id_db);
|
params.push("id=" + d.id_db);
|
||||||
params.push("delete_node=1");
|
params.push("delete_node=1");
|
||||||
@ -1973,8 +2044,6 @@ function show_menu(item, data) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid deletion if Pandora FMS node.
|
|
||||||
if (data.type != 2) {
|
|
||||||
items_list["delete"] = {
|
items_list["delete"] = {
|
||||||
name: delete_menu,
|
name: delete_menu,
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
@ -1983,7 +2052,6 @@ function show_menu(item, data) {
|
|||||||
delete_nodes();
|
delete_nodes();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
$.contextMenu("destroy");
|
$.contextMenu("destroy");
|
||||||
$.contextMenu({
|
$.contextMenu({
|
||||||
@ -2030,15 +2098,7 @@ function show_menu(item, data) {
|
|||||||
icon: "refresh",
|
icon: "refresh",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
callback: function(key, options) {
|
callback: function(key, options) {
|
||||||
update_networkmap();
|
refresh();
|
||||||
}
|
|
||||||
};
|
|
||||||
items_list["refresh_holding_area"] = {
|
|
||||||
name: refresh_holding_area_menu,
|
|
||||||
icon: "refresh_holding_area",
|
|
||||||
disabled: false,
|
|
||||||
callback: function(key, options) {
|
|
||||||
refresh_holding_area();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
items_list["restart_map"] = {
|
items_list["restart_map"] = {
|
||||||
@ -2398,6 +2458,99 @@ function refresh_holding_area() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
$("#spinner_networkmap").css("display", "flex");
|
||||||
|
var holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
||||||
|
var holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
||||||
|
|
||||||
|
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
||||||
|
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
params.push("refresh_holding_area=1");
|
||||||
|
params.push("id=" + networkmap_id);
|
||||||
|
params.push("x=" + pos_x);
|
||||||
|
params.push("y=" + pos_y);
|
||||||
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
|
$.ajax({
|
||||||
|
data: {
|
||||||
|
page: "operation/agentes/pandora_networkmap.view",
|
||||||
|
refresh_holding_area: 1,
|
||||||
|
id: networkmap_id,
|
||||||
|
x: pos_x,
|
||||||
|
y: pos_y
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
type: "POST",
|
||||||
|
url: window.base_url_homedir + "/ajax.php",
|
||||||
|
success: function(data) {
|
||||||
|
if (data["correct"]) {
|
||||||
|
const array_nodes = data["holding_area"]["nodes"];
|
||||||
|
let array_links = data["holding_area"]["links"];
|
||||||
|
jQuery.each(graph.links, function(j, g_link) {
|
||||||
|
for (var i = 0; i < array_links.length; i++) {
|
||||||
|
if (g_link["id_db"] == array_links[i]["id_db"]) {
|
||||||
|
array_links.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let location = "";
|
||||||
|
if ($("#main").height()) {
|
||||||
|
location = `index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=${networkmap_id}`;
|
||||||
|
} else {
|
||||||
|
location = `index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&pure=1&id_networkmap=${networkmap_id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_nodes.length === 0 && array_links.length === 0) {
|
||||||
|
update_networkmap();
|
||||||
|
$("#spinner_networkmap").css("display", "none");
|
||||||
|
startCountDown(refresh_time);
|
||||||
|
} else {
|
||||||
|
if (array_nodes.length > 0) {
|
||||||
|
$.ajax({
|
||||||
|
data: {
|
||||||
|
page: "operation/agentes/pandora_networkmap.view",
|
||||||
|
refresh_map: 1,
|
||||||
|
id: networkmap_id
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
type: "POST",
|
||||||
|
url: window.base_url_homedir + "/ajax.php",
|
||||||
|
success: function(data) {
|
||||||
|
$("#spinner_networkmap").css("display", "none");
|
||||||
|
window.location = location;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (array_links.length > 0) {
|
||||||
|
$("#spinner_networkmap").css("display", "none");
|
||||||
|
window.location = location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
$("#spinner_networkmap").css("display", "none");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function startCountDown(duration) {
|
||||||
|
$("div.vc-countdown").countdown("destroy");
|
||||||
|
if (!duration) return;
|
||||||
|
var t = new Date();
|
||||||
|
t.setTime(t.getTime() + duration * 1000);
|
||||||
|
$("div.vc-countdown").countdown({
|
||||||
|
until: t,
|
||||||
|
format: "MS",
|
||||||
|
layout: "(%M%nn%M:%S%nn%S Until refreshed) ",
|
||||||
|
alwaysExpire: true,
|
||||||
|
onExpiry: function() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function restart_map() {
|
function restart_map() {
|
||||||
$(
|
$(
|
||||||
"<div id='restart_map_confirm' class='dialog ui-dialog-content' title='" +
|
"<div id='restart_map_confirm' class='dialog ui-dialog-content' title='" +
|
||||||
@ -2935,6 +3088,10 @@ function init_graph(parameter_object) {
|
|||||||
window.url_background_grid = "";
|
window.url_background_grid = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof parameter_object.refresh_time != "undefined") {
|
||||||
|
window.refresh_time = parameter_object.refresh_time;
|
||||||
|
}
|
||||||
|
|
||||||
var rect_center_x = graph.nodes[0].x;
|
var rect_center_x = graph.nodes[0].x;
|
||||||
var rect_center_y = graph.nodes[0].y;
|
var rect_center_y = graph.nodes[0].y;
|
||||||
|
|
||||||
@ -3644,11 +3801,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -3685,11 +3838,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -3721,11 +3870,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -3767,11 +3912,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -3804,11 +3945,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
@ -3850,11 +3987,7 @@ function draw_elements_graph() {
|
|||||||
})
|
})
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
.on("dblclick", function(d) {
|
.on("dblclick", function(d) {
|
||||||
if (d.type == 3) {
|
|
||||||
move_to_networkmap(d);
|
|
||||||
} else {
|
|
||||||
edit_node(d, true);
|
edit_node(d, true);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.on("contextmenu", function(d) {
|
.on("contextmenu", function(d) {
|
||||||
show_menu("node", d);
|
show_menu("node", d);
|
||||||
|
@ -886,7 +886,6 @@ function period_select_init(name, allow_zero) {
|
|||||||
// Manual mode is hidden by default
|
// Manual mode is hidden by default
|
||||||
$("#" + name + "_manual").css("display", "none");
|
$("#" + name + "_manual").css("display", "none");
|
||||||
$("#" + name + "_default").css("display", "inline");
|
$("#" + name + "_default").css("display", "inline");
|
||||||
|
|
||||||
// If the text input is empty, we put on it 5 minutes by default
|
// If the text input is empty, we put on it 5 minutes by default
|
||||||
if ($("#text-" + name + "_text").val() == "") {
|
if ($("#text-" + name + "_text").val() == "") {
|
||||||
$("#text-" + name + "_text").val(300);
|
$("#text-" + name + "_text").val(300);
|
||||||
@ -897,7 +896,7 @@ function period_select_init(name, allow_zero) {
|
|||||||
} else {
|
} else {
|
||||||
$("#" + name + "_select option:eq(1)").prop("selected", true);
|
$("#" + name + "_select option:eq(1)").prop("selected", true);
|
||||||
}
|
}
|
||||||
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) {
|
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero == 1) {
|
||||||
$("#" + name + "_units option:last").prop("selected", false);
|
$("#" + name + "_units option:last").prop("selected", false);
|
||||||
$("#" + name + "_manual").css("display", "inline");
|
$("#" + name + "_manual").css("display", "inline");
|
||||||
$("#" + name + "_default").css("display", "none");
|
$("#" + name + "_default").css("display", "none");
|
||||||
@ -1041,10 +1040,10 @@ function adjustTextUnits(name) {
|
|||||||
var restInt = parseInt(rest).toString();
|
var restInt = parseInt(rest).toString();
|
||||||
|
|
||||||
if (rest != restInt && unitsSelected == false) {
|
if (rest != restInt && unitsSelected == false) {
|
||||||
$("#" + name + "_units option:eq(" + ($(this).index() - 1) + ")").prop(
|
var value_selected = $(
|
||||||
"selected",
|
"#" + name + "_units option:eq(" + ($(this).index() - 1) + ")"
|
||||||
true
|
).val();
|
||||||
);
|
$("#" + name + "_units").val(value_selected);
|
||||||
|
|
||||||
$("#text-" + name + "_text").val(restPrev);
|
$("#text-" + name + "_text").val(restPrev);
|
||||||
unitsSelected = true;
|
unitsSelected = true;
|
||||||
|
@ -85,29 +85,6 @@ function show_event_dialog(event, dialog_page) {
|
|||||||
$("#refrcounter").countdown("pause");
|
$("#refrcounter").countdown("pause");
|
||||||
$("div.vc-countdown").countdown("pause");
|
$("div.vc-countdown").countdown("pause");
|
||||||
|
|
||||||
/*
|
|
||||||
switch (result) {
|
|
||||||
case "comment_ok":
|
|
||||||
$("#notification_comment_success").show();
|
|
||||||
break;
|
|
||||||
case "comment_error":
|
|
||||||
$("#notification_comment_error").show();
|
|
||||||
break;
|
|
||||||
case "status_ok":
|
|
||||||
$("#notification_status_success").show();
|
|
||||||
break;
|
|
||||||
case "status_error":
|
|
||||||
$("#notification_status_error").show();
|
|
||||||
break;
|
|
||||||
case "owner_ok":
|
|
||||||
$("#notification_owner_success").show();
|
|
||||||
break;
|
|
||||||
case "owner_error":
|
|
||||||
$("#notification_owner_error").show();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
forced_title_callback();
|
forced_title_callback();
|
||||||
},
|
},
|
||||||
"html"
|
"html"
|
||||||
@ -119,37 +96,152 @@ function show_event_dialog(event, dialog_page) {
|
|||||||
function execute_response(event_id, server_id) {
|
function execute_response(event_id, server_id) {
|
||||||
var response_id = $("#select_custom_response option:selected").val();
|
var response_id = $("#select_custom_response option:selected").val();
|
||||||
|
|
||||||
var response = get_response(response_id, server_id);
|
var response_parameters_list = $('input[name^="values_params_"]');
|
||||||
|
var response_parameters = [];
|
||||||
// If cannot get response abort it
|
if (response_parameters_list.length > 0) {
|
||||||
if (response == null) {
|
response_parameters_list.each(function() {
|
||||||
return;
|
var acum = {
|
||||||
|
name: $(this).attr("name"),
|
||||||
|
value: $(this).val()
|
||||||
|
};
|
||||||
|
response_parameters.push(acum);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
|
params.push({ name: "get_response", value: 1 });
|
||||||
|
params.push({ name: "response_id", value: response_id });
|
||||||
|
params.push({ name: "server_id", value: server_id });
|
||||||
|
params.push({ name: "event_id", value: event_id });
|
||||||
|
params.push({
|
||||||
|
name: "response_parameters",
|
||||||
|
value: JSON.stringify(response_parameters)
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response) {
|
||||||
|
// If cannot get response abort it
|
||||||
|
if (response == null) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
response["target"] = get_response_target(event_id, response_id, server_id);
|
|
||||||
response["event_id"] = event_id;
|
response["event_id"] = event_id;
|
||||||
response["server_id"] = server_id;
|
response["server_id"] = server_id;
|
||||||
|
|
||||||
if (response["type"] == "url" && response["new_window"] == 1) {
|
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||||
window.open(response["target"], "_blank");
|
window.open(response["target"], "_blank");
|
||||||
} else {
|
} else {
|
||||||
show_response_dialog(response_id, response);
|
show_response_dialog(response_id, response);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the response type and open it in a modal dialog or new window
|
||||||
|
function execute_response_massive(events, response_id, response_parameters) {
|
||||||
|
var params = [];
|
||||||
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
|
params.push({ name: "get_response_massive", value: 1 });
|
||||||
|
params.push({ name: "response_id", value: response_id });
|
||||||
|
params.push({ name: "events", value: JSON.stringify(events) });
|
||||||
|
params.push({ name: "response_parameters", value: response_parameters });
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
// If cannot get response abort it
|
||||||
|
if (data == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".container-massive-events-response").empty();
|
||||||
|
|
||||||
|
// Convert to array.
|
||||||
|
var array_data = Object.entries(data.event_response_targets);
|
||||||
|
var total_count = array_data.length;
|
||||||
|
|
||||||
|
// Each input checkeds.
|
||||||
|
array_data.forEach(function(element, index) {
|
||||||
|
var id = element[0];
|
||||||
|
var target = element[1].target;
|
||||||
|
var meta = $("#hidden-meta").val();
|
||||||
|
var event_id = id;
|
||||||
|
var server_id = 0;
|
||||||
|
if (meta != 0) {
|
||||||
|
var split_id = id.split("|");
|
||||||
|
event_id = split_id[0];
|
||||||
|
server_id = split_id[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = 0;
|
||||||
|
if (total_count - 1 === index) {
|
||||||
|
end = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = data.event_response;
|
||||||
|
response["event_id"] = event_id;
|
||||||
|
response["server_id"] = server_id;
|
||||||
|
response["target"] = target;
|
||||||
|
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||||
|
window.open(response["target"], "_blank");
|
||||||
|
} else {
|
||||||
|
var params = [];
|
||||||
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
|
params.push({ name: "get_row_response_action", value: 1 });
|
||||||
|
params.push({ name: "response_id", value: response_id });
|
||||||
|
params.push({ name: "server_id", value: response.server_id });
|
||||||
|
params.push({ name: "end", value: end });
|
||||||
|
params.push({ name: "response", value: JSON.stringify(response) });
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "html",
|
||||||
|
success: function(data) {
|
||||||
|
$(".container-massive-events-response").append(data);
|
||||||
|
response["event_id"] = event_id;
|
||||||
|
response["server_id"] = server_id;
|
||||||
|
response["target"] = target;
|
||||||
|
|
||||||
|
var indexstr = event_id;
|
||||||
|
if (meta != 0) {
|
||||||
|
indexstr += "-" + server_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
perform_response(
|
||||||
|
btoa(JSON.stringify(response)),
|
||||||
|
response_id,
|
||||||
|
indexstr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Show the modal window of an event response
|
//Show the modal window of an event response
|
||||||
function show_response_dialog(response_id, response) {
|
function show_response_dialog(response_id, response) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("page=include/ajax/events");
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
params.push("dialogue_event_response=1");
|
params.push({ name: "dialogue_event_response", value: 1 });
|
||||||
params.push("massive=0");
|
params.push({ name: "event_id", value: response.event_id });
|
||||||
params.push("event_id=" + response["event_id"]);
|
params.push({ name: "target", value: response.target });
|
||||||
params.push("target=" + encodeURIComponent(response["target"]));
|
params.push({ name: "response_id", value: response_id });
|
||||||
params.push("response_id=" + response_id);
|
params.push({ name: "server_id", value: response.server_id });
|
||||||
params.push("server_id=" + response["server_id"]);
|
params.push({ name: "response", value: JSON.stringify(response) });
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: $("#hidden-ajax_file").val(),
|
url: $("#hidden-ajax_file").val(),
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
@ -164,271 +256,49 @@ function show_response_dialog(response_id, response) {
|
|||||||
draggable: true,
|
draggable: true,
|
||||||
modal: false,
|
modal: false,
|
||||||
open: function() {
|
open: function() {
|
||||||
perform_response(response, response_id);
|
perform_response(btoa(JSON.stringify(response)), response_id, "");
|
||||||
},
|
},
|
||||||
width: response["modal_width"],
|
width: response["modal_width"],
|
||||||
height: response["modal_height"]
|
height: response["modal_height"],
|
||||||
|
buttons: []
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Show the modal window of event responses when multiple events are selected
|
|
||||||
function show_massive_response_dialog(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
out_iterator,
|
|
||||||
end
|
|
||||||
) {
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("dialogue_event_response=1");
|
|
||||||
params.push("massive=1");
|
|
||||||
params.push("end=" + end);
|
|
||||||
params.push("out_iterator=" + out_iterator);
|
|
||||||
params.push("event_id=" + response["event_id"]);
|
|
||||||
params.push("target=" + response["target"]);
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
params.push("server_id=" + response["server_id"]);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
response_tg: response,
|
|
||||||
response_id: response_id,
|
|
||||||
out_iterator: out_iterator,
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
dataType: "html",
|
|
||||||
success: function(data) {
|
|
||||||
if (out_iterator === 0) $("#event_response_window").empty();
|
|
||||||
|
|
||||||
$("#event_response_window")
|
|
||||||
.hide()
|
|
||||||
.append(data)
|
|
||||||
.dialog({
|
|
||||||
title: $("#select_custom_response option:selected").html(),
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: false,
|
|
||||||
open: function() {
|
|
||||||
$("#response_loading_dialog").hide();
|
|
||||||
$("#button-submit_event_response").show();
|
|
||||||
},
|
|
||||||
close: function() {
|
|
||||||
$("#checkbox-all_validate_box").prop("checked", false);
|
|
||||||
$(".chk_val").prop("checked", false);
|
|
||||||
},
|
|
||||||
width: response["modal_width"],
|
|
||||||
height: response["modal_height"]
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
|
|
||||||
perform_response_massive(
|
|
||||||
this.response_tg,
|
|
||||||
this.response_id,
|
|
||||||
this.out_iterator
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get an event response from db
|
|
||||||
function get_response(response_id, server_id) {
|
|
||||||
var response = "";
|
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("get_response=1");
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
params.push("server_id=" + server_id);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
async: false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
response = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get an event response params from db
|
|
||||||
function get_response_params(response_id) {
|
|
||||||
var response_params;
|
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("get_response_params=1");
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
async: false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
response_params = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return response_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get an event response description from db
|
|
||||||
function get_response_description(response_id) {
|
|
||||||
var response_description = "";
|
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("get_response_description=1");
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
async: false,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(data) {
|
|
||||||
response_description = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return response_description;
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_row_param(id_table, param) {
|
|
||||||
$("#" + id_table).append(
|
|
||||||
'<tr class="params_rows"><td style="text-align:left; padding-left:40px; font-weight: normal; font-style: italic;">' +
|
|
||||||
param +
|
|
||||||
'</td><td style="text-align:left" colspan="2"><input type="text" name="' +
|
|
||||||
param +
|
|
||||||
'" id="' +
|
|
||||||
param +
|
|
||||||
'"></td></tr>'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get an event response from db
|
|
||||||
function get_response_target(
|
|
||||||
event_id,
|
|
||||||
response_id,
|
|
||||||
server_id,
|
|
||||||
response_command
|
|
||||||
) {
|
|
||||||
var target = "";
|
|
||||||
|
|
||||||
// Replace the main macros
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("get_response_target=1");
|
|
||||||
params.push("event_id=" + event_id);
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
params.push("server_id=" + server_id);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
async: false,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(data) {
|
|
||||||
target = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Replace the custom params macros.
|
|
||||||
var response_params = get_response_params(response_id);
|
|
||||||
if (response_params.length > 1 || response_params[0] != "") {
|
|
||||||
for (var i = 0; i < response_params.length; i++) {
|
|
||||||
if (!response_command) {
|
|
||||||
var response_param = "_" + response_params[i] + "_";
|
|
||||||
|
|
||||||
if (
|
|
||||||
response_params[i].startsWith("_") &&
|
|
||||||
response_params[i].endsWith("_")
|
|
||||||
) {
|
|
||||||
response_param = response_params[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
target = target.replace(
|
|
||||||
response_param,
|
|
||||||
$("#" + response_params[i]).val()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
target = target.replace(
|
|
||||||
"_" + response_params[i] + "_",
|
|
||||||
response_command[response_params[i] + "-" + i]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform a response and put the output into a div
|
// Perform a response and put the output into a div
|
||||||
function perform_response(response, response_id) {
|
function perform_response(response, response_id, index) {
|
||||||
$("#re_exec_command").hide();
|
$("#re_exec_command" + index).hide();
|
||||||
$("#response_loading_command").show();
|
$("#response_loading_command" + index).show();
|
||||||
$("#response_out").html("");
|
$("#response_out" + index).html("");
|
||||||
|
|
||||||
|
try {
|
||||||
|
response = JSON.parse(atob(response));
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("page=include/ajax/events");
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
params.push("perform_event_response=1");
|
params.push({ name: "perform_event_response", value: 1 });
|
||||||
params.push("target=" + encodeURIComponent(response["target"]));
|
params.push({ name: "target", value: response["target"] });
|
||||||
params.push("response_id=" + response_id);
|
params.push({ name: "response_id", value: response_id });
|
||||||
params.push("event_id=" + response["event_id"]);
|
params.push({ name: "event_id", value: response["event_id"] });
|
||||||
params.push("server_id=" + response["server_id"]);
|
params.push({ name: "server_id", value: response["server_id"] });
|
||||||
|
params.push({ name: "response", value: JSON.stringify(response) });
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: $("#hidden-ajax_file").val(),
|
url: $("#hidden-ajax_file").val(),
|
||||||
async: true,
|
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||||
$("#response_out").html(out);
|
$("#response_out" + index).html(out);
|
||||||
$("#response_loading_command").hide();
|
$("#response_loading_command" + index).hide();
|
||||||
$("#re_exec_command").show();
|
$("#re_exec_command" + index).show();
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform a response and put the output into a div
|
|
||||||
function perform_response_massive(response, response_id, out_iterator) {
|
|
||||||
$("#re_exec_command").hide();
|
|
||||||
$("#response_loading_command_" + out_iterator).show();
|
|
||||||
$("#response_out_" + out_iterator).html("");
|
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("perform_event_response=1");
|
|
||||||
params.push("target=" + response["target"]);
|
|
||||||
params.push("response_id=" + response_id);
|
|
||||||
params.push("event_id=" + response["event_id"]);
|
|
||||||
params.push("server_id=" + response["server_id"]);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
async: true,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(data) {
|
|
||||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
|
||||||
$("#response_out_" + out_iterator).html(out);
|
|
||||||
$("#response_loading_command_" + out_iterator).hide();
|
|
||||||
$("#re_exec_command_" + out_iterator).show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -600,54 +470,6 @@ function event_comment(current_event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_event_response_command_dialog(id, response, total_checked) {
|
|
||||||
var params = [];
|
|
||||||
params.push("page=include/ajax/events");
|
|
||||||
params.push("get_table_response_command=1");
|
|
||||||
params.push("event_response_id=" + id);
|
|
||||||
|
|
||||||
jQuery.ajax({
|
|
||||||
data: params.join("&"),
|
|
||||||
type: "POST",
|
|
||||||
url: $("#hidden-ajax_file").val(),
|
|
||||||
dataType: "html",
|
|
||||||
success: function(data) {
|
|
||||||
$("#event_response_command_window")
|
|
||||||
.hide()
|
|
||||||
.empty()
|
|
||||||
.append(data)
|
|
||||||
.dialog({
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: false,
|
|
||||||
open: function() {
|
|
||||||
$("#response_loading_dialog").hide();
|
|
||||||
$("#button-submit_event_response").show();
|
|
||||||
},
|
|
||||||
width: 600,
|
|
||||||
height: 300
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
|
|
||||||
$("#submit-enter_command").on("click", function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var response_command = [];
|
|
||||||
|
|
||||||
$(".response_command_input").each(function() {
|
|
||||||
response_command[$(this).attr("name")] = $(this).val();
|
|
||||||
});
|
|
||||||
|
|
||||||
check_massive_response_event(
|
|
||||||
id,
|
|
||||||
response,
|
|
||||||
total_checked,
|
|
||||||
response_command
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var processed = 0;
|
var processed = 0;
|
||||||
function update_event(table, id_evento, type, event_rep, row, server_id) {
|
function update_event(table, id_evento, type, event_rep, row, server_id) {
|
||||||
var inputs = $("#events_form :input");
|
var inputs = $("#events_form :input");
|
||||||
@ -820,8 +642,13 @@ function execute_delete_event_reponse(
|
|||||||
|
|
||||||
// Imported from old files.
|
// Imported from old files.
|
||||||
function execute_event_response(event_list_btn) {
|
function execute_event_response(event_list_btn) {
|
||||||
|
var response_id = $("select[name=response_id]").val();
|
||||||
|
if (!isNaN(response_id)) {
|
||||||
|
table_info_response_event(response_id, 0, 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
var message =
|
var message =
|
||||||
"<h4 style = 'text-align: center; color:black' > Are you sure?</h4> ";
|
"<h4 style = 'text-align: center; color:black' > Are you sure?</h4> <div id='massive-parameters-response'></div> ";
|
||||||
confirmDialog({
|
confirmDialog({
|
||||||
title: "ATTENTION",
|
title: "ATTENTION",
|
||||||
message: message,
|
message: message,
|
||||||
@ -833,8 +660,6 @@ function execute_event_response(event_list_btn) {
|
|||||||
$("#max_custom_event_resp_msg").hide();
|
$("#max_custom_event_resp_msg").hide();
|
||||||
$("#max_custom_selected").hide();
|
$("#max_custom_selected").hide();
|
||||||
|
|
||||||
var response_id = $("select[name=response_id]").val();
|
|
||||||
|
|
||||||
var total_checked = $(".chk_val:checked").length;
|
var total_checked = $(".chk_val:checked").length;
|
||||||
|
|
||||||
// Check select an event.
|
// Check select an event.
|
||||||
@ -844,58 +669,28 @@ function execute_event_response(event_list_btn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isNaN(response_id)) {
|
if (!isNaN(response_id)) {
|
||||||
// It is a custom response
|
var response_parameters_list = $('input[name^="values_params_"]');
|
||||||
var response = get_response(response_id);
|
var response_parameters = [];
|
||||||
|
if (response_parameters_list.length > 0) {
|
||||||
// If cannot get response abort it
|
response_parameters_list.each(function() {
|
||||||
if (response == null) {
|
var acum = {
|
||||||
return;
|
name: $(this).attr("name"),
|
||||||
}
|
value: $(this).val()
|
||||||
|
};
|
||||||
// Limit number of events to apply custom responses
|
response_parameters.push(acum);
|
||||||
// due performance reasons.
|
|
||||||
if (total_checked > $("#max_execution_event_response").val()) {
|
|
||||||
$("#max_custom_event_resp_msg").show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var response_command = [];
|
|
||||||
$(".response_command_input").each(function() {
|
|
||||||
response_command[$(this).attr("name")] = $(this).val();
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
response_parameters = JSON.stringify(response_parameters);
|
||||||
|
|
||||||
if (event_list_btn) {
|
if (event_list_btn) {
|
||||||
$("#button-submit_event_response").hide(function() {
|
$("#button-submit_event_response").hide(function() {
|
||||||
$("#response_loading_dialog").show(function() {
|
$("#response_loading_dialog").show(function() {
|
||||||
var check_params = get_response_params(response_id);
|
show_response_dialog_massive(response_id, response_parameters);
|
||||||
|
|
||||||
if (check_params[0] !== "") {
|
|
||||||
show_event_response_command_dialog(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
check_massive_response_event(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked,
|
|
||||||
response_command
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$("#button-btn_str").hide(function() {
|
check_execute_response_massive(response_id, response_parameters);
|
||||||
$("#execute_again_loading").show(function() {
|
|
||||||
check_massive_response_event(
|
|
||||||
response_id,
|
|
||||||
response,
|
|
||||||
total_checked,
|
|
||||||
response_command
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// It is not a custom response
|
// It is not a custom response
|
||||||
@ -970,15 +765,63 @@ function execute_event_response(event_list_btn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_massive_response_event(
|
function show_response_dialog_massive(response_id, response_parameters) {
|
||||||
response_id,
|
var params = [];
|
||||||
response,
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
total_checked,
|
params.push({ name: "get_response", value: 1 });
|
||||||
response_command
|
params.push({ name: "response_id", value: response_id });
|
||||||
) {
|
|
||||||
var counter = 0;
|
|
||||||
var end = 0;
|
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response) {
|
||||||
|
// If cannot get response abort it
|
||||||
|
if (response == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#event_response_window")
|
||||||
|
.hide()
|
||||||
|
.empty()
|
||||||
|
.append('<div class="container-massive-events-response"></div>')
|
||||||
|
.dialog({
|
||||||
|
title: $("#response_id option:selected").html(),
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: false,
|
||||||
|
open: function() {
|
||||||
|
check_execute_response_massive(response_id, response_parameters);
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
$("#checkbox-all_validate_box").prop("checked", false);
|
||||||
|
$(".chk_val").prop("checked", false);
|
||||||
|
$("#response_loading_dialog").hide();
|
||||||
|
$("#button-submit_event_response").show();
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "Execute All",
|
||||||
|
id: "execute-again-all",
|
||||||
|
class:
|
||||||
|
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||||
|
click: function() {
|
||||||
|
execute_event_response(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
width: response["modal_width"],
|
||||||
|
height: response["modal_height"]
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_execute_response_massive(response_id, response_parameters) {
|
||||||
|
var events = [];
|
||||||
|
$(".container-massive-events-response").empty();
|
||||||
$(".chk_val:checked").each(function() {
|
$(".chk_val:checked").each(function() {
|
||||||
var event_id = $(this).val();
|
var event_id = $(this).val();
|
||||||
var meta = $("#hidden-meta").val();
|
var meta = $("#hidden-meta").val();
|
||||||
@ -987,23 +830,18 @@ function check_massive_response_event(
|
|||||||
var split_id = event_id.split("|");
|
var split_id = event_id.split("|");
|
||||||
event_id = split_id[0];
|
event_id = split_id[0];
|
||||||
server_id = split_id[1];
|
server_id = split_id[1];
|
||||||
|
|
||||||
|
if (events[server_id] === undefined) {
|
||||||
|
events[server_id] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
response["target"] = get_response_target(
|
events[server_id].push(event_id);
|
||||||
event_id,
|
} else {
|
||||||
response_id,
|
events.push(event_id);
|
||||||
server_id,
|
}
|
||||||
response_command
|
|
||||||
);
|
|
||||||
response["server_id"] = server_id;
|
|
||||||
response["event_id"] = event_id;
|
|
||||||
|
|
||||||
if (total_checked - 1 === counter) end = 1;
|
|
||||||
|
|
||||||
show_massive_response_dialog(response_id, response, counter, end);
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
execute_response_massive(events, response_id, response_parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
function event_widget_options() {
|
function event_widget_options() {
|
||||||
@ -1287,3 +1125,43 @@ function check_event_sound(settings) {
|
|||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function table_info_response_event(response_id, event_id, server_id, massive) {
|
||||||
|
var params = [];
|
||||||
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
|
params.push({ name: "get_response", value: 1 });
|
||||||
|
params.push({ name: "response_id", value: response_id });
|
||||||
|
params.push({ name: "server_id", value: server_id });
|
||||||
|
params.push({ name: "event_id", value: event_id });
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response) {
|
||||||
|
if (response) {
|
||||||
|
var params = [];
|
||||||
|
params.push({ name: "page", value: "include/ajax/events" });
|
||||||
|
params.push({ name: "draw_row_response_info", value: 1 });
|
||||||
|
params.push({ name: "massive", value: massive === true ? 1 : 0 });
|
||||||
|
params.push({ name: "response", value: JSON.stringify(response) });
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params,
|
||||||
|
type: "POST",
|
||||||
|
url: $("#hidden-ajax_file").val(),
|
||||||
|
dataType: "html",
|
||||||
|
success: function(output) {
|
||||||
|
if (massive === true) {
|
||||||
|
$("#massive-parameters-response").append(output);
|
||||||
|
} else {
|
||||||
|
$(".params_rows").remove();
|
||||||
|
$("#responses_table").append(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -740,3 +740,26 @@ function reveal_password(name) {
|
|||||||
revealElement.attr("src", imagesPath + "eye_show.png");
|
revealElement.attr("src", imagesPath + "eye_show.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns html img group icon.
|
||||||
|
* @param {int} $id_group
|
||||||
|
*/
|
||||||
|
function getGroupIcon(id_group, img_container) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
page: "godmode/groups/group_list",
|
||||||
|
get_group_json: 1,
|
||||||
|
id_group: id_group
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
img_container.attr("src", "images/groups_small/" + data["icon"] + ".png");
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
img_container.attr("src", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -338,22 +338,6 @@ class AgentModuleWidget extends Widget
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
$values['mModules'] = implode(
|
|
||||||
SEPARATOR_META_MODULE,
|
|
||||||
array_reduce(
|
|
||||||
$values['mModules'],
|
|
||||||
function ($carry, $item) {
|
|
||||||
$d = explode('|', $item);
|
|
||||||
$carry[] = (isset($d[1]) === true) ? $d[1] : $item;
|
|
||||||
|
|
||||||
return $carry;
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,64 +654,34 @@ class AgentModuleWidget extends Widget
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract info all modules selected.
|
|
||||||
$target_modules = $this->values['mModules'];
|
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
$target_modules = explode(
|
|
||||||
SEPARATOR_META_MODULE,
|
|
||||||
$this->values['mModules']
|
|
||||||
);
|
|
||||||
|
|
||||||
$all_modules = $target_modules;
|
|
||||||
} else {
|
|
||||||
if (is_array($target_modules) === true
|
|
||||||
|| is_numeric($target_modules) === true
|
|
||||||
) {
|
|
||||||
$target_modules = array_reduce(
|
|
||||||
$target_modules,
|
|
||||||
function ($carry, $item) {
|
|
||||||
$carry[] = io_safe_output($item);
|
|
||||||
|
|
||||||
return $carry;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$all_modules = Module::search(
|
|
||||||
['nombre' => $target_modules]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// From previous definitions.
|
|
||||||
$all_modules = Module::search(
|
|
||||||
['id_agente_modulo' => explode(',', $target_modules)]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($all_modules !== null) {
|
|
||||||
if (is_metaconsole() === true
|
|
||||||
&& $this->values['mShowCommonModules'] === '1'
|
|
||||||
) {
|
|
||||||
$reduceAllModules = [];
|
|
||||||
} else {
|
|
||||||
$reduceAllModules = array_reduce(
|
$reduceAllModules = array_reduce(
|
||||||
$all_modules,
|
$this->values['mModules'],
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
if ($item === null) {
|
if ($item === null) {
|
||||||
return $carry;
|
return $carry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($item) === true) {
|
if (is_metaconsole() === true) {
|
||||||
$carry[$item->name()] = null;
|
$item = explode('|', $item);
|
||||||
|
$serverId = $item[0];
|
||||||
|
$fullname = $item[1];
|
||||||
|
if ($this->values['mShowCommonModules'] !== 'on') {
|
||||||
|
$item = explode(' » ', $fullname);
|
||||||
|
$name = $item[1];
|
||||||
|
$carry['modules_selected'][$serverId][$name] = null;
|
||||||
|
$carry['modules'][$name] = null;
|
||||||
} else {
|
} else {
|
||||||
$carry[io_safe_output($item)] = null;
|
$carry['modules'][$fullname] = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$carry['modules'][$item] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $carry;
|
return $carry;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$allModules = $reduceAllModules['modules'];
|
||||||
$visualData = [];
|
$visualData = [];
|
||||||
// Extract info agents selected.
|
// Extract info agents selected.
|
||||||
$target_agents = explode(',', $this->values['mAgents']);
|
$target_agents = explode(',', $this->values['mAgents']);
|
||||||
@ -754,54 +708,33 @@ class AgentModuleWidget extends Widget
|
|||||||
$visualData[$agent_id]['agent_alias'] = $agent->alias();
|
$visualData[$agent_id]['agent_alias'] = $agent->alias();
|
||||||
$visualData[$agent_id]['modules'] = [];
|
$visualData[$agent_id]['modules'] = [];
|
||||||
|
|
||||||
if (is_metaconsole() === true
|
if (empty($allModules) === false) {
|
||||||
&& $this->values['mShowCommonModules'] === '1'
|
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
|
||||||
) {
|
|
||||||
// MC should connect to nodes and retrieve information
|
|
||||||
// from targets.
|
|
||||||
$tmpModules = array_reduce(
|
|
||||||
$target_modules,
|
|
||||||
function ($carry, $item) {
|
|
||||||
// In this case, the modules come with '» ' chain.
|
|
||||||
$tmpCarry = explode('» ', $item);
|
|
||||||
$carry[trim($tmpCarry[1])] = null;
|
|
||||||
|
|
||||||
return $carry;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$modules = $agent->searchModules(
|
$modules = $agent->searchModules(
|
||||||
['nombre' => array_keys($tmpModules)]
|
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
if ($module === null) {
|
|
||||||
$reduceAllModules[] = null;
|
|
||||||
} else {
|
} else {
|
||||||
$reduceAllModules[$module->name()] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (empty($reduceAllModules) === false) {
|
|
||||||
$modules = $agent->searchModules(
|
$modules = $agent->searchModules(
|
||||||
['nombre' => array_keys($reduceAllModules)]
|
['nombre' => array_keys($allModules)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$visualData[$agent_id]['modules'] = $reduceAllModules;
|
$visualData[$agent_id]['modules'] = $allModules;
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
if ($module === null) {
|
if ($module === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$key_name_module = $module->name();
|
||||||
|
|
||||||
if ($this->values['mTypeShow'] === '1') {
|
if ($this->values['mTypeShow'] === '1') {
|
||||||
$mod = $module->toArray();
|
$mod = $module->toArray();
|
||||||
$mod['datos'] = $module->lastValue();
|
$mod['datos'] = $module->lastValue();
|
||||||
$module_last_value = modules_get_agentmodule_data_for_humans($mod);
|
$module_last_value = modules_get_agentmodule_data_for_humans($mod);
|
||||||
$visualData[$agent_id]['modules'][$module->name()] = $module_last_value;
|
$visualData[$agent_id]['modules'][$key_name_module] = $module_last_value;
|
||||||
} else {
|
} else {
|
||||||
$visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
|
$visualData[$agent_id]['modules'][$key_name_module] = $module->getStatus()->estado();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,17 +746,9 @@ class AgentModuleWidget extends Widget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reduceAllModules) === false) {
|
|
||||||
$allModules = array_keys($reduceAllModules);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($allModules === null) {
|
|
||||||
$allModules = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = $this->generateViewAgentModule(
|
$output = $this->generateViewAgentModule(
|
||||||
$visualData,
|
$visualData,
|
||||||
$allModules
|
array_keys($allModules)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -328,7 +328,7 @@ class ServiceMapWidget extends Widget
|
|||||||
];
|
];
|
||||||
|
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Enable sunburst'),
|
'label' => __('Show sunburst by default'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'name' => 'sunburst',
|
'name' => 'sunburst',
|
||||||
|
@ -749,6 +749,10 @@ class Module extends Entity
|
|||||||
$updates = $this->fields;
|
$updates = $this->fields;
|
||||||
$updates['id_tipo_modulo'] = $this->moduleType()->id_tipo();
|
$updates['id_tipo_modulo'] = $this->moduleType()->id_tipo();
|
||||||
|
|
||||||
|
if (empty($updates['debug_content']) === false) {
|
||||||
|
$updates['debug_content'] = str_replace("'", '"', $updates['debug_content']);
|
||||||
|
}
|
||||||
|
|
||||||
// In the case of the webserver modules, debug_content special characters must be handled.
|
// In the case of the webserver modules, debug_content special characters must be handled.
|
||||||
if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
|
if ($updates['id_tipo_modulo'] >= MODULE_TYPE_WEB_ANALYSIS
|
||||||
&& $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING
|
&& $updates['id_tipo_modulo'] <= MODULE_TYPE_WEB_CONTENT_STRING
|
||||||
|
@ -396,3 +396,59 @@ div.multi-response-buttons {
|
|||||||
.white_table_graph_header {
|
.white_table_graph_header {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container-massive-events-response {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-massive-events-response-cell {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-massive-events-response-command > span {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-massive-events-response-output {
|
||||||
|
/*border: 2px dashed #ddd;*/
|
||||||
|
/*padding: 10px;*/
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-massive-events-response-execute {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#massive-parameters-response {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#massive-parameters-response > div {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#massive-parameters-response > div h5 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#massive-parameters-response > div div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
@ -323,7 +323,7 @@ if (isset($config['id_user']) === false) {
|
|||||||
$userIP,
|
$userIP,
|
||||||
$nick
|
$nick
|
||||||
),
|
),
|
||||||
$userIP
|
$nick
|
||||||
);
|
);
|
||||||
while (ob_get_length() > 0) {
|
while (ob_get_length() > 0) {
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
@ -128,8 +128,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.764';
|
$version = '7.0NG.765';
|
||||||
$build = '220929';
|
$build = '221018';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Login check
|
// Login check.
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
@ -37,7 +37,7 @@ if (is_ajax()) {
|
|||||||
$get_alert_fired = get_parameter('get_alert_fired', 0);
|
$get_alert_fired = get_parameter('get_alert_fired', 0);
|
||||||
|
|
||||||
if ($get_alert_fired) {
|
if ($get_alert_fired) {
|
||||||
// Calculate alerts fired
|
// Calculate alerts fired.
|
||||||
$data_reporting = reporting_get_group_stats();
|
$data_reporting = reporting_get_group_stats();
|
||||||
echo $data_reporting['monitor_alerts_fired'];
|
echo $data_reporting['monitor_alerts_fired'];
|
||||||
}
|
}
|
||||||
|
@ -564,7 +564,10 @@ for ($i = 0; $i < $custom_fields_count; $i++) {
|
|||||||
$columns = array_merge($first_column, $second_column);
|
$columns = array_merge($first_column, $second_column);
|
||||||
} else {
|
} else {
|
||||||
$columns = $first_column;
|
$columns = $first_column;
|
||||||
|
if ($table_data->data !== null) {
|
||||||
$filas = count($table_data->data);
|
$filas = count($table_data->data);
|
||||||
|
}
|
||||||
|
|
||||||
$table_data->colspan[$filas][1] = 3;
|
$table_data->colspan[$filas][1] = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|