Merge branch 'ent-3381-eventos-extendidos' into 'ent-3430-discovery'
Ent 3381 eventos extendidos See merge request artica/pandorafms!2169 Former-commit-id: b8a4fd52a30b8cc34c2417499ce3b4a60c027edf
This commit is contained in:
commit
6e7369d672
|
@ -1856,6 +1856,19 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||||
|
|
||||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tevent_extended`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||||
|
`id` serial PRIMARY KEY,
|
||||||
|
`id_evento` bigint(20) unsigned NOT NULL,
|
||||||
|
`external_id` bigint(20) unsigned,
|
||||||
|
`utimestamp` bigint(20) NOT NULL default '0',
|
||||||
|
`description` text,
|
||||||
|
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tgis_map_layer_groups`
|
-- Table `tgis_map_layer_groups`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
|
|
@ -1,16 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Manage AJAX response for event pages.
|
||||||
|
*
|
||||||
|
* @category Ajax
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Events
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 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.
|
|
||||||
require_once 'include/functions_events.php';
|
require_once 'include/functions_events.php';
|
||||||
require_once 'include/functions_agents.php';
|
require_once 'include/functions_agents.php';
|
||||||
require_once 'include/functions_ui.php';
|
require_once 'include/functions_ui.php';
|
||||||
|
@ -210,11 +225,14 @@ if ($dialogue_event_response) {
|
||||||
$prompt = '<br>> ';
|
$prompt = '<br>> ';
|
||||||
switch ($event_response['type']) {
|
switch ($event_response['type']) {
|
||||||
case 'command':
|
case 'command':
|
||||||
|
|
||||||
|
|
||||||
if ($massive) {
|
if ($massive) {
|
||||||
echo "<div style='text-align:left'>";
|
echo "<div style='text-align:left'>";
|
||||||
echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s', $command));
|
echo $prompt.sprintf(
|
||||||
|
'(Event #'.$event_id.') '.__(
|
||||||
|
'Executing command: %s',
|
||||||
|
$command
|
||||||
|
)
|
||||||
|
);
|
||||||
echo '</div><br>';
|
echo '</div><br>';
|
||||||
|
|
||||||
echo "<div id='response_loading_command_".$out_iterator."' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
|
echo "<div id='response_loading_command_".$out_iterator."' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||||
|
@ -242,7 +260,11 @@ if ($dialogue_event_response) {
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
$command = str_replace('localhost', $_SERVER['SERVER_NAME'], $command);
|
$command = str_replace('localhost', $_SERVER['SERVER_NAME'], $command);
|
||||||
echo "<iframe src='$command' id='divframe' style='width:100%;height:90%;'></iframe>";
|
echo "<iframe src='".$command."' id='divframe' style='width:100%;height:90%;'></iframe>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignore.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,10 +341,10 @@ if ($get_extended_event) {
|
||||||
$readonly = true;
|
$readonly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean url from events and store in array
|
// Clean url from events and store in array.
|
||||||
$event['clean_tags'] = events_clean_tags($event['tags']);
|
$event['clean_tags'] = events_clean_tags($event['tags']);
|
||||||
|
|
||||||
// If the event is not found, we abort
|
// If the event is not found, we abort.
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
ui_print_error_message('Event not found');
|
ui_print_error_message('Event not found');
|
||||||
return false;
|
return false;
|
||||||
|
@ -341,42 +363,62 @@ if ($get_extended_event) {
|
||||||
$event['timestamp_last'] = $timestamp_last;
|
$event['timestamp_last'] = $timestamp_last;
|
||||||
$event['event_rep'] = $event_rep;
|
$event['event_rep'] = $event_rep;
|
||||||
|
|
||||||
// Check ACLs
|
// Check ACLs.
|
||||||
if (is_user_admin($config['id_user'])) {
|
if (is_user_admin($config['id_user'])) {
|
||||||
// Do nothing if you're admin, you get full access
|
// Do nothing if you're admin, you get full access.
|
||||||
|
$__ignored_line = 0;
|
||||||
} else if ($config['id_user'] == $event['owner_user']) {
|
} else if ($config['id_user'] == $event['owner_user']) {
|
||||||
// Do nothing if you're the owner user, you get access
|
// Do nothing if you're the owner user, you get access.
|
||||||
|
$__ignored_line = 0;
|
||||||
} else if ($event['id_grupo'] == 0) {
|
} else if ($event['id_grupo'] == 0) {
|
||||||
// If the event has access to all groups, you get access
|
// If the event has access to all groups, you get access.
|
||||||
|
$__ignored_line = 0;
|
||||||
} else {
|
} else {
|
||||||
// Get your groups
|
// Get your groups.
|
||||||
$groups = users_get_groups($config['id_user'], 'ER');
|
$groups = users_get_groups($config['id_user'], 'ER');
|
||||||
|
|
||||||
if (in_array($event['id_grupo'], array_keys($groups))) {
|
if (in_array($event['id_grupo'], array_keys($groups))) {
|
||||||
// If the event group is among the groups of the user, you get access
|
// If event group is among the groups of the user, you get access.
|
||||||
|
$__ignored_line = 0;
|
||||||
} else {
|
} else {
|
||||||
// If all the access types fail, abort
|
// If all the access types fail, abort.
|
||||||
echo 'Access denied';
|
echo 'Access denied';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print group_rep in a hidden field to recover it from javascript
|
// Print group_rep in a hidden field to recover it from javascript.
|
||||||
html_print_input_hidden('group_rep', (int) $group_rep);
|
html_print_input_hidden('group_rep', (int) $group_rep);
|
||||||
|
|
||||||
if ($event === false) {
|
if ($event === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tabs
|
// Tabs.
|
||||||
$tabs = "<ul style='background:#ffffff !important; border-top: 0px; border-left: 0px; border-right: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color: #D3D3D3;'>";
|
$tabs = "<ul style='background:#ffffff !important; border-top: 0px; border-left: 0px; border-right: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color: #D3D3D3;'>";
|
||||||
$tabs .= "<li><a href='#extended_event_general_page' id='link_general'>".html_print_image('images/lightning_go.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('General').'</span></a></li>';
|
$tabs .= "<li><a href='#extended_event_general_page' id='link_general'>".html_print_image('images/lightning_go.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('General').'</span></a></li>';
|
||||||
|
if (events_has_extended_info($event['id_evento']) === true) {
|
||||||
|
$tabs .= "<li><a href='#extended_event_related_page' id='link_related'>".html_print_image('images/zoom.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Related').'</span></a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
$tabs .= "<li><a href='#extended_event_details_page' id='link_details'>".html_print_image('images/zoom.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Details').'</span></a></li>';
|
$tabs .= "<li><a href='#extended_event_details_page' id='link_details'>".html_print_image('images/zoom.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Details').'</span></a></li>';
|
||||||
$tabs .= "<li><a href='#extended_event_custom_fields_page' id='link_custom_fields'>".html_print_image('images/custom_field_col.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Agent fields').'</span></a></li>';
|
$tabs .= "<li><a href='#extended_event_custom_fields_page' id='link_custom_fields'>".html_print_image('images/custom_field_col.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Agent fields').'</span></a></li>';
|
||||||
$tabs .= "<li><a href='#extended_event_comments_page' id='link_comments'>".html_print_image('images/pencil.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Comments').'</span></a></li>';
|
$tabs .= "<li><a href='#extended_event_comments_page' id='link_comments'>".html_print_image('images/pencil.png', true)."<span style='position:relative;top:-6px;left:5px;margin-right:10px;'>".__('Comments').'</span></a></li>';
|
||||||
|
|
||||||
if (!$readonly
|
if (!$readonly
|
||||||
&& ((tags_checks_event_acl($config['id_user'], $event['id_grupo'], 'EM', $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config['id_user'], $event['id_grupo'], 'EW', $event['clean_tags'], $childrens_ids)))
|
&& ((tags_checks_event_acl(
|
||||||
|
$config['id_user'],
|
||||||
|
$event['id_grupo'],
|
||||||
|
'EM',
|
||||||
|
$event['clean_tags'],
|
||||||
|
$childrens_ids
|
||||||
|
)) || (tags_checks_event_acl(
|
||||||
|
$config['id_user'],
|
||||||
|
$event['id_grupo'],
|
||||||
|
'EW',
|
||||||
|
$event['clean_tags'],
|
||||||
|
$childrens_ids
|
||||||
|
)))
|
||||||
) {
|
) {
|
||||||
$tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image('images/event_responses_col.png', true)."<span style='position:relative;top:-6px;left:3px;margin-right:10px;'>".__('Responses').'</span></a></li>';
|
$tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image('images/event_responses_col.png', true)."<span style='position:relative;top:-6px;left:3px;margin-right:10px;'>".__('Responses').'</span></a></li>';
|
||||||
}
|
}
|
||||||
|
@ -387,7 +429,7 @@ if ($get_extended_event) {
|
||||||
|
|
||||||
$tabs .= '</ul>';
|
$tabs .= '</ul>';
|
||||||
|
|
||||||
// Get criticity image
|
// Get criticity image.
|
||||||
switch ($event['criticity']) {
|
switch ($event['criticity']) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -419,7 +461,19 @@ if ($get_extended_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$readonly
|
if (!$readonly
|
||||||
&& ((tags_checks_event_acl($config['id_user'], $event['id_grupo'], 'EM', $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config['id_user'], $event['id_grupo'], 'EW', $event['clean_tags'], $childrens_ids)))
|
&& ((tags_checks_event_acl(
|
||||||
|
$config['id_user'],
|
||||||
|
$event['id_grupo'],
|
||||||
|
'EM',
|
||||||
|
$event['clean_tags'],
|
||||||
|
$childrens_ids
|
||||||
|
)) || (tags_checks_event_acl(
|
||||||
|
$config['id_user'],
|
||||||
|
$event['id_grupo'],
|
||||||
|
'EW',
|
||||||
|
$event['clean_tags'],
|
||||||
|
$childrens_ids
|
||||||
|
)))
|
||||||
) {
|
) {
|
||||||
$responses = events_page_responses($event, $childrens_ids);
|
$responses = events_page_responses($event, $childrens_ids);
|
||||||
} else {
|
} else {
|
||||||
|
@ -427,7 +481,7 @@ if ($get_extended_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$console_url = '';
|
$console_url = '';
|
||||||
// If metaconsole switch to node to get details and custom fields
|
// If metaconsole switch to node to get details and custom fields.
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$server = metaconsole_get_connection_by_id($server_id);
|
$server = metaconsole_get_connection_by_id($server_id);
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
|
@ -437,7 +491,12 @@ if ($get_extended_event) {
|
||||||
|
|
||||||
$details = events_page_details($event, $server);
|
$details = events_page_details($event, $server);
|
||||||
|
|
||||||
// Juanma (09/05/2014) Fix: Needs to reconnect to node, in previous funct node connection was lost
|
if (events_has_extended_info($event['id_evento']) === true) {
|
||||||
|
$related = events_page_related($event, $server);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Juanma (09/05/2014) Fix: Needs to reconnect to node, in previous funct
|
||||||
|
// node connection was lost.
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$server = metaconsole_get_connection_by_id($server_id);
|
$server = metaconsole_get_connection_by_id($server_id);
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
|
@ -464,7 +523,7 @@ if ($get_extended_event) {
|
||||||
|
|
||||||
$loading = '<div id="response_loading" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
|
$loading = '<div id="response_loading" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
|
||||||
|
|
||||||
$out = '<div id="tabs" style="height:95%; overflow: auto">'.$tabs.$notifications.$loading.$general.$details.$custom_fields.$comments.$responses.$custom_data.html_print_input_hidden('id_event', $event['id_evento']).'</div>';
|
$out = '<div id="tabs" style="height:95%; overflow: auto">'.$tabs.$notifications.$loading.$general.$details.$related.$custom_fields.$comments.$responses.$custom_data.html_print_input_hidden('id_event', $event['id_evento']).'</div>';
|
||||||
|
|
||||||
$js = '<script>
|
$js = '<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
@ -472,7 +531,7 @@ if ($get_extended_event) {
|
||||||
});
|
});
|
||||||
';
|
';
|
||||||
|
|
||||||
// Load the required tab
|
// Load the required tab.
|
||||||
switch ($dialog_page) {
|
switch ($dialog_page) {
|
||||||
case 'general':
|
case 'general':
|
||||||
$js .= '$tabs.tabs( "option", "active", 0);';
|
$js .= '$tabs.tabs( "option", "active", 0);';
|
||||||
|
@ -482,26 +541,53 @@ if ($get_extended_event) {
|
||||||
$js .= '$tabs.tabs( "option", "active", 1);';
|
$js .= '$tabs.tabs( "option", "active", 1);';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'custom_fields':
|
case 'related':
|
||||||
$js .= '$tabs.tabs( "option", "active", 2);';
|
$js .= '$tabs.tabs( "option", "active", 2);';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'comments':
|
case 'custom_fields':
|
||||||
$js .= '$tabs.tabs( "option", "active", 3);';
|
$js .= '$tabs.tabs( "option", "active", 3);';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'responses':
|
case 'comments':
|
||||||
$js .= '$tabs.tabs( "option", "active", 4);';
|
$js .= '$tabs.tabs( "option", "active", 4);';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'custom_data':
|
case 'responses':
|
||||||
$js .= '$tabs.tabs( "option", "active", 5);';
|
$js .= '$tabs.tabs( "option", "active", 5);';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'custom_data':
|
||||||
|
$js .= '$tabs.tabs( "option", "active", 6);';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignore.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$js .= '});';
|
||||||
|
|
||||||
|
if (events_has_extended_info($event['id_evento']) === true) {
|
||||||
$js .= '
|
$js .= '
|
||||||
|
$("#link_related").click(function (){
|
||||||
|
$.post ({
|
||||||
|
url : "ajax.php",
|
||||||
|
data : {
|
||||||
|
page: "include/ajax/events_extended",
|
||||||
|
get_extended_info: 1,
|
||||||
|
id_event: '.$event['id_evento'].'
|
||||||
|
},
|
||||||
|
dataType : "html",
|
||||||
|
success: function (data) {
|
||||||
|
$("#related_data").html(data);
|
||||||
|
console.log("vamos puta");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>';
|
});';
|
||||||
|
}
|
||||||
|
|
||||||
|
$js .= '</script>';
|
||||||
|
|
||||||
echo $out.$js;
|
echo $out.$js;
|
||||||
}
|
}
|
||||||
|
@ -543,6 +629,10 @@ if ($get_events_details) {
|
||||||
$img = ui_get_full_url('images/hourglass.png', false, false, false);
|
$img = ui_get_full_url('images/hourglass.png', false, false, false);
|
||||||
$title = __('Event in process');
|
$title = __('Event in process');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignore.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '<tr class="'.get_priority_class($event['criticity']).'" style="height: 25px;">';
|
$out .= '<tr class="'.get_priority_class($event['criticity']).'" style="height: 25px;">';
|
||||||
|
@ -594,7 +684,8 @@ if ($table_events) {
|
||||||
$id_agente = (int) get_parameter('id_agente', 0);
|
$id_agente = (int) get_parameter('id_agente', 0);
|
||||||
$all_events_24h = (int) get_parameter('all_events_24h', 0);
|
$all_events_24h = (int) get_parameter('all_events_24h', 0);
|
||||||
|
|
||||||
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
// Fix: for tag functionality groups have to be all user_groups
|
||||||
|
// (propagate ACL funct!).
|
||||||
$groups = users_get_groups($config['id_user']);
|
$groups = users_get_groups($config['id_user']);
|
||||||
|
|
||||||
$tags_condition = tags_get_acl_tags(
|
$tags_condition = tags_get_acl_tags(
|
||||||
|
@ -612,7 +703,7 @@ if ($table_events) {
|
||||||
|
|
||||||
if ($all_events_24h) {
|
if ($all_events_24h) {
|
||||||
events_print_event_table(
|
events_print_event_table(
|
||||||
"utimestamp > $date_subtract_day",
|
'utimestamp > '.$date_subtract_day,
|
||||||
200,
|
200,
|
||||||
'100%',
|
'100%',
|
||||||
false,
|
false,
|
||||||
|
@ -621,7 +712,7 @@ if ($table_events) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
events_print_event_table(
|
events_print_event_table(
|
||||||
"estado <> 1 $tags_condition",
|
'estado <> 1 '.$tags_condition,
|
||||||
200,
|
200,
|
||||||
'100%',
|
'100%',
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Manage AJAX response for event pages.
|
||||||
|
*
|
||||||
|
* @category Ajax
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Events extended
|
||||||
|
* @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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once 'include/functions_events.php';
|
||||||
|
|
||||||
|
|
||||||
|
enterprise_include_once('meta/include/functions_events_meta.php');
|
||||||
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
|
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Check ACLs.
|
||||||
|
if (is_user_admin($config['id_user']) === true) {
|
||||||
|
// Do nothing if you're admin, you get full access.
|
||||||
|
$allowed = true;
|
||||||
|
} else if ($config['id_user'] == $event['owner_user']) {
|
||||||
|
// Do nothing if you're the owner user, you get access.
|
||||||
|
$allowed = true;
|
||||||
|
} else if ($event['id_grupo'] == 0) {
|
||||||
|
// If the event has access to all groups, you get access.
|
||||||
|
$allowed = 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 = true;
|
||||||
|
} else {
|
||||||
|
// If all the access types fail, abort.
|
||||||
|
$allowed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($allowed === false) {
|
||||||
|
echo 'Access denied';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_event = get_parameter('id_event', null);
|
||||||
|
$get_extended_info = get_parameter('get_extended_info', 0);
|
||||||
|
|
||||||
|
|
||||||
|
if ($get_extended_info == 1) {
|
||||||
|
if (isset($id_event) === false) {
|
||||||
|
echo 'Internal error. Invalid event.';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$extended_info = events_get_extended_events($id_event);
|
||||||
|
|
||||||
|
$table = new StdClass();
|
||||||
|
//
|
||||||
|
// Details.
|
||||||
|
//
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->data = [];
|
||||||
|
$table->head = [];
|
||||||
|
$table->style[0] = 'min-width:120px; text-align: left;';
|
||||||
|
$table->style[1] = 'text-align: left;';
|
||||||
|
$table->cellspacing = 2;
|
||||||
|
$table->cellpadding = 2;
|
||||||
|
$table->class = 'alternate rounded_cells';
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
$output[] = '<b>'.__('Timestamp').'</b>';
|
||||||
|
$output[] = '<b>'.__('Description').'</b>';
|
||||||
|
$table->data[] = $output;
|
||||||
|
|
||||||
|
foreach ($extended_info as $data) {
|
||||||
|
$output = [];
|
||||||
|
$output[] = date('Y/m/d H:i:s', $data['utimestamp']);
|
||||||
|
$output[] = io_safe_output($data['description']);
|
||||||
|
$table->data[] = $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -655,6 +655,19 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
||||||
-- Criticity: 3 - Warning (yellow) (status 2)
|
-- Criticity: 3 - Warning (yellow) (status 2)
|
||||||
-- Criticity: 4 - Critical (red) (status 1)
|
-- Criticity: 4 - Critical (red) (status 1)
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tevent_extended`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||||
|
`id` serial PRIMARY KEY,
|
||||||
|
`id_evento` bigint(20) unsigned NOT NULL,
|
||||||
|
`external_id` bigint(20) unsigned,
|
||||||
|
`utimestamp` bigint(20) NOT NULL default '0',
|
||||||
|
`description` text,
|
||||||
|
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tgrupo`
|
-- Table `tgrupo`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue