Merge branch 'develop' into 'ent-9002-Eliminar-monitorizacion-transaccional-Servidor-transaccional'

# Conflicts:
#   pandora_console/extras/mr/60.sql
This commit is contained in:
Alejandro Campos 2022-12-13 11:42:41 +00:00
commit 867e1cc2b3
80 changed files with 755 additions and 240 deletions

View File

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

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.767'; use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '221209'; use constant AGENT_BUILD => '221213';
# 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;
@ -2403,6 +2403,11 @@ sub check_collections () {
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) { if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
$local_collection_md5 = <MD5_FILE>; $local_collection_md5 = <MD5_FILE>;
close MD5_FILE; close MD5_FILE;
if ( ! defined ($local_collection_md5) ) {
log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0");
unlink ("$ConfDir/collections/$collection_md5_file");
$local_collection_md5 = "Size 0";
}
} else { } else {
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
next; next;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
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.767" PI_VERSION="7.0NG.767"
PI_BUILD="221209" PI_BUILD="221213"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.767(Build 221209))" VALUE "ProductVersion", "(7.0NG.767(Build 221213))"
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.767-221209 Version: 7.0NG.767-221213
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.767-221209" pandora_version="7.0NG.767-221213"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -3,4 +3,9 @@ START TRANSACTION;
DROP TABLE IF EXISTS `tphase`; DROP TABLE IF EXISTS `tphase`;
DROP TABLE IF EXISTS `ttransaction`; DROP TABLE IF EXISTS `ttransaction`;
ALTER TABLE `tagent_custom_fields` ADD `is_link_enabled` TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE `tevent_filter` ADD COLUMN `owner_user` TEXT;
ALTER TABLE `tevent_filter` ADD COLUMN `not_search` INT NOT NULL DEFAULT 0;
COMMIT; COMMIT;

View File

@ -91,7 +91,7 @@ $login_body_class = '';
// Overrides the default background with the defined by the user. // Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) { if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background']; $background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\""; $login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
} }
// Support for Internet Explorer and Microsoft Edge browsers // Support for Internet Explorer and Microsoft Edge browsers

View File

@ -872,6 +872,35 @@ foreach ($fields as $field) {
true, true,
true true
); );
} else if ($field['is_link_enabled']) {
list($link_text, $link_url) = json_decode($custom_value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$link_text = '';
$link_url = '';
}
$data_field[1] = '<span style="line-height: 3.5;">'.__('Link text:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_text,
'class="min-height-30px',
true
);
$data_field[1] .= '<br>';
$data_field[1] .= '<span style="line-height: 3.5;">'.__('Link URL:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_url,
'class="min-height-30px',
true
);
} else { } else {
$data_field[1] = html_print_textarea( $data_field[1] = html_print_textarea(
'customvalue_'.$field['id_field'], 'customvalue_'.$field['id_field'],

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
// Check if agent exists (BUG WC-50518-2). // Check if agent exists (BUG WC-50518-2).
@ -999,7 +1007,22 @@ if ($update_agent) {
$field_values = []; $field_values = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
if ($field_value[1] !== '') {
$parsed_url = parse_url($field_value[1]);
if (empty($parsed_url['scheme']) === true) {
$field_value[1] = 'http://'.ltrim($field_value[1], '/');
}
}
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
} }
foreach ($field_values as $key => $value) { foreach ($field_values as $key => $value) {

View File

@ -30,6 +30,8 @@ $display_on_front = (bool) get_parameter('display_on_front', 0);
$is_password_type = (bool) get_parameter('is_password_type', 0); $is_password_type = (bool) get_parameter('is_password_type', 0);
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0); $is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Header. // Header.
if ($id_field) { if ($id_field) {
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]); $field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
@ -38,6 +40,7 @@ if ($id_field) {
$is_password_type = $field['is_password_type']; $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 = $config['is_combo_enable'];
$is_link_enabled = $field['is_link_enabled'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
} else { } else {
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, ''); ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
@ -128,6 +131,17 @@ $table->data[4][1] = html_print_textarea(
true true
); );
$table->data[5][0] = __('Link type');
$table->data[5][1] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">'; echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -167,25 +181,46 @@ $(document).ready (function () {
}); });
} }
if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) {
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else {
$('#configure_field-1').show();
$('#configure_field-3').show();
}
$('input[type=checkbox][name=is_link_enabled]').change(function () {
if( $(this).is(":checked") ){
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else{
$('#configure_field-1').show();
$('#configure_field-3').show();
}
});
$('input[type=checkbox][name=is_combo_enable]').change(function () { $('input[type=checkbox][name=is_combo_enable]').change(function () {
if( $(this).is(":checked") ){ if( $(this).is(":checked") ){
$('#configure_field-4').show(); $('#configure_field-4').show();
dialog_message("#message_no_set_password"); dialog_message("#message_no_set_password");
$('#configure_field-1').hide(); $('#configure_field-1').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-4').hide(); $('#configure_field-4').hide();
$('#configure_field-1').show(); $('#configure_field-1').show();
$('#configure_field-5').show();
} }
}); });
$('input[type=checkbox][name=is_password_type]').change(function () { $('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){ if( $(this).is(":checked")){
dialog_message("#message_no_set_combo"); dialog_message("#message_no_set_combo");
$('#configure_field-3').hide(); $('#configure_field-3').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-3').show(); $('#configure_field-3').show();
$('#configure_field-5').show();
} }
}); });
}); });

View File

