fixed conflicts

This commit is contained in:
alejandro.campos@artica.es 2023-01-09 10:49:11 +01:00
commit 5b5694c5f6
791 changed files with 143032 additions and 46860 deletions

View File

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

View File

@ -312,6 +312,7 @@ console_dependencies=" \
mod_ssl \ mod_ssl \
libzstd \ libzstd \
openldap-clients \ openldap-clients \
chromium \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"

View File

@ -18,6 +18,7 @@ WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501' S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables # define default variables
[ "$TZ" ] || TZ="Europe/Madrid" [ "$TZ" ] || TZ="Europe/Madrid"
@ -271,6 +272,10 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE" /usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs" check_cmd_status "Error Installing phanromjs"
# Chrome
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies # SDK VMware perl dependencies
vmware_dependencies=" \ vmware_dependencies=" \

View File

@ -262,13 +262,11 @@ RUN dnf install -y --setopt=tsflags=nodocs \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm
# Install utils # Install utils
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs RUN dnf install -y supervisor chromium crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
# SDK VMware perl dependencies # SDK VMware perl dependencies
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
# Instant client Oracle # Instant client Oracle
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
# Install Phantom
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
EXPOSE 80 443 41121 162/udp EXPOSE 80 443 41121 162/udp

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.767-221205 Version: 7.0NG.767-230105
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.767'; use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '221205'; use constant AGENT_BUILD => '230105';
# 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;
@ -2403,6 +2403,11 @@ sub check_collections () {
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) { if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
$local_collection_md5 = <MD5_FILE>; $local_collection_md5 = <MD5_FILE>;
close MD5_FILE; close MD5_FILE;
if ( ! defined ($local_collection_md5) ) {
log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0");
unlink ("$ConfDir/collections/$collection_md5_file");
$local_collection_md5 = "Size 0";
}
} else { } else {
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
next; next;

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.767" PI_VERSION="7.0NG.767"
PI_BUILD="221205" PI_BUILD="230105"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -12,19 +12,21 @@
# #
################################################### ###################################################
from sys import argv try:
from sys import path from sys import argv
from sys import stderr from sys import stderr
from sys import exit from sys import exit
from subprocess import Popen from subprocess import Popen
from subprocess import PIPE from subprocess import PIPE
from subprocess import DEVNULL from subprocess import DEVNULL
from subprocess import getstatusoutput from subprocess import getstatusoutput
import psutil import psutil
except ModuleNotFoundError as err:
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
exit(1)
global module_list
module_list = [] module_list = []
version = "1.1" VERSION = "1.2"
######################################################################################### #########################################################################################
@ -50,15 +52,15 @@ class PSCheck:
procname = PSCheck.get_serviceprocess(element) procname = PSCheck.get_serviceprocess(element)
# Get process status # Get process status
parstatus = PSCheck.getstatus(element) parstatus = PSCheck.getstatus(element)
if memcpu == True and parstatus == 1: if memcpu and parstatus == 1:
usage = get_memcpu(str(procname), str(element)) usage = get_memcpu(str(procname), str(element))
output += usage output += usage
# Generate module with name and status # Generate module with name and status
parent = service_module(str(element), parstatus) parent = service_module(str(element), parstatus)
output += parent output += parent
if option == True: if option:
children = PSCheck.getchildren(element, memcpu) children = PSCheck.getchildren(element, memcpu)
if type(children) == list and len(children) > 1: if isinstance(children, list) and len(children) > 1:
for child in children: for child in children:
output += child output += child
else: else:
@ -66,7 +68,6 @@ class PSCheck:
else: else:
next next
#if output != '':
if output and element and procname: if output and element and procname:
return ({"name" : element, "process" : procname, "modules": output}) return ({"name" : element, "process" : procname, "modules": output})
else: else:
@ -84,13 +85,13 @@ class PSCheck:
status = PSCheck.getstatus(child) status = PSCheck.getstatus(child)
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status") kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
if status: if status:
if memcpu == True: if memcpu:
kidsusage = get_memcpu(str(child)) kidsusage = get_memcpu(str(child))
for usage in kidsusage: for usage in kidsusage:
kids += usage kids += usage
else: else:
next next
return (kids) return kids
@staticmethod @staticmethod
def getstatus(servicename): def getstatus(servicename):
@ -99,7 +100,7 @@ class PSCheck:
"' |", "Select-Object", "-ExpandProperty", "Status"], "' |", "Select-Object", "-ExpandProperty", "Status"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
status = running.communicate()[0].strip() status = running.communicate()[0].strip()
return (int(status == "Running")) return int(status == "Running")
@staticmethod @staticmethod
def get_serviceprocess(servicename): def get_serviceprocess(servicename):
@ -108,7 +109,7 @@ class PSCheck:
srv_pid = service.pid() srv_pid = service.pid()
process = psutil.Process(srv_pid) process = psutil.Process(srv_pid)
proc_name = process.name() proc_name = process.name()
return (proc_name) return proc_name
######################################################################################### #########################################################################################
@ -124,13 +125,13 @@ def service_module(name, value, parent=None):
"module_parent" : parent, "module_parent" : parent,
}] }]
#print ("service_module END "+str(now(0,1))) #print ("service_module END "+str(now(0,1)))
return (module) return module
def get_memcpu (process, servicename): def get_memcpu (process, servicename=None):
"""Creates a module for Memory and CPU for a given process. Returns a list of dictionaries.""" """Creates a module for Memory and CPU for a given process. Returns a list of dictionaries."""
modules = [] modules = []
if process: if process:
if servicename != None: if servicename is not None:
parentname = servicename parentname = servicename
else: else:
parentname = process parentname = process
@ -147,7 +148,7 @@ def get_memcpu (process, servicename):
"unit" : "%", "unit" : "%",
"module_parent" : "Service "+ parentname + " - Status", "module_parent" : "Service "+ parentname + " - Status",
}] }]
return (modules) return modules
def proc_percentbyname(procname): ############# 03/03/2020 def proc_percentbyname(procname): ############# 03/03/2020
"""Gets Memory and CPU usage for a given process. Returns a list.""" """Gets Memory and CPU usage for a given process. Returns a list."""
@ -165,7 +166,7 @@ def proc_percentbyname(procname): ############# 03/03/2020
except psutil.NoSuchProcess: except psutil.NoSuchProcess:
next next
#print ("proc_percentbyname END "+str(now(0,1))) #print ("proc_percentbyname END "+str(now(0,1)))
return ([sum(memory),sum(cpu)]) return [sum(memory),sum(cpu)]
def win_service(servicelist, option=False, memcpu=False): def win_service(servicelist, option=False, memcpu=False):
"""Creates modules for Windows servers.""" """Creates modules for Windows servers."""
@ -173,7 +174,7 @@ def win_service(servicelist, option=False, memcpu=False):
for srvc in servicelist: for srvc in servicelist:
if srvc and len(srvc) > 2: if srvc and len(srvc) > 2:
output = PSCheck.check_service(srvc, option, memcpu) output = PSCheck.check_service(srvc, option, memcpu)
if output != None and output["modules"]: if output is not None and output["modules"]:
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"] modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
module_list.append(srvc) module_list.append(srvc)
#winprocess = output["name"] #winprocess = output["name"]
@ -199,7 +200,7 @@ def lnx_service(services_list, memcpu=False):
syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE, syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE,
stdin=DEVNULL, universal_newlines=True) stdin=DEVNULL, universal_newlines=True)
result = syscall.communicate() result = syscall.communicate()
srvstatus= result[0].strip().lower().split("\n") srvstatus = result[0].strip().lower().split("\n")
if srvstatus[0] == "loadstate=not-found": if srvstatus[0] == "loadstate=not-found":
next next
else: else:
@ -223,15 +224,15 @@ def lnx_service(services_list, memcpu=False):
else: else:
next next
else: else:
print ("No systemd or service commands available. Exiting...", file=stderr) print("No systemd or service commands available. Exiting...", file=stderr)
exit() exit()
if status: if status:
module_list.append(srvc) module_list.append(srvc)
if memcpu == True: if memcpu:
modules += get_memcpu(srvc, None) modules += get_memcpu(srvc, None)
for m in modules: for m in modules:
print_module (m, 1) print_module(m, 1)
######################################################################################### #########################################################################################
@ -339,7 +340,7 @@ def print_module(module, str_flag=False):
#### Print flag #### Print flag
if str_flag is not False: if str_flag is not False:
print (module_xml) print(module_xml)
return (module_xml) return (module_xml)
@ -362,7 +363,7 @@ def main():
"postfix", "mysqld", "postgres", "oracle", "mongod"] "postfix", "mysqld", "postgres", "oracle", "mongod"]
discover(OS, service_list) discover(OS, service_list)
else: else:
print ("OS not recognized. Exiting...", file=stderr) print("OS not recognized. Exiting...", file=stderr)
exit() exit()
def discover(osyst, servicelist): def discover(osyst, servicelist):
@ -383,23 +384,23 @@ def discover(osyst, servicelist):
elif osyst == "Linux": elif osyst == "Linux":
lnx_service(servicelist, memcpu) lnx_service(servicelist, memcpu)
else: else:
print ("\nPandora FMS Autodiscovery plugin v{}".format(version)) print("\nPandora FMS Autodiscovery plugin v{}".format(VERSION))
print ("Checks the status of the services in list and monitors CPU and Memory for each of them.\n") print("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
print ("Usage:") print("Usage:")
print ("{} [options] [--usage]".format(argv[0])) print("{} [options] [--usage]".format(argv[0]))
print ("--help") print("--help")
print ("\tPrints this help screen") print("\tPrints this help screen")
print ("--default") print("--default")
print ("\tRuns this tool with default monitoring.") print("\tRuns this tool with default monitoring.")
print ("\tServices monitored by default for {}:".format(osyst)) print("\tServices monitored by default for {}:".format(osyst))
print ("\t",", ".join(servicelist)) print("\t", ", ".join(servicelist))
print ("--list \"<srvc1,srvc2,srvc3>\"") print("--list \"<srvc1,srvc2,srvc3>\"")
print ("\tReplaces default services for a given list (comma-separated)") print("\tReplaces default services for a given list (comma-separated)")
if osyst == "Windows": if osyst == "Windows":
print ("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.") print("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.")
print ("\tElements under 2 characters will be discarded.") print("\tElements under 2 characters will be discarded.")
print ("--usage") print("--usage")
print ("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n") print("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
##### RUN #### ##### RUN ####

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{221205} {230105}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.767-221205 Version: 7.0NG.767-230105
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -9,13 +9,24 @@
], ],
"config": { "config": {
"platform": { "platform": {
"php": "7.2.0" "php": "8.0.0"
} }
}, },
"require": { "require": {
"mpdf/mpdf": "^8.0.15", "mpdf/mpdf": "^8.0.15",
"swiftmailer/swiftmailer": "^6.0", "swiftmailer/swiftmailer": "^6.0",
"amphp/parallel-functions": "^1.0" "amphp/parallel-functions": "^1.0",
"chrome-php/chrome": "^1.7.1",
"artica/phpchartjs": "^1.0"
},
"repositories": {
"phpchartjs": {
"type": "path",
"url": "../../../phpchartjs",
"options": {
"symlink": false
}
}
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "643ac0dc8a8e1f129104399054f8dd0c", "content-hash": "be2ad3d9d4df55d7ccb87981e82c4932",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
@ -549,6 +549,205 @@
], ],
"time": "2021-10-25T18:29:10+00:00" "time": "2021-10-25T18:29:10+00:00"
}, },
{
"name": "artica/phpchartjs",
"version": "v1.0.2",
"dist": {
"type": "path",
"url": "../../../phpchartjs",
"reference": "4957e7cd699e50cee8e0ba7304e1423aafb2cad2"
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"halfpastfouram/collection": "1.0.0",
"laminas/laminas-json": ">3.1.2",
"php": ">=7.2",
"symfony/var-dumper": "^3.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^5.0",
"squizlabs/php_codesniffer": "3.5.3"
},
"type": "package",
"autoload": {
"psr-4": {
"Artica\\PHPChartJS\\": "src/",
"Test\\": "test/"
}
},
"scripts": {
"test": [
"./vendor/bin/phpunit"
],
"cs-check": [
"./vendor/bin/phpcs"
],
"cs-fix": [
"./vendor/bin/phpcbf"
]
},
"license": [
"AGPL-3.0-or-later"
],
"authors": [
{
"name": "Bob Kruithof"
},
{
"name": "Daniel Barbero"
}
],
"description": "PHP library for ChartJS",
"homepage": "https://artica.es/",
"keywords": [
"chartjs",
"graph",
"php"
],
"transport-options": {
"symlink": false,
"relative": true
}
},
{
"name": "chrome-php/chrome",
"version": "v1.7.1",
"source": {
"type": "git",
"url": "https://github.com/chrome-php/chrome.git",
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chrome-php/chrome/zipball/5783c749b2ee385d1c481b0906f1b8acef0296e4",
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4",
"shasum": ""
},
"require": {
"chrome-php/wrench": "^1.3",
"evenement/evenement": "^3.0.1",
"monolog/monolog": "^1.27.1 || ^2.8 || ^3.2",
"php": "^7.3 || ^8.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
"symfony/polyfill-mbstring": "^1.26",
"symfony/process": "^4.4 || ^5.0 || ^6.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^9.5.23",
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"HeadlessChromium\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Enrico Dias",
"email": "enrico@enricodias.com",
"homepage": "https://github.com/enricodias"
}
],
"description": "Instrument headless chrome/chromium instances from PHP",
"keywords": [
"browser",
"chrome",
"chromium",
"crawl",
"headless",
"pdf",
"puppeteer",
"screenshot"
],
"support": {
"issues": "https://github.com/chrome-php/chrome/issues",
"source": "https://github.com/chrome-php/chrome/tree/v1.7.1"
},
"time": "2022-09-04T21:11:00+00:00"
},
{
"name": "chrome-php/wrench",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/chrome-php/wrench.git",
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chrome-php/wrench/zipball/68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
"shasum": ""
},
"require": {
"ext-sockets": "*",
"php": "^7.3 || ^8.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/polyfill-php80": "^1.26"
},
"conflict": {
"wrench/wrench": "*"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^9.5.23"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"Wrench\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
}
],
"description": "A simple PHP WebSocket implementation",
"keywords": [
"WebSockets",
"hybi",
"websocket"
],
"support": {
"issues": "https://github.com/chrome-php/wrench/issues",
"source": "https://github.com/chrome-php/wrench/tree/v1.3.0"
},
"time": "2022-08-28T11:42:16+00:00"
},
{ {
"name": "doctrine/lexer", "name": "doctrine/lexer",
"version": "1.2.2", "version": "1.2.2",
@ -693,6 +892,265 @@
], ],
"time": "2021-10-11T09:18:27+00:00" "time": "2021-10-11T09:18:27+00:00"
}, },
{
"name": "evenement/evenement",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Evenement": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
}
],
"description": "Événement is a very simple event dispatching library for PHP",
"keywords": [
"event-dispatcher",
"event-emitter"
],
"support": {
"issues": "https://github.com/igorw/evenement/issues",
"source": "https://github.com/igorw/evenement/tree/master"
},
"time": "2017-07-23T21:35:13+00:00"
},
{
"name": "halfpastfouram/collection",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/halfpastfouram/collection.git",
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/halfpastfouram/collection/zipball/0862d0b431fef9dc2245518dc06b86ff00dcd102",
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102",
"shasum": ""
},
"require": {
"php": ">=5.6.0 || ^7.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"phpunit/phpunit": "5.2.*"
},
"type": "package",
"autoload": {
"psr-4": {
"Test\\": "test/",
"Halfpastfour\\Collection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"AGPL 3.0"
],
"authors": [
{
"name": "Bob Kruithof"
}
],
"description": "A flexible PHP Collection complete with custom Iterator.",
"homepage": "http://github.com/halfpastfouram/collection",
"keywords": [
"collection",
"php"
],
"support": {
"issues": "https://github.com/halfpastfouram/collection/issues",
"source": "https://github.com/halfpastfouram/collection/tree/master"
},
"time": "2016-12-18T13:04:48+00:00"
},
{
"name": "laminas/laminas-json",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-json.git",
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-json/zipball/7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
"shasum": ""
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
},
"conflict": {
"zendframework/zend-json": "*"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.4.0",
"laminas/laminas-stdlib": "^2.7.7 || ^3.1",
"phpunit/phpunit": "^9.5.25"
},
"suggest": {
"laminas/laminas-json-server": "For implementing JSON-RPC servers",
"laminas/laminas-xml2json": "For converting XML documents to JSON"
},
"type": "library",
"autoload": {
"psr-4": {
"Laminas\\Json\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
"homepage": "https://laminas.dev",
"keywords": [
"json",
"laminas"
],
"support": {
"chat": "https://laminas.dev/chat",
"docs": "https://docs.laminas.dev/laminas-json/",
"forum": "https://discourse.laminas.dev",
"issues": "https://github.com/laminas/laminas-json/issues",
"rss": "https://github.com/laminas/laminas-json/releases.atom",
"source": "https://github.com/laminas/laminas-json"
},
"funding": [
{
"url": "https://funding.communitybridge.org/projects/laminas-project",
"type": "community_bridge"
}
],
"time": "2022-10-17T04:06:45+00:00"
},
{
"name": "monolog/monolog",
"version": "2.8.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50",
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50",
"shasum": ""
},
"require": {
"php": ">=7.2",
"psr/log": "^1.0.1 || ^2.0 || ^3.0"
},
"provide": {
"psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
"graylog2/gelf-php": "^1.4.2",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4 || ^3",
"phpspec/prophecy": "^1.15",
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5.14",
"predis/predis": "^1.1 || ^2.0",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": "^7",
"swiftmailer/swiftmailer": "^5.3|^6.0",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"ext-openssl": "Required to send log messages using SSL",
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "https://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.8.0"
},
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
"type": "tidelift"
}
],
"time": "2022-07-24T11:55:47+00:00"
},
{ {
"name": "mpdf/mpdf", "name": "mpdf/mpdf",
"version": "v8.0.15", "version": "v8.0.15",
@ -940,30 +1398,30 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.4", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11" "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11", "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=8.0.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Psr\\Log\\": "Psr/Log/" "Psr\\Log\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -984,9 +1442,9 @@
"psr-3" "psr-3"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/log/tree/1.1.4" "source": "https://github.com/php-fig/log/tree/2.0.0"
}, },
"time": "2021-05-03T11:20:27+00:00" "time": "2021-07-14T16:41:46+00:00"
}, },
{ {
"name": "setasign/fpdi", "name": "setasign/fpdi",
@ -1136,6 +1594,152 @@
"abandoned": "symfony/mailer", "abandoned": "symfony/mailer",
"time": "2021-10-18T15:26:12+00:00" "time": "2021-10-18T15:26:12+00:00"
}, },
{
"name": "symfony/filesystem",
"version": "v5.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51",
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v5.4.13"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-09-21T19:53:16+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{ {
"name": "symfony/polyfill-iconv", "name": "symfony/polyfill-iconv",
"version": "v1.24.0", "version": "v1.24.0",
@ -1392,16 +1996,16 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.24.0", "version": "v1.27.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1416,7 +2020,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "1.23-dev" "dev-main": "1.27-dev"
}, },
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
@ -1424,12 +2028,12 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [ "files": [
"bootstrap.php" "bootstrap.php"
] ],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -1455,7 +2059,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
}, },
"funding": [ "funding": [
{ {
@ -1471,7 +2075,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-11-30T18:21:41+00:00" "time": "2022-11-03T14:55:06+00:00"
}, },
{ {
"name": "symfony/polyfill-php72", "name": "symfony/polyfill-php72",
@ -1548,6 +2152,232 @@
} }
], ],
"time": "2021-05-27T09:17:38+00:00" "time": "2021-05-27T09:17:38+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/process",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1",
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.11"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-06-27T16:58:25+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v3.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0719f6cf4633a38b2c1585140998579ce23b4b7d",
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
},
"require-dev": {
"ext-iconv": "*",
"twig/twig": "~1.34|~2.4"
},
"suggest": {
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-intl": "To show region name in time zone dump",
"ext-symfony_debug": ""
},
"type": "library",
"autoload": {
"files": [
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony mechanism for exploring and dumping PHP variables",
"homepage": "https://symfony.com",
"keywords": [
"debug",
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -1559,7 +2389,7 @@
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.2.0" "php": "8.0.0"
}, },
"plugin-api-version": "2.3.0" "plugin-api-version": "2.3.0"
} }

View File

@ -1666,4 +1666,24 @@ godmode/um_client/vendor/sebastian/object-enumerator
godmode/um_client/vendor/sebastian godmode/um_client/vendor/sebastian
godmode/um_client/vendor godmode/um_client/vendor
update_manager_client/resources/styles/pandora.css update_manager_client/resources/styles/pandora.css
enterprise/views/cluster/edit.php
enterprise/views/cluster/list.php
enterprise/views/cluster/view.php
enterprise/include/lib/Cluster.php
enterprise/include/lib/ClusterModule.php
enterprise/include/lib/ClusterViewer/ClusterManager.php
enterprise/include/lib/ClusterViewer/ClusterWizard.php
enterprise/operation/cluster/cluster.php
enterprise/meta/general/upload_head_image.php enterprise/meta/general/upload_head_image.php
general/first_task/transactional_list.php
enterprise/include/ajax/transactional.ajax.php
enterprise/include/class/Transactionalmap.class.php
enterprise/include/help/es/help_transactional_map_phases.php
enterprise/include/javascript/transactional/TransactionalController.js
enterprise/include/functions_transactional.php
enterprise/operation/agentes/manage_transmap.php
enterprise/operation/agentes/manage_transmap_creation.php
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
enterprise/operation/agentes/transactional_map.php
include/test.js
include/web2image.js

File diff suppressed because one or more lines are too long

View File

@ -68,7 +68,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
?> ?>
<form action='index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&op=new' method="post"> <form action='index.php?sec=estado&sec2=operation/cluster/cluster&op=new' method="post">
<input type="submit" class="button_task ui_toggle" value="<?php echo __('Create Cluster'); ?>" /> <input type="submit" class="button_task ui_toggle" value="<?php echo __('Create Cluster'); ?>" />
</form> </form>

View File

@ -1,46 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
global $networkmaps_write;
global $networkmaps_manage;
check_login();
ui_require_css_file('first_task');
?>
<?php
ui_print_info_message(['no_close' => true, 'message' => __('There are no transactions defined yet.') ]);
if ($networkmaps_write || $networkmaps_manage) {
?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
<?php
echo __(
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
Transaction graphs represent the different processes within our infrastructure that we use to deliver our service.'
);
?>
</p>
<form action="index.php?sec=network&sec2=enterprise/operation/agentes/manage_transmap_creation&create_transaction=1" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>
</div>
</div>
<?php
}

View File

@ -91,7 +91,7 @@ $login_body_class = '';
// Overrides the default background with the defined by the user. // Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) { if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background']; $background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\""; $login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
} }
// Support for Internet Explorer and Microsoft Edge browsers // Support for Internet Explorer and Microsoft Edge browsers

View File

@ -59,6 +59,7 @@ ui_print_warning_message(
] ]
); );
$table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->data = []; $table->data = [];

View File

