Merge remote-tracking branch 'origin/develop' into ent-3980-7966-aws-multicuenta-y-mejora-monitorizacion
This commit is contained in:
commit
4754e20784
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.735-190624
|
||||
Version: 7.0NG.735-190626
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.735-190624"
|
||||
pandora_version="7.0NG.735-190626"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.735';
|
||||
use constant AGENT_BUILD => '190624';
|
||||
use constant AGENT_BUILD => '190626';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.735"
|
||||
PI_BUILD="190624"
|
||||
PI_BUILD="190626"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190624}
|
||||
{190626}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.735(Build 190624)")
|
||||
#define PANDORA_VERSION ("7.0NG.735(Build 190626)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.735(Build 190624))"
|
||||
VALUE "ProductVersion", "(7.0NG.735(Build 190626))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.735-190624
|
||||
Version: 7.0NG.735-190626
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.735-190624"
|
||||
pandora_version="7.0NG.735-190626"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`);
|
||||
|
||||
DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||
|
|
|
@ -163,7 +163,7 @@ echo '<td>';
|
|||
|
||||
echo __('Group').' ';
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (!$own_info['is_admin'] && check_acl($config['id_user'], 0, 'AW')) {
|
||||
$return_all_group = false;
|
||||
} else {
|
||||
$return_all_group = true;
|
||||
|
|
|
@ -317,9 +317,9 @@ $(document).ready (function () {
|
|||
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
|
||||
values,
|
||||
function (data, status) {
|
||||
original_command = js_html_entity_decode (data["command"]);
|
||||
original_command = data["command"];
|
||||
render_command_preview (original_command);
|
||||
command_description = js_html_entity_decode (data["description"]);
|
||||
command_description = data["description"];
|
||||
render_command_description(command_description);
|
||||
|
||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||
|
|
|
@ -113,6 +113,8 @@ $fields_available['instructions'] = __('Instructions');
|
|||
$fields_available['server_name'] = __('Server Name');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['module_status'] = __('Module Status');
|
||||
$fields_available['mini_severity'] = __('Severity mini');
|
||||
|
||||
|
||||
// Remove fields already selected.
|
||||
foreach ($fields_available as $key => $available) {
|
||||
|
|
|
@ -50,17 +50,10 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=responses&pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
|
||||
];
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
} else {
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=event/custom_events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
}
|
||||
$buttons['fields'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
switch ($section) {
|
||||
|
|
|
@ -208,7 +208,7 @@ if (!empty($sub)) {
|
|||
}
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'RR')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) {
|
||||
// Servers
|
||||
$menu_godmode['gservers']['text'] = __('Servers');
|
||||
$menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
|
||||
|
|
|
@ -280,7 +280,7 @@ if (($create != '') || ($view != '')) {
|
|||
} else {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(
|
||||
__('Plugin creation'),
|
||||
__('Plugin registration'),
|
||||
'images/gm_servers.png',
|
||||
false,
|
||||
'plugin_definition',
|
||||
|
|
|
@ -75,13 +75,73 @@ $graphic_event_group = (bool) get_parameter('graphic_event_group');
|
|||
$get_table_response_command = (bool) get_parameter('get_table_response_command');
|
||||
$save_filter_modal = get_parameter('save_filter_modal', 0);
|
||||
$load_filter_modal = get_parameter('load_filter_modal', 0);
|
||||
$save_filter = get_parameter('save_filter', 0);
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
$update_event_filter = get_parameter('update_event_filter', 0);
|
||||
$save_event_filter = get_parameter('save_event_filter', 0);
|
||||
$in_process_event = get_parameter('in_process_event', 0);
|
||||
$validate_event = get_parameter('validate_event', 0);
|
||||
$delete_event = get_parameter('delete_event', 0);
|
||||
$get_event_filters = get_parameter('get_event_filters', 0);
|
||||
$get_comments = get_parameter('get_comments', 0);
|
||||
|
||||
if ($get_comments) {
|
||||
$event = get_parameter('event', false);
|
||||
$filter = get_parameter('filter', false);
|
||||
|
||||
if ($event === false) {
|
||||
return __('Failed to retrieve comments');
|
||||
}
|
||||
|
||||
if ($filter['group_rep'] == 1) {
|
||||
$events = events_get_all(
|
||||
['te.*'],
|
||||
// Filter.
|
||||
$filter,
|
||||
// Offset.
|
||||
null,
|
||||
// Limit.
|
||||
null,
|
||||
// Order.
|
||||
null,
|
||||
// Sort_field.
|
||||
null,
|
||||
// History.
|
||||
$filter['history'],
|
||||
// Return_sql.
|
||||
false,
|
||||
// Having.
|
||||
sprintf(
|
||||
' HAVING max_id_evento = %d',
|
||||
$event['id_evento']
|
||||
)
|
||||
);
|
||||
if ($events !== false) {
|
||||
$event = $events[0];
|
||||
}
|
||||
} else {
|
||||
$events = events_get_event(
|
||||
$event['id_evento'],
|
||||
false,
|
||||
$meta,
|
||||
$history
|
||||
);
|
||||
|
||||
if ($events !== false) {
|
||||
$event = $events[0];
|
||||
}
|
||||
}
|
||||
|
||||
echo events_page_comments($event, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_event_filters) {
|
||||
$event_filter = events_get_event_filter_select();
|
||||
|
||||
echo io_json_mb_encode($event_filter);
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete event (filtered or not).
|
||||
if ($delete_event) {
|
||||
|
@ -267,6 +327,17 @@ if ($get_filter_values) {
|
|||
|
||||
$event_filter = events_get_event_filter($id_filter);
|
||||
|
||||
if ($event_filter === false) {
|
||||
$event_filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$event_filter['search'] = io_safe_output($event_filter['search']);
|
||||
$event_filter['id_name'] = io_safe_output($event_filter['id_name']);
|
||||
$event_filter['tag_with'] = base64_encode(
|
||||
|
@ -590,7 +661,7 @@ function save_new_filter() {
|
|||
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{
|
||||
"page" : "operation/events/events_list",
|
||||
"page" : "include/ajax/events",
|
||||
"save_event_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
"id_group" : $("select#id_group").val(),
|
||||
|
@ -659,7 +730,7 @@ function save_update_filter() {
|
|||
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
{"page" : "include/ajax/events",
|
||||
"update_event_filter" : 1,
|
||||
"id" : $("#overwrite_filter").val(),
|
||||
"id_group" : $("select#id_group").val(),
|
||||
|
@ -712,7 +783,7 @@ function save_update_filter() {
|
|||
$('#filter_id').append ($('<option></option>').html ( <?php echo "'".__('none')."'"; ?> ).attr ("value", 0));
|
||||
// Reload filters select
|
||||
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
{"page" : "include/ajax/events",
|
||||
"get_event_filters" : 1
|
||||
},
|
||||
function (data) {
|
||||
|
@ -1040,6 +1111,7 @@ if ($get_extended_event) {
|
|||
global $config;
|
||||
|
||||
$event = get_parameter('event', false);
|
||||
$filter = get_parameter('filter', false);
|
||||
|
||||
if ($event === false) {
|
||||
return;
|
||||
|
@ -1079,29 +1151,37 @@ if ($get_extended_event) {
|
|||
}
|
||||
|
||||
// Check ACLs.
|
||||
$access = false;
|
||||
if (is_user_admin($config['id_user'])) {
|
||||
// Do nothing if you're admin, you get full access.
|
||||
$__ignored_line = 0;
|
||||
$access = true;
|
||||
} else if ($config['id_user'] == $event['owner_user']) {
|
||||
// Do nothing if you're the owner user, you get access.
|
||||
$__ignored_line = 0;
|
||||
$access = true;
|
||||
} else if ($event['id_grupo'] == 0) {
|
||||
// If the event has access to all groups, you get access.
|
||||
$__ignored_line = 0;
|
||||
$access = true;
|
||||
} else {
|
||||
// Get your groups.
|
||||
$groups = users_get_groups($config['id_user'], 'ER');
|
||||
|
||||
if (in_array($event['id_grupo'], array_keys($groups))) {
|
||||
// If event group is among the groups of the user, you get access.
|
||||
$__ignored_line = 0;
|
||||
} else {
|
||||
// If all the access types fail, abort.
|
||||
echo 'Access denied';
|
||||
return false;
|
||||
$access = true;
|
||||
} else if ($event['id_agente']
|
||||
&& agents_check_access_agent($event['id_agente'], 'ER')
|
||||
) {
|
||||
// Secondary group, indirect access.
|
||||
$access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$access) {
|
||||
// If all the access types fail, abort.
|
||||
echo 'Access denied';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Print group_rep in a hidden field to recover it from javascript.
|
||||
html_print_input_hidden('group_rep', (int) $group_rep);
|
||||
|
||||
|
@ -1227,7 +1307,7 @@ if ($get_extended_event) {
|
|||
|
||||
$general = events_page_general($event);
|
||||
|
||||
$comments = events_page_comments($event);
|
||||
$comments = '<div id="extended_event_comments_page" class="extended_event_pages"></div>';
|
||||
|
||||
$notifications = '<div id="notification_comment_error" style="display:none">'.ui_print_error_message(__('Error adding comment'), '', true).'</div>';
|
||||
$notifications .= '<div id="notification_comment_success" style="display:none">'.ui_print_success_message(__('Comment added successfully'), '', true).'</div>';
|
||||
|
@ -1238,6 +1318,18 @@ if ($get_extended_event) {
|
|||
|
||||
$loading = '<div id="response_loading" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
|
||||
|
||||
$i = 0;
|
||||
$tab['general'] = $i++;
|
||||
$tab['details'] = $i++;
|
||||
if (!empty($related)) {
|
||||
$tab['related'] = $i++;
|
||||
}
|
||||
|
||||
$tab['custom_fields'] = $i++;
|
||||
$tab['comments'] = $i++;
|
||||
$tab['responses'] = $i++;
|
||||
$tab['custom_data'] = $i++;
|
||||
|
||||
$out = '<div id="tabs">'.$tabs.$notifications.$loading.$general.$details.$related.$custom_fields.$comments.$responses.$custom_data.html_print_input_hidden('id_event', $event['id_evento']).'</div>';
|
||||
|
||||
$js = '<script>
|
||||
|
@ -1249,31 +1341,31 @@ if ($get_extended_event) {
|
|||
// Load the required tab.
|
||||
switch ($dialog_page) {
|
||||
case 'general':
|
||||
$js .= '$tabs.tabs( "option", "active", 0);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['general'].');';
|
||||
break;
|
||||
|
||||
case 'details':
|
||||
$js .= '$tabs.tabs( "option", "active", 1);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['details'].');';
|
||||
break;
|
||||
|
||||
case 'related':
|
||||
$js .= '$tabs.tabs( "option", "active", 2);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['related'].');';
|
||||
break;
|
||||
|
||||
case 'custom_fields':
|
||||
$js .= '$tabs.tabs( "option", "active", 3);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['custom_fields'].');';
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
$js .= '$tabs.tabs( "option", "active", 4);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['comments'].');';
|
||||
break;
|
||||
|
||||
case 'responses':
|
||||
$js .= '$tabs.tabs( "option", "active", 5);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['responses'].');';
|
||||
break;
|
||||
|
||||
case 'custom_data':
|
||||
$js .= '$tabs.tabs( "option", "active", 6);';
|
||||
$js .= '$tabs.tabs( "option", "active", '.$tab['custom_data'].');';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1283,6 +1375,24 @@ if ($get_extended_event) {
|
|||
|
||||
$js .= '});';
|
||||
|
||||
$js .= '
|
||||
$("#link_comments").click(function (){
|
||||
$.post ({
|
||||
url : "ajax.php",
|
||||
data : {
|
||||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: '.json_encode($event).',
|
||||
filter: '.json_encode($filter).'
|
||||
},
|
||||
dataType : "html",
|
||||
success: function (data) {
|
||||
$("#extended_event_comments_page").empty();
|
||||
$("#extended_event_comments_page").html(data);
|
||||
}
|
||||
});
|
||||
});';
|
||||
|
||||
if (events_has_extended_info($event['id_evento']) === true) {
|
||||
$js .= '
|
||||
$("#link_related").click(function (){
|
||||
|
|
|
@ -1257,11 +1257,8 @@ function fill_permissions_ldap($sr)
|
|||
global $config;
|
||||
$permissions = [];
|
||||
$permissions_profile = [];
|
||||
if (defined('METACONSOLE')) {
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) {
|
||||
if ((bool) $config['ldap_save_profile'] === false && ($config['ldap_advanced_config'] == 0 || $config['ldap_advanced_config'] == '')) {
|
||||
$result = 0;
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
|
@ -1287,43 +1284,9 @@ function fill_permissions_ldap($sr)
|
|||
return $permissions_profile;
|
||||
}
|
||||
|
||||
if ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') {
|
||||
$result = db_get_all_rows_filter(
|
||||
'tusuario_perfil',
|
||||
['id_usuario' => $sr['uid'][0]]
|
||||
);
|
||||
if ($result == false) {
|
||||
$permissions[0]['profile'] = $config['default_remote_profile'];
|
||||
$permissions[0]['groups'][] = $config['default_remote_group'];
|
||||
$permissions[0]['tags'] = $config['default_assign_tags'];
|
||||
$permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
foreach ($result as $perms) {
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions_profile;
|
||||
}
|
||||
|
||||
if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 1) {
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions;
|
||||
return get_advanced_permissions($ldap_adv_perms, $sr);
|
||||
}
|
||||
|
||||
if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) {
|
||||
|
@ -1333,25 +1296,16 @@ function fill_permissions_ldap($sr)
|
|||
);
|
||||
if ($result == false) {
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
return $permissions;
|
||||
return get_advanced_permissions($ldap_adv_perms, $sr);
|
||||
}
|
||||
|
||||
foreach ($result as $perms) {
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
$permissions_profile[] = [
|
||||
'profile' => $perms['id_perfil'],
|
||||
'groups' => [$perms['id_grupo']],
|
||||
'tags' => $perms['tags'],
|
||||
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
};
|
||||
|
||||
return $permissions_profile;
|
||||
|
@ -1365,22 +1319,43 @@ function fill_permissions_ldap($sr)
|
|||
return $permissions;
|
||||
}
|
||||
|
||||
// Decode permissions in advanced mode
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get permissions in advanced mode.
|
||||
*
|
||||
* @param array ldap_adv_perms
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_advanced_permissions($ldap_adv_perms, $sr)
|
||||
{
|
||||
$permissions = [];
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if (preg_match('/'.$attr[1].'/', $s_attr)) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
if (!empty($attributes[0])) {
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if (preg_match('/'.$attr[1].'/', $s_attr)) {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[] = [
|
||||
'profile' => $ldap_adv_perm['profile'],
|
||||
'groups' => $ldap_adv_perm['group'],
|
||||
'tags' => implode(',', $ldap_adv_perm['tags']),
|
||||
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190624';
|
||||
$build_version = 'PC190626';
|
||||
$pandora_version = 'v7.0NG.735';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -146,7 +146,7 @@ define('COL_NOTINIT', '#4a83f3');
|
|||
define('COL_UNKNOWN', '#B2B2B2');
|
||||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#FFA631');
|
||||
define('COL_ALERTFIRED', '#F36201');
|
||||
define('COL_MINOR', '#B2B2B2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
define('COL_INFORMATIONAL', '#E4E4E4');
|
||||
|
|
|
@ -2023,3 +2023,58 @@ function db_check_minor_relase_available_to_um($package, $ent, $offline)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to get a lock with current name.
|
||||
*
|
||||
* @param string $lockname Lock name.
|
||||
* @param integer $expiration_time Expiration time.
|
||||
*
|
||||
* @return integer 1 - lock OK, able to continue executing
|
||||
* 0 - already locked by another process.
|
||||
* NULL: something really bad happened
|
||||
*/
|
||||
function db_get_lock($lockname, $expiration_time=86400)
|
||||
{
|
||||
$lock_status = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT IS_FREE_LOCK("%s")',
|
||||
$lockname
|
||||
)
|
||||
);
|
||||
|
||||
if ($lock_status == 1) {
|
||||
$lock_status = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT GET_LOCK("%s", %d)',
|
||||
$lockname,
|
||||
$expiration_time
|
||||
)
|
||||
);
|
||||
|
||||
return $lock_status;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release a previously defined lock.
|
||||
*
|
||||
* @param string $lockname Lock name.
|
||||
*
|
||||
* @return integer 1 Lock released.
|
||||
* 0 cannot release (not owned).
|
||||
* NULL lock does not exist.
|
||||
*/
|
||||
function db_release_lock($lockname)
|
||||
{
|
||||
return db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT RELEASE_LOCK("%s")',
|
||||
$lockname
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,143 @@ enterprise_include_once('meta/include/functions_agents_meta.php');
|
|||
enterprise_include_once('meta/include/functions_modules_meta.php');
|
||||
|
||||
|
||||
/**
|
||||
* Translates a numeric value module_status into descriptive text.
|
||||
*
|
||||
* @param integer $status Module status.
|
||||
*
|
||||
* @return string Descriptive text.
|
||||
*/
|
||||
function events_translate_module_status($status)
|
||||
{
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
return __('NORMAL');
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
return __('CRITICAL');
|
||||
|
||||
case AGENT_MODULE_STATUS_NO_DATA:
|
||||
return __('NOT INIT');
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
return __('ALERT');
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
return __('WARNING');
|
||||
|
||||
default:
|
||||
return __('UNKNOWN');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates a numeric value event_type into descriptive text.
|
||||
*
|
||||
* @param integer $event_type Event type.
|
||||
*
|
||||
* @return string Descriptive text.
|
||||
*/
|
||||
function events_translate_event_type($event_type)
|
||||
{
|
||||
// Event type prepared.
|
||||
switch ($event_type) {
|
||||
case EVENTS_ALERT_FIRED:
|
||||
case EVENTS_ALERT_RECOVERED:
|
||||
case EVENTS_ALERT_CEASED:
|
||||
case EVENTS_ALERT_MANUAL_VALIDATION:
|
||||
return __('ALERT');
|
||||
|
||||
case EVENTS_RECON_HOST_DETECTED:
|
||||
case EVENTS_SYSTEM:
|
||||
case EVENTS_ERROR:
|
||||
case EVENTS_NEW_AGENT:
|
||||
case EVENTS_CONFIGURATION_CHANGE:
|
||||
return __('SYSTEM');
|
||||
|
||||
case EVENTS_GOING_UP_WARNING:
|
||||
case EVENTS_GOING_DOWN_WARNING:
|
||||
return __('WARNING');
|
||||
|
||||
case EVENTS_GOING_DOWN_NORMAL:
|
||||
case EVENTS_GOING_UP_NORMAL:
|
||||
return __('NORMAL');
|
||||
|
||||
case EVENTS_GOING_DOWN_CRITICAL:
|
||||
case EVENTS_GOING_UP_CRITICAL:
|
||||
return __('CRITICAL');
|
||||
|
||||
case EVENTS_UNKNOWN:
|
||||
case EVENTS_GOING_UNKNOWN:
|
||||
default:
|
||||
return __('UNKNOWN');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates a numeric value event_status into descriptive text.
|
||||
*
|
||||
* @param integer $status Event status.
|
||||
*
|
||||
* @return string Descriptive text.
|
||||
*/
|
||||
function events_translate_event_status($status)
|
||||
{
|
||||
switch ($status) {
|
||||
case EVENT_STATUS_NEW:
|
||||
default:
|
||||
return __('NEW');
|
||||
|
||||
case EVENT_STATUS_INPROCESS:
|
||||
return __('IN PROCESS');
|
||||
|
||||
case EVENT_STATUS_VALIDATED:
|
||||
return __('VALIDATED');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates a numeric value criticity into descriptive text.
|
||||
*
|
||||
* @param integer $criticity Event criticity.
|
||||
*
|
||||
* @return string Descriptive text.
|
||||
*/
|
||||
function events_translate_event_criticity($criticity)
|
||||
{
|
||||
switch ($criticity) {
|
||||
case EVENT_CRIT_CRITICAL:
|
||||
return __('CRITICAL');
|
||||
|
||||
case EVENT_CRIT_MAINTENANCE:
|
||||
return __('MAINTENANCE');
|
||||
|
||||
case EVENT_CRIT_INFORMATIONAL:
|
||||
return __('INFORMATIONAL');
|
||||
|
||||
case EVENT_CRIT_MAJOR:
|
||||
return __('MAJOR');
|
||||
|
||||
case EVENT_CRIT_MINOR:
|
||||
return __('MINOR');
|
||||
|
||||
case EVENT_CRIT_NORMAL:
|
||||
return __('NORMAL');
|
||||
|
||||
case EVENT_CRIT_WARNING:
|
||||
return __('WARNING');
|
||||
|
||||
default:
|
||||
return __('UNKNOWN');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all header string for each event field.
|
||||
*
|
||||
|
@ -151,6 +288,9 @@ function events_get_column_name($field)
|
|||
case 'options':
|
||||
return __('Options');
|
||||
|
||||
case 'mini_severity':
|
||||
return 'S';
|
||||
|
||||
default:
|
||||
return __($field);
|
||||
}
|
||||
|
@ -641,32 +781,35 @@ function events_get_all(
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($filter['id_group_filter']) && $filter['id_group_filter'] > 0) {
|
||||
$groups = $filter['id_group_filter'];
|
||||
if (isset($groups) && $groups > 0) {
|
||||
$propagate = db_get_value(
|
||||
'propagate',
|
||||
'tgrupo',
|
||||
'id_grupo',
|
||||
$filter['id_group_filter']
|
||||
$groups
|
||||
);
|
||||
|
||||
if (!$propagate) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND te.id_grupo = %d ',
|
||||
$filter['id_group_filter']
|
||||
' AND (te.id_grupo = %d OR tasg.id_group = %d)',
|
||||
$groups
|
||||
);
|
||||
} else {
|
||||
$groups = [ $filter['id_group_filter'] ];
|
||||
$childrens = groups_get_childrens($id_group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$groups[] = (int) $child['id_grupo'];
|
||||
$children = groups_get_children($groups);
|
||||
$_groups = [ $groups ];
|
||||
if (!empty($children)) {
|
||||
foreach ($children as $child) {
|
||||
$_groups[] = (int) $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
$filter['id_group_filter'] = $groups;
|
||||
$groups = $_groups;
|
||||
|
||||
$sql_filters[] = sprintf(
|
||||
' AND id_group IN (%s) ',
|
||||
join(',', $filter['id_group_filter'])
|
||||
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
join(',', $groups),
|
||||
join(',', $groups)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -702,8 +845,6 @@ function events_get_all(
|
|||
}
|
||||
}
|
||||
|
||||
$sg_active = enterprise_hook('agents_is_using_secondary_groups');
|
||||
|
||||
if (!$user_is_admin) {
|
||||
$ER_groups = users_get_groups($config['id_user'], 'ER', false);
|
||||
$EM_groups = users_get_groups($config['id_user'], 'EM', false, true);
|
||||
|
@ -713,7 +854,8 @@ function events_get_all(
|
|||
if (!$user_is_admin && !users_can_manage_group_all('ER')) {
|
||||
// Get groups where user have ER grants.
|
||||
$sql_filters[] = sprintf(
|
||||
' AND te.id_grupo IN ( %s )',
|
||||
' AND (te.id_grupo IN ( %s ) OR tasg.id_group IN (%s))',
|
||||
join(', ', array_keys($ER_groups)),
|
||||
join(', ', array_keys($ER_groups))
|
||||
);
|
||||
}
|
||||
|
@ -912,7 +1054,9 @@ function events_get_all(
|
|||
// Force_group_and_tag.
|
||||
true,
|
||||
// Table tag for id_grupo.
|
||||
'te.'
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
'tasg.'
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
} else if (check_acl($config['id_user'], 0, 'EW')) {
|
||||
|
@ -936,7 +1080,9 @@ function events_get_all(
|
|||
// Force_group_and_tag.
|
||||
true,
|
||||
// Table tag for id_grupo.
|
||||
'te.'
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
'tasg.'
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
} else if (check_acl($config['id_user'], 0, 'EM')) {
|
||||
|
@ -960,7 +1106,9 @@ function events_get_all(
|
|||
// Force_group_and_tag.
|
||||
true,
|
||||
// Table tag for id_grupo.
|
||||
'te.'
|
||||
'te.',
|
||||
// Alt table tag for id_grupo.
|
||||
'tasg.'
|
||||
);
|
||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||
}
|
||||
|
@ -1036,12 +1184,37 @@ function events_get_all(
|
|||
|
||||
$tgrupo_join = 'LEFT';
|
||||
$tgrupo_join_filters = [];
|
||||
if (isset($filter['id_group_filter']) && $filter['id_group_filter'] > 0) {
|
||||
if (isset($groups)
|
||||
&& (is_array($groups)
|
||||
|| $groups > 0)
|
||||
) {
|
||||
$tgrupo_join = 'INNER';
|
||||
$tgrupo_join_filters[] = sprintf(
|
||||
' AND tg.id_grupo = %s',
|
||||
$filter['id_group_filter']
|
||||
);
|
||||
if (is_array($groups)) {
|
||||
$tgrupo_join_filters[] = sprintf(
|
||||
' AND (tg.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
join(', ', $groups),
|
||||
join(', ', $groups)
|
||||
);
|
||||
} else {
|
||||
$tgrupo_join_filters[] = sprintf(
|
||||
' AND (tg.id_grupo = %s OR tasg.id_group = %s)',
|
||||
$groups,
|
||||
$groups
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$server_join = '';
|
||||
if (is_metaconsole()) {
|
||||
$server_join = ' LEFT JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id';
|
||||
if (!empty($filter['server_id'])) {
|
||||
$server_join = sprintf(
|
||||
' LEFT JOIN tmetaconsole_setup ts
|
||||
ON ts.id = te.server_id AND ts.id= %d',
|
||||
$filter['server_id']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Secondary groups.
|
||||
|
@ -1076,6 +1249,7 @@ function events_get_all(
|
|||
%s JOIN tgrupo tg
|
||||
ON te.id_grupo = tg.id_grupo
|
||||
%s
|
||||
%s
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
|
@ -1094,6 +1268,7 @@ function events_get_all(
|
|||
join(' ', $agent_join_filters),
|
||||
$tgrupo_join,
|
||||
join(' ', $tgrupo_join_filters),
|
||||
$server_join,
|
||||
join(' ', $sql_filters),
|
||||
$group_by,
|
||||
$order_by,
|
||||
|
@ -4363,7 +4538,7 @@ function events_page_general($event)
|
|||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
function events_page_comments($event)
|
||||
function events_page_comments($event, $ajax=false)
|
||||
{
|
||||
// Comments.
|
||||
global $config;
|
||||
|
@ -4372,7 +4547,7 @@ function events_page_comments($event)
|
|||
|
||||
$comments = $event['user_comment'];
|
||||
if (isset($event['comments'])) {
|
||||
$comments = $event['comments'];
|
||||
$comments = explode('<br>', $event['comments']);
|
||||
}
|
||||
|
||||
$table_comments = new stdClass;
|
||||
|
@ -4383,100 +4558,102 @@ function events_page_comments($event)
|
|||
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
|
||||
// If comments are not stored in json, the format is old.
|
||||
$comments_array = json_decode(io_safe_output($comments), true);
|
||||
if (!empty($comments) && json_last_error() != JSON_ERROR_NONE) {
|
||||
$comments_array = [
|
||||
[
|
||||
'comment' => 'Error retrieving comments',
|
||||
'action' => 'Internal message',
|
||||
'id_user' => 'SYSTEM',
|
||||
'utimestamp' => time(),
|
||||
],
|
||||
];
|
||||
}
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comments_array)) {
|
||||
$comments_array = array_reverse($comments_array);
|
||||
}
|
||||
|
||||
if (empty($comments_array)) {
|
||||
$comments_format = 'old';
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
} else {
|
||||
$comments_format = 'new';
|
||||
// If comments are not stored in json, the format is old.
|
||||
$comments_array = json_decode(io_safe_output($comments), true);
|
||||
}
|
||||
|
||||
switch ($comments_format) {
|
||||
case 'new':
|
||||
if (empty($comments_array)) {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$comm = array_reverse($comm);
|
||||
}
|
||||
|
||||
if (isset($comments_array) === true
|
||||
&& is_array($comments_array) === true
|
||||
) {
|
||||
foreach ($comments_array as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = $c['comment'];
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (empty($comm)) {
|
||||
$comments_format = 'old';
|
||||
} else {
|
||||
$comments_format = 'new';
|
||||
}
|
||||
|
||||
case 'old':
|
||||
$comments_array = explode('<br>', $comments);
|
||||
|
||||
// Split comments and put in table.
|
||||
$col = 0;
|
||||
$data = [];
|
||||
|
||||
foreach ($comments_array as $c) {
|
||||
switch ($col) {
|
||||
case 0:
|
||||
$row_text = preg_replace('/\s*--\s*/', '', $c);
|
||||
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
|
||||
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
|
||||
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[$col] = $row_text;
|
||||
|
||||
$col++;
|
||||
|
||||
if ($col == 2) {
|
||||
$col = 0;
|
||||
$table_comments->data[] = $data;
|
||||
switch ($comments_format) {
|
||||
case 'new':
|
||||
if (empty($comm)) {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($comments_array) == 1 && $comments_array[0] == '') {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
if (isset($comm) === true
|
||||
&& is_array($comm) === true
|
||||
) {
|
||||
foreach ($comm as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = $c['comment'];
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'old':
|
||||
$comm = explode('<br>', $comments);
|
||||
|
||||
// Split comments and put in table.
|
||||
$col = 0;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
foreach ($comm as $c) {
|
||||
switch ($col) {
|
||||
case 0:
|
||||
$row_text = preg_replace('/\s*--\s*/', '', $c);
|
||||
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
|
||||
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
|
||||
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[$col] = $row_text;
|
||||
|
||||
$col++;
|
||||
|
||||
if ($col == 2) {
|
||||
$col = 0;
|
||||
$table_comments->data[] = $data;
|
||||
$data = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($comm) == 1 && $comm[0] == '') {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (((tags_checks_event_acl(
|
||||
|
@ -4519,9 +4696,11 @@ function events_page_comments($event)
|
|||
);
|
||||
}
|
||||
|
||||
$comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
|
||||
if ($ajax) {
|
||||
return $comments_form.html_print_table($table_comments, true);
|
||||
}
|
||||
|
||||
return $comments;
|
||||
return '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -6449,10 +6628,6 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
|
|||
*/
|
||||
function events_get_secondary_groups_left_join($table)
|
||||
{
|
||||
if (users_is_admin()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($table == 'tevento') {
|
||||
return 'LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent';
|
||||
}
|
||||
|
|
|
@ -298,6 +298,52 @@ function groups_get_childrens_ids($parent, $groups=null)
|
|||
|
||||
|
||||
/**
|
||||
* Return a array of id_group of children of given parent.
|
||||
*
|
||||
* @param integer $parent The id_grupo parent to search its children.
|
||||
* @param array $ignorePropagate Ignore propagate.
|
||||
*/
|
||||
function groups_get_children($parent, $ignorePropagate=false)
|
||||
{
|
||||
static $groups;
|
||||
|
||||
if (empty($groups)) {
|
||||
$groups = db_get_all_rows_in_table('tgrupo');
|
||||
$groups = array_reduce(
|
||||
$groups,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_grupo']] = $item;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$return = [];
|
||||
foreach ($groups as $key => $g) {
|
||||
if ($g['id_grupo'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($ignorePropagate || $parent == 0 || $groups[$parent]['propagate']) {
|
||||
if ($g['parent'] == $parent) {
|
||||
$return += [$g['id_grupo'] => $g];
|
||||
if ($g['propagate'] || $ignorePropagate) {
|
||||
$return += groups_get_children(
|
||||
$g['id_grupo'],
|
||||
$ignorePropagate
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XXX: This is not working. Expects 'propagate' on CHILD not on PARENT!!!
|
||||
*
|
||||
* Return a array of id_group of childrens (to branches down)
|
||||
*
|
||||
* @param integer $parent The id_group parent to search the childrens.
|
||||
|
|
|
@ -50,6 +50,12 @@ function menu_print_menu(&$menu)
|
|||
|
||||
$sec = (string) get_parameter('sec');
|
||||
$sec2 = (string) get_parameter('sec2');
|
||||
if ($sec2 == 'operation/agentes/ver_agente') {
|
||||
$sec2 = 'godmode/agentes/configurar_agente';
|
||||
} else {
|
||||
$sec2 = (string) get_parameter('sec2');
|
||||
}
|
||||
|
||||
$menu_selected = false;
|
||||
|
||||
$allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']);
|
||||
|
|
|
@ -597,7 +597,7 @@ function snmp_browser_print_oid(
|
|||
*
|
||||
* @return string The container div.
|
||||
*/
|
||||
function snmp_browser_print_container($return=false, $width='100%', $height='500px', $display='')
|
||||
function snmp_browser_print_container($return=false, $width='100%', $height='60%', $display='')
|
||||
{
|
||||
// Target selection
|
||||
$table = new stdClass();
|
||||
|
@ -773,7 +773,7 @@ function snmp_browser_print_container($return=false, $width='100%', $height='500
|
|||
|
||||
$output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>';
|
||||
$output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">'.html_print_image('images/spinner.gif', true).'</div>';
|
||||
$output .= '<div id="snmp_browser" style="height: 100%; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>';
|
||||
$output .= '<div id="snmp_browser" style="height: 100%; min-height:100px; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>';
|
||||
$output .= '<div class="databox" id="snmp_data" style="margin: 5px;"></div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
|
|
@ -745,7 +745,8 @@ function tags_get_acl_tags(
|
|||
$meta=false,
|
||||
$childrens_ids=[],
|
||||
$force_group_and_tag=false,
|
||||
$id_grupo_table_pretag=''
|
||||
$id_grupo_table_pretag='',
|
||||
$alt_id_grupo_table_pretag=''
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -820,7 +821,8 @@ function tags_get_acl_tags(
|
|||
$meta,
|
||||
$force_group_and_tag,
|
||||
false,
|
||||
$id_grupo_table_pretag
|
||||
$id_grupo_table_pretag,
|
||||
$alt_id_grupo_table_pretag
|
||||
);
|
||||
|
||||
if (!empty($condition)) {
|
||||
|
@ -917,7 +919,8 @@ function tags_get_acl_tags_event_condition(
|
|||
$meta=false,
|
||||
$force_group_and_tag=false,
|
||||
$force_equal=false,
|
||||
$id_grupo_table_pretag=''
|
||||
$id_grupo_table_pretag='',
|
||||
$alt_id_grupo_table_pretag=''
|
||||
) {
|
||||
global $config;
|
||||
$condition = [];
|
||||
|
@ -935,7 +938,7 @@ function tags_get_acl_tags_event_condition(
|
|||
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
|
||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR id_group = '.$group_id.')';
|
||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
|
||||
|
||||
// Tags condition (The module has at least one of the restricted tags).
|
||||
$tags_condition = '';
|
||||
|
@ -971,7 +974,7 @@ function tags_get_acl_tags_event_condition(
|
|||
}
|
||||
|
||||
$in_group = implode(',', $without_tags);
|
||||
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR id_group IN (%s))', $in_group, $in_group);
|
||||
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR '.$alt_id_grupo_table_pretag.'id_group IN (%s))', $in_group, $in_group);
|
||||
}
|
||||
|
||||
$condition = !empty($condition) ? "($condition)" : '';
|
||||
|
|
|
@ -760,6 +760,12 @@ function ui_print_os_icon(
|
|||
$subfolder .= '/so_big_icons';
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$no_in_meta = true;
|
||||
} else {
|
||||
$no_in_meta = false;
|
||||
}
|
||||
|
||||
$icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
|
||||
$os_name = get_os_name($id_os);
|
||||
if (empty($icon)) {
|
||||
|
@ -770,7 +776,7 @@ function ui_print_os_icon(
|
|||
$options,
|
||||
true,
|
||||
$relative,
|
||||
false,
|
||||
$no_in_meta,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
|
@ -778,13 +784,13 @@ function ui_print_os_icon(
|
|||
}
|
||||
} else if ($apply_skin) {
|
||||
if ($only_src) {
|
||||
$output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, false, true);
|
||||
$output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, $no_in_meta, true);
|
||||
} else {
|
||||
if (!isset($options['title'])) {
|
||||
$options['title'] = $os_name;
|
||||
}
|
||||
|
||||
$output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, false, true);
|
||||
$output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, $no_in_meta, true);
|
||||
}
|
||||
} else {
|
||||
// $output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>";
|
||||
|
@ -2938,15 +2944,15 @@ function ui_print_datatable(array $parameters)
|
|||
}
|
||||
|
||||
if (!isset($parameters['order']['field'])) {
|
||||
$order = 1;
|
||||
$order = 0;
|
||||
} else {
|
||||
$order = array_search(
|
||||
$parameters['order']['field'],
|
||||
$parameters['columns']
|
||||
);
|
||||
|
||||
if (empty($order)) {
|
||||
$order = 1;
|
||||
if ($order === false) {
|
||||
$order = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function clippy_module_unknow()
|
|||
$return_tours['tours']['module_unknow']['steps'] = [];
|
||||
$return_tours['tours']['module_unknow']['steps'][] = [
|
||||
'init_step_context' => true,
|
||||
'intro' => '<table>'.'<tr>'.'<td class="context_help_title">'.__('You have unknown modules in this agent.').'</td>'.'</tr>'.'<tr>'.'<td class="context_help_body">'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').ui_print_help_icon('context_module_unknow', true, '', 'images/help.png').'</td>'.'</tr>'.'</table>',
|
||||
'intro' => '<table>'.'<tr>'.'<td class="context_help_title">'.__('You have unknown modules in this agent.').'</td>'.'</tr>'.'<tr>'.'<td class="context_help_body">'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').'</td>'.'</tr>'.'</table>',
|
||||
];
|
||||
$return_tours['tours']['module_unknow']['conf'] = [];
|
||||
$return_tours['tours']['module_unknow']['conf']['autostart'] = false;
|
||||
|
|
|
@ -1,386 +1,405 @@
|
|||
(function($) {
|
||||
$.fn.check = function () {
|
||||
return this.each (function () {
|
||||
this.checked = true;
|
||||
});};
|
||||
$.fn.check = function() {
|
||||
return this.each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.uncheck = function () {
|
||||
return this.each (function () {
|
||||
this.checked = false;
|
||||
});};
|
||||
$.fn.uncheck = function() {
|
||||
return this.each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.enable = function () {
|
||||
return $(this).removeAttr ("disabled");
|
||||
};
|
||||
$.fn.enable = function() {
|
||||
return $(this).removeAttr("disabled");
|
||||
};
|
||||
|
||||
$.fn.disable = function () {
|
||||
return $(this).attr ("disabled", "disabled");
|
||||
};
|
||||
$.fn.disable = function() {
|
||||
return $(this).attr("disabled", "disabled");
|
||||
};
|
||||
|
||||
$.fn.pulsate = function () {
|
||||
var i = 0;
|
||||
for (i = 0; i <= 2; i++) {
|
||||
$(this).fadeOut ("slow").fadeIn ("slow");
|
||||
}
|
||||
};
|
||||
$.fn.pulsate = function() {
|
||||
var i = 0;
|
||||
for (i = 0; i <= 2; i++) {
|
||||
$(this)
|
||||
.fadeOut("slow")
|
||||
.fadeIn("slow");
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.showMessage = function (msg) {
|
||||
return $(this).hide ().empty ()
|
||||
// here, previously .text (msg)
|
||||
.html (msg)
|
||||
.slideDown ();
|
||||
};
|
||||
}) (jQuery);
|
||||
$.fn.showMessage = function(msg) {
|
||||
return (
|
||||
$(this)
|
||||
.hide()
|
||||
.empty()
|
||||
// here, previously .text (msg)
|
||||
.html(msg)
|
||||
.slideDown()
|
||||
);
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
$(document).ready (function () {
|
||||
$("a#show_messages_dialog").click (function () {
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "operation/messages/message_list"
|
||||
},
|
||||
function (data, status) {
|
||||
$("#dialog_messages").hide ()
|
||||
.empty ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
title: $("a#show_messages_dialog").attr ("title"),
|
||||
resizable: false,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 700,
|
||||
height: 300
|
||||
}).show ();
|
||||
},
|
||||
"html"
|
||||
);
|
||||
$(document).ready(function() {
|
||||
$("a#show_messages_dialog").click(function() {
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "operation/messages/message_list"
|
||||
},
|
||||
function(data, status) {
|
||||
$("#dialog_messages")
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: $("a#show_messages_dialog").attr("title"),
|
||||
resizable: false,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 700,
|
||||
height: 300
|
||||
})
|
||||
.show();
|
||||
},
|
||||
"html"
|
||||
);
|
||||
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$("a.show_systemalert_dialog").click (function () {
|
||||
$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
|
||||
$("#opacidad").css('opacity', 0.5);
|
||||
$("a.show_systemalert_dialog").click(function() {
|
||||
$("body").append(
|
||||
"<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
|
||||
);
|
||||
$("#opacidad").css("opacity", 0.5);
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "operation/system_alert"},
|
||||
function (data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages").empty ().append (data);
|
||||
$("#alert_messages").css('opacity', 1);
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "operation/system_alert"
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages")
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#alert_messages").css("opacity", 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
});
|
||||
|
||||
},
|
||||
"html"
|
||||
);
|
||||
});
|
||||
|
||||
$("a.modalpopup").click (function () {
|
||||
var elem = $(this).attr("id");
|
||||
$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
|
||||
$("#opacidad").css('opacity', 0.5);
|
||||
$("a.modalpopup").click(function() {
|
||||
var elem = $(this).attr("id");
|
||||
$("body").append(
|
||||
"<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
|
||||
);
|
||||
$("#opacidad").css("opacity", 0.5);
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "general/alert_enterprise",
|
||||
"message": elem
|
||||
},
|
||||
function (data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages").empty ().append (data);
|
||||
$("#alert_messages").css('opacity', 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages")
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#alert_messages").css("opacity", 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
// Creacion de ventana modal y botones
|
||||
$(".publienterprise").click (function () {
|
||||
var elem = $(this).attr("id");
|
||||
$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
|
||||
$("#opacidad").css('opacity', 0.5);
|
||||
// Creacion de ventana modal y botones
|
||||
$(".publienterprise").click(function() {
|
||||
var elem = $(this).attr("id");
|
||||
$("body").append(
|
||||
"<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
|
||||
);
|
||||
$("#opacidad").css("opacity", 0.5);
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "general/alert_enterprise",
|
||||
"message": elem
|
||||
},
|
||||
function (data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages").empty ().append (data);
|
||||
$("#alert_messages").css('opacity', 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$(".publienterprisehide").click (function () {
|
||||
var elem = $(this).attr("id");
|
||||
$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
|
||||
$("#opacidad").css('opacity', 0.5);
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages")
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#alert_messages").css("opacity", 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page": "general/alert_enterprise",
|
||||
"message": elem
|
||||
},
|
||||
function (data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages").empty ().append (data);
|
||||
$("#alert_messages").css('opacity', 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
$(".publienterprisehide").click(function() {
|
||||
var elem = $(this).attr("id");
|
||||
$("body").append(
|
||||
"<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
|
||||
);
|
||||
$("#opacidad").css("opacity", 0.5);
|
||||
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
$("#alert_messages")
|
||||
.empty()
|
||||
.append(data);
|
||||
$("#alert_messages").css("opacity", 1);
|
||||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
if ($("#license_error_msg_dialog").length) {
|
||||
if (typeof process_login_ok == "undefined") process_login_ok = 0;
|
||||
|
||||
if ($('#license_error_msg_dialog').length) {
|
||||
if (typeof(process_login_ok) == "undefined")
|
||||
process_login_ok = 0;
|
||||
if (typeof show_error_license == "undefined") show_error_license = 0;
|
||||
|
||||
if (typeof(show_error_license) == "undefined")
|
||||
show_error_license = 0;
|
||||
if (process_login_ok || show_error_license) {
|
||||
$("#license_error_msg_dialog").dialog({
|
||||
dialogClass: "no-close",
|
||||
closeOnEscape: false,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 470,
|
||||
width: 850,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
open: function() {
|
||||
var remaining = 30;
|
||||
|
||||
if (process_login_ok || show_error_license) {
|
||||
// Timeout counter.
|
||||
var count = function() {
|
||||
if (remaining > 0) {
|
||||
$("#license_error_remaining").text(remaining);
|
||||
remaining -= 1;
|
||||
} else {
|
||||
$("#license_error_remaining").hide();
|
||||
$("#ok_buttom").show();
|
||||
clearInterval(count);
|
||||
}
|
||||
};
|
||||
|
||||
$( "#license_error_msg_dialog" ).dialog({
|
||||
dialogClass: "no-close",
|
||||
closeOnEscape: false,
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 450,
|
||||
width: 850,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
open: function() {
|
||||
var remaining = 30;
|
||||
setInterval(count, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
// Timeout counter.
|
||||
var count = function() {
|
||||
if (remaining > 0) {
|
||||
$("#license_error_remaining").text(remaining);
|
||||
remaining -= 1;
|
||||
} else {
|
||||
$("#license_error_remaining").hide();
|
||||
$("#ok_buttom").show();
|
||||
clearInterval(count);
|
||||
}
|
||||
}
|
||||
$("#submit-hide-license-error-msg").click(function() {
|
||||
$("#license_error_msg_dialog").dialog("close");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(count, 1000);
|
||||
}
|
||||
});
|
||||
if ($("#msg_change_password").length) {
|
||||
$("#msg_change_password").dialog({
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 450,
|
||||
width: 620,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#submit-hide-license-error-msg").click (function () {
|
||||
$("#license_error_msg_dialog" ).dialog('close')
|
||||
});
|
||||
if ($("#login_blocked").length) {
|
||||
$("#login_blocked").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 200,
|
||||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ($("#login_correct_pass").length) {
|
||||
$("#login_correct_pass").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 200,
|
||||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
forced_title_callback();
|
||||
|
||||
if ($('#msg_change_password').length) {
|
||||
$(document).on("scroll", function() {
|
||||
if (
|
||||
document.documentElement.scrollTop != 0 ||
|
||||
document.body.scrollTop != 0
|
||||
) {
|
||||
if ($("#head").css("position") == "fixed") {
|
||||
if ($("#menu").css("position") == "fixed") {
|
||||
$("#menu").css("top", "80px");
|
||||
} else {
|
||||
$("#menu").css("top", "60px");
|
||||
}
|
||||
} else {
|
||||
if ($("#menu").css("position") == "fixed") {
|
||||
$("#menu").css("top", "20px");
|
||||
} else {
|
||||
$("#menu").css("top", "80px");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($("#head").css("position") == "fixed") {
|
||||
if ($("#menu").css("position") == "fixed") {
|
||||
$("#menu").css("top", "80px");
|
||||
} else {
|
||||
$("#menu").css("top", "60px");
|
||||
}
|
||||
} else {
|
||||
if ($("#menu").css("position") == "fixed") {
|
||||
$("#menu").css("top", "80px");
|
||||
} else {
|
||||
$("#menu").css("top", "80px");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$( "#msg_change_password" ).dialog({
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 350,
|
||||
width: 620,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
// if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){
|
||||
// if($('#head').css('position') =='fixed'){
|
||||
// $('#menu').css('top','80px');
|
||||
// }
|
||||
// else{
|
||||
// $('#menu').css('top','20px');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// if($('#head').css('position') =='fixed'){
|
||||
// if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
|
||||
// $('#menu').css('top','60px');
|
||||
// }else{
|
||||
// $('#menu').css('top','80px');
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else{
|
||||
// $('#menu').css('top','60px');
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if ($('#login_blocked').length) {
|
||||
|
||||
$( "#login_blocked" ).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 200,
|
||||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if ($('#login_correct_pass').length) {
|
||||
|
||||
$( "#login_correct_pass" ).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 200,
|
||||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
forced_title_callback();
|
||||
|
||||
|
||||
$(document).on("scroll", function(){
|
||||
|
||||
if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
|
||||
if($('#head').css('position') =='fixed'){
|
||||
if($('#menu').css('position') =='fixed'){
|
||||
$('#menu').css('top','80px');
|
||||
} else {
|
||||
$('#menu').css('top','60px');
|
||||
}
|
||||
} else {
|
||||
if($('#menu').css('position') =='fixed'){
|
||||
$('#menu').css('top','20px');
|
||||
} else {
|
||||
$('#menu').css('top','80px');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($('#head').css('position') =='fixed'){
|
||||
if($('#menu').css('position') =='fixed'){
|
||||
$('#menu').css('top','80px');
|
||||
} else {
|
||||
$('#menu').css('top','60px');
|
||||
}
|
||||
} else {
|
||||
if($('#menu').css('position') =='fixed'){
|
||||
$('#menu').css('top','80px');
|
||||
} else {
|
||||
$('#menu').css('top','80px');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){
|
||||
// if($('#head').css('position') =='fixed'){
|
||||
// $('#menu').css('top','80px');
|
||||
// }
|
||||
// else{
|
||||
// $('#menu').css('top','20px');
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// if($('#head').css('position') =='fixed'){
|
||||
// if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
|
||||
// $('#menu').css('top','60px');
|
||||
// }else{
|
||||
// $('#menu').css('top','80px');
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else{
|
||||
// $('#menu').css('top','60px');
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
$("#alert_messages").draggable();
|
||||
$("#alert_messages").css({'left':+parseInt(screen.width/2)-parseInt($("#alert_messages").css('width'))/2+'px'});
|
||||
|
||||
$("#alert_messages").draggable();
|
||||
$("#alert_messages").css({
|
||||
left:
|
||||
+parseInt(screen.width / 2) -
|
||||
parseInt($("#alert_messages").css("width")) / 2 +
|
||||
"px"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function forced_title_callback() {
|
||||
// Forced title code
|
||||
$('body').on('mouseenter', '.forced_title', function() {
|
||||
///////////////////////////////////////////
|
||||
// Put the layer in the left-top corner to fill it
|
||||
///////////////////////////////////////////
|
||||
$('#forced_title_layer').css('left', 0);
|
||||
$('#forced_title_layer').css('top', 0);
|
||||
// Forced title code
|
||||
$("body").on("mouseenter", ".forced_title", function() {
|
||||
///////////////////////////////////////////
|
||||
// Put the layer in the left-top corner to fill it
|
||||
///////////////////////////////////////////
|
||||
$("#forced_title_layer").css("left", 0);
|
||||
$("#forced_title_layer").css("top", 0);
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Get info of the image
|
||||
///////////////////////////////////////////
|
||||
///////////////////////////////////////////
|
||||
// Get info of the image
|
||||
///////////////////////////////////////////
|
||||
|
||||
var img_top = $(this).offset().top;
|
||||
var img_width = $(this).width();
|
||||
var img_height = $(this).height();
|
||||
var img_id = $(this).attr('id');
|
||||
var img_left_mid = $(this).offset().left + (img_width / 2);
|
||||
var img_top = $(this).offset().top;
|
||||
var img_width = $(this).width();
|
||||
var img_height = $(this).height();
|
||||
var img_id = $(this).attr("id");
|
||||
var img_left_mid = $(this).offset().left + img_width / 2;
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Put title in the layer
|
||||
///////////////////////////////////////////
|
||||
///////////////////////////////////////////
|
||||
// Put title in the layer
|
||||
///////////////////////////////////////////
|
||||
|
||||
// If the '.forced_title' element has 'use_title_for_force_title' = 1
|
||||
// into their 'data' prop, the element title will be used for the
|
||||
// content.
|
||||
if ($(this).data("use_title_for_force_title")) {
|
||||
var title = $(this).data("title");
|
||||
}
|
||||
else {
|
||||
var title = $('#forced_title_'+img_id).html();
|
||||
}
|
||||
// If the '.forced_title' element has 'use_title_for_force_title' = 1
|
||||
// into their 'data' prop, the element title will be used for the
|
||||
// content.
|
||||
if ($(this).data("use_title_for_force_title")) {
|
||||
var title = $(this).data("title");
|
||||
} else {
|
||||
var title = $("#forced_title_" + img_id).html();
|
||||
}
|
||||
|
||||
$('#forced_title_layer').html(title);
|
||||
$("#forced_title_layer").html(title);
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Get info of the layer
|
||||
///////////////////////////////////////////
|
||||
///////////////////////////////////////////
|
||||
// Get info of the layer
|
||||
///////////////////////////////////////////
|
||||
|
||||
var layer_width = $('#forced_title_layer').width();
|
||||
var layer_height = $('#forced_title_layer').height();
|
||||
var layer_width = $("#forced_title_layer").width();
|
||||
var layer_height = $("#forced_title_layer").height();
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Obtain the new position of the layer
|
||||
///////////////////////////////////////////
|
||||
///////////////////////////////////////////
|
||||
// Obtain the new position of the layer
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Jquery doesnt know the padding of the layer
|
||||
var layer_padding = 4;
|
||||
// Jquery doesnt know the padding of the layer
|
||||
var layer_padding = 4;
|
||||
|
||||
// Deduct padding of both sides
|
||||
var layer_top = img_top - layer_height - (layer_padding * 2) - 5;
|
||||
if (layer_top < 0) {
|
||||
layer_top = img_top + img_height + (layer_padding * 2);
|
||||
}
|
||||
// Deduct padding of both sides
|
||||
var layer_top = img_top - layer_height - layer_padding * 2 - 5;
|
||||
if (layer_top < 0) {
|
||||
layer_top = img_top + img_height + layer_padding * 2;
|
||||
}
|
||||
|
||||
// Deduct padding of one side
|
||||
var layer_left = img_left_mid - (layer_width / 2) - layer_padding;
|
||||
if (layer_left < 0) {
|
||||
layer_left = 0;
|
||||
}
|
||||
// Deduct padding of one side
|
||||
var layer_left = img_left_mid - layer_width / 2 - layer_padding;
|
||||
if (layer_left < 0) {
|
||||
layer_left = 0;
|
||||
}
|
||||
|
||||
var real_layer_width = layer_width + (layer_padding * 2) + 5;
|
||||
var layer_right = layer_left + real_layer_width;
|
||||
var screen_width = $(window).width();
|
||||
if (screen_width < layer_right) {
|
||||
layer_left = screen_width - real_layer_width;
|
||||
}
|
||||
var real_layer_width = layer_width + layer_padding * 2 + 5;
|
||||
var layer_right = layer_left + real_layer_width;
|
||||
var screen_width = $(window).width();
|
||||
if (screen_width < layer_right) {
|
||||
layer_left = screen_width - real_layer_width;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Set the layer position and show
|
||||
///////////////////////////////////////////
|
||||
///////////////////////////////////////////
|
||||
// Set the layer position and show
|
||||
///////////////////////////////////////////
|
||||
|
||||
$('#forced_title_layer').css('left', layer_left);
|
||||
$('#forced_title_layer').css('top', layer_top);
|
||||
$('#forced_title_layer').show();
|
||||
});
|
||||
$('body').on('mouseout', '.forced_title', function () {
|
||||
$('#forced_title_layer').hide().empty();
|
||||
});
|
||||
$("#forced_title_layer").css("left", layer_left);
|
||||
$("#forced_title_layer").css("top", layer_top);
|
||||
$("#forced_title_layer").show();
|
||||
});
|
||||
$("body").on("mouseout", ".forced_title", function() {
|
||||
$("#forced_title_layer")
|
||||
.hide()
|
||||
.empty();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
var original_command = "";
|
||||
|
||||
function parse_alert_command(command, classs) {
|
||||
if (classs == "recovery") {
|
||||
classs = "fields_recovery";
|
||||
|
@ -34,13 +33,13 @@ function parse_alert_command(command, classs) {
|
|||
}
|
||||
|
||||
function render_command_preview(original_command) {
|
||||
$("#textarea_command_preview").text(
|
||||
$("#textarea_command_preview").html(
|
||||
parse_alert_command(original_command, "")
|
||||
);
|
||||
}
|
||||
|
||||
function render_command_recovery_preview(original_command) {
|
||||
$("#textarea_command_recovery_preview").text(
|
||||
$("#textarea_command_recovery_preview").html(
|
||||
parse_alert_command(original_command, "recovery")
|
||||
);
|
||||
}
|
||||
|
|
|
@ -231,7 +231,6 @@ function get_response(response_id) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
response = data;
|
||||
|
@ -255,7 +254,6 @@ function get_response_params(response_id) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
response_params = data;
|
||||
|
@ -279,7 +277,6 @@ function get_response_description(response_id) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
response_description = data;
|
||||
|
@ -305,7 +302,6 @@ function get_event_name(event_id, meta, history) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
name = data;
|
||||
|
@ -349,7 +345,6 @@ function get_response_target(
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
target = data;
|
||||
|
@ -394,7 +389,6 @@ function perform_response(target, response_id) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
|
@ -424,7 +418,6 @@ function perform_response_massive(target, response_id, out_iterator) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
var out = data.replace(/[\n|\r]/g, "<br>");
|
||||
|
@ -460,7 +453,6 @@ function event_change_status(event_ids) {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#button-status_button").removeAttr("disabled");
|
||||
|
@ -499,7 +491,6 @@ function event_change_owner() {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#button-owner_button").removeAttr("disabled");
|
||||
|
@ -553,13 +544,11 @@ function event_comment() {
|
|||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#button-comment_button").removeAttr("disabled");
|
||||
$("#response_loading").show();
|
||||
dt_events.draw(false);
|
||||
show_event_dialog(current_event, "comments", data);
|
||||
$("#response_loading").hide();
|
||||
$("#link_comments").click();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -681,7 +670,6 @@ function update_event(table, id_evento, type, event_rep, row) {
|
|||
// Update events matching current filters and id_evento selected.
|
||||
$.ajax({
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
type: "POST",
|
||||
url: $("#hidden-ajax_file").val(),
|
||||
data: {
|
||||
|
@ -700,7 +688,7 @@ function update_event(table, id_evento, type, event_rep, row) {
|
|||
var diff_s = diff_g / 1000;
|
||||
if (processed >= $(".chk_val:checked").length) {
|
||||
// If operation takes less than 2 seconds, redraw.
|
||||
if (diff_s < 2) {
|
||||
if (diff_s < 2 || $(".chk_val:checked").length > 1) {
|
||||
redraw = true;
|
||||
}
|
||||
if (redraw) {
|
||||
|
@ -722,6 +710,7 @@ function validate_event(table, id_evento, event_rep, row) {
|
|||
var button = document.getElementById("val-" + id_evento);
|
||||
if (!button) {
|
||||
// Button does not exist. Ignore.
|
||||
processed += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -734,6 +723,7 @@ function in_process_event(table, id_evento, event_rep, row) {
|
|||
var button = document.getElementById("proc-" + id_evento);
|
||||
if (!button) {
|
||||
// Button does not exist. Ignore.
|
||||
processed += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -752,6 +742,7 @@ function delete_event(table, id_evento, event_rep, row) {
|
|||
var button = document.getElementById("del-" + id_evento);
|
||||
if (!button) {
|
||||
// Button does not exist. Ignore.
|
||||
processed += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -406,6 +406,8 @@ div.form_message_alert ul li input {
|
|||
}
|
||||
|
||||
div.form_message_alert ul li label {
|
||||
display: inline-block;
|
||||
width: 145px;
|
||||
font-size: 10pt;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.735';
|
||||
$build = '190624';
|
||||
$build = '190626';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
* Event list.
|
||||
*
|
||||
* @category Events
|
||||
* @package Pandora FMS
|
||||
|
@ -45,9 +44,13 @@ require_once $config['homedir'].'/include/functions_ui.php';
|
|||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'ER')
|
||||
&& ! check_acl($config['id_user'], 0, 'EW')
|
||||
&& ! check_acl($config['id_user'], 0, 'EM')
|
||||
$event_a = check_acl($config['id_user'], 0, 'ER');
|
||||
$event_w = check_acl($config['id_user'], 0, 'EW');
|
||||
$event_m = check_acl($config['id_user'], 0, 'EM');
|
||||
|
||||
if (! $event_a
|
||||
&& ! $event_w
|
||||
&& ! $event_m
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
|
@ -62,9 +65,6 @@ if (! check_acl($config['id_user'], 0, 'ER')
|
|||
}
|
||||
|
||||
|
||||
$event_a = check_acl($config['id_user'], 0, 'ER');
|
||||
$event_w = check_acl($config['id_user'], 0, 'EW');
|
||||
$event_m = check_acl($config['id_user'], 0, 'EM');
|
||||
$access = ($event_a == true) ? 'ER' : (($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'ER'));
|
||||
|
||||
|
||||
|
@ -88,32 +88,118 @@ if (is_metaconsole()) {
|
|||
ui_require_javascript_file('pandora_events');
|
||||
|
||||
// Get requests.
|
||||
$id_group = get_parameter('filter[id_group]');
|
||||
$event_type = get_parameter('filter[event_type]');
|
||||
$severity = get_parameter('filter[severity]');
|
||||
$status = get_parameter('filter[status]', EVENT_NO_VALIDATED);
|
||||
$search = get_parameter('filter[search]');
|
||||
$text_agent = get_parameter('filter[text_agent]');
|
||||
$id_agent = get_parameter('filter[id_agent]');
|
||||
$id_agent_module = get_parameter('filter[id_agent_module]');
|
||||
$pagination = get_parameter('filter[pagination]');
|
||||
$event_view_hr = get_parameter('filter[event_view_hr]', $config['event_view_hr']);
|
||||
$id_user_ack = get_parameter('filter[id_user_ack]');
|
||||
$group_rep = get_parameter('filter[group_rep]', 1);
|
||||
$tag_with = get_parameter('filter[tag_with]', []);
|
||||
$tag_without = get_parameter('filter[tag_without]', []);
|
||||
$filter_only_alert = get_parameter('filter[filter_only_alert]');
|
||||
$id_group_filter = get_parameter('filter[id_group_filter]');
|
||||
$date_from = get_parameter('filter[date_from]');
|
||||
$date_to = get_parameter('filter[date_to]');
|
||||
$source = get_parameter('filter[source]');
|
||||
$id_extra = get_parameter('filter[id_extra]');
|
||||
$user_comment = get_parameter('filter[user_comment]');
|
||||
$default_filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
];
|
||||
|
||||
$fb64 = get_parameter('fb64', null);
|
||||
if (isset($fb64)) {
|
||||
$filter = json_decode(base64_decode($fb64), true);
|
||||
} else {
|
||||
$filter = get_parameter(
|
||||
'filter',
|
||||
$default_filter
|
||||
);
|
||||
}
|
||||
|
||||
$id_group = get_parameter(
|
||||
'filter[id_group]',
|
||||
$filter['id_group']
|
||||
);
|
||||
$event_type = get_parameter(
|
||||
'filter[event_type]',
|
||||
$filter['event_type']
|
||||
);
|
||||
$severity = get_parameter(
|
||||
'filter[severity]',
|
||||
$filter['severity']
|
||||
);
|
||||
$status = get_parameter(
|
||||
'filter[status]',
|
||||
$filter['status']
|
||||
);
|
||||
$search = get_parameter(
|
||||
'filter[search]',
|
||||
$filter['search']
|
||||
);
|
||||
$text_agent = get_parameter(
|
||||
'filter[text_agent]',
|
||||
$filter['text_agent']
|
||||
);
|
||||
$id_agent = get_parameter(
|
||||
'filter[id_agent]',
|
||||
$filter['id_agent']
|
||||
);
|
||||
$id_agent_module = get_parameter(
|
||||
'filter[id_agent_module]',
|
||||
$filter['id_agent_module']
|
||||
);
|
||||
$pagination = get_parameter(
|
||||
'filter[pagination]',
|
||||
$filter['pagination']
|
||||
);
|
||||
$event_view_hr = get_parameter(
|
||||
'filter[event_view_hr]',
|
||||
$filter['event_view_hr']
|
||||
);
|
||||
$id_user_ack = get_parameter(
|
||||
'filter[id_user_ack]',
|
||||
$filter['id_user_ack']
|
||||
);
|
||||
$group_rep = get_parameter(
|
||||
'filter[group_rep]',
|
||||
$filter['group_rep']
|
||||
);
|
||||
$tag_with = get_parameter(
|
||||
'filter[tag_with]',
|
||||
$filter['tag_with']
|
||||
);
|
||||
$tag_without = get_parameter(
|
||||
'filter[tag_without]',
|
||||
$filter['tag_without']
|
||||
);
|
||||
$filter_only_alert = get_parameter(
|
||||
'filter[filter_only_alert]',
|
||||
$filter['filter_only_alert']
|
||||
);
|
||||
$id_group_filter = get_parameter(
|
||||
'filter[id_group_filter]',
|
||||
$filter['id_group_filter']
|
||||
);
|
||||
$date_from = get_parameter(
|
||||
'filter[date_from]',
|
||||
$filter['date_from']
|
||||
);
|
||||
$date_to = get_parameter(
|
||||
'filter[date_to]',
|
||||
$filter['date_to']
|
||||
);
|
||||
$source = get_parameter(
|
||||
'filter[source]',
|
||||
$filter['source']
|
||||
);
|
||||
$id_extra = get_parameter(
|
||||
'filter[id_extra]',
|
||||
$filter['id_extra']
|
||||
);
|
||||
$user_comment = get_parameter(
|
||||
'filter[user_comment]',
|
||||
$filter['user_comment']
|
||||
);
|
||||
$history = get_parameter(
|
||||
'history',
|
||||
$filter['history']
|
||||
);
|
||||
$section = get_parameter('section', false);
|
||||
|
||||
// Ajax responses.
|
||||
if (is_ajax()) {
|
||||
$get_events = get_parameter('get_events', 0);
|
||||
$filter = get_parameter('filter', []);
|
||||
// Datatables offset, limit.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
|
@ -123,6 +209,10 @@ if (is_ajax()) {
|
|||
ob_start();
|
||||
$order = get_datatable_order(true);
|
||||
|
||||
if (is_array($order) && $order['field'] == 'mini_severity') {
|
||||
$order['field'] = 'te.criticity';
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'te.id_evento',
|
||||
'te.id_agente',
|
||||
|
@ -151,11 +241,17 @@ if (is_ajax()) {
|
|||
'tg.nombre as group_name',
|
||||
];
|
||||
if (!is_metaconsole()) {
|
||||
$fields[] = 'am.nombre as id_agentmodule';
|
||||
$fields[] = 'am.nombre as module_name';
|
||||
$fields[] = 'am.id_agente_modulo as id_agentmodule';
|
||||
$fields[] = 'ta.server_name as server_name';
|
||||
} else {
|
||||
$fields[] = 'ts.server_name as server_name';
|
||||
}
|
||||
|
||||
$events = events_get_all(
|
||||
// Fields.
|
||||
$fields,
|
||||
// Filter.
|
||||
$filter,
|
||||
// Offset.
|
||||
$start,
|
||||
|
@ -164,7 +260,9 @@ if (is_ajax()) {
|
|||
// Order.
|
||||
$order['direction'],
|
||||
// Sort field.
|
||||
$order['field']
|
||||
$order['field'],
|
||||
// History.
|
||||
$history
|
||||
);
|
||||
$count = events_get_all(
|
||||
'count',
|
||||
|
@ -181,6 +279,11 @@ if (is_ajax()) {
|
|||
function ($carry, $item) {
|
||||
$tmp = (object) $item;
|
||||
$tmp->evento = io_safe_output($tmp->evento);
|
||||
if ($tmp->module_name) {
|
||||
$tmp->module_name = io_safe_output($tmp->module_name);
|
||||
}
|
||||
|
||||
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
||||
$tmp->ack_utimestamp = ui_print_timestamp(
|
||||
$tmp->ack_utimestamp,
|
||||
true
|
||||
|
@ -191,6 +294,9 @@ if (is_ajax()) {
|
|||
);
|
||||
|
||||
$tmp->data = format_numeric($tmp->data, 1);
|
||||
|
||||
$tmp->b64 = base64_encode(json_encode($tmp));
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
|
@ -487,34 +593,34 @@ if ($pure) {
|
|||
|
||||
// Fullscreen.
|
||||
$fullscreen['active'] = false;
|
||||
$fullscreen['text'] = '<a href="'.$url.'&pure=1">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
|
||||
$fullscreen['text'] = '<a class="events_link" href="'.$url.'&pure=1&">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
|
||||
|
||||
// Event list.
|
||||
$list['active'] = false;
|
||||
$list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'">'.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'</a>';
|
||||
$list['text'] = '<a class="events_link" href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'&">'.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'</a>';
|
||||
|
||||
// History event list.
|
||||
$history_list['active'] = false;
|
||||
$history_list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'&section=history&history=1">'.html_print_image('images/books.png', true, ['title' => __('History event list')]).'</a>';
|
||||
$history_list['text'] = '<a class="events_link" href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'&section=history&history=1&">'.html_print_image('images/books.png', true, ['title' => __('History event list')]).'</a>';
|
||||
|
||||
// RSS.
|
||||
$rss['active'] = false;
|
||||
$rss['text'] = '<a href="operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&'.$params.'">'.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).'</a>';
|
||||
$rss['text'] = '<a class="events_link" href="operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&">'.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).'</a>';
|
||||
|
||||
// Marquee.
|
||||
$marquee['active'] = false;
|
||||
$marquee['text'] = '<a href="operation/events/events_marquee.php">'.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).'</a>';
|
||||
$marquee['text'] = '<a class="events_link" href="operation/events/events_marquee.php?">'.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).'</a>';
|
||||
|
||||
// CSV.
|
||||
$csv['active'] = false;
|
||||
$csv['text'] = '<a href="operation/events/export_csv.php?'.$params.'">'.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).'</a>';
|
||||
$csv['text'] = '<a class="events_link" href="operation/events/export_csv.php?'.$filter_b64.'">'.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).'</a>';
|
||||
|
||||
// Sound events.
|
||||
$sound_event['active'] = false;
|
||||
$sound_event['text'] = '<a href="javascript: openSoundEventWindow();">'.html_print_image('images/sound.png', true, ['title' => __('Sound events')]).'</a>';
|
||||
|
||||
// If the user has administrator permission display manage tab.
|
||||
if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) {
|
||||
if ($event_w || $event_m) {
|
||||
// Manage events.
|
||||
$manage_events['active'] = false;
|
||||
$manage_events['text'] = '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=filter&pure='.$config['pure'].'">'.html_print_image('images/setup.png', true, ['title' => __('Manage events')]).'</a>';
|
||||
|
@ -791,12 +897,14 @@ $buttons[] = [
|
|||
'onclick' => '',
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'id' => 'save-filter',
|
||||
'class' => 'float-left margin-right-2 sub wand',
|
||||
'text' => __('Save filter'),
|
||||
'onclick' => '',
|
||||
];
|
||||
if ($event_w || $event_m) {
|
||||
$buttons[] = [
|
||||
'id' => 'save-filter',
|
||||
'class' => 'float-left margin-right-2 sub wand',
|
||||
'text' => __('Save filter'),
|
||||
'onclick' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
* Advanced filter.
|
||||
|
@ -1067,6 +1175,10 @@ try {
|
|||
'text' => 'evento',
|
||||
'class' => 'mw120px',
|
||||
],
|
||||
[
|
||||
'text' => 'mini_severity',
|
||||
'class' => 'no-padding',
|
||||
],
|
||||
'id_evento',
|
||||
// 'id_agente',
|
||||
// 'id_usuario',
|
||||
|
@ -1112,6 +1224,12 @@ try {
|
|||
$fields = $default_fields;
|
||||
}
|
||||
|
||||
if (in_array('mini_severity', $fields) > 0) {
|
||||
$fields[array_search('mini_severity', $fields)] = [
|
||||
'text' => 'mini_severity',
|
||||
'class' => 'no-padding-imp',
|
||||
];
|
||||
}
|
||||
|
||||
$evento_id = array_search('evento', $fields);
|
||||
if ($evento_id !== false) {
|
||||
|
@ -1219,6 +1337,7 @@ try {
|
|||
$active_filters_div .= '</div>';
|
||||
|
||||
$table_id = 'events';
|
||||
$form_id = 'events_form';
|
||||
|
||||
// Print datatable.
|
||||
ui_print_datatable(
|
||||
|
@ -1227,9 +1346,12 @@ try {
|
|||
'class' => 'info_table events',
|
||||
'style' => 'width: 100%;',
|
||||
'ajax_url' => 'operation/events/events',
|
||||
'ajax_data' => ['get_events' => 1],
|
||||
'ajax_data' => [
|
||||
'get_events' => 1,
|
||||
'history' => (int) $history,
|
||||
],
|
||||
'form' => [
|
||||
'id' => 'events_form',
|
||||
'id' => $form_id,
|
||||
'class' => 'flex-row',
|
||||
'html' => $filter,
|
||||
'inputs' => [],
|
||||
|
@ -1280,39 +1402,41 @@ try {
|
|||
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
|
||||
$event_responses = db_get_all_rows_sql($sql_event_resp);
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'EW') == 1 && !$readonly) {
|
||||
$array_events_actions['in_progress_selected'] = __('In progress selected');
|
||||
$array_events_actions['validate_selected'] = __('Validate selected');
|
||||
}
|
||||
if ($config['event_replication'] != 1) {
|
||||
if ($event_w && !$readonly) {
|
||||
$array_events_actions['in_progress_selected'] = __('In progress selected');
|
||||
$array_events_actions['validate_selected'] = __('Validate selected');
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'EM') == 1 && !$readonly) {
|
||||
$array_events_actions['delete_selected'] = __('Delete selected');
|
||||
if ($event_m == 1 && !$readonly) {
|
||||
$array_events_actions['delete_selected'] = __('Delete selected');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($event_responses as $val) {
|
||||
$array_events_actions[$val['id']] = $val['name'];
|
||||
}
|
||||
|
||||
if ($config['event_replication'] != 1) {
|
||||
echo '<div class="multi-response-buttons">';
|
||||
echo '<form method="post" id="form_event_response">';
|
||||
echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />';
|
||||
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
|
||||
echo '  ';
|
||||
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
|
||||
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
|
||||
echo '</form>';
|
||||
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
|
||||
echo __(
|
||||
'A maximum of %s event custom responses can be selected',
|
||||
$config['max_execution_event_response']
|
||||
).'</span>';
|
||||
echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
|
||||
echo __(
|
||||
'Please, select an event'
|
||||
).'</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="multi-response-buttons">';
|
||||
echo '<form method="post" id="form_event_response">';
|
||||
echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />';
|
||||
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
|
||||
echo '  ';
|
||||
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
|
||||
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
|
||||
echo '</form>';
|
||||
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
|
||||
echo __(
|
||||
'A maximum of %s event custom responses can be selected',
|
||||
$config['max_execution_event_response']
|
||||
).'</span>';
|
||||
echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
|
||||
echo __(
|
||||
'Please, select an event'
|
||||
).'</span>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
// Close viewer.
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
@ -1477,16 +1601,17 @@ function process_datatables_item(item) {
|
|||
output += '</div>';
|
||||
|
||||
// Add event severity to end of text.
|
||||
evn = '<div class="event flex-row h100p nowrap">';
|
||||
evn += '<div><a href="javascript:" onclick="show_event_dialog(\'';
|
||||
evn += btoa(JSON.stringify(item))+'\','+$("#group_rep").val()+');">';
|
||||
evn = '<a href="javascript:" onclick="show_event_dialog(\'';
|
||||
evn += item.b64+'\','+$("#group_rep").val()+');">';
|
||||
// Grouped events.
|
||||
if(item.event_rep && item.event_rep > 1) {
|
||||
evn += '('+item.event_rep+') ';
|
||||
}
|
||||
evn += item.evento+'</a></div>';
|
||||
evn += output;
|
||||
evn += '</div>'
|
||||
evn += item.evento+'</a>';
|
||||
|
||||
item.mini_severity = '<div class="event flex-row h100p nowrap">';
|
||||
item.mini_severity += output;
|
||||
item.mini_severity += '</div>';
|
||||
|
||||
criticity = '<div class="criticity" style="background: ';
|
||||
criticity += color + '">' + text + "</div>";
|
||||
|
@ -1517,7 +1642,7 @@ function process_datatables_item(item) {
|
|||
|
||||
case "<?php echo EVENTS_GOING_UP_WARNING; ?>":
|
||||
case "<?php echo EVENTS_GOING_DOWN_WARNING; ?>":
|
||||
$tex = "<?php echo __('WARNING'); ?>";
|
||||
text = "<?php echo __('WARNING'); ?>";
|
||||
color = "<?php echo COL_WARNING; ?>";
|
||||
break;
|
||||
|
||||
|
@ -1580,42 +1705,10 @@ function process_datatables_item(item) {
|
|||
module_status = '<div class="criticity" style="background: ';
|
||||
module_status += color + '">' + text + "</div>";
|
||||
|
||||
|
||||
/* Agent name link */
|
||||
if (item.id_agente > 0) {
|
||||
item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';
|
||||
} else {
|
||||
item.agent_name = '';
|
||||
}
|
||||
|
||||
/* Agent ID link */
|
||||
if (item.id_agente > 0) {
|
||||
<?php
|
||||
if (in_array('agent_name', $fields)) {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.id_agente + '</a>';
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.agent_name + '</a>';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
} else {
|
||||
item.id_agente = '';
|
||||
}
|
||||
|
||||
/* Group name */
|
||||
if (item.id_grupo == "0") {
|
||||
item.id_grupo = "<?php echo __('All'); ?>";
|
||||
} else {
|
||||
item.id_grupo = item.group_name;
|
||||
}
|
||||
|
||||
/* Options */
|
||||
// Show more.
|
||||
item.options = '<a href="javascript:" onclick="show_event_dialog(\'';
|
||||
item.options += btoa(JSON.stringify(item))+'\','+$("#group_rep").val();
|
||||
item.options += item.b64+'\','+$("#group_rep").val();
|
||||
item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
|
||||
<?php
|
||||
|
@ -1658,6 +1751,9 @@ function process_datatables_item(item) {
|
|||
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>';
|
||||
}
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
// Multi select.
|
||||
item.m = '<input name="checkbox-multi[]" type="checkbox" value="';
|
||||
|
@ -1668,27 +1764,49 @@ function process_datatables_item(item) {
|
|||
item.m += ' event_rep="0" ';
|
||||
}
|
||||
item.m += 'class="candeleted chk_val">';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
/* Status */
|
||||
img = '<?php echo html_print_image('images/star.png', true, ['title' => __('Unknown'), 'class' => 'forced-title']); ?>';
|
||||
switch (item.estado) {
|
||||
case "0":
|
||||
case "<?php echo EVENT_STATUS_NEW; ?>":
|
||||
img = '<?php echo html_print_image('images/star.png', true, ['title' => __('New event'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
|
||||
case "1":
|
||||
case "<?php echo EVENT_STATUS_VALIDATED; ?>":
|
||||
img = '<?php echo html_print_image('images/tick.png', true, [ 'title' => __('Event validated'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
|
||||
case "2":
|
||||
case "<?php echo EVENT_STATUS_INPROCESS; ?>":
|
||||
img = '<?php echo html_print_image('images/hourglass.png', true, [ 'title' => __('Event in process'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update column content now to avoid json poisoning. */
|
||||
|
||||
/* Agent name link */
|
||||
if (item.id_agente > 0) {
|
||||
item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';
|
||||
} else {
|
||||
item.agent_name = '';
|
||||
}
|
||||
|
||||
/* Agent ID link */
|
||||
if (item.id_agente > 0) {
|
||||
<?php
|
||||
if (in_array('agent_name', $fields)) {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.id_agente + '</a>';
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.agent_name + '</a>';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
} else {
|
||||
item.id_agente = '';
|
||||
}
|
||||
|
||||
item.estado = '<div>';
|
||||
item.estado += img;
|
||||
item.estado += '</div>';
|
||||
|
@ -1708,6 +1826,15 @@ function process_datatables_item(item) {
|
|||
// Add event severity format to itself.
|
||||
item.evento = evn;
|
||||
|
||||
/* Group name */
|
||||
if (item.id_grupo == "0") {
|
||||
item.id_grupo = "<?php echo __('All'); ?>";
|
||||
} else {
|
||||
item.id_grupo = item.group_name;
|
||||
}
|
||||
|
||||
/* Module name */
|
||||
item.id_agentmodule = item.module_name;
|
||||
}
|
||||
|
||||
/* Datatables auxiliary functions ends */
|
||||
|
@ -1957,6 +2084,23 @@ function reorder_tags_inputs() {
|
|||
}
|
||||
/* Tag management ends */
|
||||
$(document).ready( function() {
|
||||
/* Filter to a href */
|
||||
$('.events_link').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
inputs = $("#<?php echo $form_id; ?> :input");
|
||||
values = {};
|
||||
inputs.each(function() {
|
||||
values[this.name] = $(this).val();
|
||||
})
|
||||
|
||||
values['history'] = "<?php echo (int) $history; ?>";
|
||||
|
||||
var url = e.currentTarget.href;
|
||||
url += 'fb64=' + btoa(JSON.stringify(values));
|
||||
document.location = url;
|
||||
|
||||
});
|
||||
|
||||
/* Multi select handler */
|
||||
$('#checkbox-all_validate_box').on('change', function() {
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Event RSS exporter.
|
||||
*
|
||||
* @category Event RSS export
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
// Don't display other errors, messes up XML.
|
||||
ini_set('display_errors', E_ALL);
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
ini_set('display_errors', 0);
|
||||
// Don't display other errors, messes up XML
|
||||
require_once '../../include/config.php';
|
||||
require_once '../../include/functions.php';
|
||||
require_once '../../include/functions_db.php';
|
||||
|
@ -22,65 +41,115 @@ require_once '../../include/functions_users.php';
|
|||
require_once '../../include/functions_tags.php';
|
||||
require_once '../../include/functions_groups.php';
|
||||
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Uncoment this to activate ACL on RSS Events
|
||||
if (!isInACL($ipOrigin)) {
|
||||
rss_error_handler(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
__('Your IP is not into the IP list with API access.')
|
||||
);
|
||||
|
||||
exit;
|
||||
/**
|
||||
* Generates an xml entry.
|
||||
*
|
||||
* @param string $key Key.
|
||||
* @param string $value Value.
|
||||
*
|
||||
* @return string XML entry.
|
||||
*/
|
||||
function xml_entry($key, $value)
|
||||
{
|
||||
$output = '<'.xml_entities($key).'>';
|
||||
$output .= '<![CDATA['.io_safe_output($value).']]>';
|
||||
$output .= '</'.xml_entities($key).'>';
|
||||
return $output."\n";
|
||||
}
|
||||
|
||||
// Check user credentials
|
||||
$user = get_parameter('user');
|
||||
$hashup = get_parameter('hashup');
|
||||
|
||||
$pss = get_user_info($user);
|
||||
$hashup2 = md5($user.$pss['password']);
|
||||
/**
|
||||
* Escape entities for XML.
|
||||
*
|
||||
* @param string $str String.
|
||||
*
|
||||
* @return string Escaped string.
|
||||
*/
|
||||
function xml_entities($str)
|
||||
{
|
||||
if (!is_string($str)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($hashup != $hashup2) {
|
||||
rss_error_handler(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
__('The URL of your feed has bad hash.')
|
||||
);
|
||||
if (preg_match_all('/(&[^;]+;)/', $str, $matches) != 0) {
|
||||
$matches = $matches[0];
|
||||
|
||||
exit;
|
||||
foreach ($matches as $entity) {
|
||||
$char = html_entity_decode($entity, (ENT_COMPAT | ENT_HTML401), 'UTF-8');
|
||||
|
||||
$html_entity_numeric = '&#'.uniord($char).';';
|
||||
|
||||
$str = str_replace($entity, $html_entity_numeric, $str);
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
header('Content-Type: application/xml; charset=UTF-8');
|
||||
// Send header before starting to output
|
||||
|
||||
/**
|
||||
* Undocumented function.
|
||||
*
|
||||
* @param string $u U.
|
||||
*
|
||||
* @return integer Ord.
|
||||
*/
|
||||
function uniord($u)
|
||||
{
|
||||
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
|
||||
$k1 = ord(substr($k, 0, 1));
|
||||
$k2 = ord(substr($k, 1, 1));
|
||||
|
||||
return ($k2 * 256 + $k1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate RSS header.
|
||||
*
|
||||
* @param integer $lastbuild Date, last build.
|
||||
*
|
||||
* @return string RSS header.
|
||||
*/
|
||||
function rss_header($lastbuild=0)
|
||||
{
|
||||
$selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
|
||||
|
||||
// ' <?php ' -- Fixes highlighters thinking that the closing tag is PHP
|
||||
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'."\n";
|
||||
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
|
||||
$rss_feed .= '<channel>'."\n";
|
||||
$rss_feed .= '<title>'.io_safe_output(get_product_name()).' Events Feed</title>'."\n";
|
||||
$rss_feed .= '<description>Latest events on '.get_product_name().'</description>'."\n";
|
||||
$rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, $lastbuild).'</lastBuildDate>'."\n";
|
||||
// Last build date is the last event - that way readers won't mark it as having new posts.
|
||||
$rss_feed .= '<link>'.$url.'</link>'."\n";
|
||||
// Link back to the main Pandora page.
|
||||
$rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />'."\n";
|
||||
|
||||
return $rss_feed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RSS error handler.
|
||||
*
|
||||
* @param string $errno Errno.
|
||||
* @param string $errstr Errstr.
|
||||
* @param string $errfile Errfile.
|
||||
* @param string $errline Errline.
|
||||
* @param string $error_human_description Error_human_description.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rss_error_handler($errno, $errstr, $errfile, $errline, $error_human_description=null)
|
||||
{
|
||||
$url = ui_get_full_url(false);
|
||||
$selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
|
||||
|
||||
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>';
|
||||
// ' Fixes certain highlighters freaking out on the PHP closing tag
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<channel>';
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<title>'.get_product_name().' RSS Feed</title>';
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<description>Latest events on '.get_product_name().'</description>';
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, 0).'</lastBuildDate>';
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<link>'.$url.'</link>';
|
||||
// Link back to the main Pandora page
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />';
|
||||
// Alternative for Atom feeds. It's the same.
|
||||
// ' Fixes certain highlighters freaking out on the PHP closing tag.
|
||||
$rss_feed = rss_header(0);
|
||||
$rss_feed .= "\n";
|
||||
$rss_feed .= '<item>';
|
||||
$rss_feed .= "\n";
|
||||
|
@ -104,169 +173,206 @@ function rss_error_handler($errno, $errstr, $errfile, $errline, $error_human_des
|
|||
$rss_feed .= "\n";
|
||||
$rss_feed .= '</rss>';
|
||||
|
||||
exit($rss_feed);
|
||||
// Exit by displaying the feed
|
||||
echo $rss_feed;
|
||||
}
|
||||
|
||||
|
||||
// Errors output as RSS.
|
||||
set_error_handler('rss_error_handler', E_ERROR);
|
||||
// Errors output as RSS
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
// group
|
||||
$event_type = get_parameter('event_type', '');
|
||||
// 0 all
|
||||
$severity = (int) get_parameter('severity', -1);
|
||||
// -1 all
|
||||
$status = (int) get_parameter('status', 0);
|
||||
// -1 all, 0 only red, 1 only green
|
||||
$id_agent = (int) get_parameter('id_agent', -1);
|
||||
|
||||
$id_event = (int) get_parameter('id_event', -1);
|
||||
// This will allow to select only 1 event (eg. RSS)
|
||||
$event_view_hr = (int) get_parameter('event_view_hr', 0);
|
||||
$id_user_ack = get_parameter('id_user_ack', 0);
|
||||
$search = io_safe_output(preg_replace('/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', rawurldecode(get_parameter('search'))));
|
||||
$text_agent = (string) get_parameter('text_agent', __('All'));
|
||||
// Send header before starting to output.
|
||||
header('Content-Type: application/xml; charset=UTF-8');
|
||||
|
||||
$tag_with_json = base64_decode(get_parameter('tag_with', ''));
|
||||
$tag_with_json_clean = io_safe_output($tag_with_json);
|
||||
$tag_with_base64 = base64_encode($tag_with_json_clean);
|
||||
$tag_with = json_decode($tag_with_json_clean, true);
|
||||
if (empty($tag_with)) {
|
||||
$tag_with = [];
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Uncoment this to activate ACL on RSS Events.
|
||||
if (!isInACL($ipOrigin)) {
|
||||
rss_error_handler(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
__('Your IP is not into the IP list with API access.')
|
||||
);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$tag_with = array_diff($tag_with, [0 => 0]);
|
||||
// Check user credentials.
|
||||
$user = get_parameter('user');
|
||||
$hashup = get_parameter('hashup');
|
||||
|
||||
$tag_without_json = base64_decode(get_parameter('tag_without', ''));
|
||||
$tag_without_json_clean = io_safe_output($tag_without_json);
|
||||
$tag_without_base64 = base64_encode($tag_without_json_clean);
|
||||
$tag_without = json_decode($tag_without_json_clean, true);
|
||||
if (empty($tag_without)) {
|
||||
$tag_without = [];
|
||||
$pss = get_user_info($user);
|
||||
$hashup2 = md5($user.$pss['password']);
|
||||
|
||||
if ($hashup != $hashup2) {
|
||||
rss_error_handler(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
__('The URL of your feed has bad hash.')
|
||||
);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$tag_without = array_diff($tag_without, [0 => 0]);
|
||||
|
||||
$filter_only_alert = (int) get_parameter('filter_only_alert', -1);
|
||||
|
||||
//
|
||||
// Build the condition of the events query
|
||||
$sql_post = '';
|
||||
$meta = false;
|
||||
|
||||
$id_user = $user;
|
||||
|
||||
require 'events.build_query.php';
|
||||
|
||||
// Now $sql_post have all the where condition
|
||||
//
|
||||
$sql = 'SELECT *
|
||||
FROM tevento te LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC';
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
|
||||
$url = ui_get_full_url(false);
|
||||
$selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
|
||||
|
||||
if (empty($result)) {
|
||||
$lastbuild = 0;
|
||||
// Last build in 1970
|
||||
} else {
|
||||
$lastbuild = (int) $result[0]['utimestamp'];
|
||||
$reset_session = false;
|
||||
if (empty($config['id_user'])) {
|
||||
$config['id_user'] = $user;
|
||||
$reset_session = true;
|
||||
}
|
||||
|
||||
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'."\n";
|
||||
// ' <?php ' -- Fixes highlighters thinking that the closing tag is PHP
|
||||
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
|
||||
$rss_feed .= '<channel>'."\n";
|
||||
$rss_feed .= '<title>'.get_product_name().' RSS Feed</title>'."\n";
|
||||
$rss_feed .= '<description>Latest events on '.get_product_name().'</description>'."\n";
|
||||
$rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, $lastbuild).'</lastBuildDate>'."\n";
|
||||
// Last build date is the last event - that way readers won't mark it as having new posts
|
||||
$rss_feed .= '<link>'.$url.'</link>'."\n";
|
||||
// Link back to the main Pandora page
|
||||
$rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />'."\n";
|
||||
;
|
||||
// Alternative for Atom feeds. It's the same.
|
||||
if (empty($result)) {
|
||||
$result = [];
|
||||
$rss_feed .= '<item><guid>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</guid><title>No results</title>';
|
||||
$rss_feed .= '<description>There are no results. Click on the link to see all Pending events</description>';
|
||||
$rss_feed .= '<link>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</link></item>'."\n";
|
||||
}
|
||||
$column_names = [
|
||||
'id_evento',
|
||||
'evento',
|
||||
'timestamp',
|
||||
'estado',
|
||||
'event_type',
|
||||
'utimestamp',
|
||||
'id_agente',
|
||||
'agent_name',
|
||||
'id_usuario',
|
||||
'id_grupo',
|
||||
'id_agentmodule',
|
||||
'id_alert_am',
|
||||
'criticity',
|
||||
'user_comment',
|
||||
'tags',
|
||||
'source',
|
||||
'id_extra',
|
||||
'critical_instructions',
|
||||
'warning_instructions',
|
||||
'unknown_instructions',
|
||||
'owner_user',
|
||||
'ack_utimestamp',
|
||||
'custom_data',
|
||||
'data',
|
||||
'module_status',
|
||||
];
|
||||
|
||||
foreach ($result as $row) {
|
||||
if (!check_acl($user, $row['id_grupo'], 'ER')) {
|
||||
continue;
|
||||
$fields = [
|
||||
'te.id_evento',
|
||||
'te.evento',
|
||||
'te.timestamp',
|
||||
'te.estado',
|
||||
'te.event_type',
|
||||
'te.utimestamp',
|
||||
'te.id_agente',
|
||||
'ta.alias as agent_name',
|
||||
'te.id_usuario',
|
||||
'te.id_grupo',
|
||||
'te.id_agentmodule',
|
||||
'am.nombre as module_name',
|
||||
'te.id_alert_am',
|
||||
'te.criticity',
|
||||
'te.user_comment',
|
||||
'te.tags',
|
||||
'te.source',
|
||||
'te.id_extra',
|
||||
'te.critical_instructions',
|
||||
'te.warning_instructions',
|
||||
'te.unknown_instructions',
|
||||
'te.owner_user',
|
||||
'te.ack_utimestamp',
|
||||
'te.custom_data',
|
||||
'te.data',
|
||||
'te.module_status',
|
||||
'tg.nombre as group_name',
|
||||
];
|
||||
|
||||
|
||||
try {
|
||||
$fb64 = get_parameter('fb64', null);
|
||||
$plain_filter = base64_decode($fb64);
|
||||
$filter = json_decode($plain_filter, true);
|
||||
if (json_last_error() != JSON_ERROR_NONE) {
|
||||
throw new Exception('Invalid filter. ['.$plain_filter.']');
|
||||
}
|
||||
|
||||
if ($row['event_type'] == 'system') {
|
||||
$agent_name = __('System');
|
||||
} else if ($row['id_agente'] > 0) {
|
||||
// Agent name
|
||||
$agent_name = agents_get_alias($row['id_agente']);
|
||||
} else {
|
||||
$agent_name = __('Alert').__('SNMP');
|
||||
// Dump events.
|
||||
$limit = get_parameter('limit', 20);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$events = events_get_all(
|
||||
$fields,
|
||||
$filter,
|
||||
$offset,
|
||||
$limit,
|
||||
'desc',
|
||||
'timestamp',
|
||||
$filter['history']
|
||||
);
|
||||
|
||||
$last_timestamp = 0;
|
||||
if (is_array($events)) {
|
||||
$last_timestamp = $events[0]['utimestamp'];
|
||||
}
|
||||
|
||||
// This is mandatory
|
||||
$rss_feed .= '<item><guid>';
|
||||
$rss_feed .= xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events&id_event='.$row['id_evento']));
|
||||
$rss_feed .= '</guid><title>';
|
||||
$rss_feed .= xml_entities($agent_name);
|
||||
$rss_feed .= '</title><description>';
|
||||
$rss_feed .= xml_entities($row['evento']);
|
||||
if ($row['estado'] == 1) {
|
||||
$rss_feed .= xml_entities(io_safe_input('<br /><br />'.'Validated by '.$row['id_usuario']));
|
||||
}
|
||||
// Dump headers.
|
||||
$rss = rss_header($last_timestamp);
|
||||
$url = ui_get_full_url(false);
|
||||
|
||||
$rss_feed .= '</description><link>';
|
||||
$rss_feed .= xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events&id_event='.$row['id_evento']));
|
||||
$rss_feed .= '</link>';
|
||||
if (is_array($events)) {
|
||||
foreach ($events as $row) {
|
||||
$rss .= '<item>';
|
||||
$rss .= xml_entry('title', $row['evento']);
|
||||
if (!empty($row['id_agente'])) {
|
||||
$rss .= xml_entry('link', $url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$row['id_agente']);
|
||||
}
|
||||
|
||||
// The rest is optional
|
||||
$rss_feed .= '<pubDate>'.date(DATE_RFC822, $row['utimestamp']).'</pubDate>';
|
||||
$rss .= xml_entry('comments', $row['']);
|
||||
$rss .= xml_entry('pubDate', $row['timestamp']);
|
||||
$rss .= xml_entry('category', $row['source']);
|
||||
foreach ($column_names as $val) {
|
||||
$key = $val;
|
||||
if ($val == 'id_grupo') {
|
||||
$key = 'group_name';
|
||||
} else if ($val == 'id_agentmodule') {
|
||||
$key = 'module_name';
|
||||
}
|
||||
|
||||
// This is mandatory again
|
||||
$rss_feed .= '</item>'."\n";
|
||||
}
|
||||
switch ($key) {
|
||||
case 'module_status':
|
||||
$value = events_translate_module_status(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
$rss_feed .= "</channel>\n</rss>\n";
|
||||
case 'event_type':
|
||||
$value = events_translate_event_type(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
echo $rss_feed;
|
||||
case 'criticity':
|
||||
$value = events_translate_event_criticity(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = $row[$key];
|
||||
break;
|
||||
}
|
||||
|
||||
function xml_entities($str)
|
||||
{
|
||||
if (!is_string($str)) {
|
||||
return '';
|
||||
}
|
||||
$rss .= xml_entry($key, $value);
|
||||
}
|
||||
|
||||
if (preg_match_all('/(&[^;]+;)/', $str, $matches) != 0) {
|
||||
$matches = $matches[0];
|
||||
|
||||
foreach ($matches as $entity) {
|
||||
$char = html_entity_decode($entity, (ENT_COMPAT | ENT_HTML401), 'UTF-8');
|
||||
|
||||
$html_entity_numeric = '&#'.uniord($char).';';
|
||||
|
||||
$str = str_replace($entity, $html_entity_numeric, $str);
|
||||
$rss .= '</item>';
|
||||
}
|
||||
} else {
|
||||
$rss .= '<item><guid>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</guid><title>No results</title>';
|
||||
$rss .= '<description>There are no results. Click on the link to see all Pending events</description>';
|
||||
$rss .= '<link>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</link></item>'."\n";
|
||||
}
|
||||
|
||||
return $str;
|
||||
$rss .= "</channel>\n</rss>\n";
|
||||
|
||||
echo $rss;
|
||||
} catch (Exception $e) {
|
||||
echo rss_error_handler(200, 'Controlled error', '', '', $e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
function uniord($u)
|
||||
{
|
||||
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
|
||||
$k1 = ord(substr($k, 0, 1));
|
||||
$k2 = ord(substr($k, 1, 1));
|
||||
|
||||
return ($k2 * 256 + $k1);
|
||||
if ($reset_session) {
|
||||
unset($config['id_user']);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Event CSV exporter.
|
||||
*
|
||||
* @category Event CSV export
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once '../../include/config.php';
|
||||
require_once '../../include/auth/mysql.php';
|
||||
require_once '../../include/functions.php';
|
||||
|
@ -23,134 +39,165 @@ require_once '../../include/functions_groups.php';
|
|||
|
||||
$config['id_user'] = $_SESSION['id_usuario'];
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], 0, 'EW') && ! check_acl($config['id_user'], 0, 'EM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'ER')
|
||||
&& ! check_acl($config['id_user'], 0, 'EW')
|
||||
&& ! check_acl($config['id_user'], 0, 'EM')
|
||||
) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $config;
|
||||
|
||||
// loading l10n tables, because of being invoked not through index.php.
|
||||
// Loading l10n tables, because of being invoked not through index.php.
|
||||
$l10n = null;
|
||||
if (file_exists($config['homedir'].'/include/languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader(new CachedFileReader($config['homedir'].'/include/languages/'.$user_language.'.mo'));
|
||||
$cfr = new CachedFileReader(
|
||||
$config['homedir'].'/include/languages/'.$user_language.'.mo'
|
||||
);
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
// group
|
||||
$event_type = (string) get_parameter('event_type', 'all');
|
||||
// 0 all
|
||||
$severity = (int) get_parameter('severity', -1);
|
||||
// -1 all
|
||||
$status = (int) get_parameter('status', -1);
|
||||
// -1 all, 0 only red, 1 only green
|
||||
$id_agent = (int) get_parameter('id_agent', -1);
|
||||
$column_names = [
|
||||
'id_evento',
|
||||
'evento',
|
||||
'timestamp',
|
||||
'estado',
|
||||
'event_type',
|
||||
'utimestamp',
|
||||
'id_agente',
|
||||
'agent_name',
|
||||
'id_usuario',
|
||||
'id_grupo',
|
||||
'id_agentmodule',
|
||||
'id_alert_am',
|
||||
'criticity',
|
||||
'user_comment',
|
||||
'tags',
|
||||
'source',
|
||||
'id_extra',
|
||||
'critical_instructions',
|
||||
'warning_instructions',
|
||||
'unknown_instructions',
|
||||
'owner_user',
|
||||
'ack_utimestamp',
|
||||
'custom_data',
|
||||
'data',
|
||||
'module_status',
|
||||
];
|
||||
|
||||
$id_event = (int) get_parameter('id_event', -1);
|
||||
$event_view_hr = (int) get_parameter('event_view_hr', $config['event_view_hr']);
|
||||
$id_user_ack = get_parameter('id_user_ack', 0);
|
||||
$search = io_safe_output(preg_replace('/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', rawurldecode(get_parameter('search'))));
|
||||
$text_agent = (string) get_parameter('text_agent', __('All'));
|
||||
|
||||
$tag_with_json = base64_decode(get_parameter('tag_with', ''));
|
||||
$tag_with_json_clean = io_safe_output($tag_with_json);
|
||||
$tag_with_base64 = base64_encode($tag_with_json_clean);
|
||||
$tag_with = json_decode($tag_with_json_clean, true);
|
||||
if (empty($tag_with)) {
|
||||
$tag_with = [];
|
||||
}
|
||||
|
||||
$tag_with = array_diff($tag_with, [0 => 0]);
|
||||
|
||||
$tag_without_json = base64_decode(get_parameter('tag_without', ''));
|
||||
$tag_without_json_clean = io_safe_output($tag_without_json);
|
||||
$tag_without_base64 = base64_encode($tag_without_json_clean);
|
||||
$tag_without = json_decode($tag_without_json_clean, true);
|
||||
if (empty($tag_without)) {
|
||||
$tag_without = [];
|
||||
}
|
||||
|
||||
$tag_without = array_diff($tag_without, [0 => 0]);
|
||||
|
||||
$filter_only_alert = (int) get_parameter('filter_only_alert', -1);
|
||||
|
||||
//
|
||||
// Build the condition of the events query
|
||||
$sql_post = '';
|
||||
$meta = false;
|
||||
|
||||
$id_user = $config['id_user'];
|
||||
|
||||
require 'events.build_query.php';
|
||||
|
||||
// Now $sql_post have all the where condition
|
||||
//
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$sql = 'SELECT *
|
||||
FROM tevento te
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON te.id_grupo = tasg.id_group
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC';
|
||||
break;
|
||||
}
|
||||
$fields = [
|
||||
'te.id_evento',
|
||||
'te.evento',
|
||||
'te.timestamp',
|
||||
'te.estado',
|
||||
'te.event_type',
|
||||
'te.utimestamp',
|
||||
'te.id_agente',
|
||||
'ta.alias as agent_name',
|
||||
'te.id_usuario',
|
||||
'te.id_grupo',
|
||||
'te.id_agentmodule',
|
||||
'am.nombre as module_name',
|
||||
'te.id_alert_am',
|
||||
'te.criticity',
|
||||
'te.user_comment',
|
||||
'te.tags',
|
||||
'te.source',
|
||||
'te.id_extra',
|
||||
'te.critical_instructions',
|
||||
'te.warning_instructions',
|
||||
'te.unknown_instructions',
|
||||
'te.owner_user',
|
||||
'te.ack_utimestamp',
|
||||
'te.custom_data',
|
||||
'te.data',
|
||||
'te.module_status',
|
||||
'tg.nombre as group_name',
|
||||
];
|
||||
|
||||
$now = date('Y-m-d');
|
||||
|
||||
// Show contentype header
|
||||
// Download header.
|
||||
header('Content-type: text/txt');
|
||||
header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
|
||||
|
||||
echo 'timestamp';
|
||||
echo $config['csv_divider'];
|
||||
echo 'agent';
|
||||
echo $config['csv_divider'];
|
||||
echo 'group';
|
||||
echo $config['csv_divider'];
|
||||
echo 'event';
|
||||
echo $config['csv_divider'];
|
||||
echo 'status';
|
||||
echo $config['csv_divider'];
|
||||
echo 'user';
|
||||
echo $config['csv_divider'];
|
||||
echo 'event_type';
|
||||
echo $config['csv_divider'];
|
||||
echo 'severity';
|
||||
echo $config['csv_divider'];
|
||||
echo 'id';
|
||||
echo chr(13);
|
||||
|
||||
$new = true;
|
||||
while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
|
||||
$new = false;
|
||||
$alias = db_get_value('alias', 'tagente', 'id_agente', $event['id_agente']);
|
||||
if ((!check_acl($config['id_user'], $event['id_grupo'], 'ER')
|
||||
&& !check_acl($config['id_user'], $event['id_grupo'], 'EW') && !check_acl($config['id_user'], $event['id_grupo'], 'EM') )
|
||||
|| (!check_acl($config['id_user'], 0, 'PM') && $event['event_type'] == 'system')
|
||||
) {
|
||||
continue;
|
||||
try {
|
||||
$fb64 = get_parameter('fb64', null);
|
||||
$plain_filter = base64_decode($fb64);
|
||||
$filter = json_decode($plain_filter, true);
|
||||
if (json_last_error() != JSON_ERROR_NONE) {
|
||||
throw new Exception('Invalid filter. ['.$plain_filter.']');
|
||||
}
|
||||
|
||||
$names = events_get_column_names($column_names);
|
||||
|
||||
// Dump headers.
|
||||
foreach ($names as $n) {
|
||||
echo io_safe_output($n).$config['csv_divider'];
|
||||
}
|
||||
|
||||
echo date($config['date_format'], $event['utimestamp']);
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output($alias);
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output(groups_get_name($event['id_grupo']));
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output($event['evento']);
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output($event['estado']);
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output($event['id_usuario']);
|
||||
echo $config['csv_divider'];
|
||||
echo io_safe_output($event['event_type']);
|
||||
echo $config['csv_divider'];
|
||||
echo $event['criticity'];
|
||||
echo $config['csv_divider'];
|
||||
echo $event['id_evento'];
|
||||
echo chr(13);
|
||||
|
||||
// Dump events.
|
||||
$events_per_step = 1000;
|
||||
$step = 0;
|
||||
while (1) {
|
||||
$events = events_get_all(
|
||||
$fields,
|
||||
$filter,
|
||||
(($step++) * $events_per_step),
|
||||
$events_per_step,
|
||||
'desc',
|
||||
'timestamp',
|
||||
$filter['history']
|
||||
);
|
||||
|
||||
if ($events === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($events as $row) {
|
||||
foreach ($column_names as $val) {
|
||||
$key = $val;
|
||||
if ($val == 'id_grupo') {
|
||||
$key = 'group_name';
|
||||
} else if ($val == 'id_agentmodule') {
|
||||
$key = 'module_name';
|
||||
}
|
||||
|
||||
switch ($key) {
|
||||
case 'module_status':
|
||||
echo events_translate_module_status(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
case 'event_type':
|
||||
echo events_translate_event_type(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
case 'criticity':
|
||||
echo events_translate_event_criticity(
|
||||
$row[$key]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
echo io_safe_output($row[$key]);
|
||||
break;
|
||||
}
|
||||
|
||||
echo $config['csv_divider'];
|
||||
}
|
||||
|
||||
echo chr(13);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo 'ERROR'.chr(13);
|
||||
echo $e->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
|
|
|
@ -373,10 +373,36 @@ if (check_acl($config['id_user'], 0, 'ER')
|
|||
$pss = get_user_info($config['id_user']);
|
||||
$hashup = md5($config['id_user'].$pss['password']);
|
||||
|
||||
$user_filter = db_get_row_sql(
|
||||
sprintf(
|
||||
'SELECT f.id_filter, f.id_name
|
||||
FROM tevent_filter f
|
||||
INNER JOIN tusuario u
|
||||
ON u.default_event_filter=f.id_filter
|
||||
WHERE u.id_user = "%s" ',
|
||||
$config['id_user']
|
||||
)
|
||||
);
|
||||
if ($user_filter !== false) {
|
||||
$filter = events_get_event_filter($user_filter['id_filter']);
|
||||
} else {
|
||||
// Default.
|
||||
$filter = [
|
||||
'status' => EVENT_NO_VALIDATED,
|
||||
'event_view_hr' => $config['event_view_hr'],
|
||||
'group_rep' => 1,
|
||||
'tag_with' => [],
|
||||
'tag_without' => [],
|
||||
'history' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$fb64 = base64_encode(json_encode($filter));
|
||||
|
||||
// RSS.
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['text'] = __('RSS');
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['id'] = 'RSS';
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0§ion=list&open_filter=0&pure=']['type'] = 'direct';
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['text'] = __('RSS');
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['id'] = 'RSS';
|
||||
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct';
|
||||
|
||||
// Marquee.
|
||||
$sub['operation/events/events_marquee.php']['text'] = __('Marquee');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.735-190624
|
||||
Version: 7.0NG.735-190626
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.735-190624"
|
||||
pandora_version="7.0NG.735-190626"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.735";
|
||||
my $pandora_build = "190624";
|
||||
my $pandora_build = "190626";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -137,12 +137,21 @@ sub data_producer ($) {
|
|||
# Manual tasks are "forced" like the other, setting the utimestamp to 1
|
||||
# By default, after create a tasks it takes the utimestamp to 0
|
||||
# Status -1 means "done".
|
||||
|
||||
my @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
|
||||
WHERE id_recon_server = ?
|
||||
AND disabled = 0
|
||||
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
|
||||
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
|
||||
my @rows;
|
||||
if (pandora_is_master($pa_config) == 0) {
|
||||
@rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
|
||||
WHERE id_recon_server = ?
|
||||
AND disabled = 0
|
||||
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
|
||||
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
|
||||
} else {
|
||||
@rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task
|
||||
WHERE (id_recon_server = ? OR id_recon_server = ANY(SELECT id_server FROM tserver WHERE status = 0 AND server_type = ?))
|
||||
AND disabled = 0
|
||||
AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
|
||||
OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id, DISCOVERYSERVER);
|
||||
}
|
||||
|
||||
foreach my $row (@rows) {
|
||||
|
||||
# Update task status
|
||||
|
|
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.735";
|
||||
my $pandora_build = "190624";
|
||||
my $pandora_build = "190626";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.735
|
||||
%define release 190624
|
||||
%define release 190626
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.735"
|
||||
PI_BUILD="190624"
|
||||
PI_BUILD="190626"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.735 PS190624";
|
||||
my $version = "7.0NG.735 PS190626";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.735 PS190624";
|
||||
my $version = "7.0NG.735 PS190626";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue