Merge remote-tracking branch 'origin' into ent-7662-rebranding-meta

This commit is contained in:
Jose Gonzalez 2021-09-28 11:33:48 +02:00
commit 1a884a9df6
134 changed files with 34258 additions and 26316 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.756-210831
Version: 7.0NG.757-210927
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.756-210831"
pandora_version="7.0NG.757-210927"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.756
%define release 210831
%define version 7.0NG.757
%define release 210927
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.756
%define release 210831
%define version 7.0NG.757
%define release 210927
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

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

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.756}
{Pandora FMS Windows Agent v7.0NG.757}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210831}
{210927}
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.756 Build 210831")
#define PANDORA_VERSION ("7.0NG.757 Build 210927")
string pandora_path;
string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.756-210831
Version: 7.0NG.757-210927
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.756-210831"
pandora_version="7.0NG.757-210927"
package_pear=0
package_pandora=1

View File

@ -106,3 +106,9 @@ enterprise/godmode/alerts/alert_events.php
enterprise/godmode/alerts/alert_events_list.php
enterprise/godmode/alerts/alert_events_rules.php
enterprise/godmode/alerts/configure_alert_rule.php
enterprise/include/functions_networkmap.php
enterprise/operation/agentes/pandora_networkmap.view.php
enterprise/include/ajax/map_enterprise.ajax.php
enterprise/include/javascript/SimpleMapController.js
enterprise/include/javascript/tooltipster.bundle.min.js
enterprise/include/styles/tooltipster.bundle.min.css

View File

@ -1,7 +1,5 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_setup` ADD COLUMN `unified` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `title` TEXT default '';

View File

@ -1,6 +1,9 @@
START TRANSACTION;
ALTER TABLE `tevento` MODIFY `data` TINYTEXT default NULL;
ALTER TABLE `tmetaconsole_event` MODIFY `data` TINYTEXT default NULL;
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';
COMMIT;

View File

@ -0,0 +1,8 @@
START TRANSACTION;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_filter` ADD COLUMN `time_from` TIME NULL;
ALTER TABLE `tevent_filter` ADD COLUMN `time_to` TIME NULL;
COMMIT;

View File

@ -710,6 +710,8 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` (
ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0;
ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400;
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_conditions` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tevent_alert` ADD COLUMN `id_template_fields` int(10) unsigned NOT NULL default 0;
-- -----------------------------------------------------
-- Table `tevent_alert_action`
@ -1441,13 +1443,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 48);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 49);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 756);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 757);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -4078,3 +4080,5 @@ CREATE TABLE IF NOT EXISTS `talert_execution_queue` (
`utimestamp` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE `tlanguage` SET `name` = 'Deutsch' WHERE `id_language` = 'de';

View File

@ -2095,7 +2095,7 @@ if ($delete_module) {
exit;
}
// Also call base function to delete modules madafakas de los cojones.
// Also call base function to delete modules.
modules_delete_agent_module($id_borrar_modulo);
// Check for errors.

View File

@ -26,7 +26,7 @@
* ============================================================================
*/
// Begin
// Begin.
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_categories.php';
require_once $config['homedir'].'/include/graphs/functions_d3.php';
@ -273,7 +273,8 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
true,
false,
true,
$disabledBecauseInPolicy
$disabledBecauseInPolicy,
'width: 150px'
);
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
@ -358,7 +359,7 @@ if (!$edit) {
false,
'',
false,
false,
'width:200px',
false,
100
);
@ -637,7 +638,7 @@ $table_advanced->data[1][4] = html_print_extended_select_for_post_process(
'0',
false,
true,
false,
'width:10em',
false,
$disabledBecauseInPolicy
);

View File

@ -443,6 +443,13 @@ $data[1] = html_print_input_text_extended(
$largeClassDisabledBecauseInPolicy,
true
);
$data[1] .= ui_print_help_tip(
__(
'Please use single quotation marks when necessary. '."\n".'
If double quotation marks are needed, please escape them with a backslash (\&quot;)'
),
true
);
$table_simple->colspan['row-cmd-row-1'][1] = 3;
push_table_simple($data, 'row-cmd-row-1');

View File

@ -0,0 +1,195 @@
<?php
/**
* Empty Network map editor.
*
* @category View
* @package Pandora FMS
* @subpackage Enterprise
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation 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.
* ============================================================================
*/
// Begin.
global $config;
// Check user credentials
check_login();
$id = (int) get_parameter('id_networkmap', 0);
$new_empty_networkmap = (bool) get_parameter('new_empty_networkmap', false);
$edit_networkmap = (bool) get_parameter('edit_networkmap', false);
$not_found = false;
if (empty($id)) {
$new_empty_networkmap = true;
$edit_networkmap = false;
}
if ($new_empty_networkmap) {
$name = '';
$id_group = 0;
$node_radius = 40;
$description = '';
}
if ($edit_networkmap) {
if (enterprise_installed()) {
$disabled_generation_method_select = true;
}
$disabled_source = true;
$values = db_get_row('tmap', 'id', $id);
$not_found = false;
if ($values === false) {
$not_found = true;
} else {
$id_group = $values['id_group'];
// ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
'ACL Violation',
'Trying to access networkmap'
);
include 'general/noaccess.php';
return;
}
$name = io_safe_output($values['name']);
$description = $values['description'];
$filter = json_decode($values['filter'], true);
$node_radius = $filter['node_radius'];
}
}
// Header.
ui_print_standard_header(
__('Empty Network maps editor'),
'images/bricks.png',
false,
'network_map_enterprise_edit',
false,
[],
[
[
'link' => '',
'label' => __('Topology maps'),
],
[
'link' => '',
'label' => __('Networkmap'),
],
]
);
if ($not_found) {
ui_print_error_message(__('Not found networkmap.'));
} else {
$table = new StdClass();
$table->id = 'form_editor';
$table->width = '98%';
$table->class = 'databox_color';
$table->head = [];
$table->size = [];
$table->size[0] = '30%';
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
30,
100,
true
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
).'</div>';
$table->data[2][0] = __('Node radius');
$table->data[2][1] = html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table);
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
if ($new_empty_networkmap) {
html_print_input_hidden('save_empty_networkmap', 1);
html_print_submit_button(
__('Save networkmap'),
'crt',
false,
'class="sub next"'
);
}
if ($edit_networkmap) {
html_print_input_hidden('id_networkmap', $id);
html_print_input_hidden('update_empty_networkmap', 1);
html_print_submit_button(
__('Update networkmap'),
'crt',
false,
'class="sub upd"'
);
}
echo '</form>';
echo '</div>';
}

View File

@ -219,34 +219,15 @@ if ($filemanager) {
$id_plugin = (int) get_parameter('id_plugin', 0);
// Add custom directories here
// Add custom directories here.
$fallback_directory = 'attachment/plugin';
$directory = (string) get_parameter('directory', $fallback_directory);
$directory = str_replace('\\', '/', $directory);
// A miminal security check to avoid directory traversal
if (preg_match('/\.\./', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^\//', $directory)) {
$directory = $fallback_directory;
}
if (preg_match('/^manager/', $directory)) {
$directory = $fallback_directory;
}
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory])) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -263,12 +244,12 @@ if ($filemanager) {
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
if ($upload_file_or_zip) {
upload_file($upload_file_or_zip, $default_real_directory);
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file) {
create_text_file($default_real_directory);
if ($create_text_file === true) {
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(

View File

@ -47,26 +47,15 @@ if (isset($config['filemanager']['message']) === true) {
$config['filemanager']['message'] = null;
}
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = 'images';
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, 'images');
}
// Add custom directories here.
$fallback_directory = 'images';
// Banned directories.
$banned_directories['include'] = true;
$banned_directories['godmode'] = true;
$banned_directories['operation'] = true;
$banned_directories['reporting'] = true;
$banned_directories['general'] = true;
$banned_directories[ENTERPRISE_DIR] = true;
if (isset($banned_directories[$directory]) === true) {
// Get directory.
$directory = (string) get_parameter('directory');
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
@ -76,14 +65,14 @@ echo '<h4>'.__('Index of %s', $directory).'</h4>';
$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'.$fallback_directory);
$default_real_directory = realpath($config['homedir'].'/');
if ($upload_file_or_zip === true) {
upload_file($upload_file_or_zip, $default_real_directory);
upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
}
if ($create_text_file === true) {
create_text_file($default_real_directory);
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(
@ -96,5 +85,6 @@ filemanager_file_explorer(
'',
false,
'',
false,
false
);

View File

@ -87,7 +87,8 @@ if (function_exists('enterprise_hook') === true) {
$days_to_expiry = ((strtotime($license_data['expiry_date']) - time()) / (60 * 60 * 24));
if ((int) $license_data['limit_mode'] === 0) {
$limit = db_get_value('count(*)', 'tagente', 'disabled', 0);
$agent_table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
$limit = db_get_value('count(*)', $agent_table, 'disabled', 0);
} else {
$limit = db_get_value('count(*)', 'tagente_modulo', 'disabled', 0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@ -991,7 +991,7 @@ $email = '<div class="label_select_simple">'.html_print_input_text_extended(
$view_mode,
'',
[
'class' => 'input input_line email_icon_input invert_filter',
'class' => 'input input_line email_icon_input',
'placeholder' => __('E-mail'),
],
true

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -252,7 +252,9 @@ if ($save_event_filter) {
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
$values['time_from'] = get_parameter('time_from');
$values['date_to'] = get_parameter('date_to');
$values['time_to'] = get_parameter('time_to');
$values['source'] = get_parameter('source');
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
@ -304,13 +306,15 @@ if ($update_event_filter) {
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
$values['time_from'] = get_parameter('time_from');
$values['date_to'] = get_parameter('date_to');
$values['time_to'] = get_parameter('time_to');
$values['source'] = get_parameter('source');
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$values['server_id'] = get_parameter('server_id');
}
@ -355,7 +359,9 @@ if ($get_filter_values) {
'id_extra' => '',
'id_user_ack' => '',
'date_from' => '',
'time_from' => '',
'date_to' => '',
'time_to' => '',
'severity' => '',
'event_type' => '',
'group_rep' => 0,
@ -380,7 +386,7 @@ if ($get_filter_values) {
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
@ -543,8 +549,12 @@ function load_form_filter() {
$("#select2-server_id-container").text(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'time_from')
$("#text-time_from").val(val);
if(i == 'date_to')
$("#text-date_to").val(val);
if(i == 'time_to')
$("#text-time_to").val(val);
if(i == 'module_search')
$('input[name=module_search]').val(val);
if(i == 'group_name')
@ -767,7 +777,9 @@ function save_new_filter() {
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(),
"time_from": $("#text-time_from").val(),
"date_to": $("#text-date_to").val(),
"time_to": $("#text-time_to").val(),
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
@ -838,7 +850,9 @@ function save_update_filter() {
"filter_only_alert" : $("#filter_only_alert").val(),
"id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(),
"time_from": $("#text-time_from").val(),
"date_to": $("#text-date_to").val(),
"time_to": $("#text-time_to").val(),
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
@ -1783,7 +1797,9 @@ if ($get_list_events_agents) {
$tag_without = get_parameter('tag_without');
$filter_only_alert = get_parameter('filter_only_alert');
$date_from = get_parameter('date_from');
$time_from = get_parameter('time_from', '00:00:00');
$date_to = get_parameter('date_to');
$time_to = get_parameter('time_to', '23:59:59');
$id_user = $config['id_user'];
$returned_sql = events_sql_events_grouped_agents(
@ -1800,7 +1816,9 @@ if ($get_list_events_agents) {
$tag_without,
$filter_only_alert,
$date_from,
$time_from,
$date_to,
$time_to,
$id_user
);

View File

@ -0,0 +1,102 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2021 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
$networkmap = get_parameter('networkmap', false);
global $config;
require_once $config['homedir'].'/include/class/NetworkMap.class.php';
if ((bool) is_metaconsole() === true) {
$node = get_parameter('node', 0);
if ($node > 0) {
metaconsole_connect(null, $node);
}
}
if ($networkmap) {
$networkmap_id = get_parameter('networkmap_id', 0);
$x_offset = get_parameter('x_offset', 0);
$y_offset = get_parameter('y_offset', 0);
$zoom_dash = get_parameter('zoom_dash', 0.5);
// Dashboard mode.
$ignore_acl = (bool) get_parameter('ignore_acl', 0);
$networkmap = db_get_row_filter('tmap', ['id' => $networkmap_id]);
if ($ignore_acl === false) {
// ACL for the network map.
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
'ACL Violation',
'Trying to access networkmap'
);
include 'general/noaccess.php';
if ($node > 0) {
metaconsole_restore_db();
}
return;
}
}
ob_start();
if ($networkmap['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
$data['name'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/networkmap.dinamic&'.'activeTab=radial_dynamic&'.'id_networkmap='.$networkmap['id'].'">'.$networkmap['name'].'</a>';
global $id_networkmap;
$id_networkmap = $networkmap['id'];
$tab = 'radial_dynamic';
include_once 'operation/agentes/networkmap.dinamic.php';
} else {
$map = new NetworkMap(
[
'id_map' => $networkmap_id,
'widget' => 1,
'pure' => 1,
'no_popup' => 1,
'map_options' => [
'x_offs' => $x_offset,
'y_offs' => $y_offset,
'z_dash' => $zoom_dash,
],
]
);
$map->printMap(false, $ignore_acl);
}
$return = ob_get_clean();
echo $return;
if ($node > 0) {
metaconsole_restore_db();
}
return;
}
if ($node > 0) {
metaconsole_restore_db();
}

View File

@ -105,19 +105,19 @@ if ($info == 'version') {
if (empty($apiPassword) === true
|| (empty($apiPassword) === false && $api_password === $apiPassword)
&& (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true)
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
if (empty($apiPassword) === true || (empty($apiPassword) === false && $api_password === $apiPassword)) {
if (enterprise_hook('metaconsole_validate_origin', [get_parameter('server_auth')]) === true
|| enterprise_hook('console_validate_origin', [get_parameter('server_auth')]) === true
) {
// Allow internal direct node -> metaconsole connection
// or node -> own console connection.
$config['__internal_call'] = true;
$config['id_usuario'] = 'admin';
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {
$config['id_usuario'] = $user_in_db;
@ -138,10 +138,10 @@ if (empty($apiPassword) === true
$no_login_msg = 'Incorrect user credentials';
}
} else {
$no_login_msg = 'Incorrect given API password';
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
}
} else {
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
$no_login_msg = 'Incorrect given API password';
}
if ($correctLogin) {

View File

@ -770,7 +770,7 @@ function ldap_process_user_login($login, $password)
io_safe_output($config['ldap_base_dn']),
$config['ldap_login_attr'],
io_safe_output($config['ldap_admin_login']),
$config['ldap_admin_pass'],
io_safe_output($config['ldap_admin_pass']),
io_safe_output($login)
);

View File

@ -837,8 +837,11 @@ class ModuleTemplates extends HTML
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
$penList = [];
foreach ($penInfo as $pen) {
$penList[] = $pen['pen'];
// Handle if list of PEN does not exist or is empty.
if ($penInfo !== false) {
foreach ($penInfo as $pen) {
$penList[] = $pen['pen'];
}
}
$this->pen = implode(',', $penList);

View File

@ -30,7 +30,6 @@
global $config;
require_once $config['homedir'].'/include/functions_networkmap.php';
enterprise_include_once('include/functions_networkmap.php');
enterprise_include_once('include/functions_discovery.php');
// Avoid node overlapping.
@ -723,13 +722,7 @@ class NetworkMap
}
if ($this->idMap !== false) {
if (enterprise_installed()) {
// Enterprise environment: LOAD.
$this->nodes = enterprise_hook(
'get_nodes_from_db',
[$this->idMap]
);
}
$this->nodes = get_nodes_from_db($this->idMap);
}
return $this->nodes;
@ -762,12 +755,7 @@ class NetworkMap
}
if ($this->idMap !== false) {
if (enterprise_installed()) {
$this->relations = enterprise_hook(
'get_relations_from_db',
[$this->idMap]
);
}
$this->relations = get_relations_from_db($this->idMap);
}
return $this->relations;
@ -786,12 +774,9 @@ class NetworkMap
// Calculate.
// Search.
if (enterprise_installed() && $this->idTask) {
if ($this->idTask) {
// Network map, based on discovery task.
return enterprise_hook(
'get_discovery_agents',
[$this->idTask]
);
return get_discovery_agents($this->idTask);
}
if ($this->network) {
@ -1101,18 +1086,14 @@ class NetworkMap
$relations = $this->relations;
// Generate if there's no data in DB about nodes or relations.
if (empty($nodes) && empty($relations)) {
if (empty($nodes) === true && empty($relations) === true) {
$this->generateNetworkMap();
return;
}
$graph = enterprise_hook(
'networkmap_load_map',
[$this]
);
$graph = networkmap_load_map($this);
if ($graph === ENTERPRISE_NOT_HOOK) {
// Method not available, regenerate.
if (empty($graph) === true) {
$this->generateNetworkMap();
return;
}
@ -2607,15 +2588,7 @@ class NetworkMap
// Save data.
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
if (enterprise_installed()) {
$graph = enterprise_hook(
'save_generate_nodes',
[
$this->idMap,
$graph,
]
);
}
$graph = save_generate_nodes($this->idMap, $graph);
db_process_sql_update(
'tmap',
@ -2733,7 +2706,6 @@ class NetworkMap
$output .= 'var networkmap_refresh_time = 1000 * '.$networkmap['source_period'].";\n";
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
@ -2883,22 +2855,14 @@ class NetworkMap
public function loadAdvancedInterface()
{
$list_networkmaps = get_networkmaps($this->idMap);
if (empty($list_networkmaps)) {
if (empty($list_networkmaps) === true) {
$list_networkmaps = [];
}
$id = 'dialog_node_edit';
if (!enterprise_installed()) {
$id = 'open_version_dialog';
$output = '<div id="open_version" style="display: none" title="'.__('Warning').'">';
$output .= '<div class="center mrgn_top_20px w90p font_13px">'.__(
'In the Open version of %s can not be edited nodes or map',
get_product_name()
);
$output .= '</div></div>';
}
$output .= '<div id="'.$id.'" class="invisible" title="';
$output = '<div id="'.$id.'" class="invisible" title="';
$output .= __('Edit node').'">';
$output .= '<div class="left w100p">';
@ -3017,16 +2981,14 @@ class NetworkMap
true
);
if (enterprise_installed()) {
$output .= ui_toggle(
html_print_table($table, true),
__('Node options'),
__('Node options'),
'',
true,
true
);
}
$output .= ui_toggle(
html_print_table($table, true),
__('Node options'),
__('Node options'),
'',
true,
true
);
$table = new StdClass();
$table->id = 'relations_table';
@ -3109,16 +3071,14 @@ class NetworkMap
true
);
if (enterprise_installed()) {
$output .= ui_toggle(
html_print_table($table, true),
__('Relations'),
__('Relations'),
'',
true,
true
);
}
$output .= ui_toggle(
html_print_table($table, true),
__('Relations'),
__('Relations'),
'',
true,
true
);
$output .= '</div></div>';
@ -3340,8 +3300,7 @@ class NetworkMap
{
$output = '';
if (enterprise_installed()
&& $this->useTooltipster
if ($this->useTooltipster
) {
$output .= '<script type="text/javascript">
$(function() {
@ -3376,7 +3335,7 @@ class NetworkMap
graph: networkmap,
networkmap_center: networkmap_center,
networkmap_dimensions: networkmap_dimensions,
enterprise_installed: enterprise_installed,
enterprise_installed: 1,
node_radius: node_radius,
holding_area_dimensions: networkmap_holding_area_dimensions,
url_background_grid: url_background_grid,
@ -3419,18 +3378,17 @@ class NetworkMap
{
global $config;
if (enterprise_installed()
&& isset($this->useTooltipster)
&& $this->useTooltipster == true
if (isset($this->useTooltipster) === true
&& (bool) $this->useTooltipster === true
) {
$output = '<script type="text/javascript" src="'.ui_get_full_url(
'include/javascript/d3.3.5.14.js'
).'" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
'enterprise/include/javascript/SimpleMapController.js'
'include/javascript/SimpleMapController.js'
).'"></script>';
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
'enterprise/include/javascript/tooltipster.bundle.min.js'
'include/javascript/tooltipster.bundle.min.js'
).'"></script>';
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
'include/javascript/jquery.svg.js'
@ -3439,11 +3397,11 @@ class NetworkMap
'include/javascript/jquery.svgdom.js'
).'"></script>';
$output .= '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url(
'/enterprise/include/styles/tooltipster.bundle.min.css'
'include/styles/tooltipster.bundle.min.css'
).'" />'."\n";
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
$output .= 'class="border_1px_dd';
$output .= 'class="border_1px_dd" style="';
if ($this->fullSize) {
$output .= ' width:100%';

View File

@ -222,20 +222,20 @@ class TreeService extends Tree
switch ($status) {
case SERVICE_STATUS_NORMAL:
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_ok_ball.png'.'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_ok_ball.png').'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
break;
case SERVICE_STATUS_CRITICAL:
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_critical_ball.png'.'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_critical_ball.png').'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
break;
case SERVICE_STATUS_WARNING:
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_warning_ball.png'.'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_warning_ball.png').'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
break;
case SERVICE_STATUS_UNKNOWN:
default:
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_no_data_ball.png'.'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
$processed_items[$row['id']]['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_no_data_ball.png').'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
break;
}
}
@ -406,21 +406,21 @@ class TreeService extends Tree
switch ($item->agent()->lastStatus()) {
case AGENT_STATUS_NORMAL:
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_ok_ball.png'.'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_ok_ball.png').'" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
break;
case AGENT_STATUS_CRITICAL:
case AGENT_STATUS_ALERT_FIRED:
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_critical_ball.png'.'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_critical_ball.png').'" data-title="CRITICAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
break;
case AGENT_STATUS_WARNING:
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_warning_ball.png'.'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_warning_ball.png').'" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
break;
case AGENT_STATUS_UNKNOWN:
default:
$tmp['statusImageHTML'] = '<img src="'.'images/status_sets/default/agent_no_data_ball.png'.'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
$tmp['statusImageHTML'] = '<img src="'.ui_get_full_url('images/status_sets/default/agent_no_data_ball.png').'" data-title="UNKNOWN status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
break;
}

View File

@ -40,7 +40,8 @@ class TreeTag extends Tree
$this->L1orderByFinal = 'tt.name';
$this->L2condition = 'AND ttm.id_tag = '.$this->rootID;
$this->L2inner = $this->L1innerInside;
$this->L2inner = 'INNER JOIN ttag_module ttm
ON ttm.id_agente_modulo = tam.id_agente_modulo';
$this->L3forceTagCondition = true;
}

View File

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

View File

@ -3299,8 +3299,10 @@ function extract_column($array, $column)
function get_percentile($percentile, $array)
{
global $config;
sort($array);
$index = (($percentile / 100) * count($array));
$index = (($config['percentil'] / 100) * count($array));
if (floor($index) == $index) {
$result = (($array[($index - 1)] + $array[$index]) / 2);

View File

@ -5777,10 +5777,6 @@ function api_set_create_alert_template($name, $thrash1, $other, $thrash3)
{
global $config;
if (is_metaconsole() === true) {
return;
}
$headers = getallheaders();
if (isset($headers['idk']) === false
&& is_management_allowed($headers['idk']) === false
@ -16733,9 +16729,15 @@ function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3)
return;
}
if (is_array($other['data']) === true) {
$group_id = $other['data'][0];
} else {
$group_id = $other['data'];
}
$sql = sprintf(
'SELECT id_grupo
FROM tgrupo WHERE nombre = "'.$other['data'].'"'
FROM tgrupo WHERE nombre = "'.$group_id.'"'
);
$group_id = db_get_all_rows_sql($sql);
@ -17341,7 +17343,7 @@ function remove_agent_from_policy($id_policy, $use_agent_name, $params)
$agent = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $id_node]);
}
$policy = policies_get_policy($id_policy, false, false);
$policy = policies_get_policy($id_policy);
$policy_agent = (is_metaconsole()) ? db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent, 'id_node' => $id_node]) : db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent]);

View File

@ -620,7 +620,7 @@ function config_update_config()
$error_update[] = __('Admin LDAP login');
}
if (!config_update_value('ldap_admin_pass', io_input_password(get_parameter('ldap_admin_pass')))) {
if (!config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'))) {
$error_update[] = __('Admin LDAP password');
}

View File

@ -762,7 +762,7 @@ function events_get_all(
}
if (isset($filter['time_from'])) {
$time_from = $filter['time_from'];
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
}
if (isset($date_from)) {
@ -785,7 +785,7 @@ function events_get_all(
}
if (isset($filter['time_to'])) {
$time_to = $filter['time_to'];
$time_to = (empty($filter['time_to']) === true) ? '23:59:59' : $filter['time_to'];
}
if (isset($date_to)) {
@ -6193,7 +6193,9 @@ function events_get_events_grouped_by_agent(
* @param array $tag_without Tag_without.
* @param boolean $filter_only_alert Filter_only_alert.
* @param string $date_from Date_from.
* @param string $time_from Time_from.
* @param string $date_to Date_to.
* @param string $time_to Time_to.
* @param boolean $id_user Id_user.
* @param boolean $server_id_search Server_id_search.
*
@ -6213,7 +6215,9 @@ function events_sql_events_grouped_agents(
$tag_without=[],
$filter_only_alert=false,
$date_from='',
$time_from='',
$date_to='',
$time_to='',
$id_user=false,
$server_id_search=false
) {
@ -6320,27 +6324,35 @@ function events_sql_events_grouped_agents(
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
}
if (!isset($date_from)) {
if (isset($date_from) === false) {
$date_from = '';
}
if (!isset($date_to)) {
if (isset($time_from) === false) {
$time_from = '00:00:00';
}
if (isset($date_to) === false) {
$date_to = '';
}
if (isset($time_to) === false || empty($time_to) === true) {
$time_to = '23:59:59';
}
if (($date_from == '') && ($date_to == '')) {
if ($event_view_hr > 0) {
$unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR));
$sql_post .= ' AND (utimestamp > '.$unixtime.')';
}
} else {
if ($date_from != '') {
$udate_from = strtotime($date_from.' 00:00:00');
if (empty($date_from) === false) {
$udate_from = strtotime($date_from.' '.$time_from);
$sql_post .= ' AND (utimestamp >= '.$udate_from.')';
}
if ($date_to != '') {
$udate_to = strtotime($date_to.' 23:59:59');
if (empty($date_to) === false) {
$udate_to = strtotime($date_to.' '.$time_to);
$sql_post .= ' AND (utimestamp <= '.$udate_to.')';
}
}

View File

@ -26,7 +26,6 @@
* ============================================================================
*/
// Get global data.
// Constants.
define('MIME_UNKNOWN', 0);
@ -129,15 +128,16 @@ require_once $config['homedir'].'/vendor/autoload.php';
*
* @param boolean $upload_file_or_zip Upload file or zip.
* @param string $default_real_directory String with default directory.
* @param string $destination_directory String with destination directory.
*
* @return void
*/
function upload_file($upload_file_or_zip, $default_real_directory)
function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory)
{
global $config;
$config['filemanager'] = [];
$config['filemanager']['correct_upload_file'] = 0;
$config['filemanager']['message'] = null;
$config['filemanager']['message'] = '';
check_login();
@ -165,34 +165,43 @@ function upload_file($upload_file_or_zip, $default_real_directory)
if ($upload_file === true) {
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = io_safe_output((string) get_parameter('umask'));
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 execution of PHP files in directories that are not explicitly controlled by corresponding .htaccess).
ui_print_error_message(__('Security error'));
// 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
// execution of PHP files in directories that are not explicitly
// controlled by corresponding .htaccess).
$config['filemanager']['message'] = ui_print_error_message(__('Security error'));
} else {
// Copy file to directory and change name.
if (empty($directory) === true) {
$nombre_archivo = $real_directory.'/'.$filename;
} else {
$nombre_archivo = $default_real_directory.'/'.$directory.'/'.$filename;
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
try {
$result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
} catch (Exception $ex) {
$result = false;
}
if (! @copy($_FILES['file']['tmp_name'], $nombre_archivo)) {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
} else {
if ($result === true) {
// If umask is provided, set.
if (empty($umask) === false) {
chmod($nombre_archivo, $umask);
try {
chmod($nombre_archivo, $umask);
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message(__('Issue setting umask: %s', $ex->getMessage()));
}
}
// Upload performed properly.
$config['filemanager']['message'] .= ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
ui_print_success_message(__('Upload correct'));
// Delete temporal file.
unlink($_FILES['file']['tmp_name']);
} else {
$config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
}
}
}
@ -204,10 +213,8 @@ function upload_file($upload_file_or_zip, $default_real_directory)
&& empty($_FILES['file']['name']) === false
) {
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$filepath = $_FILES['file']['tmp_name'];
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
if (strpos($real_directory, $default_real_directory) !== 0) {
// Perform security check to determine whether received upload
@ -218,10 +225,10 @@ function upload_file($upload_file_or_zip, $default_real_directory)
ui_print_error_message(__('Security error'));
} else {
if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) {
ui_print_error_message(__('It was impossible to uncompress your file'));
$config['filemanager']['message'] = ui_print_error_message(__('It was impossible to uncompress your file'));
} else {
unlink($_FILES['file']['tmp_name']);
ui_print_success_message(__('Upload correct'));
$config['filemanager']['message'] = ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
}
}
@ -239,7 +246,7 @@ if (isset($_SERVER['CONTENT_LENGTH']) === true) {
}
function create_text_file($default_real_directory)
function create_text_file($default_real_directory, $destination_directory)
{
global $config;
@ -255,37 +262,42 @@ function create_text_file($default_real_directory)
return;
}
$filename = io_safe_output(get_parameter('name_file'));
$filename = filemanager_safe_directory((string) get_parameter('name_file'));
if (empty($filename) === false) {
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$real_directory = filemanager_safe_directory($destination_directory);
$umask = (string) get_parameter('umask');
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 execution of PHP files in directories that are not explicitly controlled by corresponding .htaccess).
// 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 execution
// of PHP files in directories that are not explicitly controlled by
// corresponding .htaccess).
ui_print_error_message(__('Security error'));
} else {
if (empty($directory) === true) {
$nombre_archivo = $real_directory.'/'.$filename;
} else {
$nombre_archivo = $default_real_directory.'/'.$directory.'/'.$filename;
}
$nombre_archivo = $real_directory.'/'.$filename;
if (! @touch($nombre_archivo)) {
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file'));
} else {
if ($umask !== '') {
chmod($nombre_archivo, $umask);
try {
// Create the file.
$result = touch($nombre_archivo);
if ($result === true) {
if ($umask !== '') {
chmod($nombre_archivo, $umask);
}
ui_print_success_message(__('File created correctly'));
$config['filemanager']['correct_upload_file'] = 1;
} else {
throw new Exception(__('Error creating file'));
}
ui_print_success_message(__('Upload correct'));
$config['filemanager']['correct_upload_file'] = 1;
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message($ex->getMessage());
}
}
} else {
ui_print_error_message(__('Error creating file with empty name'));
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file with empty name'));
}
}
@ -295,13 +307,18 @@ $create_dir = (bool) get_parameter('create_dir');
if ($create_dir === true) {
global $config;
$homedir_filemanager = io_safe_output($config['attachment_store']).'/collection';
$sec2 = get_parameter('sec2');
if ($sec2 === 'enterprise/godmode/agentes/collections' || $sec2 === 'advanced/collections') {
$homedir_filemanager = io_safe_output($config['attachment_store']).'/collection';
} else {
$homedir_filemanager = io_safe_output($config['homedir']);
}
$config['filemanager'] = [];
$config['filemanager']['correct_create_dir'] = 0;
$config['filemanager']['message'] = null;
$directory = filemanager_safe_directory((string) get_parameter('directory', '/'));
$directory = filemanager_safe_directory((string) get_parameter('directory'));
$hash = (string) get_parameter('hash');
$testHash = md5($directory.$config['server_unique_identifier']);
@ -312,12 +329,23 @@ if ($create_dir === true) {
if (empty($dirname) === false) {
// Create directory.
@mkdir(
$homedir_filemanager.'/'.$directory.'/'.$dirname
);
$config['filemanager']['message'] = ui_print_success_message(__('Directory created'), '', true);
try {
// If directory exists, add an slash at end.
if (empty($directory) === false) {
$directory .= '/';
}
$config['filemanager']['correct_create_dir'] = 1;
$result = mkdir($homedir_filemanager.'/'.$directory.$dirname);
if ($result === true) {
$config['filemanager']['message'] = ui_print_success_message(__('Directory created'), '', true);
$config['filemanager']['correct_create_dir'] = 1;
} else {
throw new Exception(__('Something gone wrong creating directory'));
}
} catch (Exception $ex) {
$config['filemanager']['message'] = ui_print_error_message($ex->getMessage(), '', true);
}
} else {
$config['filemanager']['message'] = ui_print_error_message(__('Error creating file with empty name'), '', true);
}
@ -367,7 +395,9 @@ if ($delete_file === true) {
/**
* Recursive delete directory and empty or not directory.
*
* @param string $dir The dir to deletete
* @param string $dir The dir to deletete.
*
* @return void
*/
function filemanager_delete_directory($dir)
{
@ -397,8 +427,9 @@ function filemanager_delete_directory($dir)
* Read a directory recursibly and return a array with the files with
* the absolute path and relative
*
* @param string $dir absoute dir to scan
* @param string $relative_path Relative path to scan, by default ''
* @param string $dir Absoute dir to scan.
* @param string $relative_path Relative path to scan, by default ''.
* @param boolean $add_empty_dirs Add empty dirs.
*
* @return array The files in the dirs, empty array for empty dir of files.
*/
@ -406,14 +437,14 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
{
$return = [];
// Windows compatibility
// Windows compatibility.
$dir = str_replace('\\', '/', $dir);
$relative_path = str_replace('\\', '/', $relative_path);
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if (($entry != '.') && ($entry != '..')) {
if (is_dir($dir.$entry)) {
if (($entry !== '.') && ($entry !== '..')) {
if (is_dir($dir.$entry) === true) {
$return[] = [
'relative' => $relative_path.$entry,
'absolute' => $dir.$entry,
@ -449,14 +480,17 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
/**
* The main function to show the directories and files.
*
* @param string $real_directory The string of dir as realpath.
* @param string $relative_directory The string of dir as relative path.
* @param string $url The url to set in the forms and some links in the explorer.
* @param string $father The directory father don't navigate bottom this.
* @param boolean $editor The flag to set the edition of text files.
* @param string $url_file The url to put in the files instead the default. By default empty string and use the url of filemanager.
* @param boolean $download_button The flag to show download button, by default false.
* @param string $umask The umask as hex values to set the new files or updload.
* @param string $real_directory The string of dir as realpath.
* @param string $relative_directory The string of dir as relative path.
* @param string $url The url to set in the forms and some links in the explorer.
* @param string $father The directory father don't navigate bottom this.
* @param boolean $editor The flag to set the edition of text files.
* @param boolean $readOnly If true, only can read the files.
* @param string $url_file The url to put in the files instead the default. By default empty string and use the url of filemanager.
* @param boolean $download_button The flag to show download button, by default false.
* @param string $umask The umask as hex values to set the new files or updload.
* @param boolean $homedir_filemanager Homedir filemanager.
* @param boolean $allowCreateText If true, 'Create Text' button will be shown.
*/
function filemanager_file_explorer(
$real_directory,
@ -468,11 +502,12 @@ function filemanager_file_explorer(
$url_file='',
$download_button=false,
$umask='',
$homedir_filemanager=false
$homedir_filemanager=false,
$allowCreateText=true
) {
global $config;
// Windows compatibility
// Windows compatibility.
$real_directory = str_replace('\\', '/', $real_directory);
$relative_directory = str_replace('\\', '/', $relative_directory);
$father = str_replace('\\', '/', $father);
@ -481,10 +516,7 @@ function filemanager_file_explorer(
$homedir_filemanager = $config['homedir'];
}
$hack_metaconsole = '';
if (defined('METACONSOLE')) {
$hack_metaconsole = '../../';
}
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
?>
<script type="text/javascript">
@ -493,13 +525,13 @@ function filemanager_file_explorer(
$("#create_folder").css("display", "block");
check_opened_dialog('create_folder');
}
<?php if ($allowCreateText === true) : ?>
function show_create_text_file() {
actions_dialog('create_text_file');
$("#create_text_file").css("display", "block");
check_opened_dialog('create_text_file');
}
<?php endif ?>
function show_upload_file() {
actions_dialog('upload_file');
$("#upload_file").css("display", "block");
@ -512,12 +544,13 @@ function filemanager_file_explorer(
$('#create_folder').dialog('close');
}
}
<?php if ($allowCreateText === true) : ?>
if(check_opened !== 'create_text_file'){
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
$('#create_text_file').dialog('close');
}
}
<?php endif ?>
if(check_opened !== 'upload_file'){
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
$('#upload_file').dialog('close');
@ -532,11 +565,11 @@ function filemanager_file_explorer(
case 'create_folder':
title_action = "<?php echo __('Create a Directory'); ?>";
break;
<?php if ($allowCreateText === true) : ?>
case 'create_text_file':
title_action = "<?php echo __('Create a Text'); ?>";
break;
<?php endif ?>
case 'upload_file':
title_action = "<?php echo __('Upload Files'); ?>";
break;
@ -567,28 +600,21 @@ function filemanager_file_explorer(
}
</script>
<?php
// List files
if (! is_dir($real_directory)) {
// List files.
if (is_dir($real_directory) === false) {
echo __('Directory %s doesn\'t exist!', $relative_directory);
return;
}
$files = filemanager_list_dir($real_directory);
if (!empty($files)) {
if (empty($files) === false) {
$table = new stdClass();
$table->width = '100%';
$table->id = 'table_filemanager';
if (!defined('METACONSOLE')) {
$table->class = 'info_table';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
}
if (defined('METACONSOLE')) {
$table->class = 'databox_tactical';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
}
$table->class = (is_metaconsole() === true) ? 'databox_tactical' : 'info_table';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
$table->colspan = [];
$table->data = [];
$table->head = [];
@ -608,10 +634,12 @@ function filemanager_file_explorer(
$table->head[4] = __('Actions');
$prev_dir = explode('/', $relative_directory);
$count_prev_dir = count($prev_dir);
$prev_dir_str = '';
for ($i = 0; $i < (count($prev_dir) - 1); $i++) {
$prev_dir_count = count($prev_dir);
for ($i = 0; $i < ($prev_dir_count - 1); $i++) {
$prev_dir_str .= $prev_dir[$i];
if ($i < (count($prev_dir) - 2)) {
if ($i < ($prev_dir_count - 2)) {
$prev_dir_str .= '/';
}
}
@ -649,16 +677,16 @@ function filemanager_file_explorer(
break;
case MIME_UNKNOWN:
if ($fileinfo['size'] == 0) {
if ((int) $fileinfo['size'] === 0) {
if ((strstr($fileinfo['name'], '.txt') !== false) || (strstr($fileinfo['name'], '.conf') !== false) || (strstr($fileinfo['name'], '.sql') !== false) || (strstr($fileinfo['name'], '.pl') !== false)) {
$fileinfo['mime'] = MIME_TEXT;
$data[0] = html_print_image('images/mimetypes/text.png', true, ['title' => __('Text file'), 'class' => 'invert_filter']);
} else {
// unknow
// Unknown.
$data[0] = '';
}
} else {
// pdf
// Pdf.
$data[0] = '';
}
break;
@ -670,8 +698,8 @@ function filemanager_file_explorer(
if ($fileinfo['is_dir']) {
$data[1] = '<a href="'.$url.'&directory='.$relative_directory.'/'.$fileinfo['name'].'&hash2='.md5($relative_directory.'/'.$fileinfo['name'].$config['server_unique_identifier']).'">'.$fileinfo['name'].'</a>';
} else if (!empty($url_file)) {
// Set the custom url file
} else if (empty($url_file) === false) {
// Set the custom url file.
$url_file_clean = str_replace('[FILE_FULLPATH]', $fileinfo['realpath'], $url_file);
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>';
@ -681,9 +709,9 @@ function filemanager_file_explorer(
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
}
// Notice that uploaded php files could be dangerous
if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) == 'php'
&& (is_readable($fileinfo['realpath']) || is_executable($fileinfo['realpath']))
// Notice that uploaded php files could be dangerous.
if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) === 'php'
&& (is_readable($fileinfo['realpath']) === true || is_executable($fileinfo['realpath']) === true)
) {
$error_message = __('This file could be executed by any user');
$error_message .= '. '.__('Make sure it can\'t perform dangerous tasks');
@ -702,12 +730,13 @@ function filemanager_file_explorer(
}
// Actions buttons
// Delete button
// Delete button.
$data[4] = '';
$data[4] .= '<span style="display: flex">';
$typefile = array_pop(explode('.', $fileinfo['name']));
if (is_writable($fileinfo['realpath'])
&& (! is_dir($fileinfo['realpath']) || count(scandir($fileinfo['realpath'])) < 3) && (!$readOnly)
if (is_writable($fileinfo['realpath']) === true
&& (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3)
&& ($readOnly === false)
) {
$data[4] .= '<form method="post" action="'.$url.'" style="">';
$data[4] .= '<input type="image" class="invert_filter" src="images/cross.png" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
@ -717,7 +746,7 @@ function filemanager_file_explorer(
$relative_dir = str_replace($homedir_filemanager, '', str_replace('\\', '/', dirname($fileinfo['realpath'])));
if ($relative_dir[0] == '/') {
if ($relative_dir[0] === '/') {
$relative_dir = substr($relative_dir, 1);
}
@ -727,9 +756,9 @@ function filemanager_file_explorer(
$data[4] .= html_print_input_hidden('hash2', $hash2, true);
$data[4] .= '</form>';
if (($editor) && (!$readOnly)) {
if (($typefile != 'bin') && ($typefile != 'pdf') && ($typefile != 'png') && ($typefile != 'jpg')
&& ($typefile != 'iso') && ($typefile != 'docx') && ($typefile != 'doc') && ($fileinfo['mime'] != MIME_DIR)
if (($editor) && ($readOnly === false)) {
if (($typefile !== 'bin') && ($typefile !== 'pdf') && ($typefile !== 'png') && ($typefile !== 'jpg')
&& ($typefile !== 'iso') && ($typefile !== 'docx') && ($typefile !== 'doc') && ($fileinfo['mime'] != MIME_DIR)
) {
$hash = md5($fileinfo['realpath'].$config['server_unique_identifier']);
$data[4] .= "<a style='vertical-align: top;' href='$url&edit_file=1&hash=".$hash.'&location_file='.$fileinfo['realpath']."' style='float: left;'>".html_print_image('images/edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file'), 'class' => 'invert_filter']).'</a>';
@ -758,9 +787,9 @@ function filemanager_file_explorer(
);
}
if (!$readOnly) {
if (is_writable($real_directory)) {
// The buttons to make actions
if ($readOnly === false) {
if (is_writable($real_directory) === true) {
// The buttons to make actions.
$tabs_dialog = '<ul id="file_table_modal">
<li class="create_folder">
<a href="javascript: show_form_create_folder();">'.html_print_image(
@ -772,18 +801,24 @@ function filemanager_file_explorer(
]
).'<span>'.__('Create a Directory').'</span>
</a>
</li>
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create a Text'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Text').'</span>
</a>
</li>
</li>';
if ($allowCreateText === true) {
$tabs_dialog .= '
<li class="create_text_file">
<a href="javascript: show_create_text_file();">'.html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create a Text'),
'class' => 'invert_filter',
]
).'<span>'.__('Create a Text').'</span>
</a>
</li>';
}
$tabs_dialog .= '
<li class="upload_file">
<a href="javascript: show_upload_file();">'.html_print_image(
'images/upload_file.png',
@ -794,7 +829,9 @@ function filemanager_file_explorer(
]
).'<span>'.__('Upload Files').'</span>
</a>
</li></ul>';
</li>';
$tabs_dialog .= '</ul>';
echo '<div id="create_folder" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).'</form></div>';
@ -802,8 +839,10 @@ function filemanager_file_explorer(
echo '<div id="upload_file" class="invisible"> '.$tabs_dialog.'
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
if ($allowCreateText === true) {
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
}
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
@ -818,16 +857,18 @@ function filemanager_file_explorer(
);
echo '</a>';
echo "<a href='javascript: show_create_text_file();'>";
echo html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create text'),
'class' => 'invert_filter',
]
);
echo '</a>';
if ($allowCreateText === true) {
echo "<a href='javascript: show_create_text_file();'>";
echo html_print_image(
'images/create_file.png',
true,
[
'title' => __('Create text'),
'class' => 'invert_filter',
]
);
echo '</a>';
}
echo "<a href='javascript: show_upload_file();'>";
echo html_print_image(
@ -855,18 +896,17 @@ function filemanager_file_explorer(
/**
* Check if a directory is writable.
*
* @param string Directory path to check.
* @param bool If set, it will try to make the directory writeable if it's not.
* @param string $filepath Directory path to check.
*
* @param bool Wheter the directory is writeable or not.
* @return boolean Wheter the directory is writeable or not.
*/
function filemanager_get_file_info($filepath)
function filemanager_get_file_info(string $filepath)
{
global $config;
$realpath = realpath($filepath);
$filepath = str_replace('\\', '/', $filepath);
// Windows compatibility
// Windows compatibility.
$info = [
'mime' => MIME_UNKNOWN,
'mime_extend' => mime_content_type($filepath),
@ -904,10 +944,9 @@ function filemanager_get_file_info($filepath)
/**
* Check if a directory is writable.
*
* @param string Directory path to check.
* @param bool If set, it will try to make the directory writeable if it's not.
* @param string $dirpath Directory path to check.
*
* @param bool Wheter the directory is writeable or not.
* @return array List with files.
*/
function filemanager_list_dir($dirpath)
{
@ -917,8 +956,8 @@ function filemanager_list_dir($dirpath)
$dirs = [];
$dir = opendir($dirpath);
while ($file = @readdir($dir)) {
// Ignore hidden files
if ($file[0] == '.') {
// Ignore hidden files.
if ($file[0] === '.') {
continue;
}
@ -953,9 +992,18 @@ function filemanager_safe_directory(
// Safe output.
$directory = io_safe_output($directory);
$forbiddenAttempting = false;
// Banned directories.
$bannedDirectory = [
'include',
'godmode',
'operation',
'reporting',
'general',
ENTERPRISE_DIR,
];
if ((bool) preg_match('/(\.){1,2}/', $directory) !== false) {
$directory = preg_replace('/(\.){1,2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
if ((bool) preg_match('/(\.){2}/', $directory) !== false) {
$directory = preg_replace('/(\.){2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
$forbiddenAttempting = true;
}
@ -964,9 +1012,15 @@ function filemanager_safe_directory(
$forbiddenAttempting = true;
}
if (in_array($directory, $bannedDirectory) === true) {
// Setted images for default (usually in file manager).
$directory = (empty($safedDirectory) === false) ? $safedDirectory : 'images';
$forbiddenAttempting = true;
}
if ($forbiddenAttempting === true) {
db_pandora_audit('File manager', 'Attempting to use a forbidden file or directory name');
}
return $directory;
}
}

View File

@ -3755,7 +3755,7 @@ function graph_custom_sql_graph(
0,
floor($SQL_GRAPH_MAX_LABEL_SIZE / 2)
);
$label .= '...';
$label .= '...<br>';
$label .= substr(
$first_label,
floor(-$SQL_GRAPH_MAX_LABEL_SIZE / 2)

View File

@ -436,6 +436,7 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip
* @param string $size Style, size (width) of element.
* @param boolean $simple_multiple_options Discovery simple multiple inputs.
* @param boolean $required Required input.
* @param string $inverse Change All to None with inverse condition.
*
* @return string HTML code if return parameter is true.
*/
@ -462,7 +463,8 @@ function html_print_select_groups(
$include_groups=false,
$size=false,
$simple_multiple_options=false,
$required=false
$required=false,
$inverse=''
) {
$output = '';
@ -522,7 +524,11 @@ function html_print_select_groups(
if (empty($selected) === false) {
$fields = [ $selected => groups_get_name($selected) ];
} else if ($returnAllGroup === true && $multiple === false) {
$fields = [ $selected => groups_get_name(null, true) ];
if ($selected === 0 && $inverse !== '') {
$fields = [ $selected => 'None' ];
} else {
$fields = [ $selected => groups_get_name(null, true) ];
}
}
} else {
foreach ($selected as $k) {
@ -595,7 +601,9 @@ function html_print_select_groups(
</style>
<script type="text/javascript">
$(document).ready(function() {
$('select[name="<?php echo $name; ?>"]').each(
function() {
$(this).select2({
@ -625,6 +633,7 @@ function html_print_select_groups(
inclusions: '<?php echo $json_inclusions; ?>',
step: params.page || 1,
strict: "<?php echo $strict_user; ?>",
not_condition: $('#not_condition_switch').prop('checked'),
returnAllGroup: <?php echo (int) $returnAllGroup; ?>
}
@ -781,7 +790,7 @@ function html_print_select(
$required = 'required';
}
$output .= '<select '.$required.' id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
$output .= '<select '.$required.' onclick="'.$script.'" id="'.$id.'" name="'.$name.'"'.$attributes.' '.$styleText.'>';
if ($nothing !== false) {
if ($nothing != '' || empty($fields)) {
@ -1765,6 +1774,12 @@ function html_print_extended_select_for_post_process(
$uniq_name = $name;
}
$style = 'font-size: xx-small;';
if ($select_style !== false) {
$style .= sprintf(' %s', $select_style);
}
ob_start();
echo '<div id="'.$uniq_name.'_default" style="w100p inline_line">';
@ -1780,7 +1795,7 @@ function html_print_extended_select_for_post_process(
false,
'',
$disabled,
'font-size: xx-small;'.$select_style
$style
);
echo ' <a href="javascript:">'.html_print_image(
'images/pencil.png',
@ -1831,20 +1846,20 @@ function html_print_extended_select_for_post_process(
/**
* Render a pair of select for times and text box for set the time more fine.
*
* @param string $name Select form name
* @param variant $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple)
* @param string $name Select form name.
* @param mixed $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple).
* @param string $script Javascript onChange (select) code.
* @param string $nothing Label when nothing is selected.
* @param variant $nothing_value Value when nothing is selected
* @param mixed $nothing_value Value when nothing is selected.
* @param integer $size Size of the input.
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard)
* @param boolean $unique_name
* @param string $class
* @param boolean $readonly
* @param string $custom_fields
* @param string $style_icon
* @param boolean $no_change
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard).
* @param boolean $unique_name Uunique name value.
* @param string $class Class value.
* @param boolean $readonly Readonly value.
* @param string $custom_fields Custom fields value.
* @param string $style_icon Style icon value.
* @param boolean $no_change No change value.
* @param boolean $allow_zero Allow the use of the value zero.
* @return string HTML code if return parameter is true.
@ -1926,7 +1941,7 @@ function html_print_extended_select_for_time(
ob_start();
// Use the no_meta parameter because this image is only in the base console.
echo '<div id="'.$uniq_name.'_default" class="wauto inline_line">';
echo '<div id="'.$uniq_name.'_default" class="wauto inline_flex">';
html_print_select(
$fields,
$uniq_name.'_select',
@ -2015,13 +2030,14 @@ function html_print_extended_select_for_time(
/**
* Print selects to configure the cron of a module.
*
* @param string Run hour.
* @param string Run minute.
* @param string Run day of the month.
* @param string Run month.
* @param string Run day of the week.
* @param bool Whether to return an output string or echo now (optional, echo by default).
* @param bool Print cron grayed
* @param string $hour Run hour.
* @param string $minute Run minute.
* @param string $mday Run day of the month.
* @param string $month Run month.
* @param string $wday Run day of the week.
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param boolean $disabled If true, the control will show disabled.
* @param boolean $to Print cron grayed.
*
* @return string HTML code if return parameter is true.
*/
@ -4805,7 +4821,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['style']) === true) ? $data['selected'] : false),
((isset($data['unique']) === true) ? $data['unique'] : false)
((isset($data['unique']) === true) ? $data['unique'] : false),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['readonly']) === true) ? $data['readonly'] : false),
((isset($data['custom_fields']) === true) ? $data['custom_fields'] : false),
((isset($data['style_icon']) === true) ? $data['style_icon'] : '')
);
break;
@ -5271,7 +5291,7 @@ function html_print_tabs(array $tabs)
* Create a datalist.
*
* @param string $id Use custom id.
* @param string $values Input values.
* @param array $values Input values.
* @param string $returnparam Whether to return an output string or echo now (optional, echo by default).
*
* @return string HTML code if return parameter is true.

File diff suppressed because it is too large Load Diff

View File

@ -4334,14 +4334,6 @@ function reporting_html_general($table, $item, $pdf=0)
$table1->style[2] = 'text-align: center';
$table1->style[3] = 'text-align: center';
// Begin - Order by agent.
foreach ($item['data'] as $key => $row) {
$aux[$key] = $row['agent'];
}
array_multisort($aux, SORT_ASC, $item['data']);
// End - Order by agent.
foreach ($item['data'] as $row) {
if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) {
$row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN);

View File

@ -705,7 +705,7 @@ function tags_get_tags_formatted($tags_array, $get_url=true)
$tags = [];
foreach ($tags_array as $t) {
$tag_url = explode(' ', trim($t));
$tag = $tag_url[0];
$tag = io_safe_output($tag_url[0]);
if (isset($tag_url[1]) && $tag_url[1] != '' && $get_url) {
$title = $tag_url[1];
// $link = '<a href="'.$tag_url[1].'" target="_blank">'.html_print_image('images/zoom.png',true, array('alt' => $title, 'title' => $title)).'</a>';

View File

@ -1041,7 +1041,7 @@ function ui_format_alert_row(
$styleDisabled = '';
}
if (empty($alert)) {
if (empty($alert) === true) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
return [
'',
@ -1066,7 +1066,7 @@ function ui_format_alert_row(
}
}
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) {
@ -1087,7 +1087,7 @@ function ui_format_alert_row(
$data = [];
// Validate checkbox.
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
if (check_acl($config['id_user'], $id_group, 'LW')
|| check_acl($config['id_user'], $id_group, 'LM')
) {
@ -1106,7 +1106,7 @@ function ui_format_alert_row(
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if (is_metaconsole()) {
if (is_metaconsole() === true && (int) $alert['server_data']['id'] !== 0) {
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
@ -1121,14 +1121,14 @@ function ui_format_alert_row(
$data[$index['policy']] = '';
} else {
$img = 'images/policies_mc.png';
if (!is_metaconsole()) {
if (is_metaconsole() === false) {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
} else {
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
}
}
if (is_metaconsole()) {
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
}
@ -1139,7 +1139,7 @@ function ui_format_alert_row(
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
}
if (!defined('METACONSOLE')) {
if (is_metaconsole() === false) {
// Force alert execution.
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
if ($alert['force_execution'] == 0) {
@ -1154,7 +1154,7 @@ function ui_format_alert_row(
if ($agent == 0) {
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
} else {
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$agent_name = $alert['agent_name'];
$id_agent = $alert['id_agent'];
} else {
@ -1162,7 +1162,7 @@ function ui_format_alert_row(
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
}
if (defined('METACONSOLE') || !can_user_access_node()) {
if (is_metaconsole() === true || !can_user_access_node()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', '');
} else {
if ($agent_style !== false) {
@ -1179,7 +1179,7 @@ function ui_format_alert_row(
$data[$index['description']] = '';
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$data[$index['template']] .= '<a class="template_details" href="'.ui_get_full_url('/', false, false, false).'/ajax.php?page=enterprise/meta/include/ajax/tree_view.ajax&action=get_template_tooltip&id_template='.$template['id'].'&server_name='.$alert['server_data']['server_name'].'">';
} else {
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
@ -1196,7 +1196,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
if (!empty($actions)) {
if (empty($actions) === false) {
$actionText = '<div><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];
@ -5738,7 +5738,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
$attrs['style'] = 'background: url('.$icon_image.') no-repeat right; '.$text_color.'';
$attrs['style'] = 'padding-right: 20px; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -0,0 +1,459 @@
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/* globals d3 */
/* globals jQuery */
/* globals $ */
/*-----------------------------------------------*/
/*-------------------Constants-------------------*/
/*-----------------------------------------------*/
var MAX_ZOOM_LEVEL = 5;
/*-----------------------------------------------*/
/*------------------Constructor------------------*/
/*-----------------------------------------------*/
var SimpleMapController = function(params) {
if (!params) {
console.log("[SimpleMapController]: No params received");
return this;
}
this._target = params["target"];
if (typeof params["map_width"] == "undefined") {
this.map_width = 0;
} else {
this.map_width = params["map_width"];
}
if (typeof params["map_height"] == "undefined") {
this.map_height = 0;
} else {
this.map_height = params["map_height"];
}
if (typeof params["font_size"] == "undefined") {
this.font_size = 20;
} else {
this.font_size = params["font_size"];
}
if (typeof params["homedir"] == "undefined") {
this.homedir = "";
} else {
this.homedir = params["homedir"];
}
if (typeof params["custom_params"] == "undefined") {
this.custom_params = "";
} else {
this.custom_params = params["custom_params"];
}
if (typeof params["center_x"] == "undefined") {
this.center_x = 0;
} else {
this.center_x = params["center_x"];
}
if (typeof params["center_y"] == "undefined") {
this.center_y = 0;
} else {
this.center_y = params["center_y"];
}
if (typeof params["z_dash"] == "undefined") {
this.z_dash = 0.5;
} else {
this.z_dash = params["z_dash"];
}
if (typeof params["nodes"] == "undefined") {
this.nodes = [];
} else {
this.nodes = params["nodes"];
}
if (typeof params["arrows"] == "undefined") {
this.arrows = [];
} else {
this.arrows = params["arrows"];
}
var factor = $(this._target).width() / $(this._target).height();
// Center is about complete SVG map not only central node.
// Calculus is to leave same space on left-right (width)
// and top-bottom (height).
this.center_x = ($(this._target).width() - this.map_width * factor) / 2;
this.center_y = ($(this._target).height() - this.map_height * factor) / 2;
};
/*-----------------------------------------------*/
/*------------------Atributes--------------------*/
/*-----------------------------------------------*/
SimpleMapController.prototype._viewport = null;
SimpleMapController.prototype._zoomManager = null;
/*-----------------------------------------------*/
/*--------------------Methods--------------------*/
/*-----------------------------------------------*/
/**
* Function init_trans_map
* Return void
* This function init the transactional map
*/
SimpleMapController.prototype.init_map = function() {
var self = this;
var svg = d3.select(self._target + " svg");
self._zoomManager = d3.behavior
.zoom()
.scale(self.z_dash)
.scaleExtent([1 / MAX_ZOOM_LEVEL, MAX_ZOOM_LEVEL])
.on("zoom", zoom);
self._viewport = svg
.call(self._zoomManager)
.append("g")
.attr("class", "viewport")
.attr("transform", "translate(0, 0) scale(" + self.z_dash + ")");
self._slider = d3
.select(self._target + " .zoom_controller .vertical_range")
.property("value", 0)
.property("min", -Math.log(MAX_ZOOM_LEVEL))
.property("max", Math.log(MAX_ZOOM_LEVEL))
.property("step", (Math.log(MAX_ZOOM_LEVEL) * 2) / MAX_ZOOM_LEVEL)
.on("input", slided);
/**
* Function zoom
* Return void
* This function manages the zoom
*/
function zoom() {
self.last_event = "zoom";
var zoom_level = d3.event.scale;
self._slider.property("value", Math.log(zoom_level));
self._viewport.attr(
"transform",
"translate(" + d3.event.translate + ") scale(" + zoom_level + ")"
);
}
/**
* Function slided
* Return void
* This function manages the slide (zoom system)
*/
function slided() {
var slider_value = parseFloat(self._slider.property("value"));
var zoom_level = Math.exp(slider_value);
/*----------------------------------------------------------------*/
/*-Code to translate the map with the zoom for to hold the center-*/
/*----------------------------------------------------------------*/
var center = [
parseFloat(d3.select(self._target).style("width")) / 2,
parseFloat(d3.select(self._target).style("height")) / 2
];
var old_translate = self._zoomManager.translate();
var old_scale = self._zoomManager.scale();
var temp1 = [
(center[0] - old_translate[0]) / old_scale,
(center[1] - old_translate[1]) / old_scale
];
var temp2 = [
temp1[0] * zoom_level + old_translate[0],
temp1[1] * zoom_level + old_translate[1]
];
var new_translation = [
old_translate[0] + center[0] - temp2[0],
old_translate[1] + center[1] - temp2[1]
];
self._zoomManager
.scale(zoom_level)
.translate(new_translation)
.event(self._viewport);
}
self.paint_arrows();
self.paint_nodes();
};
SimpleMapController.prototype.paint_nodes = function() {
var self = this;
if (self.nodes != null) {
// Initialize objects.
var circle_elem = self._viewport
.selectAll(".node")
.data(self.nodes)
.enter()
.append("g")
.attr("id", function(d) {
return "node_" + d["id"];
})
.attr("transform", function(d) {
return "translate(" + d["x"] + ", " + d["y"] + ")";
})
.attr("class", "draggable node")
.attr("image", function(d) {
return d["image"];
})
.attr("style", function(d) {
return (
"fill: " + d["color"] + "; " + "stroke: " + d["stroke-color"] + ";"
);
})
.attr("stroke-width", function(d) {
return d["stroke-width"];
})
.style("cursor", function(d) {
if (d["id"] === "0") {
return "default";
} else {
return "pointer";
}
});
// Node size in map.
circle_elem
.append("circle")
.attr("cx", self.center_x)
.attr("cy", function(d) {
return self.center_y + d["radius"];
})
.attr("r", function(d) {
return d["radius"];
});
circle_elem.each(function(node, index) {
if (Array.isArray(node["label"])) {
node["label"].forEach(function(value, index2) {
d3.selectAll("#node_" + index)
.append("text")
.attr("dx", function(d) {
if (typeof d["label_x_offset"] == "undefined") {
d["label_x_offset"] = 0;
}
return self.center_x + d["label_x_offset"];
})
.attr("dy", function(d) {
if (typeof d["font_size"] == "undefined") {
d["font_size"] = self.font_size;
}
if (typeof d["label_y_offset"] == "undefined") {
d["label_y_offset"] = d["radius"] + d["font_size"];
}
return (
self.center_y +
d["radius"] +
d["label_y_offset"] +
index2 * d["font_size"]
);
})
.style("text-anchor", "middle")
.style("font-size", function(d) {
if (typeof d["font_size"] == "undefined") {
d["font_size"] = self.font_size;
}
return d["font_size"] + "px";
})
.style("stroke-width", 0)
.attr("fill", "black")
.text(value);
});
} else {
circle_elem
.append("text")
.attr("dx", function(d) {
if (typeof d["label_x_offset"] == "undefined") {
d["label_x_offset"] = 0;
}
return self.center_x + d["label_x_offset"];
})
.attr("dy", function(d) {
if (typeof d["font_size"] == "undefined") {
d["font_size"] = self.font_size;
}
if (typeof d["label_y_offset"] == "undefined") {
d["label_y_offset"] = d["radius"] + d["font_size"];
}
return self.center_y + d["radius"] + d["label_y_offset"];
})
.style("text-anchor", "middle")
.style("font-size", function(d) {
if (typeof d["font_size"] == "undefined") {
d["font_size"] = self.font_size;
}
return d["font_size"] + "px";
})
.style("stroke-width", 0)
.attr("fill", "black")
.text(function(d) {
return d["label"];
});
}
});
}
// Node image.
circle_elem
.append("svg:image")
.attr("class", "node_image")
.attr("xlink:href", function(d) {
return d["image"];
})
.attr("x", function(d) {
if (typeof d["size_image"] != "undefined") {
return self.center_x - d["size_image"] / 2;
} else {
return self.center_x - 52 / 2;
}
})
.attr("y", function(d) {
if (typeof size_image != "undefined") {
return self.center_y + d["radius"] - d["size_image"] / 2;
} else {
return self.center_y + d["radius"] - 52 / 2;
}
})
.attr("width", function(d) {
return d["image_width"];
})
.attr("height", function(d) {
return d["image_height"];
});
// Tooltipster. This could be dynamic.
self.nodes.forEach(function(node) {
if (node["id_agent"] != 0) {
$("#node_" + node["id"]).tooltipster({
contentAsHTML: true,
onlyOne: true,
updateAnimation: null,
interactive: true,
trigger: "click",
content: $('<img src="' + self.homedir + '/images/spinner.gif"/>'),
functionReady: function() {
$("#node_" + node["id"]).tooltipster("open");
$(".tooltipster-content").css("background", "#FFF");
$(".tooltipster-content").css("color", "#000");
var params = self.custom_params;
// Add data node click.
params.node_data = node;
params["id_agent"] = node["id_agent"];
jQuery.ajax({
data: params,
dataType: "html",
type: "POST",
url: self.homedir + "/ajax.php",
success: function(data) {
$(".tooltipster-content").css("min-height", "330px");
$(".tooltipster-content").css("max-height", "500px");
$("#node_" + node["id"]).tooltipster("content", data);
}
});
}
});
}
});
};
SimpleMapController.prototype.paint_arrows = function() {
var self = this;
if (self.arrows != null) {
self._viewport
.selectAll(".arrow")
.data(self.arrows)
.enter()
.append("g")
.attr("class", "arrow")
.attr("to", function(d) {
return d["dest"];
})
.attr("from", function(d) {
return d["orig"];
})
.attr("style", "fill: rgb(50, 50, 128);")
.append("line")
.attr("stroke", "#373737")
.attr("stroke-width", 3)
.attr("x1", function(d) {
return self.center_x + self.getFirstPoint(d["orig"], "x");
})
.attr("y1", function(d) {
return self.center_y + self.getFirstPoint(d["orig"], "y");
})
.attr("x2", function(d) {
return self.center_x + self.getSecondPoint(d["dest"], "x");
})
.attr("y2", function(d) {
return self.center_y + self.getSecondPoint(d["dest"], "y");
});
}
};
SimpleMapController.prototype.getFirstPoint = function(orig, coord) {
var self = this;
var point = 0;
self.nodes.forEach(function(node) {
if (node["id"] === orig) {
if (coord == "x") {
point = parseFloat(node["x"]);
return;
} else {
point = parseFloat(node["y"]) + node["radius"];
return;
}
}
});
return point;
};
SimpleMapController.prototype.getSecondPoint = function(dest, coord) {
var self = this;
var point = 0;
self.nodes.forEach(function(node) {
if (node["id"] === dest) {
if (coord == "x") {
point = parseFloat(node["x"]);
return;
} else {
point = parseFloat(node["y"]) + node["radius"];
return;
}
}
});
return point;
};

View File

@ -1333,9 +1333,13 @@ function defineTinyMCE(added_config) {
theme_advanced_buttons1: buttons1,
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "none",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
convert_urls: false,
element_format: "html"
element_format: "html",
object_resizing: true,
autoresize_bottom_margin: 50,
autoresize_on_init: true
});
if (!isEmptyObject(added_config)) {
@ -1385,6 +1389,8 @@ function removeTinyMCE(elementID) {
function addTinyMCE(elementID) {
if (elementID.length > 0 && !isEmptyObject(tinyMCE))
tinyMCE.EditorManager.execCommand("mceAddControl", true, elementID);
tinyMCE.EditorManager.execCommand("mceAutoResize");
tinymce.EditorManager.execCommand("mceTableSizingMode", false, "responsive");
}
function toggle_full_value(id) {

View File

@ -12,7 +12,6 @@ function parse_alert_command(command, classs) {
// Only render values different from ''
var field = "_field" + nfield + "_";
var regex = new RegExp(field, "gi");
console.log($(this).val());
if ($(this).val() == "") {
if (
classs == "fields_recovery" &&

View File

@ -948,6 +948,133 @@ function processTreeSearch(settings) {
});
}
function processServiceTree(settings) {
var treeController = TreeController.getController();
if (
typeof treeController.recipient != "undefined" &&
treeController.recipient.length > 0
)
treeController.recipient.empty();
$(".loading_tree").show();
var parameters = {};
parameters["page"] = "include/ajax/tree.ajax";
parameters["getChildren"] = 1;
parameters["type"] = "services";
parameters["filter"] = {};
parameters["filter"]["searchGroup"] = "";
parameters["filter"]["searchAgent"] = "";
parameters["filter"]["statusAgent"] = "";
parameters["filter"]["searchModule"] = "";
parameters["filter"]["statusModule"] = "";
parameters["filter"]["groupID"] = "";
parameters["filter"]["tagID"] = "";
parameters["filter"]["searchHirearchy"] = 1;
parameters["filter"]["show_not_init_agents"] = 1;
parameters["filter"]["show_not_init_modules"] = 1;
parameters["filter"]["is_favourite"] = 0;
parameters["filter"]["width"] = 100;
$.ajax({
type: "POST",
url: settings.ajaxURL,
data: parameters,
success: function(data) {
if (data.success) {
$(".loading_tree").hide();
// Get the main values of the tree.
var rawTree = Object.values(data.tree);
// Sorting tree by description (TreeController.js).
rawTree.sort(function(a, b) {
var x = a.description.toLowerCase();
var y = b.description.toLowerCase();
if (x < y) {
return -1;
}
if (x > y) {
return 1;
}
return 0;
});
treeController.init({
recipient: $("div#container_servicemap_" + settings.cellId),
detailRecipient: {
render: function(element, data) {
return {
open: function() {
$("#module_details_window")
.hide()
.empty()
.append(data)
.dialog({
resizable: true,
draggable: true,
modal: true,
title: "Info",
overlay: {
opacity: 0.5,
background: "black"
},
width: 450,
height: 500
});
}
};
}
},
page: parameters["page"],
emptyMessage: "No data found",
foundMessage: "Found groups",
tree: rawTree,
baseURL: settings.baseURL,
ajaxURL: settings.ajaxURL,
filter: parameters["filter"],
counterTitles: {
total: {
agents: "Total agents",
modules: "Total modules",
none: "Total"
},
alerts: {
agents: "Fired alerts",
modules: "Fired alerts",
none: "Fired alerts"
},
critical: {
agents: "Critical agents",
modules: "Critical modules')",
none: "Critical"
},
warning: {
agents: "Warning agents",
modules: "Warning modules",
none: "Warning"
},
unknown: {
agents: "Unknown agents",
modules: "Unknown modules",
none: "Unknown"
},
not_init: {
agents: "Not init agents",
modules: "Not init modules",
none: "Not init"
},
ok: {
agents: " Normal agents ",
modules: " Normal modules ",
none: " Normal "
}
}
});
}
},
dataType: "json"
});
}
function show_module_detail_dialog(
module_id,
id_agent,

View File

@ -66,16 +66,26 @@ function snmpBrowse() {
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$("#spinner").css("display", "none");
$("#snmp_browser").html(
"<p>Status: " +
var htmlError = "";
if (XMLHttpRequest.responseText) {
htmlError =
"<p><b>Status:</b> " +
textStatus +
"</p><p>" +
"Error: " +
errorThrown +
"</p><p>" +
XMLHttpRequest.responseText +
"</p>"
);
"</p>";
} else {
htmlError =
"<p><b>Status:</b> " +
textStatus +
"</p><p>" +
"<b>Error:</b> " +
errorThrown +
"</p>";
}
$("#snmp_browser").html(htmlError);
}
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -352,6 +352,14 @@ class Widget
$className .= '\ServiceMapWidget';
break;
case 'service_view':
if (\enterprise_installed() === false) {
$not_installed = true;
}
$className .= '\ServiceViewWidget';
break;
case 'single_graph':
$className .= '\SingleGraphWidget';
break;

View File

@ -354,6 +354,7 @@ class CustomGraphWidget extends Widget
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];

View File

@ -613,6 +613,8 @@ class EventsListWidget extends Widget
'tg.nombre as group_name',
];
$home_url = $config['homeurl'];
if ((bool) \is_metaconsole() === false
|| $this->nodeId > 0
) {
@ -676,6 +678,14 @@ class EventsListWidget extends Widget
$table->size = [];
$table->rowclass = [];
// If its node, get direccion value and construct rute.
if ($this->nodeId !== null && $this->nodeId > 0) {
metaconsole_restore_db();
$result = db_get_all_rows_sql('SELECT server_url FROM tmetaconsole_setup WHERE id = '.$this->nodeId.'');
$home_url = $result[0]['server_url'];
metaconsole_connect(null, $this->nodeId);
}
foreach ($events as $event) {
$data = [];
$event['evento'] = \io_safe_output($event['evento']);
@ -684,8 +694,8 @@ class EventsListWidget extends Widget
$agent_alias = \agents_get_alias($event['id_agente']);
if ($agent_alias !== '') {
$data[1] = '<a href="'.$config['homeurl'];
$data[1] .= 'index.php?sec=estado';
$data[1] = '<a href="'.$home_url;
$data[1] .= '/index.php?sec=estado';
$data[1] .= '&sec2=operation/agentes/ver_agente';
$data[1] .= '&id_agente='.$event['id_agente'];
$data[1] .= '" title="'.$event['evento'].'">';

View File

@ -325,6 +325,8 @@ class GraphModuleHistogramWidget extends Widget
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];

View File

@ -285,7 +285,6 @@ class NetworkMapWidget extends Widget
null,
null,
true,
false,
$return_all_group
);
@ -438,7 +437,7 @@ class NetworkMapWidget extends Widget
$settings = \json_encode(
[
'cellId' => $this->cellId,
'page' => 'enterprise/include/ajax/map_enterprise.ajax',
'page' => 'include/ajax/map_enterprise.ajax',
'url' => ui_get_full_url('ajax.php'),
'networkmap_id' => $id_networkmap,
'x_offset' => $x_offset,

View File

@ -0,0 +1,471 @@
<?php
/**
* Widget Tree view Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Tree view
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation 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\Dashboard\Manager;
/**
* Tree view Widgets.
*/
class ServiceViewWidget 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;
/**
* Dashboard ID.
*
* @var integer
*/
protected $dashboardId;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* 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;
ui_require_css_file('tree');
ui_require_css_file('fixed-bottom-box');
// Includes.
enterprise_include_once('/include/functions_services.php');
enterprise_include_once('/include/functions_servicemap.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;
// Cell Id.
$this->cellId = $cellId;
// Widget ID.
$this->widgetId = $widgetId;
// Dashboard ID.
$this->dashboardId = $dashboardId;
// 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 View');
// Name.
if (empty($this->name) === true) {
$this->name = 'service_view';
}
// // This forces at least a first configuration.
// $this->configurationRequired = false;
// if (empty($this->values['serviceId']) === true) {
// $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['type']) === true) {
$values['type'] = $decoder['type'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
$values = $this->values;
if (empty($values['type']) === true) {
$values['type'] = 'tree';
}
// Type services view.
$fields = [
'tree' => __('Tree'),
'table' => __('Table'),
];
$inputs[] = [
'label' => __('Type'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'type',
'selected' => $values['type'],
'return' => true,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['type'] = \get_parameter('type', 'tree');
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$values = $this->values;
$size = parent::getSize();
$output = '';
if ($values['type'] === 'tree' || empty($values['type'])) {
if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">';
$output .= \ui_print_error_message(
__('The user doesn\'t have permission to read agents'),
'',
true
);
$output .= '</div>';
return $output;
}
$containerId = 'container_servicemap_'.$this->cellId;
$output .= "<div id='".$containerId."' class='tree-controller-recipient'>";
$output .= '</div>';
$output .= \html_print_image(
'images/spinner.gif',
true,
[
'class' => 'loading_tree',
'style' => 'display: none;',
]
);
// Css Files.
\ui_require_css_file('tree', 'include/styles/', true);
if ($config['style'] == 'pandora_black') {
\ui_require_css_file('pandora_black', 'include/styles/', true);
}
\ui_require_javascript_file(
'TreeController',
'include/javascript/tree/',
true
);
\ui_require_javascript_file(
'fixed-bottom-box',
'include/javascript/',
true
);
$settings['cellId'] = $this->cellId;
$settings['baseURL'] = \ui_get_full_url('/', false, false, false);
$settings['ajaxURL'] = \ui_get_full_url('ajax.php', false, false, false);
// Show the modal window of an module.
$output .= '<div id="module_details_window" class="">';
$output .= '</div>';
// Script.
$output .= '<script type="text/javascript">';
$output .= 'processServiceTree('.json_encode($settings).');';
$output .= '</script>';
} else {
$own_info = \get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$display_all_services = true;
} else {
$display_all_services = false;
}
$order = [
'field' => 'name',
'field2' => 'name',
'order' => 'ASC',
];
$filter['order'] = $order;
$services = services_get_services(
$filter,
false,
$display_all_services,
'AR'
);
$output .= '<div class="white_box mgn_btt_20px mrgn_top_20px pddng_50px services_table" >';
$output .= '<div id="table_services_dashboard">';
foreach ($services as $service) {
switch ($service['status']) {
case SERVICE_STATUS_NORMAL:
$color = COL_NORMAL;
break;
case SERVICE_STATUS_CRITICAL:
$color = COL_CRITICAL;
break;
case SERVICE_STATUS_WARNING:
$color = COL_WARNING;
break;
case SERVICE_STATUS_UNKNOWN:
default:
$color = COL_UNKNOWN;
break;
}
$output .= '<a id="service_'.$service['id'].'" style="background-color: '.$color.'; color: #fff;" class="table_services_item_link_dashboard" href="index.php?'.'sec=network&'.'sec2=enterprise/operation/services/services&tab=service_map&'.'id_service='.$service['id'].'">
<div class="table_services_item">
<div style="width:50px; text-align:center;">';
$output .= \ui_print_group_icon($service['id_group'], true, 'groups_small_white', '', false);
$output .= '</div>
<div class="tooltip" style="color: #fff;position: relative;opacity: 1">'.$service['description'].'
</div>
<div class="tooltip" style="color: #fff;position: relative;opacity: 1">';
$output .= \html_print_image('images/help_w.png', true, ['class' => 'img_help', 'title' => __($service['name']), 'id' => $service['id']]);
$output .= '</div>
</div>
</a>';
}
$output .= '</div>';
$output .= '<table cellspacing="0" cellpadding="0">';
$output .= '<tr>';
$output .= '<td>';
$output .= '<div class="service_status" style=" background: '.COL_UNKNOWN.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_NORMAL.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_WARNING.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_CRITICAL.';"></div>';
$output .= '</td>';
$output .= '</tr><tr>';
$output .= '<td>';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Unknown</span></div>';
$output .= '</td>';
$output .= '<td >';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Normal</span></div>';
$output .= '</div>';
$output .= '<td>';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Warning</span></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div><span class="font_12px">Critical</span></div>';
$output .= '</td>';
$output .= '</tr>';
$output .= '</table>';
$output .= '</div>';
}
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Services view');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'service_view';
}
}

View File

@ -310,6 +310,7 @@ class SingleGraphWidget extends Widget
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];

View File

@ -335,6 +335,7 @@ class SLAPercentWidget extends Widget
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];

View File

@ -240,6 +240,7 @@ class TopNWidget extends Widget
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
'style_icon' => 'flex-grow: 0',
],
];

View File

@ -386,6 +386,7 @@ class Group extends Entity
$search = get_parameter('search', '');
$step = get_parameter('step', 1);
$limit = get_parameter('limit', false);
$not_condition = get_parameter('not_condition', false);
$exclusions = get_parameter('exclusions', '[]');
$inclusions = get_parameter('inclusions', '[]');
@ -430,6 +431,11 @@ class Group extends Entity
$return = self::prepareGroups($groups);
// When not_condition is select firts option text change All to None.
if ($not_condition === 'true') {
$return[0]['text'] = 'None';
}
if (is_array($return) === false) {
return;
}

View File

@ -379,6 +379,11 @@ final class Percentile extends Item
$moduleValue = \modules_get_last_value($moduleId);
if ($moduleValue === false) {
// Restore connection.
if ($nodeConnected === true) {
\metaconsole_restore_db();
}
throw new \InvalidArgumentException(
'error fetching the module value'
);

View File

@ -22,6 +22,7 @@
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
font-family: monospace;
}
.query_result_view_container {

View File

@ -166,15 +166,15 @@ div.target.flex {
text-align: center;
}
div#rules::after {
content: "Drop Here";
position: relative;
display: block;
margin: 2em auto;
font-size: 3em;
font-size: 2.5em;
color: #aaa;
overflow: hidden;
background: #fff;
text-align: center;
height: 100px;
}
div#rules.cleanup::after {
content: none;

View File

@ -1,11 +1,9 @@
/**
*
* Name: Default theme
* Pandora Stylesheet
*
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @category Stylesheet
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
@ -953,7 +951,7 @@ input.sub {
border-radius: 5px;
background-color: #fff;
background-repeat: no-repeat;
background-position: 92% 10px;
background-position: 92% 13px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
@ -4969,7 +4967,6 @@ input:checked + .p-slider:before {
#file_table_modal {
display: flex;
justify-content: space-between;
margin-bottom: 40px;
}
@ -5817,6 +5814,18 @@ div#status_pie {
margin-bottom: 30px;
}
#table_services_dashboard {
display: grid;
grid-gap: 20px;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
grid-template-rows: 1fr;
margin-bottom: 30px;
}
.services_table {
width: 97%;
}
.table_services_item_link {
font-size: 16px;
display: grid;
@ -5825,6 +5834,14 @@ div#status_pie {
padding: 10px 10px 10px 0;
}
.table_services_item_link_dashboard {
font-size: 16px;
display: grid;
min-height: 50px;
box-sizing: border-box;
padding: 10px 10px 10px 0;
}
.table_services_item {
display: grid;
align-items: center;
@ -7859,9 +7876,10 @@ div.graph div.legend table {
}
.model_log_viewer {
position: absolute;
bottom: 5px;
right: 0;
margin-top: 5px;
float: right;
margin-bottom: 0px;
margin-right: 0px;
}
.container_left_class {

View File

@ -63,6 +63,27 @@ table.agent_info_table tr {
color: #fff !important;
}
#um-next:hover,
#um-last:hover {
border: 1px solid #888 !important;
}
#um-next,
#um-last {
background-color: #111 !important;
color: #fff !important;
font-weight: 500;
border-radius: 5px;
background-repeat: no-repeat;
background-position: 92% 10px;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 15px;
border: 1px solid #333 !important;
cursor: pointer;
font-family: inherit;
font-size: 10pt;
}
input[readonly] {
background-color: #444 !important;
color: #a2a2a2 !important;
@ -465,7 +486,7 @@ pre,
/* update_manager.css */
div#box_online * {
color: #000;
color: #fff;
}
/* discovery.css */
@ -1161,7 +1182,18 @@ a.pandora_pagination,
padding-right: 35px;
background-color: #222;
}
#box_online {
background-image: url("../../images/update_pandora_black.jpg") !important;
background-position: left, left !important;
background-repeat: no-repeat;
background-color: #000 !important;
padding: 40px 50px;
border: 1px solid #111 !important;
border-radius: 5px;
min-height: 600px;
background-size: contain;
box-shadow: 1px 1px 4px rgba(160, 160, 160, 0.514);
}
.legend_background {
background-color: #222;
color: #fff !important;

File diff suppressed because one or more lines are too long

View File

@ -176,6 +176,12 @@ div#tree-controller-recipient {
margin-top: 10px;
}
.tree-controller-recipient {
text-align: left;
width: 98%;
margin-top: 10px;
}
.tree-node > .node-content > div + div:not(.tree-node-counters) {
margin-left: 3px;
}

File diff suppressed because one or more lines are too long

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