@ -872,6 +872,35 @@ foreach ($fields as $field) {
true, true,
true true
); );
} else if ($field['is_link_enabled']) {
list($link_text, $link_url) = json_decode($custom_value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$link_text = '';
$link_url = '';
}
$data_field[1] = '<span style="line-height: 3.5;">'.__('Link text:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_text,
'class="min-height-30px',
true
);
$data_field[1] .= '<br>';
$data_field[1] .= '<span style="line-height: 3.5;">'.__('Link URL:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_url,
'class="min-height-30px',
true
);
} else { } else {
$data_field[1] = html_print_textarea( $data_field[1] = html_print_textarea(
'customvalue_'.$field['id_field'], 'customvalue_'.$field['id_field'],

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
// Check if agent exists (BUG WC-50518-2). // Check if agent exists (BUG WC-50518-2).
@ -999,7 +1007,22 @@ if ($update_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
if ($field_value[1] !== '') {
$parsed_url = parse_url($field_value[1]);
if (empty($parsed_url['scheme']) === true) {
$field_value[1] = 'http://'.ltrim($field_value[1], '/');
}
}
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
foreach ($field_values as $key => $value) { foreach ($field_values as $key => $value) {
@ -2095,6 +2118,9 @@ if ($delete_module) {
exit; exit;
} }
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_borrar_modulo);
// Also call base function to delete modules. // Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo); modules_delete_agent_module($id_borrar_modulo);
@ -2451,6 +2477,11 @@ switch ($tab) {
}); });
}); });
// Change description when edit port
$( "#text-tcp_port" ).change(function() {
$( "#textarea_description" ).text(`Checks port ${$( "#text-tcp_port" ).val()} is opened`);
});
// Set the position and width of the subtab // Set the position and width of the subtab
/* /*
function agent_wizard_tab_setup() { function agent_wizard_tab_setup() {

View File

@ -30,6 +30,8 @@ $display_on_front = (bool) get_parameter('display_on_front', 0);
$is_password_type = (bool) get_parameter('is_password_type', 0); $is_password_type = (bool) get_parameter('is_password_type', 0);
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0); $is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Header. // Header.
if ($id_field) { if ($id_field) {
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]); $field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
@ -38,6 +40,7 @@ if ($id_field) {
$is_password_type = $field['is_password_type']; $is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : ''; $combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable']; $is_combo_enable = $config['is_combo_enable'];
$is_link_enabled = $field['is_link_enabled'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
} else { } else {
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
@ -128,6 +131,17 @@ $table->data[4][1] = html_print_textarea(
true true
); );
$table->data[5][0] = __('Link type');
$table->data[5][1] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">'; echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -167,25 +181,46 @@ $(document).ready (function () {
}); });
} }
if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) {
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else {
$('#configure_field-1').show();
$('#configure_field-3').show();
}
$('input[type=checkbox][name=is_link_enabled]').change(function () {
if( $(this).is(":checked") ){
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else{
$('#configure_field-1').show();
$('#configure_field-3').show();
}
});
$('input[type=checkbox][name=is_combo_enable]').change(function () { $('input[type=checkbox][name=is_combo_enable]').change(function () {
if( $(this).is(":checked") ){ if( $(this).is(":checked") ){
$('#configure_field-4').show(); $('#configure_field-4').show();
dialog_message("#message_no_set_password"); dialog_message("#message_no_set_password");
$('#configure_field-1').hide(); $('#configure_field-1').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-4').hide(); $('#configure_field-4').hide();
$('#configure_field-1').show(); $('#configure_field-1').show();
$('#configure_field-5').show();
} }
}); });
$('input[type=checkbox][name=is_password_type]').change(function () { $('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){ if( $(this).is(":checked")){
dialog_message("#message_no_set_combo"); dialog_message("#message_no_set_combo");
$('#configure_field-3').hide(); $('#configure_field-3').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-3').show(); $('#configure_field-3').show();
$('#configure_field-5').show();
} }
}); });
}); });

View File

@ -38,11 +38,12 @@ $display_on_front = (int) get_parameter('display_on_front', 0);
$is_password_type = (int) get_parameter('is_password_type', 0); $is_password_type = (int) get_parameter('is_password_type', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$combo_value_selected = (string) get_parameter('combo_value_selected', ''); $combo_value_selected = (string) get_parameter('combo_value_selected', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Create field. // Create field.
if ($create_field) { if ($create_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name == '') { if ($name === '') {
ui_print_error_message(__('The name must not be empty')); ui_print_error_message(__('The name must not be empty'));
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) { } else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
ui_print_error_message(__('The name must be unique')); ui_print_error_message(__('The name must be unique'));
@ -54,6 +55,7 @@ if ($create_field) {
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
] ]
); );
ui_print_success_message(__('Field successfully created')); ui_print_success_message(__('Field successfully created'));
@ -63,12 +65,13 @@ if ($create_field) {
// Update field. // Update field.
if ($update_field) { if ($update_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name != '') { if ($name !== '') {
$values = [ $values = [
'name' => $name, 'name' => $name,
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
]; ];
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]); $result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);

View File

@ -732,17 +732,15 @@ if ($agents !== false) {
} }
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
$agent['id_agente'] $agent['id_agente']
); );
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url = 'index.php?sec=reporting&sec2=';
$url .= '/operation/cluster/cluster'; $url .= 'operation/cluster/cluster';
$url = ui_get_full_url( $url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id() $url.'&op=update&id='.$cluster->id()
); );
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>'; echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
}
} else { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
@ -792,18 +790,16 @@ if ($agents !== false) {
echo '</span><div class="left actions clear_left" style=" visibility: hidden">'; echo '</span><div class="left actions clear_left" style=" visibility: hidden">';
if ($check_aw) { if ($check_aw) {
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
$agent['id_agente'] $agent['id_agente']
); );
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url = 'index.php?sec=reporting&sec2=';
$url .= '/operation/cluster/cluster'; $url .= 'operation/cluster/cluster';
$url = ui_get_full_url( $url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id() $url.'&op=update&id='.$cluster->id()
); );
echo '<a href="'.$url.'">'.__('Edit').'</a>'; echo '<a href="'.$url.'">'.__('Edit').'</a>';
echo ' | '; echo ' | ';
}
} else { } else {
echo '<a href="index.php?sec=gagente& echo '<a href="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main& sec2=godmode/agentes/configurar_agente&tab=main&
@ -825,17 +821,15 @@ if ($agents !== false) {
echo ' | '; echo ' | ';
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
$agent['id_agente'] $agent['id_agente']
); );
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $url = 'index.php?sec=reporting&sec2=';
$url .= '/operation/cluster/cluster'; $url .= 'operation/cluster/cluster';
$url = ui_get_full_url( $url = ui_get_full_url(
$url.'&op=view&id='.$cluster->id() $url.'&op=view&id='.$cluster->id()
); );
echo '<a href="'.$url.'">'.__('View').'</a>'; echo '<a href="'.$url.'">'.__('View').'</a>';
}
} else { } else {
echo '<a href="index.php?sec=estado echo '<a href="index.php?sec=estado
&sec2=operation/agentes/ver_agente &sec2=operation/agentes/ver_agente

View File

@ -52,13 +52,13 @@ if (!isset($policy_page)) {
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >'; echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
echo "<tr><td class='datos bolder w20p'>"; echo "<tr><td class='datos bolder w12p'><span class='mrgn_right_7px'>";
echo __('Search').' '.html_print_input_text( echo __('Search').'</span>'.html_print_input_text(
'search_string', 'search_string',
$search_string, $search_string,
'', '',
15, 5,
255, 5,
true true
); );
html_print_input_hidden('search', 1); html_print_input_hidden('search', 1);
@ -73,7 +73,6 @@ echo '</td>';
echo "<td class='datos w10p'>"; echo "<td class='datos w10p'>";
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"'); html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
echo '</td>'; echo '</td>';
echo "<td class='datos w10p'></td>";
echo '</form>'; echo '</form>';
// Check if there is at least one server of each type available to assign that // Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo. // kind of modules. If not, do not show server type in combo.
@ -179,7 +178,7 @@ if (($policy_page) || (isset($agent))) {
// Create module/type combo. // Create module/type combo.
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) { if (!$policy_page) {
echo '<td class="datos w20p bolder">'; echo '<td class="datos w15p bolder">';
echo __('Show in hierachy mode'); echo __('Show in hierachy mode');
if ($checked == 'true') { if ($checked == 'true') {
$checked = true; $checked = true;
@ -198,8 +197,8 @@ if (($policy_page) || (isset($agent))) {
echo '</td>'; echo '</td>';
} }
echo '<td class="datos w20p bolder">'; echo '<td class="datos w20p bolder lign_right"><span class="mrgn_right_7px">';
echo __('<p>Type</p>'); echo __('Type').'</span>';
html_print_select( html_print_select(
$modules, $modules,
'moduletype', 'moduletype',
@ -216,7 +215,7 @@ if (($policy_page) || (isset($agent))) {
); );
html_print_input_hidden('edit_module', 1); html_print_input_hidden('edit_module', 1);
echo '</td>'; echo '</td>';
echo '<td class="datos w10p">'; echo '<td class="datos w5p">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">'; echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
@ -247,6 +246,8 @@ if ($module_action === 'delete') {
$print_result_msg = true; $print_result_msg = true;
$count_correct_delete_modules = 0; $count_correct_delete_modules = 0;
foreach ($id_agent_modules_delete as $id_agent_module_del) { foreach ($id_agent_modules_delete as $id_agent_module_del) {
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_agent_module_del);
$id_grupo = (int) agents_get_agent_group($id_agente); $id_grupo = (int) agents_get_agent_group($id_agente);
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo); $all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
@ -445,8 +446,6 @@ if ($module_action === 'delete') {
} }
} else if ($module_action === 'disable') { } else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete'); $id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0; $updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) { foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +489,52 @@ if ($module_action === 'delete') {
); );
} }
} }
} else if ($module_action === 'enable') {
$id_agent_modules_enable = (array) get_parameter('id_delete');
$updated_count = 0;
foreach ($id_agent_modules_enable as $id_agent_module_enable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 0
WHERE id_agente_modulo = %d',
$id_agent_module_enable
);
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_enable);
$agent_update_result = db_process_sql_update(
'tagente',
['update_module_count' => 1],
['id_agente' => $id_agent_changed]
);
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
$updated_count++;
}
}
$count_modules_to_enable = count($id_agent_modules_enable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_enable
)
);
} else {
if ($updated_count == $count_modules_to_enable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_enable
)
);
}
}
} }
@ -1274,6 +1319,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select( html_print_select(
[ [
'disable' => 'Disable selected modules', 'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules', 'delete' => 'Delete selected modules',
], ],
'module_action', 'module_action',
@ -1286,6 +1332,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false false
); );
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button( html_print_submit_button(
__('Execute action'), __('Execute action'),
'submit_modules_action', 'submit_modules_action',

View File

@ -69,7 +69,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 2); define('ID_NETWORK_COMPONENT_TYPE', 2);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php. // Function in module_manager_editor_common.php.
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} }

View File

@ -36,7 +36,7 @@ if (strstr($page, 'policy_modules') === false) {
define('ID_NETWORK_COMPONENT_TYPE', 4); define('ID_NETWORK_COMPONENT_TYPE', 4);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -82,7 +82,7 @@ if ($plugin_pass == '' && !$id_agent_module) {
$plugin_pass = 1; $plugin_pass = 1;
} }
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -34,7 +34,7 @@ $extra_title = __('WMI server module');
define('ID_NETWORK_COMPONENT_TYPE', 6); define('ID_NETWORK_COMPONENT_TYPE', 6);
if (empty($update_module_id)) { if (empty($edit_module)) {
// Function in module_manager_editor_common.php // Function in module_manager_editor_common.php
add_component_selection(ID_NETWORK_COMPONENT_TYPE); add_component_selection(ID_NETWORK_COMPONENT_TYPE);
} else { } else {

View File

@ -1842,6 +1842,10 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(document).ready (function () { $(document).ready (function () {
populate_agents_selector(); populate_agents_selector();
// Add data-pendingdelete attribute to exclude delete_pending modules
document.querySelector("#id_agents").dataset.pendingdelete = true
document.querySelector("#modules_selection_mode").dataset.pendingdelete = true
$("#id_agents").change(agent_changed_by_multiple_agents); $("#id_agents").change(agent_changed_by_multiple_agents);
$("#modules_selection_mode").change(agent_changed_by_multiple_agents); $("#modules_selection_mode").change(agent_changed_by_multiple_agents);

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) { if (!empty($downtimes)) {
ob_clean(); ob_clean();
// Show contentype header // Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/csv'); header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"'); header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"');
@ -161,7 +163,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) { if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) { foreach ($downtime_agents as $downtime_agent) {
$downtime_items = []; $downtime_items = [];
$downtime_items[] = $downtime_agent[alias]; $downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) { if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id']; $agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'), __('Export to CSV'),
'csv_export', 'csv_export',
false, false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"' 'class="sub next"'
); );
echo '</div>'; echo '</div>';

View File

@ -40,6 +40,7 @@ $update_command = (bool) get_parameter('update_command');
$create_command = (bool) get_parameter('create_command'); $create_command = (bool) get_parameter('create_command');
$delete_command = (bool) get_parameter('delete_command'); $delete_command = (bool) get_parameter('delete_command');
$copy_command = (bool) get_parameter('copy_command'); $copy_command = (bool) get_parameter('copy_command');
$content_type = (string) get_parameter('content_type', 'text/plain');
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands'; $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands';
@ -226,7 +227,7 @@ if (is_ajax()) {
'field'.$i.'_value', 'field'.$i.'_value',
'text/plain', 'text/plain',
'', '',
'', $content_type == 'text/plain',
$is_management_allowed, $is_management_allowed,
'', '',
'', '',
@ -238,7 +239,7 @@ if (is_ajax()) {
'field'.$i.'_value', 'field'.$i.'_value',
'text/html', 'text/html',
'', '',
'text/html', $content_type == 'text/html',
$is_management_allowed, $is_management_allowed,
'', '',
'', '',

View File

@ -231,7 +231,7 @@ if (strlen(trim($agentName)) > 0) {
} }
if ($actionID != -1 && $actionID != '') { if ($actionID != -1 && $actionID != '') {
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))'; $where .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.')))';
} }
if ($status_alert === 'disabled') { if ($status_alert === 'disabled') {

View File

@ -353,9 +353,18 @@ if ($delete_action) {
if ($enable_alert) { if ($enable_alert) {
$searchFlag = true; $searchFlag = true;
$id_alert = (int) get_parameter('id_alert'); $id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, false); $result = alerts_agent_module_disable($id_alert, false);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT, AUDIT_LOG_ALERT_MANAGEMENT,
@ -380,9 +389,18 @@ if ($enable_alert) {
if ($disable_alert) { if ($disable_alert) {
$searchFlag = true; $searchFlag = true;
$id_alert = (int) get_parameter('id_alert'); $id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, true); $result = alerts_agent_module_disable($id_alert, true);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT, AUDIT_LOG_ALERT_MANAGEMENT,

View File

@ -66,6 +66,7 @@ if ($id) {
$severity = explode(',', $filter['severity']); $severity = explode(',', $filter['severity']);
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
$text_module = $filter['text_module']; $text_module = $filter['text_module'];
@ -73,6 +74,7 @@ if ($id) {
$pagination = $filter['pagination']; $pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr']; $event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack']; $id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep']; $group_rep = $filter['group_rep'];
$date_from = str_replace('-', '/', $filter['date_from']); $date_from = str_replace('-', '/', $filter['date_from']);
$date_to = str_replace('-', '/', $filter['date_to']); $date_to = str_replace('-', '/', $filter['date_to']);
@ -115,10 +117,12 @@ if ($id) {
$severity = ''; $severity = '';
$status = ''; $status = '';
$search = ''; $search = '';
$not_search = 0;
$text_agent = ''; $text_agent = '';
$pagination = ''; $pagination = '';
$event_view_hr = ''; $event_view_hr = '';
$id_user_ack = ''; $id_user_ack = '';
$owner_user = '';
$group_rep = ''; $group_rep = '';
$date_from = ''; $date_from = '';
$date_to = ''; $date_to = '';
@ -140,6 +144,7 @@ if ($update || $create) {
$severity = implode(',', get_parameter('severity', -1)); $severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$not_search = get_parameter_switch('not_search', 0);
$text_agent = get_parameter('text_agent', ''); $text_agent = get_parameter('text_agent', '');
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', ''); $text_module = get_parameter('text_module', '');
@ -157,6 +162,7 @@ if ($update || $create) {
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', ''); $group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', ''); $date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', ''); $date_to = get_parameter('date_to', '');
@ -185,12 +191,14 @@ if ($update || $create) {
'severity' => $severity, 'severity' => $severity,
'status' => $status, 'status' => $status,
'search' => $search, 'search' => $search,
'not_search' => $not_search,
'text_agent' => $text_agent, 'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module, 'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent, 'id_agent' => $id_agent,
'pagination' => $pagination, 'pagination' => $pagination,
'event_view_hr' => $event_view_hr, 'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack, 'id_user_ack' => $id_user_ack,
'owner_user' => $owner_user,
'group_rep' => $group_rep, 'group_rep' => $group_rep,
'tag_with' => $tag_with_json, 'tag_with' => $tag_with_json,
'tag_without' => $tag_without_json, 'tag_without' => $tag_without_json,
@ -376,6 +384,15 @@ $table->data[6][1] = html_print_input_text(
255, 255,
true true
); );
$table->data[6][1] .= ' '.html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$table->data[7][0] = '<b>'.__('Agent search').'</b>'; $table->data[7][0] = '<b>'.__('Agent search').'</b>';
$params = []; $params = [];
@ -420,7 +437,12 @@ $table->data[9][1] = html_print_input_text(
true true
); );
$table->data[10][0] = '<b>'.__('User ack.').'</b>'.' '.ui_print_help_tip(__('Choose between the users who have validated an event. '), true); $table->data[10][0] = '<b>'.__('User ack.').'</b>';
$table->data[10][0] .= ' ';
$table->data[10][0] .= ui_print_help_tip(
__('Choose between the users who have validated an event. '),
true
);
if ($strict_user) { if ($strict_user) {
$users = [$config['id_user'] => $config['id_user']]; $users = [$config['id_user'] => $config['id_user']];
@ -442,14 +464,25 @@ $table->data[10][1] = html_print_select(
true true
); );
$table->data[11][0] = '<b>'.__('Owner.').'</b>';
$table->data[11][1] = html_print_select(
$users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$repeated_sel = [ $repeated_sel = [
EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
]; ];
$table->data[11][0] = '<b>'.__('Repeated').'</b>'; $table->data[12][0] = '<b>'.__('Repeated').'</b>';
$table->data[11][1] = html_print_select( $table->data[12][1] = html_print_select(
$repeated_sel, $repeated_sel,
'group_rep', 'group_rep',
$group_rep, $group_rep,
@ -459,11 +492,11 @@ $table->data[11][1] = html_print_select(
true true
); );
$table->data[12][0] = '<b>'.__('Date from').'</b>'; $table->data[13][0] = '<b>'.__('Date from').'</b>';
$table->data[12][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); $table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true);
$table->data[13][0] = '<b>'.__('Date to').'</b>'; $table->data[14][0] = '<b>'.__('Date to').'</b>';
$table->data[13][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); $table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true);
$tag_with = json_decode($tag_with_json_clean, true); $tag_with = json_decode($tag_with_json_clean, true);
if (empty($tag_with)) { if (empty($tag_with)) {
@ -502,9 +535,9 @@ $remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without); $add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp); $remove_without_tag_disabled = empty($tag_without_temp);
$table->colspan[14][0] = '2'; $table->colspan[15][0] = '2';
$table->data[14][0] = '<b>'.__('Events with following tags').'</b>'; $table->data[15][0] = '<b>'.__('Events with following tags').'</b>';
$table->data[15][0] = html_print_select( $table->data[16][0] = html_print_select(
$tags_select_with, $tags_select_with,
'select_with', 'select_with',
'', '',
@ -518,7 +551,7 @@ $table->data[15][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[15][1] = html_print_button( $table->data[16][1] = html_print_button(
__('Add'), __('Add'),
'add_whith', 'add_whith',
$add_with_tag_disabled, $add_with_tag_disabled,
@ -527,7 +560,7 @@ $table->data[15][1] = html_print_button(
true true
); );
$table->data[16][0] = html_print_select( $table->data[17][0] = html_print_select(
$tag_with_temp, $tag_with_temp,
'tag_with_temp', 'tag_with_temp',
[], [],
@ -541,12 +574,12 @@ $table->data[16][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[16][0] .= html_print_input_hidden( $table->data[17][0] .= html_print_input_hidden(
'tag_with', 'tag_with',
$tag_with_base64, $tag_with_base64,
true true
); );
$table->data[16][1] = html_print_button( $table->data[17][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whith', 'remove_whith',
$remove_with_tag_disabled, $remove_with_tag_disabled,
@ -555,9 +588,9 @@ $table->data[16][1] = html_print_button(
true true
); );
$table->colspan[17][0] = '2'; $table->colspan[18][0] = '2';
$table->data[17][0] = '<b>'.__('Events without following tags').'</b>'; $table->data[18][0] = '<b>'.__('Events without following tags').'</b>';
$table->data[18][0] = html_print_select( $table->data[19][0] = html_print_select(
$tags_select_without, $tags_select_without,
'select_without', 'select_without',
'', '',
@ -571,7 +604,7 @@ $table->data[18][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[18][1] = html_print_button( $table->data[19][1] = html_print_button(
__('Add'), __('Add'),
'add_whithout', 'add_whithout',
$add_without_tag_disabled, $add_without_tag_disabled,
@ -580,7 +613,7 @@ $table->data[18][1] = html_print_button(
true true
); );
$table->data[19][0] = html_print_select( $table->data[20][0] = html_print_select(
$tag_without_temp, $tag_without_temp,
'tag_without_temp', 'tag_without_temp',
[], [],
@ -594,12 +627,12 @@ $table->data[19][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[19][0] .= html_print_input_hidden( $table->data[20][0] .= html_print_input_hidden(
'tag_without', 'tag_without',
$tag_without_base64, $tag_without_base64,
true true
); );
$table->data[19][1] = html_print_button( $table->data[20][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whithout', 'remove_whithout',
$remove_without_tag_disabled, $remove_without_tag_disabled,
@ -608,8 +641,8 @@ $table->data[19][1] = html_print_button(
true true
); );
$table->data[20][0] = '<b>'.__('Alert events').'</b>'; $table->data[21][0] = '<b>'.__('Alert events').'</b>';
$table->data[20][1] = html_print_select( $table->data[21][1] = html_print_select(
[ [
'-1' => __('All'), '-1' => __('All'),
'0' => __('Filter alert events'), '0' => __('Filter alert events'),
@ -624,8 +657,8 @@ $table->data[20][1] = html_print_select(
); );
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->data[21][0] = '<b>'.__('Module search').'</b>'; $table->data[22][0] = '<b>'.__('Module search').'</b>';
$table->data[21][1] .= html_print_autocomplete_modules( $table->data[22][1] .= html_print_autocomplete_modules(
'module_search', 'module_search',
$text_module, $text_module,
false, false,
@ -637,17 +670,17 @@ if (!is_metaconsole()) {
); );
} }
$table->data[22][0] = '<b>'.__('Source').'</b>'; $table->data[23][0] = '<b>'.__('Source').'</b>';
$table->data[22][1] = html_print_input_text('source', $source, '', 35, 255, true); $table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true);
$table->data[23][0] = '<b>'.__('Extra ID').'</b>'; $table->data[24][0] = '<b>'.__('Extra ID').'</b>';
$table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); $table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$table->data[24][0] = '<b>'.__('Comment').'</b>'; $table->data[25][0] = '<b>'.__('Comment').'</b>';
$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); $table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[25][0] = '<b>'.__('Custom data filter type').'</b>'; $table->data[26][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[25][1] = html_print_select( $table->data[26][1] = html_print_select(
[ [
'0' => __('Filter custom data by name field'), '0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'), '1' => __('Filter custom data by value field'),
@ -660,12 +693,12 @@ $table->data[25][1] = html_print_select(
true true
); );
$table->data[26][0] = '<b>'.__('Custom data').'</b>'; $table->data[27][0] = '<b>'.__('Custom data').'</b>';
$table->data[26][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); $table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
if (is_metaconsole()) { if (is_metaconsole()) {
$table->data[27][0] = '<b>'.__('Id souce event').'</b>'; $table->data[28][0] = '<b>'.__('Id souce event').'</b>';
$table->data[27][1] = html_print_input_text( $table->data[28][1] = html_print_input_text(
'id_source_event', 'id_source_event',
$id_source_event, $id_source_event,
'', '',
@ -727,6 +760,14 @@ $(document).ready( function() {
}); });
function checked_slide_events(element) {
var value = $("#checkbox-"+element.name).val();
if (value == 0) {
$("#checkbox-"+element.name).val(1);
} else {
$("#checkbox-"+element.name).val(0);
}
}
function click_button_remove_tag(what_button) { function click_button_remove_tag(what_button) {
if (what_button == "with") { if (what_button == "with") {

View File

@ -92,6 +92,7 @@ if (is_ajax() === true) {
if ($get_group_agents === true) { if ($get_group_agents === true) {
ob_clean(); ob_clean();
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$id_os = (int) get_parameter('id_os', 0);
$disabled = (int) get_parameter('disabled', 0); $disabled = (int) get_parameter('disabled', 0);
$search = (string) get_parameter('search', ''); $search = (string) get_parameter('search', '');
$recursion = (int) get_parameter('recursion', 0); $recursion = (int) get_parameter('recursion', 0);
@ -151,6 +152,10 @@ if (is_ajax() === true) {
$filter['status'] = $status_agents; $filter['status'] = $status_agents;
} }
if ($id_os !== 0) {
$filter['id_os'] = $id_os;
}
$_sql_post = ' 1=1 '; $_sql_post = ' 1=1 ';
if ($show_void_agents == 0) { if ($show_void_agents == 0) {
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\''; $_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
@ -782,18 +787,18 @@ if ($tab == 'tree') {
$form = "<form method='post' action=''>"; $form = "<form method='post' action=''>";
$form .= "<table class='databox filters bolder' width='100%'>"; $form .= "<table class='databox filters bolder' width='100%'>";
$form .= '<tr><td>'.__('Search').'&nbsp;'; $form .= '<tr><td>'.__('Search').'&nbsp;&nbsp;&nbsp;';
$form .= html_print_input_text( $form .= html_print_input_text(
'search', 'search',
$search, $search,
'', '',
100, 30,
100, 30,
true true
); );
$form .= '</td><td>'; $form .= '</td><td style="text-align: right">';
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>"; $form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
$form .= '<td></tr>'; $form .= '</tr>';
$form .= '</table>'; $form .= '</table>';
$form .= '</form>'; $form .= '</form>';

View File

@ -181,6 +181,7 @@ if (empty($alert_templates)) {
$alert_templates = ''; $alert_templates = '';
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->width = '98%'; $table->width = '98%';
$table->data = []; $table->data = [];

View File

@ -192,6 +192,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -249,6 +249,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -148,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -164,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Godmode menu. * Godmode menu.
* *
@ -200,14 +201,14 @@ if ($access_console_node === true) {
$sub['gmassive']['type'] = 'direct'; $sub['gmassive']['type'] = 'direct';
$sub['gmassive']['subtype'] = 'nolink'; $sub['gmassive']['subtype'] = 'nolink';
$sub2 = []; $sub2 = [];
$sub2['godmode/massive/massive_operations&amp;tab=massive_agents']['text'] = __('Agents operations'); $sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_modules']['text'] = __('Modules operations'); $sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_plugins']['text'] = __('Plugins operations'); $sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) { if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
$sub2['godmode/massive/massive_operations&amp;tab=massive_users']['text'] = __('Users operations'); $sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
} }
$sub2['godmode/massive/massive_operations&amp;tab=massive_alerts']['text'] = __('Alerts operations'); $sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
enterprise_hook('massivepolicies_submenu'); enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu'); enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu'); enterprise_hook('massivesatellite_submenu');
@ -422,10 +423,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
if (is_user_admin($config['id_user']) === true) { if (is_user_admin($config['id_user']) === true) {
$sub['extensions/db_status']['text'] = __('DB Schema Check'); $sub['extensions/db_status']['text'] = __('DB Schema Check');
$sub['extensions/db_status']['id'] = 'DB Schema Check'; $sub['extensions/db_status']['id'] = 'DB Schema Check';
$sub['extensions/db_status']['sec'] = 'gbman'; $sub['extensions/db_status']['sec'] = 'gextensions';
$sub['extensions/dbmanager']['text'] = __('DB Interface'); $sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface'; $sub['extensions/dbmanager']['id'] = 'DB Interface';
$sub['extensions/dbmanager']['sec'] = 'gbman'; $sub['extensions/dbmanager']['sec'] = 'gextensions';
enterprise_hook('dbBackupManager'); enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu'); enterprise_hook('elasticsearch_interface_menu');
} }
@ -578,6 +579,14 @@ if ($access_console_node === true) {
} }
} }
if ($access_console_node === true) {
// About.
$menu_godmode['about']['text'] = __('About');
$menu_godmode['about']['id'] = 'about';
}
if ((bool) $config['pure'] === false) { if ((bool) $config['pure'] === false) {
menu_print_menu($menu_godmode); menu_print_menu($menu_godmode);
} }
echo '<div id="about-div"></div>';

View File

@ -189,6 +189,8 @@ if ($export_profile) {
} }
} }
// Set cookie for download control.
setDownloadCookieToken();
// Send headers to tell the browser we're sending a file // Send headers to tell the browser we're sending a file
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
@ -285,7 +287,7 @@ foreach ($result as $row) {
] ]
); );
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -229,7 +229,8 @@ if ($add_module === true) {
// Safe output remove all entities. // Safe output remove all entities.
io_safe_output_array($id_modules, ''); io_safe_output_array($id_modules, '');
$id_modules = array_map(function ($mod) { $id_modules = array_map(
function ($mod) {
return io_safe_input($mod); return io_safe_input($mod);
}, },
$id_modules $id_modules

View File

@ -169,6 +169,7 @@ $visual_format = 0;
$filter_search = ''; $filter_search = '';
$filter_exclude = ''; $filter_exclude = '';
$use_prefix_notation = true;
// Added for select fields. // Added for select fields.
$total_time = true; $total_time = true;
@ -461,6 +462,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'max_value': case 'max_value':
@ -476,6 +478,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'min_value': case 'min_value':
@ -491,6 +494,7 @@ switch ($action) {
$lapse = $item['lapse']; $lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc']; $lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format']; $visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'sumatory': case 'sumatory':
@ -504,6 +508,7 @@ switch ($action) {
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
$period = $item['period']; $period = $item['period'];
$uncompressed_module = $item['uncompressed_module']; $uncompressed_module = $item['uncompressed_module'];
$use_prefix_notation = $item['use_prefix_notation'];
break; break;
case 'historical_data': case 'historical_data':
@ -773,6 +778,7 @@ switch ($action) {
$show_resume = $item['show_resume']; $show_resume = $item['show_resume'];
$show_graph = $item['show_graph']; $show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown']; $order_uptodown = $item['order_uptodown'];
$use_prefix_notation = $item['use_prefix_notation'];
$text_agent = ''; $text_agent = '';
if (isset($style['text_agent']) === true if (isset($style['text_agent']) === true
@ -3404,6 +3410,22 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_use_prefix_notation" class="datos advanced_elements">
<td class="bolder">
<?php
echo __('Use prefix notation');
ui_print_help_tip(
__('Use prefix notation for numeric values (example: 20,8Kbytes/sec), otherwise full value will be displayed (example: 20.742 bytes/sec)')
);
?>
</td>
<td>
<?php
html_print_checkbox_switch('use_prefix_notation', 1, $use_prefix_notation);
?>
</td>
</tr>
<tr id="row_uncompressed_module" class="datos"> <tr id="row_uncompressed_module" class="datos">
<td class="bolder"> <td class="bolder">
<?php <?php
@ -6367,6 +6389,7 @@ function chooseType() {
$("#row_show_summary").hide(); $("#row_show_summary").hide();
$("#row_group_by").hide(); $("#row_group_by").hide();
$("#row_type_show").hide(); $("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
// SLA list default state. // SLA list default state.
$("#sla_list").hide(); $("#sla_list").hide();
@ -6561,6 +6584,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'max_value': case 'max_value':
@ -6572,6 +6596,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'min_value': case 'min_value':
@ -6583,6 +6608,7 @@ function chooseType() {
$("#row_lapse").show(); $("#row_lapse").show();
$("#row_visual_format").show(); $("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'sumatory': case 'sumatory':
@ -6592,6 +6618,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_uncompressed_module").show(); $("#row_uncompressed_module").show();
$("#row_use_prefix_notation").show();
break; break;
case 'historical_data': case 'historical_data':
@ -6879,6 +6906,7 @@ function chooseType() {
$("#row_show_resume").show(); $("#row_show_resume").show();
$("#row_show_graph").show(); $("#row_show_graph").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break; break;
case 'exception': case 'exception':

View File

@ -1055,7 +1055,7 @@ switch ($action) {
] ]
); );
$data[2] .= '</a>'; $data[2] .= '</a>';
$data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">'; $data[3] = '<a onclick="blockResubmit($(this))" href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">';
$data[3] .= html_print_image( $data[3] .= html_print_image(
'images/xml.png', 'images/xml.png',
true, true,
@ -1888,6 +1888,9 @@ switch ($action) {
$values['visual_format'] = get_parameter( $values['visual_format'] = get_parameter(
'visual_format' 'visual_format'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
@ -1911,6 +1914,9 @@ switch ($action) {
$values['show_graph'] = get_parameter( $values['show_graph'] = get_parameter(
'combo_graph_options' 'combo_graph_options'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
} }
@ -2176,6 +2182,8 @@ switch ($action) {
'historical_db_check' 'historical_db_check'
); );
$values['top_n_value'] = get_parameter('max_items'); $values['top_n_value'] = get_parameter('max_items');
$values['server_name'] = get_parameter('combo_server');
} else if ($values['type'] == 'url') { } else if ($values['type'] == 'url') {
$values['external_source'] = get_parameter('url'); $values['external_source'] = get_parameter('url');
} else if ($values['type'] == 'event_report_group') { } else if ($values['type'] == 'event_report_group') {
@ -2704,6 +2712,9 @@ switch ($action) {
$values['visual_format'] = get_parameter( $values['visual_format'] = get_parameter(
'visual_format' 'visual_format'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
@ -2720,6 +2731,9 @@ switch ($action) {
$values['show_graph'] = get_parameter( $values['show_graph'] = get_parameter(
'combo_graph_options' 'combo_graph_options'
); );
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true; $good_format = true;
break; break;
} }

View File

@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true); $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">'; $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true); $data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plug-in parameters'); $data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$table->data['plugin_parameters'] = $data; $table->data['plugin_parameters'] = $data;
$data = []; $data = [];
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>"; $datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true); $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, false, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>"; $datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true); $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>"; $datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : '';
$datam[1] = html_print_textarea( $datam[1] = html_print_textarea(
$macro_help_name, $macro_help_name,
6, 6,
100, 100,
$macro_help_value, $macro_help_value,
'class="command_macro" class="w97p"'.$tadisabled, 'class="command_macro" class="w97p"',
true true
); );
if ($locked) {
$datam[1] .= html_print_image(
'images/lock_mc.png',
true,
['class' => 'command_macro lock invert_filter']
);
}
$datam[1] .= '<br><br><br>'; $datam[1] .= '<br><br><br>';
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -551,6 +529,8 @@ if (($create != '') || ($view != '')) {
// Add/Delete buttons // Add/Delete buttons
$datam = []; $datam = [];
if (!$locked) {
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image( $datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png', 'images/add.png',
true, true,
@ -559,7 +539,6 @@ if (($create != '') || ($view != '')) {
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>'; $datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>'; $datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
if (!$locked) {
$delete_macro_style = ''; $delete_macro_style = '';
if ($i <= 2) { if ($i <= 2) {
$delete_macro_style = 'display:none;'; $delete_macro_style = 'display:none;';
@ -1002,7 +981,10 @@ ui_require_javascript_file('pandora_modules');
}); });
update_preview(); update_preview();
} }
if (locked === 0) {
$('a#add_macro_btn').click(add_macro_click_event); $('a#add_macro_btn').click(add_macro_click_event);
}
// Delete macro // Delete macro
var delete_macro_click_event = function (event) { var delete_macro_click_event = function (event) {
@ -1031,45 +1013,12 @@ ui_require_javascript_file('pandora_modules');
} }
} }
var command_click_locked_event = function (event) {
var $element = $(this);
if (!$element.is('input') || ($element.is('input') && ($element.prop('readonly') || $element.prop('disabled')))) {
if ($element.prop('id') === 'form_parameters') {
var message = '<?php echo __('Some modules or components are using the plugin'); ?>'
+ '.\n' + '<?php echo __('Are you sure you want to unlock this item?'); ?>';
if (confirm(message)) {
if ($element.is('input')) {
$element
.prop('readonly', false)
.prop('disabled', false)
.siblings('img.command_advanced_conf.lock')
.remove();
}
else {
$element
.siblings('input.command_advanced_conf')
.prop('readonly', false)
.prop('disabled', false)
$element.remove();
}
}
}
else {
alert("<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>");
}
}
}
var macros_click_locked_event = function (event) { var macros_click_locked_event = function (event) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>"); alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
} }
if (locked) { if (locked) {
$('a#add_macro_btn').click(add_macro_click_locked_event); $('a#add_macro_btn').click(add_macro_click_locked_event);
$('.command_advanced_conf').click(command_click_locked_event);
$('.command_macro').click(macros_click_locked_event);
} }

View File

@ -684,23 +684,6 @@ $table_other->data[$i++][1] = html_print_input_text(
true true
); );
if (enterprise_installed() === true) {
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
$table_other->data[$i++][1] = html_print_input(
[
'type' => 'select',
'name' => 'phantomjs_cache_interval',
'return' => true,
'fields' => [
PHANTOM_CACHE_CLEANUP_ONCE => __('No scheduled'),
PHANTOM_CACHE_CLEANUP_WEEKLY => __('Each week'),
PHANTOM_CACHE_CLEANUP_DAILY => __('Each day'),
],
'selected' => ($config['phantomjs_cache_interval'] ?? PHANTOM_CACHE_CLEANUP_ONCE),
]
);
}
// Agent Wizard defaults. // Agent Wizard defaults.
$defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults'])); $defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults']));
$tableSnmpWizard = new stdClass(); $tableSnmpWizard = new stdClass();

View File

@ -77,6 +77,7 @@ if (is_ajax()) {
true true
).'&nbsp;&nbsp;'; ).'&nbsp;&nbsp;';
$table->data['autocreate_remote_users'] = $row; $table->data['autocreate_remote_users'] = $row;
$table->data['csrf_token'] = html_print_csrf_hidden();
add_enterprise_auth_autocreate_profiles($table, $type_auth); add_enterprise_auth_autocreate_profiles($table, $type_auth);
} }
@ -475,6 +476,8 @@ if (!is_metaconsole()) {
html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass'])); html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass']));
} }
html_print_csrf_hidden();
html_print_table($table); html_print_table($table);
echo '<div id="table_auth_result"></div>'; echo '<div id="table_auth_result"></div>';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';

View File

@ -95,11 +95,11 @@ $table->data[$i++][1] = html_print_input_text(
true true
); );
$table->data[$i][0] = __('Phantomjs bin directory'); $table->data[$i][0] = __('Chromium path');
$table->data[$i++][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'phantomjs_bin', 'chromium_path',
io_safe_output( io_safe_output(
$config['phantomjs_bin'] $config['chromium_path']
), ),
'', '',
30, 30,

View File

@ -1312,6 +1312,27 @@ $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_f
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++; $row++;
$decimal_separators = [
',' => ',',
'.' => '.'
];
$table_other->data[$row][0] = __('Decimal separator');
$table_other->data[$row][1] = html_print_select(
$decimal_separators,
'decimal_separator',
$config['decimal_separator'],
'',
'',
'',
true,
false,
false
);
$row++;
if ($config['prominent_time'] == 'comparation') { if ($config['prominent_time'] == 'comparation') {
$timestamp = false; $timestamp = false;
$comparation = true; $comparation = true;

View File

@ -1599,6 +1599,10 @@ $(document).ready (function () {
name: "get_recovery_fields", name: "get_recovery_fields",
value: "0" value: "0"
}); });
values.push({
name: "content_type",
value: "<?php echo $al_field4; ?>"
})
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values, values,
function (data, status) { function (data, status) {
@ -1624,8 +1628,9 @@ $(document).ready (function () {
// The row provided has a predefined class. We delete it. // The row provided has a predefined class. We delete it.
$('#table_macros-field' + i) $('#table_macros-field' + i)
.removeAttr('class'); .removeAttr('class');
if(old_value && i != 4){
$("[name=field" + i + "_value]").val(old_value).trigger('change'); $("[name=field" + i + "_value]").val(old_value).trigger('change');
}
$('#table_macros-field').show(); $('#table_macros-field').show();
} }
} }

View File

@ -404,6 +404,7 @@ if ($id_profile || $new_profile) {
html_print_input_hidden('create_profile', 1); html_print_input_hidden('create_profile', 1);
} else { } else {
html_print_input_hidden('id', $id_profile); html_print_input_hidden('id', $id_profile);
html_print_input_hidden('old_name_profile', $name);
html_print_input_hidden('update_profile', 1); html_print_input_hidden('update_profile', 1);
html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"'); html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"');
} }
@ -425,5 +426,43 @@ enterprise_hook('close_meta_frame');
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'}); $(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
}); });
} }
//Not enable enter for prevent submits
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
$('#text-name').on('blur',function(){
/* Check if the name is already on use for new profiles or check if the
name is already on use for update checking if the name is distinct of the original*/
if($('#hidden-create_profile').val()==1 || ($('#hidden-update_profile').val()==1 && $('#hidden-old_name_profile').val()!=$('#text-name').val())){
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "html",
data: {
page: 'include/ajax/profile',
search_profile_nanme: true,
profile_name: $('#text-name').val().trim(),
},
success: function (data) {
if(data === 'true'){
alert( <?php echo "'".__('Profile name already on use, please, change the name before save')."'"; ?> );
if($('#hidden-old_name_profile').val()){
$('#text-name').val($('#hidden-old_name_profile').val());
}else{
$('#text-name').val("");
}
}
},
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
});
}
}); });
</script> </script>

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['id_user']) { if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($id_user); $user_row = users_get_user_by_id($id_user);
$private_dashboards = db_get_all_rows_filter(
'tdashboard',
['id_user' => $id_user],
'id'
);
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
header('Refresh:1');
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
); );
// Delete the user in all the consoles. // Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
foreach ($servers as $server) { foreach ($servers as $server) {
// Connect to the remote console. // Connect to the remote console.
if (metaconsole_connect($server) === NOERR) { if (metaconsole_connect($server) === NOERR) {
// Delete the user. // Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
@ -367,6 +382,8 @@ if ($delete_user === true) {
__('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) __('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
); );
} }
header('Refresh:1');
} }
} else { } else {
ui_print_error_message(__('There was a problem deleting the user')); ui_print_error_message(__('There was a problem deleting the user'));

View File

@ -1450,17 +1450,17 @@ class DiscoveryTaskList extends HTML
// Header information. // Header information.
if ((int) $task['status'] <= 0 && empty($summary)) { if ((int) $task['status'] <= 0 && empty($summary)) {
if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) { if ((int) $task['utimestamp'] !== 0) {
$outputMessage = __('Task completed.'); $output .= $this->progressTaskGraph($task);
} else { } else {
$outputMessage = __('This task has never executed'); $outputMessage = __('This task has never executed');
}
$output .= ui_print_info_message( $output .= ui_print_info_message(
$outputMessage, $outputMessage,
'', '',
true true
); );
}
} else if ($task['status'] == 1 } else if ($task['status'] == 1
|| ($task['utimestamp'] == 0 && $task['interval_sweep']) || ($task['utimestamp'] == 0 && $task['interval_sweep'])
) { ) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -654,7 +654,7 @@ if ($get_agent_alerts_datatable === true) {
} }
$idGroup = $filter_alert['ag_group']; $idGroup = $filter_alert['ag_group'];
$tag_filter = $filter_alert['tag_filter']; $tag_filter = $filter_alert['tag'];
$action_filter = $filter_alert['action']; $action_filter = $filter_alert['action'];
try { try {
@ -884,9 +884,9 @@ if ($get_agent_alerts_datatable === true) {
users_get_groups($config['id_user'], $access, false) users_get_groups($config['id_user'], $access, false)
); );
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter); $alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter); $countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false);
} }
} }

