2013-03-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_events.php, include/functions_html.php, include/functions_graph.php, include/functions_reporting.php, operation/events/events_list.php, operation/events/events.php, operation/agentes/group_view.php: improved source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7859 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7025a8deec
commit
df50d9f731
|
@ -1,3 +1,10 @@
|
|||
2013-03-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_events.php, include/functions_html.php,
|
||||
include/functions_graph.php, include/functions_reporting.php,
|
||||
operation/events/events_list.php, operation/events/events.php,
|
||||
operation/agentes/group_view.php: improved source code style.
|
||||
|
||||
2013-03-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/massive/massive_copy_modules.php: uploaded lost changes
|
||||
|
|
|
@ -71,7 +71,7 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
|
||||
$table = events_get_events_table($meta, $history);
|
||||
|
||||
if($meta) {
|
||||
if ($meta) {
|
||||
$groupby_extra = ', server_id';
|
||||
}
|
||||
else {
|
||||
|
@ -89,9 +89,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY estado, evento, id_agentmodule" . $groupby_extra . "
|
||||
ORDER BY timestamp_rep DESC LIMIT " . $offset . "," . $pagination;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT *, MAX(id_evento) AS id_evento, array_to_string(array_agg(DISTINCT user_comment), '<br>') AS user_comment,
|
||||
|
@ -101,9 +101,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra" . $groupby_extra . "
|
||||
ORDER BY timestamp_rep DESC LIMIT " . $pagination . " OFFSET " . $offset;
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array();
|
||||
|
@ -111,7 +111,7 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
$set['offset'] = $offset;
|
||||
// TODO: Remove duplicate user comments
|
||||
$sql = "SELECT a.*, b.event_rep, b.timestamp_rep
|
||||
FROM (SELECT * FROM $table WHERE 1=1 ".$sql_post.") a,
|
||||
FROM (SELECT * FROM $table WHERE 1=1 " . $sql_post . ") a,
|
||||
(SELECT MAX (id_evento) AS id_evento, to_char(evento) AS evento,
|
||||
id_agentmodule, COUNT(*) AS event_rep,
|
||||
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep,
|
||||
|
@ -120,8 +120,8 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, to_char(evento), id_agentmodule".$groupby_extra.") b
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY estado, to_char(evento), id_agentmodule" . $groupby_extra . ") b
|
||||
WHERE a.id_evento=b.id_evento AND
|
||||
to_char(a.evento)=to_char(b.evento)
|
||||
AND a.id_agentmodule=b.id_agentmodule";
|
||||
|
|
|
@ -1384,16 +1384,16 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
$filter = array('disabled' => 0, 'id_grupo' => array_keys(users_get_groups(false, 'AR', false)));
|
||||
|
||||
|
||||
if(!empty($id_agent)) {
|
||||
if (!empty($id_agent)) {
|
||||
$filter['id_agente'] = $id_agent;
|
||||
}
|
||||
|
||||
$fields = array('SUM(critical_count) Critical',
|
||||
'SUM(warning_count) Warning',
|
||||
'SUM(normal_count) Normal',
|
||||
'SUM(unknown_count) Unknown');
|
||||
'SUM(warning_count) Warning',
|
||||
'SUM(normal_count) Normal',
|
||||
'SUM(unknown_count) Unknown');
|
||||
|
||||
if($show_not_init) {
|
||||
if ($show_not_init) {
|
||||
$fields[] = 'SUM(notinit_count) "Not init"';
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
|
||||
// If any value is negative, truncate it to 0
|
||||
function truncate_negatives(&$element) {
|
||||
if($element < 0) {
|
||||
if ($element < 0) {
|
||||
$element = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
|
||||
$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
|
||||
|
||||
if($show_not_init) {
|
||||
if ($show_not_init) {
|
||||
$colors[] = COL_NOTINIT;
|
||||
}
|
||||
|
||||
|
|
|
@ -1070,7 +1070,7 @@ function html_print_input_hidden_extended($name, $value, $id, $return = false, $
|
|||
*/
|
||||
function html_print_submit_button ($label = 'OK', $name = '', $disabled = false, $attributes = '', $return = false) {
|
||||
if (!$name) {
|
||||
$name="unnamed";
|
||||
$name = "unnamed";
|
||||
}
|
||||
|
||||
if (is_array ($attributes)) {
|
||||
|
|
|
@ -1004,7 +1004,8 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
|
|||
$tdata = array();
|
||||
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
|
||||
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
|
||||
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
|
||||
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
||||
graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ $groups = array();
|
|||
foreach($groups_full as $group) {
|
||||
$groups[$group['id_grupo']]['name'] = $group['nombre'];
|
||||
|
||||
if($group['id_grupo'] != 0) {
|
||||
if ($group['id_grupo'] != 0) {
|
||||
$groups[$group['parent']]['childs'][] = $group['id_grupo'];
|
||||
$groups[$group['id_grupo']]['prefix'] = $groups[$group['parent']]['prefix'].' ';
|
||||
}
|
||||
|
@ -59,13 +59,14 @@ foreach($groups_full as $group) {
|
|||
$groups[$group['id_grupo']]['prefix'] = '';
|
||||
}
|
||||
|
||||
if(!isset($groups[$group['id_grupo']]['childs'])) {
|
||||
if (!isset($groups[$group['id_grupo']]['childs'])) {
|
||||
$groups[$group['id_grupo']]['childs'] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if ($config["realtimestats"] == 0){
|
||||
$updated_time = __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
|
||||
if ($config["realtimestats"] == 0) {
|
||||
$updated_time = __('Last update') . " : " .
|
||||
ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
|
||||
}
|
||||
else {
|
||||
$updated_time = __("Updated at realtime");
|
||||
|
@ -74,7 +75,7 @@ else {
|
|||
// Header
|
||||
ui_print_page_header (__("Group view"), "images/bricks.png", false, "", false, $updated_time );
|
||||
|
||||
if(tags_has_user_acl_tags()) {
|
||||
if (tags_has_user_acl_tags()) {
|
||||
ui_print_tags_warning();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ if(enterprise_installed() && defined("METACONSOLE")) {
|
|||
// Get the history mode
|
||||
$history = (bool) get_parameter('history', 0);
|
||||
|
||||
if(isset($config['event_replication']) && $config['event_replication'] == 1 && !$meta) {
|
||||
if (isset($config['event_replication']) && $config['event_replication'] == 1 && !$meta) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access event viewer. View disabled due event replication.");
|
||||
ui_print_info_message('Event viewer is disabled due event replication. For more information, please contact with the administrator');
|
||||
|
|
|
@ -162,7 +162,7 @@ if ($update_pressed || $open_filter){
|
|||
if ($open_filter) {
|
||||
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b> '.html_print_image ("images/go.png", true, array ("title" => __('Toggle filter(s)'), "id" => 'toggle_arrow')).'</a><br><br>';
|
||||
}
|
||||
else{
|
||||
else {
|
||||
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b> '.html_print_image ("images/down.png", true, array ("title" => __('Toggle filter(s)'), "id" => 'toggle_arrow')).'</a><br><br>';
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ $params['input_name'] = 'text_agent';
|
|||
$params['value'] = $text_agent;
|
||||
$params['return'] = true;
|
||||
|
||||
if($meta) {
|
||||
if ($meta) {
|
||||
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
|
||||
}
|
||||
else {
|
||||
|
@ -415,7 +415,7 @@ $data = array();
|
|||
$data[0] = '<div style="width:100%; text-align:left">';
|
||||
$data[0] .= '<a href="javascript:" onclick="show_save_filter_dialog();">' . html_print_image("images/disk.png", true, array("border" => '0', "title" => __('Save filter'), "alt" => __('Save filter'))) . '</a> ';
|
||||
$data[0] .= '<a href="javascript:" onclick="show_load_filter_dialog();">' . html_print_image("images/server_database.png", true, array("border" => '0', "title" => __('Load filter'), "alt" => __('Load filter'))) . '</a> ';
|
||||
if(empty($id_name)) {
|
||||
if (empty($id_name)) {
|
||||
$data[0] .= '[<span id="filter_loaded_span" style="font-weight: normal">' . __('No filter loaded') . '</span>]';
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue