Clean the source code style.

This commit is contained in:
mdtrooper 2015-06-08 11:05:19 +02:00
parent 819b1d5d77
commit 89cac169f4
101 changed files with 606 additions and 458 deletions

View File

@ -140,15 +140,17 @@ function mainAgentsModules() {
$filter_module_group['id_module_group'] = $modulegroup; $filter_module_group['id_module_group'] = $modulegroup;
} }
$count = 0; $count = 0;
foreach ($agents as $agent){ foreach ($agents as $agent) {
$module = agents_get_modules($agent, false, $filter_module_group, true, false); $module = agents_get_modules($agent, false,
if ($module == false){ $filter_module_group, true, false);
if ($module == false) {
unset($agents[$count]); unset($agents[$count]);
} }
$count++; $count++;
} }
$total_pagination = count($agents); $total_pagination = count($agents);
$all_modules = agents_get_modules($agents, false, $filter_module_group, true, false); $all_modules = agents_get_modules($agents, false,
$filter_module_group, true, false);
$modules_by_name = array(); $modules_by_name = array();
$name = ''; $name = '';

View File

@ -98,7 +98,7 @@ function main_net_tools () {
} }
echo " echo "
<script type='text/javascript'> <script type='text/javascript'>
function mostrarColumns(ValueSelect){ function mostrarColumns(ValueSelect) {
value = ValueSelect.value; value = ValueSelect.value;
if (value == 3) { if (value == 3) {
$('netToolTable').css('width','100%'); $('netToolTable').css('width','100%');
@ -131,7 +131,7 @@ function main_net_tools () {
echo __("IP address"); echo __("IP address");
echo "</td><td>"; echo "</td><td>";
echo "<select name='select_ips'>"; echo "<select name='select_ips'>";
foreach($ips as $ip){ foreach ($ips as $ip) {
if ($ip['ip'] == $principal_ip) { if ($ip['ip'] == $principal_ip) {
echo "<option value='". $ip['ip'] ."' selected = 'selected'>" . $ip['ip']; echo "<option value='". $ip['ip'] ."' selected = 'selected'>" . $ip['ip'];
} }

View File

@ -76,11 +76,15 @@ function pluginreg_extension_main () {
$file_exec_path = $exec_path; $file_exec_path = $exec_path;
if (isset($ini_array["plugin_definition"]["execution_command"]) && ($ini_array["plugin_definition"]["execution_command"] != "")){ if (isset($ini_array["plugin_definition"]["execution_command"])
&& ($ini_array["plugin_definition"]["execution_command"] != "")) {
$exec_path = $ini_array["plugin_definition"]["execution_command"] . " " . $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"]; $exec_path = $ini_array["plugin_definition"]["execution_command"] . " " . $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"];
} }
if (isset($ini_array["plugin_definition"]["execution_postcommand"]) && ($ini_array["plugin_definition"]["execution_postcommand"] != "")){ if (isset($ini_array["plugin_definition"]["execution_postcommand"])
&& ($ini_array["plugin_definition"]["execution_postcommand"] != "")) {
$exec_path = $exec_path . " " .$ini_array["plugin_definition"]["execution_postcommand"]; $exec_path = $exec_path . " " .$ini_array["plugin_definition"]["execution_postcommand"];
} }

View File

@ -27,10 +27,10 @@ function render_info_data ($query, $label) {
render_row ($info, $label); render_row ($info, $label);
} }
function render_row ($data, $label){ function render_row ($data, $label) {
global $console_mode; global $console_mode;
if ($console_mode == 1){ if ($console_mode == 1) {
echo $label; echo $label;
echo "|"; echo "|";
echo $data; echo $data;

View File

@ -205,7 +205,7 @@ $(document).ready( function() {
show_menu(); show_menu();
openTime = new Date().getTime(); openTime = new Date().getTime();
} }
}).mouseleave(function(){ }).mouseleave(function() {
handsIn = 0; handsIn = 0;
setTimeout(function() { setTimeout(function() {
openedTime = new Date().getTime() - openTime; openedTime = new Date().getTime() - openTime;
@ -225,7 +225,7 @@ $(document).ready( function() {
$('#menu').css('width', '145px'); $('#menu').css('width', '145px');
$('li.menu_icon').addClass( " no_hidden_menu" ); $('li.menu_icon').addClass( " no_hidden_menu" );
$('ul.submenu').css('left', '144px'); $('ul.submenu').css('left', '144px');
}).mouseleave(function(){ }).mouseleave(function() {
handsInMenu = 0; handsInMenu = 0;
setTimeout(function() { setTimeout(function() {
openedMenu = new Date().getTime() - openTimeMenu; openedMenu = new Date().getTime() - openTimeMenu;
@ -251,7 +251,7 @@ $(document).ready( function() {
handsIn = 0; handsIn = 0;
handsIn2 = 0; handsIn2 = 0;
$('.menu_icon').mouseenter(function(){ $('.menu_icon').mouseenter(function() {
table_hover = $(this); table_hover = $(this);
handsIn = 1; handsIn = 1;
openTime = new Date().getTime(); openTime = new Date().getTime();
@ -261,7 +261,7 @@ $(document).ready( function() {
if( typeof(table_noHover) != 'undefined') if( typeof(table_noHover) != 'undefined')
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id ) if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
$("ul#sub"+table_noHover[0].id).hide(); $("ul#sub"+table_noHover[0].id).hide();
}).mouseleave(function(){ }).mouseleave(function() {
//$('div#menu').css('overflow', 'hidden'); //$('div#menu').css('overflow', 'hidden');
table_noHover = $(this); table_noHover = $(this);
handsIn = 0; handsIn = 0;
@ -275,7 +275,7 @@ $(document).ready( function() {
}); });
- $('.has_submenu').mouseenter(function(){ - $('.has_submenu').mouseenter(function() {
table_hover2 = $(this); table_hover2 = $(this);
handsIn2 = 1; handsIn2 = 1;
openTime2 = new Date().getTime(); openTime2 = new Date().getTime();
@ -283,7 +283,7 @@ $(document).ready( function() {
if( typeof(table_noHover2) != 'undefined') if( typeof(table_noHover2) != 'undefined')
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id ) if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
$("ul#sub"+table_noHover2[0].id).hide(); $("ul#sub"+table_noHover2[0].id).hide();
}).mouseleave(function(){ }).mouseleave(function() {
table_noHover2 = table_hover2; table_noHover2 = table_hover2;
handsIn2 = 0; handsIn2 = 0;
setTimeout(function() { setTimeout(function() {
@ -295,8 +295,8 @@ $(document).ready( function() {
}, 3500); }, 3500);
}); });
$(document).ready(function(){ $(document).ready(function() {
$('#container').click(function(){ $('#container').click(function() {
openTime = 4000; openTime = 4000;
if( typeof(table_hover) != 'undefined') if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide(); $("ul#sub"+table_hover[0].id).hide();
@ -308,7 +308,7 @@ $(document).ready( function() {
$('div#title_menu').hide(); $('div#title_menu').hide();
}); });
$('div.menu>ul>li>ul>li>a').click(function(){ $('div.menu>ul>li>ul>li>a').click(function() {
openTime = 4000; openTime = 4000;
if( typeof(table_hover) != 'undefined') if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide(); $("ul#sub"+table_hover[0].id).hide();
@ -319,7 +319,7 @@ $(document).ready( function() {
$('ul.submenu').css('left', '44px'); $('ul.submenu').css('left', '44px');
$('div#title_menu').hide(); $('div#title_menu').hide();
}); });
$('div.menu>ul>li>ul>li>ul>li>a').click(function(){ $('div.menu>ul>li>ul>li>ul>li>a').click(function() {
openTime = 4000; openTime = 4000;
if( typeof(table_hover) != 'undefined') if( typeof(table_hover) != 'undefined')
$("ul#sub"+table_hover[0].id).hide(); $("ul#sub"+table_hover[0].id).hide();

View File

@ -63,13 +63,13 @@ if (is_ajax()) {
} }
// Get critical events (realtime update) // Get critical events (realtime update)
if ($get_alerts_fired){ if ($get_alerts_fired) {
echo sc_get_alerts_fired(); echo sc_get_alerts_fired();
return; return;
} }
// Get critical events (realtime update) // Get critical events (realtime update)
if ($get_critical_events){ if ($get_critical_events) {
echo sc_get_critical_events(); echo sc_get_critical_events();
return; return;
} }
@ -107,18 +107,18 @@ function sc_get_critical_events () {
$shortcut_events_update = array(); $shortcut_events_update = array();
$critical_events_update = 0; $critical_events_update = 0;
foreach($shortcut_events_update as $event_update){ foreach ($shortcut_events_update as $event_update) {
if ($event_update['criticity'] == 4 and $event_update['estado'] == 0) { if ($event_update['criticity'] == 4 and $event_update['estado'] == 0) {
$critical_events_update++; $critical_events_update++;
} }
} }
return $critical_events_update; return $critical_events_update;
} }
function sc_get_opened_incidents () { function sc_get_opened_incidents () {
global $config; global $config;
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) { if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) {

View File

@ -164,7 +164,7 @@ switch ($config["dbtype"]) {
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function // Delete rnum row generated by oracle_recode_query() function
if (($config["dbtype"] == 'oracle') && ($result !== false)){ if (($config["dbtype"] == 'oracle') && ($result !== false)) {
for ($i=0; $i < count($result); $i++) { for ($i=0; $i < count($result); $i++) {
unset($result[$i]['rnum']); unset($result[$i]['rnum']);
} }

View File

@ -66,7 +66,7 @@ if (is_ajax ()) {
$oid_snmp = array(); $oid_snmp = array();
$out = false; $out = false;
foreach ($idSNMP as $id) { foreach ($idSNMP as $id) {
foreach ($snmp[$id] as $key => $value){ foreach ($snmp[$id] as $key => $value) {
// Check if it has "ifXXXX" syntax and skip it // Check if it has "ifXXXX" syntax and skip it
if (! preg_match ( "/if/", $key)) { if (! preg_match ( "/if/", $key)) {
@ -243,7 +243,7 @@ $table->data[3][1] = html_print_select_groups(false, "AR", false, 'grupo', $grup
$table->data[4][0] = __('Interval'); $table->data[4][0] = __('Interval');
$table->data[4][1] = html_print_extended_select_for_time ('intervalo', $intervalo, '', '', '0', 10, true); $table->data[4][1] = html_print_extended_select_for_time ('intervalo', $intervalo, '', '', '0', 10, true);
if($intervalo<300){ if ($intervalo < SECONDS_5MINUTES) {
$table->data[4][1] .= clippy_context_help("interval_agent_min"); $table->data[4][1] .= clippy_context_help("interval_agent_min");
} }
$table->data[5][0] = __('OS'); $table->data[5][0] = __('OS');

View File

@ -1031,11 +1031,14 @@ $(document).ready (function () {
}); });
$("#submit-create_modules_btn").click(function () { $("#submit-create_modules_btn").click(function () {
if($("#module option").length == 0 || ($("#module option").length == 1 && $("#module option").eq(0).val() == 0)) { if ($("#module option").length == 0
|| ($("#module option").length == 1
&& $("#module option").eq(0).val() == 0)) {
alert('<?php echo __('Modules list is empty'); ?>'); alert('<?php echo __('Modules list is empty'); ?>');
return false; return false;
} }
$('#module option').map(function(){ $('#module option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });

View File

@ -490,7 +490,7 @@ $(document).ready (function () {
alert('<?php echo __('Modules list is empty'); ?>'); alert('<?php echo __('Modules list is empty'); ?>');
return false; return false;
} }
$('#module option').map(function(){ $('#module option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });

View File

@ -205,10 +205,11 @@ if ($create_agent) {
// Create custom fields for this agent // Create custom fields for this agent
foreach ($field_values as $key => $value) { foreach ($field_values as $key => $value) {
db_process_sql_insert ('tagent_custom_data', db_process_sql_insert ('tagent_custom_data',
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value)); array('id_field' => $key, 'id_agent' => $id_agente,
'description' => $value));
} }
// Create address for this agent in taddress // Create address for this agent in taddress
if ( $direccion_agente != ''){ if ( $direccion_agente != '') {
agents_add_address ($id_agente, $direccion_agente); agents_add_address ($id_agente, $direccion_agente);
} }

View File

@ -40,7 +40,7 @@ $display_on_front = (int) get_parameter ('display_on_front', 0);
/* Create field */ /* Create field */
if ($create_field) { if ($create_field) {
/*Check if name field is empty*/ /*Check if name field is empty*/
if ($name == ""){ if ($name == "") {
ui_print_error_message(__('The name must not be empty')); ui_print_error_message(__('The name must not be empty'));
} }
else if ($name == db_get_value ('name', 'tagent_custom_fields', 'name', $name)) { else if ($name == db_get_value ('name', 'tagent_custom_fields', 'name', $name)) {

View File

@ -725,13 +725,13 @@ $(document).ready (function () {
}); });
$("#submit-updbutton").click(function () { $("#submit-updbutton").click(function () {
$('#id_tag_selected option').map(function(){ $('#id_tag_selected option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });
$("#submit-crtbutton").click(function () { $("#submit-crtbutton").click(function () {
$('#id_tag_selected option').map(function(){ $('#id_tag_selected option').map(function() {
$(this).attr('selected','selected'); $(this).attr('selected','selected');
}); });
}); });
@ -770,7 +770,7 @@ $(document).ready (function () {
$("#id_module_type").trigger('change'); $("#id_module_type").trigger('change');
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs // Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
$("#text-autocomplete_agent_name").keydown(function(event){ $("#text-autocomplete_agent_name").keydown(function(event) {
if(event.keyCode == 13) { // key code 13 is the enter button if(event.keyCode == 13) { // key code 13 is the enter button
event.preventDefault(); event.preventDefault();
} }
@ -839,7 +839,7 @@ function change_modules_autocomplete_input () {
if (data) { if (data) {
module_autocomplete.html(data); module_autocomplete.html(data);
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs // Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
$("#text-autocomplete_module_name").keydown(function(event){ $("#text-autocomplete_module_name").keydown(function(event) {
if(event.keyCode == 13) { // key code 13 is the enter button if(event.keyCode == 13) { // key code 13 is the enter button
event.preventDefault(); event.preventDefault();
} }

View File

@ -499,10 +499,13 @@ else {
'delete_downtime=1&amp;id_downtime='.$downtime['id'].'">' . 'delete_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete')));
} }
elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once'){ elseif ($downtime["executed"] == 1
&& $downtime['type_execution'] == 'once') {
$data[8] = '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor&amp;' . $data[8] = '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor&amp;' .
'edit_downtime=1&amp;id_downtime='.$downtime['id'].'">' . 'edit_downtime=1&amp;id_downtime=' . $downtime['id'] . '">' .
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>'; html_print_image("images/config.png", true,
array("border" => '0', "alt" => __('Update'))) . '</a>';
$data[9]= "N/A"; $data[9]= "N/A";
} }
else { else {

View File

@ -73,9 +73,9 @@ if ($copy_action) {
$al_action = alerts_get_alert_action ($id); $al_action = alerts_get_alert_action ($id);
if ($al_action !== false){ if ($al_action !== false) {
// If user tries to copy an action with group=ALL // If user tries to copy an action with group=ALL
if ($al_action['id_group'] == 0){ if ($al_action['id_group'] == 0) {
// then must have "PM" access privileges // then must have "PM" access privileges
if (! check_acl ($config['id_user'], 0, "PM")) { if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",

View File

@ -498,7 +498,7 @@ foreach ($simple_alerts as $alert) {
else else
$data[2] .= __('On').' '.$action['fires_min']; $data[2] .= __('On').' '.$action['fires_min'];
} }
else if ($action['fires_min'] < $action['fires_max']){ else if ($action['fires_min'] < $action['fires_max']) {
if ($action['fires_min'] == 0) if ($action['fires_min'] == 0)
$data[2] .= __('Until').' '.$action['fires_max']; $data[2] .= __('Until').' '.$action['fires_max'];
else else
@ -699,7 +699,7 @@ if (isset($dont_display_alert_create_bttn))
if ($dont_display_alert_create_bttn) if ($dont_display_alert_create_bttn)
$display_create = false; $display_create = false;
if ($display_create && check_acl ($config['id_user'], 0, "LW")){ if ($display_create && check_acl ($config['id_user'], 0, "LW")) {
echo '<div class="action-buttons" style="width: ' . $table->width . '">'; echo '<div class="action-buttons" style="width: ' . $table->width . '">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"'); html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"');

View File

@ -231,8 +231,8 @@ $search_string = (string) get_parameter ('search_string');
$search_type = (string) get_parameter ('search_type'); $search_type = (string) get_parameter ('search_type');
$table->width = '98%'; $table->width = '98%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '96%'; $table->width = '96%';
$table->class = 'databox_filters'; $table->class = 'databox_filters';
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
@ -242,7 +242,7 @@ $table->data = array ();
$table->head = array (); $table->head = array ();
$table->style = array (); $table->style = array ();
if (!defined("METACONSOLE")){ if (!defined("METACONSOLE")) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
} }
@ -258,7 +258,7 @@ $table->data[0][4] .= html_print_submit_button (__('Search'), 'search', false,
'class="sub search"', true); 'class="sub search"', true);
$table->data[0][4] .= '</div>'; $table->data[0][4] .= '</div>';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$filter = '<form class="filters_form" method="post" action="' . $url . '">'; $filter = '<form class="filters_form" method="post" action="' . $url . '">';
$filter .= html_print_table ($table,true); $filter .= html_print_table ($table,true);
$filter .= '</form>'; $filter .= '</form>';

View File

@ -302,14 +302,18 @@ $(document).ready (function () {
// Replace the old column with the new // Replace the old column with the new
$table_macros_field.replaceWith(field_row); $table_macros_field.replaceWith(field_row);
if (old_value != '' || old_recovery_value != ''){ if (old_value != '' || old_recovery_value != '') {
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
} }
else { else {
$("[name=field" + i + "_value]").val($("[name=field" + i + "_value]").val()); $("[name=field" + i + "_value]")
$("[name=field" + i + "_recovery_value]").val($("[name=field" + i + "_recovery_value]").val()); .val($("[name=field" + i + "_value]")
} .val());
$("[name=field" + i + "_recovery_value]")
.val($("[name=field" + i + "_recovery_value]")
.val());
}
// Add help hint only in first field // Add help hint only in first field
if (i == 1) { if (i == 1) {
var td_content = $table_macros_field.find('td').eq(0); var td_content = $table_macros_field.find('td').eq(0);

View File

@ -119,7 +119,7 @@ if (!empty($fields_values)) {
} }
$table->width = '98%'; $table->width = '98%';
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if ($id) { if ($id) {
@ -133,7 +133,7 @@ if (defined('METACONSOLE')){
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
} }
$table->style = array (); $table->style = array ();
if (!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
} }

View File

@ -538,16 +538,18 @@ if ($step == 2) {
$table->data[4][0] = __('Default action'); $table->data[4][0] = __('Default action');
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true))); $usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
switch ($config['dbtype']){ switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$sql_query = sprintf('SELECT id, name $sql_query = sprintf('
SELECT id, name
FROM talert_actions FROM talert_actions
WHERE id_group IN (%s) WHERE id_group IN (%s)
ORDER BY name', $usr_groups); ORDER BY name', $usr_groups);
break; break;
case "oracle": case "oracle":
$sql_query = sprintf('SELECT id, $sql_query = sprintf('
SELECT id,
dbms_lob.substr(name,4000,1) AS nombre dbms_lob.substr(name,4000,1) AS nombre
FROM talert_actions FROM talert_actions
WHERE id_group IN (%s) WHERE id_group IN (%s)
@ -557,7 +559,8 @@ if ($step == 2) {
$table->data[4][1] = html_print_select_from_sql ($sql_query, $table->data[4][1] = html_print_select_from_sql ($sql_query,
'default_action', $default_action, '', __('None'), 0, 'default_action', $default_action, '', __('None'), 0,
true, false, false) . true, false, false) .
ui_print_help_tip (__('In case you fill any Field 1, Field 2 or Field 3 above, those will replace the corresponding fields of this associated "Default action".'), true); ui_print_help_tip (
__('In case you fill any Field 1, Field 2 or Field 3 above, those will replace the corresponding fields of this associated "Default action".'), true);
$table->data[5][0] = __('Condition type'); $table->data[5][0] = __('Condition type');
$table->data[5][1] = html_print_select (alerts_get_alert_templates_types (), 'type', $table->data[5][1] = html_print_select (alerts_get_alert_templates_types (), 'type',

View File

@ -89,13 +89,14 @@ $result = false;
$result = categories_get_all_categories (); $result = categories_get_all_categories ();
// Form to add new categories or search categories // Form to add new categories or search categories
if(!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
echo "<table border=0 cellpadding=4 cellspacing=4 class='databox' width=98%>"; echo "<table border=0 cellpadding=4 cellspacing=4 class='databox' width=98%>";
echo "<tr>"; echo "<tr>";
echo "<td align=right>"; echo "<td align=right>";
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int)$config['pure'].'">'; echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int)$config['pure'].'">';
html_print_input_hidden ("create_category", "1", true); html_print_input_hidden ("create_category", "1", true);
html_print_submit_button (__('Create category'), 'create_button', false, 'class="sub next"'); html_print_submit_button (__('Create category'),
'create_button', false, 'class="sub next"');
echo "</form>"; echo "</form>";
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";
@ -133,7 +134,7 @@ if (!empty($result)) {
$data = array (); $data = array ();
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "&pure=" . (int)$config['pure'] . "'>" . $category["name"] . "</a>"; $data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "&pure=" . (int)$config['pure'] . "'>" . $category["name"] . "</a>";
$data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "&pure=" . (int)$config['pure'] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;"; $data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "&pure=" . (int)$config['pure'] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category["id"] . '&pure='.(int)$config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>'; $data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category["id"] . '&pure='.(int)$config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
@ -148,7 +149,7 @@ if (!empty($result)) {
html_print_table ($table); html_print_table ($table);
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>"; echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>";
echo "<tr>"; echo "<tr>";
echo "<td align=right>"; echo "<td align=right>";

View File

@ -131,7 +131,7 @@ if(!defined('METACONSOLE'))
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=100%>"; echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=100%>";
else else
echo "<table border=0 cellpadding=4 cellspacing=4 class='databox data' width=100%>"; echo "<table border=0 cellpadding=4 cellspacing=4 class='databox data' width=100%>";
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
if ($action == "update") { if ($action == "update") {
echo "<thead> echo "<thead>
<tr> <tr>
@ -165,14 +165,15 @@ else
html_print_input_text ('name_category', $name_category); html_print_input_text ('name_category', $name_category);
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";
if(!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
echo "<tr>"; echo "<tr>";
if ($action == "update") { if ($action == "update") {
echo "<td align=center>"; echo "<td align=center>";
html_print_input_hidden ('update_category', 1); html_print_input_hidden ('update_category', 1);
echo "</td>"; echo "</td>";
echo "<td align=right>"; echo "<td align=right>";
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub next"'); html_print_submit_button (__('Update'), 'update_button',
false, 'class="sub next"');
echo "</td>"; echo "</td>";
} }
if ($action == "new") { if ($action == "new") {
@ -186,17 +187,19 @@ else
echo "</tr>"; echo "</tr>";
} }
echo "</table>"; echo "</table>";
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>"; echo "<table border=0 cellpadding=0 cellspacing=0 class='' width=100%>";
echo "<tr>"; echo "<tr>";
echo "<td align=right>"; echo "<td align=right>";
if ($action == "update") { if ($action == "update") {
html_print_input_hidden ('update_category', 1); html_print_input_hidden ('update_category', 1);
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub next"'); html_print_submit_button (__('Update'), 'update_button', false,
'class="sub next"');
} }
if ($action == "new") { if ($action == "new") {
html_print_input_hidden ('create_category', 1); html_print_input_hidden ('create_category', 1);
html_print_submit_button (__('Create'), 'create_button', false, 'class="sub next"'); html_print_submit_button (__('Create'), 'create_button', false,
'class="sub next"');
} }
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";

View File

@ -61,7 +61,7 @@ $time["3month"] = $time["all"] - SECONDS_3MONTHS;
# ADQUIRE DATA PASSED AS FORM PARAMETERS # ADQUIRE DATA PASSED AS FORM PARAMETERS
# ====================================== # ======================================
# Purge data using dates # Purge data using dates
if (isset($_POST["purgedb"])){ # Fixed 2005-1-13, nil if (isset($_POST["purgedb"])) { # Fixed 2005-1-13, nil
$from_date = get_parameter_post("date_purge"); $from_date = get_parameter_post("date_purge");
$deleted = db_process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date)); $deleted = db_process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date));

View File

@ -29,10 +29,11 @@ if (! check_acl ($config['id_user'], 0, "DM")) {
# ADQUIRE DATA PASSED AS FORM PARAMETERS # ADQUIRE DATA PASSED AS FORM PARAMETERS
# ====================================== # ======================================
# Purge data using dates # Purge data using dates
if (isset ($_POST["date_purge"])){ if (isset ($_POST["date_purge"])) {
$from_date = (int) get_parameter_post ("date_purge"); $from_date = (int) get_parameter_post ("date_purge");
$deleted = db_process_sql_delete('tevento', array('utimestamp' => '< ' . $from_date)); $deleted = db_process_sql_delete('tevento',
array('utimestamp' => '< ' . $from_date));
if ($deleted !== false) { if ($deleted !== false) {
ui_print_success_message(__('Successfully deleted old events')); ui_print_success_message(__('Successfully deleted old events'));
@ -43,7 +44,11 @@ if (isset ($_POST["date_purge"])){
} }
# End of get parameters block # End of get parameters block
$row = db_get_row_sql ("SELECT COUNT(*) AS total, MIN(timestamp) AS first_date, MAX(timestamp) AS latest_date FROM tevento"); $row = db_get_row_sql ("
SELECT COUNT(*) AS total,
MIN(timestamp) AS first_date,
MAX(timestamp) AS latest_date
FROM tevento");
$table->data = array (); $table->data = array ();
$table->cellpadding = 4; $table->cellpadding = 4;

View File

@ -212,7 +212,7 @@ $(document).ready (function () {
$("#left").click (function () { $("#left").click (function () {
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) { jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html(); field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>){ if (field_name != <?php echo "'".__('None')."'"; ?>) {
id_field = $(value).attr('value'); id_field = $(value).attr('value');
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>')); $("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove(); $("#fields_selected").find("option[value='" + id_field + "']").remove();

View File

@ -28,7 +28,7 @@ if (! check_acl ($config["id_user"], 0, "EW")) {
$delete = (bool) get_parameter ('delete', 0); $delete = (bool) get_parameter ('delete', 0);
$multiple_delete = (bool)get_parameter('multiple_delete', 0); $multiple_delete = (bool)get_parameter('multiple_delete', 0);
if ($delete){ if ($delete) {
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');

View File

@ -85,13 +85,13 @@ $table->data = array();
$defaultMapId = null; $defaultMapId = null;
if ($maps){ if ($maps) {
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
foreach ($maps as $map) { foreach ($maps as $map) {
if (!check_acl ($config["id_user"], $map["group_id"], "IW")) { if (!check_acl ($config["id_user"], $map["group_id"], "IW")) {
continue; continue;
} }
$checked = false; $checked = false;
if ($map['default_map']) { if ($map['default_map']) {
$checked = true; $checked = true;

View File

@ -98,7 +98,7 @@ else {
$table->width = '98%'; $table->width = '98%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if ($id_group) if ($id_group)

View File

@ -323,11 +323,12 @@ foreach ($all_parents as $parent) {
$groups_count = count($groups); $groups_count = count($groups);
if (check_acl($config['id_user'], 0, "PM")) { if (check_acl($config['id_user'], 0, "PM")) {
if (!defined("METACONSOLE")){ if (!defined("METACONSOLE")) {
echo '<br />'; echo '<br />';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">';
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"'); html_print_submit_button(__('Create group'), 'crt', false,
'class="sub next"');
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
} }

View File

@ -45,7 +45,7 @@ else {
} }
$table->width = '98%'; $table->width = '98%';
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if ($id) { if ($id) {

View File

@ -442,12 +442,12 @@ $search_id_group = (int) get_parameter ('search_id_group');
$search_string = (string) get_parameter ('search_string'); $search_string = (string) get_parameter ('search_string');
$table->width = '98%'; $table->width = '98%';
if(defined("METACONSOLE")){ if(defined("METACONSOLE")) {
$table->width = '50%'; $table->width = '50%';
$table->class = 'databox_filters'; $table->class = 'databox_filters';
} }
$table->style = array (); $table->style = array ();
if (!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
} }
@ -501,7 +501,7 @@ $table->data[0][4] .= html_print_submit_button (__('Search'), 'search', false,
'class="sub search"', true); 'class="sub search"', true);
$table->data[0][4] .= '</div>'; $table->data[0][4] .= '</div>';
if(defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$filter = '<form class="filters_form" method="post" action="'.$url.'">'; $filter = '<form class="filters_form" method="post" action="'.$url.'">';
$filter .= html_print_table ($table,true); $filter .= html_print_table ($table,true);
$filter .= '</form>'; $filter .= '</form>';

View File

@ -233,7 +233,7 @@ else {
echo '<form name="component" method="post">'; echo '<form name="component" method="post">';
/* $table came from manage_network_components_form_common.php */ /* $table came from manage_network_components_form_common.php */
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if ($id) { if ($id) {

View File

@ -112,7 +112,7 @@ if ($filters === false)
$filters = array (); $filters = array ();
$table->width = '90%'; $table->width = '90%';
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
} }
$table->head = array (); $table->head = array ();

View File

@ -173,7 +173,7 @@ $table->border = 0;
$table->cellspacing = 3; $table->cellspacing = 3;
$table->cellpadding = 5; $table->cellpadding = 5;
$table->class = "databox_color"; $table->class = "databox_color";
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if($id) if($id)

View File

@ -195,14 +195,14 @@ $last_item = $item_max['id_rc'];
foreach ($reports_item as $item) { foreach ($reports_item as $item) {
$data = array (); $data = array ();
if (($item['id_rc'] == $first_item) && ($item['id_rc'] == $last_item)){ if (($item['id_rc'] == $first_item) && ($item['id_rc'] == $last_item)) {
$data[0] = '<span style="display: block; float: left; width: 16px;">&nbsp;</span>'; $data[0] = '<span style="display: block; float: left; width: 16px;">&nbsp;</span>';
} }
else if (($item['id_rc'] == $first_item) && ($item['id_rc'] != $last_item)){ else if (($item['id_rc'] == $first_item) && ($item['id_rc'] != $last_item)) {
$data[0] = '<span style="display: block; float: left; width: 16px;">&nbsp;</span>'; $data[0] = '<span style="display: block; float: left; width: 16px;">&nbsp;</span>';
$data[0] .= '<a href="' . $config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$item['id_report'].'&order=1&dir=down&id_rc='.$item['id_rc'].'">' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . '</a>'; $data[0] .= '<a href="' . $config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$item['id_report'].'&order=1&dir=down&id_rc='.$item['id_rc'].'">' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . '</a>';
} }
else if (($item['id_rc'] == $last_item) && ($item['id_rc'] != $first_item)){ else if (($item['id_rc'] == $last_item) && ($item['id_rc'] != $first_item)) {
$data[0] = '<a href="' . $config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$item['id_report'].'&order=1&dir=up&id_rc='.$item['id_rc'].'">' . html_print_image("images/up.png", true, array("title" => __('Move to up'))) . '</a>'; $data[0] = '<a href="' . $config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$item['id_report'].'&order=1&dir=up&id_rc='.$item['id_rc'].'">' . html_print_image("images/up.png", true, array("title" => __('Move to up'))) . '</a>';
} }
else { else {

View File

@ -73,7 +73,7 @@ if ($editGraph) {
} }
// Modules table // Modules table
if(count($module_array) > 0){ if (count($module_array) > 0) {
echo "<table width='98%' cellpadding=4 cellpadding=4 class='databox'>"; echo "<table width='98%' cellpadding=4 cellpadding=4 class='databox'>";
echo "<tr> echo "<tr>
<th>".__('Agent')."</th> <th>".__('Agent')."</th>
@ -81,9 +81,9 @@ if(count($module_array) > 0){
<th>".__('Weight')."</th> <th>".__('Weight')."</th>
<th>".__('Delete')."</th>"; <th>".__('Delete')."</th>";
$color = 0; $color = 0;
for ($a = 0; $a < count($module_array); $a++){ for ($a = 0; $a < count($module_array); $a++) {
// Calculate table line color // Calculate table line color
if ($color == 1){ if ($color == 1) {
$tdcolor = "datos"; $tdcolor = "datos";
$color = 0; $color = 0;
} }
@ -91,7 +91,7 @@ if(count($module_array) > 0){
$tdcolor = "datos2"; $tdcolor = "datos2";
$color = 1; $color = 1;
} }
echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>"; echo "<tr><td class='$tdcolor'>" . $agent_array[$a] . "</td>";
echo "<td class='$tdcolor'>"; echo "<td class='$tdcolor'>";
echo modules_get_agentmodule_name ($module_array[$a])."</td>"; echo modules_get_agentmodule_name ($module_array[$a])."</td>";

View File

@ -38,7 +38,7 @@ $buttons['graph_list'] = array('active' => true,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>'); html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>');
if ($enterpriseEnable){ if ($enterpriseEnable) {
$buttons = reporting_enterprise_add_template_graph_tabs($buttons); $buttons = reporting_enterprise_add_template_graph_tabs($buttons);
} }

View File

@ -189,7 +189,7 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$period = $item['period']; $period = $item['period'];
// 'top_n_value' field will be reused for projection report // 'top_n_value' field will be reused for projection report
if ($type == 'projection_graph'){ if ($type == 'projection_graph') {
$projection_period = $item['top_n_value']; $projection_period = $item['top_n_value'];
$period_pg = $item['period']; $period_pg = $item['period'];
} }
@ -531,16 +531,16 @@ else
?> ?>
<table style="" class="<?php echo $class;?>" id="" border="0" cellpadding="4" cellspacing="4" width="100%"> <table style="" class="<?php echo $class;?>" id="" border="0" cellpadding="4" cellspacing="4" width="100%">
<?php <?php
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
echo "<thead> echo "<thead>
<tr> <tr>
<th align=center colspan=5> <th align=center colspan=5>
" . __('Item Editor') . " " . __('Item Editor') . "
</th> </th>
</tr> </tr>
</thead>"; </thead>";
} }
?> ?>
<tbody> <tbody>
<tr id="row_type" style="" class="datos"> <tr id="row_type" style="" class="datos">
<td style="vertical-align: top; width: 220px;"><?php echo __('Type'); ?></td> <td style="vertical-align: top; width: 220px;"><?php echo __('Type'); ?></td>
@ -945,8 +945,10 @@ else
$metaconsole_connections = array(); $metaconsole_connections = array();
} }
$result_servers = array(); $result_servers = array();
foreach ($metaconsole_connections as $metaconsole_element){ foreach ($metaconsole_connections as $metaconsole_element) {
$connection_data = enterprise_hook('metaconsole_get_connection', array($metaconsole_element)); $connection_data = enterprise_hook(
'metaconsole_get_connection',
array($metaconsole_element));
$result_servers[$connection_data['server_name']] = $connection_data['server_name']; $result_servers[$connection_data['server_name']] = $connection_data['server_name'];
} }
// Print select combo with metaconsole servers // Print select combo with metaconsole servers
@ -1665,7 +1667,7 @@ function edit_custom_graph() {
var id_element_graph; var id_element_graph;
var id_server; var id_server;
if (id_graph.indexOf("|") != -1){ if (id_graph.indexOf("|") != -1) {
agent_server_temp = id_graph.split('|'); agent_server_temp = id_graph.split('|');
id_element_graph = agent_server_temp[0]; id_element_graph = agent_server_temp[0];
id_server = agent_server_temp[1]; id_server = agent_server_temp[1];

View File

@ -148,7 +148,7 @@ if (!defined("METACONSOLE"))
array("title" => __('Toggle filter(s)'), array("title" => __('Toggle filter(s)'),
"id" => 'image_form_filter')) . '</a>'; "id" => 'image_form_filter')) . '</a>';
if (!defined("METACONSOLE")){ if (!defined("METACONSOLE")) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->data[0][0] = __('Agents'); $table->data[0][0] = __('Agents');
@ -260,7 +260,7 @@ $table->style[0] = 'text-align: right;';
if ($items) { if ($items) {
$table->width = '98%'; $table->width = '98%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = "databox data"; $table->class = "databox data";
} }
@ -429,7 +429,7 @@ foreach ($items as $item) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
if ($items != false) { if ($items != false) {
ui_pagination ($countItems, 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter); ui_pagination ($countItems, 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
html_print_table($table); html_print_table($table);
@ -475,7 +475,7 @@ $table->size[0] = '25%';
$table->size[1] = '25%'; $table->size[1] = '25%';
$table->size[2] = '25%'; $table->size[2] = '25%';
$table->size[3] = '25%'; $table->size[3] = '25%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->class = "databox data"; $table->class = "databox data";
$table->head[0] = __("Sort items"); $table->head[0] = __("Sort items");
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;
@ -506,7 +506,7 @@ $table->size[0] = '25%';
$table->size[1] = '25%'; $table->size[1] = '25%';
$table->size[2] = '25%'; $table->size[2] = '25%';
$table->size[3] = '25%'; $table->size[3] = '25%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->class = "databox data"; $table->class = "databox data";
$table->head[0] = __("Delete items"); $table->head[0] = __("Delete items");
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;

View File

@ -47,7 +47,7 @@ $table->id = 'add_alert_table';
$table->class = 'databox'; $table->class = 'databox';
$table->head = array (); $table->head = array ();
if(defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('Main data'); $table->head[0] = __('Main data');

View File

@ -374,7 +374,7 @@ switch ($action) {
$table_aux->class = 'databox filters'; $table_aux->class = 'databox filters';
$table_aux->cellpadding = 0; $table_aux->cellpadding = 0;
$table_aux->cellspacing = 0; $table_aux->cellspacing = 0;
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table_aux->class = 'databox_filters'; $table_aux->class = 'databox_filters';
$table_aux->width = '96%'; $table_aux->width = '96%';
$table_aux->cellpadding = 0; $table_aux->cellpadding = 0;
@ -390,7 +390,7 @@ switch ($action) {
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true); $table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$filter = "<form class ='filters_form' action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group=$id_group&pure=$pure' $filter = "<form class ='filters_form' action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group=$id_group&pure=$pure'
method='post'>"; method='post'>";
$filter .= html_print_table($table_aux,true); $filter .= html_print_table($table_aux,true);
@ -471,7 +471,7 @@ switch ($action) {
$table->class = 'databox data'; $table->class = 'databox data';
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->class = 'databox'; $table->class = 'databox';
$table->width = '100%'; $table->width = '100%';
} }
@ -853,7 +853,7 @@ switch ($action) {
$interval_max = get_parameter('max_interval'); $interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval'); $interval_min = get_parameter('min_interval');
// Checks intervals fields // Checks intervals fields
if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)){ if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) {
$good_format = true; $good_format = true;
} }
$intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval'); $intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval');
@ -1091,7 +1091,7 @@ switch ($action) {
$interval_max = get_parameter('max_interval'); $interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval'); $interval_min = get_parameter('min_interval');
// Checks intervals fields // Checks intervals fields
if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)){ if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) {
$good_format = true; $good_format = true;
} }
$intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval'); $intervals = get_parameter('max_interval') . ';' . get_parameter('min_interval');

View File

@ -263,12 +263,12 @@ if (($create != "") OR ($view != "")) {
$table->colspan['plugin_desc'][1] = 3; $table->colspan['plugin_desc'][1] = 3;
$table->data['plugin_desc'] = $data; $table->data['plugin_desc'] = $data;
if (!defined("METACONSOLE")){ if (!defined("METACONSOLE")) {
echo '<br>'; echo '<br>';
echo '<table class="databox" style="margin: 0 auto; width: 98%;"><tr><td>'; echo '<table class="databox" style="margin: 0 auto; width: 98%;"><tr><td>';
} }
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('General'); $table->head[0] = __('General');
@ -331,7 +331,7 @@ if (($create != "") OR ($view != "")) {
$data[1] = '<div id="command_preview" style="font-style:italic"></div>'; $data[1] = '<div id="command_preview" style="font-style:italic"></div>';
$table->data['plugin_preview'] = $data; $table->data['plugin_preview'] = $data;
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('Command'); $table->head[0] = __('Command');
@ -451,7 +451,7 @@ if (($create != "") OR ($view != "")) {
$table->data['plugin_action'] = $datam; $table->data['plugin_action'] = $datam;
} }
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('Parameters macros'); $table->head[0] = __('Parameters macros');

View File

@ -67,7 +67,7 @@ if ($create != "") {
// SHOW THE FORM // SHOW THE FORM
// ================================================================= // =================================================================
if (($create != "") OR ($view != "")){ if (($create != "") OR ($view != "")) {
if ($create != "") if ($create != "")
ui_print_page_header (__('Recon script creation'), "images/gm_servers.png", false, "reconscript_definition", true); ui_print_page_header (__('Recon script creation'), "images/gm_servers.png", false, "reconscript_definition", true);
@ -215,7 +215,7 @@ if (($create != "") OR ($view != "")){
echo '<table width=98%>'; echo '<table width=98%>';
echo '<tr><td align="right">'; echo '<tr><td align="right">';
if ($create != ""){ if ($create != "") {
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>"; echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
} }
else { else {
@ -332,7 +332,7 @@ else {
else { else {
ui_print_success_message(__('reconscript deleted successfully')); ui_print_success_message(__('reconscript deleted successfully'));
} }
if ($reconscript_id != 0){ if ($reconscript_id != 0) {
$result = db_process_sql_delete('trecon_task', $result = db_process_sql_delete('trecon_task',
array('id_recon_script' => $reconscript_id)); array('id_recon_script' => $reconscript_id));
} }

View File

@ -89,8 +89,8 @@ foreach ($servers as $server) {
} }
// Type // Type
$data[2] = '<span style="white-space:nowrap;">'.$server["img"]; $data[2] = '<span style="white-space:nowrap;">' . $server["img"];
if ($server["master"] == 1){ if ($server["master"] == 1) {
$data[2] .= ui_print_help_tip (__("This is a master server"), true); $data[2] .= ui_print_help_tip (__("This is a master server"), true);
} }
//$data[2] .= '</span> <span style="font-size:8px;"> v' .. '</span>'; //$data[2] .= '</span> <span style="font-size:8px;"> v' .. '</span>';
@ -116,7 +116,7 @@ foreach ($servers as $server) {
} }
$data[6] = $server['threads'].' : '.$server['queued_modules']; $data[6] = $server['threads'].' : '.$server['queued_modules'];
if ($server['queued_modules'] > 200){ if ($server['queued_modules'] > 200) {
$data[6] .= clippy_context_help("server_queued_modules"); $data[6] .= clippy_context_help("server_queued_modules");
} }
$data[7] = ui_print_timestamp ($server['keepalive'], true); $data[7] = ui_print_timestamp ($server['keepalive'], true);

View File

@ -136,9 +136,9 @@ else { // Main list view for Links editor
echo "<th width='180px'>".__('Link name')."</th>"; echo "<th width='180px'>".__('Link name')."</th>";
echo "<th width='80px'>".__('Delete')."</th>"; echo "<th width='80px'>".__('Delete')."</th>";
$color=1; $color = 1;
foreach ($rows as $row) { foreach ($rows as $row) {
if ($color == 1){ if ($color == 1) {
$tdcolor = "datos"; $tdcolor = "datos";
$color = 0; $color = 0;
} }

View File

@ -133,7 +133,7 @@ if ($config["integria_enabled"]) {
$table->data[20][0] = __('Integria URL') . ui_print_help_icon ("integria_url", true); $table->data[20][0] = __('Integria URL') . ui_print_help_icon ("integria_url", true);
$table->data[20][1] = html_print_input_text ('integria_url', $config["integria_url"], '', 25, 255, true); $table->data[20][1] = html_print_input_text ('integria_url', $config["integria_url"], '', 25, 255, true);
// If something goes wrong // If something goes wrong
if ($bad_input){ if ($bad_input) {
$table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect'))); $table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect')));
} }
@ -309,18 +309,18 @@ function show_timezone () {
url: "ajax.php", url: "ajax.php",
data: "page=<?php echo $_GET['sec2']; ?>&select_timezone=1&zone=" + zone, data: "page=<?php echo $_GET['sec2']; ?>&select_timezone=1&zone=" + zone,
dataType: "json", dataType: "json",
success: function(data){ success: function(data) {
$("#timezone").empty(); $("#timezone").empty();
jQuery.each (data, function (id, value) { jQuery.each (data, function (id, value) {
timezone = value; timezone = value;
$("select[name='timezone']").append($("<option>").val(timezone).html(timezone)); $("select[name='timezone']").append($("<option>").val(timezone).html(timezone));
}); });
} }
}); });
} }
$(document).ready (function () { $(document).ready (function () {
$("#zone").attr("hidden", true); $("#zone").attr("hidden", true);
$("#timezone").attr("hidden", true); $("#timezone").attr("hidden", true);

View File

@ -244,7 +244,7 @@ if (!empty($result)) {
html_print_table ($table); html_print_table ($table);
} }
if(defined("METACONSOLE")){ if (defined("METACONSOLE")) {
echo "<table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo "<table border=0 cellpadding=0 cellspacing=0 width=100%>";
echo "<tr>"; echo "<tr>";
echo "<td align=right>"; echo "<td align=right>";

View File

@ -415,7 +415,7 @@ if ($delete_profile) {
$table->id = 'user_configuration_table'; $table->id = 'user_configuration_table';
$table->width = '98%'; $table->width = '98%';
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
if ($id) { if ($id) {
@ -596,7 +596,7 @@ if (!empty ($id) && !$new_user) {
echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>'; echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>';
$table->width = '98%'; $table->width = '98%';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->head_colspan[0] = 0; $table->head_colspan[0] = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox_tactical data'; $table->class = 'databox_tactical data';
@ -606,7 +606,7 @@ if (!empty ($id) && !$new_user) {
$table->head = array (); $table->head = array ();
$table->align = array (); $table->align = array ();
$table->style = array (); $table->style = array ();
if (!defined("METACONSOLE")){ if (!defined("METACONSOLE")) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold'; $table->style[1] = 'font-weight: bold';
} }

View File

@ -235,7 +235,7 @@ $table->data[0][4] = html_print_submit_button(__('Search'), 'search',
false, array('class' => 'sub search'), true); false, array('class' => 'sub search'), true);
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '96%'; $table->width = '96%';
$form_filter = "<form class='filters_form' method='post'>"; $form_filter = "<form class='filters_form' method='post'>";
$form_filter .= html_print_table($table, true); $form_filter .= html_print_table($table, true);
@ -251,7 +251,7 @@ else {
} }
$table = null; $table = null;
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
@ -431,7 +431,7 @@ foreach ($info as $user_id => $user_info) {
$data[4] = ""; $data[4] = "";
$result = db_get_all_rows_field_filter ("tusuario_perfil", "id_usuario", $user_id); $result = db_get_all_rows_field_filter ("tusuario_perfil", "id_usuario", $user_id);
if ($result !== false) { if ($result !== false) {
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$data[4] .= "<div width='100%'>"; $data[4] .= "<div width='100%'>";
foreach ($result as $row) { foreach ($result as $row) {
$data[4] .= "<div style='float:left;'>"; $data[4] .= "<div style='float:left;'>";

View File

@ -175,7 +175,7 @@ if ($get_module_detail) {
"width" => "230px"), "width" => "230px"),
); );
if($config['prominent_time']=='comparation'){ if($config['prominent_time']=='comparation') {
$columns["Time"] = array( $columns["Time"] = array(
"utimestamp", "utimestamp",
"modules_format_time", "modules_format_time",
@ -887,8 +887,8 @@ if ($list_modules) {
$salida = "<span style='$style'>$salida</span>"; $salida = "<span style='$style'>$salida</span>";
} }
else { else {
if (is_numeric($module["datos"]) && !modules_is_string_type($module['id_tipo_modulo'])){ if (is_numeric($module["datos"]) && !modules_is_string_type($module['id_tipo_modulo'])) {
if ( $config["render_proc"] ){ if ( $config["render_proc"] ) {
switch($module["id_tipo_modulo"]) { switch($module["id_tipo_modulo"]) {
case 2: case 2:
case 6: case 6:

View File

@ -905,7 +905,7 @@ if ($get_element_status) {
return; return;
} }
if ($get_image_path_status){ if ($get_image_path_status) {
$img_src = get_parameter("img_src"); $img_src = get_parameter("img_src");
$only_src = get_parameter("only_src", 0); $only_src = get_parameter("only_src", 0);

View File

@ -247,19 +247,19 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
} }
} }
else { else {
if ($type[0] == 'INSERT'){ if ($type[0] == 'INSERT') {
$query = oci_parse($config['dbconnection'], 'begin insert_id(:table_name, :sql, :out); end;'); $query = oci_parse($config['dbconnection'], 'begin insert_id(:table_name, :sql, :out); end;');
} }
// Prevent execution of insert_id stored procedure // Prevent execution of insert_id stored procedure
else if ($type[0] == '/INSERT'){ else if ($type[0] == '/INSERT') {
$query = oci_parse($config['dbconnection'], substr($sql,1)); $query = oci_parse($config['dbconnection'], substr($sql,1));
} }
else { else {
$query = oci_parse($config['dbconnection'], $sql); $query = oci_parse($config['dbconnection'], $sql);
} }
} }
//If query is an insert retrieve Id field //If query is an insert retrieve Id field
if ($type[0] == 'INSERT'){ if ($type[0] == 'INSERT') {
oci_bind_by_name($query,":table_name", $table_name ,32); oci_bind_by_name($query,":table_name", $table_name ,32);
oci_bind_by_name($query,":sql", $sql, 1000); oci_bind_by_name($query,":sql", $sql, 1000);
oci_bind_by_name($query,":out", $id, 32); oci_bind_by_name($query,":out", $id, 32);
@ -605,7 +605,7 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
if ($i == 1) { if ($i == 1) {
$query .= ' ( '; $query .= ' ( ';
} }
if ($field == '1' AND $value == '1'){ if ($field == '1' AND $value == '1') {
$query .= sprintf("'%s' = '%s'", $field, $value); $query .= sprintf("'%s' = '%s'", $field, $value);
if ($i < $max) { if ($i < $max) {
@ -815,17 +815,17 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
$query .= sprintf ("%s IN ('%s')", $field, implode ("', '", $value)); $query .= sprintf ("%s IN ('%s')", $field, implode ("', '", $value));
} }
else { else {
if ($value[0] == ">"){ if ($value[0] == ">") {
$value = substr($value,1,strlen($value)-1); $value = substr($value,1,strlen($value) - 1);
$query .= sprintf ("%s > '%s'", $field, $value); $query .= sprintf ("%s > '%s'", $field, $value);
} }
else if ($value[0] == "<"){ else if ($value[0] == "<") {
if ($value[1] == ">"){ if ($value[1] == ">") {
$value = substr($value,2,strlen($value)-2); $value = substr($value,2,strlen($value) - 2);
$query .= sprintf ("%s <> '%s'", $field, $value); $query .= sprintf ("%s <> '%s'", $field, $value);
} }
else { else {
$value = substr($value,1,strlen($value)-1); $value = substr($value,1,strlen($value) - 1);
$query .= sprintf ("%s < '%s'", $field, $value); $query .= sprintf ("%s < '%s'", $field, $value);
} }
} }
@ -1130,7 +1130,7 @@ function oracle_db_format_array_to_update_sql ($values) {
if (isset ($value[0]) && $value[0] == '`') if (isset ($value[0]) && $value[0] == '`')
/* Don't round with quotes if it references a field */ /* Don't round with quotes if it references a field */
$sql = sprintf ("%s = %s", $field, str_replace('`', '', $value)); $sql = sprintf ("%s = %s", $field, str_replace('`', '', $value));
else if (substr($value, 0,1) == '#'){ else if (substr($value, 0,1) == '#') {
$sql = sprintf ("%s = %s", $field, substr($value,1)); $sql = sprintf ("%s = %s", $field, substr($value,1));
} }
else { else {
@ -1235,7 +1235,7 @@ function oracle_db_process_sql_delete($table, $where, $where_join = 'AND') {
return db_process_sql ($query); return db_process_sql ($query);
} }
function oracle_db_process_sql_delete_temp ($table, $where, $where_join = 'AND'){ function oracle_db_process_sql_delete_temp ($table, $where, $where_join = 'AND') {
if (empty ($where)) if (empty ($where))
/* Should avoid any mistake that lead to deleting all data */ /* Should avoid any mistake that lead to deleting all data */
return false; return false;
@ -1415,7 +1415,7 @@ function oracle_db_get_type_field_table($table, $field) {
* *
* @return mixed Return an array/string of table fields or false if something goes wrong. * @return mixed Return an array/string of table fields or false if something goes wrong.
*/ */
function oracle_list_all_field_table($table_name, $return_mode = 'array'){ function oracle_list_all_field_table($table_name, $return_mode = 'array') {
if (empty($table_name)) { if (empty($table_name)) {
return false; return false;
} }

View File

@ -2240,8 +2240,12 @@ function print_audit_csv ($data) {
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Expires: 0"); header("Expires: 0");
if ($data){ if ($data) {
echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n"; echo __('User') . ';' .
__('Action') . ';' .
__('Date') . ';' .
__('Source ID') . ';' .
__('Comments') ."\n";
foreach ($data as $line) { foreach ($data as $line) {
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n"; echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
} }

View File

@ -1584,7 +1584,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
$result_modules = array(); $result_modules = array();
// Skip non init modules // Skip non init modules
foreach ($all_modules as $module) { foreach ($all_modules as $module) {
if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){ if (modules_get_agentmodule_is_init($module['id_agente_modulo'])) {
$modules[] = $module['id_agente_modulo']; $modules[] = $module['id_agente_modulo'];
} }
} }

View File

@ -676,7 +676,7 @@ function alerts_get_alert_template ($id_alert_template) {
FROM user_tab_columns FROM user_tab_columns
WHERE table_name = \'TALERT_TEMPLATES\' WHERE table_name = \'TALERT_TEMPLATES\'
AND column_name NOT IN (\'TIME_FROM\',\'TIME_TO\')'); AND column_name NOT IN (\'TIME_FROM\',\'TIME_TO\')');
foreach ($fields_select as $field_select){ foreach ($fields_select as $field_select) {
$select_field[] = $field_select['column_name']; $select_field[] = $field_select['column_name'];
} }
$select_stmt = implode(',', $select_field); $select_stmt = implode(',', $select_field);

View File

@ -1310,14 +1310,14 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
$result_modules = array(); $result_modules = array();
// Skip non init modules // Skip non init modules
foreach ($modules as $module) { foreach ($modules as $module) {
if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){ if (modules_get_agentmodule_is_init($module['id_agente_modulo'])) {
$result_modules[] = $module; $result_modules[] = $module;
} }
} }
// Without modules NO_MODULES // Without modules NO_MODULES
if ($other['data'][2] == 'no_modules'){ if ($other['data'][2] == 'no_modules') {
if (empty($result_modules) and $other['data'][2] == 'no_modules'){ if (empty($result_modules) and $other['data'][2] == 'no_modules') {
$result_agents[] = $agent; $result_agents[] = $agent;
} }
} }
@ -1508,7 +1508,7 @@ function api_get_policy_modules($thrash1, $thrash2, $other, $thrash3) {
$where = ''; $where = '';
if ($other['data'][0] == "") { if ($other['data'][0] == "") {
returnError('error_policy_modules', 'Error retrieving policy modules. Id_policy cannot be left blank.'); returnError('error_policy_modules', 'Error retrieving policy modules. Id_policy cannot be left blank.');
return; return;
} }
@ -1516,11 +1516,11 @@ function api_get_policy_modules($thrash1, $thrash2, $other, $thrash3) {
array($other['data'][0], $other['data'][1])); array($other['data'][0], $other['data'][1]));
if ($policies === ENTERPRISE_NOT_HOOK) { if ($policies === ENTERPRISE_NOT_HOOK) {
returnError('error_policy_modules', 'Error retrieving policy modules.'); returnError('error_policy_modules', 'Error retrieving policy modules.');
return; return;
} }
if (count($policies) > 0 and $policies !== false){ if (count($policies) > 0 and $policies !== false) {
$data = array('type' => 'array', 'data' => $policies); $data = array('type' => 'array', 'data' => $policies);
returnData('csv', $data, ';'); returnData('csv', $data, ';');
@ -1637,21 +1637,23 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3) {
* *
* @param $thrash3 Don't use * @param $thrash3 Don't use
*/ */
function api_set_update_network_module($id_module, $thrash1, $other, $thrash3){ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
return; return;
} }
if ($id_module == "") { if ($id_module == "") {
returnError('error_update_network_module', __('Error updating network module. Module name cannot be left blank.')); returnError('error_update_network_module',
__('Error updating network module. Module name cannot be left blank.'));
return; return;
} }
$check_id_module = db_get_value ('id_agente_modulo', 'tagente_modulo', 'id_agente_modulo', $id_module); $check_id_module = db_get_value ('id_agente_modulo', 'tagente_modulo', 'id_agente_modulo', $id_module);
if (!$check_id_module) { if (!$check_id_module) {
returnError('error_update_network_module', __('Error updating network module. Id_module doesn\'t exists.')); returnError('error_update_network_module',
__('Error updating network module. Id_module doesn\'t exists.'));
return; return;
} }
@ -1660,9 +1662,11 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3){
$id_agent_old = db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module); $id_agent_old = db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module);
if ($id_agent_old != $other['data'][0]) { if ($id_agent_old != $other['data'][0]) {
$id_module_exists = db_get_value_filter ('id_agente_modulo', 'tagente_modulo', array('nombre' => $module_name, 'id_agente' => $other['data'][0])); $id_module_exists = db_get_value_filter ('id_agente_modulo',
'tagente_modulo',
array('nombre' => $module_name, 'id_agente' => $other['data'][0]));
if ($id_module_exists){ if ($id_module_exists) {
returnError('error_update_network_module', returnError('error_update_network_module',
__('Error updating network module. Id_module exists in the new agent.')); __('Error updating network module. Id_module exists in the new agent.'));
return; return;
@ -1825,7 +1829,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3) {
* *
* @param $thrash3 Don't use * @param $thrash3 Don't use
*/ */
function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3){ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
return; return;
} }
@ -2012,7 +2016,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3) {
* *
* @param $thrash3 Don't use * @param $thrash3 Don't use
*/ */
function api_set_update_data_module($id_module, $thrash1, $other, $thrash3){ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
return; return;
} }
@ -2070,7 +2074,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3){
$values = array(); $values = array();
$cont = 0; $cont = 0;
foreach ($data_module_fields as $field) { foreach ($data_module_fields as $field) {
if ($other['data'][$cont] != ""){ if ($other['data'][$cont] != "") {
$values[$field] = $other['data'][$cont]; $values[$field] = $other['data'][$cont];
} }
@ -2298,21 +2302,28 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
if ($other['data'][13] == "3") { if ($other['data'][13] == "3") {
if ($other['data'][22] != "AES" and $other['data'][22] != "DES") { if ($other['data'][22] != "AES" and $other['data'][22] != "DES") {
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. ')); returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return; return;
} }
if ($other['data'][24] != "authNoPriv" and $other['data'][24] != "authPriv" and $other['data'][24] != "noAuthNoPriv"){ if ($other['data'][24] != "authNoPriv"
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); and $other['data'][24] != "authPriv"
and $other['data'][24] != "noAuthNoPriv") {
returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return; return;
} }
if ($other['data'][25] != "MD5" and $other['data'][25] != "SHA") { if ($other['data'][25] != "MD5" and $other['data'][25] != "SHA") {
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. ')); returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return; return;
} }
$snmp_module_fields = array('id_agente', $snmp_module_fields = array(
'id_agente',
'disabled', 'disabled',
'id_module_group', 'id_module_group',
'min_warning', 'min_warning',
@ -2347,7 +2358,8 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
'min_ff_event_critical'); 'min_ff_event_critical');
} }
else { else {
$snmp_module_fields = array('id_agente', $snmp_module_fields = array(
'id_agente',
'disabled', 'disabled',
'id_module_group', 'id_module_group',
'min_warning', 'min_warning',
@ -2378,8 +2390,8 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
$values = array(); $values = array();
$cont = 0; $cont = 0;
foreach ($snmp_module_fields as $field){ foreach ($snmp_module_fields as $field) {
if ($other['data'][$cont] != ""){ if ($other['data'][$cont] != "") {
$values[$field] = $other['data'][$cont]; $values[$field] = $other['data'][$cont];
} }
@ -2618,13 +2630,18 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
return; return;
} }
if ($other['data'][25] != "authNoPriv" and $other['data'][25] != "authPriv" and $other['data'][25] != "noAuthNoPriv"){ if ($other['data'][25] != "authNoPriv"
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); and $other['data'][25] != "authPriv"
and $other['data'][25] != "noAuthNoPriv") {
returnError('error_set_new_snmp_component',
__('Error creating SNMP component. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return; return;
} }
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") { if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. ')); returnError('error_set_new_snmp_component',
__('Error creating SNMP component. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return; return;
} }
@ -3104,7 +3121,7 @@ function api_get_alert_template($id_template, $thrash1, $other, $thrash3) {
if ($id_template != "") { if ($id_template != "") {
$result_template = alerts_get_alert_template_name($id_template); $result_template = alerts_get_alert_template_name($id_template);
if (!$result_template){ if (!$result_template) {
returnError('error_get_alert_template', returnError('error_get_alert_template',
__('Error getting alert template. Id_template doesn\'t exists.')); __('Error getting alert template. Id_template doesn\'t exists.'));
return; return;
@ -3275,24 +3292,28 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) {
} }
if ($id == "") { if ($id == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_template cannot be left blank.')); returnError('error_module_to_template',
__('Error assigning module to template. Id_template cannot be left blank.'));
return; return;
} }
if ($other['data'][0] == ""){ if ($other['data'][0] == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_module cannot be left blank.')); returnError('error_module_to_template',
__('Error assigning module to template. Id_module cannot be left blank.'));
return; return;
} }
if ($other['data'][1] == "") { if ($other['data'][1] == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_agent cannot be left blank.')); returnError('error_module_to_template',
__('Error assigning module to template. Id_agent cannot be left blank.'));
return; return;
} }
$result_template = alerts_get_alert_template($id); $result_template = alerts_get_alert_template($id);
if (!$result_template){ if (!$result_template) {
returnError('error_module_to_template', __('Error assigning module to template. Id_template doensn\'t exists.')); returnError('error_module_to_template',
__('Error assigning module to template. Id_template doensn\'t exists.'));
return; return;
} }
@ -3466,13 +3487,14 @@ function api_set_validate_all_alerts($id, $thrash1, $other, $thrash3) {
$id_agents = db_get_all_rows_sql($sql); $id_agents = db_get_all_rows_sql($sql);
foreach ($id_agents as $id_agent){ foreach ($id_agents as $id_agent) {
$result_agents[] = $id_agent['id_agente']; $result_agents[] = $id_agent['id_agente'];
} }
$agents_string = implode(',', $result_agents); $agents_string = implode(',', $result_agents);
$sql = sprintf ("SELECT talert_template_modules.id $sql = sprintf ("
SELECT talert_template_modules.id
FROM talert_template_modules FROM talert_template_modules
INNER JOIN tagente_modulo t2 INNER JOIN tagente_modulo t2
ON talert_template_modules.id_agent_module = t2.id_agente_modulo ON talert_template_modules.id_agent_module = t2.id_agente_modulo
@ -3480,7 +3502,7 @@ function api_set_validate_all_alerts($id, $thrash1, $other, $thrash3) {
ON t2.id_agente = t3.id_agente ON t2.id_agente = t3.id_agente
INNER JOIN talert_templates t4 INNER JOIN talert_templates t4
ON talert_template_modules.id_alert_template = t4.id ON talert_template_modules.id_alert_template = t4.id
WHERE id_agent_module in (%s)", $agents_string); WHERE id_agent_module in (%s)", $agents_string);
$alerts = db_get_all_rows_sql($sql); $alerts = db_get_all_rows_sql($sql);
@ -3541,14 +3563,14 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
// Number of alerts in this policy // Number of alerts in this policy
if ($policy_alerts != false){ if ($policy_alerts != false) {
$partial_alerts = count($policy_alerts); $partial_alerts = count($policy_alerts);
// Added alerts of this policy to the total // Added alerts of this policy to the total
$total_alerts = $total_alerts + $partial_alerts; $total_alerts = $total_alerts + $partial_alerts;
} }
$result_pol_alerts = array(); $result_pol_alerts = array();
foreach ($policy_alerts as $policy_alert){ foreach ($policy_alerts as $policy_alert) {
$result_pol_alerts[] = $policy_alert['id']; $result_pol_alerts[] = $policy_alert['id'];
} }
@ -3556,7 +3578,8 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
// If the policy has alerts // If the policy has alerts
if (count($result_pol_alerts) != 0) { if (count($result_pol_alerts) != 0) {
$sql = sprintf ("SELECT id $sql = sprintf ("
SELECT id
FROM talert_template_modules FROM talert_template_modules
WHERE id_policy_alerts IN (%s)", WHERE id_policy_alerts IN (%s)",
$id_pol_alerts); $id_pol_alerts);
@ -3899,31 +3922,37 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) {
} }
if ($module_policy[0]['id_module'] != 1) { if ($module_policy[0]['id_module'] != 1) {
returnError('error_update_data_module_policy', __('Error updating data module in policy. Module type is not network type.')); returnError('error_update_data_module_policy',
__('Error updating data module in policy. Module type is not network type.'));
return; return;
} }
$fields_data_module = array('id','description', 'id_module_group', 'min', 'max', 'post_process', 'module_interval', $fields_data_module = array(
'min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'id','description', 'id_module_group', 'min', 'max',
'history_data', 'configuration_data', 'disabled_types_event', 'module_macros'); 'post_process', 'module_interval', 'min_warning', 'max_warning',
'str_warning', 'min_critical', 'max_critical', 'str_critical',
'history_data', 'configuration_data', 'disabled_types_event',
'module_macros');
$cont = 0; $cont = 0;
foreach ($fields_data_module as $field){ foreach ($fields_data_module as $field) {
if ($other['data'][$cont] != "" and $field != 'id'){ if ($other['data'][$cont] != "" and $field != 'id') {
$values[$field] = $other['data'][$cont]; $values[$field] = $other['data'][$cont];
} }
$cont++; $cont++;
} }
$result_update = enterprise_hook('policies_update_module', array($other['data'][0], $values, false)); $result_update = enterprise_hook('policies_update_module',
array($other['data'][0], $values, false));
if ($result_update < 0) if ($result_update < 0)
returnError('error_update_data_module_policy', 'Error updating policy module.'); returnError('error_update_data_module_policy', 'Error updating policy module.');
else else
returnData('string', array('type' => 'string', 'data' => __('Data policy module updated.'))); returnData('string',
array('type' => 'string', 'data' => __('Data policy module updated.')));
} }
/** /**
@ -4629,33 +4658,46 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
# SNMP version 3 # SNMP version 3
if ($other['data'][12] == "3") { if ($other['data'][12] == "3") {
if ($other['data'][21] != "AES" and $other['data'][21] != "DES"){ if ($other['data'][21] != "AES" and $other['data'][21] != "DES") {
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. ')); returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return; return;
} }
if ($other['data'][23] != "authNoPriv" and $other['data'][23] != "authPriv" and $other['data'][23] != "noAuthNoPriv"){ if ($other['data'][23] != "authNoPriv"
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. ')); and $other['data'][23] != "authPriv"
and $other['data'][23] != "noAuthNoPriv") {
returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return; return;
} }
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA"){ if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") {
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. ')); returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return; return;
} }
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical', $fields_snmp_module = array('id','disabled', 'id_module_group',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', 'custom_string_1', 'max_critical', 'str_critical', 'min_ff_event',
'custom_string_2', 'custom_string_3', 'plugin_parameter', 'plugin_user', 'plugin_pass'); 'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
'custom_id', 'description', 'custom_string_1',
'custom_string_2', 'custom_string_3', 'plugin_parameter',
'plugin_user', 'plugin_pass');
} }
else { else {
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical', $fields_snmp_module = array('id','disabled', 'id_module_group',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description'); 'max_critical', 'str_critical', 'min_ff_event',
'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
'custom_id', 'description');
} }
$cont = 0; $cont = 0;
@ -4667,13 +4709,15 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
$cont++; $cont++;
} }
$result_update = enterprise_hook('policies_update_module', array($other['data'][0], $values, false)); $result_update = enterprise_hook('policies_update_module',
array($other['data'][0], $values, false));
if ($result_update < 0) if ($result_update < 0)
returnError('error_update_snmp_module_policy', 'Error updating policy module.'); returnError('error_update_snmp_module_policy', 'Error updating policy module.');
else else
returnData('string', array('type' => 'string', 'data' => __('SNMP policy module updated.'))); returnData('string',
array('type' => 'string', 'data' => __('SNMP policy module updated.')));
} }
@ -4714,13 +4758,14 @@ function api_set_apply_policy($id, $thrash1, $other, $thrash3) {
} }
} }
if ($duplicated == STATUS_IN_QUEUE_APPLYING or $duplicated == STATUS_IN_QUEUE_IN){ if ($duplicated == STATUS_IN_QUEUE_APPLYING or $duplicated == STATUS_IN_QUEUE_IN) {
// We want to return a value // We want to return a value
if ($other == "return") { if ($other == "return") {
return -1; return -1;
} }
else { else {
returnError('error_apply_policy', __('Error applying policy. This policy is already pending to apply.')); returnError('error_apply_policy',
__('Error applying policy. This policy is already pending to apply.'));
return; return;
} }
} }
@ -5235,19 +5280,22 @@ function api_set_enable_disable_user ($id, $thrash2, $other, $thrash3) {
return; return;
} }
if ($id == ""){ if ($id == "") {
returnError('error_enable_disable_user', 'Error enable/disable user. Id_user cannot be left blank.'); returnError('error_enable_disable_user',
__('Error enable/disable user. Id_user cannot be left blank.'));
return; return;
} }
if ($other['data'][0] != "0" and $other['data'][0] != "1"){ if ($other['data'][0] != "0" and $other['data'][0] != "1") {
returnError('error_enable_disable_user', 'Error enable/disable user. Enable/disable value cannot be left blank.'); returnError('error_enable_disable_user',
__('Error enable/disable user. Enable/disable value cannot be left blank.'));
return; return;
} }
if (users_get_user_by_id($id) == false){ if (users_get_user_by_id($id) == false) {
returnError('error_enable_disable_user', 'Error enable/disable user. The user doesn\'t exists.'); returnError('error_enable_disable_user',
__('Error enable/disable user. The user doesn\'t exists.'));
return; return;
} }
@ -5255,14 +5303,17 @@ function api_set_enable_disable_user ($id, $thrash2, $other, $thrash3) {
if (is_error($result)) { if (is_error($result)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info
returnError('error_enable_disable_user', __('Error in user enabling/disabling.')); returnError('error_enable_disable_user',
__('Error in user enabling/disabling.'));
} }
else { else {
if ($other['data'][0] == "0"){ if ($other['data'][0] == "0") {
returnData('string', array('type' => 'string', 'data' => __('Enabled user.'))); returnData('string',
array('type' => 'string', 'data' => __('Enabled user.')));
} }
else { else {
returnData('string', array('type' => 'string', 'data' => __('Disabled user.'))); returnData('string',
array('type' => 'string', 'data' => __('Disabled user.')));
} }
} }
} }
@ -7696,36 +7747,44 @@ function api_set_enable_disable_agent ($id, $thrash2, $other, $thrash3) {
return; return;
} }
if ($id == ""){ if ($id == "") {
returnError('error_enable_disable_agent', 'Error enable/disable agent. Id_agent cannot be left blank.'); returnError('error_enable_disable_agent',
__('Error enable/disable agent. Id_agent cannot be left blank.'));
return; return;
} }
if ($other['data'][0] != "0" and $other['data'][0] != "1"){ if ($other['data'][0] != "0" and $other['data'][0] != "1") {
returnError('error_enable_disable_agent', 'Error enable/disable agent. Enable/disable value cannot be left blank.'); returnError('error_enable_disable_agent',
__('Error enable/disable agent. Enable/disable value cannot be left blank.'));
return; return;
} }
if (agents_get_name($id) == false){ if (agents_get_name($id) == false) {
returnError('error_enable_disable_agent', 'Error enable/disable agent. The agent doesn\'t exists.'); returnError('error_enable_disable_agent',
__('Error enable/disable agent. The agent doesn\'t exists.'));
return; return;
} }
$disabled = ( $other['data'][0] ? 0 : 1 ); $disabled = ( $other['data'][0] ? 0 : 1 );
$result = db_process_sql_update('tagente', array('disabled' => $disabled), array('id_agente' => $id)); $result = db_process_sql_update('tagente',
array('disabled' => $disabled), array('id_agente' => $id));
if (is_error($result)) { if (is_error($result)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info
returnError('error_enable_disable_agent', __('Error in agent enabling/disabling.')); returnError('error_enable_disable_agent', __('Error in agent enabling/disabling.'));
} }
else { else {
if ($disabled == 0){ if ($disabled == 0) {
returnData('string', array('type' => 'string', 'data' => __('Enabled agent.'))); returnData('string',
array('type' => 'string',
'data' => __('Enabled agent.')));
} }
else { else {
returnData('string', array('type' => 'string', 'data' => __('Disabled agent.'))); returnData('string',
array('type' => 'string',
'data' => __('Disabled agent.')));
} }
} }
} }

View File

@ -277,7 +277,7 @@ function clippy_context_help($help = null) {
} }
$(document).ready(function() { $(document).ready(function() {
(function pulse_' . $id . '(){ (function pulse_' . $id . '() {
$("#' . $id . ' img") $("#' . $id . ' img")
.delay(100) .delay(100)
.animate({\'opacity\': 1}) .animate({\'opacity\': 1})

View File

@ -842,7 +842,7 @@ function config_process_config () {
// the first time make a conenction and disable itself // the first time make a conenction and disable itself
// Not Managed here ! // Not Managed here !
// if (!isset ($config["autoupdate"])){ // if (!isset ($config["autoupdate"])) {
// config_update_value ('autoupdate', true); // config_update_value ('autoupdate', true);
// } // }

View File

@ -119,7 +119,7 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr
continue; continue;
if ($graph["id_group"] > 0) if ($graph["id_group"] > 0)
if (!isset($groups[$graph["id_group"]])){ if (!isset($groups[$graph["id_group"]])) {
continue; continue;
} }

View File

@ -420,7 +420,7 @@ function db_get_sql ($sql, $field = 0, $search_history_db = false) {
return false; return false;
$ax = 0; $ax = 0;
foreach ($result[0] as $f){ foreach ($result[0] as $f) {
if ($field == $ax) if ($field == $ax)
return $f; return $f;
$ax++; $ax++;

View File

@ -851,7 +851,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
if ($result === false) { if ($result === false) {
if ($return){ if ($return) {
$returned = ui_print_info_message ( __('No events'),'',true ); $returned = ui_print_info_message ( __('No events'),'',true );
return $returned; return $returned;
} }
@ -1386,12 +1386,12 @@ function events_get_module ($id_agent_module, $period, $date = 0) {
* *
* @return string Type description. * @return string Type description.
*/ */
function events_get_event_types ($type_id){ function events_get_event_types ($type_id) {
$diferent_types = get_event_types (); $diferent_types = get_event_types ();
$type_desc = ''; $type_desc = '';
switch($type_id) { switch ($type_id) {
case 'unknown': case 'unknown':
$type_desc = __('Unknown'); $type_desc = __('Unknown');
break; break;
@ -1434,7 +1434,7 @@ function events_get_event_types ($type_id){
default: default:
if (isset($config['text_char_long'])) { if (isset($config['text_char_long'])) {
foreach ($diferent_types as $key => $type) { foreach ($diferent_types as $key => $type) {
if ($key == $type_id){ if ($key == $type_id) {
$type_desc = ui_print_truncate_text($type, $config['text_char_long'], false, true, false); $type_desc = ui_print_truncate_text($type, $config['text_char_long'], false, true, false);
} }
} }
@ -1453,7 +1453,7 @@ function events_get_event_types ($type_id){
* *
* @return string Severity description. * @return string Severity description.
*/ */
function events_get_severity_types ($severity_id){ function events_get_severity_types ($severity_id) {
$diferent_types = get_priorities (); $diferent_types = get_priorities ();
@ -1477,8 +1477,9 @@ function events_get_severity_types ($severity_id){
default: default:
if (isset($config['text_char_long'])) { if (isset($config['text_char_long'])) {
foreach ($diferent_types as $key => $type) { foreach ($diferent_types as $key => $type) {
if ($key == $severity_id){ if ($key == $severity_id) {
$severity_desc = ui_print_truncate_text($type, $config['text_char_long'], false, true, false); $severity_desc = ui_print_truncate_text($type,
$config['text_char_long'], false, true, false);
} }
} }
} }
@ -1634,7 +1635,7 @@ function events_get_event_filter_select($manage = true) {
} }
else { else {
$result = array(); $result = array();
foreach ($event_filters as $event_filter){ foreach ($event_filters as $event_filter) {
$result[$event_filter['id_filter']] = $event_filter['id_name']; $result[$event_filter['id_filter']] = $event_filter['id_name'];
} }
} }

View File

@ -546,7 +546,7 @@ function filemanager_file_explorer($real_directory, $relative_directory,
$table->class = 'databox data'; $table->class = 'databox data';
$table->title = '<span>' . __('Index of %s', $relative_directory) . '</span>'; $table->title = '<span>' . __('Index of %s', $relative_directory) . '</span>';
} }
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox_tactical'; $table->class = 'databox_tactical';
$table->title = '<span>' . __('Index of images') . '</span>'; $table->title = '<span>' . __('Index of images') . '</span>';

View File

@ -31,26 +31,29 @@
* *
* @return array Void array or prediction of the module data. * @return array Void array or prediction of the module data.
*/ */
function forecast_projection_graph($module_id, $period = 5184000, $prediction_period, $max_value = false, $min_value = false, $csv = false){ function forecast_projection_graph($module_id,
$period = SECONDS_2MONTHS, $prediction_period, $max_value = false,
$min_value = false, $csv = false) {
global $config; global $config;
$max_exec_time = ini_get('max_execution_time'); $max_exec_time = ini_get('max_execution_time');
if ($max_exec_time !== false) { if ($max_exec_time !== false) {
$max_exec_time = (int)$max_exec_time; $max_exec_time = (int)$max_exec_time;
} }
$begin_time = time(); $begin_time = time();
$module_data=grafico_modulo_sparse ($module_id, $period, 0, $module_data=grafico_modulo_sparse ($module_id, $period, 0,
300, 300 , '', null, 300, 300 , '', null,
false, 0, false, false, 0, false,
0, '', 0, 1, false, 0, '', 0, 1, false,
true, '', 1, true); true, '', 1, true);
if (empty($module_data)){ if (empty($module_data)) {
return array(); return array();
} }
// Prevents bad behaviour over image error // Prevents bad behaviour over image error
@ -245,7 +248,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]); //html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
// Found it // Found it
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){ if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]) {
return $current_ts; return $current_ts;
} }
} }
@ -269,7 +272,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
* *
* @return mixed timestamp with the prediction date or false * @return mixed timestamp with the prediction date or false
*/ */
function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0, $min_value = 0){ function forecast_prediction_date ($module_id,
$period = SECONDS_2MONTHS, $max_value = 0, $min_value = 0) {
// Checks interval // Checks interval
if ($min_value > $max_value) { if ($min_value > $max_value) {
return false; return false;

View File

@ -374,7 +374,7 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
$timestamp_short = date($time_format, $timestamp); $timestamp_short = date($time_format, $timestamp);
$long_index[$timestamp_short] = date( $long_index[$timestamp_short] = date(
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp); html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
if (!$projection){ if (!$projection) {
$timestamp = $timestamp_short; $timestamp = $timestamp_short;
} }
@ -924,13 +924,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ($projection != false) { if ($projection != false) {
$j = $datelimit; $j = $datelimit;
$in_range = true; $in_range = true;
while ($in_range){ while ($in_range) {
$timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2); $timestamp_f = graph_get_formatted_date($j, $time_format, $time_format_2);
//$timestamp_f = date('d M Y H:i:s', $j); //$timestamp_f = date('d M Y H:i:s', $j);
$before_projection[$timestamp_f] = 0; $before_projection[$timestamp_f] = 0;
if ($j > $date){ if ($j > $date) {
$in_range = false; $in_range = false;
} }
$j = $j + $interval; $j = $j + $interval;
@ -2001,17 +2001,19 @@ function graph_db_agentes_modulos($width, $height) {
$data = array (); $data = array ();
switch ($config['dbtype']){ switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente $modules = db_get_all_rows_sql ('
SELECT COUNT(id_agente_modulo), id_agente
FROM tagente_modulo FROM tagente_modulo
WHERE delete_pending = 0 WHERE delete_pending = 0
GROUP BY id_agente GROUP BY id_agente
ORDER BY 1 DESC LIMIT 10'); ORDER BY 1 DESC LIMIT 10');
break; break;
case "oracle": case "oracle":
$modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente $modules = db_get_all_rows_sql ('
SELECT COUNT(id_agente_modulo), id_agente
FROM tagente_modulo FROM tagente_modulo
WHERE rownum <= 10 WHERE rownum <= 10
AND delete_pending = 0 AND delete_pending = 0
@ -2029,7 +2031,7 @@ function graph_db_agentes_modulos($width, $height) {
if (empty($agent_name)) { if (empty($agent_name)) {
continue; continue;
} }
switch ($config['dbtype']){ switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$data[$agent_name]['g'] = $module['COUNT(id_agente_modulo)']; $data[$agent_name]['g'] = $module['COUNT(id_agente_modulo)'];
@ -2678,7 +2680,7 @@ function graph_custom_sql_graph ($id, $width, $height,
global $config; global $config;
$report_content = db_get_row ('treport_content', 'id_rc', $id); $report_content = db_get_row ('treport_content', 'id_rc', $id);
if ($report_content["external_source"] != ""){ if ($report_content["external_source"] != "") {
$sql = io_safe_output ($report_content["external_source"]); $sql = io_safe_output ($report_content["external_source"]);
} }
else { else {
@ -4056,7 +4058,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
$rows = 0; $rows = 0;
$first = true; $first = true;
while ($row = get_db_all_row_by_steps_sql($first, $result, $sql1)){ while ($row = get_db_all_row_by_steps_sql($first, $result, $sql1)) {
$first = false; $first = false;
$rows++; $rows++;
@ -4135,7 +4137,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
grafico_modulo_log4x_trace(__LINE__); grafico_modulo_log4x_trace(__LINE__);
if ($pure == 0){ if ($pure == 0) {
$Graph->add( $Graph->add(
Image_Graph::horizontal( Image_Graph::horizontal(
Image_Graph::vertical( Image_Graph::vertical(
@ -4179,7 +4181,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
$dataset[$i] = Image_Graph::factory('dataset'); $dataset[$i] = Image_Graph::factory('dataset');
$dataset[$i]->setName($severity); $dataset[$i]->setName($severity);
if (isset($valores[$severity])){ if (isset($valores[$severity])) {
$data =& $valores[$severity]; $data =& $valores[$severity];
while (list($index, $data2) = each($data)) { while (list($index, $data2) = each($data)) {
$count = $data2['count']; $count = $data2['count'];
@ -4275,7 +4277,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
//$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); //$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
// Show events ! // Show events !
if ($show_event == 1){ if ($show_event == 1) {
$Plot =& $Plotarea->addNew('Plot_Impulse', array($dataset_event)); $Plot =& $Plotarea->addNew('Plot_Impulse', array($dataset_event));
$Plot->setLineColor( 'red' ); $Plot->setLineColor( 'red' );
$Marker_event =& Image_Graph::factory('Image_Graph_Marker_Cross'); $Marker_event =& Image_Graph::factory('Image_Graph_Marker_Cross');

View File

@ -1118,7 +1118,7 @@ function groups_get_group_by_id($id_group) {
* @return mixed Return group_id or false if something goes wrong * @return mixed Return group_id or false if something goes wrong
* *
*/ */
function groups_create_group($group_name, $rest_values){ function groups_create_group($group_name, $rest_values) {
if ($group_name == "") { if ($group_name == "") {
return false; return false;
@ -1992,7 +1992,7 @@ function groups_monitor_fired_alerts ($group_array, $strict_user = false, $id_gr
return 0; return 0;
} }
else if (!is_array ($group_array)){ else if (!is_array ($group_array)) {
$group_array = array($group_array); $group_array = array($group_array);
} }
@ -2069,7 +2069,7 @@ function groups_agent_disabled ($group_array) {
return 0; return 0;
} }
else if (!is_array ($group_array)){ else if (!is_array ($group_array)) {
$group_array = array($group_array); $group_array = array($group_array);
} }

View File

@ -336,10 +336,10 @@ function io_safe_output_xml ($string) {
static $replace; static $replace;
if (empty ($table)) { if (empty ($table)) {
$table = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES); $table = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES);
$replace = array (); $replace = array ();
foreach ($table as $key => $value){ foreach ($table as $key => $value) {
$table[$key] = "/".$value."/"; $table[$key] = "/".$value."/";
$char = htmlentities ($key, ENT_QUOTES, "UTF-8"); $char = htmlentities ($key, ENT_QUOTES, "UTF-8");
$replace[$char] = "&#".ord ($key).";"; $replace[$char] = "&#".ord ($key).";";
@ -431,7 +431,7 @@ function __ ($string /*, variable arguments */) {
* *
* @param string Text string to be encoded. * @param string Text string to be encoded.
*/ */
function io_json_mb_encode($string){ function io_json_mb_encode($string) {
$v = json_encode($string); $v = json_encode($string);
$v = preg_replace_callback("/\\\\u([0-9a-zA-Z]{4})/", $v = preg_replace_callback("/\\\\u([0-9a-zA-Z]{4})/",
create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UTF-16");' create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UTF-16");'

View File

@ -105,7 +105,7 @@ function menu_print_menu (&$menu) {
$subsec2 = io_safe_output($subsec2); $subsec2 = io_safe_output($subsec2);
// Choose valid suboptions (sec2) // Choose valid suboptions (sec2)
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $subsec2)) == false){ if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $subsec2)) == false) {
continue; continue;
} }
@ -341,7 +341,7 @@ function menu_print_menu (&$menu) {
} }
// Choose valid section (sec) // Choose valid section (sec)
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $main["sec2"])) == false){ if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $main["sec2"])) == false) {
if ($count_sub_access > 0) { if ($count_sub_access > 0) {
// If any susection have access but main section not, we change main link to first subsection found // If any susection have access but main section not, we change main link to first subsection found
$main["sec2"] = $first_sub_sec2; $main["sec2"] = $first_sub_sec2;

View File

@ -633,7 +633,7 @@ function modules_format_data($data)
* *
* @return string HTML string data with verbatim format. * @return string HTML string data with verbatim format.
*/ */
function modules_format_verbatim($data){ function modules_format_verbatim($data) {
// We need to replace \n by <br> to create a "similar" output to // We need to replace \n by <br> to create a "similar" output to
// information recolected in logs. // information recolected in logs.
$data2 = preg_replace ("/\\n/", "<br>", $data); $data2 = preg_replace ("/\\n/", "<br>", $data);
@ -731,8 +731,9 @@ function modules_get_agentmodule ($id_agentmodule) {
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
break; break;
case "oracle": case "oracle":
$fields = db_get_all_rows_filter('USER_TAB_COLUMNS', 'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME'); $fields = db_get_all_rows_filter('USER_TAB_COLUMNS',
foreach ($fields as $field){ 'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME');
foreach ($fields as $field) {
$fields_[] = $field['column_name']; $fields_[] = $field['column_name'];
} }
$fields = implode(',', $fields_); $fields = implode(',', $fields_);

View File

@ -91,7 +91,7 @@ function netflow_check_filter_group ($id_sg) {
$groups_id = array(); $groups_id = array();
$has_permission = false; $has_permission = false;
foreach($groups_user as $key => $groups){ foreach($groups_user as $key => $groups) {
if ($groups['id_grupo'] == $id_group) if ($groups['id_grupo'] == $id_group)
return true; return true;
} }
@ -117,7 +117,7 @@ function netflow_check_report_group ($id_report, $mode=false) {
$groups_id = array(); $groups_id = array();
$has_permission = false; $has_permission = false;
foreach($groups_user as $key => $groups){ foreach ($groups_user as $key => $groups) {
if ($groups['id_grupo'] == $id_group) if ($groups['id_grupo'] == $id_group)
return true; return true;
} }
@ -162,7 +162,7 @@ function netflow_reports_get_reports ($id_report, $filter = false, $fields = fal
return db_get_row_filter ('tnetflow_report', $filter, $fields); return db_get_row_filter ('tnetflow_report', $filter, $fields);
} }
function netflow_reports_get_content ($id_rc, $filter = false, $fields = false){ function netflow_reports_get_content ($id_rc, $filter = false, $fields = false) {
if (empty ($id_rc)) if (empty ($id_rc))
return false; return false;
if (! is_array ($filter)) if (! is_array ($filter))
@ -205,9 +205,9 @@ function sort_netflow_data (&$netflow_data) {
* *
* @return The statistics table. * @return The statistics table.
*/ */
function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){ function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit) {
global $nfdump_date_format; global $nfdump_date_format;
$start_date = date ($nfdump_date_format, $start_date); $start_date = date ($nfdump_date_format, $start_date);
$end_date = date ($nfdump_date_format, $end_date); $end_date = date ($nfdump_date_format, $end_date);
$values = array(); $values = array();
@ -223,10 +223,10 @@ function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
$table->head[1] = '<b>' . netflow_format_unit ($unit) . '</b>'; $table->head[1] = '<b>' . netflow_format_unit ($unit) . '</b>';
$table->style[0] = 'padding: 6px'; $table->style[0] = 'padding: 6px';
$table->style[1] = 'padding: 6px'; $table->style[1] = 'padding: 6px';
while (isset ($data[$j])) { while (isset ($data[$j])) {
$agg = $data[$j]['agg']; $agg = $data[$j]['agg'];
if (!isset($values[$agg])){ if (!isset($values[$agg])) {
$values[$agg] = $data[$j]['data']; $values[$agg] = $data[$j]['data'];
$table->data[$x][0] = $agg; $table->data[$x][0] = $agg;
$table->data[$x][1] = format_numeric ($data[$j]['data']) . '&nbsp;' . netflow_format_unit ($unit); $table->data[$x][1] = format_numeric ($data[$j]['data']) . '&nbsp;' . netflow_format_unit ($unit);
@ -467,7 +467,7 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
$string[0] = ''; $string[0] = '';
// Parse aggregates // Parse aggregates
foreach($string as $line){ foreach ($string as $line) {
if ($line=='') { if ($line=='') {
continue; continue;
} }
@ -502,7 +502,8 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
if (isset ($filter[$extra_filter]) && $filter[$extra_filter] != '') { if (isset ($filter[$extra_filter]) && $filter[$extra_filter] != '') {
$filter[$extra_filter] .= ','; $filter[$extra_filter] .= ',';
} }
$filter[$extra_filter] = implode (',', array_keys ($values['sources'])); $filter[$extra_filter] = implode (',',
array_keys($values['sources']));
} }
else { else {
$values = array (); $values = array ();
@ -513,7 +514,7 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
if ($address_resolution && ($aggregate == "srcip" || $aggregate == "dstip")) { if ($address_resolution && ($aggregate == "srcip" || $aggregate == "dstip")) {
$get_hostnames = true; $get_hostnames = true;
global $hostnames; global $hostnames;
$sources = array(); $sources = array();
foreach ($values['sources'] as $source => $value) { foreach ($values['sources'] as $source => $value) {
if (!isset($hostnames[$source])) { if (!isset($hostnames[$source])) {
@ -531,9 +532,9 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
$values['sources'] = $sources; $values['sources'] = $sources;
} }
// Address resolution end // Address resolution end
$interval_start = $start_date; $interval_start = $start_date;
for ($i = 0; $i < $num_intervals; $i++, $interval_start+=$interval_length+1) { for ($i = 0; $i < $num_intervals; $i++, $interval_start += $interval_length + 1) {
$interval_end = $interval_start + $interval_length; $interval_end = $interval_start + $interval_length;
if ($interval_end > $end_date) { if ($interval_end > $end_date) {
$interval_end = $end_date; $interval_end = $end_date;
@ -570,10 +571,14 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
foreach ($values['sources'] as $source => $discard) { foreach ($values['sources'] as $source => $discard) {
$values['data'][$interval_start][$source] = 0; $values['data'][$interval_start][$source] = 0;
} }
$data = netflow_get_stats ($interval_start, $interval_end, $filter, $aggregate, $max, $unit, $connection_name);
$data = netflow_get_stats($interval_start,
$interval_end, $filter, $aggregate, $max, $unit,
$connection_name);
foreach ($data as $line) { foreach ($data as $line) {
// Address resolution start // Address resolution start
if ($get_hostnames) { if ($get_hostnames) {
if (!isset($hostnames[$line['agg']])) { if (!isset($hostnames[$line['agg']])) {
@ -693,7 +698,7 @@ function netflow_get_stats ($start_date, $end_date, $filter, $aggregate, $max, $
return array (); return array ();
} }
switch ($unit){ switch ($unit) {
case "megabytes": case "megabytes":
$values[$i]['data'] = $val[9] / 1048576; $values[$i]['data'] = $val[9] / 1048576;
break; break;
@ -818,8 +823,8 @@ function netflow_get_record ($start_date, $end_date, $filter, $max, $unit, $addr
$data['source_port'] = $items[5]; $data['source_port'] = $items[5];
$data['destination_port'] = $items[6]; $data['destination_port'] = $items[6];
$data['protocol'] = $items[7]; $data['protocol'] = $items[7];
switch ($unit){ switch ($unit) {
case "megabytes": case "megabytes":
$data['data'] = $items[12] / 1048576; $data['data'] = $items[12] / 1048576;
break; break;
@ -921,7 +926,7 @@ function netflow_get_filter_arguments ($filter) {
if ($filter['ip_dst'] != '') { if ($filter['ip_dst'] != '') {
$filter_args .= ' "('; $filter_args .= ' "(';
$val_ipdst = explode(',', io_safe_output ($filter['ip_dst'])); $val_ipdst = explode(',', io_safe_output ($filter['ip_dst']));
for($i = 0; $i < count ($val_ipdst); $i++){ for ($i = 0; $i < count ($val_ipdst); $i++) {
if ($i > 0) { if ($i > 0) {
$filter_args .= ' or '; $filter_args .= ' or ';
} }
@ -1619,22 +1624,22 @@ function netflow_summary_xml ($data) {
* @param string Netflow unit. * @param string Netflow unit.
*/ */
function netflow_format_unit ($unit) { function netflow_format_unit ($unit) {
switch ($unit){ switch ($unit) {
case 'megabytes': case 'megabytes':
return __('MB'); return __('MB');
case 'megabytespersecond': case 'megabytespersecond':
return __('MB/s'); return __('MB/s');
case 'kilobytes': case 'kilobytes':
return __('kB'); return __('kB');
case 'kilobytespersecond': case 'kilobytespersecond':
return __('kB/s'); return __('kB/s');
case 'bytes': case 'bytes':
return __('Bytes'); return __('Bytes');
case 'bytespersecond': case 'bytespersecond':
return __('B/s'); return __('B/s');
default: default:
return ''; return '';
} }
} }
/** /**
@ -1643,20 +1648,20 @@ function netflow_format_unit ($unit) {
* @param string Netflow aggregate. * @param string Netflow aggregate.
*/ */
function netflow_format_aggregate ($aggregate) { function netflow_format_aggregate ($aggregate) {
switch ($aggregate){ switch ($aggregate) {
case 'dstport': case 'dstport':
return __('Dst port'); return __('Dst port');
case 'dstip': case 'dstip':
return __('Dst IP'); return __('Dst IP');
case 'proto': case 'proto':
return __('Protocol'); return __('Protocol');
case 'srcip': case 'srcip':
return __('Src IP'); return __('Src IP');
case 'srcport': case 'srcport':
return __('Src port'); return __('Src port');
default: default:
return ''; return '';
} }
} }
/** /**

View File

@ -5286,7 +5286,7 @@ function reporting_get_stats_alerts($data, $links = false) {
$table_al->rowclass[] = ''; $table_al->rowclass[] = '';
$table_al->data[] = $tdata; $table_al->data[] = $tdata;
if(!defined('METACONSOLE')){ if(!defined('METACONSOLE')) {
$output = '<fieldset class="databox tactical_set"> $output = '<fieldset class="databox tactical_set">
<legend>' . <legend>' .
__('Defined and fired alerts') . __('Defined and fired alerts') .
@ -5383,7 +5383,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
$table_mbs->data[] = $tdata; $table_mbs->data[] = $tdata;
} }
if(!defined("METACONSOLE")){ if(!defined("METACONSOLE")) {
$output = ' $output = '
<fieldset class="databox tactical_set"> <fieldset class="databox tactical_set">
<legend>' . <legend>' .
@ -7568,7 +7568,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
// Get module type // Get module type
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); $id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
// If module is boolean don't create translation intervals (on the edge intervals) // If module is boolean don't create translation intervals (on the edge intervals)
// if ($id_module_type == 2 or $id_module_type == 6 or $id_module_type == 9 or $id_module_type == 18){ // if ($id_module_type == 2 or $id_module_type == 6 or $id_module_type == 9 or $id_module_type == 18) {
// $percent = 0; // $percent = 0;
// } // }
// else { // else {

View File

@ -2533,7 +2533,7 @@ function reporting_template_graphs_get_user ($id_user = 0, $only_names = false,
continue; continue;
if ($template["id_group"] > 0) if ($template["id_group"] > 0)
if (!isset($groups[$template["id_group"]])){ if (!isset($groups[$template["id_group"]])) {
continue; continue;
} }
@ -2646,7 +2646,7 @@ function reporting_get_total_servers ($num_servers) {
$node_data[1] = "<b><span style='font-size: 12pt; font-weight: bold; color: black;'>".format_numeric($num_servers)."</span></b>"; $node_data[1] = "<b><span style='font-size: 12pt; font-weight: bold; color: black;'>".format_numeric($num_servers)."</span></b>";
$table_node->data[] = $node_data; $table_node->data[] = $node_data;
if (!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
$node_overview = '<fieldset class="databox tactical_set"> $node_overview = '<fieldset class="databox tactical_set">
<legend>' . <legend>' .
__('Node overview') . __('Node overview') .
@ -2674,7 +2674,7 @@ function reporting_get_events ($data, $links = false) {
$style = " vertical-align:middle;"; $style = " vertical-align:middle;";
else else
$style = ""; $style = "";
if (defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table_events->style[0] = "background-color:#FC4444"; $table_events->style[0] = "background-color:#FC4444";
$table_events->data[0][0] = html_print_image('images/module_event_critical.png', true, array('title' => __('Critical events'))); $table_events->data[0][0] = html_print_image('images/module_event_critical.png', true, array('title' => __('Critical events')));
$table_events->data[0][0] .= "&nbsp;&nbsp;&nbsp;" . $table_events->data[0][0] .= "&nbsp;&nbsp;&nbsp;" .

View File

@ -2422,7 +2422,7 @@ function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_an
if ($return_all_fields) { if ($return_all_fields) {
return $user_agents; return $user_agents;
} }
if (!$meta){ if (!$meta) {
$user_agents_aux = array(); $user_agents_aux = array();
foreach ($user_agents as $ua) { foreach ($user_agents as $ua) {

View File

@ -879,7 +879,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$actionText = '<div><ul class="action_list">'; $actionText = '<div><ul class="action_list">';
foreach ($actions as $action) { foreach ($actions as $action) {
$actionText .= '<div style="margin-bottom: 5px;" ><span class="action_name"><li>' . $action['name']; $actionText .= '<div style="margin-bottom: 5px;" ><span class="action_name"><li>' . $action['name'];
if ($action["fires_min"] != $action["fires_max"]){ if ($action["fires_min"] != $action["fires_max"]) {
$actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")"; $actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")";
} }
$actionText .= '</li></span></div>'; $actionText .= '</li></span></div>';
@ -1338,7 +1338,7 @@ function ui_process_page_head ($string, $bitfield) {
if ($login_ok and $isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($login_ok and $isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
//Checks if user's skin is available //Checks if user's skin is available
$exists_skin = enterprise_hook('skins_is_path_set'); $exists_skin = enterprise_hook('skins_is_path_set');
if ($exists_skin){ if ($exists_skin) {
$skin_path = enterprise_hook('skins_get_skin_path'); $skin_path = enterprise_hook('skins_get_skin_path');
$skin_styles = themes_get_css ($skin_path . 'include/styles/'); $skin_styles = themes_get_css ($skin_path . 'include/styles/');
$exists_css = !empty($skin_styles); $exists_css = !empty($skin_styles);
@ -1346,7 +1346,7 @@ function ui_process_page_head ($string, $bitfield) {
} }
//If skin's css files exists then add them //If skin's css files exists then add them
if ($exists_css) { if ($exists_css) {
foreach ($skin_styles as $filename => $name){ foreach ($skin_styles as $filename => $name) {
$style = substr ($filename, 0, strlen ($filename) - 4); $style = substr ($filename, 0, strlen ($filename) - 4);
$config['css'][$style] = $skin_path . 'include/styles/' . $filename; $config['css'][$style] = $skin_path . 'include/styles/' . $filename;
} }
@ -2362,7 +2362,7 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
* @return string Header HTML * @return string Header HTML
*/ */
function ui_print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = ""){ function ui_print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = "") {
$title = io_safe_input_html($title); $title = io_safe_input_html($title);
if (($icon == "") && ($godmode == true)) { if (($icon == "") && ($godmode == true)) {
$icon = "images/gm_setup.png"; $icon = "images/gm_setup.png";

View File

@ -292,7 +292,7 @@ function users_access_to_agent ($id_agent, $mode = "AR", $id_user = false) {
* *
* @return mixed User row or false if something goes wrong * @return mixed User row or false if something goes wrong
*/ */
function users_get_user_by_id ($id_user){ function users_get_user_by_id ($id_user) {
$result_user = db_get_row('tusuario', 'id_user', $id_user); $result_user = db_get_row('tusuario', 'id_user', $id_user);
return $result_user; return $result_user;

View File

@ -2131,8 +2131,9 @@ function visual_map_get_layoutdata_x ($id_layoutdata) {
* *
* @return int The Y axis coordinate value. * @return int The Y axis coordinate value.
*/ */
function visual_map_get_layoutdata_y ($id_layoutdata){ function visual_map_get_layoutdata_y ($id_layoutdata) {
return (float) db_get_value ('pos_y', 'tlayout_data', 'id', (int) $id_layoutdata); return (float) db_get_value ('pos_y', 'tlayout_data', 'id',
(int)$id_layoutdata);
} }
function visual_map_type_in_js($type) { function visual_map_type_in_js($type) {

View File

@ -355,7 +355,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$red); ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$red);
elseif ($rating == 100) elseif ($rating == 100)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$green); ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$green);
else if ($rating > 0){ else if ($rating > 0) {
if ($radius != 0 && $rating < 30) { if ($radius != 0 && $rating < 30) {
$x2 = $ratingbar30; $x2 = $ratingbar30;
} }

View File

@ -803,7 +803,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
if (isset($size['Height'])) { if (isset($size['Height'])) {
/* Define the chart area */ /* Define the chart area */
//if ($yaxisname != ''){ //if ($yaxisname != '') {
//} //}
$myPicture->setGraphArea($chart_size,$size['Height'],$width - $water_mark_width,$height - $margin_bottom); $myPicture->setGraphArea($chart_size,$size['Height'],$width - $water_mark_width,$height - $margin_bottom);
} }

View File

@ -114,7 +114,7 @@ class Swift_CharacterReader_Utf8Reader
++$foundChars; ++$foundChars;
$invalid=false; $invalid=false;
} }
if (($i+$size) > $strlen){ if (($i+$size) > $strlen) {
$ignoredChars=substr($string, $i); $ignoredChars=substr($string, $i);
break; break;
} }

View File

@ -700,9 +700,9 @@ class Ui {
} }
} }
echo "<script type='text/javascript'> echo "<script type='text/javascript'>
$(document).bind('mobileinit', function(){ $(document).bind('mobileinit', function() {
//Disable ajax link //Disable ajax link
$('.disable-ajax').click(function(event){ $('.disable-ajax').click(function(event) {
$.mobile.ajaxFormsEnabled = false; $.mobile.ajaxFormsEnabled = false;
}); });
}); });
@ -725,7 +725,7 @@ class Ui {
} }
}); });
} }
$(document).ready(function(){ $(document).ready(function() {
refresh_link_listener_" . $table_name . "(); refresh_link_listener_" . $table_name . "();
}); });
</script>"); </script>");

View File

@ -214,7 +214,7 @@ class Agent {
$ui->contentAddLinkListener('list_agent_Modules'); $ui->contentAddLinkListener('list_agent_Modules');
$ui->contentAddHtml("<script type=\"text/javascript\"> $ui->contentAddHtml("<script type=\"text/javascript\">
$(document).ready(function(){ $(document).ready(function() {
function set_same_heigth() { function set_same_heigth() {
//Set same height to boxes //Set same height to boxes
var max_height = 0; var max_height = 0;

View File

@ -150,7 +150,7 @@ class Tactical {
$ui->contentCollapsibleAddItem($table->getHTML()); $ui->contentCollapsibleAddItem($table->getHTML());
$ui->contentEndCollapsible(); $ui->contentEndCollapsible();
$ui->contentAddHtml("<script type=\"text/javascript\"> $ui->contentAddHtml("<script type=\"text/javascript\">
$(document).ready(function(){ $(document).ready(function() {
function set_same_heigth() { function set_same_heigth() {
//Set same height to boxes //Set same height to boxes
var max_height = 0; var max_height = 0;

View File

@ -43,7 +43,7 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->cellpadding = '0'; $table->cellpadding = '0';
$table->cellspacing = '0'; $table->cellspacing = '0';
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->class = 'databox_filters'; $table->class = 'databox_filters';
$table->width = '96%'; $table->width = '96%';
$table->cellpadding = '0'; $table->cellpadding = '0';
@ -56,7 +56,7 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st
$table->style[2] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;'; $table->style[3] = 'font-weight: bold;';
$table->style[4] = 'font-weight: bold;'; $table->style[4] = 'font-weight: bold;';
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->style[0] = 'vertical-align:middle; font-weight: bold;'; $table->style[0] = 'vertical-align:middle; font-weight: bold;';
$table->style[1] = 'vertical-align:middle; font-weight: bold;'; $table->style[1] = 'vertical-align:middle; font-weight: bold;';
$table->style[2] = 'vertical-align:middle; font-weight: bold;'; $table->style[2] = 'vertical-align:middle; font-weight: bold;';
@ -101,7 +101,7 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st
$table->data[1][2] = __('Standby'); $table->data[1][2] = __('Standby');
$table->data[1][3] = html_print_select ($alert_standby, "filter_standby", $filter_standby, '', '', '', true); $table->data[1][3] = html_print_select ($alert_standby, "filter_standby", $filter_standby, '', '', '', true);
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->data[0][7] = html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub filter"', true); $table->data[0][7] = html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub filter"', true);
$table->rowspan[0][7] = 2; $table->rowspan[0][7] = 2;
$data = '<form style="background-color: #ECECEC;" method="post" action="'.$url.'">'; $data = '<form style="background-color: #ECECEC;" method="post" action="'.$url.'">';

View File

@ -373,11 +373,17 @@ if ($pure) {
// Filter form // Filter form
if ($print_agent) { if ($print_agent) {
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Show Options'));; ui_toggle(
printFormFilterAlert($id_group, $filter, $free_search,
$url, $filter_standby, $tag_filter, true, $strict_user),
__('Show Options'));;
} }
else { else {
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Alert control filter'), __('Toggle filter(s)')); ui_toggle(
printFormFilterAlert($id_group, $filter, $free_search,
$url, $filter_standby, $tag_filter, true, $strict_user),
__('Alert control filter'), __('Toggle filter(s)'));
} }
} }
@ -386,7 +392,7 @@ $table->width = '100%';
$table->class = "databox data"; $table->class = "databox data";
$table->cellpadding = '0'; $table->cellpadding = '0';
$table->cellspacing = '0'; $table->cellspacing = '0';
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
$table->class = "databox"; $table->class = "databox";
$table->cellpadding = '0'; $table->cellpadding = '0';
$table->cellspacing = '0'; $table->cellspacing = '0';
@ -622,23 +628,26 @@ $(document).ready (function () {
} }
}); });
$('#ag_group').change (function (){ $('#ag_group').change (function () {
strict_user = $("#text-strict_user_hidden").val(); strict_user = $("#text-strict_user_hidden").val();
is_meta = $("#text-is_meta_hidden").val(); is_meta = $("#text-is_meta_hidden").val();
if (($("#ag_group").val() != 0) && (strict_user != 0)) { if (($("#ag_group").val() != 0) && (strict_user != 0)) {
$("#tag_filter").css('display', 'none'); $("#tag_filter").css('display', 'none');
if (is_meta) { if (is_meta) {
$("#table1-0-4").css('display', 'none'); $("#table1-0-4").css('display', 'none');
} else { }
else {
$("#table2-0-4").css('display', 'none'); $("#table2-0-4").css('display', 'none');
} }
} else { }
else {
$("#tag_filter").css('display', ''); $("#tag_filter").css('display', '');
if (is_meta) { if (is_meta) {
$("#table1-0-4").css('display', ''); $("#table1-0-4").css('display', '');
} else { }
else {
$("#table2-0-4").css('display', ''); $("#table2-0-4").css('display', '');
} }
} }

View File

@ -447,7 +447,7 @@ function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
FROM tmodule_group ORDER BY name"); FROM tmodule_group ORDER BY name");
$rows = io_safe_output($rows); $rows = io_safe_output($rows);
$rows_select = array(); $rows_select = array();
if (!empty($rows)){ if (!empty($rows)) {
$rows_select[-1] = __('All'); $rows_select[-1] = __('All');
foreach ($rows as $module_group) foreach ($rows as $module_group)
$rows_select[$module_group['id_mg']] = __($module_group['name']); $rows_select[$module_group['id_mg']] = __($module_group['name']);

View File

@ -27,7 +27,7 @@ if (! check_acl ($config['id_user'], 0, "AR") && ! check_acl ($config['id_user']
return; return;
} }
if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ) {
$id_agentmodule = $_GET["agentmodule"]; $id_agentmodule = $_GET["agentmodule"];
$id_agent = $_GET["agent"]; $id_agent = $_GET["agent"];
$agentmodule_name = modules_get_agentmodule_name ($id_agentmodule); $agentmodule_name = modules_get_agentmodule_name ($id_agentmodule);
@ -37,13 +37,13 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
require ("../../general/noaccess.php"); require ("../../general/noaccess.php");
exit; exit;
} }
$now = date("Y/m/d H:i:s"); $now = date("Y/m/d H:i:s");
// Show contentype header // Show contentype header
Header("Content-type: text/txt"); Header("Content-type: text/txt");
header('Content-Disposition: attachment; filename="pandora_export_'.$agentmodule_name.'.txt"'); header('Content-Disposition: attachment; filename="pandora_export_' . $agentmodule_name . '.txt"');
if (isset($_GET["from_date"])) if (isset($_GET["from_date"]))
$from_date = $_GET["from_date"]; $from_date = $_GET["from_date"];
else else
@ -53,31 +53,39 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
$to_date = $_GET["to_date"]; $to_date = $_GET["to_date"];
else else
$to_date = $now; $to_date = $now;
// Convert to unix date // Convert to unix date
$from_date = date("U", strtotime($from_date)); $from_date = date("U", strtotime($from_date));
$to_date = date("U", strtotime($to_date)); $to_date = date("U", strtotime($to_date));
// Make the query // Make the query
$sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule"; $sql1="
SELECT *
FROM tdatos
WHERE id_agente = $id_agent
AND id_agente_modulo = $id_agentmodule";
$tipo = modules_get_moduletype_name (modules_get_agentmodule_type ($id_agentmodule)); $tipo = modules_get_moduletype_name (modules_get_agentmodule_type ($id_agentmodule));
if ($tipo == "generic_data_string") if ($tipo == "generic_data_string")
$sql1 = "SELECT * $sql1 = "
SELECT *
FROM tagente_datos_string FROM tagente_datos_string
WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule WHERE utimestamp > $from_date AND utimestamp < $to_date
AND id_agente_modulo = $id_agentmodule
ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC";
else else
$sql1 = "SELECT * $sql1 = "
SELECT *
FROM tagente_datos FROM tagente_datos
WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule WHERE utimestamp > $from_date AND utimestamp < $to_date
AND id_agente_modulo = $id_agentmodule
ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC";
$result1 = db_get_all_rows_sql ($sql1, true); $result1 = db_get_all_rows_sql ($sql1, true);
if ($result1 === false) { if ($result1 === false) {
$result1 = array (); $result1 = array ();
} }
// Render data // Render data
foreach ($result1 as $row){ foreach ($result1 as $row) {
echo $agentmodule_name; echo $agentmodule_name;
echo ","; echo ",";
echo $row["datos"]; echo $row["datos"];

View File

@ -138,7 +138,7 @@ if (!empty($result_groups)) {
foreach ($result_groups as $data) { foreach ($result_groups as $data) {
// Calculate entire row color // Calculate entire row color
if ($data["_monitors_alerts_fired_"] > 0){ if ($data["_monitors_alerts_fired_"] > 0) {
$color_class = 'group_view_alrm'; $color_class = 'group_view_alrm';
$status_image = ui_print_status_image ('agent_alertsfired_ball.png', "", true); $status_image = ui_print_status_image ('agent_alertsfired_ball.png', "", true);
} }
@ -321,7 +321,7 @@ if (!empty($result_groups)) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/alerts_status&tag_filter=".$data['_id_']."&filter=fired'>"; href='index.php?sec=estado&sec2=operation/agentes/alerts_status&tag_filter=".$data['_id_']."&filter=fired'>";
} }
if ($data["_monitors_alerts_fired_"] > 0){ if ($data["_monitors_alerts_fired_"] > 0) {
echo $link . $data["_monitors_alerts_fired_"] . "</a>"; echo $link . $data["_monitors_alerts_fired_"] . "</a>";
} }
echo '</td>'; echo '</td>';

View File

@ -91,7 +91,7 @@ if ($id_module) {
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (!defined('METACONSOLE')){ if (!defined('METACONSOLE')) {
$filters = '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;ag_group=' . $filters = '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;ag_group=' .
$ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . '&amp;sort_field=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . '&amp;sort_field=' .
$sortField . '&amp;sort=' . $sort .'&amp;pure=' . $config['pure'] . $ag_custom_fields_params . '">'; $sortField . '&amp;sort=' . $sort .'&amp;pure=' . $config['pure'] . $ag_custom_fields_params . '">';
@ -403,7 +403,7 @@ if (defined('METACONSOLE')) {
if ($key_group_all !== false) if ($key_group_all !== false)
unset($groups_select[$key_group_all]); unset($groups_select[$key_group_all]);
} }
if(defined("METACONSOLE")){ if(defined("METACONSOLE")) {
$table->style[0] = 'vertical-align:middle; font-weight: bold;'; $table->style[0] = 'vertical-align:middle; font-weight: bold;';
$table->style[1] = 'vertical-align:middle; font-weight: bold;'; $table->style[1] = 'vertical-align:middle; font-weight: bold;';
$table->style[2] = 'vertical-align:middle; font-weight: bold;'; $table->style[2] = 'vertical-align:middle; font-weight: bold;';
@ -495,7 +495,7 @@ else {
$table_custom_fields = new stdClass(); $table_custom_fields = new stdClass();
$table_custom_fields->class = 'filters'; $table_custom_fields->class = 'filters';
$table_custom_fields->width = '100%'; $table_custom_fields->width = '100%';
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table_custom_fields->width = '100%'; $table_custom_fields->width = '100%';
$table_custom_fields->class = 'filters'; $table_custom_fields->class = 'filters';
$table_custom_fields->styleTable = 'margin-left:0px; margin-top:15px;'; $table_custom_fields->styleTable = 'margin-left:0px; margin-top:15px;';
@ -529,9 +529,11 @@ foreach ($custom_fields as $custom_field) {
$table_custom_fields->data[] = $row; $table_custom_fields->data[] = $row;
} }
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->colspan[2][0] = 7; $table->colspan[2][0] = 7;
$table->data[2][0] = ui_toggle(html_print_table($table_custom_fields, true), __('Advanced Options'),'',true,true); $table->data[2][0] = ui_toggle(
html_print_table($table_custom_fields, true),
__('Advanced Options'), '', true, true);
$filters .= html_print_table($table, true); $filters .= html_print_table($table, true);
$filters .= "</form>"; $filters .= "</form>";
@ -904,7 +906,7 @@ $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = "100%"; $table->width = "100%";
$table->class = "databox data"; $table->class = "databox data";
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
$table->width = "100%"; $table->width = "100%";
$table->cellpadding = '0'; $table->cellpadding = '0';
$table->cellspacing = '0'; $table->cellspacing = '0';
@ -1230,7 +1232,7 @@ foreach ($result as $row) {
$row['min_critical'], $row['str_critical']); $row['min_critical'], $row['str_critical']);
if (is_numeric($row["datos"])) { if (is_numeric($row["datos"])) {
if ( $config["render_proc"] ){ if ( $config["render_proc"] ) {
switch($row["module_type"]) { switch($row["module_type"]) {
case 2: case 2:
case 6: case 6:
@ -1379,9 +1381,9 @@ ui_require_javascript_file('pandora_modules');
} }
}); });
$('#ag_group').change (function (){ $('#ag_group').change (function () {
strict_user = $("#text-strict_user_hidden").val(); strict_user = $("#text-strict_user_hidden").val();
if (($("#ag_group").val() != 0) && (strict_user != 0)) { if (($("#ag_group").val() != 0) && (strict_user != 0)) {
$("#tag_filter").css('display', 'none'); $("#tag_filter").css('display', 'none');
$("#tag_td").css('display', 'none'); $("#tag_td").css('display', 'none');

View File

@ -541,7 +541,7 @@ foreach ($result as $event) {
} }
if (in_array('ack_utimestamp',$show_fields)) { if (in_array('ack_utimestamp',$show_fields)) {
if($event["ack_utimestamp"] == 0){ if ($event["ack_utimestamp"] == 0) {
$data[$i] = ''; $data[$i] = '';
} }
else { else {

View File

@ -693,10 +693,10 @@ $(document).ready( function() {
// Remove row due to new state // Remove row due to new state
if (($("#status").val() == 0) || ($("#status").val() == 1)) { if (($("#status").val() == 0) || ($("#status").val() == 1)) {
$.each($tr, function(index, value){ $.each($tr, function(index, value) {
row = value; row = value;
if ($(row).attr('id') != ''){ if ($(row).attr('id') != '') {
row_id_name = $(row).attr('id').split('-').shift(); row_id_name = $(row).attr('id').split('-').shift();
row_id_number = $(row).attr('id').split('-').pop() - 1; row_id_number = $(row).attr('id').split('-').pop() - 1;

View File

@ -184,7 +184,7 @@ if (!defined("METACONSOLE")) {
$table->data[0][1] = '<a id="events_graph_link" href="javascript: show_events_graph_dialog()">' . html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '</a>'; $table->data[0][1] = '<a id="events_graph_link" href="javascript: show_events_graph_dialog()">' . html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '</a>';
$table->cellstyle[0][1] = 'background: #ECECEC;'; $table->cellstyle[0][1] = 'background: #ECECEC;';
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class='events_list'; $table->class='events_list';
} }
@ -212,14 +212,14 @@ if (check_acl ($config["id_user"], 0, "EW") || check_acl ($config["id_user"], 0,
$table->cellspacing = 4; $table->cellspacing = 4;
$table->cellpadding = 4; $table->cellpadding = 4;
$table->class = 'databox'; $table->class = 'databox';
if(defined('METACONSOLE')){ if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
} }
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; $table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
if(!defined("METACONSOLE")) if (!defined("METACONSOLE"))
$table->style[0] = 'width: 50%; width:50%;'; $table->style[0] = 'width: 50%; width:50%;';
$data = array(); $data = array();

View File

@ -34,7 +34,7 @@ if (sizeof ($config['extensions']) == 0) {
$delete = get_parameter ("delete", ""); $delete = get_parameter ("delete", "");
$name = get_parameter ("name", ""); $name = get_parameter ("name", "");
if ($delete != ""){ if ($delete != "") {
if (!file_exists($config["homedir"]."/extensions/ext_backup")) if (!file_exists($config["homedir"]."/extensions/ext_backup"))
mkdir($config["homedir"]."/extensions/ext_backup"); mkdir($config["homedir"]."/extensions/ext_backup");
$source = $config["homedir"]."/$delete.php"; $source = $config["homedir"]."/$delete.php";

View File

@ -193,7 +193,7 @@ if ($layers != false) {
// Resize GIS map on fullscreen // Resize GIS map on fullscreen
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$().ready(function(){ $().ready(function() {
var new_height = $(document).height(); var new_height = $(document).height();
$("#map").css("height", new_height - 60); $("#map").css("height", new_height - 60);

View File

@ -227,7 +227,7 @@ if ($layers != false) {
if ($config["pure"] != 0) { if ($config["pure"] != 0) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$().ready(function(){ $().ready(function() {
var new_height = $(document).height(); var new_height = $(document).height();
$("#map").css("height", new_height - 60); $("#map").css("height", new_height - 60);

View File

@ -173,7 +173,7 @@ if ($prioridad != -1) //-1 = All
$filter .= sprintf (" AND prioridad = %d", $prioridad); $filter .= sprintf (" AND prioridad = %d", $prioridad);
$agent_search = (int) get_parameter("agent_search"); $agent_search = (int) get_parameter("agent_search");
if ($agent_search != 0){ if ($agent_search != 0) {
$filter .= sprintf(" AND id_agent = %d", $agent_search); $filter .= sprintf(" AND id_agent = %d", $agent_search);
} }
@ -247,7 +247,7 @@ echo '</td></tr><tr><td>';
$agents_incidents = agents_get_agents(false, array('id_agente', 'nombre')); $agents_incidents = agents_get_agents(false, array('id_agente', 'nombre'));
if ($agents_incidents === false){ if ($agents_incidents === false) {
$agents_incidents = array(); $agents_incidents = array();
} }

View File

@ -178,7 +178,7 @@ if (isset($config['netflow_disable_custom_lvfilters'])) {
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
if (defined ('METACONSOLE')){ if (defined ('METACONSOLE')) {
$class = "databox data"; $class = "databox data";
} }
else { else {
@ -187,14 +187,14 @@ else {
echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&sec2=operation/netflow/nf_live_view&pure='.$pure.'">'; echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&sec2=operation/netflow/nf_live_view&pure='.$pure.'">';
echo "<table class='".$class."' width='100%'>"; echo "<table class='".$class."' width='100%'>";
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
echo "<thead> echo "<thead>
<tr> <tr>
<th align=center colspan=6> <th align=center colspan=6>
" . __('Draw live filter') . " " . __('Draw live filter') . "
</th> </th>
</tr> </tr>
</thead>"; </thead>";
} }
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
$list_servers = array(); $list_servers = array();

View File

@ -167,13 +167,17 @@ if($searchAlerts) {
)'; )';
break; break;
} }
$alertsraw = agents_get_alerts_simple ($agents, "all_enabled", array('offset' => get_parameter ('offset',0), 'limit' => $config['block_size'], 'order' => $order['field'] . " " . $order['order']), $whereAlerts); $alertsraw = agents_get_alerts_simple($agents, "all_enabled",
array('offset' => get_parameter ('offset', 0),
'limit' => $config['block_size'],
'order' => $order['field'] . " " . $order['order']),
$whereAlerts);
$stringSearchPHP = substr($stringSearchSQL,1,strlen($stringSearchSQL)-2); $stringSearchPHP = substr($stringSearchSQL,1,strlen($stringSearchSQL)-2);
$alerts = array(); $alerts = array();
foreach($alertsraw as $key => $alert){ foreach ($alertsraw as $key => $alert) {
$finded = false; $finded = false;
$alerts[$key]['disabled'] = $alert['disabled']; $alerts[$key]['disabled'] = $alert['disabled'];
$alerts[$key]['id_agente'] = modules_get_agentmodule_agent($alert['id_agent_module']); $alerts[$key]['id_agente'] = modules_get_agentmodule_agent($alert['id_agent_module']);
@ -189,7 +193,7 @@ if($searchAlerts) {
$alerts[$key]['actions'] = implode(',',$actions_name); $alerts[$key]['actions'] = implode(',',$actions_name);
} }
$totalAlerts = count($alerts); $totalAlerts = count($alerts);
if ($only_count) { if ($only_count) {

View File

@ -35,21 +35,23 @@ foreach($userreports as $userreport) {
$userreports_id[] = $userreport['id_report']; $userreports_id[] = $userreport['id_report'];
} }
if(!$userreports_id){ if (!$userreports_id) {
$reports_condition = " AND 1<>1"; $reports_condition = " AND 1<>1";
} }
else { else {
$reports_condition = " AND id_report IN (".implode(',',$userreports_id).")"; $reports_condition = " AND id_report IN (".implode(',',$userreports_id).")";
} }
$reports = false; $reports = false;
if($searchReports) { if ($searchReports) {
$sql = "SELECT id_report, name, description $sql = "
SELECT id_report, name, description
FROM treport FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition. WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition.
" LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
$sql_count = "SELECT COUNT(id_report) AS count $sql_count = "
SELECT COUNT(id_report) AS count
FROM treport FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition; WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;

View File

@ -125,7 +125,7 @@ else {
$data[2] = human_time_description_raw ($task["interval_sweep"]); $data[2] = human_time_description_raw ($task["interval_sweep"]);
if ($task["id_recon_script"] == 0){ if ($task["id_recon_script"] == 0) {
$data[3] = $task["subnet"]; $data[3] = $task["subnet"];
} }
else { else {
@ -139,7 +139,7 @@ else {
$data[4] = __('Pending'); $data[4] = __('Pending');
} }
if ($task["id_recon_script"] == 0){ if ($task["id_recon_script"] == 0) {
// Network recon task // Network recon task
$data[5] = html_print_image ("images/network.png", true, array ("title" => __('Network recon task')))."&nbsp;&nbsp;"; $data[5] = html_print_image ("images/network.png", true, array ("title" => __('Network recon task')))."&nbsp;&nbsp;";
$data[5] .= network_profiles_get_name ($task["id_network_profile"]); $data[5] .= network_profiles_get_name ($task["id_network_profile"]);

View File

@ -258,9 +258,9 @@ if ($filter_status != -1)
$whereSubquery .= ' AND status = ' . $filter_status; $whereSubquery .= ' AND status = ' . $filter_status;
if ($trap_type == 5) { if ($trap_type == 5) {
$whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)'; $whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)';
} }
else if ($trap_type != -1){ else if ($trap_type != -1) {
$whereSubquery .= ' AND type = ' . $trap_type; $whereSubquery .= ' AND type = ' . $trap_type;
} }
@ -444,7 +444,7 @@ if ($traps !== false) {
foreach ($traps as $trap) { foreach ($traps as $trap) {
$data = array (); $data = array ();
if (empty($trap["description"])){ if (empty($trap["description"])) {
$trap["description"]=""; $trap["description"]="";
} }
$severity = enterprise_hook ('get_severity', array ($trap)); $severity = enterprise_hook ('get_severity', array ($trap));

View File

@ -329,15 +329,29 @@ enterprise_hook('close_meta_frame');
period = $('#period').val(); period = $('#period').val();
params.selection_mode = $('input[name=selection_mode]:checked').val(); params.selection_mode = $('input[name=selection_mode]:checked').val();
if(!params.selection_mode){params.selection_mode='fromnow';} if (!params.selection_mode) {
params.selection_mode='fromnow';
}
params.date_from = $('#text-date_from').val(); params.date_from = $('#text-date_from').val();
if(!params.date_from){params.date_from = f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();} if (!params.date_from) {
params.date_from = f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();
}
params.time_from = $('#text-time_from').val(); params.time_from = $('#text-time_from').val();
if(!params.time_from){params.time_from = f.getHours() + ":" + f.getMinutes();} if (!params.time_from) {
params.time_from = f.getHours() + ":" + f.getMinutes();
}
params.date_to = $('#text-date_to').val(); params.date_to = $('#text-date_to').val();
if(!params.date_to){params.date_to =f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();} if (!params.date_to) {
params.date_to =f.getFullYear() + "/" + (f.getMonth() +1) + "/" + f.getDate();
}
params.time_to = $('#text-time_to').val(); params.time_to = $('#text-time_to').val();
if(!params.time_to){params.time_to = f.getHours() + ":" + f.getMinutes();} if (!params.time_to) {
params.time_to = f.getHours() + ":" + f.getMinutes();
}
params.page = "include/ajax/module"; params.page = "include/ajax/module";
params.get_module_detail = 1; params.get_module_detail = 1;

Some files were not shown because too many files have changed in this diff Show More