View File

@ -429,7 +429,9 @@ if (check_login()) {
$table_modules->data[$key][1] = remove_right_zeros( $table_modules->data[$key][1] = remove_right_zeros(
number_format( number_format(
$value['datos'], $value['datos'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} else { } else {

View File

@ -59,6 +59,7 @@ $drawConsoleSound = (bool) get_parameter('drawConsoleSound', false);
$process_buffers = (bool) get_parameter('process_buffers', false); $process_buffers = (bool) get_parameter('process_buffers', false);
$get_extended_event = (bool) get_parameter('get_extended_event'); $get_extended_event = (bool) get_parameter('get_extended_event');
$change_status = (bool) get_parameter('change_status'); $change_status = (bool) get_parameter('change_status');
$get_Acknowledged = (bool) get_parameter('get_Acknowledged');
$change_owner = (bool) get_parameter('change_owner'); $change_owner = (bool) get_parameter('change_owner');
$add_comment = (bool) get_parameter('add_comment'); $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');
@ -351,12 +352,14 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -409,12 +412,14 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -481,6 +486,7 @@ if ($get_filter_values) {
'user_comment' => '', 'user_comment' => '',
'id_extra' => '', 'id_extra' => '',
'id_user_ack' => '', 'id_user_ack' => '',
'owner_user' => '',
'date_from' => '', 'date_from' => '',
'time_from' => '', 'time_from' => '',
'date_to' => '', 'date_to' => '',
@ -642,6 +648,8 @@ function load_form_filter() {
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$('#text-search').val(val); $('#text-search').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
$('input[name=text_agent]').val(val); $('input[name=text_agent]').val(val);
if (i == 'id_agent') if (i == 'id_agent')
@ -654,6 +662,8 @@ function load_form_filter() {
$("#text-event_view_hr").val(val); $("#text-event_view_hr").val(val);
if (i == 'id_user_ack') if (i == 'id_user_ack')
$("#id_user_ack").val(val); $("#id_user_ack").val(val);
if (i == 'owner_user')
$("#owner_user").val(val);
if (i == 'group_rep') if (i == 'group_rep')
$("#group_rep").val(val); $("#group_rep").val(val);
if (i == 'tag_with') if (i == 'tag_with')
@ -898,12 +908,14 @@ function save_new_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()), "tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()), "tag_without": Base64.decode($("#hidden-tag_without").val()),
@ -975,12 +987,14 @@ function save_update_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with" : Base64.decode($("#hidden-tag_with").val()), "tag_with" : Base64.decode($("#hidden-tag_with").val()),
"tag_without" : Base64.decode($("#hidden-tag_without").val()), "tag_without" : Base64.decode($("#hidden-tag_without").val()),
@ -1500,6 +1514,12 @@ if ($change_status === true) {
return; return;
} }
if ($get_Acknowledged === true) {
$event_id = get_parameter('event_id');
echo events_page_general_acknowledged($event_id);
return;
}
if ($change_owner === true) { if ($change_owner === true) {
$new_owner = get_parameter('new_owner', ''); $new_owner = get_parameter('new_owner', '');
$event_id = (int) get_parameter('event_id', 0); $event_id = (int) get_parameter('event_id', 0);
@ -2018,8 +2038,10 @@ if ($total_event_graph) {
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';
$prueba = grafico_eventos_total('', 280, 150, false, true); $out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
echo $prueba; $out .= grafico_eventos_total('', 0, 0, false, true);
$out .= '<div>';
echo $out;
return; return;
} }
@ -2028,8 +2050,10 @@ if ($graphic_event_group) {
include_once $config['homedir'].'/include/functions_graph.php'; include_once $config['homedir'].'/include/functions_graph.php';
$prueba = grafico_eventos_grupo(280, 150, '', false, true); $out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
echo $prueba; $out .= grafico_eventos_grupo(0, 0, '', false, true);
$out .= '<div>';
echo $out;
return; return;
} }
@ -2270,7 +2294,7 @@ if ($drawConsoleSound === true) {
], ],
], ],
[ [
'label' => __('Time Sound'), 'label' => __('Sound duration'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $times_sound, 'fields' => $times_sound,
@ -2417,6 +2441,7 @@ if ($get_events_fired) {
'severity' => -1, 'severity' => -1,
'status' => -1, 'status' => -1,
'search' => '', 'search' => '',
'not_search' => 0,
'text_agent' => '', 'text_agent' => '',
'id_agent' => 0, 'id_agent' => 0,
'id_agent_module' => 0, 'id_agent_module' => 0,

View File

@ -26,6 +26,8 @@
* ============================================================================ * ============================================================================
*/ */
use PandoraFMS\Enterprise\Metaconsole\Node;
// Begin. // Begin.
if (check_login()) { if (check_login()) {
global $config; global $config;
@ -59,6 +61,11 @@ if (check_login()) {
0 0
); );
$get_data_dataMatrix = (bool) get_parameter(
'get_data_dataMatrix',
0
);
if ($get_agent_modules_json_by_name === true) { if ($get_agent_modules_json_by_name === true) {
$agent_name = get_parameter('agent_name'); $agent_name = get_parameter('agent_name');
@ -499,7 +506,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -507,7 +516,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -524,7 +535,9 @@ if (check_login()) {
$data[] = remove_right_zeros( $data[] = remove_right_zeros(
number_format( number_format(
$row[$attr[0]], $row[$attr[0]],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} }
@ -1430,4 +1443,190 @@ if (check_login()) {
return; return;
} }
if ($get_data_dataMatrix === true) {
global $config;
$table_id = get_parameter('table_id', '');
$modules = json_decode(
io_safe_output(
get_parameter('modules', '')
),
true
);
$period = get_parameter('period', 0);
$slice = get_parameter('slice', 0);
// Datatables offset, limit.
$start = get_parameter('start', 0);
$formatData = (bool) get_parameter('formatData', 0);
$length = get_parameter(
'length',
$config['block_size']
);
$order = get_datatable_order(true);
// Total time per page.
$time_all_box = ($length * $slice);
// Total number of boxes.
$total_box = ceil($period / $slice);
if ($start > 0) {
$start = ($start / $length);
}
// Uncompress.
try {
ob_start();
$dateNow = get_system_time();
$final = ($dateNow - $period);
$date = ($dateNow - ($time_all_box * $start));
if (($date - $time_all_box) > $final) {
$datelimit = ($date - $time_all_box);
} else {
$datelimit = $final;
}
foreach ($modules as $key => $value) {
if (is_metaconsole() === true) {
try {
$node = new Node((int) $value['id_node']);
$node->connect();
} catch (\Exception $e) {
// Unexistent agent.
$node->disconnect();
}
}
$value['thresholds'] = [
'min_critical' => (empty($value['c_min']) === true) ? null : $value['c_min'],
'max_critical' => (empty($value['c_max']) === true) ? null : $value['c_max'],
'min_warning' => (empty($value['w_min']) === true) ? null : $value['w_min'],
'max_warning' => (empty($value['w_max']) === true) ? null : $value['w_max'],
];
$module_data = db_uncompress_module_data(
$value['id'],
$datelimit,
$date,
$slice,
true
);
$uncompressData[] = array_reduce(
$module_data,
function ($carry, $item) use ($value, $config, $formatData) {
// Last value.
$vdata = null;
if (is_array($item['data']) === true) {
foreach ($item['data'] as $v) {
$vdata = $v['datos'];
}
}
$status = get_status_data_modules(
$value['id'],
$vdata,
$value['thresholds']
);
$resultData = '<span style="color:'.$status['color'].'">';
if ($vdata !== null && $vdata !== '' && $vdata !== false) {
if (isset($formatData) === true
&& (bool) $formatData === true
) {
$resultData .= format_for_graph(
$vdata,
$config['graph_precision']
);
} else {
$resultData .= sla_truncate(
$vdata,
$config['graph_precision']
);
}
$resultData .= ' '.$value['unit'];
} else {
$resultData .= '--';
}
$resultData .= '</span>';
$carry[] = [
'utimestamp' => $item['utimestamp'],
'Column-'.$value['id'] => $resultData,
];
return $carry;
},
[]
);
if (is_metaconsole() === true) {
$node->disconnect();
}
}
if (empty($uncompressData) === false) {
$data = array_reduce(
$uncompressData,
function ($carry, $item) {
foreach ($item as $data_module) {
foreach ($data_module as $key => $value) {
if ($key === 'utimestamp') {
$carry[$data_module['utimestamp']]['date'] = date('Y-m-d H:i', (int) $value);
} else {
$carry[$data_module['utimestamp']][$key] = $value;
}
}
}
return $carry;
}
);
}
if (empty($data) === false) {
$data = array_reverse(array_values($data));
} else {
$data = [];
}
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $total_box,
'recordsFiltered' => $total_box,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
return;
}
} }

View File

@ -0,0 +1,29 @@
<?php
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once $config['homedir'].'/include/functions_profile.php';
// Clean the possible blanks introduced by the included files.
ob_clean();
$search_profile_name = (bool) get_parameter('search_profile_nanme');
if ($search_profile_name) {
$profile_name = (string) get_parameter('profile_name');
echo json_encode(profile_exist($profile_name));
return;
}

View File

@ -148,9 +148,7 @@ function process_user_login_local($login, $pass, $api=false)
{ {
global $config, $mysql_cache; global $config, $mysql_cache;
// Connect to Database // Connect to Database.
switch ($config['dbtype']) {
case 'mysql':
if (!$api) { if (!$api) {
$sql = sprintf( $sql = sprintf(
"SELECT `id_user`, `password` "SELECT `id_user`, `password`
@ -168,55 +166,19 @@ function process_user_login_local($login, $pass, $api=false)
$login $login
); );
} }
break;
case 'postgresql':
if (!$api) {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\' AND "not_login" = 0
AND "disabled" = 0',
$login
);
} else {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\'
AND "disabled" = 0',
$login
);
}
break;
case 'oracle':
if (!$api) {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\' AND not_login = 0
AND disabled = 0',
$login
);
} else {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\'
AND disabled = 0',
$login
);
}
break;
}
$row = db_get_row_sql($sql); $row = db_get_row_sql($sql);
// Check that row exists, that password is not empty and that password is the same hash // Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
if ($row !== false && $row['password'] !== md5('') if (strlen($row['password']) === 32) {
&& $row['password'] == md5($pass) // MD5.
) { $credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
} else {
// Bcrypt.
$credentials_check = password_verify($pass, $row['password']);
}
if ($credentials_check === true) {
// Login OK // Login OK
// Nick could be uppercase or lowercase (select in MySQL // Nick could be uppercase or lowercase (select in MySQL
// is not case sensitive) // is not case sensitive)
@ -231,6 +193,11 @@ function process_user_login_local($login, $pass, $api=false)
return false; return false;
} }
// Override password to use Bcrypt encryption.
if (strlen($row['password']) === 32) {
update_user_password($login, $pass);
}
return $row['id_user']; return $row['id_user'];
} else { } else {
if (!user_can_login($login)) { if (!user_can_login($login)) {
@ -655,8 +622,16 @@ function process_user_contact(string $id_user)
function create_user($id_user, $password, $user_info) function create_user($id_user, $password, $user_info)
{ {
$values = $user_info; $values = $user_info;
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['id_user'] = $id_user; $values['id_user'] = $id_user;
$values['password'] = md5($password); $values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
$values['last_connect'] = 0; $values['last_connect'] = 0;
$values['registered'] = get_system_time(); $values['registered'] = get_system_time();
@ -747,7 +722,7 @@ function delete_user(string $id_user)
/** /**
* Update the password in MD5 for user pass as id_user with * Update the password using BCRYPT algorithm for specific id_user passing
* password in plain text. * password in plain text.
* *
* @param string $user User ID. * @param string $user User ID.
@ -764,9 +739,19 @@ function update_user_password(string $user, string $password_new)
return false; return false;
} }
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
if (isset($config['auth']) === true && $config['auth'] === 'pandora') { if (isset($config['auth']) === true && $config['auth'] === 'pandora') {
$sql = sprintf( $sql = sprintf(
"UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'" "UPDATE tusuario SET password = '%s', last_pass_change = '%s' WHERE id_user = '%s'",
($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
date('Y-m-d H:i:s', get_system_time()),
$user
); );
$connection = mysql_connect_db( $connection = mysql_connect_db(
@ -786,7 +771,7 @@ function update_user_password(string $user, string $password_new)
return db_process_sql_update( return db_process_sql_update(
'tusuario', 'tusuario',
[ [
'password' => md5($password_new), 'password' => ($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
'last_pass_change' => date('Y/m/d H:i:s', get_system_time()), 'last_pass_change' => date('Y/m/d H:i:s', get_system_time()),
], ],
['id_user' => $user] ['id_user' => $user]
@ -1050,7 +1035,14 @@ function create_user_and_permisions_ldap(
$values['id_user'] = $id_user; $values['id_user'] = $id_user;
if ($config['ldap_save_password'] || $config['ad_save_password']) { if ($config['ldap_save_password'] || $config['ad_save_password']) {
$values['password'] = md5($password); $column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
} }
$values['last_connect'] = 0; $values['last_connect'] = 0;
@ -1482,12 +1474,27 @@ function change_local_user_pass_ldap($id_user, $password)
$local_user_pass = db_get_value_filter('password', 'tusuario', ['id_user' => $id_user]); $local_user_pass = db_get_value_filter('password', 'tusuario', ['id_user' => $id_user]);
$return = false; $return = false;
if (md5($password) !== $local_user_pass) {
$values_update = [];
$values_update['password'] = md5($password);
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values_update = [];
if ($column_type === false) {
if (md5($password) !== $local_user_pass) {
$values_update['password'] = md5($password);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]); $return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
} }
} else {
if (password_hash($password, PASSWORD_BCRYPT) !== $local_user_pass) {
$values_update['password'] = password_hash($password, PASSWORD_BCRYPT);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
}
}
return $return; return $return;
} }

View File

@ -42,39 +42,22 @@ require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
$data_raw = get_parameter('data'); $data_raw = get_parameter('data');
$data_decoded = json_decode(base64_decode($data_raw), true); $data_decoded = json_decode(io_safe_output($data_raw), true);
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {
$data = urldecode($data_decoded['data']); $data = $data_decoded['data'];
$session_id = urldecode($data_decoded['session_id']); $session_id = $data_decoded['session_id'];
$data_combined = urldecode($data_decoded['data_combined']); $type_graph_pdf = $data_decoded['type_graph_pdf'];
$data_module_list = urldecode($data_decoded['data_module_list']);
$type_graph_pdf = urldecode($data_decoded['type_graph_pdf']);
$viewport_width = urldecode($data_decoded['viewport_width']);
}
$data_combined = [];
/** if (isset($data_decoded['data_combined']) === true) {
* Echo to stdout a PhantomJS callback call. $data_combined = $data_decoded['data_combined'];
*
* @return void
*/
function echoPhantomCallback()
{
?>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
try {
var status = window.callPhantom({ status: "loaded" });
} catch (error) {
console.log("CALLBACK ERROR", error.message)
} }
}, 100);
});
</script>
<?php
}
$data_module_list = [];
if (isset($data_decoded['data_module_list']) === true) {
$data_module_list = $data_decoded['data_module_list'];
}
}
// Initialize session. // Initialize session.
global $config; global $config;
@ -99,7 +82,6 @@ if (check_login(false) === false) {
</head> </head>
<body> <body>
<h1>Access is not granted</h1> <h1>Access is not granted</h1>
<?php echoPhantomCallback(); ?>
</body> </body>
</html> </html>
@ -108,10 +90,16 @@ if (check_login(false) === false) {
} }
// Access granted. // Access granted.
$params = json_decode($data, true); $params = $data;
if (isset($params['backgroundColor']) === false) {
$params['backgroundColor'] = 'inherit';
}
// Metaconsole connection to the node. // Metaconsole connection to the node.
$server_id = $params['server_id']; $server_id = 0;
if (isset($params['server_id']) === true) {
$server_id = $params['server_id'];
}
if (is_metaconsole() === true && empty($server_id) === false) { if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id); $server = metaconsole_get_connection_by_id($server_id);
@ -124,7 +112,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
ui_print_error_message( ui_print_error_message(
__('There was a problem connecting with the node') __('There was a problem connecting with the node')
); );
echoPhantomCallback();
?> ?>
</body> </body>
</html> </html>
@ -133,7 +120,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
} }
} }
$user_language = get_user_language($config['id_user']); $user_language = get_user_language($config['id_user']);
if (file_exists('languages/'.$user_language.'.mo') === true) { if (file_exists('languages/'.$user_language.'.mo') === true) {
$cfr = new CachedFileReader('languages/'.$user_language.'.mo'); $cfr = new CachedFileReader('languages/'.$user_language.'.mo');
@ -146,16 +132,16 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id).' - '.$interface_name; ?>)</title> <title>Pandora FMS Graph</title>
<link rel="stylesheet" href="styles/pandora.css" type="text/css" /> <link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" /> <link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" /> <link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" /> <link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script> <script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script>
@ -170,48 +156,46 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script> <script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chart.js"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chartjs-plugin-datalabels.min.js"></script>
</head> </head>
<body style='background-color: <?php echo $params['backgroundColor']; ?>;'> <body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
<?php <?php
$params['only_image'] = false; $params['only_image'] = false;
$params['menu'] = false; $params['menu'] = false;
$params['disable_black'] = true; $params['disable_black'] = true;
$params_combined = json_decode($data_combined, true); $params_combined = $data_combined;
$module_list = json_decode($data_module_list, true); $module_list = $data_module_list;
if (isset($params['vconsole']) === false || $params['vconsole'] === false) { $viewport = [
if ((int) $viewport_width > 0) { 'width' => 0,
$params['width'] = (int) $viewport_width; 'height' => 0,
];
$style = 'width:100%;';
if (isset($params['options']['viewport']) === true) {
$viewport = $params['options']['viewport'];
if (empty($viewport['width']) === false) {
$style .= 'width:'.$viewport['width'].'px;';
} }
if ((isset($params['width']) === false if (empty($viewport['height']) === false) {
|| ($params['width'] <= 0)) $style .= 'height:'.$viewport['height'].'px;';
) {
if ((int) $params['width'] <= 0) {
$params['width'] = 650;
}
if ((int) $params['landscape'] === 1) {
$params['width'] = 850;
}
if ($type_graph_pdf === 'slicebar') {
$params['width'] = 100;
$params['height'] = 70;
}
} }
} }
echo '<div>'; echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
switch ($type_graph_pdf) { switch ($type_graph_pdf) {
case 'combined': case 'combined':
$params['pdf'] = true; $params['pdf'] = true;
echo graphic_combined_module( $result = graphic_combined_module(
$module_list, $module_list,
$params, $params,
$params_combined $params_combined
); );
echo $result;
break; break;
case 'sparse': case 'sparse':
@ -219,67 +203,40 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
echo grafico_modulo_sparse($params); echo grafico_modulo_sparse($params);
break; break;
case 'pie_chart': case 'pie_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_pie_chart( $chart = get_build_setup_charts(
$params['values'], 'PIE',
$params['keys'], $params['options'],
$params['width'], $params['chart_data']
$params['height'],
$params['water_mark_url'],
$params['font'],
$config['font_size'],
$params['legend_position'],
$params['colors'],
$params['hide_labels']
); );
echo $chart->render(true);
break; break;
case 'vbar': case 'vbar_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_vcolumn_chart($params); $chart = get_build_setup_charts(
break; 'BAR',
$params['options'],
case 'hbar': $params['chart_data']
$params['pdf'] = true;
echo flot_hcolumn_chart(
$params['chart_data'],
$params['width'],
$params['height'],
$params['water_mark_url'],
$params['font'],
$config['font_size'],
$params['backgroundColor'],
$params['tick_color'],
$params['val_min'],
$params['val_max'],
$params['pdf']
); );
echo $chart->render(true);
break; break;
case 'ring_graph': case 'ring_graph':
$params['pdf'] = true; $params['pdf'] = true;
echo flot_custom_pie_chart( $params['options']['width'] = 500;
$params['chart_data'], $params['options']['height'] = 500;
$params['width'],
$params['height'], $chart = get_build_setup_charts(
$params['colors'], 'DOUGHNUT',
$params['module_name_list'], $params['options'],
$params['long_index'], $params['chart_data']
$params['no_data'],
false,
'',
$params['water_mark'],
$params['font'],
$config['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
$params['background_color'],
$params['legend_position'],
$params['background_color'],
$params['pdf']
); );
echo $chart->render(true);
break; break;
case 'slicebar': case 'slicebar':
@ -313,7 +270,6 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
} }
echo '</div>'; echo '</div>';
echoPhantomCallback();
?> ?>
</body> </body>
</html> </html>

View File

@ -2636,6 +2636,8 @@ class AgentWizard extends HTML
*/ */
private function resultsInterfaceWizard() private function resultsInterfaceWizard()
{ {
global $config;
$generalInterfaceModules = $this->getInterfacesModules(); $generalInterfaceModules = $this->getInterfacesModules();
$generalInterfaceTables = []; $generalInterfaceTables = [];
$generalInterfaceModulesUpdated = []; $generalInterfaceModulesUpdated = [];
@ -2849,7 +2851,12 @@ class AgentWizard extends HTML
// Format current value with thousands and decimals. // Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) { if (is_numeric($currentValue) === true) {
$decimals = (is_float($currentValue) === true) ? 2 : 0; $decimals = (is_float($currentValue) === true) ? 2 : 0;
$currentValue = number_format($currentValue, $decimals); $currentValue = number_format(
$currentValue,
$decimals,
$config['decimal_separator'],
$config['thousand_separator']
);
} }
// It unit of measure have data, attach to current value. // It unit of measure have data, attach to current value.

View File

@ -167,7 +167,7 @@ class ConsoleSupervisor
* NOTIF.PHP.UPLOAD_MAX_FILESIZE * NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT * NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS * NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS * NOTIF.PHP.CHROMIUM
* NOTIF.PHP.VERSION * NOTIF.PHP.VERSION
*/ */
@ -349,7 +349,7 @@ class ConsoleSupervisor
* NOTIF.PHP.UPLOAD_MAX_FILESIZE * NOTIF.PHP.UPLOAD_MAX_FILESIZE
* NOTIF.PHP.MEMORY_LIMIT * NOTIF.PHP.MEMORY_LIMIT
* NOTIF.PHP.DISABLE_FUNCTIONS * NOTIF.PHP.DISABLE_FUNCTIONS
* NOTIF.PHP.PHANTOMJS * NOTIF.PHP.CHROMIUM
* NOTIF.PHP.VERSION * NOTIF.PHP.VERSION
*/ */
@ -528,11 +528,7 @@ class ConsoleSupervisor
*/ */
public function maintenanceOperations() public function maintenanceOperations()
{ {
/*
* Process cache clean if needed.
*/
$this->checkCleanPhantomCache();
} }
@ -688,7 +684,7 @@ class ConsoleSupervisor
case 'NOTIF.PHP.UPLOAD_MAX_FILESIZE': case 'NOTIF.PHP.UPLOAD_MAX_FILESIZE':
case 'NOTIF.PHP.MEMORY_LIMIT': case 'NOTIF.PHP.MEMORY_LIMIT':
case 'NOTIF.PHP.DISABLE_FUNCTIONS': case 'NOTIF.PHP.DISABLE_FUNCTIONS':
case 'NOTIF.PHP.PHANTOMJS': case 'NOTIF.PHP.CHROMIUM':
case 'NOTIF.PHP.VERSION': case 'NOTIF.PHP.VERSION':
case 'NOTIF.HISTORYDB': case 'NOTIF.HISTORYDB':
case 'NOTIF.PANDORADB': case 'NOTIF.PANDORADB':
@ -1431,9 +1427,9 @@ class ConsoleSupervisor
$PHPmemory_limit_min = config_return_in_bytes('-1'); $PHPmemory_limit_min = config_return_in_bytes('-1');
} }
// PhantomJS status. // Chromium status.
$phantomjs_dir = io_safe_output($config['phantomjs_bin']); $chromium_dir = io_safe_output($config['chromium_path']);
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version'); $result_ejecution = exec($chromium_dir.' --version');
// PHP version checks. // PHP version checks.
$php_version = phpversion(); $php_version = phpversion();
@ -1577,21 +1573,20 @@ class ConsoleSupervisor
} }
if (!isset($result_ejecution) || $result_ejecution == '') { if (!isset($result_ejecution) || $result_ejecution == '') {
$url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration#Phantomjs'; $url = 'https://www.chromium.org/getting-involved/download-chromium/';
if ($config['language'] == 'es') { // if ($config['language'] == 'es') {
$url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs'; // $url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs';
} // }
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.PHP.PHANTOMJS', 'type' => 'NOTIF.PHP.CHROMIUM',
'title' => __('PhantomJS is not installed'), 'title' => __('chromium is not installed'),
'message' => __('To be able to create images of the graphs for PDFs, please install the PhantomJS extension. For that, it is necessary to follow these steps:'), 'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'),
'url' => $url, 'url' => $url,
] ]
); );
} else { } else {
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS'); $this->cleanNotifications('NOTIF.PHP.CHROMIUM');
} }
if ($php_version_array[0] < 8) { if ($php_version_array[0] < 8) {
@ -2698,34 +2693,6 @@ class ConsoleSupervisor
} }
/**
* Clean Phantom cache if needed.
*
* @return void
*/
public function checkCleanPhantomCache()
{
global $config;
if (isset($config['clean_phantomjs_cache']) !== true
|| (int) $config['clean_phantomjs_cache'] !== 1
) {
return;
}
$cache_dir = $config['homedir'].'/attachment/cache';
if (is_dir($cache_dir) === true) {
Files::rmrf($cache_dir);
}
// Clean process has ended.
config_update_value(
'clean_phantomjs_cache',
0
);
}
/** /**
* Verifies the status of synchronization queue and warns if something is * Verifies the status of synchronization queue and warns if something is
* not working as expected. * not working as expected.

View File

@ -143,6 +143,7 @@ class Diagnostics extends Wizard
[ [
'title' => __('Export to PDF'), 'title' => __('Export to PDF'),
'class' => 'invert_filter', 'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
] ]
); );
$header_buttons = [ $header_buttons = [
@ -986,7 +987,7 @@ class Diagnostics extends Wizard
], ],
'tablesFragmentationValue' => [ 'tablesFragmentationValue' => [
'name' => __('Tables fragmentation (current value)'), 'name' => __('Tables fragmentation (current value)'),
'value' => number_format($tFragmentationValue, 2).'%', 'value' => number_format($tFragmentationValue, 2, $config['decimal_separator'], $config['thousand_separator']).'%',
], ],
'tablesFragmentationStatus' => [ 'tablesFragmentationStatus' => [
'name' => __('Table fragmentation status'), 'name' => __('Table fragmentation status'),
@ -1121,7 +1122,9 @@ class Diagnostics extends Wizard
if ($totalModuleIntervalTime !== false) { if ($totalModuleIntervalTime !== false) {
$averageTime = number_format( $averageTime = number_format(
((int) $totalNetworkModules / (int) $totalModuleIntervalTime), ((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
3 3,
$config['decimal_separator'],
$config['thousand_separator']
); );
} }
@ -1748,7 +1751,7 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize); $sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog)); $sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
$value = number_format(($fileSize / $mega), 3); $value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs'); $message = __('You have more than 10 MB of logs');
$status = 0; $status = 0;
if ($sizeServerLog <= $tenMega) { if ($sizeServerLog <= $tenMega) {

View File

@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
header('Pragma: no-cache'); header('Pragma: no-cache');
header('Expires: 0'); header('Expires: 0');
setDownloadCookieToken();
// Clean up output buffering // Clean up output buffering
while (@ob_end_clean()) { while (@ob_end_clean()) {
@ -931,7 +932,7 @@ class ModuleTemplates extends HTML
] ]
); );
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -113,13 +113,6 @@ define('SECONDS_1YEAR', 31536000);
define('SECONDS_2YEARS', 63072000); define('SECONDS_2YEARS', 63072000);
define('SECONDS_3YEARS', 94608000); define('SECONDS_3YEARS', 94608000);
// PhantomJS Cache cleanup intervals.
define('PHANTOM_CACHE_CLEANUP_ONCE', 0);
define('PHANTOM_CACHE_CLEANUP_WEEKLY', SECONDS_1WEEK);
define('PHANTOM_CACHE_CLEANUP_DAILY', SECONDS_1DAY);
// Separator constats. // Separator constats.
define('SEPARATOR_COLUMN', ';'); define('SEPARATOR_COLUMN', ';');
define('SEPARATOR_ROW', chr(10)); define('SEPARATOR_ROW', chr(10));

View File

@ -16,7 +16,11 @@
* @subpackage Generic_Functions * @subpackage Generic_Functions
*/ */
/** use HeadlessChromium\BrowserFactory;
use HeadlessChromium\Clip;
use HeadlessChromium\Page;
/*
* Include the html and ui functions. * Include the html and ui functions.
*/ */
require_once 'functions_html.php'; require_once 'functions_html.php';
@ -219,6 +223,8 @@ function list_files($directory, $stringSearch, $searchHandler, $return=false)
*/ */
function format_numeric($number, $decimals=1) function format_numeric($number, $decimals=1)
{ {
global $config;
// Translate to float in case there are characters in the string so // Translate to float in case there are characters in the string so
// fmod doesn't throw a notice // fmod doesn't throw a notice
$number = (float) $number; $number = (float) $number;
@ -227,17 +233,11 @@ function format_numeric($number, $decimals=1)
return 0; return 0;
} }
// Translators: This is separator of decimal point
$dec_point = __('.');
// Translators: This is separator of decimal point
$thousands_sep = __(',');
// If has decimals
if (fmod($number, 1) > 0) { if (fmod($number, 1) > 0) {
return number_format($number, $decimals, $dec_point, $thousands_sep); return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']);
} }
return number_format($number, 0, $dec_point, $thousands_sep); return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']);
} }
@ -967,6 +967,10 @@ function get_parameter($name, $default='')
return get_parameter_get($name, $default); return get_parameter_get($name, $default);
} }
if (isset($_FILES[$name])) {
return get_parameter_file($name, $default);
}
return $default; return $default;
} }
@ -1007,6 +1011,24 @@ function get_parameter_post($name, $default='')
} }
/**
* Get a parameter from a post file request.
*
* @param string $name key of the parameter in the $_FILES array
* @param mixed $default default value if the key wasn't found
*
* @return mixed Whatever was in that parameter, cleaned however
*/
function get_parameter_file($name, $default='')
{
if ((isset($_FILES[$name])) && !empty($_FILES[$name])) {
return io_safe_input($_FILES[$name]);
}
return $default;
}
/** /**
* Get header. * Get header.
* *
@ -2104,7 +2126,7 @@ function get_snmpwalk(
} }
if (enterprise_installed()) { if (enterprise_installed()) {
if ($server_to_exec != 0) { if (empty($server_to_exec) === false) {
$server_data = db_get_row('tserver', 'id_server', $server_to_exec); $server_data = db_get_row('tserver', 'id_server', $server_to_exec);
if (empty($server_data['port'])) { if (empty($server_data['port'])) {
@ -4084,14 +4106,18 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros( $data_return['legend'][$key] .= remove_right_zeros(
number_format( number_format(
$value['min'], $value['min'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
$data_return['legend'][$key] .= ' '.__('Max:'); $data_return['legend'][$key] .= ' '.__('Max:');
$data_return['legend'][$key] .= remove_right_zeros( $data_return['legend'][$key] .= remove_right_zeros(
number_format( number_format(
$value['max'], $value['max'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
$data_return['legend'][$key] .= ' '._('Avg:'); $data_return['legend'][$key] .= ' '._('Avg:');
@ -4099,7 +4125,8 @@ function series_type_graph_array($data, $show_elements_graph)
number_format( number_format(
$value['avg'], $value['avg'],
$config['graph_precision'], $config['graph_precision'],
$config['csv_decimal_separator'] $config['decimal_separator'],
$config['thousand_separator']
) )
).' '.$str; ).' '.$str;
} }
@ -4156,7 +4183,9 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros( $data_return['legend'][$key] .= remove_right_zeros(
number_format( number_format(
$value['data'][0][1], $value['data'][0][1],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
).' '.$str; ).' '.$str;
} }
@ -4209,7 +4238,6 @@ function generator_chart_to_pdf(
$hack_metaconsole = ''; $hack_metaconsole = '';
} }
$file_js = $config['homedir'].'/include/web2image.js';
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php'; $url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
if (!$params['return_img_base_64']) { if (!$params['return_img_base_64']) {
@ -4218,65 +4246,89 @@ function generator_chart_to_pdf(
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; $img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
} }
if ($type_graph_pdf === 'vbar') {
$width_img = $params['generals']['pdf']['width'];
$height_img = $params['generals']['pdf']['height'];
} else if ($type_graph_pdf === 'combined'
&& $params_combined['stacked'] == CUSTOM_GRAPH_VBARS
) {
$width_img = 650;
$height_img = ($params['height'] + 50);
} else if ($type_graph_pdf === 'hbar' || $type_graph_pdf === 'pie_chart') {
$width_img = ($params['width'] ?? 550);
$height_img = $params['height'];
} else {
$width_img = 550;
$height_img = $params['height'];
if ((int) $params['landscape'] === 1) {
$height_img = 150;
$params['height'] = 150;
}
}
$params_encode_json = urlencode(json_encode($params));
if ($params_combined) {
$params_combined = urlencode(json_encode($params_combined));
}
if ($module_list) {
$module_list = urlencode(json_encode($module_list));
}
$session_id = session_id(); $session_id = session_id();
$cache_dir = $config['homedir'].'/attachment/cache'; if ($type_graph_pdf === 'combined') {
$data = [
'data' => $params,
'session_id' => $session_id,
'type_graph_pdf' => $type_graph_pdf,
'data_module_list' => $module_list,
'data_combined' => $params_combined,
];
} else {
$data = [
'data' => $params,
'session_id' => $session_id,
'type_graph_pdf' => $type_graph_pdf,
];
}
$cmd = '"'.io_safe_output($config['phantomjs_bin']); // If not install chromium avoid 500 convert tu images no data to show.
$cmd .= DIRECTORY_SEPARATOR.'phantomjs" '; $chromium_dir = io_safe_output($config['chromium_path']);
$cmd .= ' --disk-cache=true --disk-cache-path="'.$cache_dir.'"'; $result_ejecution = exec($chromium_dir.' --version');
$cmd .= ' --max-disk-cache-size=10000 '; if (empty($result_ejecution) === true) {
$cmd .= ' --ssl-protocol=any --ignore-ssl-errors=true '; if ($params['return_img_base_64']) {
$cmd .= '"'.$file_js.'" "'.$url.'" "'.$type_graph_pdf.'"'; $params['base64'] = true;
$cmd .= ' "'.$params_encode_json.'" "'.$params_combined.'"'; }
$cmd .= ' "'.$module_list.'" "'.$img_path.'"';
$cmd .= ' "'.$width_img.'" "'.$height_img.'"';
$cmd .= ' "'.$session_id.'" "'.$params['return_img_base_64'].'"';
$result = null; return graph_nodata_image($params);
$retcode = null; }
exec($cmd, $result, $retcode);
$img_content = join("\n", $result); try {
$browserFactory = new BrowserFactory($chromium_dir);
// Starts headless chrome.
$browser = $browserFactory->createBrowser(['noSandbox' => true]);
// Creates a new page.
$page = $browser->createPage();
// Navigate to an URL.
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
// Dynamic.
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();
if (empty($dynamic_height) === true) {
$dynamic_height = 200;
}
if (isset($params['options']['viewport']) === true
&& isset($params['options']['viewport']['height']) === true
&& empty($params['options']['viewport']['height']) === false
) {
$dynamic_height = $params['options']['viewport']['height'];
}
$dynamic_width = $page->evaluate('document.getElementById("container-chart-generator-item").clientWidth')->getReturnValue();
if (empty($dynamic_width) === true) {
$dynamic_width = 794;
}
if (isset($params['options']['viewport']) === true
&& isset($params['options']['viewport']['width']) === true
&& empty($params['options']['viewport']['width']) === false
) {
$dynamic_width = $params['options']['viewport']['width'];
}
$clip = new Clip(0, 0, $dynamic_width, $dynamic_height);
if ($params['return_img_base_64']) { if ($params['return_img_base_64']) {
$b64 = $page->screenshot(['clip' => $clip])->getBase64();
// To be used in alerts. // To be used in alerts.
return $img_content; return $b64;
} else { } else {
// To be used in PDF files. // To be used in PDF files.
$b64 = $page->screenshot(['clip' => $clip])->saveToFile($img_path);
$config['temp_images'][] = $img_path; $config['temp_images'][] = $img_path;
return '<img src="'.$img_url.'" />'; return '<img src="'.$img_url.'" />';
} }
} catch (\Throwable $th) {
error_log($th);
} finally {
$browser->close();
}
} }
@ -6269,3 +6321,24 @@ function arrayOutputSorting($sort, $sortField)
} }
}; };
} }
/**
* Get dowload started cookie from js and set ready cokkie for download ready comntrol.
*
* @return
*/
function setDownloadCookieToken()
{
$download_cookie = get_cookie('downloadToken', false);
if ($download_cookie === false) {
return;
} else {
setcookie(
'downloadReady',
$download_cookie,
(time() + 15),
'/'
);
}
}

