Merge remote-tracking branch 'origin/develop' into ent-9135-buscar-por-nombre-de-usuario-en-eventos

Conflicts:
	pandora_console/extras/mr/59.sql
This commit is contained in:
Daniel Barbero 2022-12-13 09:17:39 +01:00
commit a0ddad63b8
145 changed files with 1073 additions and 469 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.766
%define release 221118
%define version 7.0NG.767
%define release 221213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.766
%define release 221118
%define version 7.0NG.767
%define release 221213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -12,8 +12,8 @@
#
###################################################
try:
from sys import argv
from sys import path
from sys import stderr
from sys import exit
from subprocess import Popen
@ -21,10 +21,12 @@ from subprocess import PIPE
from subprocess import DEVNULL
from subprocess import getstatusoutput
import psutil
except ModuleNotFoundError as err:
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
exit(1)
global module_list
module_list = []
version = "1.1"
VERSION = "1.2"
#########################################################################################
@ -50,15 +52,15 @@ class PSCheck:
procname = PSCheck.get_serviceprocess(element)
# Get process status
parstatus = PSCheck.getstatus(element)
if memcpu == True and parstatus == 1:
if memcpu and parstatus == 1:
usage = get_memcpu(str(procname), str(element))
output += usage
# Generate module with name and status
parent = service_module(str(element), parstatus)
output += parent
if option == True:
if option:
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:
output += child
else:
@ -66,7 +68,6 @@ class PSCheck:
else:
next
#if output != '':
if output and element and procname:
return ({"name" : element, "process" : procname, "modules": output})
else:
@ -84,13 +85,13 @@ class PSCheck:
status = PSCheck.getstatus(child)
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
if status:
if memcpu == True:
if memcpu:
kidsusage = get_memcpu(str(child))
for usage in kidsusage:
kids += usage
else:
next
return (kids)
return kids
@staticmethod
def getstatus(servicename):
@ -99,7 +100,7 @@ class PSCheck:
"' |", "Select-Object", "-ExpandProperty", "Status"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
status = running.communicate()[0].strip()
return (int(status == "Running"))
return int(status == "Running")
@staticmethod
def get_serviceprocess(servicename):
@ -108,7 +109,7 @@ class PSCheck:
srv_pid = service.pid()
process = psutil.Process(srv_pid)
proc_name = process.name()
return (proc_name)
return proc_name
#########################################################################################
@ -124,13 +125,13 @@ def service_module(name, value, parent=None):
"module_parent" : parent,
}]
#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."""
modules = []
if process:
if servicename != None:
if servicename is not None:
parentname = servicename
else:
parentname = process
@ -147,7 +148,7 @@ def get_memcpu (process, servicename):
"unit" : "%",
"module_parent" : "Service "+ parentname + " - Status",
}]
return (modules)
return modules
def proc_percentbyname(procname): ############# 03/03/2020
"""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:
next
#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):
"""Creates modules for Windows servers."""
@ -173,7 +174,7 @@ def win_service(servicelist, option=False, memcpu=False):
for srvc in servicelist:
if srvc and len(srvc) > 2:
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"]
module_list.append(srvc)
#winprocess = output["name"]
@ -227,7 +228,7 @@ def lnx_service(services_list, memcpu=False):
exit()
if status:
module_list.append(srvc)
if memcpu == True:
if memcpu:
modules += get_memcpu(srvc, None)
for m in modules:
@ -383,7 +384,7 @@ def discover(osyst, servicelist):
elif osyst == "Linux":
lnx_service(servicelist, memcpu)
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("Usage:")
print("{} [options] [--usage]".format(argv[0]))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,9 @@
START TRANSACTION;
ALTER TABLE `tevent_filter` ADD COLUMN `owner_user` TEXT;
ALTER TABLE `tevent_filter` ADD COLUMN `not_search` INT NOT NULL DEFAULT 0;
ALTER TABLE `tevent_filter` MODIFY COLUMN `server_id` TEXT;
UPDATE tconfig SET value = 'Hope' WHERE token LIKE 'lts_name';
ALTER TABLE `tlayout_template` ADD COLUMN `maintenance_mode` TEXT;
COMMIT;

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `tagent_custom_fields` ADD `is_link_enabled` TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE `tevent_filter` ADD COLUMN `owner_user` TEXT;
ALTER TABLE `tevent_filter` ADD COLUMN `not_search` INT NOT NULL DEFAULT 0;
COMMIT;

View File

@ -91,7 +91,7 @@ $login_body_class = '';
// Overrides the default background with the defined by the user.
if (!empty($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

View File

@ -19,15 +19,15 @@
global $config;
if ($config['language'] == 'es') {
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
} else {
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
}
// Prints help dialog information
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" class="invisible">';
echo '<div class="login_help_dialog">';
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'</b></p>';
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'</b></p>';
echo "<p class='font_10'><b>".__('Otherwise, functionalities will be lost.').'</b></p>';
echo '<ul>';
echo "<li class='pdd_5px'>".__('Report download in PDF format').'</li>';

View File

@ -309,7 +309,7 @@ $table_ip .= '<div class="label_select_child_right">'.html_print_input(
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
).__('Fix IP address').'<p style="margin-right: 15px">'.ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</p></div>';
$table_ip .= '</div></div>';
@ -872,6 +872,35 @@ foreach ($fields as $field) {
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 {
$data_field[1] = html_print_textarea(
'customvalue_'.$field['id_field'],

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = [];
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).
@ -999,7 +1007,22 @@ if ($update_agent) {
$field_values = [];
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) {

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_combo_enable = (bool) get_parameter('is_combo_enable', 0);
$combo_values = (string) get_parameter('combo_values', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Header.
if ($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'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$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, '');
} else {
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
);
$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">';
html_print_table($table);
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 () {
if( $(this).is(":checked") ){
$('#configure_field-4').show();
dialog_message("#message_no_set_password");
$('#configure_field-1').hide();
$('#configure_field-5').hide();
}
else{
$('#configure_field-4').hide();
$('#configure_field-1').show();
$('#configure_field-5').show();
}
});
$('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){
dialog_message("#message_no_set_combo");
$('#configure_field-3').hide();
$('#configure_field-5').hide();
}
else{
$('#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);
$combo_values = (string) get_parameter('combo_values', '');
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Create field.
if ($create_field) {
// Check if name field is empty.
if ($name == '') {
if ($name === '') {
ui_print_error_message(__('The name must not be empty'));
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
ui_print_error_message(__('The name must be unique'));
@ -54,6 +55,7 @@ if ($create_field) {
'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type,
'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
]
);
ui_print_success_message(__('Field successfully created'));
@ -63,12 +65,13 @@ if ($create_field) {
// Update field.
if ($update_field) {
// Check if name field is empty.
if ($name != '') {
if ($name !== '') {
$values = [
'name' => $name,
'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type,
'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
];
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);

View File

@ -445,8 +445,6 @@ if ($module_action === 'delete') {
}
} else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +488,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 +1318,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select(
[
'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules',
],
'module_action',
@ -1286,6 +1331,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false
);
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button(
__('Execute action'),
'submit_modules_action',

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) {
ob_clean();
// Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/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)) {
foreach ($downtime_agents as $downtime_agent) {
$downtime_items = [];
$downtime_items[] = $downtime_agent[alias];
$downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'),
'csv_export',
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"'
);
echo '</div>';

View File

@ -451,7 +451,7 @@ $simple_alerts = agents_get_alerts_simple(
if (!$id_agente) {
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'&offset='.$offset.$form_params;
} else {
$url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
}
// Urls to sort the table.
@ -570,7 +570,7 @@ foreach ($simple_alerts as $alert) {
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

@ -102,7 +102,7 @@ $table_details->data[] = $data;
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

@ -378,7 +378,7 @@ $table->data[5][1] = html_print_select(
$table->data[6][0] = '<b>'.__('Free search').'</b>';
$table->data[6][1] = html_print_input_text(
'search',
io_safe_output($search),
$search,
'',
15,
255,

View File

@ -42,7 +42,6 @@ require_once $config['homedir'].'/include/functions_users.php';
if (is_metaconsole() === true) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_hook('open_meta_frame');
}
if (is_ajax() === true) {
@ -270,6 +269,7 @@ if (is_ajax() === true) {
return;
}
enterprise_hook('open_meta_frame');
$tab = (string) get_parameter('tab', 'groups');

View File

@ -100,16 +100,15 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
$options_policies = [];
$policies_options = enterprise_hook('massive_policies_options');
$policies_options = array_unique($policies_options);
if ($policies_options != ENTERPRISE_NOT_HOOK) {
$policies_options = array_unique($policies_options);
$options_policies = array_merge($options_policies, $policies_options);
}
$options_snmp = [];
$snmp_options = enterprise_hook('massive_snmp_options');
$snmp_options = array_reverse($snmp_options);
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
$snmp_options = array_reverse($snmp_options);
$options_snmp = array_merge($options_snmp, $snmp_options);
}

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
header('Content-type: application/octet-stream');
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'.'&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);
}

View File

@ -229,6 +229,12 @@ if ($add_module === true) {
// Safe output remove all entities.
io_safe_output_array($id_modules, '');
$id_modules = array_map(
function ($mod) {
return io_safe_input($mod);
},
$id_modules
);
$id_agent_modules = db_get_all_rows_sql(
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"

View File

@ -1055,7 +1055,7 @@ switch ($action) {
]
);
$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(
'images/xml.png',
true,

View File

@ -886,6 +886,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
}
function submit_delete_multiple_items() {
event.preventDefault();
delete_items = [];
jQuery.each($("input[name='multiple_delete_items']:checked"),
function(i, item) {
@ -893,7 +894,22 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
}
);
$("input[name='id_item_json']").val(JSON.stringify(delete_items));
$("#form_multiple_delete").submit();
$.ajax({
type: "POST",
url: "ajax.php",
data: {
page: "godmode/reporting/visual_console_builder",
action: "multiple_delete",
tab: "list_elements",
id_item_json: JSON.stringify(delete_items),
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
},
dataType: "json",
complete: function (data) {
location.reload();
}
});
return false;
}
</script>

View File

@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$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.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
$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);
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$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.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
$table->data['plugin_parameters'] = $data;
$data = [];
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$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);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$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);
$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);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$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);
$table->data['plugin_'.$next_name_number] = $datam;
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : '';
$datam[1] = html_print_textarea(
$macro_help_name,
6,
100,
$macro_help_value,
'class="command_macro" class="w97p"'.$tadisabled,
'class="command_macro" class="w97p"',
true
);
if ($locked) {
$datam[1] .= html_print_image(
'images/lock_mc.png',
true,
['class' => 'command_macro lock invert_filter']
);
}
$datam[1] .= '<br><br><br>';
$table->data['plugin_'.$next_name_number] = $datam;
@ -551,6 +529,8 @@ if (($create != '') || ($view != '')) {
// Add/Delete buttons
$datam = [];
if (!$locked) {
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
@ -559,7 +539,6 @@ if (($create != '') || ($view != '')) {
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
if (!$locked) {
$delete_macro_style = '';
if ($i <= 2) {
$delete_macro_style = 'display:none;';
@ -1002,7 +981,10 @@ ui_require_javascript_file('pandora_modules');
});
update_preview();
}
if (locked === 0) {
$('a#add_macro_btn').click(add_macro_click_event);
}
// Delete macro
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) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
}
if (locked) {
$('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

@ -63,6 +63,7 @@ switch ($action) {
break;
}
$table = new stdClass();
$table->class = 'info_table';
$table->width = '98%';
$table->head[0] = __('Map connection name');

View File

@ -207,6 +207,7 @@ switch ($action) {
break;
}
$table = new stdClass();
$table->width = '90%';
$table->data = [];

View File

@ -45,7 +45,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if ($php_version_array[0] < 7) {
include_once 'general/php7_message.php';
include_once 'general/php_message.php';
}
$tab = get_parameter('tab', 'online');

View File

@ -35,8 +35,6 @@ require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php';
@ -130,6 +128,8 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
if (is_ajax()) {
$delete_profile = (bool) get_parameter('delete_profile');
$get_user_profile = (bool) get_parameter('get_user_profile');
if ($delete_profile) {
$id2 = (string) get_parameter('id_user');
$id_up = (int) get_parameter('id_user_profile');
@ -211,9 +211,64 @@ if (is_ajax()) {
return;
}
if ($get_user_profile === true) {
$profile_id = (int) get_parameter('profile_id');
$group_id = (int) get_parameter('group_id', -1);
$user_id = (string) get_parameter('user_id', '');
$no_hierarchy = (int) get_parameter('no_hierarchy', -1);
$assigned_by = (string) get_parameter('assigned_by', '');
$id_policy = (int) get_parameter('id_policy', -1);
$tags = (string) get_parameter('id_policy', '');
$filter = [];
if ($group_id > -1) {
$filter['id_perfil'] = $profile_id;
}
if ($group_id > -1) {
$filter['id_grupo'] = $group_id;
}
if ($user_id !== '') {
$filter['id_usuario'] = $user_id;
}
if ($no_hierarchy > -1) {
$filter['no_hierarchy'] = $no_hierarchy;
}
if ($assigned_by !== '') {
$filter['assigned_by'] = $assigned_by;
}
if ($id_policy > -1) {
$filter['id_policy'] = $id_policy;
}
if ($tags !== '') {
$filter['tags'] = $tags;
}
$profile = db_get_all_rows_filter(
'tusuario_perfil',
$filter
);
if ($profile !== false && count($profile) > 0) {
echo json_encode($profile);
return;
} else {
echo json_encode('');
}
return;
}
}
enterprise_hook('open_meta_frame');
$tab = get_parameter('tab', 'user');
@ -1718,12 +1773,13 @@ $(document).ready (function () {
var data = [];
var aux = 0;
if(json_profile.val() != '') {
function addProfile(form) {
try {
var data = JSON.parse(json_profile.val());
} catch {
var data = [];
}
$('input:image[name="add"]').click(function (e) {
e.preventDefault();
var profile = $('#assign_profile').val();
var profile_text = $('#assign_profile option:selected').text();
var group = $('#assign_group').val();
@ -1739,14 +1795,26 @@ $(document).ready (function () {
}
if (profile === '0' || group === '-1') {
alert('<?php echo __('please select profile and group'); ?>');
alert('<?php echo __('Please select profile and group'); ?>');
return;
}
if (id_user == '' || is_err == 1) {
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
var profile_is_added = Object.entries(data).find(function(_data) {
return _data[1] === new_json;
});
if (typeof profile_is_added === 'undefined') {
data.push(new_json);
} else {
alert('<?php echo __('This profile is already defined'); ?>');
return;
}
json_profile.val(JSON.stringify(data));
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
@ -1765,8 +1833,39 @@ $(document).ready (function () {
aux++;
} else {
this.form.submit();
form.submit();
}
}
$('input:image[name="add"]').click(function (e) {
e.preventDefault();
if (id_user.length === 0) {
addProfile(this.form);
return;
}
var params = [];
params.push("get_user_profile=1");
params.push("profile_id=" + $('#assign_profile').val())
params.push("group_id=" + $('#assign_group').val());
params.push("user_id=" + id_user);
params.push("page=godmode/users/configure_user");
jQuery.ajax ({
data: params.join("&"),
type: 'POST',
dataType: "json",
async: false,
form: this.form,
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
success: function (data) {
if (data.length > 0) {
alert('<?php echo __('This profile is already defined'); ?>');
} else {
addProfile(this.form);
}
}
});
});
$('input:image[name="del"]').click(function (e) {
@ -1841,9 +1940,11 @@ function delete_profile(event, btn) {
var json = json_profile.val();
var test = JSON.parse(json);
delete test[position-1];
json_profile.val(JSON.stringify(test));
var position_offset = <?php echo (is_metaconsole() === true) ? 2 : 1; ?>;
test.splice(position-position_offset, 1);
json_profile.val(JSON.stringify(test));
}
function show_data_section () {

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['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);
if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
);
// Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user);
if ($result) {
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']))
);
}
header('Refresh:1');
}
} else {
ui_print_error_message(__('There was a problem deleting the user'));

View File

@ -558,7 +558,7 @@ if ($load_filter_modal) {
);
echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter">';
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
$table = new StdClass;
$table->id = 'load_filter_form';
@ -1593,7 +1593,7 @@ if ($get_extended_event) {
$filter = get_parameter('filter', []);
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = $filter['group_rep'];
$event_rep = $group_rep;
$event_rep = (empty($group_rep) === true) ? EVENT_GROUP_REP_EVENTS : $group_rep;
$timestamp_first = $event['timestamp_first'];
$timestamp_last = $event['timestamp_last'];
$server_id = $event['server_id'];
@ -2283,7 +2283,7 @@ if ($drawConsoleSound === true) {
],
],
[
'label' => __('Time Sound'),
'label' => __('Sound duration'),
'arguments' => [
'type' => 'select',
'fields' => $times_sound,

View File

@ -250,9 +250,9 @@ function process_user_login_remote($login, $pass, $api=false)
{
global $config, $mysql_cache;
// Remote authentication
// Remote authentication.
switch ($config['auth']) {
// LDAP
// LDAP.
case 'ldap':
$sr = ldap_process_user_login($login, $pass);
// Try with secondary server if not login.
@ -265,7 +265,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Active Directory
// Active Directory.
case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
@ -273,7 +273,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Remote Pandora FMS
// Remote Pandora FMS.
case 'pandora':
if (enterprise_hook('remote_pandora_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
@ -281,7 +281,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Remote Integria
// Remote Integria.
case 'integria':
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
@ -289,7 +289,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Unknown authentication method
// Unknown authentication method.
default:
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
@ -303,7 +303,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
}
// Authentication ok, check if the user exists in the local database
// Authentication ok, check if the user exists in the local database.
if (is_user($login)) {
if (!user_can_login($login) && $api === false) {
return false;
@ -370,7 +370,7 @@ function process_user_login_remote($login, $pass, $api=false)
return $login;
}
// The user does not exist and can not be created
// The user does not exist and can not be created.
if ($config['autocreate_remote_users'] == 0 || is_user_blacklisted($login)) {
$config['auth_error'] = __(
'Ooops User not found in
@ -967,6 +967,12 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
$sr = ldap_search($ds, io_safe_output($ldap['ldap_base_dn']), $filter);
if (empty($sr) === true) {
$config['auth_error'] = 'ldap search failed';
@ldap_close($ds);
return false;
}
$memberof = ldap_get_entries($ds, $sr);
if ($memberof['count'] == 0 && !isset($memberof[0]['memberof'])) {

View File

@ -1594,17 +1594,21 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS');
}
if ($php_version_array[0] < 7) {
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
if ($php_version_array[0] < 8) {
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
if ($config['language'] == 'es') {
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
}
if ($config['language'] == 'ja') {
$url = 'https://pandorafms.com/manual/ja/documentation/07_technical_annexes/18_php_8';
}
$this->notify(
[
'type' => 'NOTIF.PHP.VERSION',
'title' => __('PHP UPDATE REQUIRED'),
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
'url' => $url,
]
);

View File

@ -143,6 +143,7 @@ class Diagnostics extends Wizard
[
'title' => __('Export to PDF'),
'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
]
);
$header_buttons = [

View File

@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
header('Pragma: no-cache');
header('Expires: 0');
setDownloadCookieToken();
// Clean up output buffering
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=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);
}

View File

@ -2215,8 +2215,10 @@ class NetworkMap
// Store relationships.
$this->relations = array_merge($edges, $orphans);
} else {
if (empty($this->relations) === true && empty($this->$edges) === false) {
$this->relations = $edges;
}
}
// Close dot file.
$graph .= $this->closeDotFile();
@ -2409,6 +2411,13 @@ class NetworkMap
);
}
if (isset($this->mapOptions['map_filter']['node_separation']) === true) {
foreach ($graph['nodes'] as $key => $value) {
$graph['nodes'][$key]['x'] *= $this->mapOptions['map_filter']['node_separation'];
$graph['nodes'][$key]['y'] *= $this->mapOptions['map_filter']['node_separation'];
}
}
unlink($filename_plain);
/*

View File

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

View File

@ -1046,7 +1046,7 @@ function mysql_db_get_row_filter($table, $filter, $fields=false, $where_join='AN
*
* @return mixed Array of the row or false in case of error.
*/
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false)
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false, $cache=true)
{
// TODO: Validate and clean fields
if (empty($fields)) {
@ -1077,7 +1077,7 @@ function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_
if ($returnSQL) {
return $sql;
} else {
return db_get_all_rows_sql($sql, $search_history_db);
return db_get_all_rows_sql($sql, $search_history_db, $cache);
}
}

View File

@ -6269,3 +6269,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

@ -4367,7 +4367,6 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
$status = modules_get_agentmodule_status($key);
switch ($status) {
case 0:
case 4:
case 300:
$status = 'normal';
break;
@ -4386,6 +4385,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
$status = 'unknown';
break;
case 4:
case 5:
$status = 'notinit';
break;

View File

@ -3588,6 +3588,19 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
// 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) {
$agents_affected = 0;
$idModule = false;
@ -11334,7 +11347,7 @@ function api_get_events($node_id, $trash2, $other, $returnType)
'status' => (isset($other['data'][8]) === true) ? $other['data'][8] : null,
'search' => (isset($other['data'][9]) === true) ? $other['data'][9] : null,
'id_group_filter' => (isset($other['data'][13]) === true) ? $other['data'][13] : null,
'tag_with' => (isset($other['data'][14]) === true) ? $other['data'][14] : null,
'tag_with' => (isset($other['data'][14]) === true) ? base64_encode(io_safe_output($other['data'][14])) : null,
'event_type' => (isset($other['data'][15]) === true) ? $other['data'][15] : null,
'id_server' => $node_id,
];

View File

@ -89,23 +89,34 @@ function cron_next_execution($cron, $module_interval, $module_id)
'id_agente_modulo',
$module_id
);
$cron_elems = explode(' ', $cron);
if (isset($cron_elems[4]) === true) {
$cron_elems[4] = '*';
}
$cron = implode(' ', $cron_elems);
$cur_time = ($last_execution !== false) ? $last_execution : time();
$nex_time = cron_next_execution_date($cron, $cur_time, $module_interval);
$nex_wday = (int) date('w', $nex_time);
// Check the wday values to avoid infinite loop.
$wday_int = cron_get_interval($wday);
if ($wday_int['down'] !== '*' && ($wday_int['down'] > 6 || ($wday_int['up'] !== false && $wday_int['up'] > 6))) {
$wday = '*';
}
// Check day of the way.
// Check week day.
while (!cron_check_interval($nex_wday, $wday)) {
// If it does not acomplish the day of the week, go to the next day.
$nex_time += SECONDS_1DAY;
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
$nex_wday = (int) date('w', $nex_time);
}
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
return ($nex_time - $cur_time);
}

View File

@ -795,6 +795,10 @@ function db_uncompress_module_data(
$flag_async = true;
}
if (strstr($module_type_str, 'async_string') !== false) {
$flag_async = true;
}
if (strstr($module_type_str, 'async_proc') !== false) {
$flag_async = true;
}

View File

@ -802,7 +802,7 @@ function events_get_all(
}
}
if (isset($filter['severity']) === true && $filter['severity'] !== '') {
if (isset($filter['severity']) === true && $filter['severity'] !== '' && (int) $filter['severity'] > -1) {
if (is_array($filter['severity']) === true) {
if (in_array(-1, $filter['severity']) === false) {
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
@ -1149,27 +1149,27 @@ function events_get_all(
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
io_safe_output($filter['custom_data'])
io_safe_output_html($filter['custom_data'])
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
io_safe_output($filter['custom_data'])
io_safe_output_html($filter['custom_data'])
);
}
} else {
if ($filter['custom_data_filter_type'] === '1') {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
$filter['custom_data'],
$filter['custom_data']
' AND JSON_VALID(custom_data) = 1
AND cast(JSON_EXTRACT(custom_data, "$.*") as CHAR) LIKE lower("%%%s%%") ',
io_safe_output($filter['custom_data'])
);
} else {
$sql_filters[] = sprintf(
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
$filter['custom_data'],
$filter['custom_data']
' AND JSON_VALID(custom_data) = 1
AND cast(JSON_KEYS(custom_data) as CHAR) REGEXP "%s" ',
io_safe_output($filter['custom_data'])
);
}
}
@ -1874,11 +1874,14 @@ function events_get_all(
);
if (isset($limit, $offset) === true
&& $limit !== 0
&& (int) $limit !== 0
&& isset($filter['csv_all']) === false
) {
$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);
$return = [
'buffers' => $buffers,
@ -3747,6 +3750,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) {
$target = str_replace(
'_event_utimestamp_',
@ -4727,22 +4739,30 @@ function events_page_general($event)
$data = [];
$data[0] = __('Timestamp');
if ($group_rep == 1 && $event['event_rep'] > 1) {
$data[1] = __('First event').': '.date($config['date_format'], $event['timestamp_first']).'<br>'.__('Last event').': '.date($config['date_format'], $event['timestamp_last']);
if ($event['event_rep'] > 1) {
$data[1] = __('First event').': ';
$data[1] .= date($config['date_format'], $event['timestamp_first']);
$data[1] .= '<br>';
$data[1] .= __('Last event').': ';
$data[1] .= date($config['date_format'], $event['timestamp_last']);
} else {
$data[1] = date($config['date_format'], $event['utimestamp']);
}
$table_general->data[] = $data;
// $event['owner_user'] = $event['id_usuario'];
$data = [];
$data[0] = __('Owner');
if (empty($event['owner_user'])) {
if (empty($event['owner_user']) === true) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$user_owner = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']);
if (empty($user_owner)) {
$user_owner = db_get_value(
'fullname',
'tusuario',
'id_user',
$event['owner_user']
);
if (empty($user_owner) === true) {
$user_owner = $event['owner_user'];
}

View File

@ -1100,7 +1100,7 @@ function gis_update_map(
}
if (array_key_exists('layer_agent_list', $layer)) {
if (count($layer['layer_agent_list']) > 0) {
if (empty($layer['layer_agent_list']) === false && count($layer['layer_agent_list']) > 0) {
foreach ($layer['layer_agent_list'] as $agent) {
$id = db_process_sql_insert(
'tgis_map_layer_has_tagente',
@ -1114,7 +1114,7 @@ function gis_update_map(
}
if (array_key_exists('layer_group_list', $layer)) {
if (count($layer['layer_group_list']) > 0) {
if (empty($layer['layer_group_list']) === false && count($layer['layer_group_list']) > 0) {
foreach ($layer['layer_group_list'] as $group) {
$id = db_process_sql_insert(
'tgis_map_layer_groups',

View File

@ -1416,7 +1416,7 @@ function graphic_combined_module(
}
}
if (isset($sources) && is_array($sources)) {
if (isset($sources) === true && is_array($sources) === true) {
$weights = [];
$labels = [];
$modules = [];
@ -1498,6 +1498,10 @@ function graphic_combined_module(
}
}
if ((bool) $params_combined['from_interface'] === true) {
$labels = [];
}
if ($module_list) {
$params_combined['modules_id'] = $module_list;
} else {

View File

@ -126,6 +126,7 @@ function network_general_map_configuration($nodes, $relations)
'map_filter' => [
'node_radius' => 40,
'node_sep' => 7,
'node_separation' => 5,
],
],
];
@ -171,8 +172,8 @@ function network_init_node_map($name)
return [
'name' => $name,
'type' => NODE_GENERIC,
'width' => 20,
'height' => 20,
'status' => '#82B92E',
'width' => 40,
'height' => 40,
'status' => 0,
];
}

View File

@ -284,7 +284,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false)
if (empty($profile['tags'])) {
$data['tags'] = '';
} else {
if (is_array($profile['tags'] === false)) {
if (is_array($profile['tags']) === false) {
$tags_ids = explode(',', $profile['tags']);
} else {
$tags_ids = $profile['tags'];

View File

@ -8682,8 +8682,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
$item['id_agent_module']
);
if (isset($item['compare']) === true
&& empty($item['compare']) === true
if (isset($item['compare']) === false
|| empty($item['compare']) === true
) {
$row['data']['compare'] = false;
} else {

View File

@ -4007,7 +4007,7 @@ function reporting_html_text(&$table, $item)
*/
function reporting_html_availability($table, $item, $pdf=0)
{
$retun_pdf = '';
$return_pdf = '';
$style = db_get_value(
'style',
@ -4234,7 +4234,7 @@ function reporting_html_availability($table, $item, $pdf=0)
} else {
$table_row[] = $row['agent'];
$item_name = $row['availability_item'];
if ((bool) $row['compare'] === false) {
if ((bool) $row['compare'] === true) {
$item_name .= ' ('.__('24 x 7').')';
}
@ -4422,6 +4422,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->data[] = $table_row2;
}
} else {
$table = new stdClass();
$table->colspan['error']['cell'] = 3;
$table->data['error']['cell'] = __(
'There are no Agent/Modules defined'
@ -5980,11 +5981,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
include_once '../../include/graphs/functions_gd.php';
}
$max_value = count($events);
if (is_metaconsole()) {
$max_value = SECONDS_1HOUR;
}
$period = SECONDS_1DAY;
if (!$text_header_event) {
$text_header_event = __('Events info (1hr.)');
@ -6057,7 +6054,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
} else {
$graph_data[] = [
'data' => $color,
'utimestamp' => 1,
'utimestamp' => SECONDS_1DAY,
];
}
}
@ -6076,9 +6073,9 @@ function reporting_get_event_histogram($events, $text_header_event=false)
$slicebar = flot_slicesbar_graph(
$graph_data,
$max_value,
'450px;border:0',
25,
$period,
'400px;border:0',
40,
$full_legend,
$colors,
$config['fontpath'],
@ -6091,7 +6088,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
[],
true,
1,
false,
450,
true
);

View File

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

View File

@ -1107,7 +1107,7 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
$profiles_without_tags = db_get_value_sql($query);
if ($profiles_without_tags == 0) {
if (users_is_admin() === true || $profiles_without_tags == 0) {
// --------------------------------------------------------------
// FIXED FOR TICKET #1921
//

View File

@ -3540,6 +3540,11 @@ function ui_print_datatable(array $parameters)
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
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 : {
modifier : {
// DataTables core
@ -3547,7 +3552,7 @@ function ui_print_datatable(array $parameters)
page : "All",
search : "applied"
}'.$export_columns.'
}
},
}
] : [],
lengthMenu: '.json_encode($pagination_options).',
@ -3671,6 +3676,16 @@ function ui_print_datatable(array $parameters)
$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 .= '</script>';
@ -4001,11 +4016,12 @@ function ui_toggle(
);
// Options.
$style = 'overflow:hidden;';
if ($hidden_default) {
$style = 'display:none';
$style .= 'height:0;position:absolute;';
$original = $img_b;
} else {
$style = '';
$style .= 'height:auto;position:relative;';
$original = $img_a;
}
@ -4111,24 +4127,28 @@ function ui_toggle(
$output .= ' if (is_metaconsole == 0) {';
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n";

View File

@ -51,6 +51,9 @@ $default_filename = 'data_exported - '.date($config['date_format']);
$filename = (string) get_parameter('filename', $default_filename);
$filename = io_safe_output($filename);
// Set cookie for download control.
setDownloadCookieToken();
/*
* $data = array(
* 'head' => array(<column>,<column>,...,<column>),

View File

@ -2461,14 +2461,14 @@ function pandoraFlotArea(
);
} else {
$.each(update_legend, function(index, value) {
if (typeof value[x] !== "undefined") {
if (typeof value[x - 1] !== "undefined") {
data_legend[index] =
" Min: " +
number_format(value[x].min, 0, unit, short_data, divisor) +
number_format(value[x - 1].min, 0, unit, short_data, divisor) +
" Max: " +
number_format(value[x].max, 0, unit, short_data, divisor) +
number_format(value[x - 1].max, 0, unit, short_data, divisor) +
" Avg: " +
number_format(value[x].avg, 0, unit, short_data, divisor);
number_format(value[x - 1].avg, 0, unit, short_data, divisor);
} else {
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
}
@ -2716,6 +2716,7 @@ function pandoraFlotArea(
$("#menu_export_csv_" + graph_id).click(function(e) {
e.preventDefault();
blockResubmit($(this));
plot.exportDataCSV();
var es_firefox =
navigator.userAgent.toLowerCase().indexOf("firefox") > -1;

File diff suppressed because one or more lines are too long

View File

@ -583,8 +583,7 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
status_module: status_module,
"module_name[]": idModules,
selection_mode: selection_mode,
tags: tags_selected,
id_group: id_group
tags: tags_selected
},
function(data) {
$("#agents").append(

View File

@ -72,7 +72,7 @@ function initialiceLayout(data) {
var positionGrid = grid.el.getBoundingClientRect();
var gridWidth = positionGrid.width;
var title = data.title;
getCellsLayout();
function getCellsLayout() {
@ -548,7 +548,7 @@ function initialiceLayout(data) {
function addWidgetDialog(id) {
$("#modal-add-widget")
.dialog({
title: "New Widget",
title: data.title,
resizable: false,
modal: true,
overlay: {

View File

@ -846,7 +846,56 @@ function check_execute_response_massive(response_id, response_parameters) {
function event_widget_options() {
if ($("#customFilter").val() != "-1") {
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: {
page: "include/ajax/events",
get_filter_values: 1,
id: $("#customFilter").val()
},
success: function(data) {
if (data["event_type"] === "") {
$("#eventType").val("0");
$("#eventType").trigger("change");
} else {
$("#eventType").val(data["event_type"]);
$("#eventType").trigger("change");
}
$("#limit").val(data["pagination"]);
$("#limit").trigger("change");
$("input[name='maxHours']").val(data["event_view_hr"]);
$("#eventStatus").val(data["status"]);
$("#eventStatus").trigger("change");
let posicion = data["severity"].indexOf(-1);
if (posicion !== -1) {
$("#severity").val(-1);
$("#severity").trigger("change");
} else {
const severity_array = data["severity"].split(",");
$("#severity").val(severity_array[0]);
$("#severity").trigger("change");
}
$("#tagsId option").attr("selected", false);
$.each(
atob(data["tag_with"])
.slice(0, -1)
.slice(1)
.split(","),
function(i, e) {
$(`#tagsId option[value=${e}]`).prop("selected", true);
}
);
$(".event-widget-input").disable();
}
});
} else {
$(".event-widget-input").enable();
}
@ -920,7 +969,7 @@ function openSoundEventModal(settings) {
sound = true;
}
test_sound_button(sound);
test_sound_button(sound, settings.urlSound);
});
// Play Stop.
@ -977,9 +1026,9 @@ function openSoundEventModal(settings) {
.show();
}
function test_sound_button(test_sound) {
function test_sound_button(test_sound, urlSound) {
if (test_sound === true) {
add_audio();
add_audio(urlSound);
} else {
remove_audio();
}
@ -1035,8 +1084,8 @@ function action_events_sound(mode, settings) {
}
}
function add_audio() {
var sound = "./include/sounds/" + $("#tabs-sound-modal #sound_id").val();
function add_audio(urlSound) {
var sound = urlSound + $("#tabs-sound-modal #sound_id").val();
$(".actions-sound-modal").append(
"<audio id='id_sound_event' src='" +
sound +
@ -1062,7 +1111,7 @@ function listen_event_sound(settings) {
function check_event_sound(settings) {
jQuery.post(
"./ajax.php",
settings.url,
{
page: "include/ajax/events",
get_events_fired: 1,
@ -1091,7 +1140,7 @@ function check_event_sound(settings) {
remove_audio();
// Apend audio.
add_audio();
add_audio(settings.urlSound);
// Add elements.
data.forEach(function(element) {

View File

@ -456,8 +456,7 @@ function load_modal(settings) {
// Function that shows a dialog box to confirm closures of generic manners.
// The modal id is random.
// eslint-disable-next-line no-unused-vars
function confirmDialog(settings) {
var randomStr = uniqId();
function confirmDialog(settings, idDialog = uniqId()) {
var hideOkButton = "";
var hideCancelButton = "";
@ -487,11 +486,11 @@ function confirmDialog(settings) {
if (typeof settings.message == "function") {
$("body").append(
'<div id="confirm_' + randomStr + '">' + settings.message() + "</div>"
'<div id="confirm_' + idDialog + '">' + settings.message() + "</div>"
);
} else {
$("body").append(
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
'<div id="confirm_' + idDialog + '">' + settings.message + "</div>"
);
}
@ -542,8 +541,8 @@ function confirmDialog(settings) {
buttons.unshift(newButton);
}
$("#confirm_" + randomStr);
$("#confirm_" + randomStr)
$("#confirm_" + idDialog);
$("#confirm_" + idDialog)
.dialog({
open: settings.open,
title: settings.title,
@ -763,3 +762,75 @@ function getGroupIcon(id_group, img_container) {
}
});
}
/* Prepare download control */
function getCookie(name) {
var parts = document.cookie.split(name + "=");
if (parts.length == 2)
return parts
.pop()
.split(";")
.shift();
}
function expireCookie(cName) {
document.cookie =
encodeURIComponent(cName) +
"=deleted; expires=" +
new Date(0).toUTCString();
}
function setCursor(buttonStyle, button) {
button.css("cursor", buttonStyle);
}
function setToken(tokenName, token) {
token = typeof token !== "undefined" ? token : new Date().getTime();
document.cookie = tokenName + "=" + token + ";" + "-1" + ";path=/";
return token;
}
var downloadTimer;
var attempts = 30;
// Prevents double-submits by waiting for a cookie from the server.
function blockResubmit(button) {
var downloadToken = setToken("downloadToken");
setCursor("wait", button);
// Disable butoon to prevent clicking until download is ready.
button.disable();
button.click(false);
//Show dialog.
confirmDialog(
{
title: get_php_value("prepareDownloadTitle"),
message: get_php_value("prepareDownloadMsg"),
hideCancelButton: true
},
"downloadDialog"
);
downloadTimer = setInterval(function() {
var downloadReady = getCookie("downloadReady");
if (downloadToken == downloadReady || attempts == 0) {
unblockSubmit(button);
}
attempts--;
}, 1000);
}
function unblockSubmit(button) {
setCursor("pointer", button);
button.enable();
button.on("click");
clearInterval(downloadTimer);
$("#confirm_downloadDialog").dialog("close");
expireCookie("downloadToken");
expireCookie("downloadReady");
attempts = 30;
}

View File

@ -170,7 +170,7 @@ class AlertsFiredWidget extends Widget
$this->configurationRequired = false;
if (isset($this->values['groupId']) === false) {
$this->configurationRequired = true;
} else {
} else if ($this->values['groupId'] !== '0') {
$check_exist = \db_get_value(
'id_grupo',
'tgrupo',

View File

@ -375,11 +375,19 @@ class TopNWidget extends Widget
);
}
// Prevent double safe input in agents_get_group_agents function.
$agentRegex = io_safe_output($agentRegex);
// This function check ACL.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);
$agentsIdString = \implode(',', $agentsId);
// Prevent from error when performing IN clause with an empty string.
if ($agentsIdString === '') {
$agentsIdString = 'NULL';
}
// Initialize variables.
$date = \get_system_time();
$datelimit = ($date - $period);

View File

@ -23,4 +23,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
set_js_value('homeurl', $config['homeurl']);
set_js_value('homedir', $config['homedir'].'/');
// Prevent double request message.
set_js_value('prepareDownloadTitle', __('Generating content'));
set_js_value('prepareDownloadMsg', __('Generating content, please wait'));
// ======================================================================

View File

@ -2296,6 +2296,7 @@ class Item extends CachedModel
false
);
$aux_images = $all_images;
foreach ($all_images as $image_file) {
$image_file = substr($image_file, 0, (strlen($image_file) - 4));
@ -2311,9 +2312,13 @@ class Item extends CachedModel
continue;
}
// Check the 4 images.
$array_images = preg_grep('/'.$image_file.'(_ok|_bad|_warning)*\./', $aux_images);
if (count($array_images) >= 4) {
$result[$image_file] = $image_file;
}
}
}
if ($service === true) {
\array_unshift($result, ['name' => __('None')]);

View File

@ -121,7 +121,7 @@ final class BarsGraph extends Item
*
* @return mixed String representing the grid color (not empty) or null.
*/
private function extractGridColor(array $data): string
private static function extractGridColor(array $data): string
{
return static::notEmptyStringOr(
static::issetInArray($data, ['gridColor', 'border_color']),
@ -138,7 +138,7 @@ final class BarsGraph extends Item
* @return string One of 'white', 'black' or 'transparent'.
* 'white' by default.
*/
private function extractBackgroundColor(array $data): string
private static function extractBackgroundColor(array $data): string
{
$backgroundColor = static::notEmptyStringOr(
static::issetInArray($data, ['backgroundColor', 'image']),
@ -163,7 +163,7 @@ final class BarsGraph extends Item
*
* @return string One of 'vertical' or 'horizontal'. 'vertical' by default.
*/
private function extractTypeGraph(array $data): string
private static function extractTypeGraph(array $data): string
{
$typeGraph = static::notEmptyStringOr(
static::issetInArray($data, ['typeGraph', 'type_graph']),

View File

@ -77,7 +77,7 @@ final class EventsHistory extends Item
*
* @return mixed String representing the grid color (not empty) or null.
*/
private function extractLegendColor(array $data): string
private static function extractLegendColor(array $data): string
{
return static::notEmptyStringOr(
static::issetInArray($data, ['legendColor', 'border_color']),

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