Merge remote-tracking branch 'origin/develop' into ent-12688-Mejoras-sistema-datos-de-demo-y-adaptar-al-nuevo-sistema-PRD

This commit is contained in:
alejandro.campos@artica.es 2024-02-23 10:24:26 +01:00
commit 06107f4773
150 changed files with 1370 additions and 422 deletions

View File

@ -122,6 +122,7 @@ module_min_critical 91
module_max_critical 0 module_max_critical 0
module_end module_end
# Number processes # Number processes
module_begin module_begin
module_name Number processes module_name Number processes

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.775-240221 Version: 7.0NG.775-240223
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775'; use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240221'; use constant AGENT_BUILD => '240223';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.775" PI_VERSION="7.0NG.775"
PI_BUILD="240221" PI_BUILD="240223"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -157,8 +157,8 @@ ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf"
module_begin module_begin
module_name CPU Load module_name CPU Load
module_type generic_data module_type generic_data
module_wmiquery SELECT LoadPercentage FROM Win32_Processor module_wmiquery SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor where name like '_Total'
module_wmicolumn LoadPercentage module_wmicolumn PercentProcessorTime
module_max 100 module_max 100
module_min 0 module_min 0
module_description User CPU Usage (%) module_description User CPU Usage (%)

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{240221} {240223}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.775-240221 Version: 7.0NG.775-240223
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -496,6 +496,10 @@ function mainAgentsModules()
$agents = []; $agents = [];
} }
if (isset($agents_id) === false) {
$agents_id = '';
}
$filter_agents = html_print_label_input_block( $filter_agents = html_print_label_input_block(
__('Agents'), __('Agents'),
html_print_select( html_print_select(

View File

@ -91,7 +91,7 @@ function mainModuleGroups()
$module_group_search = get_parameter('module_group_search', ''); $module_group_search = get_parameter('module_group_search', '');
// Check the user's group permissions. // Check the user's group permissions.
$user_groups = users_get_groups($config['user'], 'AR'); $user_groups = users_get_groups($config['id_user'], 'AR');
$info = array_filter( $info = array_filter(
$info, $info,
function ($v) use ($user_groups) { function ($v) use ($user_groups) {
@ -112,7 +112,7 @@ function mainModuleGroups()
); );
if (empty($info) === false) { if (empty($info) === false) {
$groups_view = ($is_not_paginated) ? $info : array_slice( $groups_view = (isset($is_not_paginated) === true) ? $info : array_slice(
$info, $info,
$offset, $offset,
$config['block_size'] $config['block_size']
@ -374,6 +374,10 @@ function mainModuleGroups()
'…' '…'
); );
$j = 1; $j = 1;
if (isset($background_color) === false) {
$background_color = 'none';
}
if (isset($array_data[$key])) { if (isset($array_data[$key])) {
foreach ($value['gm'] as $k => $v) { foreach ($value['gm'] as $k => $v) {
if (isset($array_data[$key][$k])) { if (isset($array_data[$key][$k])) {

View File

@ -273,6 +273,14 @@ function buildConnectionURL($method)
{ {
global $config; global $config;
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
$address = (empty($config['gotty_addr']) === true) ? $_SERVER['SERVER_ADDR'] : $config['gotty_addr']; $address = (empty($config['gotty_addr']) === true) ? $_SERVER['SERVER_ADDR'] : $config['gotty_addr'];
$use_ssl = ($method === 'ssh') ? $config['gotty_ssh_use_ssl'] : $config['gotty_telnet_use_ssl']; $use_ssl = ($method === 'ssh') ? $config['gotty_ssh_use_ssl'] : $config['gotty_telnet_use_ssl'];
$protocol = ((bool) $use_ssl === true) ? 'https://' : 'http://'; $protocol = ((bool) $use_ssl === true) ? 'https://' : 'http://';
@ -353,6 +361,18 @@ function quickShellSettings()
config_update_value('gotty_telnet_enabled', $gotty_telnet_enabled); config_update_value('gotty_telnet_enabled', $gotty_telnet_enabled);
} }
if (isset($config['gotty_addr']) === false) {
$config['gotty_addr'] = '';
}
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
if ($config['gotty_addr'] != $gotty_addr) { if ($config['gotty_addr'] != $gotty_addr) {
config_update_value('gotty_addr', $gotty_addr); config_update_value('gotty_addr', $gotty_addr);
} }
@ -389,6 +409,25 @@ function quickShellSettings()
$general_table->data = []; $general_table->data = [];
$general_table->style = []; $general_table->style = [];
$general_table->style[0] = 'width: 50%;'; $general_table->style[0] = 'width: 50%;';
if (isset($config['gotty_addr']) === false) {
$config['gotty_addr'] = '';
}
if (isset($config['gotty_ssh_enabled']) === false) {
$config['gotty_ssh_enabled'] = '';
}
if (isset($config['gotty_ssh_use_ssl']) === false) {
$config['gotty_ssh_use_ssl'] = '';
}
if (isset($disable_agentaccess) === false) {
$disable_agentaccess = '';
}
if (isset($config['gotty_telnet_use_ssl']) === false) {
$config['gotty_telnet_use_ssl'] = '';
}
$general_table->data[0][] = html_print_label_input_block( $general_table->data[0][] = html_print_label_input_block(
__('Address'), __('Address'),

View File

@ -229,7 +229,7 @@ function users_extension_main_god($god=true)
$data = []; $data = [];
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row['id_user'].'">'.$row['id_user'].'</a>'; $data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row['id_user'].'">'.$row['id_user'].'</a>';
$data[1] = $last_login_data['ip_origin']; $data[1] = $last_login_data['ip_origen'];
$data[2] = date($config['date_format'], $last_login_data['utimestamp']); $data[2] = date($config['date_format'], $last_login_data['utimestamp']);
$data[3] = date($config['date_format'], $row['last_connect']); $data[3] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data); array_push($table->data, $data);

View File

@ -161,6 +161,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
'code' => false, 'code' => false,
]; ];
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
if (!isset($_GET['sec2'])) { if (!isset($_GET['sec2'])) {
$_GET['sec2'] = ''; $_GET['sec2'] = '';
} }

View File

@ -152,9 +152,11 @@
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.'); echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>'; echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name()); echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
if ($config['logged'] == false) { if (isset($config['logged']) === true) {
if (session_status() === PHP_SESSION_ACTIVE) { if ($config['logged'] == false) {
session_destroy(); if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
}
} }
} }
?> ?>

View File

@ -246,6 +246,7 @@ if ($new_agent === true) {
// QR Code table. // QR Code table.
$CodeQRContent = '';
if ($new_agent === false) { if ($new_agent === false) {
$CodeQRContent .= html_print_div(['id' => 'qr_container_image'], true); $CodeQRContent .= html_print_div(['id' => 'qr_container_image'], true);
$CodeQRContent .= html_print_anchor( $CodeQRContent .= html_print_anchor(

View File

@ -816,6 +816,23 @@ if ($id_agente) {
$helper = ($help_header === 'main_tab') ? 'main_tab' : ''; $helper = ($help_header === 'main_tab') ? 'main_tab' : '';
$pure = (int) get_parameter('pure'); $pure = (int) get_parameter('pure');
$menu_tabs = [];
// Agent details.
$menu_tab_url = '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general">'.__('General setup').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Agent details.
$menu_tab_url = '<a href="index.php?sec=view&sec2=operation/agentes/estado_agente">'.__('Agent detail').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Manage agents.
$menu_tab_url = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'.__('Manage agents').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Events.
$menu_tab_url = '<a href="index.php?sec=eventos&sec2=operation/events/events">'.__('View events').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Events.
$menu_tab_url = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">'.__('Custom reports').'</a>';
array_push($menu_tabs, $menu_tab_url);
$dots = dot_tab($menu_tabs);
if ($pure === 0) { if ($pure === 0) {
ui_print_standard_header( ui_print_standard_header(
__('Agent setup view').' ( '.strtolower(agents_get_alias($id_agente)).' )', __('Agent setup view').' ( '.strtolower(agents_get_alias($id_agente)).' )',
@ -837,7 +854,9 @@ if ($id_agente) {
'link' => '', 'link' => '',
'label' => $tab_name, 'label' => $tab_name,
], ],
] ],
[],
$dots
); );
} }
} else { } else {
@ -857,7 +876,9 @@ if ($id_agente) {
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente', 'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
'label' => __('Manage agents'), 'label' => __('Manage agents'),
], ],
] ],
[],
$dots
); );
} }
@ -2334,6 +2355,23 @@ if ($delete_module) {
exit; exit;
} }
// Check if module is used by agent for Safe mode.
$is_safe_mode_module = modules_check_safe_mode($id_borrar_modulo);
if ($is_safe_mode_module === true && isset($id_agente) === true) {
db_process_sql_update('tagente', ['safe_mode_module' => '0'], ['id_agente' => $id_agente]);
db_process_sql_update(
'tagente_modulo',
[
'disabled' => 0,
'disabled_by_safe_mode' => 0,
],
[
'id_agente' => $id_agente,
'disabled_by_safe_mode' => 1,
]
);
}
// Before delete the main module, check and delete the childrens from the original module. // Before delete the main module, check and delete the childrens from the original module.
module_check_childrens_and_delete($id_borrar_modulo); module_check_childrens_and_delete($id_borrar_modulo);

View File

@ -55,7 +55,7 @@ if ($id_field) {
$display_on_front = $field['display_on_front']; $display_on_front = $field['display_on_front'];
$is_password_type = $field['is_password_type']; $is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : ''; $combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable']; $is_combo_enable = (isset($config['is_combo_enable']) === true) ? $config['is_combo_enable'] : false;
$is_link_enabled = $field['is_link_enabled']; $is_link_enabled = $field['is_link_enabled'];
$header_title = __('Update agent custom field'); $header_title = __('Update agent custom field');
} else { } else {
@ -162,6 +162,10 @@ $table->data[2][0] = html_print_label_input_block(
) )
); );
if (isset($config['is_combo_enable']) === false) {
$config['is_combo_enable'] = false;
}
$table->data[2][1] = html_print_label_input_block( $table->data[2][1] = html_print_label_input_block(
__('Enabled combo'), __('Enabled combo'),
html_print_checkbox_switch_extended( html_print_checkbox_switch_extended(

View File

@ -164,12 +164,13 @@ foreach ($password_fields as $k => $p) {
return; return;
} }
const moduleId = <?php echo $id_agent_module; ?>; const moduleId = <?php echo ($module['id_policy'] > 0) ? $module['id'] : $id_agent_module; ?>;
const isPolicy = <?php echo ($module['id_policy'] > 0) ? '1' : '0'; ?>;
load_plugin_description($("#id_plugin").val()); load_plugin_description($("#id_plugin").val());
load_plugin_macros_fields('simple-macro', moduleId); load_plugin_macros_fields('simple-macro', moduleId, isPolicy);
forced_title_callback(); forced_title_callback();
$('select#id_plugin').select2('close'); $('select#id_plugin').select2('close');

View File

@ -109,7 +109,7 @@ if (is_ajax()) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_description = $fields_descriptions[($i - 1)]; $field_description = $fields_descriptions[($i - 1)];
$field_value = $fields_values[($i - 1)]; $field_value = $fields_values[($i - 1)];
$field_hidden = $fields_hidden_checked[($i - 1)]; $field_hidden = (isset($fields_hidden_checked[($i - 1)]) === true) ? $fields_hidden_checked[($i - 1)] : '';
if (!empty($field_description)) { if (!empty($field_description)) {

View File

@ -253,7 +253,7 @@ if (is_metaconsole() === true) {
echo '<br>'; echo '<br>';
} }
if (!$id_cluster) { if (isset($id_cluster) === false) {
ui_toggle( ui_toggle(
$form_filter, $form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>', '<span class="subsection_header_title">'.__('Alert control filter').'</span>',
@ -1115,7 +1115,7 @@ if (isset($dont_display_alert_create_bttn)) {
} }
} }
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) { if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && isset($id_cluster) === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
$actionButtons = html_print_submit_button( $actionButtons = html_print_submit_button(
__('Create'), __('Create'),

View File

@ -242,6 +242,7 @@ if (empty($result) === false) {
html_print_table($table); html_print_table($table);
$tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false); $tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false);
} else { } else {
$tablePagination = '';
// No categories available or selected. // No categories available or selected.
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]); ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);
} }

View File

@ -195,13 +195,13 @@ foreach ($extensions as $file => $extension) {
$data[] = '<i class="grey">'.$file.'</i>'; $data[] = '<i class="grey">'.$file.'</i>';
// Get version of this extensions // Get version of this extensions
if ($config['extensions'][$file]['operation_menu']) { if (isset($config['extensions'][$file]['operation_menu']) === true) {
$data[] = $config['extensions'][$file]['operation_menu']['version']; $data[] = $config['extensions'][$file]['operation_menu']['version'];
} else if ($config['extensions'][$file]['godmode_menu']) { } else if (isset($config['extensions'][$file]['godmode_menu']) === true) {
$data[] = $config['extensions'][$file]['godmode_menu']['version']; $data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if ($config['extensions'][$file]['extension_ope_tab']) { } else if (isset($config['extensions'][$file]['extension_ope_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version']; $data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) { } else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version']; $data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else { } else {
$data[] = __('N/A'); $data[] = __('N/A');
@ -216,7 +216,7 @@ foreach ($extensions as $file => $extension) {
$data[] = $config['extensions'][$file]['godmode_menu']['version']; $data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if (isset($config['extensions'][$file]['extension_ope_tab'])) { } else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$data[] = $config['extensions'][$file]['extension_ope_tab']['version']; $data[] = $config['extensions'][$file]['extension_ope_tab']['version'];
} else if ($config['extensions'][$file]['extension_god_tab']) { } else if (isset($config['extensions'][$file]['extension_god_tab']) === true) {
$data[] = $config['extensions'][$file]['extension_god_tab']['version']; $data[] = $config['extensions'][$file]['extension_god_tab']['version'];
} else { } else {
$data[] = __('N/A'); $data[] = __('N/A');

View File

@ -1205,9 +1205,9 @@ $tab = 'group_edition';
<script type="text/javascript"> <script type="text/javascript">
let show_full_hirearchy = "<?php echo $show_full_hirearchy; ?>"; let show_full_hirearchy = "<?php echo (isset($show_full_hirearchy) === true) ? $show_full_hirearchy : ''; ?>";
let show_not_init_agents = "<?php echo $show_not_init_agents; ?>"; let show_not_init_agents = "<?php echo (isset($show_not_init_agents) === true) ? $show_not_init_agents : ''; ?>";
let show_not_init_modules = "<?php echo $show_not_init_modules; ?>"; let show_not_init_modules = "<?php echo (isset($show_not_init_modules) === true) ? $show_not_init_modules : ''; ?>";
$('#checkbox-show_full_hirearchy').on("change", function() { $('#checkbox-show_full_hirearchy').on("change", function() {
if (show_full_hirearchy == 1) { if (show_full_hirearchy == 1) {

View File

@ -134,7 +134,7 @@ $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block( $table->data[0][1] = html_print_label_input_block(
__('Group recursion'), __('Group recursion'),
html_print_checkbox('recursion', 1, $recursion, true, false, '', true) html_print_checkbox('recursion', 1, ($recursion ?? false), true, false, '', true)
); );
$arr_policies = policies_get_policies(); $arr_policies = policies_get_policies();

View File

@ -138,7 +138,7 @@ $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block( $table->data[0][1] = html_print_label_input_block(
__('Group recursion'), __('Group recursion'),
html_print_checkbox('recursion', 1, $recursion, true, false, '', true) html_print_checkbox('recursion', 1, ($recursion ?? false), true, false, '', true)
); );
$arr_policies = policies_get_policies(); $arr_policies = policies_get_policies();

View File

@ -631,8 +631,8 @@ if (is_metaconsole() === true) {
echo '<form method="post" autocomplete="off" id="form_agent" action="'.$url.'">'; echo '<form method="post" autocomplete="off" id="form_agent" action="'.$url.'">';
echo html_print_avoid_autocomplete(); echo html_print_avoid_autocomplete();
$params = [ $params = [
'id_group' => $id_group, 'id_group' => ($id_group ?? ''),
'recursion' => $recursion, 'recursion' => ($recursion ?? ''),
]; ];
echo get_table_inputs_masive_agents($params); echo get_table_inputs_masive_agents($params);
@ -712,9 +712,9 @@ if (is_metaconsole() === false) {
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;'; $table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;';
$table->data[0][1] .= html_print_select( $table->data[0][1] .= html_print_select(
$modules, ($modules ?? ''),
'cascade_protection_module', 'cascade_protection_module',
$cascade_protection_module, ($cascade_protection_module ?? ''),
'', '',
'', '',
0, 0,
@ -1162,7 +1162,7 @@ $table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip(
), ),
true true
); );
$table->data[7][1] .= html_print_select( $table->data[7][1] = html_print_select(
[ [
1 => __('Enabled'), 1 => __('Enabled'),
0 => __('Disabled'), 0 => __('Disabled'),
@ -1229,7 +1229,7 @@ if ($fields === false) {
foreach ($fields as $field) { foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>'; $data[0] = '<b>'.$field['name'].'</b>';
$combo = []; $combo = [];
$combo = $field['combo_values']; $combo = ($field['combo_values'] ?? '');
$combo = explode(',', $combo); $combo = explode(',', $combo);
$combo_values = []; $combo_values = [];
foreach ($combo as $value) { foreach ($combo as $value) {
@ -1258,7 +1258,7 @@ foreach ($fields as $field) {
'', '',
30, 30,
100, 100,
$view_mode, ($view_mode ?? ''),
'', '',
'', '',
true, true,

View File

@ -421,7 +421,7 @@ $table->data[4][0] = html_print_label_input_block(
html_print_select( html_print_select(
$tags, $tags,
'tags[]', 'tags[]',
$tags_name, ($tags_name ?? ''),
false, false,
__('Any'), __('Any'),
-1, -1,
@ -537,7 +537,7 @@ $table->data[8][0] = html_print_label_input_block(
html_print_select( html_print_select(
$tags, $tags,
'tags[]', 'tags[]',
$tags_name, ($tags_name ?? ''),
false, false,
__('Any'), __('Any'),
-1, -1,
@ -1304,7 +1304,7 @@ $table->data[29][0] = html_print_label_input_block(
html_print_select_from_sql( html_print_select_from_sql(
'SELECT id_tag, name FROM ttag ORDER BY name', 'SELECT id_tag, name FROM ttag ORDER BY name',
'id_tag[]', 'id_tag[]',
$id_tag, ($id_tag ?? ''),
'', '',
__('None'), __('None'),
'0', '0',

View File

@ -476,12 +476,12 @@ if (is_metaconsole() === false) {
$timezone_name = 'Asia/Shanghai'; $timezone_name = 'Asia/Shanghai';
} }
$area_data_timezone_polys .= ''; $area_data_timezone_polys = '';
foreach ($tz['polys'] as $coords) { foreach ($tz['polys'] as $coords) {
$area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />'; $area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />';
} }
$area_data_timezone_rects .= ''; $area_data_timezone_rects = '';
foreach ($tz['rects'] as $coords) { foreach ($tz['rects'] as $coords) {
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />'; $area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
} }
@ -543,7 +543,7 @@ echo sprintf(
'<div class="edit_user_options">%s %s %s %s %s %s %s %s %s %s</div>', '<div class="edit_user_options">%s %s %s %s %s %s %s %s %s %s</div>',
$language, $language,
$size_pagination, $size_pagination,
$skin, ($skin ?? ''),
$home_screen, $home_screen,
$event_filter, $event_filter,
$autorefresh_show, $autorefresh_show,

View File

@ -348,6 +348,10 @@ if (check_acl($config['id_user'], 0, 'UM')) {
$onheader['user_agents'] = $userstab; $onheader['user_agents'] = $userstab;
} }
if (isset($servicestab) === false) {
$servicestab = '';
}
$onheader['massive_alerts'] = $alertstab; $onheader['massive_alerts'] = $alertstab;
$onheader['massive_policies_alerts'] = $policiesalertstab; $onheader['massive_policies_alerts'] = $policiesalertstab;
$onheader['massive_policies_alerts_external'] = $policiesalertsexternaltab; $onheader['massive_policies_alerts_external'] = $policiesalertsexternaltab;

View File

@ -524,10 +524,12 @@ if ($access_console_node === true) {
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$show_ipam = false; $show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network'); $ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) { if ($ipam !== false) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) { foreach ($ipam as $row) {
$show_ipam = true; if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
break; $show_ipam = true;
break;
}
} }
} }
} }

View File

@ -686,6 +686,12 @@ $table->data[0][] = html_print_label_input_block(
) )
); );
if (isset($component) === false) {
$component = [];
$component['id'] = '';
$component['id_nc'] = '';
}
$filter_action_url = 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&search_string='.urlencode(io_safe_output($search_string)).'&search_id_group'.$search_id_group.'&pure='.$pure; $filter_action_url = 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&search_string='.urlencode(io_safe_output($search_string)).'&search_id_group'.$search_id_group.'&pure='.$pure;
$toggleFilters = '<form class="filters_form" method="POST" action="'.$filter_action_url.'">'; $toggleFilters = '<form class="filters_form" method="POST" action="'.$filter_action_url.'">';
$toggleFilters .= html_print_table($table, true); $toggleFilters .= html_print_table($table, true);
@ -824,7 +830,7 @@ foreach ($components as $component) {
$data[0] = io_safe_output($component['name']); $data[0] = io_safe_output($component['name']);
} }
$data[1] .= ui_print_servertype_icon((int) $component['id_modulo']); $data[1] = ui_print_servertype_icon((int) $component['id_modulo']);
$data[2] = ui_print_moduletype_icon($component['type'], true); $data[2] = ui_print_moduletype_icon($component['type'], true);
$data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>'; $data[3] = "<span class='font_8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';

View File

@ -221,6 +221,9 @@ $search = trim(get_parameter('search', ''));
$graphs = custom_graphs_get_user($config['id_user'], false, true, $access); $graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$table_aux = new stdClass(); $table_aux = new stdClass();
if (isset($strict_user) === false) {
$strict_user = false;
}
$table_aux->width = '100%'; $table_aux->width = '100%';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -273,7 +276,11 @@ if (is_metaconsole() === true) {
html_print_input_text('search', $search, '', 30, '', true) html_print_input_text('search', $search, '', 30, '', true)
); );
$searchForm .= '<form action="index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group='.$id_group.'&pure='.$pure.'"method="post">'; if (isset($pure) === false) {
$pure = '';
}
$searchForm = '<form action="index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group='.$id_group.'&pure='.$pure.'"method="post">';
$searchForm .= html_print_table($table_aux, true); $searchForm .= html_print_table($table_aux, true);
$searchForm .= html_print_div( $searchForm .= html_print_div(

View File

@ -130,6 +130,14 @@ if ($action === 'new') {
$backgroundPreviewImages[] = html_print_image('', true, ['id' => 'imagen', 'class' => 'invisible']); $backgroundPreviewImages[] = html_print_image('', true, ['id' => 'imagen', 'class' => 'invisible']);
if (isset($formAction) === false) {
$formAction = 'POST';
}
if (isset($formHidden) === false) {
$formHidden = '';
}
// Form. // Form.
echo '<form id="back" class="max_floating_element_size" method="POST" action="'.$formAction.'" enctype="multipart/form-data">'; echo '<form id="back" class="max_floating_element_size" method="POST" action="'.$formAction.'" enctype="multipart/form-data">';
echo $formHidden; echo $formHidden;

View File

@ -285,7 +285,11 @@ switch ($activeTab) {
} }
// If the background is changed the size is reseted // If the background is changed the size is reseted
$background_now = $visualConsole['background']; if (isset($visualConsole['background']) === true) {
$background_now = $visualConsole['background'];
} else {
$background_now = '';
}
$values['width'] = $width; $values['width'] = $width;
$values['height'] = $height; $values['height'] = $height;

View File

@ -268,8 +268,8 @@ echo '</div>';
if (msg.status === true) { if (msg.status === true) {
title = "<?php echo __('Importation successfully completed'); ?>"; title = "<?php echo __('Importation successfully completed'); ?>";
message = "<?php echo __('PRD import successfull:'); ?>"; message = "<?php echo __('PRD import successfull:'); ?>";
const name = "<?php echo $name; ?>"; const name = "<?php echo ($name ?? ''); ?>";
const type = "<?php echo $type; ?>"; const type = "<?php echo ($type ?? ''); ?>";
message += ` ${type} - ${name}`; message += ` ${type} - ${name}`;
} else { } else {
title = "<?php echo __('Import failure'); ?>"; title = "<?php echo __('Import failure'); ?>";

View File

@ -496,8 +496,8 @@ if (isset($_GET['server']) === true) {
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
var id_server = '<?php echo $id_server; ?>'; var id_server = '<?php echo ($id_server ?? ''); ?>';
var server_type = '<?php echo $row['server_type']; ?>'; var server_type = '<?php echo ($row['server_type'] ?? ''); ?>';
$("#check_exec_server img").on("click", function () { $("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif"); $("#check_exec_server img").attr("src", "images/spinner.gif");

View File

@ -1172,6 +1172,10 @@ if (empty($create) === false || empty($view) === false) {
} }
ui_require_javascript_file('pandora_modules'); ui_require_javascript_file('pandora_modules');
if (isset($locked) === false) {
$locked = '';
}
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -523,27 +523,29 @@ if ($error === null) {
} }
} }
if (file_exists($uploaded_filename) === true) { if (isset($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) { if (file_exists($uploaded_filename) === true) {
// Keep uploaded file to be transferred to nodes. if (is_metaconsole() === true && is_management_allowed() === true) {
if (is_dir($config['attachment_store'].'/downloads/') === false) { // Keep uploaded file to be transferred to nodes.
mkdir($config['attachment_store'].'/downloads/'); if (is_dir($config['attachment_store'].'/downloads/') === false) {
} mkdir($config['attachment_store'].'/downloads/');
}
$keep = move_uploaded_file( $keep = move_uploaded_file(
$uploaded_filename, $uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename $config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
); );
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
);
}
} else {
// Clean temporary files.
unlink($uploaded_filename);
} }
} else {
// Clean temporary files.
unlink($uploaded_filename);
} }
} }

View File

@ -146,9 +146,9 @@ foreach ($servers as $server) {
// Type. // Type.
$data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['server_name']; $data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['server_name'];
if ($server['master'] == $master) { if ($server['master'] == $master) {
$data[3] .= __('Yes', true); $data[3] = __('Yes', true);
} else { } else {
$data[3] .= __('-'); $data[3] = __('-');
} }
if ((int) $server['exec_proxy'] === 1) { if ((int) $server['exec_proxy'] === 1) {

View File

@ -70,6 +70,10 @@ if (isset($config['filemanager']['message']) === true) {
// Add custom directories here. // Add custom directories here.
$fallback_directory = 'images'; $fallback_directory = 'images';
// Get directory. // Get directory.
if (isset($text) === false) {
$text = '';
}
$directory = (string) get_parameter('directory'); $directory = (string) get_parameter('directory');
$directory = str_replace('&lt;', '', $text); $directory = str_replace('&lt;', '', $text);
$directory = str_replace('&gt;', '', $text); $directory = str_replace('&gt;', '', $text);
@ -90,7 +94,12 @@ $create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/'); $default_real_directory = realpath($config['homedir'].'/');
// Remove double dot in filename path. // Remove double dot in filename path.
$file_name = $_FILES['file']['name']; if (isset($_FILES['file']) === true) {
$file_name = $_FILES['file']['name'];
} else {
$file_name = '';
}
$path_parts = explode('/', $file_name); $path_parts = explode('/', $file_name);
$stripped_parts = array_filter( $stripped_parts = array_filter(

View File

@ -399,7 +399,7 @@ $table->data[0][0] = html_print_label_input_block(
__('Total Agents'), __('Total Agents'),
html_print_input_text( html_print_input_text(
'total_agents', 'total_agents',
$total_agents, ($total_agents ?? ''),
'', '',
30, 30,
255, 255,
@ -412,7 +412,7 @@ $table->data[0][1] = html_print_label_input_block(
__('Network & other devices'), __('Network & other devices'),
html_print_input_text( html_print_input_text(
'type_network', 'type_network',
$network_others, ($network_others ?? ''),
'', '',
30, 30,
255, 255,
@ -425,7 +425,7 @@ $table->data[1][0] = html_print_label_input_block(
__('Workstations'), __('Workstations'),
html_print_input_text( html_print_input_text(
'type_workstation', 'type_workstation',
$workstations, ($workstations ?? ''),
'', '',
30, 30,
255, 255,
@ -438,7 +438,7 @@ $table->data[1][1] = html_print_label_input_block(
__('Servers'), __('Servers'),
html_print_input_text( html_print_input_text(
'type_server', 'type_server',
$servers, ($servers ?? ''),
'', '',
30, 30,
255, 255,

View File

@ -389,6 +389,10 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo '<td>'.__('No').'</b></td>'; echo '<td>'.__('No').'</b></td>';
} }
if (isset($tdcolor) === false) {
$tdcolor = '';
}
echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['border' => '0', 'class' => 'invert_filter main_menu_icon']).'</a></td></tr>'; echo '<td class="'.$tdcolor.' table_action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['border' => '0', 'class' => 'invert_filter main_menu_icon']).'</a></td></tr>';
} }

View File

@ -164,9 +164,8 @@ if (is_metaconsole() === true) {
html_print_action_buttons( html_print_action_buttons(
$buttons, $buttons,
[ [
'type' => 'data_table', 'type' => 'data_table',
'class' => 'fixed_action_buttons', 'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
] ]
); );

View File

@ -386,6 +386,28 @@ switch ($section) {
break; break;
} }
$menu_tabs = [];
// Agent details.
$menu_tab_url = '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general">'.__('General setup').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Agent details.
$menu_tab_url = '<a href="index.php?sec=view&sec2=operation/agentes/estado_agente">'.__('Agent detail').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Manage agents.
$menu_tab_url = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'.__('Manage agents').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Events.
$menu_tab_url = '<a href="index.php?sec=eventos&sec2=operation/events/events">'.__('View events').'</a>';
array_push($menu_tabs, $menu_tab_url);
// Events.
$menu_tab_url = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">'.__('Custom reports').'</a>';
array_push($menu_tabs, $menu_tab_url);
$dots = dot_tab($menu_tabs);
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
__('Setup').' &raquo; '.$subpage, __('Setup').' &raquo; '.$subpage,
@ -403,7 +425,9 @@ ui_print_standard_header(
'link' => '', 'link' => '',
'label' => $subpage, 'label' => $subpage,
], ],
] ],
[],
$dots
); );
if (isset($config['error_config_update_config'])) { if (isset($config['error_config_update_config'])) {
@ -413,15 +437,19 @@ if (isset($config['error_config_update_config'])) {
ui_print_success_message(__('Correct update the setup options')); ui_print_success_message(__('Correct update the setup options'));
} }
if (is_array($config['error_config_update_config']['errors']) === true) { if (isset($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) { if (is_array($config['error_config_update_config']['errors']) === true) {
ui_print_error_message($msg); foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
} }
} }
if (is_array($config['error_config_update_config']['warnings']) === true) { if (isset($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) { if (is_array($config['error_config_update_config']['warnings']) === true) {
ui_print_warning_message($msg); foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
}
} }
} }

View File

@ -137,6 +137,10 @@ $row['hostname'] = html_print_label_input_block(
['div_class' => 'ITSM-remote-setup-ITSM_hostname'] ['div_class' => 'ITSM-remote-setup-ITSM_hostname']
); );
if (isset($config['ITSM_token']) === false) {
$config['ITSM_token'] = '';
}
// ITSM token. // ITSM token.
$row['password'] = html_print_label_input_block( $row['password'] = html_print_label_input_block(
__('Token'), __('Token'),

View File

@ -390,7 +390,7 @@ if (is_ajax() === true) {
set_unless_defined($config['double_auth_enabled'], false); set_unless_defined($config['double_auth_enabled'], false);
$row = []; $row = [];
$row['name'] = __('Double authentication'); $row['name'] = __('Double authentication');
$row['control'] .= html_print_checkbox_switch( $row['control'] = html_print_checkbox_switch(
'double_auth_enabled', 'double_auth_enabled',
1, 1,
$config['double_auth_enabled'], $config['double_auth_enabled'],
@ -405,7 +405,7 @@ if (is_ajax() === true) {
set_unless_defined($config['2FA_all_users'], false); set_unless_defined($config['2FA_all_users'], false);
$row = []; $row = [];
$row['name'] = __('Force 2FA for all users is enabled'); $row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch( $row['control'] = html_print_checkbox_switch(
'2FA_all_users', '2FA_all_users',
1, 1,
$config['2FA_all_users'], $config['2FA_all_users'],

View File

@ -78,6 +78,18 @@ $table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['ehorus_hostname'] = '50%'; $table_remote->size['ehorus_hostname'] = '50%';
$table_remote->size['ehorus_port'] = '50%'; $table_remote->size['ehorus_port'] = '50%';
if (isset($config['ehorus_user_level_conf']) === false) {
$config['ehorus_user_level_conf'] = '';
}
if (isset($config['ehorus_user']) === false) {
$config['ehorus_user'] = '';
}
if (isset($config['ehorus_pass']) === false) {
$config['ehorus_pass'] = '';
}
// Enable eHorus user configuration. // Enable eHorus user configuration.
$row = []; $row = [];
$row['ehorus_user_level_conf'] = html_print_label_input_block( $row['ehorus_user_level_conf'] = html_print_label_input_block(

View File

@ -488,6 +488,10 @@ $table->data[$i][] = html_print_label_input_block(
) )
); );
if (isset($config['force_public_url']) === false) {
$config['force_public_url'] = '';
}
$table->data[$i++][] = html_print_label_input_block( $table->data[$i++][] = html_print_label_input_block(
__('Force use Public URL'), __('Force use Public URL'),
html_print_switch( html_print_switch(
@ -498,6 +502,10 @@ $table->data[$i++][] = html_print_label_input_block(
) )
); );
if (isset($config['public_url_exclusions']) === false) {
$config['public_url_exclusions'] = '';
}
$table->data[$i++][] = html_print_label_input_block( $table->data[$i++][] = html_print_label_input_block(
__('Public URL host exclusions'), __('Public URL host exclusions'),
html_print_textarea( html_print_textarea(
@ -919,6 +927,10 @@ echo '<legend>'.__('Mail configuration').'</legend>';
$table_ncm_config->size[0] = '50%'; $table_ncm_config->size[0] = '50%';
$table_ncm_config->data = []; $table_ncm_config->data = [];
if (isset($config['tftp_server_ip']) === false) {
$config['tftp_server_ip'] = '';
}
$table_ncm_config->data[0][] = html_print_label_input_block( $table_ncm_config->data[0][] = html_print_label_input_block(
__('FTP server IP').ui_print_help_tip(__('This value will be used by TFTP_SERVER_IP macro in NCM scripts.'), true), __('FTP server IP').ui_print_help_tip(__('This value will be used by TFTP_SERVER_IP macro in NCM scripts.'), true),
html_print_input_text( html_print_input_text(

View File

@ -74,6 +74,8 @@ if ($view === 'create' || $view === 'edit') {
if (count($errors) === 0) { if (count($errors) === 0) {
if (count($files) > 0) { if (count($files) > 0) {
$uploadImages = $tipsWindow->uploadImages($files); $uploadImages = $tipsWindow->uploadImages($files);
} else {
$uploadImages = '';
} }
$response = $tipsWindow->createTip($id_lang, $id_profile, $title, $text, $url, $enable, $uploadImages); $response = $tipsWindow->createTip($id_lang, $id_profile, $title, $text, $url, $enable, $uploadImages);

View File

@ -2087,7 +2087,7 @@ if ($create_alert || $update_alert) {
FROM talert_actions FROM talert_actions
ORDER BY name', ORDER BY name',
'alert_type', 'alert_type',
$alert_type, ($alert_type ?? ''),
'', '',
'', '',
0, 0,
@ -2100,26 +2100,26 @@ if ($create_alert || $update_alert) {
echo '</tr>'; echo '</tr>';
$al = [ $al = [
'al_field1' => $al_field1, 'al_field1' => ($al_field1 ?? ''),
'al_field2' => $al_field2, 'al_field2' => ($al_field2 ?? ''),
'al_field3' => $al_field3, 'al_field3' => ($al_field3 ?? ''),
'al_field4' => $al_field4, 'al_field4' => ($al_field4 ?? ''),
'al_field5' => $al_field5, 'al_field5' => ($al_field5 ?? ''),
'al_field6' => $al_field6, 'al_field6' => ($al_field6 ?? ''),
'al_field7' => $al_field7, 'al_field7' => ($al_field7 ?? ''),
'al_field8' => $al_field8, 'al_field8' => ($al_field8 ?? ''),
'al_field9' => $al_field9, 'al_field9' => ($al_field9 ?? ''),
'al_field10' => $al_field10, 'al_field10' => ($al_field10 ?? ''),
'al_field11' => $al_field11, 'al_field11' => ($al_field11 ?? ''),
'al_field12' => $al_field12, 'al_field12' => ($al_field12 ?? ''),
'al_field13' => $al_field13, 'al_field13' => ($al_field13 ?? ''),
'al_field14' => $al_field14, 'al_field14' => ($al_field14 ?? ''),
'al_field15' => $al_field15, 'al_field15' => ($al_field15 ?? ''),
'al_field16' => $al_field16, 'al_field16' => ($al_field16 ?? ''),
'al_field17' => $al_field17, 'al_field17' => ($al_field17 ?? ''),
'al_field18' => $al_field18, 'al_field18' => ($al_field18 ?? ''),
'al_field19' => $al_field19, 'al_field19' => ($al_field19 ?? ''),
'al_field20' => $al_field20, 'al_field20' => ($al_field20 ?? ''),
]; ];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -2287,7 +2287,7 @@ $(document).ready (function () {
}); });
values.push({ values.push({
name: "content_type", name: "content_type",
value: "<?php echo $al_field4; ?>" value: "<?php echo ($al_field4 ?? ''); ?>"
}) })
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,

View File

@ -377,11 +377,15 @@ if ($edit_filter > -2) {
echo '</form></div>'; echo '</form></div>';
} }
if (isset($index) === false) {
$index = 0;
}
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// +1 because there is already a defined 'filter' field. // +1 because there is already a defined 'filter' field.
var id = parseInt("<?php echo $index; ?>")+1; var id = parseInt("<?php echo $index; ?>")+1;
var homeurl = "<?php echo $config['homeurl']; ?>"; var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () { $(document).ready (function () {

View File

@ -99,7 +99,7 @@ if (!$action_update_url_update_manager) {
); );
$allow_offline_patches = get_parameter_switch( $allow_offline_patches = get_parameter_switch(
'allow_offline_patches', 'allow_offline_patches',
$config['allow_offline_patches'] ($config['allow_offline_patches'] ?? '')
); );
$lts_updates = get_parameter_switch( $lts_updates = get_parameter_switch(
'lts_updates', 'lts_updates',

View File

@ -1113,11 +1113,15 @@ if (!$new_user) {
$user_id .= $apiTokenContent; $user_id .= $apiTokenContent;
$CodeQRContent .= html_print_div(['id' => 'qr_container_image', 'class' => 'scale-0-8'], true); $CodeQRContent = html_print_div(['id' => 'qr_container_image', 'class' => 'scale-0-8'], true);
$CodeQRContent .= html_print_anchor( $CodeQRContent .= html_print_anchor(
['id' => 'qr_code_agent_view'], ['id' => 'qr_code_agent_view'],
true true
); );
if (isset($custom_id_div) === false) {
$custom_id_div = '';
}
$CodeQRContent .= '<br/>'.$custom_id_div; $CodeQRContent .= '<br/>'.$custom_id_div;
// QR code div. // QR code div.

View File

@ -64,6 +64,16 @@ if ($dashboards === false) {
} }
} }
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Custom Home Screen controls. // Custom Home Screen controls.
$customHomeScreenAddition = []; $customHomeScreenAddition = [];
// Home screen. Dashboard. // Home screen. Dashboard.
@ -81,21 +91,12 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
false, false,
'width: 100%' 'width: 100%'
); );
// Home screen. Visual consoles. // Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other. // Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 400, true); $customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 400, true);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Home screen. Visual consoles. // Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select( $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux, $layouts_aux,
@ -889,7 +890,7 @@ if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_
true true
); );
$userManagementTable->data['fields_addSettings'][1] .= html_print_div( $userManagementTable->data['fields_addSettings'][1] = html_print_div(
[ [
'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'), 'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'),
'content' => html_print_textarea( 'content' => html_print_textarea(
@ -914,6 +915,7 @@ if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_
); );
} }
$ITSM_host = '';
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) { if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login. // Pandora ITSM user remote login.
$table_ITSM = new StdClass(); $table_ITSM = new StdClass();

View File

@ -66,7 +66,8 @@ class Applications extends Wizard
int $page=0, int $page=0,
string $msg='Default message. Not set.', string $msg='Default message. Not set.',
string $icon='images/wizard/applications.png', string $icon='images/wizard/applications.png',
string $label='Applications' string $label='Applications',
string $class_style='',
) { ) {
$this->setBreadcrum([]); $this->setBreadcrum([]);

View File

@ -321,7 +321,7 @@ class Cloud extends Wizard
ui_print_error_message($this->msg); ui_print_error_message($this->msg);
} }
if ($empty_account === true) { if (isset($empty_account) === true) {
ui_print_error_message($this->msg); ui_print_error_message($this->msg);
} }
@ -357,7 +357,7 @@ class Cloud extends Wizard
'name' => 'account_identifier', 'name' => 'account_identifier',
'type' => 'select', 'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType), 'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier, 'selected' => (isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '',
'return' => true, 'return' => true,
], ],
], ],
@ -408,7 +408,7 @@ class Cloud extends Wizard
{ {
global $config; global $config;
$pandora = io_safe_output($config['cloud_util_path']); $pandora = io_safe_output(($config['cloud_util_path'] ?? ''));
if (isset($pandora) === false) { if (isset($pandora) === false) {
config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api'); config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api');
@ -419,7 +419,7 @@ class Cloud extends Wizard
return false; return false;
} }
if ($this->keyIdentifier === null) { if (isset($this->keyIdentifier) === false) {
// Ask user for available credentials. // Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list'); $this->msg = __('Select a set of credentials from the list');
$this->status = null; $this->status = null;
@ -496,7 +496,7 @@ class Cloud extends Wizard
*/ */
public function getCredentials() public function getCredentials()
{ {
return CredentialStore::getKey($this->keyIdentifier); return CredentialStore::getKey((isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '');
} }

View File

@ -66,7 +66,8 @@ class Custom extends Wizard
int $page=0, int $page=0,
string $msg='Default message. Not set.', string $msg='Default message. Not set.',
string $icon='/images/wizard/Custom_apps@svg.svg', string $icon='/images/wizard/Custom_apps@svg.svg',
string $label='Custom' string $label='Custom',
string $class_style='',
) { ) {
$this->setBreadcrum([]); $this->setBreadcrum([]);

View File

@ -629,7 +629,7 @@ class DiscoveryTaskList extends HTML
// Updated at. // Updated at.
$table->headstyle[8] .= 'min-width: 50px; width: 150px;'; $table->headstyle[8] .= 'min-width: 50px; width: 150px;';
// Operations. // Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 250px;'; $table->headstyle[9] = 'min-width: 150px; width: 250px;';
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
$table->head[0] = __('Force'); $table->head[0] = __('Force');
@ -1135,6 +1135,10 @@ class DiscoveryTaskList extends HTML
array_push($table->data, $data); array_push($table->data, $data);
} }
if (isset($server_name) === false) {
$server_name = '';
}
if (empty($table->data)) { if (empty($table->data)) {
$content = '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>'; $content = '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
$return = false; $return = false;

View File

@ -813,8 +813,36 @@ class HostDevices extends Wizard
// Interval and schedules. // Interval and schedules.
$interv_manual = 0; $interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) { if (isset($this->task['interval_sweep']) === true) {
$interv_manual = 1; if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
} else {
$this->task['interval_sweep'] = '';
}
if (isset($this->task['name']) === false) {
$this->task['name'] = '';
}
if (isset($this->task['id_recon_server']) === false) {
$this->task['id_recon_server'] = '';
}
if (isset($this->task['subnet_csv']) === false) {
$this->task['subnet_csv'] = '';
}
if (isset($this->task['subnet']) === false) {
$this->task['subnet'] = '';
}
if (isset($this->task['id_group']) === false) {
$this->task['id_group'] = 0;
}
if (isset($this->task['description']) === false) {
$this->task['description'] = '';
} }
$form['rows'][0]['new_form_block'] = true; $form['rows'][0]['new_form_block'] = true;

View File

@ -214,7 +214,8 @@ class ManageExtensions extends HTML
break; break;
default: default:
continue; // Nothing.
break;
} }
} }

View File

@ -104,6 +104,20 @@ class Wizard
*/ */
public $rootUrl; public $rootUrl;
/**
* Task.
*
* @var mixed
*/
public $task;
/**
* Max pages net scan.
*
* @var mixed
*/
public $maxPagesNetScan;
/** /**
* Setter for breadcrum * Setter for breadcrum
@ -221,6 +235,10 @@ class Wizard
$i = 0; $i = 0;
foreach ($urls as $url) { foreach ($urls as $url) {
if (isset($url['selected']) === false) {
$url['selected'] = 0;
}
if ($url['selected'] == 1) { if ($url['selected'] == 1) {
$class = 'selected'; $class = 'selected';
} else { } else {

View File

@ -431,6 +431,10 @@ if ($get_agent_alerts_datatable === true) {
if (empty($filter_alert['free_search']) === false) { if (empty($filter_alert['free_search']) === false) {
$free_search_alert = $filter_alert['free_search']; $free_search_alert = $filter_alert['free_search'];
} else { } else {
if (isset($filter_alert['free_search_alert']) === false) {
$filter_alert['free_search_alert'] = '';
}
$free_search_alert = $filter_alert['free_search_alert']; $free_search_alert = $filter_alert['free_search_alert'];
} }
@ -635,6 +639,10 @@ if ($get_agent_alerts_datatable === true) {
} }
$alerts = []; $alerts = [];
if (isset($agent_view_page) === false) {
$agent_view_page = false;
}
if ($agent_view_page === true) { if ($agent_view_page === true) {
$options_simple = ['order' => $order]; $options_simple = ['order' => $order];
} else { } else {

View File

@ -71,7 +71,7 @@ if ($get_all_datatables_formatted === true) {
// Datatables format: RecordsTotal && recordsfiltered. // Datatables format: RecordsTotal && recordsfiltered.
echo json_encode( echo json_encode(
[ [
'data' => $data, 'data' => ($data ?? ''),
'recordsTotal' => $count, 'recordsTotal' => $count,
'recordsFiltered' => $count, 'recordsFiltered' => $count,
] ]

View File

@ -58,6 +58,10 @@ if (check_login()) {
if ($check_csv_button) { if ($check_csv_button) {
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
if (isset($permission) === false) {
$permission = '';
}
echo json_encode($permission); echo json_encode($permission);
return; return;
} else { } else {

View File

@ -446,11 +446,15 @@ if ($action === 'create_demo_data') {
$module_description = ''; $module_description = '';
if (isset($modules_array['description']) === true && is_string($modules_array['description']) === true) { if (isset($modules_array['description']) === true && is_string($modules_array['description']) === true) {
if (isset($mac) === false) {
$mac = '';
}
$module_description = str_replace('_mac_', $mac, $modules_array['description']); $module_description = str_replace('_mac_', $mac, $modules_array['description']);
} }
$values = [ $values = [
'unit' => $modules_array['unit'], 'unit' => (isset($modules_array['unit']) === true) ? $modules_array['unit'] : '',
'descripcion' => $module_description, 'descripcion' => $module_description,
'id_tipo_modulo' => $id_tipo, 'id_tipo_modulo' => $id_tipo,
'id_module_group' => ($modules_array['group'] ?? 0), 'id_module_group' => ($modules_array['group'] ?? 0),
@ -608,8 +612,12 @@ if ($action === 'create_demo_data') {
while (1) { while (1) {
// Insert in tmodule_inventory. // Insert in tmodule_inventory.
$modules_array = []; $modules_array = [];
foreach ($inventory as $key => $value) { if (isset($inventory) === true) {
$modules_array[$key] = ($value[$module_access_idx] ?? null); if ($inventory !== '') {
foreach ($inventory as $key => $value) {
$modules_array[$key] = ($value[$module_access_idx] ?? null);
}
}
} }
$module_access_idx++; $module_access_idx++;

View File

@ -41,6 +41,7 @@ if (check_login()) {
$get_plugin_macros = get_parameter('get_plugin_macros'); $get_plugin_macros = get_parameter('get_plugin_macros');
$get_module_macros = get_parameter('get_module_macros'); $get_module_macros = get_parameter('get_module_macros');
$is_policy = (bool) get_parameter('is_policy', 0);
$search_modules = get_parameter('search_modules'); $search_modules = get_parameter('search_modules');
$get_module_detail = get_parameter('get_module_detail', 0); $get_module_detail = get_parameter('get_module_detail', 0);
$get_module_autocomplete_input = (bool) get_parameter( $get_module_autocomplete_input = (bool) get_parameter(
@ -104,12 +105,22 @@ if (check_login()) {
$id_plugin = get_parameter('id_plugin', 0); $id_plugin = get_parameter('id_plugin', 0);
if ($id_plugin !== 0) { if ($id_plugin !== 0) {
$id_module_plugin = db_get_value( if ($is_policy === true) {
'id_plugin', $id_module_plugin = db_get_value(
'tagente_modulo', 'id_plugin',
'id_agente_modulo', 'tpolicy_modules',
$get_module_macros 'id',
); $get_module_macros
);
} else {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
}
if ($id_plugin !== $id_module_plugin) { if ($id_plugin !== $id_module_plugin) {
$get_plugin_macros = true; $get_plugin_macros = true;
$get_module_macros = 0; $get_module_macros = 0;
@ -145,12 +156,21 @@ if (check_login()) {
$module_id = $get_module_macros; $module_id = $get_module_macros;
$module_macros = db_get_value( if ($is_policy === true) {
'macros', $module_macros = db_get_value(
'tagente_modulo', 'macros',
'id_agente_modulo', 'tpolicy_modules',
$module_id 'id',
); $module_id
);
} else {
$module_macros = db_get_value(
'macros',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
}
$macros = []; $macros = [];
$macros['base64'] = base64_encode($module_macros); $macros['base64'] = base64_encode($module_macros);

View File

@ -452,7 +452,7 @@ class CustomNetScan extends Wizard
'label' => __('Task name'), 'label' => __('Task name'),
'arguments' => [ 'arguments' => [
'name' => 'taskname', 'name' => 'taskname',
'value' => $this->task['name'], 'value' => (isset($this->task['name']) === true) ? $this->task['name'] : '',
'type' => 'text', 'type' => 'text',
'size' => 50, 'size' => 50,
], ],
@ -474,7 +474,7 @@ class CustomNetScan extends Wizard
'label' => __('Comment'), 'label' => __('Comment'),
'arguments' => [ 'arguments' => [
'name' => 'comment', 'name' => 'comment',
'value' => $this->task['description'], 'value' => (isset($this->task['description']) === true) ? $this->task['description'] : '',
'type' => 'text', 'type' => 'text',
'size' => 50, 'size' => 50,
], ],
@ -496,7 +496,7 @@ class CustomNetScan extends Wizard
SERVER_TYPE_DISCOVERY SERVER_TYPE_DISCOVERY
), ),
'name' => 'id_recon_server', 'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'], 'selected' => (isset($this->task['id_recon_server']) === true) ? $this->task['id_recon_server'] : '',
'return' => true, 'return' => true,
], ],
]; ];
@ -509,7 +509,7 @@ class CustomNetScan extends Wizard
'returnAllGroup' => false, 'returnAllGroup' => false,
'privilege' => $this->access, 'privilege' => $this->access,
'type' => 'select_groups', 'type' => 'select_groups',
'selected' => $this->task['id_group'], 'selected' => (isset($this->task['id_group']) === true) ? $this->task['id_group'] : '',
'return' => true, 'return' => true,
'size' => '400px', 'size' => '400px',
], ],
@ -517,8 +517,10 @@ class CustomNetScan extends Wizard
// Interval and schedules. // Interval and schedules.
$interv_manual = 0; $interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) { if (isset($this->task['interval_sweep']) === true) {
$interv_manual = 1; if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
} }
// Schedule. // Schedule.
@ -541,7 +543,7 @@ class CustomNetScan extends Wizard
], ],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time( 'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval', 'interval',
$this->task['interval_sweep'], (isset($this->task['interval_sweep']) === true) ? $this->task['interval_sweep'] : '',
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')', 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
'', '',
'0', '0',

View File

@ -410,7 +410,7 @@ class Diagnostics extends Wizard
], ],
]; ];
$return .= '<div class="title-self-monitoring">'; $return = '<div class="title-self-monitoring">';
$return .= __( $return .= __(
'Graphs modules that represent the self-monitoring system' 'Graphs modules that represent the self-monitoring system'
); );
@ -423,7 +423,7 @@ class Diagnostics extends Wizard
$return .= '</div>'; $return .= '</div>';
} }
return $return; return ($return ?? '');
} }
@ -694,7 +694,7 @@ class Diagnostics extends Wizard
WHERE tagente_estado.estado = 4'; WHERE tagente_estado.estado = 4';
$notInitAgents = db_get_sql($sqlNotInitAgents); $notInitAgents = db_get_sql($sqlNotInitAgents);
$dateDbMantenaince = $config['db_maintance']; $dateDbMantenaince = ($config['db_maintance'] ?? '');
$currentTime = time(); $currentTime = time();
@ -1059,6 +1059,10 @@ class Diagnostics extends Wizard
$tFragmentationStatus = 1; $tFragmentationStatus = 1;
} }
if (isset($config['thousand_separator']) === false) {
$config['thousand_separator'] = '';
}
$result = [ $result = [
'error' => false, 'error' => false,
'data' => [ 'data' => [
@ -1844,6 +1848,10 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize); $sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog)); $sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
if (isset($config['thousand_separator']) === false) {
$config['thousand_separator'] = '';
}
$value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']); $value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs'); $message = __('You have more than 10 MB of logs');
$status = 0; $status = 0;

View File

@ -427,30 +427,32 @@ class EventSound extends HTML
); );
$data = db_get_all_rows_sql($sql); $data = db_get_all_rows_sql($sql);
foreach ($data as $key => $row) { if ($data !== false) {
if ($row['active'] === '1') { foreach ($data as $key => $row) {
$img = 'images/lightbulb.png'; if ($row['active'] === '1') {
$action = __('Disable sound'); $img = 'images/lightbulb.png';
$new_action = 0; $action = __('Disable sound');
} else { $new_action = 0;
$img = 'images/lightbulb_off.png'; } else {
$action = __('Enable sound'); $img = 'images/lightbulb_off.png';
$new_action = 1; $action = __('Enable sound');
$new_action = 1;
}
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
} }
$options = '<a href="index.php?sec=eventos&sec2=godmode/events/configuration_sounds';
$options .= '&action=change_action&id='.$row['id'].'&set_action='.$new_action.'">';
$options .= html_print_image(
$img,
true,
[
'title' => $action,
'class' => 'main_menu_icon invert_filter',
]
);
$options .= '</a>';
$data[$key]['options'] = $options;
} }
echo json_encode( echo json_encode(

View File

@ -186,9 +186,11 @@ class ExtensionsDiscovery extends Wizard
private function loadConfig() private function loadConfig()
{ {
$row = db_get_row('tdiscovery_apps', 'short_name', $this->mode); $row = db_get_row('tdiscovery_apps', 'short_name', $this->mode);
$this->id = $row['id_app']; if ($row !== false) {
$this->name = $row['name']; $this->id = $row['id_app'];
$this->description = $row['description']; $this->name = $row['name'];
$this->description = $row['description'];
}
} }
@ -415,7 +417,10 @@ class ExtensionsDiscovery extends Wizard
public function loadIni() public function loadIni()
{ {
global $config; global $config;
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED); $iniFile = false;
if (file_exists($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini') === true) {
$iniFile = parse_ini_file($config['homedir'].$this->path.'/'.$this->mode.'/discovery_definition.ini', true, INI_SCANNER_TYPED);
}
return $iniFile; return $iniFile;
} }
@ -2190,7 +2195,8 @@ class ExtensionsDiscovery extends Wizard
break; break;
default: default:
continue; // Nothing.
break;
} }
if ($value !== false) { if ($value !== false) {

View File

@ -208,12 +208,20 @@ class HTML
$i = 0; $i = 0;
foreach ($urls as $url) { foreach ($urls as $url) {
if (isset($url['selected']) === false) {
$url['selected'] = 0;
}
if ($url['selected'] == 1) { if ($url['selected'] == 1) {
$class = 'selected'; $class = 'selected';
} else { } else {
$class = ''; $class = '';
} }
if (isset($url['link']) === false) {
$url['link'] = '';
}
$bc[$i] = ''; $bc[$i] = '';
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">'; $bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label']; $bc[$i] .= $url['label'];
@ -618,6 +626,10 @@ class HTML
public static function printBlockAsGrid(array $input, bool $return=false) public static function printBlockAsGrid(array $input, bool $return=false)
{ {
$output = ''; $output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) { if ($input['hidden'] == 1) {
$class = ' hidden'; $class = ' hidden';
} else { } else {
@ -628,6 +640,14 @@ class HTML
$class = $input['class'].$class; $class = $input['class'].$class;
} }
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (isset($input['block_class']) === false) {
$input['block_class'] = '';
}
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
if (empty($input['label']) === false) { if (empty($input['label']) === false) {
$output .= '<div class="label_select">'; $output .= '<div class="label_select">';
@ -637,13 +657,29 @@ class HTML
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<ul class="wizard '.$input['block_class'].'">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.($input['block_id'] ?? '').'" class="'.$class.'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= self::printBlockAsGrid($input, $return); $output .= self::printBlockAsGrid($input, $return);
} }
$output .= '</ul></li>'; $output .= '</ul></li>';
} else { } else {
if (isset($input['arguments']['inline']) === false) {
$input['arguments']['inline'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if (isset($input['arguments']) === false) {
$input['arguments'] = '';
}
if (isset($input['arguments']['type']) === false) {
$input['arguments']['type'] = '';
}
if ($input['arguments']['type'] != 'hidden' if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended' && $input['arguments']['type'] != 'hidden_extended'
) { ) {
@ -729,6 +765,10 @@ class HTML
public static function printBlockAsList(array $input, bool $return=false) public static function printBlockAsList(array $input, bool $return=false)
{ {
$output = ''; $output = '';
if (isset($input['hidden']) === false) {
$input['hidden'] = 0;
}
if ($input['hidden'] == 1) { if ($input['hidden'] == 1) {
$class = ' hidden'; $class = ' hidden';
} else { } else {
@ -739,6 +779,10 @@ class HTML
$class = $input['class'].$class; $class = $input['class'].$class;
} }
if (isset($input['block_content']) === false) {
$input['block_content'] = '';
}
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
@ -749,6 +793,14 @@ class HTML
$output .= '</ul></li>'; $output .= '</ul></li>';
} else { } else {
if (isset($input['id']) === false) {
$input['id'] = '';
}
if (isset($input['extra']) === false) {
$input['extra'] = '';
}
if ($input['arguments']['type'] != 'hidden' if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended' && $input['arguments']['type'] != 'hidden_extended'
) { ) {
@ -949,6 +1001,46 @@ class HTML
{ {
$form = $data['form']; $form = $data['form'];
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
if (isset($form['enctype']) === false) {
$form['enctype'] = '';
}
$rows = $data['rows']; $rows = $data['rows'];
$rawInputs = $data['rawInputs']; $rawInputs = $data['rawInputs'];
$js = $data['js']; $js = $data['js'];
@ -987,7 +1079,15 @@ class HTML
if (is_array($rows)) { if (is_array($rows)) {
foreach ($rows as $row) { foreach ($rows as $row) {
if ($row['new_form_block'] == true) { if (isset($row['class']) === false) {
$row['class'] = '';
}
if (isset($row['style']) === false) {
$row['style'] = '';
}
if (isset($row['new_form_block']) === true) {
if ($first_block_printed === true) { if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one. // If first form block has been placed, then close it before starting a new one.
$output .= '</div>'; $output .= '</div>';
@ -1015,30 +1115,38 @@ class HTML
// Toggle option. // Toggle option.
foreach ($column['inputs'] as $input) { foreach ($column['inputs'] as $input) {
if (is_array($input)) { if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') { if (isset($input['arguments']) === true) {
if ($input['toggle'] === true) { if ($input['arguments']['type'] != 'submit') {
$output .= ui_print_toggle( if (isset($input['toggle']) === true) {
[ if ($input['toggle'] === true) {
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()), $output .= ui_print_toggle(
'title' => $input['toggle_title'], [
'id' => $input['toggle_id'], 'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'hidden_default' => $input['toggle_hidden_default'], 'title' => $input['toggle_title'],
'content' => self::printBlockAsGrid( 'id' => $input['toggle_id'],
$input, 'hidden_default' => $input['toggle_hidden_default'],
true 'content' => self::printBlockAsGrid(
), $input,
'return' => true, true
'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()), ),
'toggle_class' => $input['toggle_toggle_class'], 'return' => true,
'main_class' => $input['toggle_main_class'], 'name' => (isset($input['toggle_name']) ? $input['toggle_name'] : 'toggle_'.uniqid()),
'container_class' => $input['toggle_container_class'], 'toggle_class' => $input['toggle_toggle_class'],
'img_a' => $input['toggle_img_a'], 'main_class' => $input['toggle_main_class'],
'img_b' => $input['toggle_img_b'], 'container_class' => $input['toggle_container_class'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true), 'img_a' => $input['toggle_img_a'],
] 'img_b' => $input['toggle_img_b'],
); 'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true),
]
);
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else {
$output .= self::printBlockAsGrid($input, true);
}
} else { } else {
$output .= self::printBlockAsGrid($input, true); $output_submit .= self::printBlockAsGrid($input, true);
} }
} else { } else {
$output_submit .= self::printBlockAsGrid($input, true); $output_submit .= self::printBlockAsGrid($input, true);
@ -1089,6 +1197,34 @@ class HTML
*/ */
public static function printFormAsList(array $data, bool $return=false) public static function printFormAsList(array $data, bool $return=false)
{ {
if (isset($data['rows']) === false) {
$data['rows'] = '';
}
if (isset($data['rawInputs']) === false) {
$data['rawInputs'] = '';
}
if (isset($data['js']) === false) {
$data['js'] = '';
}
if (isset($data['js_block']) === false) {
$data['js_block'] = '';
}
if (isset($data['cb_function']) === false) {
$data['cb_function'] = null;
}
if (isset($data['cb_args']) === false) {
$data['cb_args'] = [];
}
if (isset($form['class']) === false) {
$form['class'] = '';
}
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
$rawInputs = $data['rawInputs']; $rawInputs = $data['rawInputs'];
@ -1097,6 +1233,18 @@ class HTML
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
if (isset($form['onsubmit']) === false) {
$form['onsubmit'] = '';
}
if (isset($form['extra']) === false) {
$form['extra'] = '';
}
if (isset($form['enctype']) === false) {
$form['enctype'] = '';
}
$output_head = '<form class="discovery max_floating_element_size" id="'.$form['id'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form class="discovery max_floating_element_size" id="'.$form['id'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
@ -1117,7 +1265,7 @@ class HTML
$output = '<div class="white_box pdd_15px">'; $output = '<div class="white_box pdd_15px">';
$output .= '<ul class="wizard">'; $output .= '<ul class="wizard">';
$output_submit = '';
foreach ($inputs as $input) { foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') { if ($input['arguments']['type'] != 'submit') {
$output .= self::printBlockAsList($input, true); $output .= self::printBlockAsList($input, true);

View File

@ -780,8 +780,13 @@ class ModuleTemplates extends HTML
private function setNetworkProfile() private function setNetworkProfile()
{ {
$profileInfo = db_get_row('tnetwork_profile', 'id_np', $this->id_np); $profileInfo = db_get_row('tnetwork_profile', 'id_np', $this->id_np);
$this->name = $profileInfo['name']; if ($profileInfo !== false) {
$this->description = $profileInfo['description']; $this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
} else {
$this->name = '';
$this->description = '';
}
$penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]); $penInfo = db_get_all_rows_filter('tnetwork_profile_pen', ['id_np' => $this->id_np]);
$penList = []; $penList = [];

View File

@ -199,6 +199,10 @@ class SnmpConsole extends HTML
).'</a>'; ).'</a>';
$list['active'] = true; $list['active'] = true;
if (isset($screen) === false) {
$screen = '';
}
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
__('SNMP Console'), __('SNMP Console'),

View File

@ -646,7 +646,7 @@ class TipsWindow
['class' => 'main_menu_icon'] ['class' => 'main_menu_icon']
); );
$data[$key]['edit'] .= '</a>'; $data[$key]['edit'] .= '</a>';
$data[$key]['delete'] .= '<form name="grupo" method="post" class="rowPair table_action_buttons" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=welcome_tips&action=delete">'; $data[$key]['delete'] = '<form name="grupo" method="post" class="rowPair table_action_buttons" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=welcome_tips&action=delete">';
$data[$key]['delete'] .= html_print_input_image( $data[$key]['delete'] .= html_print_input_image(
'button_delete_tip', 'button_delete_tip',
'images/delete.svg', 'images/delete.svg',
@ -1087,7 +1087,7 @@ class TipsWindow
return false; return false;
} }
if ($images !== null) { if ($images !== '') {
foreach ($images as $key => $image) { foreach ($images as $key => $image) {
$res = db_process_sql_insert( $res = db_process_sql_insert(
'twelcome_tip_file', 'twelcome_tip_file',

View File

@ -738,6 +738,22 @@ class Tree
if ($module['showGraphs']) { if ($module['showGraphs']) {
$tresholds = true; $tresholds = true;
if (isset($module['min_warning']) === false) {
$module['min_warning'] = '';
}
if (isset($module['max_warning']) === false) {
$module['max_warning'] = '';
}
if (isset($module['min_critical']) === false) {
$module['min_critical'] = '';
}
if (isset($module['max_critical']) === false) {
$module['max_critical'] = '';
}
if (empty((float) $module['min_warning']) === true if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true && empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true && empty($module['warning_inverse']) === true

View File

@ -621,6 +621,10 @@ class TreeGroup extends Tree
protected function getDisplayHierarchy() protected function getDisplayHierarchy()
{ {
if (isset($this->filter['searchHirearchy']) === false) {
$this->filter['searchHirearchy'] = '';
}
return $this->filter['searchHirearchy'] || return $this->filter['searchHirearchy'] ||
(empty($this->filter['searchAgent']) && empty($this->filter['searchModule'])); (empty($this->filter['searchAgent']) && empty($this->filter['searchModule']));
} }

View File

@ -376,10 +376,6 @@ class WelcomeWindow extends Wizard
'class' => 'modal', 'class' => 'modal',
]; ];
if (enterprise_installed() === true) {
$logo_url = ENTERPRISE_DIR.'/'.$logo_url;
}
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$flag_um = false; $flag_um = false;
$flag_cm = false; $flag_cm = false;
@ -768,6 +764,10 @@ class WelcomeWindow extends Wizard
], ],
true true
); );
if (isset($agents_num) === false) {
$agents_num = '';
}
echo html_print_label_input_block( echo html_print_label_input_block(
__('Number of agents to be created'), __('Number of agents to be created'),
html_print_div( html_print_div(
@ -1214,6 +1214,10 @@ class WelcomeWindow extends Wizard
__('Agent'), __('Agent'),
ui_print_agent_autocomplete_input($params) ui_print_agent_autocomplete_input($params)
); );
if (isset($modules) === false) {
$modules = '';
}
echo html_print_label_input_block( echo html_print_label_input_block(
__('Module'), __('Module'),
html_print_select( html_print_select(

View File

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

View File

@ -1279,7 +1279,7 @@ function agents_get_group_agents(
} }
if (is_array($search) === true) { if (is_array($search) === true) {
if (!$search['all_agents']) { if (isset($search['all_agents']) === false) {
$filter['disabled'] = 0; $filter['disabled'] = 0;
if (isset($search['disabled']) === true) { if (isset($search['disabled']) === true) {
$filter['disabled'] = (int) $search['disabled']; $filter['disabled'] = (int) $search['disabled'];

View File

@ -593,7 +593,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false. // Check ACL in reports_get_report return false.
if ($report === false) { if ($report === false) {
continue; break;
} }
$email = ui_print_truncate_text($args[1], 120); $email = ui_print_truncate_text($args[1], 120);
@ -656,7 +656,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false. // Check ACL in reports_get_report return false.
if ($template === false) { if ($template === false) {
continue; break;
} }
if (empty($args[1]) === false && (string) $args[1] !== '0') { if (empty($args[1]) === false && (string) $args[1] !== '0') {
@ -777,7 +777,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false. // Check ACL in reports_get_report return false.
if ($report === false) { if ($report === false) {
continue; break;
} }
$path = $args[1]; $path = $args[1];
@ -817,7 +817,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false. // Check ACL in reports_get_report return false.
if ($report === false) { if ($report === false) {
continue; break;
} }
$path = $args[1]; $path = $args[1];

View File

@ -289,6 +289,10 @@ function agent_counters_custom_fields($filters)
} }
} }
if (isset($groups_and) === false) {
$groups_and = '';
}
// Filter by status module. // Filter by status module.
$empty_agents_count = "UNION ALL $empty_agents_count = "UNION ALL
SELECT ta.id_agente, SELECT ta.id_agente,
@ -616,6 +620,10 @@ function agent_counters_custom_fields($filters)
$result_meta = []; $result_meta = [];
$data = []; $data = [];
if (isset($and_module_search) === false) {
$and_module_search = '';
}
$query = sprintf( $query = sprintf(
"SELECT tcd.description AS name_data, "SELECT tcd.description AS name_data,
SUM(IF($agent_state_total, 1, 0)) AS a_agents, SUM(IF($agent_state_total, 1, 0)) AS a_agents,
@ -677,6 +685,11 @@ function agent_counters_custom_fields($filters)
$result_meta[] = db_get_all_rows_sql($query); $result_meta[] = db_get_all_rows_sql($query);
if (isset($server_data) === false) {
$server_data = [];
$server_data['id'] = '';
}
$query_data = sprintf( $query_data = sprintf(
"SELECT "SELECT
tcd.description, tcd.description,

View File

@ -526,8 +526,10 @@ function filemanager_file_explorer(
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true)); $allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
$allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true; $allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true;
if ($options['denyCreateText'] === true) { if (isset($options['denyCreateText']) === true) {
$allowCreateText = false; if ($options['denyCreateText'] === true) {
$allowCreateText = false;
}
} }
if ($homedir_filemanager === false) { if ($homedir_filemanager === false) {
@ -1065,8 +1067,10 @@ function filemanager_file_explorer(
$modal_real_path = "<div><b>Real path to plugin execution is:</b></div> $modal_real_path = "<div><b>Real path to plugin execution is:</b></div>
<div id='real_path'></div>"; <div id='real_path'></div>";
if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') { if (isset($_SERVER['HTTPS']) === true) {
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, ['icon' => 'wand', 'mode' => 'mini'], true).'</div>'; if ($_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
$modal_real_path .= "<div style='float:right;margin: 5em 0 0 auto';>".html_print_submit_button(__('Copy'), 'submit', false, ['icon' => 'wand', 'mode' => 'mini'], true).'</div>';
}
} }
html_print_div( html_print_div(

View File

@ -737,6 +737,10 @@ function grafico_modulo_sparse($params)
$params['backgroundColor'] = 'white'; $params['backgroundColor'] = 'white';
} }
if (isset($params['vconsole']) === false) {
$params['vconsole'] = false;
}
if (isset($params['only_image']) === true && $params['vconsole'] !== true) { if (isset($params['only_image']) === true && $params['vconsole'] !== true) {
$params['backgroundColor'] = 'transparent'; $params['backgroundColor'] = 'transparent';
} }
@ -903,6 +907,10 @@ function grafico_modulo_sparse($params)
// Format of the graph. // Format of the graph.
if (empty($params['unit']) === true) { if (empty($params['unit']) === true) {
if (isset($module_data['unit']) === false) {
$module_data['unit'] = '';
}
$params['unit'] = $module_data['unit']; $params['unit'] = $module_data['unit'];
if (modules_is_unit_macro($params['unit'])) { if (modules_is_unit_macro($params['unit'])) {
$params['unit'] = ''; $params['unit'] = '';
@ -1008,6 +1016,10 @@ function grafico_modulo_sparse($params)
$data_module_graph = []; $data_module_graph = [];
} }
if (isset($series_suffix) === false) {
$series_suffix = '';
}
$data_module_graph['series_suffix'] = $series_suffix; $data_module_graph['series_suffix'] = $series_suffix;
// Check available data. // Check available data.
@ -4701,11 +4713,13 @@ function graph_nodata_image($options)
{ {
global $config; global $config;
if ($options['base64'] === true) { if (isset($options['base64']) === true) {
$dataImg = file_get_contents( if ($options['base64'] === true) {
$config['homedir'].'/images/image_problem_area_150.png' $dataImg = file_get_contents(
); $config['homedir'].'/images/image_problem_area_150.png'
return base64_encode($dataImg); );
return base64_encode($dataImg);
}
} }
$style = ''; $style = '';

View File

@ -196,7 +196,7 @@ function groupview_get_groups_list($id_user=false, $access='AR', $is_not_paginat
$list[$id_group]['_monitors_not_init_'] = (int) $modules_counters[$id_group]['total_module_not_init']; $list[$id_group]['_monitors_not_init_'] = (int) $modules_counters[$id_group]['total_module_not_init'];
$list[$id_group]['_monitors_ok_'] = (int) $modules_counters[$id_group]['total_module_normal']; $list[$id_group]['_monitors_ok_'] = (int) $modules_counters[$id_group]['total_module_normal'];
$list[$id_group]['_monitor_checks_'] = (int) $modules_counters[$id_group]['total_module']; $list[$id_group]['_monitor_checks_'] = (int) $modules_counters[$id_group]['total_module'];
$list[$id_group]['_monitor_not_normal_'] = ($list[$group['id_grupo']]['_monitor_checks_'] - $list[$group['id_grupo']]['_monitors_ok_']); $list[$id_group]['_monitor_not_normal_'] = ($modules_counters[$id_group]['total_module'] - $modules_counters[$id_group]['total_module_normal']);
$list[$id_group]['_monitors_alerts_fired_'] = (int) $modules_counters[$id_group]['total_module_alerts']; $list[$id_group]['_monitors_alerts_fired_'] = (int) $modules_counters[$id_group]['total_module_alerts'];
} }

View File

@ -2075,7 +2075,7 @@ function html_print_extended_select_for_post_process(
$found = false; $found = false;
if ($selected) { if ($selected) {
if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) { if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')), $fields)) {
$found = true; $found = true;
} }
} }
@ -5579,7 +5579,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_image( $output .= html_print_input_image(
((isset($data['name']) === true) ? $data['name'] : ''), ((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'], $data['src'],
$data['value'], ($data['value'] ?? ''),
((isset($data['style']) === true) ? $data['style'] : ''), ((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false) ((isset($data['options']) === true) ? $data['options'] : false)
@ -5819,7 +5819,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'checkbox': case 'checkbox':
$output .= html_print_checkbox( $output .= html_print_checkbox(
$data['name'], ((isset($data['name']) === true) ? $data['name'] : ''),
($data['value'] ?? null), ($data['value'] ?? null),
((isset($data['checked']) === true) ? $data['checked'] : false), ((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
@ -5859,9 +5859,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'textarea': case 'textarea':
$output .= html_print_textarea( $output .= html_print_textarea(
$data['name'], (isset($data['name']) === true) ? $data['name'] : '',
$data['rows'], (isset($data['rows']) === true) ? $data['rows'] : '',
$data['columns'], (isset($data['columns']) === true) ? $data['columns'] : '',
((isset($data['value']) === true) ? $data['value'] : ''), ((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''), ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
@ -7416,8 +7416,9 @@ function html_print_select_date_range(
$output .= '</div>'; $output .= '</div>';
$output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>'; $output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>';
$table = new stdClass(); $table = new stdClass();
$table->data = [];
$table->class = 'table-adv-filter'; $table->class = 'table-adv-filter';
$table->data[0][0] .= '<div><div><div><span class="font-title-font">'.__('From').':</span></div>'; $table->data[0][0] = '<div><div><div><span class="font-title-font">'.__('From').':</span></div>';
$table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; $table->data[0][0] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
$table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; $table->data[0][0] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
$table->data[0][0] .= '</div>'; $table->data[0][0] .= '</div>';
@ -7741,3 +7742,45 @@ function print_email_test_modal_window($id)
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>'; echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>';
} }
function dot_tab(array $tabs=[], array $jump_to=[])
{
$tabs_link = '<div class="dot-tab-link">';
if (isset($tabs) === true) {
foreach ($tabs as $value) {
$tabs_link .= $value;
}
}
$tabs_link .= '</div>';
$tabs_jump_to = '';
if (isset($jump_to) === true) {
foreach ($jump_to as $value) {
$tabs_jump_to .= $value;
}
}
$output = '
<div class="dot-tab">
<div></div>
<div></div>
<div></div>
<div class="dot-tab-menu-overlay">
<div class="dot-tab-menu">
'.$tabs_link;
if ($tabs_jump_to !== '') {
$output .= '<div class="dot-tab-jump-to">
<span class="muted-text ml15">'.__('Jump to').':</span>
'.$tabs_jump_to.'
</div>';
}
$output .= '</div>
</div>
</div>
';
return $output;
}

View File

@ -788,22 +788,24 @@ function inventory_get_datatable(
$rows = db_get_all_rows_sql($sql); $rows = db_get_all_rows_sql($sql);
if ($order_by_agent === false) { if ($order_by_agent === false) {
$modules = []; $modules = [];
foreach ($rows as $row) { if ($rows !== false) {
if ($row['utimestamp'] !== $row['last_update']) { foreach ($rows as $row) {
$row['timestamp'] = $row['last_update_timestamp']; if ($row['utimestamp'] !== $row['last_update']) {
} $row['timestamp'] = $row['last_update_timestamp'];
$data_rows = explode(PHP_EOL, $row['data_inventory']);
foreach ($data_rows as $data_key => $data_value) {
if (empty($inventory_search_string) !== true) {
$search_check = strpos(str_replace('&#x20;', ' ', $data_value), $inventory_search_string);
} else {
$search_check = true;
} }
if (empty($data_value) === false && $search_check !== false) { $data_rows = explode(PHP_EOL, $row['data_inventory']);
$row['data'] = $data_value; foreach ($data_rows as $data_key => $data_value) {
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row; if (empty($inventory_search_string) !== true) {
$search_check = strpos(str_replace('&#x20;', ' ', $data_value), $inventory_search_string);
} else {
$search_check = true;
}
if (empty($data_value) === false && $search_check !== false) {
$row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
}
} }
} }
} }

View File

@ -699,9 +699,9 @@ function menu_get_sec($with_categories=false)
} }
$sec_array[$k]['optgroup'] = $category; $sec_array[$k]['optgroup'] = $category;
$sec_array[$k]['name'] = $v['text']; $sec_array[$k]['name'] = (isset($v['text']) === true) ? $v['text'] : '';
} else { } else {
$sec_array[$k] = $v['text']; $sec_array[$k] = (isset($v['text']) === true) ? $v['text'] : '';
} }
} }

View File

@ -2700,6 +2700,14 @@ function modules_get_agentmodule_data_for_humans($module)
if ($data_macro !== false) { if ($data_macro !== false) {
$salida = $data_macro; $salida = $data_macro;
} else { } else {
if (isset($module['current_interval']) === false) {
$module['current_interval'] = 0;
}
if (isset($module['module_name']) === false) {
$module['module_name'] = 0;
}
$salida = ui_print_module_string_value( $salida = ui_print_module_string_value(
$module['datos'], $module['datos'],
empty($module['id']) ? $module['id_agente_modulo'] : $module['id'], empty($module['id']) ? $module['id_agente_modulo'] : $module['id'],
@ -5074,3 +5082,28 @@ function modules_made_compatible($id_tipo_modulo)
return true; return true;
} }
} }
/**
* Check if module is used by agent for Safe mode.
*
* @param integer $id_module Id for module to check
*
* @return boolean
*/
function modules_check_safe_mode($id_module)
{
$id_agent = modules_give_agent_id_from_module_id($id_module);
if ($id_agent === 0) {
// No exist agent with this id.
return false;
}
$agent = agents_get_agent($id_agent);
if (isset($agent['safe_mode_module']) === true && (int) $agent['safe_mode_module'] === (int) $id_module) {
return true;
} else {
return false;
}
}

View File

@ -144,7 +144,7 @@ function config_wiz_modal(
'UTC' => __('UTC'), 'UTC' => __('UTC'),
]; ];
if ($zone_selected == '') { if (isset($zone_selected) === false) {
if ($config['timezone'] != '') { if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']); $zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0]; $zone_selected = $zone_array[0];

View File

@ -1435,7 +1435,7 @@ function custom_fields_macros_report($macro, $key_macro)
$macro['server_id'] $macro['server_id']
); );
if (metaconsole_connect($server) != NOERR) { if (metaconsole_connect($server) != NOERR) {
continue; break;
} }
} }

View File

@ -741,7 +741,7 @@ function snmp_browser_print_container(
) )
); );
$table->data[0][1] .= html_print_label_input_block( $table->data[0][1] = html_print_label_input_block(
__('Port'), __('Port'),
html_print_input( html_print_input(
[ [

View File

@ -4022,19 +4022,21 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order; $parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction; $parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) { if (isset($parameters['no_sortable_columns']) === true) {
$found = array_search( foreach ($parameters['no_sortable_columns'] as $key => $find) {
$parameters['no_sortable_columns'][$key], $found = array_search(
$columns_tmp $parameters['no_sortable_columns'][$key],
); $columns_tmp
);
if ($found !== false) { if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]); unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found); array_push($parameters['no_sortable_columns'], $found);
} }
if (is_int($parameters['no_sortable_columns'][$key]) === false) { if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]); unset($parameters['no_sortable_columns'][$key]);
}
} }
} }
@ -4098,11 +4100,13 @@ function ui_print_datatable(array $parameters)
$filter .= '<ul class="datatable_filter content filter_table no_border">'; $filter .= '<ul class="datatable_filter content filter_table no_border">';
foreach ($parameters['form']['inputs'] as $input) { if (isset($parameters['form']['inputs']) === true) {
if ($input['type'] === 'date_range') { foreach ($parameters['form']['inputs'] as $input) {
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>'; if ($input['type'] === 'date_range') {
} else { $filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
$filter .= html_print_input(($input + ['return' => true]), 'li'); } else {
$filter .= html_print_input(($input + ['return' => true]), 'li');
}
} }
} }
@ -4252,7 +4256,7 @@ function ui_print_datatable(array $parameters)
} }
$parameters['phpDate'] = date('Y-m-d'); $parameters['phpDate'] = date('Y-m-d');
$parameters['dataElements'] = json_encode($parameters['data_element']); $parameters['dataElements'] = (isset($parameters['data_element']) === true) ? json_encode($parameters['data_element']) : '';
// * START JAVASCRIPT. // * START JAVASCRIPT.
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js'; $file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';
@ -5236,7 +5240,8 @@ function ui_print_standard_header(
bool $godmode=false, bool $godmode=false,
array $options=[], array $options=[],
array $breadcrumbs=[], array $breadcrumbs=[],
array $fav_menu_config=[] array $fav_menu_config=[],
string $dots='',
) { ) {
// For standard breadcrumbs. // For standard breadcrumbs.
ui_require_css_file('discovery'); ui_require_css_file('discovery');
@ -5275,7 +5280,8 @@ function ui_print_standard_header(
'', '',
$headerInformation->printHeader(true), $headerInformation->printHeader(true),
false, false,
$fav_menu_config $fav_menu_config,
$dots
); );
if ($return !== true) { if ($return !== true) {
echo $output; echo $output;
@ -5316,7 +5322,8 @@ function ui_print_page_header(
$alias='', $alias='',
$breadcrumbs='', $breadcrumbs='',
$hide_left_small=false, $hide_left_small=false,
$fav_menu_config=[] $fav_menu_config=[],
$dots='',
) { ) {
global $config; global $config;
@ -5447,12 +5454,22 @@ function ui_print_page_header(
} }
} }
$buffer .= '</ul></div>'; $buffer .= '</ul>';
if (isset($dots) === true) {
$buffer .= '<div id="menu_dots">'.$dots.'</div>';
}
$buffer .= '</div>';
} else { } else {
if ($options != '') { if ($options != '') {
$buffer .= '<div id="menu_tab"><ul class="mn"><li>'; $buffer .= '<div id="menu_tab"><ul class="mn"><li>';
$buffer .= $options; $buffer .= $options;
$buffer .= '</li></ul></div>'; $buffer .= '</li></ul>';
if (isset($dots) === true) {
$buffer .= '<div id="menu_dots">'.$dots.'</div>';
}
$buffer .= '</div>';
} }
} }
@ -6780,6 +6797,10 @@ function ui_print_module_string_value(
$value = io_safe_input($value); $value = io_safe_input($value);
} }
if (isset($module) === false) {
$module['datos'] = '';
}
$is_snapshot = is_snapshot_data($module['datos']); $is_snapshot = is_snapshot_data($module['datos']);
$is_large_image = is_text_to_black_string($module['datos']); $is_large_image = is_text_to_black_string($module['datos']);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) { if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {

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