View File

@ -2101,7 +2101,8 @@ function get_group_alerts(
$count=false, $count=false,
$strict_user=false, $strict_user=false,
$tag=false, $tag=false,
$action_filter=false $action_filter=false,
$alert_action=true
) { ) {
global $config; global $config;
@ -2162,8 +2163,10 @@ function get_group_alerts(
// WHEN SELECT ALL TAGS TO FILTER ALERTS // WHEN SELECT ALL TAGS TO FILTER ALERTS
if ($action_filter) { if ($action_filter) {
$filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))'; $filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))';
if ($alert_action) {
$filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')'; $filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')';
} }
}
if (is_array($options)) { if (is_array($options)) {
$filter .= db_format_array_where_clause_sql($options); $filter .= db_format_array_where_clause_sql($options);
@ -2252,6 +2255,7 @@ function get_group_alerts(
$filter, $filter,
$orderbyText $orderbyText
); );
$alerts = db_get_all_rows_sql($sql); $alerts = db_get_all_rows_sql($sql);
if ($alerts === false) { if ($alerts === false) {
@ -2824,6 +2828,25 @@ function alerts_get_agent_modules(
} }
/**
* Return the id_agent of the alert
*
* @param integer $id_agent_module
* @return integer id_agent
*/
function alerts_get_agent_by_alert($id_agent_module)
{
$sql = sprintf(
'SELECT id_agente FROM talert_template_modules atm INNER JOIN tagente_modulo am ON am.id_agente_modulo = atm.id_agent_module WHERE atm.id = %d
',
$id_agent_module
);
$id_agente = db_get_row_sql($sql)['id_agente'];
return $id_agente;
}
function alerts_get_actions_names($actions, $reduce=false) function alerts_get_actions_names($actions, $reduce=false)
{ {
$where = ''; $where = '';

View File

@ -62,7 +62,7 @@ enterprise_include_once('include/functions_cron.php');
// Clases. // Clases.
use PandoraFMS\Agent; use PandoraFMS\Agent;
use PandoraFMS\Module; use PandoraFMS\Module;
use PandoraFMS\Enterprise\Cluster; use PandoraFMS\Cluster;
use PandoraFMS\Enterprise\Metaconsole\Node; use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\Event; use PandoraFMS\Event;
use PandoraFMS\SpecialDay; use PandoraFMS\SpecialDay;
@ -604,95 +604,6 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT
} }
/*
DB column mapping table used by tree_agents (and get module_properties)
*/
/*
* Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
'agent_last_contant' => 'ultimo_contacto as agent_last_contant',
'agent_mode' => 'modo as agent_mode',
'agent_interval' => 'intervalo as agent_interval',
'agent_id_os' => 'id_os as agent_id_os',
'agent_os_version' => 'os_version as agent_os_version',
'agent_version' => 'agent_version as agent_version',
'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact',
'agent_disabled' => 'disabled as agent_disabled',
'agent_id_parent' => 'id_parent as agent_id_parent',
'agent_custom_id' => 'custom_id as agent_custom_id',
'agent_server_name' => 'server_name as agent_server_name',
'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection',
'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module',
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
// module_id_agent_modulo is not in this list
$module_field_column_mampping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_user' => 'plugin_user as module_plugin_user',
'module_plugin_pass' => 'plugin_pass as module_plugin_pass',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_plugin_macros' => 'macros as module_plugin_macros',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
/*** /***
* end of DB column mapping table * end of DB column mapping table
***/ ***/
@ -806,9 +717,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
'module_id_module', 'module_id_module',
'module_disabled', 'module_disabled',
'module_id_export', 'module_id_export',
'module_plugin_user',
'module_plugin_pass',
'module_plugin_parameter', 'module_plugin_parameter',
'module_plugin_pass',
'module_plugin_user',
'module_id_plugin', 'module_id_plugin',
'module_post_process', 'module_post_process',
'module_prediction_module', 'module_prediction_module',
@ -897,14 +808,88 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
'alert_actions_id_group', 'alert_actions_id_group',
]; ];
// agent related field mappings (output field => column designation for 'tagente') /*
global $agent_field_column_mapping; * Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
'agent_last_contant' => 'ultimo_contacto as agent_last_contant',
'agent_mode' => 'modo as agent_mode',
'agent_interval' => 'intervalo as agent_interval',
'agent_id_os' => 'id_os as agent_id_os',
'agent_os_version' => 'os_version as agent_os_version',
'agent_version' => 'agent_version as agent_version',
'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact',
'agent_disabled' => 'disabled as agent_disabled',
'agent_id_parent' => 'id_parent as agent_id_parent',
'agent_custom_id' => 'custom_id as agent_custom_id',
'agent_server_name' => 'server_name as agent_server_name',
'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection',
'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module',
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo') // module related field mappings 1/2 (output field => column for 'tagente_modulo')
global $module_field_column_mampping; // module_id_agent_modulo is not in this list
// module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes.
$module_field_column_mapping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado') // module related field mappings 2/2 (output field => column for 'tagente_estado')
global $estado_fields_to_columns_mapping; // module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
// alert related field mappings (output field => column for 'talert_template_modules', ... ) // alert related field mappings (output field => column for 'talert_template_modules', ... )
$alert_fields_to_columns_mapping = [ $alert_fields_to_columns_mapping = [
@ -985,8 +970,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$agent_additional_columns .= (', '.$agent_field_column_mapping[$fld] ); $agent_additional_columns .= (', '.$agent_field_column_mapping[$fld] );
} }
if (array_key_exists($fld, $module_field_column_mampping)) { if (array_key_exists($fld, $module_field_column_mapping)) {
$module_additional_columns .= (', '.$module_field_column_mampping[$fld]); $module_additional_columns .= (', '.$module_field_column_mapping[$fld]);
} }
if (array_key_exists($fld, $estado_fields_to_columns_mapping)) { if (array_key_exists($fld, $estado_fields_to_columns_mapping)) {
@ -1016,9 +1001,13 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$groups = []; $groups = [];
} }
$groups = str_replace('\n', $returnReplace, $groups);
foreach ($groups as &$group) { foreach ($groups as &$group) {
if (check_acl($config['id_user'], $group['group_id'], 'AR') === false) {
continue;
}
$group = str_replace('\n', $returnReplace, $group);
$group['type_row'] = 'group'; $group['type_row'] = 'group';
$returnVar[] = $group; $returnVar[] = $group;
@ -1034,9 +1023,23 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$agents = []; $agents = [];
} }
$agents = str_replace('\n', $returnReplace, $agents); if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true) {
if (array_search('module_plugin_user', $fields) !== false) {
$module_additional_columns .= ' ,plugin_user as module_plugin_user';
}
if (array_search('module_plugin_pass', $fields) !== false) {
$module_additional_columns .= ' ,plugin_pass as module_plugin_pass';
}
if (array_search('module_plugin_macros', $fields) !== false) {
$module_additional_columns .= ' ,macros as module_plugin_macros';
}
}
foreach ($agents as $index => &$agent) { foreach ($agents as $index => &$agent) {
$agent = str_replace('\n', $returnReplace, $agent);
$agent['type_row'] = 'agent'; $agent['type_row'] = 'agent';
$returnVar[] = $agent; $returnVar[] = $agent;
@ -1048,24 +1051,26 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
// SKIP collecting MODULES and ALERTS // SKIP collecting MODULES and ALERTS
} }
$modules = db_get_all_rows_sql( $sql = 'SELECT *
'SELECT *
FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.' FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.'
FROM tagente_modulo FROM tagente_modulo t1
WHERE id_agente = '.$agent['agent_id'].') t1 WHERE id_agente = '.$agent['agent_id'].') t1
INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.' INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.'
FROM tagente_estado FROM tagente_estado
WHERE id_agente = '.$agent['agent_id'].') t2 WHERE id_agente = '.$agent['agent_id'].') t2
ON t1.module_id_agent_modulo = t2.module_id_agent_modulo' ON t1.module_id_agent_modulo = t2.module_id_agent_modulo';
$modules = db_get_all_rows_sql(
$sql
); );
if ($modules === false) { if ($modules === false) {
$modules = []; $modules = [];
} }
$modules = str_replace('\n', $returnReplace, $modules);
foreach ($modules as &$module) { foreach ($modules as &$module) {
$module = str_replace('\n', $returnReplace, $module);
$module['type_row'] = 'module'; $module['type_row'] = 'module';
if ($module['module_macros']) { if ($module['module_macros']) {
@ -1097,9 +1102,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$alerts = []; $alerts = [];
} }
$alerts = str_replace('\n', $returnReplace, $alerts);
foreach ($alerts as &$alert) { foreach ($alerts as &$alert) {
$alert = str_replace('\n', $returnReplace, $alert);
$alert['type_row'] = 'alert'; $alert['type_row'] = 'alert';
$returnVar[] = $alert; $returnVar[] = $alert;
} }
@ -1366,10 +1370,66 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
]; ];
// module related field mappings 1/2 (output field => column for 'tagente_modulo') // module related field mappings 1/2 (output field => column for 'tagente_modulo')
global $module_field_column_mampping; // module_id_agent_modulo is not in this list
// module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes.
$module_field_column_mapping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_plugin_user' => 'plugin_user as module_plugin_user',
'module_plugin_pass' => 'plugin_pass as module_plugin_pass',
'module_plugin_macros' => 'macros as module_plugin_macros',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado') // module related field mappings 2/2 (output field => column for 'tagente_estado')
global $estado_fields_to_columns_mapping; // module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
if ($fields == false) { if ($fields == false) {
$fields = $module_properties_master_fields; $fields = $module_properties_master_fields;
@ -1379,8 +1439,8 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
$module_additional_columns = ''; $module_additional_columns = '';
$estado_additional_columns = ''; $estado_additional_columns = '';
foreach ($fields as $fld) { foreach ($fields as $fld) {
if (array_key_exists($fld, $module_field_column_mampping)) { if (array_key_exists($fld, $module_field_column_mapping)) {
$module_additional_columns .= (', '.$module_field_column_mampping[$fld]); $module_additional_columns .= (', '.$module_field_column_mapping[$fld]);
} }
if (array_key_exists($fld, $estado_fields_to_columns_mapping)) { if (array_key_exists($fld, $estado_fields_to_columns_mapping)) {
@ -1405,9 +1465,9 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
$modules = []; $modules = [];
} }
$modules = str_replace('\n', $returnReplace, $modules);
foreach ($modules as &$module) { foreach ($modules as &$module) {
$module = str_replace('\n', $returnReplace, $module);
$module['type_row'] = 'module'; $module['type_row'] = 'module';
if ($module['module_macros']) { if ($module['module_macros']) {
@ -3588,6 +3648,19 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
// Column 'module_macros' cannot be null. // Column 'module_macros' cannot be null.
} }
$type_exist = db_get_value_filter(
'id_tipo',
'ttipo_modulo',
[
'id_tipo' => $values['id_tipo_modulo'],
]
);
if ((bool) $type_exist === false) {
returnError('Module type does not exist');
return;
}
if ($agent_by_alias) { if ($agent_by_alias) {
$agents_affected = 0; $agents_affected = 0;
$idModule = false; $idModule = false;
@ -7436,7 +7509,7 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
$bad_agents = []; $bad_agents = [];
$i = 0; $i = 0;
foreach ($total_agents as $agent_id) { foreach ($total_agents as $agent_id) {
$result_agent = agents_check_access_agent($agent_id, 'AD'); $result_agent = agents_check_access_agent($agent_id, 'AR');
if (!$result_agent) { if (!$result_agent) {
$bad_agents[] = $agent_id; $bad_agents[] = $agent_id;
unset($agents[$i]); unset($agents[$i]);
@ -9528,6 +9601,7 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
$values['default_event_filter'] = $other['data'][10]; $values['default_event_filter'] = $other['data'][10];
$values['section'] = $other['data'][11]; $values['section'] = $other['data'][11];
$values['session_time'] = $other['data'][12]; $values['session_time'] = $other['data'][12];
$values['metaconsole_access_node'] = $other['data'][13];
if (empty($password) === true) { if (empty($password) === true) {
returnError('Password cannot be empty.'); returnError('Password cannot be empty.');
@ -10084,6 +10158,8 @@ function api_set_delete_module($id, $id2, $other, $trash1)
} }
if (!$simulate) { if (!$simulate) {
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($idAgentModule);
$return = modules_delete_agent_module($idAgentModule); $return = modules_delete_agent_module($idAgentModule);
} else { } else {
$return = true; $return = true;
@ -10109,6 +10185,8 @@ function api_set_delete_module($id, $id2, $other, $trash1)
} }
if (!$simulate) { if (!$simulate) {
// Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($idAgentModule);
$return = modules_delete_agent_module($idAgentModule); $return = modules_delete_agent_module($idAgentModule);
} else { } else {
$return = true; $return = true;
@ -16917,6 +16995,32 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
]; ];
$group_exist = db_get_value_filter(
'id_grupo',
'tgrupo',
[
'id_grupo' => $values['id_grupo'],
]
);
if ((bool) $group_exist === false) {
returnError('Selected group does not exist');
return;
}
$profile_exist = db_get_value_filter(
'id_perfil',
'tperfil',
[
'id_perfil' => $values['id_perfil'],
]
);
if ((bool) $profile_exist === false) {
returnError('Selected profile does not exist');
return;
}
$where_id_up = ['id_up' => $other['data'][4]]; $where_id_up = ['id_up' => $other['data'][4]];
if ($exist_profile === $other['data'][4] && $where_id_up !== null) { if ($exist_profile === $other['data'][4] && $where_id_up !== null) {
$sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up); $sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up);

View File

@ -184,8 +184,8 @@ function config_update_config()
$error_update[] = __('Remote config directory'); $error_update[] = __('Remote config directory');
} }
if (config_update_value('phantomjs_bin', (string) get_parameter('phantomjs_bin'), true) === false) { if (config_update_value('chromium_path', (string) get_parameter('chromium_path'), true) === false) {
$error_update[] = __('phantomjs config directory'); $error_update[] = __('Chromium config directory');
} }
if (config_update_value('loginhash_pwd', io_input_password((string) get_parameter('loginhash_pwd')), true) === false) { if (config_update_value('loginhash_pwd', io_input_password((string) get_parameter('loginhash_pwd')), true) === false) {
@ -523,6 +523,15 @@ function config_update_config()
break; break;
case 'auth': case 'auth':
$validatedCSRF = validate_csrf_code();
// CSRF Validation.
if ($validatedCSRF === false) {
include_once 'general/login_page.php';
// Finish the execution.
exit('</html>');
}
// AUTHENTICATION SETUP. // AUTHENTICATION SETUP.
if (config_update_value('auth', get_parameter('auth'), true) === false) { if (config_update_value('auth', get_parameter('auth'), true) === false) {
$error_update[] = __('Authentication method'); $error_update[] = __('Authentication method');
@ -926,25 +935,6 @@ function config_update_config()
if (config_update_value('agent_wizard_defaults', json_encode($selectedAgentWizardOptions), true) === false) { if (config_update_value('agent_wizard_defaults', json_encode($selectedAgentWizardOptions), true) === false) {
$error_update[] = __('SNMP Interface Agent Wizard'); $error_update[] = __('SNMP Interface Agent Wizard');
} }
$pjs = get_parameter('phantomjs_cache_interval');
switch ($pjs) {
case $config['phantomjs_cache_interval']:
default;
// No changes.
break;
case PHANTOM_CACHE_CLEANUP_ONCE:
case PHANTOM_CACHE_CLEANUP_DAILY:
case PHANTOM_CACHE_CLEANUP_WEEKLY:
enterprise_hook('phantomjs_cache_interval_schedule', [$pjs]);
break;
}
if (config_update_value('phantomjs_cache_interval', get_parameter('phantomjs_cache_interval'), true) === false
) {
$error_update[] = __('PhantomJS cache interval');
}
break; break;
case 'vis': case 'vis':
@ -1475,6 +1465,15 @@ function config_update_config()
if (config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'), true) === false) { if (config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'), true) === false) {
$error_update[] = __('Use data multiplier'); $error_update[] = __('Use data multiplier');
} }
if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) {
$error_update[] = __('Decimal separator');
} else {
$thousand_separator = ((string) get_parameter('decimal_separator', '.') === '.') ? ',' : '.';
if (config_update_value('thousand_separator', $thousand_separator, true) === false) {
$error_update[] = __('Thousand separator');
}
}
break; break;
case 'net': case 'net':
@ -1966,14 +1965,9 @@ function config_process_config()
config_update_value('remote_config', $default); config_update_value('remote_config', $default);
} }
if (!isset($config['phantomjs_bin'])) { if (isset($config['chromium_path']) === false) {
if ($is_windows) { $default = '/usr/bin/chromium-browser';
$default = 'C:\PandoraFMS\Pandora_Server\bin'; config_update_value('chromium_path', $default);
} else {
$default = '/usr/bin';
}
config_update_value('phantomjs_bin', $default);
} }
if (!isset($config['date_format'])) { if (!isset($config['date_format'])) {
@ -3446,7 +3440,7 @@ function config_process_config()
} }
if (!isset($config['ehorus_port'])) { if (!isset($config['ehorus_port'])) {
config_update_value('ehorus_port', 18080); config_update_value('ehorus_port', 443);
} }
if (!isset($config['ehorus_req_timeout'])) { if (!isset($config['ehorus_req_timeout'])) {
@ -3479,6 +3473,10 @@ function config_process_config()
config_update_value('module_library_password', ''); config_update_value('module_library_password', '');
} }
if (!isset($config['decimal_separator'])) {
config_update_value('decimal_separator', '.');
}
// Finally, check if any value was overwritten in a form. // Finally, check if any value was overwritten in a form.
config_update_config(); config_update_config();
} }

View File

@ -757,7 +757,8 @@ function db_uncompress_module_data(
$id_agente_modulo, $id_agente_modulo,
$tstart=false, $tstart=false,
$tend=false, $tend=false,
$slice_size=false $slice_size=false,
$force_slice_not_data=false
) { ) {
global $config; global $config;
@ -860,7 +861,10 @@ function db_uncompress_module_data(
$module_interval = modules_get_interval($id_agente_modulo); $module_interval = modules_get_interval($id_agente_modulo);
if (($raw_data === false) && ( $first_utimestamp === false )) { if (($force_slice_not_data === false)
&& ($raw_data === false)
&& ( $first_utimestamp === false )
) {
// No data. // No data.
return false; return false;
} }
@ -2313,7 +2317,13 @@ function db_get_lock(string $lockname, int $expiration_time=86400) :?int
} }
if ($lock_status === false) { if ($lock_status === false) {
return null; db_pandora_audit(
AUDIT_LOG_SYSTEM,
'Issue in Database Lock',
'system'
);
return (int) null;
} }
return (int) $lock_status; return (int) $lock_status;
@ -2520,3 +2530,28 @@ function db_unlock_tables()
return $result; return $result;
} }
/**
* Get column type. Example: 'varchar(60)'.
*
* @param string $table Table name.
* @param string $column Column name.
*
* @return array|boolean
*/
function db_get_column_type(string $table, string $column='')
{
$sql = sprintf(
'SELECT column_type FROM information_schema.columns WHERE table_name = "%s"',
$table
);
if (empty($column) === false) {
$sql .= sprintf(' AND column_name="%s"', $column);
}
$result = db_process_sql($sql);
return $result;
}

View File

@ -640,11 +640,13 @@ function events_update_status($id_evento, $status, $filter=null)
* 'status' * 'status'
* 'agent_alias' * 'agent_alias'
* 'search' * 'search'
* 'not_search'
* 'id_extra' * 'id_extra'
* 'id_source_event' * 'id_source_event'
* 'user_comment' * 'user_comment'
* 'source' * 'source'
* 'id_user_ack' * 'id_user_ack'
* 'owner_user'
* 'tag_with' * 'tag_with'
* 'tag_without' * 'tag_without'
* 'filter_only_alert' * 'filter_only_alert'
@ -1058,16 +1060,40 @@ function events_get_all(
$custom_data_search = 'te.custom_data'; $custom_data_search = 'te.custom_data';
} }
$sql_filters[] = vsprintf( $not_search = '';
' AND (lower(ta.alias) like lower("%%%s%%") $nexo = 'OR';
OR te.id_evento like "%%%s%%" $array_search = [
OR lower(te.evento) like lower("%%%s%%") 'te.id_evento',
OR lower(te.user_comment) like lower("%%%s%%") 'lower(te.evento)',
OR lower(te.id_extra) like lower("%%%s%%") 'lower(te.user_comment)',
OR lower(te.source) like lower("%%%s%%") 'lower(te.id_extra)',
OR lower('.$custom_data_search.') like lower("%%%s%%") )', 'lower(te.source)',
array_fill(0, 7, $filter['search']) 'lower('.$custom_data_search.')',
];
if (isset($filter['not_search']) === true
&& empty($filter['not_search']) === false
) {
$not_search = 'NOT';
$nexo = 'AND';
} else {
$array_search[] = 'lower(ta.alias)';
}
$sql_search = ' AND (';
foreach ($array_search as $key => $field) {
$sql_search .= sprintf(
'%s %s %s like lower("%%%s%%")',
($key === 0) ? '' : $nexo,
$field,
$not_search,
$filter['search']
); );
$sql_search .= ' ';
}
$sql_search .= ' )';
$sql_filters[] = $sql_search;
} }
// Free search exclude. // Free search exclude.
@ -1152,11 +1178,19 @@ function events_get_all(
// Validated or in process by. // Validated or in process by.
if (empty($filter['id_user_ack']) === false) { if (empty($filter['id_user_ack']) === false) {
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ', ' AND te.id_usuario like lower("%%%s%%") ',
$filter['id_user_ack'] $filter['id_user_ack']
); );
} }
// Owner by.
if (empty($filter['owner_user']) === false) {
$sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ',
$filter['owner_user']
);
}
$tag_names = []; $tag_names = [];
// With following tags. // With following tags.
if (empty($filter['tag_with']) === false) { if (empty($filter['tag_with']) === false) {
@ -1840,11 +1874,14 @@ function events_get_all(
); );
if (isset($limit, $offset) === true if (isset($limit, $offset) === true
&& $limit !== 0 && (int) $limit !== 0
&& isset($filter['csv_all']) === false && isset($filter['csv_all']) === false
) { ) {
$count = count($data); $count = count($data);
$end = ((int) $offset !== 0) ? ($offset + $limit) : $limit; // -1 For pagination 'All'.
((int) $limit === -1)
? $end = count($data)
: $end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
$finally = array_slice($data, $offset, $end, true); $finally = array_slice($data, $offset, $end, true);
$return = [ $return = [
'buffers' => $buffers, 'buffers' => $buffers,
@ -2597,27 +2634,6 @@ function events_print_event_table(
$events_table = html_print_table($table, true); $events_table = html_print_table($table, true);
$out = $events_table; $out = $events_table;
if (!$tactical_view) {
$out .= '<table width="100%"><tr><td class="w90p align-top pdd_t_0px">';
if ($agent_id != 0) {
$out .= '</td><td class="w200px align-top">';
$out .= '<table cellpadding=0 cellspacing=0 class="databox"><tr><td>';
$out .= '<fieldset class="databox tactical_set">
<legend>'.__('Events -by module-').'</legend>'.graph_event_module(180, 100, $event['id_agente']).'</fieldset>';
$out .= '</td></tr></table>';
} else {
$out .= '</td><td class="w200px align-top">';
$out .= '<table cellpadding=0 cellspacing=0 class="databox"><tr><td>';
$out .= '<fieldset class="databox tactical_set">
<legend>'.__('Event graph').'</legend>'.grafico_eventos_total('', 180, 60).'</fieldset>';
$out .= '<fieldset class="databox tactical_set">
<legend>'.__('Event graph by agent').'</legend>'.grafico_eventos_grupo(180, 60).'</fieldset>';
$out .= '</td></tr></table>';
}
$out .= '</td></tr></table>';
}
unset($table); unset($table);
if ($return) { if ($return) {
@ -3713,6 +3729,15 @@ function events_get_response_target(
); );
} }
if (strpos($target, '_group_contact_') !== false) {
$info_groups = groups_get_group_by_id($event['id_grupo']);
$target = str_replace(
'_group_contact_',
(isset($info_groups['contact']) === true) ? $info_groups['contact'] : 'N/A',
$target
);
}
if (strpos($target, '_event_utimestamp_') !== false) { if (strpos($target, '_event_utimestamp_') !== false) {
$target = str_replace( $target = str_replace(
'_event_utimestamp_', '_event_utimestamp_',
@ -4896,12 +4921,46 @@ function events_page_general($event)
} }
/**
* Return Acknowledged by value
*
* @param integer $event_id Event_id to return Acknowledged.
*
* @return string String with user and date.
*/
function events_page_general_acknowledged($event_id)
{
global $config;
$Acknowledged = '';
$event = db_get_all_rows_filter('tevento', 'id_evento', $event_id);
if ($event) {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
);
if (empty($user_ack) === true) {
$user_ack = $config['id_user'];
}
$Acknowledged = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;';
} else {
$Acknowledged = 'N/A';
}
return $Acknowledged;
}
/** /**
* Generate 'comments' page for event viewer. * Generate 'comments' page for event viewer.
* *
* @param array $event Event. * @param array $event Event.
* @param boolean $ajax If the query come from AJAX. * @param boolean $ajax If the query come from AJAX.
* @param boolean $grouped If the event must shown comments grouped. * @param boolean $groupedComments If the event must shown comments grouped.
* *
* @return string HTML. * @return string HTML.
*/ */
@ -5166,7 +5225,7 @@ function events_get_count_events_validated_by_user($data)
) { ) {
foreach ($fullnames as $value) { foreach ($fullnames as $value) {
if (isset($data_graph_by_user[$value['id_user']]) === true) { if (isset($data_graph_by_user[$value['id_user']]) === true) {
$data_graph_by_user[$value['fullname']] = $data_graph_by_user[$value['id_user']]; $data_graph_by_user[io_safe_output($value['fullname'])] = $data_graph_by_user[$value['id_user']];
unset($data_graph_by_user[$value['id_user']]); unset($data_graph_by_user[$value['id_user']]);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1950,7 +1950,7 @@ function html_print_extended_select_for_post_process(
$found = false; $found = false;
if ($selected) { if ($selected) {
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) { if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) {
$found = true; $found = true;
} }
} }

View File

@ -772,3 +772,292 @@ function menu_pepare_acl_select_data($pages, $sec)
return $pages; return $pages;
} }
if (is_ajax()) {
$about = (bool) get_parameter('about');
if ($about) {
global $config;
global $pandora_version;
global $build_version;
$product_name = io_safe_output(get_product_name());
include_once $config['homedir'].'/include/class/Diagnostics.class.php';
$d = new Diagnostics;
$db_health = json_decode($d->getDatabaseHealthStatus());
$db_info = json_decode($d->getDatabaseStatusInfo());
$db_fragmentation = json_decode($d->getTablesFragmentation());
$sys_info = json_decode($d->getSystemInfo());
$php_sys = json_decode($d->getPHPSetup());
$fragmentation_status = '';
if ($db_fragmentation->data->tablesFragmentationStatus->status === 1) {
$fragmentation_status = html_print_image(
'images/exito.png',
true,
[
'title' => __('Successfully'),
'style' => 'width:15px;',
]
);
} else {
$fragmentation_status = html_print_image(
'images/error_1.png',
true,
[
'title' => __('Error'),
'style' => 'width:15px;',
]
);
}
$dialog = '
<div id="about-tabs" class="invisible overflow-hidden">
<ul>
<li><a href="#tab-general-view">'.__('Information').'</a></li>
<li><a href="#tab-database">'.__('Database').'</a></li>
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>
<li class="ui-tabs-close-button" style="float:right!important;">
<img id="about-close" style="cursor: pointer;" src="'.ui_get_full_url('/include/styles/images/dialog-titlebar-close.png', false, false, false).'" alt="'.__('Close').'" title="'.__('Close').'" width="25px">
</li>
</ul>
<div id="tab-general-view">
<table class="table-about">
<tbody>
<tr>
<th style="width: 40%;">
<img src="'.ui_get_full_url('/images/custom_logo/'.$config['custom_logo'], false, false, false).'" alt="logo" width="70%">
</th>
<th style="width: 60%; text-align: left;">
<h1>'.$product_name.'</h1>
<p><span>'.__('Version').' '.$pandora_version.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
<p><span>'.__('Build').'</span> '.$build_version.'</p>
<p style="margin-bottom: 20px!important;"><span>'.__('Support expires').'</span> 2023/04/26</p>';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$dialog .= '
<div style="display: inline;">
<button class="sub" onclick="location.href=\''.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'\'">'.__('Update manager').'</button>
<button class="sub" onclick="location.href=\''.ui_get_full_url('/index.php?sec=gextensions&sec2=tools/diagnostics', false, false, false).'\'">'.__('System report').'</button>
</div>
';
}
$dialog .= '</th>
</tr>
</tbody>
</table>
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' Pandora FMS. All rights reserved</p>
</div>
<div id="tab-database" class="div-scroll">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Database health status').'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_health->data->unknownAgents->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_health->data->notInitAgents->value.'</p>
</th>
</tr>
<tr class="about-last-tr">
<th style="width: 50%;">
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
</th>
<th style="width: 50%;">
<p class="about-last-p">'.$db_health->data->pandoraDbLastRun->value.'</p>
</th>
</tr>
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Database status info').'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeFirstVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeBuild->value.'</p>
</th>
</tr>
<tr class="about-last-tr">
<th style="width: 50%;">
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
</th>
<th style="width: 50%;">
<p class="about-last-p">'.$db_info->data->dbSize->value.'</p>
</th>
</tr>
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$fragmentation_status.'</p>
</th>
</tr>
</tbody>
</table>
</div>
<div id="tab-system-info">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('System Info').'</h2>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->cpuInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->ramInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->osInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->hostnameInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->ipInfo->value.'</p>
</th>
</tr>
</tbody>
</table>
</div>
<div id="tab-php-system">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('PHP system').'</h2>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->phpVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->maxExecutionTime->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->maxInputTime->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->memoryLimit->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->sessionLifetime->value.'</p>
</th>
</tr>
</tbody>
</table>
</div>
</div>
';
echo $dialog;
}
}

View File

@ -2589,12 +2589,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']); $salida = human_milliseconds_to_string($module['datos']);
} }
} else { } else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} }
break; break;
default: default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break; break;
} }
break; break;
@ -2613,12 +2613,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']); $salida = human_milliseconds_to_string($module['datos']);
} }
} else { } else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} }
break; break;
default: default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'])); $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break; break;
} }
} }
@ -2900,7 +2900,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
} }
if (is_numeric($data)) { if (is_numeric($data)) {
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'])); $title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else { } else {
$text = io_safe_output($data); $text = io_safe_output($data);
@ -3982,6 +3982,81 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
} }
/**
* Get the module data from a children
*
* @param integer $id_module Id module
* @return array Children module data
*/
function get_children_module($id_module)
{
$children_module_data = db_get_all_rows_sql(
'SELECT *
FROM tagente_modulo
WHERE parent_module_id = '.$id_module
);
return $children_module_data;
}
/**
* Find and delete the childers modules from the $id_module
*
* @param mixed $id_module
* @return void
*/
function module_check_childrens_and_delete($id_module)
{
$children_data = get_children_module($id_module);
// Check if exist have a childer
if ($children_data) {
// If have more than 1 children
if (is_array($children_data)) {
foreach ($children_data as $children_module_data) {
if ($children_module_data['parent_module_id']) {
// Search children and delete this module
// Before delete, lets check if exist (Just for cases it's already deleted)
if (modules_check_agentmodule_exists($children_module_data['parent_module_id'])) {
modules_delete_agent_module($children_module_data['parent_module_id']);
}
module_check_childrens_and_delete($children_module_data['id_agente_modulo']);
} else {
// If haven't children just delete
// Before delete, lets check if exist (Just for cases it's already deleted)
if (modules_check_agentmodule_exists($children_module_data['id_agente_modulo'])) {
modules_delete_agent_module($children_module_data['id_agente_modulo']);
}
}
}
} else {
// If just have 1 children
if ($children_data['parent_module_id']) {
// Before delete, lets check if exist (Just for cases it's already deleted)
if (modules_check_agentmodule_exists($children_data['parent_module_id'])) {
modules_delete_agent_module($children_data['parent_module_id']);
}
module_check_childrens_and_delete($children_data['id_agente_modulo']);
} else {
// If haven't children just delete
// Before delete, lets check if exist (Just for cases it's already deleted)
if (modules_check_agentmodule_exists($children_data['id_agente_modulo'])) {
modules_delete_agent_module($children_data['id_agente_modulo']);
}
}
}
} else {
// Haven't childrens, so delete
// Before delete, lets check if exist (Just for cases it's already deleted)
if (modules_check_agentmodule_exists($id_module)) {
modules_delete_agent_module($id_module);
}
}
}
/** /**
* @brief Get the button with the link to open realtime stats into a new window * @brief Get the button with the link to open realtime stats into a new window
* Only to native (not satellite discovered) snmp modules. * Only to native (not satellite discovered) snmp modules.
@ -4336,3 +4411,129 @@ function modules_get_regex(
return $result; return $result;
} }
/**
* Status for data thresholds modules.
*
* @param integer $id_module Module ID.
* @param mixed $data Data int, bool, null, etc.
* @param array $thresholds Array thresholds.
*
* @return array
*/
function get_status_data_modules(int $id_module, $data, $thresholds)
{
// Check not init.
if ($data === false) {
return ['color' => COL_NOTINIT];
}
// Check boolean.
$is_bolean = modules_is_boolean($id_module);
if ($is_bolean === true) {
if ($data > 0) {
return ['color' => COL_CRITICAL];
} else {
return ['color' => COL_NORMAL];
}
}
$thresholds = calculateThreshold($thresholds);
foreach (getStatuses() as $status) {
if ($thresholds[$status]['min'] === null
&& $thresholds[$status]['max'] === null
) {
continue;
}
if (($thresholds[$status]['min'] === null
&& $thresholds[$status]['max'] >= $data)
|| ($thresholds[$status]['max'] === null
&& $thresholds[$status]['min'] <= $data)
|| ($thresholds[$status]['min'] <= $data
&& $thresholds[$status]['max'] >= $data)
) {
if ($status === 'critical') {
return ['color' => COL_CRITICAL];
} else if ($status === 'warning') {
return ['color' => COL_WARNING];
} else {
return ['color' => COL_NORMAL];
}
}
}
return ['color' => COL_NORMAL];
}
/**
* Calculate thresholds.
*
* @param array $thresholds_array
*
* @return array
*/
function calculateThreshold(array $thresholds_array)
{
$nMax = null;
if ($thresholds_array['min_warning'] !== null) {
$nMax = $thresholds_array['min_warning'];
} else if ($thresholds_array['min_critical'] !== null) {
$nMax = $thresholds_array['min_critical'];
}
$wMin = null;
if ($thresholds_array['min_warning'] !== null) {
$wMin = $thresholds_array['min_warning'];
}
$wMax = null;
if ($thresholds_array['max_warning'] !== null) {
$wMax = $thresholds_array['max_warning'];
}
$cMin = null;
if ($thresholds_array['min_critical'] !== null) {
$cMin = $thresholds_array['min_critical'];
}
$cMax = null;
if ($thresholds_array['max_critical'] !== null) {
$cMax = $thresholds_array['max_critical'];
}
$thresholds = [
'normal' => [
'min' => null,
'max' => $nMax,
],
'warning' => [
'min' => $wMin,
'max' => $wMax,
],
'critical' => [
'min' => $cMin,
'max' => $cMax,
],
];
return $thresholds;
}
/**
* Get status.
*
* @return array
*/
function getStatuses()
{
return [
'critical',
'warning',
'normal',
];
}

