Merge remote-tracking branch 'origin/develop' into ent-11711-Comprobar-versiones-de-dependencias-antes-de-actualizar

This commit is contained in:
alejandro.campos@artica.es 2023-12-13 18:48:16 +01:00
commit a72326a006
116 changed files with 2345 additions and 490 deletions

View File

@ -234,6 +234,21 @@ module_description Number of cron task files
module_unit files
module_end
# This module /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Search for ssh string into /var/log/syslog file
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# Plugin example
@ -241,11 +256,6 @@ module_end
module_plugin pandora_df
# This parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_plugin grep_log /var/log/syslog Syslog ssh
# Get disk space free in MB
#module_begin
#module_name disk_root_free
@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh
#module_end
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
# Example of preconditions
@ -303,4 +312,13 @@ module_plugin grep_log /var/log/syslog Syslog ssh
# This plugin runs several security checks in a Linux system
#module_plugin pandora_security_check
#module_plugin pandora_security_check
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -147,22 +147,23 @@ module_max_critical 20
module_end
# Log events
# Get logs from System source.
module_begin
module_name System Events (TermService)
module_type async_string
module_logevent
module_description Log Events coming from Terminal Service
module_type log
module_logevent
module_source System
module_application TermService
module_end
# Get logs from Security source.
module_begin
module_name Security Events (Invalid Login)
module_type async_string
module_description Security log events for invalid login attempt
module_name Security Events
module_description Security log events
module_type log
module_logevent
module_source Security
module_eventcode 529
module_end
# Check if Dhcp service is enabled
@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
# module_description Free space on drive D: (%)
# module_end
# Hardening plugin for security compliance analysis.
# module_begin
# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
# module_absoluteinterval 7d
# module_end
# Sample of Windows inventory module (ONLY ENTERPRISE)!
#module_begin
#module_name Inventory
@ -344,4 +351,13 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
#module_condition (3,8) cmd.exe /c echo range >> c:\log.txt
#module_exec echo 5
#module_description Postcondition test module
#module_end
# Example of collector module
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -2179,16 +2179,7 @@ sub configure ($) {
#Launch tentacle server in proxy mode if configured
if ($Conf{'proxy_mode'}) {
#Check if user is root
if ($> != 0) {
if (launch_tentacle_proxy() != 0) {
return 1;
}
} else {
error ('Proxy mode can not be launched as root');
return 1;
}
return 1 if (launch_tentacle_proxy() != 0);
}
# Add the plugins directory to the PATH

View File

@ -157,12 +157,32 @@ module_exec last | head -1
module_description Last Login
module_end
# Plugin example
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# This parses /var/log/syslog file, under the module name "syslog"
# This module parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Search for ssh string into /var/log/syslog file
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin example
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -372,13 +372,32 @@ module_end
#module_description XGrid
#module_end
#Hardening plugin for security compliance analysis. Enable to use it.
#module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d
#module_end
# This module parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
module_begin
module_name Syslog
module_description Log collection modules
module_type log
module_regexp /var/log/syslog
module_pattern ssh
module_end
# Plugin example
# This parses /var/log/syslog file, under the module name "syslog"
# And search for "ssh" string into it, sending only that information.
#module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin for inventory on the agent.
# module_plugin inventory 1 cpu ram video nic hd cdrom software
# Extraction module example
#module_begin
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.774-231205
Version: 7.0NG.774-231213
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.774-231205"
pandora_version="7.0NG.774-231213"
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

@ -271,11 +271,17 @@ module_plugin pandora_netusage
module_plugin autodiscover --default
# Plugin for inventory on the agent.
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
# Log collection modules. This will collect log files for forensic analysis and store everything
# This is for LOG monitoring. Different than log monitoring.
#module_plugin grep_log_module /var/log/messages Syslog \.\*
module_begin
module_name Syslog
module_description Log collection modules
module_type log
module_regexp /var/log/messages
module_pattern .*
module_end
# Another samples of monitoring modules
@ -317,9 +323,9 @@ module_plugin autodiscover --default
#module_absoluteinterval 7d
#module_end
# Logs extraction
# Extraction module example
#module_begin
#module_name Syslog
#module_name Collector
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '231205';
use constant AGENT_BUILD => '231213';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -4436,14 +4436,7 @@ my $PID = $$;
#Launch tentacle server in proxy mode if configured
if ($Conf{'proxy_mode'}) {
#Check if user is root
if ($> != 0) {
launch_tentacle_proxy();
} else {
log_message ('error', 'Proxy mode can not be launched as root');
exit 1;
}
launch_tentacle_proxy();
}
# Advice if YAML::Tiny is allowed in this system

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231205
%define release 231213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231205
%define release 231213
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231205
%define release 231213
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231205
%define release 231213
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231205
%define release 231213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.774"
PI_BUILD="231205"
PI_BUILD="231213"
OS_NAME=`uname -s`
FORCE=0

View File

@ -179,6 +179,22 @@ module_description Total number of TCP connections active
module_group Networking
module_end
# Get logs from System source.
module_begin
module_name Eventlog_System
module_type log
module_logevent
module_source System
module_end
# Get logs from Security source.
module_begin
module_name Eventlog_Security
module_type log
module_logevent
module_source Security
module_end
# Example plugin to retrieve drive usage
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
#module_type generic_data_string
#module_end
# Get logs from System source. Need enterprise version.
#module_begin
#module_name Eventlog_System
#module_type log
#module_logevent
#module_source System
#module_end
# Get logs from Security source. Need enterprise version.
#module_begin
#module_name Eventlog_Security
#module_type log
#module_logevent
#module_source Security
#module_end
# Get logs from Application source. Need enterprise version.
#module_begin
#module_name Eventlog_Application

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{231205}
{231213}
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.774 Build 231205")
#define PANDORA_VERSION ("7.0NG.774 Build 231213")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.774(Build 231205))"
VALUE "ProductVersion", "(7.0NG.774(Build 231213))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.774-231205
Version: 7.0NG.774-231213
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.774-231205"
pandora_version="7.0NG.774-231213"
package_pear=0
package_pandora=1

View File

@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true
$_SESSION = [];
session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
if ($config['auth'] === 'saml' && empty($public_hash) === true) {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';

View File

@ -34,11 +34,11 @@ if ((bool) $config['metaconsole']) {
include_once $config['homedir'].'/include/functions_modules.php';
include_once $config['homedir'].'/include/functions_users.php';
} else {
include_once '../include/config.php';
include_once '../include/functions_agents.php';
include_once '../include/functions_reporting.php';
include_once '../include/functions_modules.php';
include_once '../include/functions_users.php';
include_once __DIR__.'/../include/config.php';
include_once __DIR__.'/../include/functions_agents.php';
include_once __DIR__.'/../include/functions_reporting.php';
include_once __DIR__.'/../include/functions_modules.php';
include_once __DIR__.'/../include/functions_users.php';
}

View File

@ -31,7 +31,7 @@ function view_logfile($file_name, $toggle=false)
} else {
$file_size = filesize($file_name);
if ($memory_limit < $file_size) {
if ($memory_limit < $file_size && $memory_limit !== '-1') {
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
} else if ($file_size > ($config['max_log_size'] * 1000)) {
@ -117,6 +117,7 @@ function pandoralogs_extension_main()
view_logfile($config['homedir'].'/log/console.log', true);
}
view_logfile('/var/log/php-fpm/www-error.log', true);
view_logfile($logs_directory.'/pandora_server.log', true);
view_logfile($logs_directory.'/pandora_server.error', true);

View File

@ -1,4 +1,4 @@
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6

View File

@ -3,25 +3,31 @@ START TRANSACTION;
ALTER TABLE `tevento`
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
-- Telegram and vonage default alerts
UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=9;
UPDATE talert_actions
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
WHERE id=11;
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""');
prepare stmt from @sqlstmt;
execute stmt;
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""');
prepare stmt from @sqlstmt;
execute stmt;
ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
-- Delete table tagent_access
DROP TABLE tagent_access;
DROP TABLE IF EXISTS tagent_access;
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
ALTER TABLE `tevent_filter`
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
-- Update macros for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
@ -35,11 +41,6 @@ UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
-- Update lts updates
UPDATE tconfig SET value='1' WHERE token='lts_updates';
ALTER TABLE `tdashboard`
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
@ -47,4 +48,10 @@ SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
-- Telegram and vonage default alerts
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9;
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11;
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.vmware';
COMMIT;

View File

@ -35,7 +35,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['last_id']
).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',
@ -455,19 +455,28 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
);
$header_logout .= '</a></div>';
if (enterprise_installed()) {
$subtitle_header = $config['custom_subtitle_header'];
$class_header = '';
} else {
$subtitle_header = __('the Flexible Monitoring System (OpenSource version)');
echo '<div id="dialog_why_enterprise" class="invisible"></div>';
$class_header = 'underline-hover modal_module_list';
}
if (is_reporting_console_node() === true) {
echo '<div class="header_left">';
echo '<div class="header_left '.$class_header.'">';
echo '<span class="header_title">';
echo $config['custom_title_header'];
echo '</span>';
echo '<span class="header_subtitle">';
echo $config['custom_subtitle_header'];
echo $subtitle_header;
echo '</span>';
echo '</div>';
echo '<div class="header_center"></div>';
echo '<div class="header_right">'.$modal_help, $header_user, $header_logout.'</div>';
} else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
echo '<div class="header_left '.$class_header.'"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$subtitle_header.'</span></div>
<div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.'</div>';
}
@ -916,6 +925,46 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$(document).ready (function () {
<?php if (enterprise_installed() === false) { ?>
$('.header_left').on('click', function(){
// Hidden tips modal.
$(".window").css("display", "none");
jQuery.post(
"ajax.php",
{
page: "include/functions_menu",
'why_enterprise': "true"
},
function(data) {
if (data) {
$("#dialog_why_enterprise").html(data);
// Open dialog
$("#dialog_why_enterprise").dialog({
resizable: false,
draggable: false,
modal: true,
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
closeOnEscape: true,
width: 700,
height: 450,
close: function(){
$('#dialog_why_enterprise').html('');
}
});
}
},
"html"
);
});
<?php } ?>
// Check new notifications on a periodic way
setInterval(check_new_notifications, 60000);

View File

@ -1237,11 +1237,24 @@ if ($new_agent === false) {
$actionButtons .= html_print_input_hidden('id_agente', $id_agente);
if (is_management_allowed() === true) {
$clusters = agents_get_agent_belongs_cluster($id_agente);
$cluster_belongs = '';
if (empty($clusters) === false) {
$clusters = array_reduce(
$clusters,
function ($carry, $item) {
$carry[] = $item['name'];
return $carry;
}
);
$cluster_belongs = implode(', ', $clusters);
}
$actionButtons .= html_print_button(
__('Delete agent'),
'deleteAgent',
false,
'deleteAgentDialog('.$id_agente.')',
'deleteAgentDialog('.$id_agente.', "'.$cluster_belongs.'")',
[
'icon' => 'delete',
'mode' => 'secondary dialog_opener',
@ -1289,10 +1302,18 @@ ui_require_jquery_file('bgiframe');
}
}
function deleteAgentDialog($idAgente) {
function deleteAgentDialog($idAgente, cluster) {
var msg_cluster = '';
if(cluster) {
msg_cluster = "<?php echo __('This agent belongs to the clusters'); ?>";
msg_cluster += ': ';
msg_cluster += cluster;
msg_cluster += '. ';
}
confirmDialog({
title: "<?php echo __('Delete agent'); ?>",
message: "<?php echo __('This action is not reversible. Are you sure'); ?>",
message: msg_cluster + "<?php echo __('This action is not reversible. Are you sure'); ?>",
onAccept: function() {
window.location.assign('index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente='+$idAgente);
}

View File

@ -2258,6 +2258,28 @@ if ($update_module || $create_module
|| ($module_in_policy && !$module_linked)
) {
if ($success_action > 0) {
if (empty($old_configuration_data) === true
&& empty($configuration_data) === true && $disabled === '0'
&& ($enable_module || $disable_module)
) {
$modulo_nombre = io_safe_output(
db_get_value(
'nombre',
'tagente_modulo',
'id_agente_modulo',
(empty($disable_module) === false) ? $disable_module : $enable_module
)
);
$old_configuration_data = config_agents_get_module_from_conf(
$id_agente,
$modulo_nombre
);
$configuration_data = $old_configuration_data;
$disabled = (empty($disable_module) === false) ? true : false;
}
enterprise_hook(
'config_agents_write_module_in_conf',
[
@ -2406,7 +2428,6 @@ if ($disable_module) {
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
db_pandora_audit(
AUDIT_LOG_MODULE_MANAGEMENT,
'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']

View File

@ -566,10 +566,10 @@ if ($search != '') {
if ($id != '') {
$aux = $id[0]['id_agent'];
$search_sql = sprintf(
' AND ( nombre LIKE "%%%s%%"
OR alias LIKE "%%%s%%"
OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%")
' AND ( REPLACE(nombre, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(alias, "&#x20;", " ") LIKE "%%%s%%"
OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%")
OR tagente.id_agente = %d',
$search,
$search,
@ -591,10 +591,10 @@ if ($search != '') {
$search_sql .= ')';
} else {
$search_sql = sprintf(
' AND ( nombre
LIKE "%%%s%%" OR alias
LIKE "%%%s%%" OR comentarios LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))',
' AND ( REPLACE(nombre, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(alias, "&#x20;", " ")
LIKE "%%%s%%" OR REPLACE(comentarios, "&#x20;", " ") LIKE "%%%s%%"
OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, "&#x20;", " ") LIKE "%%%s%%"))',
$search,
$search,
$search,
@ -958,12 +958,33 @@ if ($agents !== false) {
);
if ($check_aw === true && is_management_allowed() === true) {
if ($agent['id_os'] != CLUSTER_OS_ID) {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('Are you sure?').'\')) return false;';
} else {
$onClickActionDeleteAgent = 'if (!confirm(\' '.__('WARNING! - You are going to delete a cluster agent. Are you sure?').'\')) return false;';
$clusters = agents_get_agent_belongs_cluster($agent['id_agente']);
$cluster_belongs = '';
if (empty($clusters) === false) {
$clusters = array_reduce(
$clusters,
function ($carry, $item) {
$carry[] = $item['name'];
return $carry;
}
);
$cluster_belongs = implode(', ', $clusters);
}
$msg = '';
if ($agent['id_os'] == CLUSTER_OS_ID) {
$msg .= __('You are going to delete a cluster agent');
$msg .= '. ';
} else if (empty($cluster_belongs) === false) {
$msg .= __('This agent belongs to the clusters');
$msg .= ': ';
$msg .= $cluster_belongs;
$msg .= '. ';
}
$msg .= __('Are you sure?');
$onClickActionDeleteAgent = 'if (!confirm(\' '.$msg.'\')) return false;';
$agentActionButtons[] = html_print_menu_button(
[
'href' => ui_get_full_url(

View File

@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
$search_string_entities = io_safe_input($search_string);
$basic_where = sprintf(
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
"(REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(nombre, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, '&#x20;', ' ') LIKE '%%%s%%') AND",
$search_string,
$search_string_entities,
$search_string,

View File

@ -243,10 +243,15 @@ switch ($action) {
$map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$map_connection_list_temp_string = implode(',', $map_connection_list_temp);
if (strlen($map_connection_list_temp_string) > 0) {
$where_map_connection = ' WHERE id_tmap_connection IN('.$map_connection_list_temp_string.')';
} else {
$where_map_connection = '';
}
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'.$where_map_connection);
foreach ($map_connection_list_temp as $index => $value) {
$cleanValue = trim($value);
@ -256,7 +261,6 @@ switch ($action) {
}
$map_connection_default = get_parameter('map_connection_default');
$map_connection_list = [];
foreach ($listConnectionTemp as $idMapConnection) {
$default = 0;
@ -345,7 +349,7 @@ function deleteConnectionMap(idConnectionMap) {
checked = $("#radiobtn0001", $("#map_connection_" + idConnectionMap)).attr('checked');
$("#map_connection_" + idConnectionMap).remove();
if (checked) {
//Checked first, but not is index = 0 maybe.
@ -485,7 +489,7 @@ foreach ($listConnectionTemp as $connectionTemp) {
$table->data[1][0] = __('Add Map connection').$iconError;
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
<tr>
<td>".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
<td>".html_print_select($listConnection, 'select-map_connection_list', '', '', '', '0', true)."
</td>
<td >
<a href='javascript: addConnectionMap();'>".html_print_image(

View File

@ -154,7 +154,7 @@ if ($is_management_allowed === true && $update_group === true) {
$subcheck = db_get_value('name', 'tmodule_group', 'id_mg', $id_group);
if ($name) {
if (!$check || $subcheck == $name) {
if ($check === false || strcasecmp($subcheck, $name) === 0) {
$result = db_process_sql_update(
'tmodule_group',
['name' => $name],

View File

@ -111,7 +111,8 @@ if ($delete) {
$alerts_agent_modules = [];
foreach ($agent_alerts['simple'] as $agent_alert) {
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
// $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
$alerts_agent_modules[] = $agent_alert['id'];
}
}
@ -126,7 +127,7 @@ if ($delete) {
$agent_module_actions = [];
foreach ($alerts_agent_modules as $alert_agent_module) {
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module['id'], ['id', 'id_alert_action']);
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module, ['id', 'id_alert_action']);
foreach ($agent_module_actions as $agent_module_action) {
foreach ($actions as $action) {

View File

@ -478,8 +478,8 @@ if ($access_console_node === true) {
}
}
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('Pandora RC');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&section=pandorarc']['text'] = __('Pandora RC');
$sub2['godmode/setup/setup&section=pandorarc']['refr'] = 0;
$sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=ITSM']['refr'] = 0;
@ -575,12 +575,13 @@ if ($access_console_node === true) {
continue;
}
$extmenu = [];
if ($extension['godmode_menu']['name'] !== __('DB Schema check') && $extension['godmode_menu']['name'] !== __('DB interface')) {
$extmenu = $extension['godmode_menu'];
}
// Check the ACL for this user.
if ((bool) check_acl($config['id_user'], 0, $extmenu['acl']) === false) {
if ((bool) check_acl($config['id_user'], 0, ($extmenu['acl'] ?? '')) === false) {
continue;
}
@ -732,7 +733,7 @@ if ((bool) $config['pure'] === false) {
echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
if (check_acl($config['id_user'], 0, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {

View File

@ -729,7 +729,7 @@ if ($search_id_group) {
}
if ($search_string != '') {
$filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')';
$filter[] = '(REPLACE(name, "&#x20;", " ") LIKE '."'%".$search_string."%'".' OR REPLACE(REPLACE(description, "&#x20;", " "), "&#x20", " ")LIKE '."'%".$search_string."%'".' OR REPLACE(tcp_send, "&#x20;", " ") LIKE '."'%".$search_string."%'".'OR REPLACE(tcp_rcv, "&#x20;", " ") LIKE '."'%".$search_string."%'".')';
}
$total_components = network_components_get_network_components(

View File

@ -117,6 +117,8 @@ $exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
$exception_condition_value = 10;
$modulegroup = 0;
$period = SECONDS_1DAY;
$period_time_service_level = '28800';
$show_agents = false;
$search = '';
$full_text = 0;
$log_number = 1000;
@ -882,6 +884,28 @@ switch ($action) {
$idAgentModule = $module;
break;
case 'service_level':
$description = $item['description'];
$es = json_decode($item['external_source'], true);
$period_time_service_level = $es['period_time_service_level'];
$show_agents = $es['show_agents'];
// Decode agents and modules.
$id_agents = json_decode(
io_safe_output(base64_decode($es['id_agents'])),
true
);
$module = json_decode(
io_safe_output(base64_decode($es['module'])),
true
);
$recursion = $item['recursion'];
$group = $item['id_group'];
$modulegroup = $item['id_module_group'];
$idAgentModule = $module;
break;
case 'end_of_life':
$es = json_decode($item['external_source'], true);
@ -1146,6 +1170,7 @@ switch ($action) {
case 'sumatory':
case 'database_serialized':
case 'last_value':
case 'service_level':
case 'monitor_report':
case 'min_value':
case 'max_value':
@ -1642,7 +1667,7 @@ if (is_metaconsole() === true) {
10,
false,
false,
true,
false,
'',
false,
false,
@ -1656,6 +1681,53 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_period_service_level" class="datos">
<td class="bolder">
<?php
echo __('Time lapse');
ui_print_help_tip(
__('This is the range, or period of time over which the report renders the information for this report type. For example, a week means data from a week ago from now. ')
);
?>
</td>
<td >
<?php
$fields_time_service_level = [
'604800' => __('1 week'),
'172800' => __('48 hours'),
'86400' => __('24 hours'),
'43200' => __('12 hours'),
'28800' => __('8 hours'),
];
html_print_select(
$fields_time_service_level,
'period_time_service_level',
$period_time_service_level,
);
?>
</td>
</tr>
<tr id="row_show_agents" class="datos">
<td class="bolder" class="datos">
<?php
echo __('Show agents');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'show_agents',
'1',
$show_agents,
false,
false,
);
?>
</td>
</tr>
<tr id="row_period_range" class="datos">
<td class="bolder">
<?php
@ -1676,7 +1748,7 @@ if (is_metaconsole() === true) {
10,
false,
false,
true,
false,
'',
false,
false,
@ -1730,7 +1802,7 @@ if (is_metaconsole() === true) {
10,
false,
false,
true,
false,
'',
false,
false,
@ -1755,7 +1827,7 @@ if (is_metaconsole() === true) {
<td >
<?php
html_print_extended_select_for_time(
'period',
'period3',
(string) $period,
'onselect=loadLogAgents();',
'',
@ -1793,7 +1865,7 @@ if (is_metaconsole() === true) {
10,
false,
false,
true,
false,
'',
false,
false,
@ -2263,7 +2335,7 @@ if (is_metaconsole() === true) {
$modulegroup,
$id_agents,
!$selection_a_m,
false
true
);
}
@ -5862,8 +5934,13 @@ $(document).ready (function () {
switch (type){
case 'agent_module':
case 'agent_module_status':
case 'service_level':
case 'alert_report_actions':
var agents_multiple = $('#id_agents2').val();
if (agents_multiple.length == 0) {
dialog_message('#message_no_agent');
return false;
}
var modules_multiple = $('#module').val();
$('#hidden-id_agents2-multiple-text').val(JSON.stringify(agents_multiple));
$('#hidden-module-multiple-text').val(JSON.stringify(modules_multiple));
@ -5889,6 +5966,7 @@ $(document).ready (function () {
case 'agent_configuration':
case 'module_histogram_graph':
case 'increment':
case 'service_level':
if ($("#hidden-id_agent").val() == 0) {
dialog_message('#message_no_agent');
return false;
@ -6049,8 +6127,13 @@ $(document).ready (function () {
switch (type){
case 'agent_module':
case 'agent_module_status':
case 'service_level':
case 'alert_report_actions':
var agents_multiple = $('#id_agents2').val();
if (agents_multiple.length == 0) {
dialog_message('#message_no_agent');
return false;
}
var modules_multiple = $('#module').val();
$('#hidden-id_agents2-multiple-text').val(JSON.stringify(agents_multiple));
$('#hidden-module-multiple-text').val(JSON.stringify(modules_multiple));
@ -6076,6 +6159,7 @@ $(document).ready (function () {
case 'agent_configuration':
case 'module_histogram_graph':
case 'increment':
case 'service_level':
if ($("#hidden-id_agent").val() == 0) {
dialog_message('#message_no_agent');
return false;
@ -7030,7 +7114,7 @@ function loadLogAgents() {
params["get_agent_source"] = 1;
params["log_alert"] = 1;
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
params["date"] = $('#period_select').val();
params["date"] = $('#period3_select').val();
jQuery.ajax({
data: params,
dataType: "json",
@ -7071,6 +7155,9 @@ function chooseType() {
$("#row_agent").hide();
$("#row_module").hide();
$("#row_search").hide();
$("#row_period").hide();
$("#row_period_service_level").hide();
$("#row_show_agents").hide();
$("#row_log_number").hide();
$("#row_period1").hide();
$("#row_period2").hide();
@ -7767,6 +7854,22 @@ function chooseType() {
}
$("#row_historical_db_check").hide();
break;
case 'service_level':
$("#row_period_service_level").show();
$("#row_show_agents").show();
$("#row_description").show();
$("#row_group").show();
$("#select_agent_modules").show();
$("#agents_modules_row").show();
$("#modules_row").show();
$("#row_historical_db_check").hide();
loadGeneralAgents();
$("#combo_group").change(function() {
loadGeneralAgents($(this).val());
});
$("#row_module_group").show();
break;
case 'agent_module':
$("#row_module_group").show();

View File

@ -1643,7 +1643,7 @@ switch ($action) {
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period'] = get_parameter('period3');
$good_format = true;
break;
@ -1661,7 +1661,7 @@ switch ($action) {
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period'] = get_parameter('period3');
$values['period_range'] = get_parameter('period_range');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
@ -1730,10 +1730,20 @@ switch ($action) {
$good_format = true;
break;
case 'service_level':
$es['period_time_service_level'] = get_parameter('period_time_service_level', '28800');
$es['show_agents'] = get_parameter('show_agents', false);
case 'agent_module':
case 'agent_module_status':
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
if ($agents_to_report_text === '' || $agents_to_report_text === 'null') {
$agents_to_report_text = io_safe_input(json_encode(get_parameter('id_agents2', '')));
}
$modules_to_report_text = get_parameter('module-multiple-text', '');
if ($modules_to_report_text === '' || $modules_to_report_text === 'null') {
$modules_to_report_text = io_safe_input(json_encode(get_parameter('module', '')));
}
// Decode json check modules.
$agents_to_report = json_decode(
@ -1745,11 +1755,16 @@ switch ($action) {
true
);
$es['module'] = get_same_modules_all(
$agents_to_report,
$modules_to_report
);
if ((bool) is_metaconsole() === true) {
$es['module'] = $modules_to_report;
}
// Encode json modules and agents.
$es['module'] = base64_encode(json_encode($es['module']));
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
@ -2755,7 +2770,7 @@ switch ($action) {
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period'] = get_parameter('period3');
$good_format = true;
break;
@ -2773,17 +2788,27 @@ switch ($action) {
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period'] = get_parameter('period3');
$values['period_range'] = get_parameter('period_range');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
$good_format = true;
break;
case 'service_level':
$es['period_time_service_level'] = get_parameter('period_time_service_level', '28800');
$es['show_agents'] = get_parameter('show_agents', false);
case 'agent_module':
case 'agent_module_status':
$agents_to_report_text = get_parameter('id_agents2-multiple-text');
$agents_to_report_text = get_parameter('id_agents2-multiple-text', '');
if ($agents_to_report_text === '' || $agents_to_report_text === 'null') {
$agents_to_report_text = io_safe_input(json_encode(get_parameter('id_agents2', '')));
}
$modules_to_report_text = get_parameter('module-multiple-text', '');
if ($modules_to_report_text === '' || $modules_to_report_text === 'null') {
$modules_to_report_text = io_safe_input(json_encode(get_parameter('module', '')));
}
// Decode json check modules.
$agents_to_report = json_decode(
@ -2800,11 +2825,14 @@ switch ($action) {
$modules_to_report
);
if ((bool) is_metaconsole() === true) {
$es['module'] = $modules_to_report;
}
// Encode json modules and agents.
$es['module'] = base64_encode(json_encode($es['module']));
$es['id_agents'] = base64_encode(json_encode($agents_to_report));
$es['show_type'] = get_parameter('show_type', 0);
$values['external_source'] = json_encode($es);
$good_format = true;
break;

View File

@ -539,6 +539,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
$table->data[($i + 1)][5] .= html_print_input_hidden('rowtype_'.$idLayoutData, $layoutData['type'], true);
// Second row
$table->data[($i + 2)]['icon'] = '';
@ -789,14 +790,6 @@ if ($x > ini_get('max_input_vars')) {
$pure = get_parameter('pure', 0);
if (is_metaconsole() === false) {
echo '<form id="vc_elem_form" method="post" action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'].'">';
html_print_input_hidden('action', 'update');
} else {
echo "<form id='vc_elem_form' method='post' action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=0&tab=list_elements&id_visual_console=".$idVisualConsole."'>";
html_print_input_hidden('action2', 'update');
}
html_print_table($table);
// Form for multiple delete.
@ -806,15 +799,14 @@ if (is_metaconsole() === false) {
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
}
echo '</form>';
$buttons = html_print_submit_button(
__('Update'),
'go',
false,
[
'icon' => 'next',
'form' => 'vc_elem_form',
'icon' => 'next',
'form' => 'vc_elem_form',
'onclick' => 'submit_update_json()',
],
true
);
@ -976,4 +968,76 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
return false;
}
function submit_update_json() {
var array_update = [];
$('input[id^=hidden-updated_]').each(function(){
var id = $(this).attr('id').split('_')[1];
var label = $('#hidden-label_'+id).val();
var image = $('#image_'+id).val();
var width = $('#text-width_'+id).val();
var height = $('#text-height_'+id).val();
var pos_x = $('#text-left_'+id).val();
var pos_y = $('#text-top_'+id).val();
var parent = $('#parent_'+id).val();
var agent = $('#hidden-agent_'+id).val();
var module = $('#module_'+id).val();
var period = $('#hidden-period_'+id).val();
var map_linked = $('#map_linked_'+id).val();
var id_server = $('#id_server_id_'+id).val();
var rowtype = $('rowtype_'+id).val();
var custom_graph = $('#custom_graph_'+id).val();
array_update.push({
'id': id,
'label': label,
'image': image,
'width': width,
'height': height,
'pos_x': pos_x,
'pos_y': pos_y,
'parent': parent,
'agent': agent,
'module': module,
'period': period,
'map_linked': map_linked,
'rowtype': rowtype,
'custom_graph': custom_graph,
'id_server': id_server,
});
});
var background_width = $('#text-width').val();
var background_height = $('#text-height').val();
if (background_height > 0 && background_width > 0){
$.ajax({
type: "POST",
url: "ajax.php",
data: {
page: "godmode/reporting/visual_console_builder",
action: "update_json",
tab: "list_elements",
array_update: JSON.stringify(array_update),
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
background: $('#background').val(),
background_width: $('#text-width').val(),
background_height: $('#text-height').val(),
},
dataType: "json",
complete: function (data) {
location.reload();
}
});
} else {
confirmDialog({
title: "<?php echo __('Error.'); ?>",
message: "<?php echo __('The width and height property is required and should greater than 0'); ?>",
strOKButton: "<?php echo __('Close'); ?>",
hideCancelButton: true,
size: 300,
});
}
}
</script>

View File

@ -78,6 +78,7 @@ $action = get_parameterBetweenListValues(
'update',
'delete',
'multiple_delete',
'update_json',
],
'new'
);
@ -526,6 +527,110 @@ switch ($activeTab) {
}
break;
case 'update_json':
// Update background.
$background = get_parameter('background');
$width = get_parameter('background_width');
$height = get_parameter('background_height');
if ($width == 0 && $height == 0) {
$sizeBackground = getimagesize(
$config['homedir'].'/images/console/background/'.$background
);
$width = $sizeBackground[0];
$height = $sizeBackground[1];
}
db_process_sql_update(
'tlayout',
[
'background' => $background,
'width' => $width,
'height' => $height,
],
['id' => $idVisualConsole]
);
// Return the updated visual console.
$visualConsole = db_get_row_filter(
'tlayout',
['id' => $idVisualConsole]
);
// Update elements in visual map.
$idsElements = db_get_all_rows_filter(
'tlayout_data',
['id_layout' => $idVisualConsole],
[
'id',
'type',
]
);
$array_update = json_decode(io_safe_output(get_parameter('array_update')), true);
if (count($array_update)) {
foreach ($array_update as $row) {
$id = $row['id'];
$values = [];
$values['label'] = $row['label'];
$values['image'] = $row['image'];
$values['width'] = $row['width'];
$values['height'] = $row['height'];
$values['pos_x'] = $row['pos_x'];
$values['pos_y'] = $row['pos_y'];
switch ($row['rowtype']) {
case NETWORK_LINK:
case LINE_ITEM:
continue 2;
break;
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$values['period'] = $row['period'];
break;
case MODULE_GRAPH:
$values['period'] = $row['period'];
unset($values['image']);
break;
case GROUP_ITEM:
$values['id_group'] = $row['group'];
break;
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
case PERCENTILE_BUBBLE:
case PERCENTILE_BAR:
unset($values['height']);
break;
}
if (defined('METACONSOLE')) {
$values['id_metaconsole'] = $row['id_server'];
}
$values['id_agent'] = $row['agent'];
$values['id_agente_modulo'] = $row['module'];
$values['id_custom_graph'] = $row['custom_graph'];
$values['parent_item'] = $row['parent'];
$values['id_layout_linked'] = $row['map_linked'];
if (enterprise_installed()) {
enterprise_visual_map_update_action_from_list_elements($row['rowtype'], $values, $id);
}
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
}
return true;
}
break;
case 'delete':
$id_element = get_parameter('id_element');
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);

View File

@ -184,7 +184,7 @@ $buttons['ITSM'] = [
$buttons['ehorus'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image(
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=pandorarc').'">'.html_print_image(
'images/RC.png',
true,
[
@ -297,7 +297,7 @@ switch ($section) {
$help_header = 'setup_flow_tab';
break;
case 'ehorus':
case 'pandorarc':
$buttons['ehorus']['active'] = true;
$subpage = __('Pandora RC');
$help_header = 'setup_ehorus_tab';
@ -442,7 +442,7 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
break;
case 'ehorus':
case 'pandorarc':
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break;

View File

@ -1113,9 +1113,9 @@ $(document).ready (function () {
id_imodule = $(value).attr('value');
$("select[name='inventory_changes_blacklist[]']")
.append(
$("<option></option>")
$("<option selected='selected'></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
.text(imodule_name)
);
$("#inventory_changes_blacklist_out")
.find("option[value='" + id_imodule + "']").remove();
@ -1141,7 +1141,7 @@ $(document).ready (function () {
.append(
$("<option></option>")
.val(id_imodule)
.html('<i>' + imodule_name + '</i>')
.text(imodule_name)
);
$("#inventory_changes_blacklist")
.find("option[value='" + id_imodule + "']").remove();
@ -1157,12 +1157,15 @@ $(document).ready (function () {
}
}
});
$("#inventory_changes_blacklist > option").each(function(key, value) {
$(value).prop('selected',true).trigger('change');
});
});
$("#submit-update_button").click(function () {
$('#inventory_changes_blacklist option').map(function(){
$(this).prop('selected', true);
});
$("#inventory_changes_blacklist > option").each(function(key, value) {
$(value).prop('selected',true).trigger('change');
});
});
</script>

View File

@ -1422,6 +1422,14 @@ class DiscoveryTaskList extends HTML
$table->rowid = [];
$table->data = [];
$countErrors = 1;
$tableErrors = new StdClasS();
$tableErrors->class = 'databox data';
$tableErrors->width = '75%';
$tableErrors->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;';
$tableErrors->rowid = [];
$tableErrors->data = [];
if ($task['review_mode'] == DISCOVERY_RESULTS) {
$agents_review = db_get_all_rows_filter(
'tdiscovery_tmp_agents',
@ -1476,11 +1484,11 @@ class DiscoveryTaskList extends HTML
$countSummary = 1;
if (is_array($task['stats']) === true && count(array_filter(array_keys($task['stats']), 'is_numeric')) === count($task['stats'])) {
foreach ($task['stats'] as $key => $summary) {
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
$table->data[$i][1] = '';
$countSummary++;
$i++;
if (is_array($summary) === true) {
$table->data[$i][0] = '<b>'.__('Summary').' '.$countSummary.'</b>';
$table->data[$i][1] = '';
$countSummary++;
$i++;
if (empty($summary['summary']) === true && empty($summary['info']) === true) {
$table->data[$i][0] = json_encode($summary, JSON_PRETTY_PRINT);
$table->data[$i][1] = '';
@ -1517,8 +1525,12 @@ class DiscoveryTaskList extends HTML
$i++;
}
} else {
$table->data[$i][0] = $summary;
$table->data[$i][1] = '';
$tableErrors->data[$i][0] = '<b>'.__('Error %s', $countErrors).'</b>';
$tableErrors->data[$i][1] = '';
$i++;
$tableErrors->data[$i][0] = $summary;
$tableErrors->data[$i][1] = '';
$countErrors++;
$i++;
}
}
@ -1560,12 +1572,26 @@ class DiscoveryTaskList extends HTML
$table->data[$i++][1] .= '</span>';
}
} else {
$table->data[$i][0] = $task['stats']['summary'];
$tableErrors->data[$i][0] = '<b>'.__('Error %s', $countErrors).'</b>';
$tableErrors->data[$i][1] = '';
$i++;
$tableErrors->data[$i][0] = $task['stats']['summary'];
$tableErrors->data[$i][1] = '';
$countErrors++;
$i++;
}
}
$output = '<div class="subtitle"><span>'.__('Summary').'</span></div>';
$output .= html_print_table($table, true).'</div>';
if (is_array($table->data) === true && count($table->data) > 0) {
$output .= html_print_table($table, true);
}
if (is_array($tableErrors->data) === true && count($tableErrors->data) > 0) {
$output .= html_print_table($tableErrors, true);
}
$output .= '</div>';
}
return $output;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -652,30 +652,30 @@ if ($get_agent_alerts_datatable === true) {
if (is_metaconsole() === true) {
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
if ($idAgent !== 0) {
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter);
} else {
$id_groups = array_keys(
users_get_groups($config['id_user'], 'AR', false)
);
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, $search_sg);
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, $search_sg);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, $search_sg);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, $search_sg);
}
} else {
if ($idAgent !== 0) {
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter);
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter);
} else {
$id_groups = array_keys(
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, false, $search_sg);
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, false, $tag_filter, $action_filter, false, $search_sg);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false, $search_sg);
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, false, $tag_filter, $action_filter, false, $search_sg);
}
}

View File

@ -756,6 +756,7 @@ if (check_login()) {
$access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
$id_agent = (int) get_parameter('id_agente');
$id_agente = $id_agent;
$id_grupo = agents_get_agent_group($id_agent);
$show_notinit = (bool) get_parameter('show_notinit');
$cluster_list = (int) get_parameter('cluster_list');
$sortField = (string) get_parameter('sort_field');

View File

@ -251,7 +251,7 @@ if ($change_custom_fields_macros_report === true) {
}
if ($get_agents === true) {
$agents_id = str_replace('&quot;', '', $agents_id);
$agents_id = str_replace('&quot;', '"', $agents_id);
try {
$agents_id = json_decode($agents_id, true);

View File

@ -118,7 +118,7 @@ class ConfigPEN extends HTML
if (is_array($filter)) {
if (!empty($filter['free_search'])) {
$sql_filters[] = vsprintf(
' AND (lower(`manufacturer`) like lower("%%%s%%")
' AND (lower(REPLACE(manufacturer, "&#x20;", " ")) like lower("%%%s%%")
OR pen = "%s") ',
array_fill(0, 2, $filter['free_search'])
);

View File

@ -701,6 +701,10 @@ class Diagnostics extends Wizard
{
global $config;
// Get version comment DB.
$sql_version_comment = 'select @@version_comment as version_comment';
$version_comment = db_get_sql($sql_version_comment);
$result = [
'error' => false,
'data' => [
@ -716,6 +720,14 @@ class Diagnostics extends Wizard
'name' => __('DB Schema Build'),
'value' => $config['db_scheme_build'],
],
'dbVersion' => [
'name' => __('Engine version'),
'value' => $config['dbconnection']->server_info,
],
'dbVersionComment' => [
'name' => __('Version comment'),
'value' => $version_comment,
],
],
];

View File

@ -549,8 +549,12 @@ class Heatmap
global $config;
$filter_group = '';
if (empty($this->filter) === false && current($this->filter) != -1) {
if (empty($this->filter) === false && current($this->filter) != -1
&& implode(',', $this->filter) !== ''
) {
$filter_group = 'AND am.id_module_group IN ('.implode(',', $this->filter).')';
} else {
return false;
}
$filter_name = '';

View File

@ -333,6 +333,7 @@ class TreeService extends Tree
$services[$service['id']]['id'] = $service['id'];
$services[$service['id']]['description'] = $service['description'];
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
$services[$service['id']]['title'] = services_get_parents_title((int) $service['id']);
}
return $services;
@ -627,6 +628,7 @@ class TreeService extends Tree
$tmp['type'] = 'services';
$tmp['rootType'] = 'services';
$tmp['children'] = [];
$tmp['servicesChildren'] = services_get_services_children($item->service()->id());
$tmp['serviceDetail'] = ui_get_full_url(
'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.$item->service()->id()
);
@ -731,7 +733,10 @@ class TreeService extends Tree
if (isset($this->filter['searchService']) === true
&& empty($this->filter['searchService']) === false
) {
return " AND (ts.name LIKE '%".$this->filter['searchService']."%' OR ts.description LIKE '%".$this->filter['searchService']."%')";
$whereAncestors = ' AND ts.name LIKE "%'.$this->filter['searchService'].'%"
OR ts.description LIKE "%'.$this->filter['searchService'].'%"';
return $whereAncestors;
}
return '';

View File

@ -606,7 +606,7 @@ class WelcomeWindow extends Wizard
],
[
'arguments' => [
'label' => __("Let's do it!"),
'label' => __('Let&apos;s do it!'),
'type' => 'button',
'attributes' => [
'class' => 'secondary',

View File

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

View File

@ -306,32 +306,48 @@ function format_for_graph(
}
function human_milliseconds_to_string($seconds)
function human_milliseconds_to_string($seconds, $size_text='large')
{
$ret = '';
// get the days
$days = intval(intval($seconds) / (360000 * 24));
if ($days > 0) {
$ret .= "$days days ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$days d").' ';
} else {
$ret .= "$days days ";
}
}
// get the hours
$hours = ((intval($seconds) / 360000) % 24);
if ($hours > 0) {
$ret .= "$hours hours ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$hours h").' ';
} else {
$ret .= "$hours hours ";
}
}
// get the minutes
$minutes = ((intval($seconds) / 6000) % 60);
if ($minutes > 0) {
$ret .= "$minutes minutes ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$minutes m").' ';
} else {
$ret .= "$minutes minutes ";
}
}
// get the seconds
$seconds = ((intval($seconds) / 100) % 60);
if ($seconds > 0) {
$ret .= "$seconds seconds";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$seconds s").' ';
} else {
$ret .= "$seconds seconds ";
}
}
return $ret;

View File

@ -3643,7 +3643,7 @@ function select_modules_for_agent_group(
if (!$selection && $agents != null) {
$number_agents = count($id_agents);
$selection_filter = "HAVING COUNT(id_agente_modulo) = $number_agents";
$selection_filter = "GROUP BY nombre HAVING COUNT(id_agente_modulo) = $number_agents";
}
if (tags_has_user_acl_tags(false)) {
@ -3664,7 +3664,7 @@ function select_modules_for_agent_group(
$sql = "SELECT * FROM
(
SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.nombre
SELECT (tagente_modulo.id_agente_modulo), tagente_modulo.nombre, tagente.alias
FROM tagente_modulo
$sql_tags_inner
INNER JOIN tagente
@ -3679,7 +3679,7 @@ function select_modules_for_agent_group(
$filter_not_string_modules
$sql_conditions_tags
) x
GROUP BY nombre
$selection_filter";
$modules = db_get_all_rows_sql($sql);
@ -4976,13 +4976,38 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent)
}
/**
* agent belongs to the clusters.
*
* @param integer $idAgent
*
* @return array Names clusters.
*/
function agents_get_agent_belongs_cluster(int $idAgent): array
{
$sql = sprintf(
'SELECT tcluster.name
FROM tcluster
INNER JOIN tcluster_agent
ON tcluster.id = tcluster_agent.id_cluster
WHERE tcluster_agent.id_agent = %d',
$idAgent
);
$result = db_get_all_rows_sql($sql);
if ($result === false) {
$result = [];
}
return $result;
}
/**
* Return an array with a list of status agents
*
* @return array.
*/
function agents_status_list()
{
$status_list = [];

View File

@ -10301,8 +10301,7 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
modules_get_type_name($agentModule['id_tipo_modulo']),
$data
);
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$time.'.data', $xml)) {
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$idAgentModule.'.'.$time.'.data', $xml)) {
returnError(sprintf('XML file could not be generated in path: %s', $config['remote_config']));
} else {
echo __('XML file was generated successfully in path: ').$config['remote_config'];

View File

@ -459,17 +459,17 @@ function cron_task_start_gotty(bool $restart_mode=true)
// Check prev process running and kill it (only if port changed in setup params).
if (empty($config['restart_gotty_next_cron_port']) === false) {
config_update_value('restart_gotty_next_cron_port', '');
$prevProcessRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
$prevProcessRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."' | grep -v 'pgrep'");
if (empty($prevProcessRunning) === false) {
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
}
config_update_value('restart_gotty_next_cron_port', '');
}
// Check if gotty is running on the configured port.
$processRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['gotty_port']."'");
$processRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['gotty_port']."' | grep -v 'pgrep'");
$start_proc = true;

View File

@ -194,11 +194,11 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
function custom_graphs_search($id_group, $search)
{
if ($id_group != '' && $search != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (name LIKE "%'.$search.'%" OR description LIKE "'.$search.'")');
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND (REPLACE(name, "&#x20;", " ") LIKE "%'.$search.'%" OR REPLACE(description, "&#x20;", " ") LIKE "'.$search.'")');
} else if ($id_group != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
} else {
$all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%" OR description LIKE "'.$search.'"');
$all_graphs = db_get_all_rows_sql('select * from tgraph where REPLACE(name, "&#x20;", " ") LIKE "%'.$search.'%" OR REPLACE(description, "&#x20;", " ") LIKE "'.$search.'"');
}
if ($all_graphs === false) {

View File

@ -5039,7 +5039,11 @@ function events_page_general($event)
$data[1] = $user_owner;
}
$table_general->cellclass[3][1] = 'general_owner';
if (is_metaconsole() === true && $event['server_name'] !== '') {
$table_general->cellclass[4][1] = 'general_owner';
} else {
$table_general->cellclass[3][1] = 'general_owner';
}
$table_general->data[] = $data;
@ -5099,38 +5103,21 @@ function events_page_general($event)
$table_general->cellclass[count($table_general->data)][1] = 'general_acknowleded';
$data = [];
if (empty($event['server_id']) === false && (int) $event['server_id'] > 0
&& is_metaconsole() === true
) {
$node_connect = new Node($event['server_id']);
$node_connect->connect();
}
$data[0] = __('Acknowledged by');
$data[1] = events_page_general_acknowledged($event['id_evento']);
if ($event['estado'] == 1 || $event['estado'] == 2) {
if (empty($event['id_usuario']) === true) {
$user_ack = __('Autovalidated');
} else {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$event['id_usuario']
);
if (empty($user_ack) === true) {
$user_ack = $event['id_usuario'];
}
}
$data[1] = $user_ack.'&nbsp;(&nbsp;';
if ($event['ack_utimestamp_raw'] !== false
&& $event['ack_utimestamp_raw'] !== 'false'
&& empty($event['ack_utimestamp_raw']) === false
) {
$data[1] .= date(
$config['date_format'],
$event['ack_utimestamp_raw']
);
}
$data[1] .= '&nbsp;)&nbsp;';
} else {
$data[1] = '<i>'.__('N/A').'</i>';
if (empty($event['server_id']) === false && (int) $event['server_id'] > 0
&& is_metaconsole() === true
) {
$node_connect->disconnect();
}
$table_general->cellclass[7][1] = 'general_status';
@ -5237,15 +5224,19 @@ function events_page_general_acknowledged($event_id)
$Acknowledged = '';
$event = db_get_row('tevento', 'id_evento', $event_id);
if ($event !== false && ($event['estado'] == 1 || $event['estado'] == 2)) {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
);
if (empty($event['id_usuario']) === true) {
$user_ack = __('Autovalidated');
} else {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
);
if (empty($user_ack) === true) {
$user_ack = $config['id_user'];
if (empty($user_ack) === true) {
$user_ack = $config['id_user'];
}
}
$Acknowledged = $user_ack.'&nbsp;(&nbsp;';
@ -5260,7 +5251,7 @@ function events_page_general_acknowledged($event_id)
$Acknowledged .= '&nbsp;)&nbsp;';
} else {
$Acknowledged = 'N/A';
$Acknowledged = '<i>'.__('N/A').'</i>';
}
return $Acknowledged;

View File

@ -128,19 +128,18 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$umask = io_safe_output((string) get_parameter('umask'));
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
$parse_sec2_query = explode('=', $parse_all_queries[1]);
$check_extension = true;
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
$check_extension = false;
} else {
$check_extension = true;
}
}
// $parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
// $parse_sec2_query = explode('=', $parse_all_queries[1]);
// $check_extension = true;
// if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
// if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
// $check_extension = false;
// } else {
// $check_extension = true;
// }
// }
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
if (strpos($real_directory, $default_real_directory) !== 0 || $check_extension === false) {
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload
// directory is part of the default path for caller uploader and
// user is not trying to access an external path (avoid
@ -152,12 +151,12 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
// Copy file to directory and change name.
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
try {
$mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) {
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} else {
$error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
$types_allowed = implode(', ', $filterFilesType);
$error_message = 'The uploaded file is not allowed. Only '.$types_allowed.' files can be uploaded.';
throw new Exception(__($error_message));
}
} catch (Exception $ex) {
@ -199,19 +198,29 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$filepath = $_FILES['file']['tmp_name'];
$real_directory = filemanager_safe_directory($destination_directory);
$secure = true;
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
// Security control structure.
$zip = new \ZipArchive;
if ($zip->open($filepath) === true) {
for ($i = 0; $i < $zip->numFiles; $i++) {
$unzip_filename = $zip->getNameIndex($i);
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
if (strtolower($extension) !== 'mib') {
$secure = false;
break;
try {
$ext = strtolower(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION));
if (empty($filterFilesType) === true || in_array($ext, $filterFilesType) === true) {
// Security control structure.
$zip = new \ZipArchive;
if ($zip->open($filepath) === true) {
for ($i = 0; $i < $zip->numFiles; $i++) {
$unzip_filename = $zip->getNameIndex($i);
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
if (in_array(strtolower($extension), $filterFilesType) === false) {
$error_message = 'The uploaded file is not allowed. Only '.$types_allowed.' files can be uploaded.';
$secure = false;
throw new Exception(__($error_message));
}
}
}
}
} catch (Exception $ex) {
db_pandora_audit(
AUDIT_LOG_FILE_MANAGER,
'Error Uploading files: '.$ex->getMessage()
);
$config['filemanager']['message'] = ui_print_error_message(__('Upload error').': '.$ex->getMessage());
}
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {

View File

@ -1585,7 +1585,7 @@ function gis_add_conection_maps_in_form($map_connection_list)
<tr class="row_0">
<td>'.html_print_input_text('map_connection_name_'.$mapConnection['id_conection'], $mapConnectionRowDB['conection_name'], '', 20, 40, true, true).'</td>
<td>'.$radioButton.'</td>
<td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter']).'</a></td>
<td><a id="delete_row" href="javascript: deleteConnectionMap(\''.$mapConnection['id_conection'].'\')">'.html_print_image('images/delete.svg', true, ['alt' => '', 'class' => 'invert_filter main_menu_icon']).'</a></td>
</tr>
</tbody>
<script type="text/javascript">

View File

@ -77,7 +77,7 @@ function inventory_get_data(
}
if ($inventory_search_string != '') {
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
array_push($where, "REPLACE(tagent_module_inventory.data, '&#x20;', ' ') LIKE '%".$inventory_search_string."%'");
}
$offset = (int) get_parameter('offset');
@ -746,7 +746,7 @@ function inventory_get_datatable(
}
if ($inventory_search_string != '') {
array_push($where, "tagent_module_inventory.data LIKE '%".$inventory_search_string."%'");
array_push($where, "REPLACE(tagente_datos_inventory.data, '&#x20;', ' ') LIKE '%".$inventory_search_string."%'");
}
if ($utimestamp > 0) {
@ -786,7 +786,6 @@ function inventory_get_datatable(
}
$rows = db_get_all_rows_sql($sql);
if ($order_by_agent === false) {
$modules = [];
foreach ($rows as $row) {
@ -796,7 +795,13 @@ function inventory_get_datatable(
$data_rows = explode(PHP_EOL, $row['data_inventory']);
foreach ($data_rows as $data_key => $data_value) {
if (empty($data_value) === false) {
if (empty($inventory_search_string) !== true) {
$search_check = strpos(str_replace('&#x20;', ' ', $data_value), $inventory_search_string);
} else {
$search_check = true;
}
if (empty($data_value) === false && $search_check !== false) {
$row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
}
@ -889,7 +894,7 @@ function get_data_basic_info_sql($params, $count=false)
if ($params['search'] > 0) {
$where .= sprintf(
' AND ( alias LIKE "%%%s%%" )',
' AND ( REPLACE(alias, "&#x20;", " ") LIKE "%%%s%%" )',
$params['search']
);
}

View File

@ -581,6 +581,9 @@ function io_output_password($password, $wrappedBy='')
$output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
// If password already decrypt return same password.
$output = (empty($plaintext) === true) ? $password : $plaintext;
return sprintf(
'%s%s%s',
$wrappedBy,

View File

@ -330,7 +330,7 @@ function menu_print_menu(&$menu)
if (isset($sub['type']) && $sub['type'] == 'direct') {
// This is an external link.
$submenu_output .= '<li title="'.$sub['id'].'" id="'.str_replace(' ', '_', $sub['id']).'" class="'.$class.'">';
$submenu_output .= '<li title="'.$sub['text'].'" id="'.str_replace(' ', '_', $sub['id']).'" class="'.$class.'">';
if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') {
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>';
@ -875,6 +875,7 @@ function menu_pepare_acl_select_data($pages, $sec)
if (is_ajax()) {
$about = (bool) get_parameter('about');
$about_operation = (bool) get_parameter('about_operation');
$why_enterprise = (bool) get_parameter('why_enterprise');
if ($about) {
global $config;
global $pandora_version;
@ -1107,10 +1108,10 @@ if (is_ajax()) {
</tr>
<tr class="about-last-tr">
<th style="width: 50%;">
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
<p class="about-last-p"><span>'.$db_info->data->dbVersion->name.'</span></p>
</th>
<th style="width: 50%;">
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbVersion->value.'</p>
</th>
</tr>
@ -1370,4 +1371,50 @@ if (is_ajax()) {
echo $dialog;
}
if ($why_enterprise) {
global $config;
global $pandora_version;
$product_name = io_safe_output(get_product_name());
$lts_name = '';
if (empty($config['lts_name']) === false) {
$lts_name = ' <i>'.$config['lts_name'].'</i>';
}
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms-collapsed.svg', false, false, false);
$url_why_enterprise = 'https://pandorafms.com/en/why-enterprise/';
$lang = users_get_user_by_id($config['id_user'])['language'];
if ($lang === 'es') {
$url_why_enterprise = 'https://pandorafms.com/es/por-que-pandora-fms-enterprise/';
}
$dialog = '
<div id="about-tabs" class="overflow-hidden">
<div id="tab-general-view">
<table class="table-about">
<tbody>
<tr>
<th style="width: 40%; border: 0px;">
<a href="https://pandorafms.com/" target="_blank">
<img src="'.$image_about.'" alt="logo" width="50%">
</a>
</th>
<th style="width: 60%; text-align: left; border: 0px;">
<h1>'.$product_name.'</h1>
<p><span>'.__('Version').' '.$pandora_version.$lts_name.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
<p>'.__('You are using the free, OpenSource version of Pandora FMS.').'</p>
<p>'.__('This version has no official support or warranty, you can purchase the Enterprise version, which offers support, warranty and additional features to the Opensource version.').'</p>
<p><span><a href="'.$url_why_enterprise.'">'.__('Click on this link for more information.').'</a></span></p>
</th>
</tr>
</tbody>
</table>
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' <a href="https://pandorafms.com/" target="_blank">Pandora FMS</a>. All rights reserved</p>
</div>
</div>
';
echo $dialog;
}
}

View File

@ -2624,12 +2624,26 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
break;
}
break;
@ -2648,12 +2662,26 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$salida = remove_right_zeros(
number_format(
$module['datos'],
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
break;
}
}
@ -2935,7 +2963,14 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
}
if (is_numeric($data)) {
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
$title .= ': '.remove_right_zeros(
number_format(
$data,
$config['graph_precision'],
$config['decimal_separator'],
($config['thousand_separator'] ?? null)
)
);
} else {
$text = io_safe_output($data);
@ -3766,7 +3801,7 @@ function get_modules_agents(
$return = array_reduce(
$modules[$tserver],
function ($carry, $item) use ($tserver, $nodes) {
function ($carry, $item) use ($tserver, $nodes, $selection) {
$t = [];
foreach ($item as $k => $v) {
$t[$k] = $v;
@ -3774,9 +3809,15 @@ function get_modules_agents(
$t['id_node'] = $tserver;
if ($nodes[$tserver] !== null) {
$t['nombre'] = io_safe_output(
$nodes[$tserver]->server_name().' &raquo; '.$t['nombre']
);
if (isset($t['alias']) === true && (bool) $selection === true) {
$t['nombre'] = io_safe_output(
$nodes[$tserver]->server_name().' &raquo; '.$t['alias'].' &raquo; '.$t['nombre']
);
} else {
$t['nombre'] = io_safe_output(
$nodes[$tserver]->server_name().' &raquo; '.$t['nombre']
);
}
}
$carry[] = $t;
@ -3810,9 +3851,23 @@ function get_modules_agents(
$selection,
false,
$useName,
false,
true,
$notStringModules
);
$modules = array_reduce(
$modules,
function ($carry, $item) use ($id_agents, $selection) {
if (count($id_agents) > 1 && (bool) $selection === true) {
$carry[$item['id_agente_modulo']] = $item['alias'].' &raquo; '.$item['nombre'];
} else {
$carry[$item['id_agente_modulo']] = $item['nombre'];
}
return $carry;
},
[]
);
}
return $modules;
@ -4770,7 +4825,231 @@ function export_agents_module_csv($filters)
/**
* Check if modules are compatible with MADE server.
* Function to return Mean Time Between Failure, Mean Time To Solution (in seconds)
* and Availability of a module
*
* @param string $datetime_from Start time of the interval.
*
* @param string $datetime_to End time of the interval.
*
* @param string $id_agentmodule id_agentmodule of the module
*
* @return array Returns an array with the data
*/
function service_level_module_data($datetime_from, $datetime_to, $id_agentmodule)
{
$data = [];
$data['mtbf'] = false;
$data['mtrs'] = false;
$data['availability'] = false;
$data['critical_events'] = false;
$data['warning_events'] = false;
$data['last_status_change'] = false;
$data['module_name'] = false;
$availability = 0;
$type = '';
if ((bool) is_metaconsole() === true) {
if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
$server_id = [];
$server_id['id'] = explode('|', $id_agentmodule)[0];
$id_agentmodule = explode('|', $id_agentmodule)[1];
$server_name = db_get_row_filter('tmetaconsole_setup', $server_id, 'server_name');
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) !== NOERR) {
// Restore db connection.
metaconsole_restore_db();
return $data;
}
}
}
$uncompressed_data = db_uncompress_module_data(
$id_agentmodule,
$datetime_from,
$datetime_to
);
$first_utimestamp = 0;
foreach ($uncompressed_data as $data_module) {
foreach ($data_module['data'] as $subdata) {
if (!empty($subdata['datos'])) {
$first_utimestamp = $subdata['utimestamp'];
if (isset($subdata['type'])) {
$type = $subdata['type'];
}
break;
}
}
}
$interval_time = ($datetime_to - $datetime_from);
$current_time = time();
$sql = 'SELECT utimestamp, event_type FROM tevento
WHERE id_agentmodule = '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
ORDER BY utimestamp DESC';
$events_time = db_get_all_rows_sql($sql);
// Count events.
$sql = 'SELECT COUNT(*) as critical_events FROM tevento
WHERE id_agentmodule= '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
AND (event_type = "going_up_critical" OR event_type = "going_down_critical")';
$critical_events = db_get_sql($sql);
$sql = 'SELECT COUNT(*) as warning_events FROM tevento
WHERE id_agentmodule= '.$id_agentmodule.'
AND utimestamp >= '.$datetime_from.'
AND utimestamp <= '.$datetime_to.'
AND (event_type = "going_up_warning" OR event_type = "going_down_warning")';
$warning_events = db_get_sql($sql);
if ($events_time !== false && count($events_time) > 0) {
$failed_event = [];
$normal_event = [];
$events_time = array_reverse($events_time);
$mtrs_events = [];
foreach ($events_time as $key => $event) {
if ($event['event_type'] === 'going_up_critical' || $event['event_type'] === 'going_down_critical') {
$failed_event[] = $event['utimestamp'];
$mtrs_events[]['failed_event'] = $event['utimestamp'];
}
if ($event['event_type'] === 'going_up_normal'
|| $event['event_type'] === 'going_down_normal'
|| $event['event_type'] === 'going_up_warning'
|| $event['event_type'] === 'going_down_warning'
) {
$normal_event[] = $event['utimestamp'];
$mtrs_events[]['normal_event'] = $event['utimestamp'];
}
}
$process_mtrs_events = [];
if (empty($mtrs_events) === false) {
$last_event_key = '';
foreach ($mtrs_events as $key => $val) {
if (key($val) !== $last_event_key) {
$last_event_key = key($val);
$process_mtrs_events[] = $val;
}
}
}
$mtrs_array = [];
if (empty($normal_event) === true) {
$mtrs_array[] = ($current_time - $failed_event[0]);
} else if (empty($failed_event) === true) {
$mtrs_array[] = 0;
} else {
$last_value = '';
foreach ($process_mtrs_events as $key => $val) {
$current_value = $val[key($val)];
if ($last_value !== '') {
$mtrs_array[] = ($current_value - $last_value);
}
$last_value = $current_value;
}
$last_mtrs_event = key(end($process_mtrs_events));
if ($last_mtrs_event === 'failed_event') {
$mtrs_array[] = ($current_time - $last_value);
}
}
$mtbf_array = [];
if (!empty($failed_event) === true) {
if (count($failed_event) > 1) {
for ($i = 1; $i <= array_key_last($failed_event); $i++) {
$mtbf_array[] = ($failed_event[$i] - ($failed_event[($i - 1)]));
}
} else {
$mtbf_array[] = 0;
}
} else {
$mtbf_array[] = 0;
}
$total_time_failed = array_sum($mtrs_array);
$total_time_ok = ($interval_time - $total_time_failed);
if (count($events_time) === 1) {
if ((int) $first_utimestamp !== 0) {
$availability = round((($total_time_ok / $interval_time) * 100), 2);
}
} else {
$availability = round((($total_time_ok / $interval_time) * 100), 2);
}
if ($critical_events > 1) {
$mtbf = round(array_sum($mtbf_array) / count($mtbf_array));
} else {
$mtbf = false;
}
if (count($mtrs_array) === 1 && (int) $first_utimestamp !== 0) {
$mtrs = round($total_time_failed / count($mtrs_array));
} else if (count($mtrs_array) > 1 && (int) $first_utimestamp !== 0) {
$mtrs = round((array_sum($mtrs_array) / count($mtrs_array)));
} else {
$mtrs = false;
}
$data['mtbf'] = $mtbf;
$data['mtrs'] = $mtrs;
$data['availability'] = $availability;
} else {
$data['mtbf'] = false;
$data['mtrs'] = false;
$data['availability'] = false;
}
// Get last status change.
$sql = 'SELECT last_status_change FROM tagente_estado
WHERE id_agente_modulo = '.$id_agentmodule.' ';
$last_status_change = db_get_sql($sql);
// Get module name.
/*
$sql = 'SELECT nombre FROM tagente_modulo
WHERE id_agente_modulo = '.$id_agentmodule;*/
$sql = 'SELECT tagente_modulo.nombre as nombre, tagente.alias as alias
FROM tagente_modulo INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
WHERE id_agente_modulo = '.$id_agentmodule.' ';
$sql_query = db_get_all_rows_sql($sql);
$data['critical_events'] = $critical_events;
$data['warning_events'] = $warning_events;
$data['last_status_change'] = $last_status_change;
$data['module_name'] = $sql_query[0]['nombre'];
if ((bool) is_metaconsole() === true) {
$data['agent_alias'] = $server_name['server_name'].' » '.$sql_query[0]['alias'];
} else {
$data['agent_alias'] = $sql_query[0]['alias'];
}
if ((bool) is_metaconsole() === true) {
metaconsole_restore_db();
}
return $data;
}
/*
Check if modules are compatible with MADE server.
*
* @param integer $id_tipo_modulo
* @retur boolean True if compatible, false otherwise.

View File

@ -804,6 +804,13 @@ function reporting_make_reporting_data(
);
break;
case 'service_level':
$report['contents'][] = reporting_service_level_detail(
$report,
$content
);
break;
case 'end_of_life':
$report['contents'][] = reporting_end_of_life(
$report,
@ -3707,6 +3714,60 @@ function reporting_agent_module_status($report, $content)
}
/**
* Service level detail
*
* @param array $report Info Report.
* @param array $content Info content.
*
* @return array
*/
function reporting_service_level_detail($report, $content)
{
global $config;
$return['type'] = 'service_level';
$module_data = [];
$interval_range = [];
$service_level_data = [];
$current_timestamp = time();
$return['title'] = io_safe_output($content['name']);
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['description'] = io_safe_output($content['description']);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$es = json_decode($content['external_source'], true);
$return['date'] = [];
$return['date']['date'] = false;
$return['date']['period'] = $es['period_time_service_level'];
$return['show_agents'] = $es['show_agents'];
$modules = json_decode(base64_decode($es['module']), true);
$agents = json_decode(base64_decode($es['id_agents']), true);
$interval_range['start'] = ($current_timestamp - $es['period_time_service_level']);
$interval_range['end'] = $current_timestamp;
foreach ($modules as $module) {
$service_level_data = service_level_module_data($interval_range['start'], $interval_range['end'], $module);
$module_data[$module] = [];
$module_data[$module]['mtrs'] = ($service_level_data['mtrs'] !== false) ? human_milliseconds_to_string(($service_level_data['mtrs'] * 100), 'short') : '-';
$module_data[$module]['mtbf'] = ($service_level_data['mtbf'] !== false) ? human_milliseconds_to_string(($service_level_data['mtbf'] * 100), 'short') : '-';
$module_data[$module]['availability'] = ($service_level_data['availability'] !== false) ? $service_level_data['availability'] : '100';
$module_data[$module]['warning_events'] = ($service_level_data['warning_events'] !== false) ? $service_level_data['warning_events'] : '0';
$module_data[$module]['critical_events'] = ($service_level_data['critical_events'] !== false) ? $service_level_data['critical_events'] : '0';
$module_data[$module]['last_status_change'] = ($service_level_data['last_status_change'] !== false) ? $service_level_data['last_status_change'] : '';
$module_data[$module]['module_name'] = ($service_level_data['module_name'] !== false) ? $service_level_data['module_name'] : '';
$module_data[$module]['agent_alias'] = ($service_level_data['agent_alias'] !== false) ? $service_level_data['agent_alias'] : '';
}
$return['data'] = $module_data;
return reporting_check_structure_content($return);
}
/**
* OS Version End of Life
*

View File

@ -260,7 +260,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
}
$table->colspan['description_row']['description'] = 3;
switch ($item['type']) {
case 'availability':
default:
@ -403,6 +402,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
reporting_html_agent_module_status($table, $item);
break;
case 'service_level':
reporting_html_service_level($table, $item);
break;
case 'end_of_life':
reporting_html_end_of_life($table, $item);
break;
@ -1275,7 +1278,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table3->headstyle[5] = 'text-align: right';
foreach ($item['data'] as $sla) {
if (isset($sla) === true) {
if (isset($sla) === true && empty($sla['agent']) === false) {
// First_table.
$row = [];
$row[] = $sla['agent'];
@ -3080,6 +3083,85 @@ function reporting_html_agent_module_status($table, $item, $pdf=0)
}
function reporting_html_service_level($table, $item, $pdf=0)
{
global $config;
$return_pdf = '';
if (empty($item['data']) === true) {
if ($pdf !== 0) {
$return_pdf .= __('No items');
} else {
$table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
$table->data['group_report']['cell'] = __('No items');
}
} else {
$table_info = new stdClass();
$table_info->width = '99%';
if ($item['show_agents'] === '1') {
$show_agents = 'on';
} else {
$show_agents = 'off';
}
if ($show_agents === 'on') {
$table_info->head[0] = __('Agent / Module');
} else {
$table_info->head[0] = __('Module');
}
$table_info->head[1] = __('% Av.');
$table_info->head[2] = __('MTBF');
$table_info->head[3] = __('MTRS');
$table_info->head[4] = __('Crit. Events').ui_print_help_tip(__('Counted only critical events generated automatic by the module'), true);
$table_info->head[5] = __('Warn. Events').ui_print_help_tip(__('Counted only warning events generated automatic by the module'), true);
$table_info->head[6] = __('Last change');
$table_info->data = [];
$table_info->cellstyle = [];
$row = 0;
foreach ($item['data'] as $agentmodule_id => $module_data) {
if ($show_agents === 'on') {
$table_info->data[$row][0] = $module_data['agent_alias'].' / '.$module_data['module_name'];
$table_info->cellstyle[$row][0] = 'text-align:left; padding-left: 30px;';
} else {
$table_info->data[$row][0] = $module_data['module_name'];
$table_info->cellstyle[$row][0] = 'text-align:left; padding-left: 30px;';
}
$table_info->data[$row][1] = $module_data['availability'].'%';
$table_info->data[$row][2] = $module_data['mtbf'];
$table_info->data[$row][3] = $module_data['mtrs'];
$table_info->data[$row][4] = $module_data['critical_events'];
$table_info->data[$row][5] = $module_data['warning_events'];
if ($module_data['last_status_change'] !== '') {
$table_info->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
}
// $table_info->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
$row++;
}
if ($pdf !== 0) {
$table_info->title = $item['title'];
$table_info->titleclass = 'title_table_pdf';
$table_info->titlestyle = 'text-align:left;';
$return_pdf .= html_print_table($table_info, true);
} else {
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: center;';
$table->data['data']['cell'] = html_print_table($table_info, true);
}
}
if ($pdf !== 0) {
return $return_pdf;
}
}
/**
* Html report end of life.
*
@ -4952,7 +5034,7 @@ function reporting_html_value(
$table2->head = [
__('Agent'),
__('Module'),
__('Minimun'),
__('Minimum'),
];
break;
@ -5023,7 +5105,7 @@ function reporting_html_value(
case 'min_value':
$table1->head = [
__('Lapse'),
__('Minimun'),
__('Minimum'),
];
break;

View File

@ -777,6 +777,10 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Modules'),
'name' => __('Last value'),
];
$types['service_level'] = [
'optgroup' => __('Modules'),
'name' => __('Service Level Detailed'),
];
$types['general'] = [
'optgroup' => __('Grouped'),

View File

@ -1549,14 +1549,41 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
title: "Minimize"
}).insertBefore(closeButton);
// Add the minimize icon to the minimize button
$("<span>", {
class: "ui-button-icon ui-icon",
style:
"background-color: rgb(51, 51, 51); -webkit-mask: url('images/arrow-down-white.png') no-repeat / contain !important;"
}).appendTo(minimizeButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(minimizeButton);
// Add the disengage button before the minimize button
var disengageButton = $("<button>", {
class:
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage disengage-buttom-image",
type: "button",
title: "Disengage"
title: "Disengage",
style: "float: right; position:relative;"
}).insertBefore(minimizeButton);
// Add the disengage icon to the disengage button
$("<span>", {
class: "ui-button-icon ui-icon",
style:
"background-color: rgb(51, 51, 51); -webkit-mask: url('images/dashboard.menu.png') no-repeat center / contain !important;"
}).appendTo(disengageButton);
$("<span>", {
class: "ui-button-icon-space"
})
.html(" ")
.appendTo(disengageButton);
minimizeButton.click(function(e) {
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");

View File

@ -808,8 +808,8 @@ function loadVisualConsoleData(
getVisualConsoleItems: 1,
size: size,
visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null,
id_user: typeof id_user !== undefined ? id_user : null,
auth_hash: typeof hash !== undefined ? hash : null,
mode: mode,
widthScreen: widthScreen
},

View File

@ -1486,6 +1486,11 @@ var TreeController = {
return 0;
});
//Search service criterion
const searchFilter = controller.filter.searchService;
if (searchFilter && controller.finded !== 1) {
rawTree = _filterItems(rawTree, searchFilter);
}
_.each(rawTree, function(element) {
element.jqObject = _processNode($group, element);
});
@ -1551,6 +1556,67 @@ var TreeController = {
// Add again the hover event to the 'force_callback' elements
forced_title_callback();
/**
* Filter the tree based on a search criterion
*/
function _filterItems(rawTree, searched) {
const ancestors = [];
const father = [];
const newTree = [];
const tmpTree = [];
rawTree.map((raw, index) => {
if (raw.type === "services") {
if (raw.servicesChildren.length !== 0) {
// search at parent level
let descr = raw.description.toLowerCase();
let sear = searched.toLowerCase();
let findedPadre = descr.indexOf(sear);
if (findedPadre === -1) {
father.push(raw.id);
} else if (findedPadre >= 0) {
ancestors.push(raw.id);
} else {
//we mark the father as found
controller.finded = 1;
}
} else {
let finded = raw.description.indexOf(searched);
if (finded === -1) {
delete rawTree[index];
}
}
}
});
if (ancestors.length >= 1) {
ancestors.map(ancestor => {
newTree.push(
rawTree.filter(item => item.id === parseInt(ancestor))
);
});
return newTree[0];
}
if (father.length >= 1) {
let filterfather = [...new Set(father)];
filterfather.map(father => {
tmpTree.push(rawTree.filter(raw => raw.id == father));
});
let tree = [...new Set(tmpTree)];
tree.map(item => {
let tmpItem = item[0];
newTree.push(tmpItem);
});
return newTree;
}
return rawTree.filter(item => item);
}
},
load: function() {
this.reload();

View File

@ -213,6 +213,10 @@ class Cluster extends Entity
public function getCounters() :array
{
$id_agent_modules = $this->getIdsModulesInvolved();
if (empty($id_agent_modules) === true) {
return [];
}
$sql = sprintf(
'SELECT SUM( IF(estado = 1, 1, 0) ) AS critical,
SUM( IF(estado = 2, 1, 0) ) AS warning,

View File

@ -466,6 +466,10 @@ class Widget
$className .= '\HeatmapWidget';
break;
case 'service_level':
$className .= '\ServiceLevelWidget';
break;
case 'security_hardening':
if (\enterprise_installed() === false) {
$not_installed = true;

View File

@ -320,6 +320,10 @@ class HeatmapWidget extends Widget
$module_groups[$module_group['id_mg']] = $module_group['name'];
}
if (empty($values['module_groups'][0]) === true) {
$values['module_groups'][0] = 0;
}
$inputs[] = [
'label' => __('Module group'),
'style' => ($values['type'] === '2') ? '' : 'display:none',
@ -332,7 +336,7 @@ class HeatmapWidget extends Widget
'return' => true,
'multiple' => true,
'nothing' => __('Not assigned'),
'nothing_value' => 0,
'nothing_value' => '0',
],
];

View File

@ -0,0 +1,672 @@
<?php
/**
* Widget Service Level Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Service Level
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Agent;
use PandoraFMS\Module;
/**
* Service Level Widgets
*/
class ServiceLevelWidget extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/include/functions_modules.php';
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Service Level Detail');
// Name.
if (empty($this->name) === true) {
$this->name = 'service_level';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (isset($this->values['mModules']) === false) {
$this->configurationRequired = true;
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['interval']) === true) {
$values['interval'] = $decoder['interval'];
} else {
$values['interval'] = '28800';
}
if (isset($decoder['show_agents']) === true) {
$values['show_agents'] = $decoder['show_agents'];
} else {
$values['show_agents'] = '0';
}
if (isset($decoder['mTypeShow']) === true) {
$values['mTypeShow'] = $decoder['mTypeShow'];
}
if (isset($decoder['mGroup']) === true) {
$values['mGroup'] = $decoder['mGroup'];
}
if (isset($decoder['mRecursion']) === true) {
$values['mRecursion'] = $decoder['mRecursion'];
}
if (isset($decoder['mModuleGroup']) === true) {
$values['mModuleGroup'] = $decoder['mModuleGroup'];
}
if (isset($decoder['mAgents']) === true) {
$values['mAgents'] = $decoder['mAgents'];
}
if (isset($decoder['mShowCommonModules']) === true) {
$values['mShowCommonModules'] = $decoder['mShowCommonModules'];
}
if (isset($decoder['mModules']) === true) {
$values['mModules'] = $decoder['mModules'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
$values = $this->values;
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Interval.
$fields = [
'604800' => __('1 week'),
'172800' => __('48 hours'),
'86400' => __('24 hours'),
'43200' => __('12 hours'),
'28800' => __('8 hours'),
];
$inputs[] = [
'label' => __('Interval'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'interval-'.$this->cellId,
'selected' => $values['interval'],
'return' => true,
],
];
// Show agent.
$inputs[] = [
'label' => __('Show agents'),
'arguments' => [
'type' => 'switch',
'name' => 'show_agents-'.$this->cellId,
'value' => $values['show_agents'],
'return' => true,
],
];
$return_all_group = false;
if (users_can_manage_group_all('RM') || $this->values['mGroup'] == 0) {
$return_all_group = true;
}
$mgroup = '';
if (isset($this->values['mGroup']) === false) {
$sql = sprintf(
'SELECT id_group FROM tdashboard WHERE id = %d',
$this->dashboardId
);
$group_dahsboard = db_get_value_sql($sql);
if ($group_dahsboard > 0) {
$mgroup = $group_dahsboard;
}
}
if (is_metaconsole() === true) {
$this->values['mAgents'] = $this->getIdCacheAgent($this->values['mAgents']);
}
$inputs[] = [
'class' => 'flex flex-row',
'id' => 'select_multiple_modules_filtered',
'arguments' => [
'type' => 'select_multiple_modules_filtered',
'uniqId' => $this->cellId,
'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : $mgroup,
'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '',
'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '',
'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '',
'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '',
'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '',
'mShowSelectedOtherGroups' => true,
'mReturnAllGroup' => $return_all_group,
'mMetaFields' => ((bool) is_metaconsole()),
'commonModulesSwitch' => true,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['interval'] = \get_parameter('interval-'.$this->cellId, '28800');
$values['show_agents'] = \get_parameter('show_agents-'.$this->cellId, '0');
$values['mTypeShow'] = \get_parameter(
'filtered-type-show-'.$this->cellId
);
$values['mGroup'] = \get_parameter(
'filtered-module-group-'.$this->cellId
);
$values['mRecursion'] = \get_parameter_switch(
'filtered-module-recursion-'.$this->cellId
);
$values['mModuleGroup'] = \get_parameter(
'filtered-module-module-group-'.$this->cellId
);
$values['mAgents'] = \get_parameter(
'filtered-module-agents-'.$this->cellId
);
if (is_metaconsole() === true) {
$values['mAgents'] = $this->getRealIdAgentNode($values['mAgents']);
}
$values['mShowCommonModules'] = \get_parameter(
'filtered-module-show-common-modules-'.$this->cellId
);
$values['mModules'] = explode(
',',
\get_parameter(
'filtered-module-modules-'.$this->cellId
)
);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">';
$output .= ui_print_error_message(
__('You don\'t have access'),
'',
true
);
$output .= '</div>';
return $output;
}
$interval_range = [];
$current_timestamp = time();
$interval_range['start'] = ($current_timestamp - $this->values['interval']);
$interval_range['end'] = $current_timestamp;
$reduceAllModules = array_reduce(
$this->values['mModules'],
function ($carry, $item) {
if ($item === null) {
return $carry;
}
if (is_metaconsole() === true) {
$item = explode('|', $item);
$serverId = $item[0];
$fullname = $item[1];
if ($this->values['mShowCommonModules'] !== 'on') {
$item = explode('&#x20;&raquo;&#x20;', $fullname);
$name = $item[1];
$carry['modules_selected'][$serverId][$name] = null;
$carry['modules'][$name] = null;
} else {
$carry['modules'][$fullname] = null;
}
} else {
$carry['modules'][$item] = null;
}
return $carry;
}
);
$allModules = $reduceAllModules['modules'];
$visualData = [];
// Extract info agents selected.
$target_agents = explode(',', $this->values['mAgents']);
foreach ($target_agents as $agent_id) {
try {
if (is_metaconsole() === true && str_contains($agent_id, '|') === true) {
$server_agent = explode('|', $agent_id);
} else {
$id_agente = $agent_id;
}
if ((bool) is_metaconsole() === true) {
if (isset($server_agent) === true) {
$id_agente = $server_agent[1];
$tserver = $server_agent[0];
} else {
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
[ 'id_agente' => $id_agente ]
);
$id_agente = $tmeta_agent['id_tagente'];
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
}
if (metaconsole_connect(null, $tserver) !== NOERR) {
continue;
}
}
$agent = new Agent((int) $id_agente);
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
$visualData[$agent_id]['agent_name'] = $agent->name();
$visualData[$agent_id]['agent_alias'] = $agent->alias();
$visualData[$agent_id]['modules'] = [];
if (empty($allModules) === false) {
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
$modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
);
} else {
$modules = null;
}
} else {
$modules = $agent->searchModules(
['nombre' => array_keys($allModules)]
);
}
}
$visualData[$agent_id]['modules'] = $allModules;
if ((bool) is_metaconsole() === true) {
metaconsole_restore_db();
}
foreach ($modules as $module) {
if ($module === null) {
continue;
}
$data_module_array = $module->toArray();
$visualData[$agent_id]['modules'][$module->name()] = [];
$last_status = $module->getStatus()->toArray();
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = $last_status['last_status_change'];
// Mean Time Between Failure.
// Mean Time To Solution.
// Availability.
if ((bool) is_metaconsole() === true) {
$module_id = $tserver.'|'.$data_module_array['id_agente_modulo'];
} else {
$module_id = $data_module_array['id_agente_modulo'];
}
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $module_id);
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = ($module_data['mtrs'] !== false) ? human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short') : '-';
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = ($module_data['mtbf'] !== false) ? human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short') : '-';
$visualData[$agent_id]['modules'][$module->name()]['availability'] = ($module_data['availability'] !== false) ? $module_data['availability'] : '100';
$visualData[$agent_id]['modules'][$module->name()]['critical_events'] = ($module_data['critical_events'] !== false) ? $module_data['critical_events'] : '';
$visualData[$agent_id]['modules'][$module->name()]['warning_events'] = ($module_data['warning_events'] !== false) ? $module_data['warning_events'] : '';
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = ($module_data['last_status_change'] !== false) ? $module_data['last_status_change'] : '';
$visualData[$agent_id]['modules'][$module->name()]['agent_alias'] = ($module_data['agent_alias'] !== false) ? $module_data['agent_alias'] : '';
$visualData[$agent_id]['modules'][$module->name()]['module_name'] = ($module_data['module_name'] !== false) ? $module_data['module_name'] : '';
}
} catch (\Exception $e) {
echo 'Error: ['.$agent_id.']'.$e->getMessage();
}
}
$table = new \stdClass();
$table->width = '100%';
$table->class = 'databox filters filter-table-adv';
$table->head = [];
$show_agents = $this->values['show_agents'];
if ($show_agents === 'on') {
$table->head[0] = __('Agent / Modules');
} else {
$table->head[0] = __('Modules');
}
$table->head[1] = __('% Av.');
$table->head[2] = __('MTBF');
$table->head[3] = __('MTRS');
$table->head[4] = __('Crit. Events').ui_print_help_tip(__('Counted only critical events generated automatic by the module'), true);
$table->head[5] = __('Warn. Events').ui_print_help_tip(__('Counted only warning events generated automatic by the module'), true);
$table->head[6] = __('Last change');
$table->data = [];
$table->cellstyle = [];
$row = 0;
foreach ($visualData as $agent_id => $data) {
foreach ($data['modules'] as $module_name => $module_data) {
if (isset($module_data) === true) {
if ($show_agents === 'on') {
$table->data[$row][0] = $module_data['agent_alias'].' / '.$module_data['module_name'];
$table->cellstyle[$row][0] = 'text-align:left';
} else {
$table->data[$row][0] = $module_data['module_name'];
$table->cellstyle[$row][0] = 'text-align:left';
}
$table->data[$row][1] = $module_data['availability'].'%';
$table->data[$row][2] = $module_data['mtbf'];
$table->data[$row][3] = $module_data['mtrs'];
$table->data[$row][4] = $module_data['critical_events'];
$table->data[$row][5] = $module_data['warning_events'];
$table->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
}
$row++;
}
}
$height = (count($table->data) * 32);
$style = 'min-width:400px; min-height:'.$height.'px;';
$output = '<div class="container-top" style="'.$style.'">';
$output .= html_print_table($table, true);
$output .= '</div>';
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Service Level Detail');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'service_level';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 800,
'height' => 270,
];
return $size;
}
/**
* Return array with the real id agent and server.
*
* @param string $id_agents_cache String with the agents cache id.
*
* @return string $agents_servers with the real id agent and server.
*/
public function getRealIdAgentNode($id_agents_cache)
{
$agents_servers = [];
$target_agents = explode(',', $id_agents_cache);
foreach ($target_agents as $agent_id) {
$id_agente = $agent_id;
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
['id_agente' => $id_agente]
);
$id_agente = $tmeta_agent['id_tagente'];
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
$agents_servers[] = $tserver.'|'.$id_agente;
}
return implode(',', $agents_servers);
}
/**
* Return string with the cache id agent in metaconsole.
*
* @param string $id_agents String with the agents and server id.
*
* @return string $cache_id_agents with the cache id agent.
*/
public function getIdCacheAgent($id_agents)
{
$target_agents = explode(',', $id_agents);
$cache_id_agents = [];
foreach ($target_agents as $agent_id) {
if (str_contains($agent_id, '|') === false) {
$cache_id_agents[] = $agent_id;
continue;
}
$server_agent = explode('|', $agent_id);
$tmeta_agent = db_get_row_filter(
'tmetaconsole_agent',
[
'id_tagente' => $server_agent[1],
'id_tmetaconsole_setup' => $server_agent[0],
]
);
$cache_id_agents[] = $tmeta_agent['id_agente'];
}
return implode(',', $cache_id_agents);
}
}

View File

@ -117,6 +117,8 @@ class NewsBoard extends Element
$output .= '</div>';
return $output;
} else {
return '';
}
}

View File

@ -1196,7 +1196,7 @@ class Item extends CachedModel
'operation/visual_console/view',
['id' => $vcId],
// No autologin from the public view.
!$config['public_view'],
!$config['public_access'],
$mobile_navigation,
[
'page' => 'visualmap',
@ -1302,7 +1302,7 @@ class Item extends CachedModel
'enterprise/operation/services/services',
['id_service' => $serviceId],
// No autologin from the public view.
!$config['public_view']
!$config['public_access']
);
} else {
// A regular module.
@ -1312,7 +1312,7 @@ class Item extends CachedModel
'operation/agentes/status_monitor',
['id_module' => $moduleId],
// No autologin from the public view.
!((isset($config['public_view']) === true) ? $config['public_view'] : false),
!((isset($config['public_access']) === true) ? $config['public_access'] : false),
$mobile_navigation,
[
'id' => $moduleId,
@ -1377,7 +1377,7 @@ class Item extends CachedModel
'operation/agentes/ver_agente',
['id_agente' => $agentId],
// No autologin from the public view.
!$config['public_view'],
!$config['public_access'],
$mobile_navigation,
[
'id' => $agentId,

View File

@ -148,7 +148,7 @@ h1 {
cursor: pointer;
}
#modal-add-widget {
min-height: 566px !important;
min-height: 625px !important;
}
#modal-add-widget .container-list-widgets {
display: flex;
@ -284,6 +284,11 @@ li#div-textarea label {
display: initial;
}
.content-widget .container-top {
height: 100%;
width: 99%;
}
.widget-groups-status {
display: flex;
flex-direction: row;

View File

@ -48,8 +48,9 @@
.ui-dialog .ui-dialog-titlebar-minimize {
position: relative;
height: 20px;
width: 20px;
margin-right: 1px;
bottom: 30%;
top: 0px;
background-color: #fff !important;
}
.ui-dialog .ui-dialog-titlebar-minimize:hover {
@ -57,10 +58,15 @@
}
.ui-dialog .ui-dialog-titlebar-disengage {
position: relative;
height: 20px;
width: 20px;
margin-right: 5px;
position: absolute !important;
right: 50px;
top: -3px;
width: 40px;
margin: 0px 0 0 0;
padding: 1px;
height: 40px;
bottom: 30%;
background-color: #fff !important;
}
.ui-dialog .ui-dialog-titlebar-disengage:hover {

View File

@ -8764,6 +8764,10 @@ div.graph div.legend table {
text-decoration: underline;
}
.underline-hover:hover {
text-decoration: underline;
}
.w105px {
width: 105px;
}
@ -10256,6 +10260,14 @@ div#err_msg_centralised {
align-items: flex-start;
}
.div-col-4 {
width: 25%;
display: flex;
flex-direction: column;
align-items: flex-start;
margin-top: 10px;
}
.div-span {
width: 100%;
color: #161628;
@ -12866,6 +12878,18 @@ tr.shown td.details-control {
top: -92px;
}
.tags_selected_container > span.select2 {
background-color: white !important;
}
.span_as_label {
font-size: 13px;
line-height: 16px;
color: #161628;
font-weight: bold;
margin-bottom: 10px;
}
.basic-options-disabled tr > td,
.basic-options-disabled tr > td > div > label {
color: gray;

View File

@ -784,6 +784,11 @@ form ul.form_flex {
width: 100%;
}
.content-widget .container-top {
height: 100%;
width: 99%;
}
.container-layout {
border-radius: 5px;
border: 3px dashed #fff;

View File

@ -743,6 +743,9 @@ p {
margin-block-end: 1em;
}
strong {
font-size: inherit;
}
/* Styles for the solid icons */
.fa {

File diff suppressed because one or more lines are too long

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.774';
$build = '231205';
$build = '231213';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -320,6 +320,7 @@ $table->size[0] = '50%';
$table->size[1] = '50%';
$table->class = 'filter-table-adv';
$table->cellstyle['group'][0] = 'display: flex;width: 95% !important;';
$table->data['group'][0] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
@ -336,7 +337,8 @@ $table->data['group'][0] = html_print_label_input_block(
true,
'',
false
)
),
['div_class' => 'w100p']
);
$table->data['group'][0] .= html_print_label_input_block(
@ -346,11 +348,7 @@ $table->data['group'][0] .= html_print_label_input_block(
1,
$recursion,
true
),
[
'div_class' => 'add-input-reverse',
'label_class' => 'label-thin',
]
)
);
$table->data['group'][1] = html_print_label_input_block(
@ -405,7 +403,7 @@ foreach ($pre_fields as $key => $value) {
$table->data[1][0] = html_print_label_input_block(
__('Operating System'),
html_print_select($fields, 'os', $os, '', 'All', 0, true)
html_print_select($fields, 'os', $os, '', 'All', 0, true, false, true, 'w100p', false, 'width:100%')
);
$table->data[1][1] = html_print_label_input_block(
@ -428,9 +426,22 @@ if (function_exists('policies_get_policies') === true) {
}
}
$table->data[2][0] = html_print_label_input_block(
$table->data[2][1] = html_print_label_input_block(
__('Policies'),
html_print_select($fields, 'policies[]', $policies, '', 'All', 0, true, true)
html_print_select(
$fields,
'policies',
$policies,
'this.form.submit()',
__('All'),
0,
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -438,7 +449,7 @@ if ($custom_fields === false) {
$custom_fields = [];
}
$div_custom_fields = '<div class="flex-row">';
$div_custom_fields = '<div class="flex-row w100p" style="justify-content: unset;">';
foreach ($custom_fields as $custom_field) {
$custom_field_value = '';
if (empty($ag_custom_fields) === false) {
@ -448,10 +459,10 @@ foreach ($custom_fields as $custom_field) {
}
}
$div_custom_fields .= '<div class="div-col">';
$div_custom_fields .= '<div class="div-col-4">';
$div_custom_fields .= '<div class="div-span">';
$div_custom_fields .= '<span >'.$custom_field['name'].'</span>';
$div_custom_fields .= '<span class="span_as_label">'.$custom_field['name'].'</span>';
$div_custom_fields .= '</div>';
$div_custom_fields .= '<div class="div-input">';
@ -890,7 +901,11 @@ if ($group_id > 0) {
$groups = array_keys($user_groups);
}
$all_policies = in_array(0, ($policies ?? []));
if (is_array($policies)) {
$all_policies = in_array(0, ($policies ?? []));
} else {
$all_policies = [];
}
$id_os_sql = '';
$policies_sql = '';

View File

@ -121,8 +121,11 @@ if (empty($agent['os_version']) !== true) {
$os_agent_text = $os_version.' ('.$os_version_name[1].')';
} else {
$os_name = preg_split('/[0-9]/', $agent['os_version'])[0];
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
$os_agent_text = $agent['os_version'];
if (empty($os_name) === false) {
$os_version = explode($os_name, explode('(', $agent['os_version'])[0])[1];
$os_agent_text = $os_version;
}
}
}

View File

@ -1205,57 +1205,6 @@ if (is_ajax() === true) {
return;
}
if ($get_agents_in_group) {
$id = (int) get_parameter('id', 0);
$group = (int) get_parameter('group', -1);
$return = [];
$return['correct'] = false;
if ($group != -1) {
$where_id_agente = ' 1=1 ';
$agents_in_networkmap = db_get_all_rows_filter(
'titem',
[
'id_map' => $id,
'deleted' => 0,
]
);
if ($agents_in_networkmap !== false) {
$ids = [];
foreach ($agents_in_networkmap as $agent) {
if ($agent['type'] == 0) {
$ids[] = $agent['source_data'];
}
}
$where_id_agente = ' id_agente NOT IN ('.implode(',', $ids).')';
}
$sql = 'SELECT id_agente, alias
FROM tagente
WHERE id_grupo = '.$group.' AND '.$where_id_agente.'
ORDER BY alias ASC';
$agents = db_get_all_rows_sql($sql);
if ($agents !== false) {
$return['agents'] = [];
foreach ($agents as $agent) {
$return['agents'][$agent['id_agente']] = $agent['alias'];
}
$return['correct'] = true;
}
}
echo json_encode($return);
return;
}
if ($get_agent_info) {
$id_agent = (int) get_parameter('id_agent');

View File

@ -675,7 +675,9 @@ $params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent';
$params['value'] = $inventory_agent;
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'module_inventory_general_view';
// $params['javascript_is_function_select'] = true;
// $params['javascript_function_action_after_select'] = 'this.form.submit';
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
@ -1289,6 +1291,10 @@ if ($inventory_module !== 'basic') {
$style = 'width: 100%';
$ordering = true;
$searching = false;
$search = [];
if (strlen($inventory_search_string) > 0) {
$search['value'] = $inventory_search_string;
}
$columns = [
'alias',
@ -1338,6 +1344,7 @@ if ($inventory_module !== 'basic') {
'get_data_basic_info' => 1,
'id_agent' => $id_agente,
'id_group' => $inventory_id_group,
'search' => $search,
],
'zeroRecords' => __('Agent info not found'),
'emptyTable' => __('Agent info not found'),

View File

@ -76,15 +76,15 @@ if ($searchAgents) {
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
INNER JOIN taddress_agent ON
taddress.id_a = taddress_agent.id_a
WHERE taddress.ip LIKE '$stringSearchSQL'";
WHERE LOWER(REPLACE(taddress.ip, '&#x20;', ' ')) LIKE LOWER('$stringSearchSQL')";
$id = db_get_all_rows_sql($sql);
if ($id != '') {
$aux = $id[0]['id_agent'];
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
t2.nombre LIKE '".$stringSearchSQL."' OR
t1.alias LIKE '".$stringSearchSQL."' OR
t1.comentarios LIKE '".$stringSearchSQL."' OR
$search_sql = " LOWER(REPLACE(t1.nombre, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t2.nombre, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t1.alias, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t1.comentarios, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
t1.id_agente =".$aux;
$idCount = count($id);
@ -96,16 +96,16 @@ if ($searchAgents) {
}
}
} else {
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
t2.nombre LIKE '".$stringSearchSQL."' OR
t1.direccion LIKE '".$stringSearchSQL."' OR
t1.comentarios LIKE '".$stringSearchSQL."' OR
t1.alias LIKE '".$stringSearchSQL."'";
$search_sql = " LOWER(REPLACE(t1.nombre, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t2.nombre, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t1.direccion, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t1.comentarios, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."') OR
LOWER(REPLACE(t1.alias, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."')";
}
if ($has_secondary === true) {
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE LOWER(REPLACE(nombre, '&#x20;', ' ')) LIKE LOWER('".$stringSearchSQL."')))";
}
$sql = "

View File

@ -139,64 +139,64 @@ if ($searchAlerts) {
switch ($config['dbtype']) {
case 'mysql':
$whereAlerts = 'AND (
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%'.$stringSearchSQL.'%") OR
id_alert_template IN (SELECT id FROM talert_templates WHERE REPLACE(name, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%") OR
id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
WHERE REPLACE(name, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%")) OR
talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$stringSearchSQL.'%")) OR
WHERE REPLACE(name, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%")) OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre LIKE "%'.$stringSearchSQL.'%") OR
WHERE REPLACE(nombre, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%") OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente IN (
SELECT id_agente
FROM tagente
WHERE nombre LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
WHERE REPLACE(nombre, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%" '.$extra_sql.'))
)';
break;
case 'postgresql':
case 'oracle':
$whereAlerts = 'AND (
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
id_alert_template IN (SELECT id FROM talert_templates WHERE upper(REPLACE(name, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
WHERE upper(REPLACE(name, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE upper(name) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
WHERE upper(REPLACE(name, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')) OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
WHERE upper(REPLACE(nombre, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\') OR
id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente IN (
SELECT id_agente
FROM tagente
WHERE upper(nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
WHERE upper(REPLACE(nombre, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' '.$extra_sql.'))
)';
$agents = false;
break;

View File

@ -31,7 +31,7 @@ if ($searchGraphs) {
}
$filter = [];
$filter[] = "(upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%$".strtolower($stringSearchSQL)."%')";
$filter[] = "(upper(REPLACE(name, '&#x20;', ' ')) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, '&#x20;', ' ')) LIKE '%$".strtolower($stringSearchSQL)."%')";
$filter['id_graph'] = $usergraphs_id;
$columns = [

View File

@ -62,10 +62,10 @@ $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
$id = db_get_all_rows_sql($sql);
if ($id != '') {
$aux = $id[0]['id_agent'];
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
t2.nombre LIKE '".$stringSearchSQL."' OR
t1.alias LIKE '".$stringSearchSQL."' OR
t1.comentarios LIKE '".$stringSearchSQL."' OR
$search_sql = " REPLACE(t1.nombre, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t2.nombre, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t1.alias, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t1.comentarios, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
t1.id_agente =".$aux;
$idCount = count($id);
@ -77,16 +77,16 @@ if ($id != '') {
}
}
} else {
$search_sql = " t1.nombre LIKE '".$stringSearchSQL."' OR
t2.nombre LIKE '".$stringSearchSQL."' OR
t1.direccion LIKE '".$stringSearchSQL."' OR
t1.comentarios LIKE '".$stringSearchSQL."' OR
t1.alias LIKE '".$stringSearchSQL."'";
$search_sql = " REPLACE(t1.nombre, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t2.nombre, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t1.direccion, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t1.comentarios, '&#x20;', ' ') LIKE '".$stringSearchSQL."' OR
REPLACE(t1.alias, '&#x20;', ' ') LIKE '".$stringSearchSQL."'";
}
if ($has_secondary === true) {
$search_sql .= " OR (tasg.id_group IS NOT NULL AND
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE nombre LIKE '".$stringSearchSQL."'))";
tasg.id_group IN (SELECT id_grupo FROM tgrupo WHERE REPLACE(nombre, '&#x20;', ' ') LIKE '".$stringSearchSQL."'))";
}
$sql = "

View File

@ -32,7 +32,7 @@ if ((bool) $searchMaps === true) {
FROM tlayout tl
LEFT JOIN tlayout_data tld
ON tl.id = tld.id_layout
WHERE tl.name LIKE "%%%s%%"
WHERE REPLACE(tl.name, "&#x20;", " ") LIKE "%%%s%%"
AND tl.id_group IN (%s)
GROUP BY tl.id, tl.name, tl.id_group',
$stringSearchSQL,

View File

@ -142,8 +142,8 @@ if ($searchModules) {
)
)
AND
(t1.nombre LIKE "%'.$stringSearchSQL.'%" OR
t3.nombre LIKE "%'.$stringSearchSQL.'%")
(REPLACE(t1.nombre, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%" OR
REPLACE(t3.nombre, "&#x20;", " ") LIKE "%'.$stringSearchSQL.'%")
AND t1.disabled = 0';
break;
@ -172,8 +172,8 @@ if ($searchModules) {
)
)
) AND
(t1.nombre LIKE \'%'.$stringSearchSQL.'%\' OR
t3.nombre LIKE \'%'.$stringSearchSQL.'%\')';
(REPLACE(t1.nombre, "&#x20;", " ") LIKE \'%'.$stringSearchSQL.'%\' OR
REPLACE(t3.nombre, "&#x20;", " ") LIKE \'%'.$stringSearchSQL.'%\')';
break;
case 'oracle':
@ -201,8 +201,8 @@ if ($searchModules) {
)
)
) AND
(LOWER(t1.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
LOWER(t3.nombre) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
(LOWER(REPLACE(t1.nombre, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\' OR
LOWER(REPLACE(t3.nombre, "&#x20;", " ")) LIKE \'%'.strtolower($stringSearchSQL).'%\')';
break;
}

View File

@ -207,7 +207,7 @@ if ($searchpolicies === true) {
$sql = "SELECT id, name, description, id_group, status
FROM tpolicies
WHERE name LIKE '$stringSearchSQL'
WHERE REPLACE(name, '&#x20;', ' ') LIKE '$stringSearchSQL'
AND id_group IN ($id_user_groups_str)
";
}

View File

@ -46,13 +46,13 @@ if ($searchReports) {
case 'postgresql':
$sql = "SELECT id_report, name, description
FROM treport
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
WHERE (REPLACE(name, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
break;
case 'oracle':
$sql = "SELECT id_report, name, description
FROM treport
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR description LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
WHERE (upper(REPLACE(name, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR REPLACE(description, '&#x20;', ' ') LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
break;
}
@ -77,13 +77,13 @@ if ($searchReports) {
case 'postgresql':
$sql_count = "SELECT COUNT(id_report) AS count
FROM treport
WHERE (name LIKE '%".$stringSearchSQL."%' OR description LIKE '%".$stringSearchSQL."%')".$reports_condition;
WHERE (REPLACE(name, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR REPLACE(description, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%')".$reports_condition;
break;
case 'oracle':
$sql_count = "SELECT COUNT(id_report) AS count
FROM treport
WHERE (upper(name) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(description) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
WHERE (upper(REPLACE(name, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR upper(REPLACE(description, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%')".$reports_condition;
break;
}

View File

@ -179,23 +179,23 @@ if ($searchUsers) {
case 'mysql':
case 'postgresql':
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
WHERE fullname LIKE '%".$stringSearchSQL."%' OR
id_user LIKE '%".$stringSearchSQL."%' OR
firstname LIKE '%".$stringSearchSQL."%' OR
lastname LIKE '%".$stringSearchSQL."%' OR
middlename LIKE '%".$stringSearchSQL."%' OR
email LIKE '%".$stringSearchSQL."%'
WHERE REPLACE(fullname, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR
REPLACE(id_user, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR
REPLACE(firstname, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR
REPLACE(lastname, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR
REPLACE(middlename, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%' OR
REPLACE(email, '&#x20;', ' ') LIKE '%".$stringSearchSQL."%'
ORDER BY ".$order['field'].' '.$order['order'];
break;
case 'oracle':
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
WHERE upper(fullname) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(id_user) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(firstname) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(lastname) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(middlename) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(email) LIKE '%".strtolower($stringSearchSQL)."%'
WHERE upper(REPLACE(fullname, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(REPLACE(id_user, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(REPLACE(firstname, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(REPLACE(lastname, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(REPLACE(middlename, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%' OR
upper(REPLACE(email, '&#x20;', ' ') ) LIKE '%".strtolower($stringSearchSQL)."%'
ORDER BY ".$order['field'].' '.$order['order'];
break;
}

View File

@ -91,7 +91,7 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory, ['mib', 'zip']);
}
if ($create_text_file === true) {

View File

@ -33,7 +33,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
ui_require_css_file('register', 'include/styles/', true);
// Connection lost alert.
ui_require_javascript_file('connection_check', 'include/javascript/', true);
// ui_require_javascript_file('connection_check', 'include/javascript/', true);
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
$conn_title = __('Connection with console has been lost');
$conn_text = __('Connection to the console has been lost. Please check your internet connection.');
@ -47,7 +47,7 @@ global $vc_public_view;
global $config;
$vc_public_view = true;
$config['public_view'] = true;
$config['public_access'] = true;
// This starts the page head. In the call back function,
// things from $page['head'] array will be processed into the head.
@ -62,12 +62,6 @@ require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash');
// For public link issue.
$force_instant_logout = true;
if (isset($config['id_user']) === true) {
$force_instant_logout = false;
}
// Check input hash.
// DO NOT move it after of get parameter user id.
if (User::validatePublicHash($hash) !== true) {
@ -256,17 +250,17 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
if (menuLinks !== null) {
menuLinks.forEach(function (menuLink) {
menuLink.href = menuLink.href.replace(regex, replacement);
menuLink.href = menuLink.href.replace(
regex_hash,
replacement_hash
);
//menuLink.href = menuLink.href.replace(
// regex_hash,
// replacement_hash
//);
});
}
// Change the URL (if the browser has support).
if ("history" in window) {
var href = window.location.href.replace(regex, replacement);
href = href.replace(regex_hash, replacement_hash);
//href = href.replace(regex_hash, replacement_hash);
window.history.replaceState({}, document.title, href);
}
}
@ -321,20 +315,24 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
}
}
});
<?php if ($force_instant_logout === true) { ?>
// No click enabled when user not logged.
$( "a" ).on( "click", function( event ) {
event.preventDefault();
$('#visual-console-container').removeClass('is-updating');
$('.div-visual-console-spinner').remove();
});
<?php } ?>
</script>
<?php
if ($force_instant_logout === true) {
unset($userAccessMaintenance, $config['id_user'], $hash);
// Clean session to avoid direct access.
if ($config['force_instant_logout'] === true) {
// Force user logout.
$iduser = $_SESSION['id_usuario'];
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION = [];
session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
if (isset($_COOKIE[session_name()]) === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}
}
while (ob_get_length() > 0) {
ob_end_flush();
}

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.774
%define release 231205
%define release 231213
# User and Group under which Apache is running
%define httpd_name httpd

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