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_end
# Number processes
module_begin
module_name Number processes

View File

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

View File

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

View File

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
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
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,7 +91,7 @@ function mainModuleGroups()
$module_group_search = get_parameter('module_group_search', '');
// 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,
function ($v) use ($user_groups) {
@ -112,7 +112,7 @@ function mainModuleGroups()
);
if (empty($info) === false) {
$groups_view = ($is_not_paginated) ? $info : array_slice(
$groups_view = (isset($is_not_paginated) === true) ? $info : array_slice(
$info,
$offset,
$config['block_size']
@ -374,6 +374,10 @@ function mainModuleGroups()
'…'
);
$j = 1;
if (isset($background_color) === false) {
$background_color = 'none';
}
if (isset($array_data[$key])) {
foreach ($value['gm'] as $k => $v) {
if (isset($array_data[$key][$k])) {

View File

@ -273,6 +273,14 @@ function buildConnectionURL($method)
{
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'];
$use_ssl = ($method === 'ssh') ? $config['gotty_ssh_use_ssl'] : $config['gotty_telnet_use_ssl'];
$protocol = ((bool) $use_ssl === true) ? 'https://' : 'http://';
@ -353,6 +361,18 @@ function quickShellSettings()
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) {
config_update_value('gotty_addr', $gotty_addr);
}
@ -389,6 +409,25 @@ function quickShellSettings()
$general_table->data = [];
$general_table->style = [];
$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(
__('Address'),

View File

@ -229,7 +229,7 @@ function users_extension_main_god($god=true)
$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[1] = $last_login_data['ip_origin'];
$data[1] = $last_login_data['ip_origen'];
$data[2] = date($config['date_format'], $last_login_data['utimestamp']);
$data[3] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data);

View File

@ -161,6 +161,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
'code' => false,
];
if (isset($_GET['sec']) === false) {
$_GET['sec'] = '';
}
if (!isset($_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 '<br/> <br/>';
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 (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
if (isset($config['logged']) === true) {
if ($config['logged'] == false) {
if (session_status() === PHP_SESSION_ACTIVE) {
session_destroy();
}
}
}
?>

View File

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

View File

@ -816,6 +816,23 @@ if ($id_agente) {
$helper = ($help_header === 'main_tab') ? 'main_tab' : '';
$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) {
ui_print_standard_header(
__('Agent setup view').' ( '.strtolower(agents_get_alias($id_agente)).' )',
@ -837,7 +854,9 @@ if ($id_agente) {
'link' => '',
'label' => $tab_name,
],
]
],
[],
$dots
);
}
} else {
@ -857,7 +876,9 @@ if ($id_agente) {
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente',
'label' => __('Manage agents'),
],
]
],
[],
$dots
);
}
@ -2334,6 +2355,23 @@ if ($delete_module) {
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.
module_check_childrens_and_delete($id_borrar_modulo);

View File

@ -55,7 +55,7 @@ if ($id_field) {
$display_on_front = $field['display_on_front'];
$is_password_type = $field['is_password_type'];
$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'];
$header_title = __('Update agent custom field');
} 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(
__('Enabled combo'),
html_print_checkbox_switch_extended(

View File

@ -164,12 +164,13 @@ foreach ($password_fields as $k => $p) {
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_macros_fields('simple-macro', moduleId);
load_plugin_macros_fields('simple-macro', moduleId, isPolicy);
forced_title_callback();
$('select#id_plugin').select2('close');

View File

@ -109,7 +109,7 @@ if (is_ajax()) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_description = $fields_descriptions[($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)) {

View File

@ -253,7 +253,7 @@ if (is_metaconsole() === true) {
echo '<br>';
}
if (!$id_cluster) {
if (isset($id_cluster) === false) {
ui_toggle(
$form_filter,
'<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.'">';
$actionButtons = html_print_submit_button(
__('Create'),

View File

@ -242,6 +242,7 @@ if (empty($result) === false) {
html_print_table($table);
$tablePagination = ui_pagination($total_categories, $url, $offset, 0, true, 'offset', false);
} else {
$tablePagination = '';
// No categories available or selected.
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>';
// 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'];
} else if ($config['extensions'][$file]['godmode_menu']) {
} else if (isset($config['extensions'][$file]['godmode_menu']) === true) {
$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'];
} 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'];
} else {
$data[] = __('N/A');
@ -216,7 +216,7 @@ foreach ($extensions as $file => $extension) {
$data[] = $config['extensions'][$file]['godmode_menu']['version'];
} else if (isset($config['extensions'][$file]['extension_ope_tab'])) {
$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'];
} else {
$data[] = __('N/A');

View File

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

View File

@ -138,7 +138,7 @@ $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_label_input_block(
__('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();

View File

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

View File

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

View File

@ -476,12 +476,12 @@ if (is_metaconsole() === false) {
$timezone_name = 'Asia/Shanghai';
}
$area_data_timezone_polys .= '';
$area_data_timezone_polys = '';
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_rects .= '';
$area_data_timezone_rects = '';
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).'" />';
}
@ -543,7 +543,7 @@ echo sprintf(
'<div class="edit_user_options">%s %s %s %s %s %s %s %s %s %s</div>',
$language,
$size_pagination,
$skin,
($skin ?? ''),
$home_screen,
$event_filter,
$autorefresh_show,

View File

@ -348,6 +348,10 @@ if (check_acl($config['id_user'], 0, 'UM')) {
$onheader['user_agents'] = $userstab;
}
if (isset($servicestab) === false) {
$servicestab = '';
}
$onheader['massive_alerts'] = $alertstab;
$onheader['massive_policies_alerts'] = $policiesalertstab;
$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) {
$show_ipam = false;
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$show_ipam = true;
break;
if ($ipam !== false) {
foreach ($ipam as $row) {
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
$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;
$toggleFilters = '<form class="filters_form" method="POST" action="'.$filter_action_url.'">';
$toggleFilters .= html_print_table($table, true);
@ -824,7 +830,7 @@ foreach ($components as $component) {
$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[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);
$offset = (int) get_parameter('offset');
$table_aux = new stdClass();
if (isset($strict_user) === false) {
$strict_user = false;
}
$table_aux->width = '100%';
if (is_metaconsole() === true) {
@ -273,7 +276,11 @@ if (is_metaconsole() === 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_div(

View File

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

View File

@ -285,7 +285,11 @@ switch ($activeTab) {
}
// 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['height'] = $height;

View File

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

View File

@ -496,8 +496,8 @@ if (isset($_GET['server']) === true) {
<script language="javascript" type="text/javascript">
$(document).ready (function () {
var id_server = '<?php echo $id_server; ?>';
var server_type = '<?php echo $row['server_type']; ?>';
var id_server = '<?php echo ($id_server ?? ''); ?>';
var server_type = '<?php echo ($row['server_type'] ?? ''); ?>';
$("#check_exec_server img").on("click", function () {
$("#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');
if (isset($locked) === false) {
$locked = '';
}
?>
<script type="text/javascript">

View File

@ -523,27 +523,29 @@ if ($error === null) {
}
}
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
if (isset($uploaded_filename) === true) {
if (file_exists($uploaded_filename) === true) {
if (is_metaconsole() === true && is_management_allowed() === true) {
// Keep uploaded file to be transferred to nodes.
if (is_dir($config['attachment_store'].'/downloads/') === false) {
mkdir($config['attachment_store'].'/downloads/');
}
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
if ($keep === false) {
$error = __(
'Cannot move uploaded file to %s.',
$config['attachment_store'].'/downloads/'
$keep = move_uploaded_file(
$uploaded_filename,
$config['attachment_store'].'/downloads/'.$filename
);
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.
$data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['server_name'];
if ($server['master'] == $master) {
$data[3] .= __('Yes', true);
$data[3] = __('Yes', true);
} else {
$data[3] .= __('-');
$data[3] = __('-');
}
if ((int) $server['exec_proxy'] === 1) {

View File

@ -70,6 +70,10 @@ if (isset($config['filemanager']['message']) === true) {
// Add custom directories here.
$fallback_directory = 'images';
// Get directory.
if (isset($text) === false) {
$text = '';
}
$directory = (string) get_parameter('directory');
$directory = str_replace('&lt;', '', $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'].'/');
// 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);
$stripped_parts = array_filter(

View File

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

View File

@ -389,6 +389,10 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
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>';
}

View File

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

View File

@ -386,6 +386,28 @@ switch ($section) {
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.
ui_print_standard_header(
__('Setup').' &raquo; '.$subpage,
@ -403,7 +425,9 @@ ui_print_standard_header(
'link' => '',
'label' => $subpage,
],
]
],
[],
$dots
);
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'));
}
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
if (isset($config['error_config_update_config']['errors']) === true) {
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
}
}
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
if (isset($config['error_config_update_config']['warnings']) === true) {
if (is_array($config['error_config_update_config']['warnings']) === true) {
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']
);
if (isset($config['ITSM_token']) === false) {
$config['ITSM_token'] = '';
}
// ITSM token.
$row['password'] = html_print_label_input_block(
__('Token'),

View File

@ -390,7 +390,7 @@ if (is_ajax() === true) {
set_unless_defined($config['double_auth_enabled'], false);
$row = [];
$row['name'] = __('Double authentication');
$row['control'] .= html_print_checkbox_switch(
$row['control'] = html_print_checkbox_switch(
'double_auth_enabled',
1,
$config['double_auth_enabled'],
@ -405,7 +405,7 @@ if (is_ajax() === true) {
set_unless_defined($config['2FA_all_users'], false);
$row = [];
$row['name'] = __('Force 2FA for all users is enabled');
$row['control'] .= html_print_checkbox_switch(
$row['control'] = html_print_checkbox_switch(
'2FA_all_users',
1,
$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_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.
$row = [];
$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(
__('Force use Public URL'),
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(
__('Public URL host exclusions'),
html_print_textarea(
@ -919,6 +927,10 @@ echo '<legend>'.__('Mail configuration').'</legend>';
$table_ncm_config->size[0] = '50%';
$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(
__('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(

View File

@ -74,6 +74,8 @@ if ($view === 'create' || $view === 'edit') {
if (count($errors) === 0) {
if (count($files) > 0) {
$uploadImages = $tipsWindow->uploadImages($files);
} else {
$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
ORDER BY name',
'alert_type',
$alert_type,
($alert_type ?? ''),
'',
'',
0,
@ -2100,26 +2100,26 @@ if ($create_alert || $update_alert) {
echo '</tr>';
$al = [
'al_field1' => $al_field1,
'al_field2' => $al_field2,
'al_field3' => $al_field3,
'al_field4' => $al_field4,
'al_field5' => $al_field5,
'al_field6' => $al_field6,
'al_field7' => $al_field7,
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'al_field16' => $al_field16,
'al_field17' => $al_field17,
'al_field18' => $al_field18,
'al_field19' => $al_field19,
'al_field20' => $al_field20,
'al_field1' => ($al_field1 ?? ''),
'al_field2' => ($al_field2 ?? ''),
'al_field3' => ($al_field3 ?? ''),
'al_field4' => ($al_field4 ?? ''),
'al_field5' => ($al_field5 ?? ''),
'al_field6' => ($al_field6 ?? ''),
'al_field7' => ($al_field7 ?? ''),
'al_field8' => ($al_field8 ?? ''),
'al_field9' => ($al_field9 ?? ''),
'al_field10' => ($al_field10 ?? ''),
'al_field11' => ($al_field11 ?? ''),
'al_field12' => ($al_field12 ?? ''),
'al_field13' => ($al_field13 ?? ''),
'al_field14' => ($al_field14 ?? ''),
'al_field15' => ($al_field15 ?? ''),
'al_field16' => ($al_field16 ?? ''),
'al_field17' => ($al_field17 ?? ''),
'al_field18' => ($al_field18 ?? ''),
'al_field19' => ($al_field19 ?? ''),
'al_field20' => ($al_field20 ?? ''),
];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -2287,7 +2287,7 @@ $(document).ready (function () {
});
values.push({
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)."'"; ?>,

View File

@ -377,11 +377,15 @@ if ($edit_filter > -2) {
echo '</form></div>';
}
if (isset($index) === false) {
$index = 0;
}
?>
<script type="text/javascript">
// +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']; ?>";
$(document).ready (function () {

View File

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

View File

@ -1113,11 +1113,15 @@ if (!$new_user) {
$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(
['id' => 'qr_code_agent_view'],
true
);
if (isset($custom_id_div) === false) {
$custom_id_div = '';
}
$CodeQRContent .= '<br/>'.$custom_id_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.
$customHomeScreenAddition = [];
// Home screen. Dashboard.
@ -81,21 +91,12 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
false,
'width: 100%'
);
// 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%');
// Home screen. External link and Other.
$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.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux,
@ -889,7 +890,7 @@ if (users_is_admin($config['id_user']) === true || (bool) check_acl($config['id_
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'),
'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']) {
// Pandora ITSM user remote login.
$table_ITSM = new StdClass();

View File

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

View File

@ -321,7 +321,7 @@ class Cloud extends Wizard
ui_print_error_message($this->msg);
}
if ($empty_account === true) {
if (isset($empty_account) === true) {
ui_print_error_message($this->msg);
}
@ -357,7 +357,7 @@ class Cloud extends Wizard
'name' => 'account_identifier',
'type' => 'select',
'fields' => CredentialStore::getKeys($this->keyStoreType),
'selected' => $this->keyIdentifier,
'selected' => (isset($this->keyIdentifier) === true) ? $this->keyIdentifier : '',
'return' => true,
],
],
@ -408,7 +408,7 @@ class Cloud extends Wizard
{
global $config;
$pandora = io_safe_output($config['cloud_util_path']);
$pandora = io_safe_output(($config['cloud_util_path'] ?? ''));
if (isset($pandora) === false) {
config_update_value('cloud_util_path', '/usr/bin/pandora-cm-api');
@ -419,7 +419,7 @@ class Cloud extends Wizard
return false;
}
if ($this->keyIdentifier === null) {
if (isset($this->keyIdentifier) === false) {
// Ask user for available credentials.
$this->msg = __('Select a set of credentials from the list');
$this->status = null;
@ -496,7 +496,7 @@ class Cloud extends Wizard
*/
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,
string $msg='Default message. Not set.',
string $icon='/images/wizard/Custom_apps@svg.svg',
string $label='Custom'
string $label='Custom',
string $class_style='',
) {
$this->setBreadcrum([]);

View File

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

View File

@ -813,8 +813,36 @@ class HostDevices extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -452,7 +452,7 @@ class CustomNetScan extends Wizard
'label' => __('Task name'),
'arguments' => [
'name' => 'taskname',
'value' => $this->task['name'],
'value' => (isset($this->task['name']) === true) ? $this->task['name'] : '',
'type' => 'text',
'size' => 50,
],
@ -474,7 +474,7 @@ class CustomNetScan extends Wizard
'label' => __('Comment'),
'arguments' => [
'name' => 'comment',
'value' => $this->task['description'],
'value' => (isset($this->task['description']) === true) ? $this->task['description'] : '',
'type' => 'text',
'size' => 50,
],
@ -496,7 +496,7 @@ class CustomNetScan extends Wizard
SERVER_TYPE_DISCOVERY
),
'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,
],
];
@ -509,7 +509,7 @@ class CustomNetScan extends Wizard
'returnAllGroup' => false,
'privilege' => $this->access,
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'selected' => (isset($this->task['id_group']) === true) ? $this->task['id_group'] : '',
'return' => true,
'size' => '400px',
],
@ -517,8 +517,10 @@ class CustomNetScan extends Wizard
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
if (isset($this->task['interval_sweep']) === true) {
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
}
// Schedule.
@ -541,7 +543,7 @@ class CustomNetScan extends Wizard
],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'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.').'\')',
'',
'0',

View File

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

View File

@ -427,30 +427,32 @@ class EventSound extends HTML
);
$data = db_get_all_rows_sql($sql);
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$action = __('Enable sound');
$new_action = 1;
if ($data !== false) {
foreach ($data as $key => $row) {
if ($row['active'] === '1') {
$img = 'images/lightbulb.png';
$action = __('Disable sound');
$new_action = 0;
} else {
$img = 'images/lightbulb_off.png';
$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(

View File

@ -186,9 +186,11 @@ class ExtensionsDiscovery extends Wizard
private function loadConfig()
{
$row = db_get_row('tdiscovery_apps', 'short_name', $this->mode);
$this->id = $row['id_app'];
$this->name = $row['name'];
$this->description = $row['description'];
if ($row !== false) {
$this->id = $row['id_app'];
$this->name = $row['name'];
$this->description = $row['description'];
}
}
@ -415,7 +417,10 @@ class ExtensionsDiscovery extends Wizard
public function loadIni()
{
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;
}
@ -2190,7 +2195,8 @@ class ExtensionsDiscovery extends Wizard
break;
default:
continue;
// Nothing.
break;
}
if ($value !== false) {

View File

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

View File

@ -780,8 +780,13 @@ class ModuleTemplates extends HTML
private function setNetworkProfile()
{
$profileInfo = db_get_row('tnetwork_profile', 'id_np', $this->id_np);
$this->name = $profileInfo['name'];
$this->description = $profileInfo['description'];
if ($profileInfo !== false) {
$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]);
$penList = [];

View File

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

View File

@ -646,7 +646,7 @@ class TipsWindow
['class' => 'main_menu_icon']
);
$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(
'button_delete_tip',
'images/delete.svg',
@ -1087,7 +1087,7 @@ class TipsWindow
return false;
}
if ($images !== null) {
if ($images !== '') {
foreach ($images as $key => $image) {
$res = db_process_sql_insert(
'twelcome_tip_file',

View File

@ -738,6 +738,22 @@ class Tree
if ($module['showGraphs']) {
$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
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true

View File

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

View File

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

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC240221';
$build_version = 'PC240223';
$pandora_version = 'v7.0NG.775';
// 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 (!$search['all_agents']) {
if (isset($search['all_agents']) === false) {
$filter['disabled'] = 0;
if (isset($search['disabled']) === true) {
$filter['disabled'] = (int) $search['disabled'];

View File

@ -593,7 +593,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$email = ui_print_truncate_text($args[1], 120);
@ -656,7 +656,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($template === false) {
continue;
break;
}
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.
if ($report === false) {
continue;
break;
}
$path = $args[1];
@ -817,7 +817,7 @@ function cron_list_table()
// Check ACL in reports_get_report return false.
if ($report === false) {
continue;
break;
}
$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.
$empty_agents_count = "UNION ALL
SELECT ta.id_agente,
@ -616,6 +620,10 @@ function agent_counters_custom_fields($filters)
$result_meta = [];
$data = [];
if (isset($and_module_search) === false) {
$and_module_search = '';
}
$query = sprintf(
"SELECT tcd.description AS name_data,
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);
if (isset($server_data) === false) {
$server_data = [];
$server_data['id'] = '';
}
$query_data = sprintf(
"SELECT
tcd.description,

View File

@ -526,8 +526,10 @@ function filemanager_file_explorer(
$allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
$allowCreateFolder = (isset($options['allowCreateFolder'])) ? false : true;
if ($options['denyCreateText'] === true) {
$allowCreateText = false;
if (isset($options['denyCreateText']) === true) {
if ($options['denyCreateText'] === true) {
$allowCreateText = 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>
<div id='real_path'></div>";
if (isset($_SERVER['HTTPS']) || $_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>';
if (isset($_SERVER['HTTPS']) === true) {
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(

View File

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

View File

@ -2075,7 +2075,7 @@ function html_print_extended_select_for_post_process(
$found = false;
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;
}
}
@ -5579,7 +5579,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_image(
((isset($data['name']) === true) ? $data['name'] : ''),
$data['src'],
$data['value'],
($data['value'] ?? ''),
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
@ -5819,7 +5819,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'checkbox':
$output .= html_print_checkbox(
$data['name'],
((isset($data['name']) === true) ? $data['name'] : ''),
($data['value'] ?? null),
((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
@ -5859,9 +5859,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
case 'textarea':
$output .= html_print_textarea(
$data['name'],
$data['rows'],
$data['columns'],
(isset($data['name']) === true) ? $data['name'] : '',
(isset($data['rows']) === true) ? $data['rows'] : '',
(isset($data['columns']) === true) ? $data['columns'] : '',
((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
@ -7416,8 +7416,9 @@ function html_print_select_date_range(
$output .= '</div>';
$output .= '<div id="'.$name.'_range" class="inline_flex" '.$display_range.'>';
$table = new stdClass();
$table->data = [];
$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('time_init', $time_init, '', 10, 7, true).' ';
$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>';
}
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);
if ($order_by_agent === false) {
$modules = [];
foreach ($rows as $row) {
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 ($rows !== false) {
foreach ($rows as $row) {
if ($row['utimestamp'] !== $row['last_update']) {
$row['timestamp'] = $row['last_update_timestamp'];
}
if (empty($data_value) === false && $search_check !== false) {
$row['data'] = $data_value;
$modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row;
$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) {
$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]['name'] = $v['text'];
$sec_array[$k]['name'] = (isset($v['text']) === true) ? $v['text'] : '';
} 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) {
$salida = $data_macro;
} 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(
$module['datos'],
empty($module['id']) ? $module['id_agente_modulo'] : $module['id'],
@ -5074,3 +5082,28 @@ function modules_made_compatible($id_tipo_modulo)
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'),
];
if ($zone_selected == '') {
if (isset($zone_selected) === false) {
if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0];

View File

@ -1435,7 +1435,7 @@ function custom_fields_macros_report($macro, $key_macro)
$macro['server_id']
);
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'),
html_print_input(
[

View File

@ -4022,19 +4022,21 @@ function ui_print_datatable(array $parameters)
$parameters['order']['order'] = $order;
$parameters['order']['direction'] = $direction;
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if (isset($parameters['no_sortable_columns']) === true) {
foreach ($parameters['no_sortable_columns'] as $key => $find) {
$found = array_search(
$parameters['no_sortable_columns'][$key],
$columns_tmp
);
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if ($found !== false) {
unset($parameters['no_sortable_columns'][$key]);
array_push($parameters['no_sortable_columns'], $found);
}
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
unset($parameters['no_sortable_columns'][$key]);
if (is_int($parameters['no_sortable_columns'][$key]) === false) {
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">';
foreach ($parameters['form']['inputs'] as $input) {
if ($input['type'] === 'date_range') {
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', true).'</li>';
} else {
$filter .= html_print_input(($input + ['return' => true]), 'li');
if (isset($parameters['form']['inputs']) === true) {
foreach ($parameters['form']['inputs'] as $input) {
if ($input['type'] === 'date_range') {
$filter .= '<li><label>'.$input['label'].'</label>'.html_print_select_date_range('date', 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['dataElements'] = json_encode($parameters['data_element']);
$parameters['dataElements'] = (isset($parameters['data_element']) === true) ? json_encode($parameters['data_element']) : '';
// * START JAVASCRIPT.
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';
@ -5236,7 +5240,8 @@ function ui_print_standard_header(
bool $godmode=false,
array $options=[],
array $breadcrumbs=[],
array $fav_menu_config=[]
array $fav_menu_config=[],
string $dots='',
) {
// For standard breadcrumbs.
ui_require_css_file('discovery');
@ -5275,7 +5280,8 @@ function ui_print_standard_header(
'',
$headerInformation->printHeader(true),
false,
$fav_menu_config
$fav_menu_config,
$dots
);
if ($return !== true) {
echo $output;
@ -5316,7 +5322,8 @@ function ui_print_page_header(
$alias='',
$breadcrumbs='',
$hide_left_small=false,
$fav_menu_config=[]
$fav_menu_config=[],
$dots='',
) {
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 {
if ($options != '') {
$buffer .= '<div id="menu_tab"><ul class="mn"><li>';
$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);
}
if (isset($module) === false) {
$module['datos'] = '';
}
$is_snapshot = is_snapshot_data($module['datos']);
$is_large_image = is_text_to_black_string($module['datos']);
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