View File

@ -1479,7 +1479,7 @@ function netflow_draw_item(
} }
if ($output === 'HTML' || $output === 'PDF') { if ($output === 'HTML' || $output === 'PDF') {
return graph_nodata_image(300, 110, 'data'); return graph_nodata_image(['height' => 110]);
} }
} }

View File

@ -3399,7 +3399,10 @@ function get_status_color_networkmap_fictional_point($id_networkmap, $parent='')
if ($agent['source_data'] == -2) { if ($agent['source_data'] == -2) {
if (empty($parent) === true) { if (empty($parent) === true) {
if (is_array($agent) === false) {
$option = json_decode($agent, true); $option = json_decode($agent, true);
}
if ($option['networkmap'] == 0) { if ($option['networkmap'] == 0) {
$status = 0; $status = 0;
} else { } else {

View File

@ -134,7 +134,7 @@ function notifications_get_subtypes(?string $source=null)
'NOTIF.PHP.UPLOAD_MAX_FILESIZE', 'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
'NOTIF.PHP.MEMORY_LIMIT', 'NOTIF.PHP.MEMORY_LIMIT',
'NOTIF.PHP.DISABLE_FUNCTIONS', 'NOTIF.PHP.DISABLE_FUNCTIONS',
'NOTIF.PHP.PHANTOMJS', 'NOTIF.PHP.CHROMIUM',
'NOTIF.PHP.VERSION', 'NOTIF.PHP.VERSION',
'NOTIF.HISTORYDB', 'NOTIF.HISTORYDB',
'NOTIF.PANDORADB', 'NOTIF.PANDORADB',

File diff suppressed because it is too large Load Diff

View File

@ -652,18 +652,18 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$row[] = round($sla['sla_limit'], 2).'%'; $row[] = round($sla['sla_limit'], 2).'%';
if (reporting_sla_is_not_init_from_array($sla)) { if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('N/A').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('Not init').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
} else if (reporting_sla_is_ignored_from_array($sla)) { } else if (reporting_sla_is_ignored_from_array($sla)) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('N/A').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('No data').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_IGNORED.';">'.__('No data').'</span>';
// Normal calculation. // Normal calculation.
} else if ($sla['sla_status']) { } else if ($sla['sla_status']) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.__('OK').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">'.__('OK').'</span>';
} else { } else {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.__('Fail').'</span>'; $row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
} }
// Second table for time globals. // Second table for time globals.
@ -961,7 +961,7 @@ function reporting_html_top_n($table, $item, $pdf=0)
$table->data['top_n']['cell'] = html_print_table($table1, true); $table->data['top_n']['cell'] = html_print_table($table1, true);
} }
if (!empty($item['charts']['pie'])) { if (empty($item['charts']['pie']) === false) {
if ($pdf !== 0) { if ($pdf !== 0) {
$return_pdf .= $item['charts']['pie']; $return_pdf .= $item['charts']['pie'];
} else { } else {
@ -970,16 +970,15 @@ function reporting_html_top_n($table, $item, $pdf=0)
} }
} }
if (!empty($item['charts']['bars'])) { if (empty($item['charts']['bars']) === false) {
if ($pdf !== 0) { if ($pdf !== 0) {
$return_pdf .= $item['charts']['bars']; $return_pdf .= $item['charts']['bars'];
} else { } else {
// $table->colspan['char_bars']['cell'] = 3;
$table->data['char_pie'][1] = $item['charts']['bars']; $table->data['char_pie'][1] = $item['charts']['bars'];
} }
} }
if (!empty($item['resume'])) { if (empty($item['resume']) === false) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
@ -2292,7 +2291,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0)
$row['data_module'] = remove_right_zeros( $row['data_module'] = remove_right_zeros(
number_format( number_format(
$data['data_module'], $data['data_module'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} else { } else {
@ -2785,7 +2786,7 @@ function reporting_html_historical_data($table, $item, $pdf=0)
} else { } else {
$row = [ $row = [
$data[__('Date')], $data[__('Date')],
remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'])), remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
]; ];
} }
@ -2925,7 +2926,9 @@ function reporting_html_last_value($table, $item, $pdf=0)
$dataDatos = remove_right_zeros( $dataDatos = remove_right_zeros(
number_format( number_format(
$item['data']['datos'], $item['data']['datos'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
); );
} else { } else {
@ -3460,28 +3463,32 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
$table1->head = []; $table1->head = [];
$table1->data = []; $table1->data = [];
if ($item['data']['unknown'] == 1) { if ($item['data']['unknown'] == 1) {
$table1->data['data']['unknown'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_UNKNOWN.';">'; $table1->data['data']['unknown'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_UNKNOWN.';">';
$table1->data['data']['unknown'] .= __('Unknown').'</p>'; $table1->data['data']['unknown'] .= __('Unknown').'</p>';
} else { } else {
$table1->data['data']['ok'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'; $table1->data['data']['ok'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">';
$table1->data['data']['ok'] .= html_print_image( $table1->data['data']['ok'] .= html_print_image(
'images/module_ok.png', 'images/module_ok.png',
true true
).' '.__('OK').': '.remove_right_zeros( ).' '.__('OK').': '.remove_right_zeros(
number_format( number_format(
$item['data']['ok']['value'], $item['data']['ok']['value'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
).' %</p>'; ).' %</p>';
$table1->data['data']['fail'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'; $table1->data['data']['fail'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">';
$table1->data['data']['fail'] .= html_print_image( $table1->data['data']['fail'] .= html_print_image(
'images/module_critical.png', 'images/module_critical.png',
true true
).' '.__('Not OK').': '.remove_right_zeros( ).' '.__('Not OK').': '.remove_right_zeros(
number_format( number_format(
$item['data']['fail']['value'], $item['data']['fail']['value'],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
).' % '.'</p>'; ).' % '.'</p>';
} }
@ -3835,7 +3842,9 @@ function reporting_html_value(
remove_right_zeros( remove_right_zeros(
number_format( number_format(
$data[__('Maximun')], $data[__('Maximun')],
$config['graph_precision'] $config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
) )
), ),
]; ];
@ -4674,7 +4683,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">'; $checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume; $checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>'; $checks_resume_text .= '</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>'; $sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
switch ($item['data'][$k_chart]['failover']) { switch ($item['data'][$k_chart]['failover']) {
case 'primary_compare': case 'primary_compare':
$title = '<b>'.__('Primary').' (24x7)</b>'; $title = '<b>'.__('Primary').' (24x7)</b>';
@ -4702,7 +4711,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
case 'result_compare': case 'result_compare':
$title = '<b>'.__('Result').' (24x7)</b>'; $title = '<b>'.__('Result').' (24x7)</b>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>'; $sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">'; $checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume; $checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>'; $checks_resume_text .= '</span>';
@ -4713,7 +4722,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$total_values += $sla_value; $total_values += $sla_value;
$count_total_charts++; $count_total_charts++;
$title = '<b>'.__('Result').'</b>'; $title = '<b>'.__('Result').'</b>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>'; $sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">'; $checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume; $checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>'; $checks_resume_text .= '</span>';
@ -4747,7 +4756,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table_summary->data = []; $table_summary->data = [];
$table_summary->data[0][0] = '<b>'.__('Summary').'</b>'; $table_summary->data[0][0] = '<b>'.__('Summary').'</b>';
$table_summary->data[0][1] = '<span style = "font-weight: bold; font-size: '.$font_size.' !important;">'; $table_summary->data[0][1] = '<span style = "font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').';">';
$table_summary->data[0][1] .= sla_truncate($total_values / $count_total_charts); $table_summary->data[0][1] .= sla_truncate($total_values / $count_total_charts);
$table_summary->data[0][1] .= ' %'; $table_summary->data[0][1] .= ' %';
$table_summary->data[0][1] .= '</span>'; $table_summary->data[0][1] .= '</span>';
@ -5131,7 +5140,17 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height)
// Fixed width non interactive charts. // Fixed width non interactive charts.
$status_chart_width = $graph_width; $status_chart_width = $graph_width;
$tdata[0] = '<div style="margin: auto; width: '.$graph_width.'px;"><div id="status_pie" style="margin: auto; width: '.$graph_width.'">'.graph_agent_status(false, $graph_width, $graph_height, true, true).'</div></div>'; $tdata[0] = '<div style="margin: auto; width: '.$graph_width.'px;">';
$tdata[0] .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'">';
$tdata[0] .= graph_agent_status(
false,
$graph_width,
$graph_height,
true,
true
);
$tdata[0] .= '</div>';
$tdata[0] .= '</div>';
} else { } else {
$tdata[2] = html_print_image( $tdata[2] = html_print_image(
'images/image_problem_area_small.png', 'images/image_problem_area_small.png',
@ -5141,7 +5160,16 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height)
} }
if ($data['monitor_alerts'] > 0) { if ($data['monitor_alerts'] > 0) {
$tdata[2] = '<div style="margin: auto; width: '.$graph_width.'px;">'.graph_alert_status($data['monitor_alerts'], $data['monitor_alerts_fired'], $graph_width, $graph_height, true, true).'</div>'; $tdata[2] = '<div style="margin: auto; width: '.$graph_width.'px;">';
$tdata[2] .= graph_alert_status(
$data['monitor_alerts'],
$data['monitor_alerts_fired'],
$graph_width,
$graph_height,
true,
true
);
$tdata[2] .= '</div>';
} else { } else {
$tdata[2] = html_print_image( $tdata[2] = html_print_image(
'images/image_problem_area_small.png', 'images/image_problem_area_small.png',

View File

@ -46,6 +46,8 @@ function reporting_xml_get_report($report, $filename, $return=false)
// Download if marked to download. // Download if marked to download.
if ($filename !== false) { if ($filename !== false) {
// Cookie for download control.
setDownloadCookieToken();
header('Content-Type: application/xml; charset=UTF-8'); header('Content-Type: application/xml; charset=UTF-8');
header('Content-Disposition: attachment; filename="'.$filename.'.xml"'); header('Content-Disposition: attachment; filename="'.$filename.'.xml"');
} }

View File

@ -1349,9 +1349,6 @@ function servers_get_server_string_name(int $server)
case SERVER_TYPE_ENTERPRISE_SATELLITE: case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite server'); return __('Satellite server');
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
return __('Transactional server');
case SERVER_TYPE_ALERT: case SERVER_TYPE_ALERT:
return __('Alert server'); return __('Alert server');

View File

@ -460,7 +460,7 @@ function snmp_browser_get_oid(
$snmptranslate_bin = $config['snmptranslate']; $snmptranslate_bin = $config['snmptranslate'];
} }
if ($server_to_exec != 0 && enterprise_installed()) { if (empty($server_to_exec) === false && enterprise_installed()) {
$server_data = db_get_row('tserver', 'id_server', $server_to_exec); $server_data = db_get_row('tserver', 'id_server', $server_to_exec);
$command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid); $command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid);

View File

@ -193,7 +193,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "<span title='".$last_data['datos']."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>'; $data = "<span title='".$last_data['datos']."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) { } else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>'; $data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else { } else {
$data = ui_print_truncate_text( $data = ui_print_truncate_text(
io_safe_output($last_data['datos']), io_safe_output($last_data['datos']),
@ -209,7 +209,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default: default:
if (is_numeric($last_data['datos'])) { if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>'; $data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else { } else {
$data = ui_print_truncate_text( $data = ui_print_truncate_text(
io_safe_output($last_data['datos']), io_safe_output($last_data['datos']),
@ -232,7 +232,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "<span title='".human_milliseconds_to_string($last_data['datos'])."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>'; $data = "<span title='".human_milliseconds_to_string($last_data['datos'])."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) { } else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>'; $data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else { } else {
$data = ui_print_truncate_text( $data = ui_print_truncate_text(
io_safe_output($last_data['datos']), io_safe_output($last_data['datos']),
@ -248,7 +248,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default: default:
if (is_numeric($last_data['datos'])) { if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>'; $data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else { } else {
$data = ui_print_truncate_text( $data = ui_print_truncate_text(
io_safe_output($last_data['datos']), io_safe_output($last_data['datos']),
@ -271,7 +271,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']); $data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']);
if ($data_macro) { if ($data_macro) {
if (is_numeric($data_macro)) { if (is_numeric($data_macro)) {
$last_data_str = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'])).'</span>'; $last_data_str = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else { } else {
$last_data_str = ui_print_truncate_text( $last_data_str = ui_print_truncate_text(
io_safe_output($data_macro), io_safe_output($data_macro),
@ -594,10 +594,10 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata); $hashdata = md5($hashdata);
$url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'].'&'.'loginhash=auto&'."loginhash_data=$hashdata&".'loginhash_user='.str_rot13($user); $url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'];
if ($grants_on_node && (bool) $user_access_node !== false) { if ($grants_on_node && (bool) $user_access_node !== false) {
$cellName .= '<a href="'.$url.'">'.'<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>'; $cellName .= '<a onclick="sendHash(\''.$url.'\')" href="#"><b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
} else { } else {
$cellName .= '<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b>'; $cellName .= '<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b>';
} }
@ -690,20 +690,13 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$go_to_agent = '<div style="text-align: right">'; $go_to_agent = '<div style="text-align: right">';
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { $cluster = PandoraFMS\Cluster::loadFromAgentId(
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
$agent['id_agente'] $agent['id_agente']
); );
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR; $go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$url .= '/operation/cluster/cluster'; $go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true);
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
$go_to_agent .= '<a target="_blank" href="'.$url.'">';
$go_to_agent .= html_print_submit_button(__('Edit cluster'), 'upd_button', false, 'class="sub config"', true);
}
} else { } else {
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">'; $go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); $go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
} }
@ -905,5 +898,12 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
metaconsole_restore_db(); metaconsole_restore_db();
} }
return; echo "
<script>
function sendHash(url) {
window.location = url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13($user)."';
}
</script>";
} }

View File

@ -3540,6 +3540,11 @@ function ui_print_datatable(array $parameters)
titleAttr: "'.__('Export current page to CSV').'", titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'", title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'", fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : { exportOptions : {
modifier : { modifier : {
// DataTables core // DataTables core
@ -3547,7 +3552,7 @@ function ui_print_datatable(array $parameters)
page : "All", page : "All",
search : "applied" search : "applied"
}'.$export_columns.' }'.$export_columns.'
} },
} }
] : [], ] : [],
lengthMenu: '.json_encode($pagination_options).', lengthMenu: '.json_encode($pagination_options).',
@ -3671,6 +3676,16 @@ function ui_print_datatable(array $parameters)
$js .= '$(".datatables_thead_tr").css("height", 0);'; $js .= '$(".datatables_thead_tr").css("height", 0);';
} }
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '});'; $js .= '});';
$js .= '</script>'; $js .= '</script>';
@ -6577,10 +6592,11 @@ function ui_print_comments($comments)
} else { } else {
$rest_time = (time() - $last_comment['utimestamp']); $rest_time = (time() - $last_comment['utimestamp']);
$time_last = (($rest_time / 60) / 60); $time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
if (strlen($comentario) > '200px') { if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...'; $comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
} }
} }

View File

@ -924,7 +924,7 @@ function visual_map_print_item(
$value_text = format_for_graph($module_value, 2); $value_text = format_for_graph($module_value, 2);
if ($value_text <= 0) { if ($value_text <= 0) {
$value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'])); $value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} }
if (!empty($unit_text)) { if (!empty($unit_text)) {
@ -1227,7 +1227,7 @@ function visual_map_print_item(
$module_data = get_bars_module_data( $module_data = get_bars_module_data(
$id_module, $id_module,
($layoutData['type_graph'] !== 'horizontal') $layoutData['type_graph']
); );
$options = []; $options = [];
$options['generals']['rotate'] = true; $options['generals']['rotate'] = true;
@ -1743,7 +1743,7 @@ function visual_map_print_item(
|| (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0) || (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0)
) { ) {
if (is_numeric($value)) { if (is_numeric($value)) {
$img_style_title .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'])); $img_style_title .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else { } else {
$img_style_title .= ' <br>'.__('Last value: ').$value; $img_style_title .= ' <br>'.__('Last value: ').$value;
} }
@ -1881,13 +1881,13 @@ function visual_map_print_item(
echo '</tr>'; echo '</tr>';
echo "<tr class='bg_whitesmoke height_90p'>"; echo "<tr class='bg_whitesmoke height_90p'>";
echo '<td>'; echo '<td>';
echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2)).'%</div>'; echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='critical_vm'>Critical</div>"; echo "<div class='critical_vm'>Critical</div>";
echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2)).'%</div>'; echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='warning_vm'>Warning</div>"; echo "<div class='warning_vm'>Warning</div>";
echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2)).'%</div>'; echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='normal_vm'>Normal</div>"; echo "<div class='normal_vm'>Normal</div>";
echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2)).'%</div>'; echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='unknown_vm'>Unknown</div>"; echo "<div class='unknown_vm'>Unknown</div>";
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
@ -2344,7 +2344,7 @@ function get_if_module_is_image($id_module)
} }
function get_bars_module_data($id_module, $vBars=false) function get_bars_module_data($id_module, $typeGraph='horizontal')
{ {
// This charts is only serialize graphs. // This charts is only serialize graphs.
// In other string show image no data to show. // In other string show image no data to show.
@ -2355,7 +2355,7 @@ function get_bars_module_data($id_module, $vBars=false)
); );
$values = false; $values = false;
// avoid showing the image type modules. WUX // Avoid showing the image type modules. WUX.
if (strpos($mod_values, 'data:image/png;base64') !== 0) { if (strpos($mod_values, 'data:image/png;base64') !== 0) {
if (preg_match("/\r\n/", $mod_values)) { if (preg_match("/\r\n/", $mod_values)) {
$values = explode("\r\n", $mod_values); $values = explode("\r\n", $mod_values);
@ -2364,26 +2364,28 @@ function get_bars_module_data($id_module, $vBars=false)
} }
} }
$values_to_return = [];
$index = 0;
$color_index = 0;
$total = 0;
if (!$values) { if (!$values) {
return false; return false;
} }
if ($vBars === false) { $values_to_return = [];
foreach ($values as $val) { foreach ($values as $val) {
$data = explode(',', $val); $data = explode(',', $val);
$values_to_return[$data[0]] = ['g' => $data[1]];
if ($data[0] === $val) {
continue;
} }
$values_to_return['labels'][] = io_safe_output($data[0]);
if ($typeGraph === 'horizontal') {
$values_to_return['data'][] = [
'y' => io_safe_output($data[0]),
'x' => $data[1],
];
} else { } else {
foreach ($values as $val) { $values_to_return['data'][] = [
$data = explode(',', $val); 'x' => io_safe_output($data[0]),
$values_to_return[] = [ 'y' => $data[1],
'tick' => $data[0],
'data' => $data[1],
]; ];
} }
} }
@ -2462,7 +2464,7 @@ function visual_map_get_simple_value($type, $id_module, $period=SECONDS_1DAY)
} else { } else {
if (is_numeric($value)) { if (is_numeric($value)) {
if ($config['simple_module_value']) { if ($config['simple_module_value']) {
$value = remove_right_zeros(number_format($value, $config['graph_precision'])); $value = remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} }
} }
@ -2842,73 +2844,22 @@ function get_donut_module_data($id_module)
$no_data_to_show = true; $no_data_to_show = true;
} }
$colors = [];
$colors[] = '#aa3333';
$colors[] = '#045FB4';
$colors[] = '#8181F7';
$colors[] = '#F78181';
$colors[] = '#D0A9F5';
$colors[] = '#BDBDBD';
$colors[] = '#6AB277';
$max_elements = 6;
$values_to_return = []; $values_to_return = [];
$index = 0;
$total = 0;
foreach ($values as $val) { foreach ($values as $val) {
if ($index < $max_elements) {
$data = explode(',', $val); $data = explode(',', $val);
if ($data[0] === $val) {
continue;
}
if ($no_data_to_show) { if ($no_data_to_show) {
$values_to_return[$index]['tag_name'] = $data[0]; $values_to_return['labels'][] = $data[0];
} else { } else {
$values_to_return[$index]['tag_name'] = $data[0].': '.$data[1]; $values_to_return['labels'][] = $data[0].': '.$data[1];
} }
$values_to_return[$index]['color'] = $colors[$index]; $values_to_return['data'][] = (int) $data[1];
$values_to_return[$index]['value'] = (int) $data[1];
$total += (int) $data[1];
$index++;
} else {
$data = explode(',', $val);
$values_to_return[$index]['tag_name'] = __('Others').': '.$data[1];
$values_to_return[$index]['color'] = $colors[$index];
$values_to_return[$index]['value'] += (int) $data[1];
$total += (int) $data[1];
} }
}
foreach ($values_to_return as $ind => $donut_data) {
$values_to_return[$ind]['percent'] = (($donut_data['value'] * 100) / $total);
}
// sort array
$new_values_to_return = [];
while (!empty($values_to_return)) {
$first = true;
$max_elem = 0;
$max_elem_array = [];
$index_to_del = 0;
foreach ($values_to_return as $i => $val) {
if ($first) {
$max_elem = $val['value'];
$max_elem_array = $val;
$index_to_del = $i;
$first = false;
} else {
if ($val['value'] > $max_elem) {
$max_elem = $val['value'];
$max_elem_array = $val;
$index_to_del = $i;
}
}
}
$new_values_to_return[] = $max_elem_array;
unset($values_to_return[$index_to_del]);
}
$values_to_return = $new_values_to_return;
return $values_to_return; return $values_to_return;
} }

File diff suppressed because it is too large Load Diff

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