@ -38,11 +38,12 @@ $display_on_front = (int) get_parameter('display_on_front', 0);
$is_password_type = (int) get_parameter('is_password_type', 0); $is_password_type = (int) get_parameter('is_password_type', 0);
$combo_values = (string) get_parameter('combo_values', ''); $combo_values = (string) get_parameter('combo_values', '');
$combo_value_selected = (string) get_parameter('combo_value_selected', ''); $combo_value_selected = (string) get_parameter('combo_value_selected', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Create field. // Create field.
if ($create_field) { if ($create_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name == '') { if ($name === '') {
ui_print_error_message(__('The name must not be empty')); ui_print_error_message(__('The name must not be empty'));
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) { } else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
ui_print_error_message(__('The name must be unique')); ui_print_error_message(__('The name must be unique'));
@ -54,6 +55,7 @@ if ($create_field) {
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
] ]
); );
ui_print_success_message(__('Field successfully created')); ui_print_success_message(__('Field successfully created'));
@ -63,12 +65,13 @@ if ($create_field) {
// Update field. // Update field.
if ($update_field) { if ($update_field) {
// Check if name field is empty. // Check if name field is empty.
if ($name != '') { if ($name !== '') {
$values = [ $values = [
'name' => $name, 'name' => $name,
'display_on_front' => $display_on_front, 'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type, 'is_password_type' => $is_password_type,
'combo_values' => $combo_values, 'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
]; ];
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]); $result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);

View File

@ -445,8 +445,6 @@ if ($module_action === 'delete') {
} }
} else if ($module_action === 'disable') { } else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete'); $id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0; $updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) { foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +488,52 @@ if ($module_action === 'delete') {
); );
} }
} }
} else if ($module_action === 'enable') {
$id_agent_modules_enable = (array) get_parameter('id_delete');
$updated_count = 0;
foreach ($id_agent_modules_enable as $id_agent_module_enable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 0
WHERE id_agente_modulo = %d',
$id_agent_module_enable
);
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_enable);
$agent_update_result = db_process_sql_update(
'tagente',
['update_module_count' => 1],
['id_agente' => $id_agent_changed]
);
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
$updated_count++;
}
}
$count_modules_to_enable = count($id_agent_modules_enable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_enable
)
);
} else {
if ($updated_count == $count_modules_to_enable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_enable
)
);
}
}
} }
@ -1274,6 +1318,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select( html_print_select(
[ [
'disable' => 'Disable selected modules', 'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules', 'delete' => 'Delete selected modules',
], ],
'module_action', 'module_action',
@ -1286,6 +1331,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false false
); );
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button( html_print_submit_button(
__('Execute action'), __('Execute action'),
'submit_modules_action', 'submit_modules_action',

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) { if (!empty($downtimes)) {
ob_clean(); ob_clean();
// Show contentype header // Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/csv'); header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"'); header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"');
@ -161,7 +163,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) { if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) { foreach ($downtime_agents as $downtime_agent) {
$downtime_items = []; $downtime_items = [];
$downtime_items[] = $downtime_agent[alias]; $downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) { if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id']; $agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'), __('Export to CSV'),
'csv_export', 'csv_export',
false, false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"' 'class="sub next"'
); );
echo '</div>'; echo '</div>';

View File

@ -66,6 +66,7 @@ if ($id) {
$severity = explode(',', $filter['severity']); $severity = explode(',', $filter['severity']);
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
$text_module = $filter['text_module']; $text_module = $filter['text_module'];
@ -73,6 +74,7 @@ if ($id) {
$pagination = $filter['pagination']; $pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr']; $event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack']; $id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep']; $group_rep = $filter['group_rep'];
$date_from = str_replace('-', '/', $filter['date_from']); $date_from = str_replace('-', '/', $filter['date_from']);
$date_to = str_replace('-', '/', $filter['date_to']); $date_to = str_replace('-', '/', $filter['date_to']);
@ -115,10 +117,12 @@ if ($id) {
$severity = ''; $severity = '';
$status = ''; $status = '';
$search = ''; $search = '';
$not_search = 0;
$text_agent = ''; $text_agent = '';
$pagination = ''; $pagination = '';
$event_view_hr = ''; $event_view_hr = '';
$id_user_ack = ''; $id_user_ack = '';
$owner_user = '';
$group_rep = ''; $group_rep = '';
$date_from = ''; $date_from = '';
$date_to = ''; $date_to = '';
@ -140,6 +144,7 @@ if ($update || $create) {
$severity = implode(',', get_parameter('severity', -1)); $severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$not_search = get_parameter_switch('not_search', 0);
$text_agent = get_parameter('text_agent', ''); $text_agent = get_parameter('text_agent', '');
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', ''); $text_module = get_parameter('text_module', '');
@ -157,6 +162,7 @@ if ($update || $create) {
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', ''); $group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', ''); $date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', ''); $date_to = get_parameter('date_to', '');
@ -185,12 +191,14 @@ if ($update || $create) {
'severity' => $severity, 'severity' => $severity,
'status' => $status, 'status' => $status,
'search' => $search, 'search' => $search,
'not_search' => $not_search,
'text_agent' => $text_agent, 'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module, 'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent, 'id_agent' => $id_agent,
'pagination' => $pagination, 'pagination' => $pagination,
'event_view_hr' => $event_view_hr, 'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack, 'id_user_ack' => $id_user_ack,
'owner_user' => $owner_user,
'group_rep' => $group_rep, 'group_rep' => $group_rep,
'tag_with' => $tag_with_json, 'tag_with' => $tag_with_json,
'tag_without' => $tag_without_json, 'tag_without' => $tag_without_json,
@ -376,6 +384,15 @@ $table->data[6][1] = html_print_input_text(
255, 255,
true true
); );
$table->data[6][1] .= ' '.html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$table->data[7][0] = '<b>'.__('Agent search').'</b>'; $table->data[7][0] = '<b>'.__('Agent search').'</b>';
$params = []; $params = [];
@ -420,7 +437,12 @@ $table->data[9][1] = html_print_input_text(
true true
); );
$table->data[10][0] = '<b>'.__('User ack.').'</b>'.' '.ui_print_help_tip(__('Choose between the users who have validated an event. '), true); $table->data[10][0] = '<b>'.__('User ack.').'</b>';
$table->data[10][0] .= ' ';
$table->data[10][0] .= ui_print_help_tip(
__('Choose between the users who have validated an event. '),
true
);
if ($strict_user) { if ($strict_user) {
$users = [$config['id_user'] => $config['id_user']]; $users = [$config['id_user'] => $config['id_user']];
@ -442,14 +464,25 @@ $table->data[10][1] = html_print_select(
true true
); );
$table->data[11][0] = '<b>'.__('Owner.').'</b>';
$table->data[11][1] = html_print_select(
$users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$repeated_sel = [ $repeated_sel = [
EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
]; ];
$table->data[11][0] = '<b>'.__('Repeated').'</b>'; $table->data[12][0] = '<b>'.__('Repeated').'</b>';
$table->data[11][1] = html_print_select( $table->data[12][1] = html_print_select(
$repeated_sel, $repeated_sel,
'group_rep', 'group_rep',
$group_rep, $group_rep,
@ -459,11 +492,11 @@ $table->data[11][1] = html_print_select(
true true
); );
$table->data[12][0] = '<b>'.__('Date from').'</b>'; $table->data[13][0] = '<b>'.__('Date from').'</b>';
$table->data[12][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); $table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true);
$table->data[13][0] = '<b>'.__('Date to').'</b>'; $table->data[14][0] = '<b>'.__('Date to').'</b>';
$table->data[13][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); $table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true);
$tag_with = json_decode($tag_with_json_clean, true); $tag_with = json_decode($tag_with_json_clean, true);
if (empty($tag_with)) { if (empty($tag_with)) {
@ -502,9 +535,9 @@ $remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without); $add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp); $remove_without_tag_disabled = empty($tag_without_temp);
$table->colspan[14][0] = '2'; $table->colspan[15][0] = '2';
$table->data[14][0] = '<b>'.__('Events with following tags').'</b>'; $table->data[15][0] = '<b>'.__('Events with following tags').'</b>';
$table->data[15][0] = html_print_select( $table->data[16][0] = html_print_select(
$tags_select_with, $tags_select_with,
'select_with', 'select_with',
'', '',
@ -518,7 +551,7 @@ $table->data[15][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[15][1] = html_print_button( $table->data[16][1] = html_print_button(
__('Add'), __('Add'),
'add_whith', 'add_whith',
$add_with_tag_disabled, $add_with_tag_disabled,
@ -527,7 +560,7 @@ $table->data[15][1] = html_print_button(
true true
); );
$table->data[16][0] = html_print_select( $table->data[17][0] = html_print_select(
$tag_with_temp, $tag_with_temp,
'tag_with_temp', 'tag_with_temp',
[], [],
@ -541,12 +574,12 @@ $table->data[16][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[16][0] .= html_print_input_hidden( $table->data[17][0] .= html_print_input_hidden(
'tag_with', 'tag_with',
$tag_with_base64, $tag_with_base64,
true true
); );
$table->data[16][1] = html_print_button( $table->data[17][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whith', 'remove_whith',
$remove_with_tag_disabled, $remove_with_tag_disabled,
@ -555,9 +588,9 @@ $table->data[16][1] = html_print_button(
true true
); );
$table->colspan[17][0] = '2'; $table->colspan[18][0] = '2';
$table->data[17][0] = '<b>'.__('Events without following tags').'</b>'; $table->data[18][0] = '<b>'.__('Events without following tags').'</b>';
$table->data[18][0] = html_print_select( $table->data[19][0] = html_print_select(
$tags_select_without, $tags_select_without,
'select_without', 'select_without',
'', '',
@ -571,7 +604,7 @@ $table->data[18][0] = html_print_select(
false, false,
'width: 220px;' 'width: 220px;'
); );
$table->data[18][1] = html_print_button( $table->data[19][1] = html_print_button(
__('Add'), __('Add'),
'add_whithout', 'add_whithout',
$add_without_tag_disabled, $add_without_tag_disabled,
@ -580,7 +613,7 @@ $table->data[18][1] = html_print_button(
true true
); );
$table->data[19][0] = html_print_select( $table->data[20][0] = html_print_select(
$tag_without_temp, $tag_without_temp,
'tag_without_temp', 'tag_without_temp',
[], [],
@ -594,12 +627,12 @@ $table->data[19][0] = html_print_select(
false, false,
'width: 220px; height: 50px;' 'width: 220px; height: 50px;'
); );
$table->data[19][0] .= html_print_input_hidden( $table->data[20][0] .= html_print_input_hidden(
'tag_without', 'tag_without',
$tag_without_base64, $tag_without_base64,
true true
); );
$table->data[19][1] = html_print_button( $table->data[20][1] = html_print_button(
__('Remove'), __('Remove'),
'remove_whithout', 'remove_whithout',
$remove_without_tag_disabled, $remove_without_tag_disabled,
@ -608,8 +641,8 @@ $table->data[19][1] = html_print_button(
true true
); );
$table->data[20][0] = '<b>'.__('Alert events').'</b>'; $table->data[21][0] = '<b>'.__('Alert events').'</b>';
$table->data[20][1] = html_print_select( $table->data[21][1] = html_print_select(
[ [
'-1' => __('All'), '-1' => __('All'),
'0' => __('Filter alert events'), '0' => __('Filter alert events'),
@ -624,8 +657,8 @@ $table->data[20][1] = html_print_select(
); );
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->data[21][0] = '<b>'.__('Module search').'</b>'; $table->data[22][0] = '<b>'.__('Module search').'</b>';
$table->data[21][1] .= html_print_autocomplete_modules( $table->data[22][1] .= html_print_autocomplete_modules(
'module_search', 'module_search',
$text_module, $text_module,
false, false,
@ -637,17 +670,17 @@ if (!is_metaconsole()) {
); );
} }
$table->data[22][0] = '<b>'.__('Source').'</b>'; $table->data[23][0] = '<b>'.__('Source').'</b>';
$table->data[22][1] = html_print_input_text('source', $source, '', 35, 255, true); $table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true);
$table->data[23][0] = '<b>'.__('Extra ID').'</b>'; $table->data[24][0] = '<b>'.__('Extra ID').'</b>';
$table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); $table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$table->data[24][0] = '<b>'.__('Comment').'</b>'; $table->data[25][0] = '<b>'.__('Comment').'</b>';
$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); $table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[25][0] = '<b>'.__('Custom data filter type').'</b>'; $table->data[26][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[25][1] = html_print_select( $table->data[26][1] = html_print_select(
[ [
'0' => __('Filter custom data by name field'), '0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'), '1' => __('Filter custom data by value field'),
@ -660,12 +693,12 @@ $table->data[25][1] = html_print_select(
true true
); );
$table->data[26][0] = '<b>'.__('Custom data').'</b>'; $table->data[27][0] = '<b>'.__('Custom data').'</b>';
$table->data[26][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); $table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
if (is_metaconsole()) { if (is_metaconsole()) {
$table->data[27][0] = '<b>'.__('Id souce event').'</b>'; $table->data[28][0] = '<b>'.__('Id souce event').'</b>';
$table->data[27][1] = html_print_input_text( $table->data[28][1] = html_print_input_text(
'id_source_event', 'id_source_event',
$id_source_event, $id_source_event,
'', '',
@ -727,6 +760,14 @@ $(document).ready( function() {
}); });
function checked_slide_events(element) {
var value = $("#checkbox-"+element.name).val();
if (value == 0) {
$("#checkbox-"+element.name).val(1);
} else {
$("#checkbox-"+element.name).val(0);
}
}
function click_button_remove_tag(what_button) { function click_button_remove_tag(what_button) {
if (what_button == "with") { if (what_button == "with") {

View File

@ -181,6 +181,7 @@ if (empty($alert_templates)) {
$alert_templates = ''; $alert_templates = '';
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->width = '98%'; $table->width = '98%';
$table->data = []; $table->data = [];

View File

@ -192,6 +192,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -249,6 +249,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -148,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -164,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true; $return_all_group = true;
} }
$table = new stdClass();
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';

View File

@ -189,6 +189,8 @@ if ($export_profile) {
} }
} }
// Set cookie for download control.
setDownloadCookieToken();
// Send headers to tell the browser we're sending a file // Send headers to tell the browser we're sending a file
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
@ -285,7 +287,7 @@ foreach ($result as $row) {
] ]
); );
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -229,7 +229,8 @@ if ($add_module === true) {
// Safe output remove all entities. // Safe output remove all entities.
io_safe_output_array($id_modules, ''); io_safe_output_array($id_modules, '');
$id_modules = array_map(function ($mod) { $id_modules = array_map(
function ($mod) {
return io_safe_input($mod); return io_safe_input($mod);
}, },
$id_modules $id_modules

View File

@ -1055,7 +1055,7 @@ switch ($action) {
] ]
); );
$data[2] .= '</a>'; $data[2] .= '</a>';
$data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">'; $data[3] = '<a onclick="blockResubmit($(this))" href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">';
$data[3] .= html_print_image( $data[3] .= html_print_image(
'images/xml.png', 'images/xml.png',
true, true,

View File

@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true); $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">'; $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true); $data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
$data = []; $data = [];
$data[0] = __('Plug-in parameters'); $data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$table->data['plugin_parameters'] = $data; $table->data['plugin_parameters'] = $data;
$data = []; $data = [];
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>"; $datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true); $datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true); $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, false, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>"; $datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true); $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
$datam = []; $datam = [];
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>"; $datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : '';
$datam[1] = html_print_textarea( $datam[1] = html_print_textarea(
$macro_help_name, $macro_help_name,
6, 6,
100, 100,
$macro_help_value, $macro_help_value,
'class="command_macro" class="w97p"'.$tadisabled, 'class="command_macro" class="w97p"',
true true
); );
if ($locked) {
$datam[1] .= html_print_image(
'images/lock_mc.png',
true,
['class' => 'command_macro lock invert_filter']
);
}
$datam[1] .= '<br><br><br>'; $datam[1] .= '<br><br><br>';
$table->data['plugin_'.$next_name_number] = $datam; $table->data['plugin_'.$next_name_number] = $datam;
@ -551,15 +529,16 @@ if (($create != '') || ($view != '')) {
// Add/Delete buttons // Add/Delete buttons
$datam = []; $datam = [];
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
if (!$locked) { if (!$locked) {
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
$delete_macro_style = ''; $delete_macro_style = '';
if ($i <= 2) { if ($i <= 2) {
$delete_macro_style = 'display:none;'; $delete_macro_style = 'display:none;';
@ -1002,7 +981,10 @@ ui_require_javascript_file('pandora_modules');
}); });
update_preview(); update_preview();
} }
$('a#add_macro_btn').click(add_macro_click_event);
if (locked === 0) {
$('a#add_macro_btn').click(add_macro_click_event);
}
// Delete macro // Delete macro
var delete_macro_click_event = function (event) { var delete_macro_click_event = function (event) {
@ -1031,45 +1013,12 @@ ui_require_javascript_file('pandora_modules');
} }
} }
var command_click_locked_event = function (event) {
var $element = $(this);
if (!$element.is('input') || ($element.is('input') && ($element.prop('readonly') || $element.prop('disabled')))) {
if ($element.prop('id') === 'form_parameters') {
var message = '<?php echo __('Some modules or components are using the plugin'); ?>'
+ '.\n' + '<?php echo __('Are you sure you want to unlock this item?'); ?>';
if (confirm(message)) {
if ($element.is('input')) {
$element
.prop('readonly', false)
.prop('disabled', false)
.siblings('img.command_advanced_conf.lock')
.remove();
}
else {
$element
.siblings('input.command_advanced_conf')
.prop('readonly', false)
.prop('disabled', false)
$element.remove();
}
}
}
else {
alert("<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>");
}
}
}
var macros_click_locked_event = function (event) { var macros_click_locked_event = function (event) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>"); alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
} }
if (locked) { if (locked) {
$('a#add_macro_btn').click(add_macro_click_locked_event); $('a#add_macro_btn').click(add_macro_click_locked_event);
$('.command_advanced_conf').click(command_click_locked_event);
$('.command_macro').click(macros_click_locked_event);
} }

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['id_user']) { if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($id_user); $user_row = users_get_user_by_id($id_user);
$private_dashboards = db_get_all_rows_filter(
'tdashboard',
['id_user' => $id_user],
'id'
);
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
header('Refresh:1');
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
); );
// Delete the user in all the consoles. // Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) { if (is_metaconsole() === true) {
$servers = metaconsole_get_servers(); $servers = metaconsole_get_servers();
foreach ($servers as $server) { foreach ($servers as $server) {
// Connect to the remote console. // Connect to the remote console.
if (metaconsole_connect($server) === NOERR) { if (metaconsole_connect($server) === NOERR) {
// Delete the user. // Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
db_pandora_audit( db_pandora_audit(
@ -367,6 +382,8 @@ if ($delete_user === true) {
__('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) __('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
); );
} }
header('Refresh:1');
} }
} else { } else {
ui_print_error_message(__('There was a problem deleting the user')); ui_print_error_message(__('There was a problem deleting the user'));

View File

@ -351,12 +351,14 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -409,12 +411,14 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1)); $values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module'); $values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep'); $values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter( $values['tag_without'] = get_parameter(
@ -481,6 +485,7 @@ if ($get_filter_values) {
'user_comment' => '', 'user_comment' => '',
'id_extra' => '', 'id_extra' => '',
'id_user_ack' => '', 'id_user_ack' => '',
'owner_user' => '',
'date_from' => '', 'date_from' => '',
'time_from' => '', 'time_from' => '',
'date_to' => '', 'date_to' => '',
@ -642,6 +647,8 @@ function load_form_filter() {
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$('#text-search').val(val); $('#text-search').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
$('input[name=text_agent]').val(val); $('input[name=text_agent]').val(val);
if (i == 'id_agent') if (i == 'id_agent')
@ -654,6 +661,8 @@ function load_form_filter() {
$("#text-event_view_hr").val(val); $("#text-event_view_hr").val(val);
if (i == 'id_user_ack') if (i == 'id_user_ack')
$("#id_user_ack").val(val); $("#id_user_ack").val(val);
if (i == 'owner_user')
$("#owner_user").val(val);
if (i == 'group_rep') if (i == 'group_rep')
$("#group_rep").val(val); $("#group_rep").val(val);
if (i == 'tag_with') if (i == 'tag_with')
@ -898,12 +907,14 @@ function save_new_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()), "tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()), "tag_without": Base64.decode($("#hidden-tag_without").val()),
@ -975,12 +986,14 @@ function save_update_filter() {
"severity" : $("#severity").val(), "severity" : $("#severity").val(),
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(), "id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(), "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(), "group_rep" : $("#group_rep").val(),
"tag_with" : Base64.decode($("#hidden-tag_with").val()), "tag_with" : Base64.decode($("#hidden-tag_with").val()),
"tag_without" : Base64.decode($("#hidden-tag_without").val()), "tag_without" : Base64.decode($("#hidden-tag_without").val()),
@ -2270,7 +2283,7 @@ if ($drawConsoleSound === true) {
], ],
], ],
[ [
'label' => __('Time Sound'), 'label' => __('Sound duration'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $times_sound, 'fields' => $times_sound,
@ -2417,6 +2430,7 @@ if ($get_events_fired) {
'severity' => -1, 'severity' => -1,
'status' => -1, 'status' => -1,
'search' => '', 'search' => '',
'not_search' => 0,
'text_agent' => '', 'text_agent' => '',
'id_agent' => 0, 'id_agent' => 0,
'id_agent_module' => 0, 'id_agent_module' => 0,

View File

@ -141,8 +141,9 @@ class Diagnostics extends Wizard
'images/pdf.png', 'images/pdf.png',
true, true,
[ [
'title' => __('Export to PDF'), 'title' => __('Export to PDF'),
'class' => 'invert_filter', 'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
] ]
); );
$header_buttons = [ $header_buttons = [

View File

@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv'); header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
header('Pragma: no-cache'); header('Pragma: no-cache');
header('Expires: 0'); header('Expires: 0');
setDownloadCookieToken();
// Clean up output buffering // Clean up output buffering
while (@ob_end_clean()) { while (@ob_end_clean()) {
@ -931,7 +932,7 @@ class ModuleTemplates extends HTML
] ]
); );
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; $data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>'; $data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

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

View File

@ -6269,3 +6269,24 @@ function arrayOutputSorting($sort, $sortField)
} }
}; };
} }
/**
* Get dowload started cookie from js and set ready cokkie for download ready comntrol.
*
* @return
*/
function setDownloadCookieToken()
{
$download_cookie = get_cookie('downloadToken', false);
if ($download_cookie === false) {
return;
} else {
setcookie(
'downloadReady',
$download_cookie,
(time() + 15),
'/'
);
}
}

View File

@ -904,7 +904,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
global $module_field_column_mampping; global $module_field_column_mampping;
// module related field mappings 2/2 (output field => column for 'tagente_estado') // module related field mappings 2/2 (output field => column for 'tagente_estado')
global $estado_fields_to_columns_mapping; global $estado_fields_to_columns_mapping;
// alert related field mappings (output field => column for 'talert_template_modules', ... ) // alert related field mappings (output field => column for 'talert_template_modules', ... )
$alert_fields_to_columns_mapping = [ $alert_fields_to_columns_mapping = [
@ -1016,9 +1016,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$groups = []; $groups = [];
} }
$groups = str_replace('\n', $returnReplace, $groups);
foreach ($groups as &$group) { foreach ($groups as &$group) {
$group = str_replace('\n', $returnReplace, $group);
$group['type_row'] = 'group'; $group['type_row'] = 'group';
$returnVar[] = $group; $returnVar[] = $group;
@ -1034,9 +1034,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$agents = []; $agents = [];
} }
$agents = str_replace('\n', $returnReplace, $agents);
foreach ($agents as $index => &$agent) { foreach ($agents as $index => &$agent) {
$agent = str_replace('\n', $returnReplace, $agent);
$agent['type_row'] = 'agent'; $agent['type_row'] = 'agent';
$returnVar[] = $agent; $returnVar[] = $agent;
@ -1063,9 +1063,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$modules = []; $modules = [];
} }
$modules = str_replace('\n', $returnReplace, $modules);
foreach ($modules as &$module) { foreach ($modules as &$module) {
$module = str_replace('\n', $returnReplace, $module);
$module['type_row'] = 'module'; $module['type_row'] = 'module';
if ($module['module_macros']) { if ($module['module_macros']) {
@ -1097,9 +1097,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$alerts = []; $alerts = [];
} }
$alerts = str_replace('\n', $returnReplace, $alerts);
foreach ($alerts as &$alert) { foreach ($alerts as &$alert) {
$alert = str_replace('\n', $returnReplace, $alert);
$alert['type_row'] = 'alert'; $alert['type_row'] = 'alert';
$returnVar[] = $alert; $returnVar[] = $alert;
} }
@ -3588,6 +3587,19 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
// Column 'module_macros' cannot be null. // Column 'module_macros' cannot be null.
} }
$type_exist = db_get_value_filter(
'id_tipo',
'ttipo_modulo',
[
'id_tipo' => $values['id_tipo_modulo'],
]
);
if ((bool) $type_exist === false) {
returnError('Module type does not exist');
return;
}
if ($agent_by_alias) { if ($agent_by_alias) {
$agents_affected = 0; $agents_affected = 0;
$idModule = false; $idModule = false;

View File

@ -640,11 +640,13 @@ function events_update_status($id_evento, $status, $filter=null)
* 'status' * 'status'
* 'agent_alias' * 'agent_alias'
* 'search' * 'search'
* 'not_search'
* 'id_extra' * 'id_extra'
* 'id_source_event' * 'id_source_event'
* 'user_comment' * 'user_comment'
* 'source' * 'source'
* 'id_user_ack' * 'id_user_ack'
* 'owner_user'
* 'tag_with' * 'tag_with'
* 'tag_without' * 'tag_without'
* 'filter_only_alert' * 'filter_only_alert'
@ -1058,16 +1060,40 @@ function events_get_all(
$custom_data_search = 'te.custom_data'; $custom_data_search = 'te.custom_data';
} }
$sql_filters[] = vsprintf( $not_search = '';
' AND (lower(ta.alias) like lower("%%%s%%") $nexo = 'OR';
OR te.id_evento like "%%%s%%" $array_search = [
OR lower(te.evento) like lower("%%%s%%") 'te.id_evento',
OR lower(te.user_comment) like lower("%%%s%%") 'lower(te.evento)',
OR lower(te.id_extra) like lower("%%%s%%") 'lower(te.user_comment)',
OR lower(te.source) like lower("%%%s%%") 'lower(te.id_extra)',
OR lower('.$custom_data_search.') like lower("%%%s%%") )', 'lower(te.source)',
array_fill(0, 7, $filter['search']) 'lower('.$custom_data_search.')',
); ];
if (isset($filter['not_search']) === true
&& empty($filter['not_search']) === false
) {
$not_search = 'NOT';
$nexo = 'AND';
} else {
$array_search[] = 'lower(ta.alias)';
}
$sql_search = ' AND (';
foreach ($array_search as $key => $field) {
$sql_search .= sprintf(
'%s %s %s like lower("%%%s%%")',
($key === 0) ? '' : $nexo,
$field,
$not_search,
$filter['search']
);
$sql_search .= ' ';
}
$sql_search .= ' )';
$sql_filters[] = $sql_search;
} }
// Free search exclude. // Free search exclude.
@ -1152,11 +1178,19 @@ function events_get_all(
// Validated or in process by. // Validated or in process by.
if (empty($filter['id_user_ack']) === false) { if (empty($filter['id_user_ack']) === false) {
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ', ' AND te.id_usuario like lower("%%%s%%") ',
$filter['id_user_ack'] $filter['id_user_ack']
); );
} }
// Owner by.
if (empty($filter['owner_user']) === false) {
$sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ',
$filter['owner_user']
);
}
$tag_names = []; $tag_names = [];
// With following tags. // With following tags.
if (empty($filter['tag_with']) === false) { if (empty($filter['tag_with']) === false) {
@ -1840,11 +1874,14 @@ function events_get_all(
); );
if (isset($limit, $offset) === true if (isset($limit, $offset) === true
&& $limit !== 0 && (int) $limit !== 0
&& isset($filter['csv_all']) === false && isset($filter['csv_all']) === false
) { ) {
$count = count($data); $count = count($data);
$end = ((int) $offset !== 0) ? ($offset + $limit) : $limit; // -1 For pagination 'All'.
((int) $limit === -1)
? $end = count($data)
: $end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
$finally = array_slice($data, $offset, $end, true); $finally = array_slice($data, $offset, $end, true);
$return = [ $return = [
'buffers' => $buffers, 'buffers' => $buffers,
@ -3713,6 +3750,15 @@ function events_get_response_target(
); );
} }
if (strpos($target, '_group_contact_') !== false) {
$info_groups = groups_get_group_by_id($event['id_grupo']);
$target = str_replace(
'_group_contact_',
(isset($info_groups['contact']) === true) ? $info_groups['contact'] : 'N/A',
$target
);
}
if (strpos($target, '_event_utimestamp_') !== false) { if (strpos($target, '_event_utimestamp_') !== false) {
$target = str_replace( $target = str_replace(
'_event_utimestamp_', '_event_utimestamp_',

View File

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

View File

@ -3540,6 +3540,11 @@ function ui_print_datatable(array $parameters)
titleAttr: "'.__('Export current page to CSV').'", titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'", title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'", fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : { exportOptions : {
modifier : { modifier : {
// DataTables core // DataTables core
@ -3547,7 +3552,7 @@ function ui_print_datatable(array $parameters)
page : "All", page : "All",
search : "applied" search : "applied"
}'.$export_columns.' }'.$export_columns.'
} },
} }
] : [], ] : [],
lengthMenu: '.json_encode($pagination_options).', lengthMenu: '.json_encode($pagination_options).',
@ -3671,6 +3676,16 @@ function ui_print_datatable(array $parameters)
$js .= '$(".datatables_thead_tr").css("height", 0);'; $js .= '$(".datatables_thead_tr").css("height", 0);';
} }
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '});'; $js .= '});';
$js .= '</script>'; $js .= '</script>';

View File

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

View File

@ -2716,6 +2716,7 @@ function pandoraFlotArea(
$("#menu_export_csv_" + graph_id).click(function(e) { $("#menu_export_csv_" + graph_id).click(function(e) {
e.preventDefault(); e.preventDefault();
blockResubmit($(this));
plot.exportDataCSV(); plot.exportDataCSV();
var es_firefox = var es_firefox =
navigator.userAgent.toLowerCase().indexOf("firefox") > -1; navigator.userAgent.toLowerCase().indexOf("firefox") > -1;

File diff suppressed because one or more lines are too long

View File

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

View File

@ -969,7 +969,7 @@ function openSoundEventModal(settings) {
sound = true; sound = true;
} }
test_sound_button(sound); test_sound_button(sound, settings.urlSound);
}); });
// Play Stop. // Play Stop.
@ -1026,9 +1026,9 @@ function openSoundEventModal(settings) {
.show(); .show();
} }
function test_sound_button(test_sound) { function test_sound_button(test_sound, urlSound) {
if (test_sound === true) { if (test_sound === true) {
add_audio(); add_audio(urlSound);
} else { } else {
remove_audio(); remove_audio();
} }
@ -1084,8 +1084,8 @@ function action_events_sound(mode, settings) {
} }
} }
function add_audio() { function add_audio(urlSound) {
var sound = "./include/sounds/" + $("#tabs-sound-modal #sound_id").val(); var sound = urlSound + $("#tabs-sound-modal #sound_id").val();
$(".actions-sound-modal").append( $(".actions-sound-modal").append(
"<audio id='id_sound_event' src='" + "<audio id='id_sound_event' src='" +
sound + sound +
@ -1111,7 +1111,7 @@ function listen_event_sound(settings) {
function check_event_sound(settings) { function check_event_sound(settings) {
jQuery.post( jQuery.post(
"./ajax.php", settings.url,
{ {
page: "include/ajax/events", page: "include/ajax/events",
get_events_fired: 1, get_events_fired: 1,
@ -1140,7 +1140,7 @@ function check_event_sound(settings) {
remove_audio(); remove_audio();
// Apend audio. // Apend audio.
add_audio(); add_audio(settings.urlSound);
// Add elements. // Add elements.
data.forEach(function(element) { data.forEach(function(element) {

View File

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

View File

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

View File

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

View File

@ -427,9 +427,9 @@ table.widget_agent_module tbody tr:first-child > th {
} }
li#search_input_widget { li#search_input_widget {
width: 50%; width: 200px;
position: absolute; position: absolute;
left: 150px; left: 200px;
top: 2px; top: 2px;
} }

View File

@ -140,6 +140,11 @@ form.flex-row div.filter_input.filter_input_switch .p-slider {
width: 30px; width: 30px;
} }
form .filter_input_not_search .p-switch {
flex: 0 1 30px;
margin: 0;
}
fieldset { fieldset {
margin: 0 auto; margin: 0 auto;
} }

View File

@ -59,6 +59,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-top: 18px; margin-top: 18px;
position: relative;
} }
#tabs-sound-modal ul.wizard li.interval-sounds label, #tabs-sound-modal ul.wizard li.interval-sounds label,
@ -225,6 +226,7 @@
background-position: 70px 17px; background-position: 70px 17px;
color: #ffffff; color: #ffffff;
padding-left: 20px; padding-left: 20px;
border: 0;
} }
.actions-sound-modal .buttons-sound-modal button.stop, .actions-sound-modal .buttons-sound-modal button.stop,
@ -234,6 +236,7 @@
background-position: 70px 17px; background-position: 70px 17px;
color: #ffffff; color: #ffffff;
padding-left: 20px; padding-left: 20px;
border: 0;
} }
.actions-sound-modal .buttons-sound-modal button.alerts, .actions-sound-modal .buttons-sound-modal button.alerts,

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.767'; $version = '7.0NG.767';
$build = '221209'; $build = '221213';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -546,6 +546,19 @@ foreach ($fields as $field) {
if ($custom_value[0]['is_password_type']) { if ($custom_value[0]['is_password_type']) {
$data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;'; $data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
} else if ($field['is_link_enabled'] === '1') {
list($link_text, $link_url) = json_decode($custom_value[0]['description'], true);
if (json_last_error() !== JSON_ERROR_NONE) {
$link_text = '';
$link_url = '';
}
if ($link_text === '') {
$link_text = $link_url;
}
$data[1] = '<a href="'.$link_url.'">'.$link_text.'</a>';
} else { } else {
$data[1] = $custom_value[0]['description']; $data[1] = $custom_value[0]['description'];
} }

View File

@ -86,6 +86,9 @@ if (!empty($module)) {
while (@ob_end_clean()) { while (@ob_end_clean()) {
} }
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension); header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension);
header('Pragma: no-cache'); header('Pragma: no-cache');

View File

@ -85,6 +85,9 @@ if (!empty($module)) {
while (@ob_end_clean()) { while (@ob_end_clean()) {
} }
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension); header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension);
header('Pragma: no-cache'); header('Pragma: no-cache');

View File

@ -402,9 +402,11 @@ ui_require_jquery_file('bgiframe');
switch (type) { switch (type) {
case 'csv': case 'csv':
blockResubmit($(this));
f.action = "operation/agentes/exportdata.csv.php"; f.action = "operation/agentes/exportdata.csv.php";
break; break;
case 'excel': case 'excel':
blockResubmit($(this));
f.action = "operation/agentes/exportdata.excel.php"; f.action = "operation/agentes/exportdata.excel.php";
break; break;
case 'avg': case 'avg':

View File

@ -122,6 +122,10 @@ $search = get_parameter(
'filter[search]', 'filter[search]',
($filter['search'] ?? '') ($filter['search'] ?? '')
); );
$not_search = get_parameter(
'filter[not_search]',
0
);
$text_agent = get_parameter( $text_agent = get_parameter(
'filter[text_agent]', 'filter[text_agent]',
($filter['text_agent'] ?? '') ($filter['text_agent'] ?? '')
@ -153,6 +157,10 @@ $id_user_ack = get_parameter(
'filter[id_user_ack]', 'filter[id_user_ack]',
($filter['id_user_ack'] ?? '') ($filter['id_user_ack'] ?? '')
); );
$owner_user = get_parameter(
'filter[owner_user]',
($filter['owner_user'] ?? '')
);
$group_rep = get_parameter( $group_rep = get_parameter(
'filter[group_rep]', 'filter[group_rep]',
($filter['group_rep'] ?? '') ($filter['group_rep'] ?? '')
@ -1082,6 +1090,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$severity = $filter['severity']; $severity = $filter['severity'];
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent']; $id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module']; $id_agent_module = $filter['id_agent_module'];
@ -1095,6 +1104,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$pagination = $filter['pagination']; $pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr']; $event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack']; $id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep']; $group_rep = $filter['group_rep'];
$tag_with = json_decode(io_safe_output($filter['tag_with'])); $tag_with = json_decode(io_safe_output($filter['tag_with']));
$tag_without = json_decode(io_safe_output($filter['tag_without'])); $tag_without = json_decode(io_safe_output($filter['tag_without']));
@ -1448,7 +1458,7 @@ if ($pure) {
// CSV. // CSV.
$csv['active'] = false; $csv['active'] = false;
$csv['text'] = '<a class="events_link" href="'.ui_get_full_url(false, false, false, false).'operation/events/export_csv.php?'.($filter_b64 ?? '').'">'.html_print_image( $csv['text'] = '<a class="events_link" onclick="blockResubmit($(this))" href="'.ui_get_full_url(false, false, false, false).'operation/events/export_csv.php?'.($filter_b64 ?? '').'">'.html_print_image(
'images/csv.png', 'images/csv.png',
true, true,
[ [
@ -1707,8 +1717,23 @@ $inputs[] = $in;
// Free search. // Free search.
$data = html_print_input_text('search', $search, '', '', 255, true); $data = html_print_input_text('search', $search, '', '', 255, true);
$in = '<div class="filter_input"><label>'.__('Free search').'</label>'; // Search recursive groups.
$in .= $data.'</div>'; $data .= ui_print_help_tip(
__('Search for elements NOT containing given text.'),
true
);
$data .= html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$in = '<div class="filter_input filter_input_not_search"><label>'.__('Free search').'</label>';
$in .= $data;
$in .= '</div>';
$inputs[] = $in; $inputs[] = $in;
if (is_array($severity) === false) { if (is_array($severity) === false) {
@ -1747,7 +1772,7 @@ $data = html_print_checkbox_switch(
$search_recursive_groups, $search_recursive_groups,
true, true,
false, false,
'search_in_secondary_groups(this);', 'checked_slide_events(this);',
true true
); );
@ -1769,7 +1794,7 @@ $data = html_print_checkbox_switch(
$search_secondary_groups, $search_secondary_groups,
true, true,
false, false,
'search_in_secondary_groups(this);', 'checked_slide_events(this);',
true true
); );
@ -1934,6 +1959,19 @@ $in = '<div class="filter_input"><label>'.__('User ack.').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$adv_inputs[] = $in; $adv_inputs[] = $in;
$data = html_print_select(
$user_users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$in = '<div class="filter_input"><label>'.__('Owner').'</label>';
$in .= $data.'</div>';
$adv_inputs[] = $in;
// Only alert events. // Only alert events.
$data = html_print_select( $data = html_print_select(
[ [
@ -3076,7 +3114,7 @@ $(document).ready( function() {
}); });
function search_in_secondary_groups(element) { function checked_slide_events(element) {
var value = $("#checkbox-"+element.name).val(); var value = $("#checkbox-"+element.name).val();
if (value == 0) { if (value == 0) {
$("#checkbox-"+element.name).val(1); $("#checkbox-"+element.name).val(1);

View File

@ -150,6 +150,7 @@ $now = date('Y-m-d');
// Download header. // Download header.
header('Content-type: text/txt'); header('Content-type: text/txt');
header('Content-Disposition: attachment; filename="export_events_'.$now.'.csv"'); header('Content-Disposition: attachment; filename="export_events_'.$now.'.csv"');
setDownloadCookieToken();
try { try {
$fb64 = get_parameter('fb64', null); $fb64 = get_parameter('fb64', null);

View File

@ -111,6 +111,9 @@ $filename = 'tickets_export-'.date('Ymd').'-'.date('His').'.csv';
ob_clean(); ob_clean();
// Set cookie for download control.
setDownloadCookieToken();
header('Content-Type: text/csv; charset=utf-8'); header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename='.$filename); header('Content-Disposition: attachment; filename='.$filename);

View File

@ -428,7 +428,7 @@ $integria_incidents_form .= '<div class="float-right mrgn_lft_5px">'.html_print_
__('Export to CSV'), __('Export to CSV'),
'csv_export', 'csv_export',
false, false,
"location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'", "blockResubmit($(this)); location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'",
'class="sub next"', 'class="sub next"',
true true
).'</div>'; ).'</div>';

View File

@ -424,10 +424,6 @@ if ($access_console_node === true) {
} }
// Sound Events. // Sound Events.
// $javascript = 'javascript: openSoundEventWindow();';
// $sub[$javascript]['text'] = __('Sound Events');
// $sub[$javascript]['id'] = 'Sound Events';
// $sub[$javascript]['type'] = 'direct';
$data_sound = base64_encode( $data_sound = base64_encode(
json_encode( json_encode(
[ [
@ -438,6 +434,7 @@ if ($access_console_node === true) {
'silenceAlarm' => __('Silence alarm'), 'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'), 'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events', 'page' => 'include/ajax/events',
'urlSound' => 'include/sounds/',
] ]
) )
); );

View File

@ -140,7 +140,7 @@ $table->data['1']['2'] .= html_print_submit_button(
__('Export to CSV'), __('Export to CSV'),
'export_csv', 'export_csv',
false, false,
'class="sub next"', 'class="sub next" onclick="blockResumit($(this))"',
true true
); );
@ -221,6 +221,8 @@ if (get_parameter('export_csv')) {
ob_end_clean(); ob_end_clean();
} }
// Set cookie for download control.
setDownloadCookieToken();
// Write metadata. // Write metadata.
header('Content-type: text/csv;'); header('Content-type: text/csv;');
header('Content-Disposition: attachment; filename="network_data.csv"'); header('Content-Disposition: attachment; filename="network_data.csv"');

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1238,6 +1238,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`severity` TEXT, `severity` TEXT,
`status` INT NOT NULL DEFAULT -1, `status` INT NOT NULL DEFAULT -1,
`search` TEXT, `search` TEXT,
`not_search` INT NOT NULL DEFAULT 0,
`text_agent` TEXT, `text_agent` TEXT,
`id_agent` INT DEFAULT 0, `id_agent` INT DEFAULT 0,
`id_agent_module` INT DEFAULT 0, `id_agent_module` INT DEFAULT 0,
@ -1261,6 +1262,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`time_to` TIME NULL, `time_to` TIME NULL,
`custom_data` VARCHAR(500) DEFAULT '', `custom_data` VARCHAR(500) DEFAULT '',
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0, `custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT,
PRIMARY KEY (`id_filter`) PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -2103,6 +2105,7 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields` (
`display_on_front` TINYINT NOT NULL DEFAULT 0, `display_on_front` TINYINT NOT NULL DEFAULT 0,
`is_password_type` TINYINT NOT NULL DEFAULT 0, `is_password_type` TINYINT NOT NULL DEFAULT 0,
`combo_values` TEXT , `combo_values` TEXT ,
`is_link_enabled` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id_field`) PRIMARY KEY (`id_field`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -344,8 +344,8 @@ INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `descri
-- --
-- Dumping data for table `tusuario` -- Dumping data for table `tusuario`
-- --
INSERT INTO `tusuario` (`id_user`, `fullname`, `firstname`, `lastname`, `middlename`, `password`, `comments`, `last_connect`, `registered`, `email`, `phone`, `is_admin`, `language`, `block_size`, `section`, `data_section`, `metaconsole_access`) VALUES INSERT INTO `tusuario` (`id_user`, `fullname`, `firstname`, `lastname`, `middlename`, `password`, `comments`, `last_connect`, `registered`, `email`, `phone`, `is_admin`, `language`, `block_size`, `section`, `data_section`, `metaconsole_access`, `local_user`) VALUES
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, 'default', 0, 'Default', '', 'advanced'); ('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, 'default', 0, 'Default', '', 'advanced', 1);
-- --
-- Dumping data for table `tusuario_perfil` -- Dumping data for table `tusuario_perfil`
@ -1189,7 +1189,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `p
INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`, `no_delete`) VALUES (9,'Packet&#x20;Loss','Checks&#x20;for&#x20;dropped&#x20;packages&#x20;after&#x20;X&#x20;seconds&#x20;of&#x20;testing.&#x20;It&#x20;returns&#x20;%&#x20;of&#x20;dropped&#x20;packets.&#x20;It&#x20;uses&#x20;ping&#x20;flood&#x20;mode&#x20;to&#x20;launch&#x20;50&#x20;consecutive&#x20;pings&#x20;to&#x20;a&#x20;remote&#x20;destination.&#x20;On&#x20;local,&#x20;stable&#x20;networks,&#x20;value&#x20;should&#x20;be&#x20;0.&#x0d;&#x0a;',30,0,'/usr/share/pandora_server/util/plugin/packet_loss.sh','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Test&#x20;time\",\"help\":\"\",\"value\":\"8\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Target&#x20;IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','_field1_&#x20;_field2_', 1); INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`, `no_delete`) VALUES (9,'Packet&#x20;Loss','Checks&#x20;for&#x20;dropped&#x20;packages&#x20;after&#x20;X&#x20;seconds&#x20;of&#x20;testing.&#x20;It&#x20;returns&#x20;%&#x20;of&#x20;dropped&#x20;packets.&#x20;It&#x20;uses&#x20;ping&#x20;flood&#x20;mode&#x20;to&#x20;launch&#x20;50&#x20;consecutive&#x20;pings&#x20;to&#x20;a&#x20;remote&#x20;destination.&#x20;On&#x20;local,&#x20;stable&#x20;networks,&#x20;value&#x20;should&#x20;be&#x20;0.&#x0d;&#x0a;',30,0,'/usr/share/pandora_server/util/plugin/packet_loss.sh','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Test&#x20;time\",\"help\":\"\",\"value\":\"8\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Target&#x20;IP\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"}}','_field1_&#x20;_field2_', 1);
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0,0,''),(2,'Department',0,0,''),(3,'Additional&#x20;ID',0,0,''),(4,'eHorusID',0,0,''); INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0,0,'',0),(2,'Department',0,0,'',0),(3,'Additional&#x20;ID',0,0,'',0),(4,'eHorusID',0,0,'',0);
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','','',''),(2,'critical','Critical&#x20;modules','','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','','',''),(5,'configuration','','','','',''); INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','','',''),(2,'critical','Critical&#x20;modules','','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','','',''),(5,'configuration','','','','','');

View File

@ -9478,6 +9478,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface
function Output($name = '', $dest = '') function Output($name = '', $dest = '')
{ {
$this->logger->debug(sprintf('PDF generated in %.6F seconds', microtime(true) - $this->time0), ['context' => LogContext::STATISTICS]); $this->logger->debug(sprintf('PDF generated in %.6F seconds', microtime(true) - $this->time0), ['context' => LogContext::STATISTICS]);
// Set cokie token to indicate download is ready.
setDownloadCookieToken();
// Finish document if necessary // Finish document if necessary
if ($this->state < 3) { if ($this->state < 3) {

View File

@ -77,7 +77,8 @@ echo $output;
class: '<?php echo $class; ?>', class: '<?php echo $class; ?>',
hash: '<?php echo $hash; ?>', hash: '<?php echo $hash; ?>',
user: '<?php echo $config['id_user']; ?>' user: '<?php echo $config['id_user']; ?>'
} },
title: '<?php echo __('New widget'); ?>',
}); });
// Mode for create new dashboard. // Mode for create new dashboard.

View File

@ -90,7 +90,7 @@ foreach ($widgets as $widget) {
); );
$output .= '</div>'; $output .= '</div>';
$output .= '<div class="list-widgets-description">'; $output .= '<div class="list-widgets-description">';
$output .= $widget['description']; $output .= __($widget['description']);
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
} }

View File

@ -304,6 +304,10 @@ sub parse_config {
$checks[$plugin_setup{"numchecks"}]{'check_name'} = trim($1); $checks[$plugin_setup{"numchecks"}]{'check_name'} = trim($1);
} }
if ($parametro =~ m/^check\_type\s(.*)/i) {
$checks[$plugin_setup{"numchecks"}]{'check_type'} = trim($1);
}
if ($parametro =~ m/^check\_schema\s(.*)/i) { if ($parametro =~ m/^check\_schema\s(.*)/i) {
$checks[$plugin_setup{"numchecks"}]{'check_schema'} = trim($1); $checks[$plugin_setup{"numchecks"}]{'check_schema'} = trim($1);
} }
@ -1015,6 +1019,7 @@ foreach (@checks) {
my $check_show = $_->{'show'}; my $check_show = $_->{'show'};
my $return_type = $_->{'return_type'}; my $return_type = $_->{'return_type'};
my $check_name = $_->{'check_name'}; my $check_name = $_->{'check_name'};
my $check_type = $_->{'check_type'};
$result_check = 0; $result_check = 0;
# Process check (System parameters) # Process check (System parameters)
@ -1156,7 +1161,7 @@ foreach (@checks) {
print_module("MySQL_" . $type . '_' . $check_show, $module_type, $result_check, '', $check_status); print_module("MySQL_" . $type . '_' . $check_show, $module_type, $result_check, '', $check_status);
} else { } else {
if (defined($check_name)) { if (defined($check_name)) {
print_module("MySQL_" . $type . "_" . $check_name, $module_type, $result_check, '', $check_status); print_module("MySQL_" . $type . "_" . $check_name, $check_type, $result_check, '', $check_status);
} else { } else {
print_module("MySQL_" . $type, $module_type, $result_check, '', $check_status); print_module("MySQL_" . $type, $module_type, $result_check, '', $check_status);
} }
@ -1186,3 +1191,4 @@ foreach (@checks) {
} # type ne 'unknown' } # type ne 'unknown'
} }

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.767-221209 Version: 7.0NG.767-221213
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.767-221209" pandora_version="7.0NG.767-221213"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.767"; my $pandora_version = "7.0NG.767";
my $pandora_build = "221209"; my $pandora_build = "221213";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.767"; my $pandora_version = "7.0NG.767";
my $pandora_build = "221209"; my $pandora_build = "221213";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.767 %define version 7.0NG.767
%define release 221209 %define release 221213
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.767" PI_VERSION="7.0NG.767"
PI_BUILD="221209" PI_BUILD="221213"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.767 Build 221209"; my $version = "7.0NG.767 Build 221213";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -21,7 +21,7 @@ use JSON qw(decode_json encode_json);
use MIME::Base64; use MIME::Base64;
use Encode qw(decode encode_utf8); use Encode qw(decode encode_utf8);
use LWP::Simple; use LWP::Simple;
#use Data::Dumper; use Data::Dumper;
# Default lib dir for RPM and DEB packages # Default lib dir for RPM and DEB packages
BEGIN { push @INC, '/usr/lib/perl5'; } BEGIN { push @INC, '/usr/lib/perl5'; }
@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.767 Build 221209"; my $version = "7.0NG.767 Build 221213";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -1294,6 +1294,58 @@ sub help_screen_line($$$){
print "\n\t$option $parameters : $help.\n" unless ($param ne '' && $param ne $option); print "\n\t$option $parameters : $help.\n" unless ($param ne '' && $param ne $option);
} }
sub check_values($) {
my ($check) = @_;
use experimental 'smartmatch';
my $arg_cont = 2;
my $cont = 0;
my @args = @ARGV;
my $total = $#args;
while ($arg_cont <= $total) {
# Check type.
if ($check->[$cont]->{'type'} eq 'json') {
my $json_out = eval { decode_json($args[$arg_cont]) };
if ($@)
{
print "\nValue `$args[$arg_cont]` is an invalid json. \nError:$@\n";
exit;
}
}
# Check values.
if (defined($check->[$cont]->{'values'})) {
if (!($args[$arg_cont] ~~ $check->[$cont]->{'values'})) {
print "\nError: value `$args[$arg_cont]` is not valid for $check->[$cont]->{'name'}\n";
print "\tAvailable options: \t$check->[$cont]->{'values'}->[0]";
if (defined($check->[$cont]->{'text_extra'}->[0])) {
print " $check->[$cont]->{'text_extra'}->[0]";
}
print "\n";
my $cont_aux = 1;
my $while = 'false';
while ($while eq 'false') {
if (defined($check->[$cont]->{'values'}->[$cont_aux])) {
print "\t\t\t\t$check->[$cont]->{'values'}->[$cont_aux]";
if (defined($check->[$cont]->{'text_extra'}->[$cont_aux])) {
print " $check->[$cont]->{'text_extra'}->[$cont_aux]";
}
print "\n";
} else {
exit;
}
$cont_aux++;
}
}
}
$cont++;
$arg_cont++;
}
}
############################################################################### ###############################################################################
############################################################################### ###############################################################################
# CLI FUNCTIONS # CLI FUNCTIONS
@ -4671,7 +4723,7 @@ sub cli_add_event_comment() {
$id_user = 'admin'; $id_user = 'admin';
} }
else { else {
$id_user = pandora_get_user_id($dbh,$user_name); $id_user = pandora_get_user_id($dbh,safe_input($user_name));
exist_check($id_user,'user',$user_name); exist_check($id_user,'user',$user_name);
} }
@ -4680,7 +4732,7 @@ sub cli_add_event_comment() {
my $current_comment = encode_utf8(pandora_get_event_comment($dbh, $id_event)); my $current_comment = encode_utf8(pandora_get_event_comment($dbh, $id_event));
my $utimestamp = time (); my $utimestamp = time ();
my @additional_comment = ({ comment => safe_input($comment), action => "Added comment", id_user => $id_user, utimestamp => $utimestamp}); my @additional_comment = ({ comment => safe_input($comment), action => "Added comment", id_user => $id_user, utimestamp => $utimestamp, event_id => $id_event});
print_log "[INFO] Adding event comment for event '$id_event'. \n\n"; print_log "[INFO] Adding event comment for event '$id_event'. \n\n";
@ -7812,7 +7864,55 @@ sub pandora_manage_main ($$$) {
cli_delete_profile(); cli_delete_profile();
} }
elsif ($param eq '--create_event') { elsif ($param eq '--create_event') {
my @fields = (
{'name' => 'event'},
{
'name' => 'event_type',
'values' => [
'unknown','alert_fired','alert_recovered','alert_ceased',
'alert_manual_validation','recon_host_detected','system',
'error','new_agent','going_up_warning','going_up_critical','going_down_warning',
'going_down_normal','going_down_critical','going_up_normal','configuration_change'
]
},
{'name' => 'group_name'},
{'name' => 'agent_name'},
{'name' => 'module_name'},
{
'name' => 'event_status',
'values' => ['0', '1', '2'],
'text_extra' => ['(New)', '(Validated)', '(In process)']
},
{
'name' => 'severity',
'values' => ['0', '1', '2', '3', '4', '5', '6'],
'text_extra' => [
'(Maintenance)', '(Informational)', '(Normal)',
'(Warning)', '(Critical)', '(Minor)', '(Major)'
]
},
{'name' => 'template_name'},
{'name' => 'user_name'},
{'name' => 'comment'},
{'name' => 'source'},
{'name' => 'id_extra'},
{'name' => 'tags'},
{'type' => 'json', 'name' => 'custom_data_json'},
{
'name' => 'force_create_agent',
'values' => ['0', '1']
},
{'name' => 'critical_instructions'},
{'name' => 'warning_instructions'},
{'name' => 'unknown_instructions'},
{'name' => 'use_alias'},
{'name' => 'metaconsole'}
);
param_check($ltotal, 20, 17); param_check($ltotal, 20, 17);
check_values(\@fields);
cli_create_event(); cli_create_event();
} }
elsif ($param eq '--validate_event') { elsif ($param eq '--validate_event') {