2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_networkmap.php, include/functions_netflow.php, extensions/snmp_explorer.php, operation/netflow/nf_live_view.php, operation/agentes/estado_monitores.php, operation/agentes/networkmap.php, godmode/netflow/nf_report_form.php, godmode/netflow/nf_edit_form.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6760 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f2c0c0762f
commit
2cbd2b69bf
|
@ -1,3 +1,12 @@
|
|||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_networkmap.php, include/functions_netflow.php,
|
||||
extensions/snmp_explorer.php, operation/netflow/nf_live_view.php,
|
||||
operation/agentes/estado_monitores.php,
|
||||
operation/agentes/networkmap.php,
|
||||
godmode/netflow/nf_report_form.php,
|
||||
godmode/netflow/nf_edit_form.php: cleaned source code style.
|
||||
|
||||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* install.php, operation/reporting/reporting_xml.php,
|
||||
|
|
|
@ -78,7 +78,8 @@ function snmp_explorer() {
|
|||
if(array_key_exists(1,$data)) {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
}
|
||||
|
@ -155,7 +156,6 @@ function snmp_explorer() {
|
|||
$ifname = $interfaces[$id]['ifDescr']['value'];
|
||||
}
|
||||
foreach($modules as $module) {
|
||||
|
||||
$oid_array = explode('.',$module);
|
||||
$oid_array[count($oid_array)-1] = $id;
|
||||
$oid = implode('.',$oid_array);
|
||||
|
@ -243,7 +243,6 @@ function snmp_explorer() {
|
|||
$msg .= '<br>'.__('Processing error')." ($number)";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ui_print_error_message($msg);
|
||||
|
@ -266,7 +265,6 @@ function snmp_explorer() {
|
|||
}
|
||||
|
||||
$interfaces_list[$interface['ifIndex']['value']] = str_replace ( "\"" , "" , $ifname);
|
||||
|
||||
}
|
||||
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
|
@ -326,7 +324,8 @@ function snmp_explorer() {
|
|||
|
||||
if ($snmp_version == 3) {
|
||||
echo '<div id="snmp3_options">';
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
echo '<div id="snmp3_options" style="display: none;">';
|
||||
}
|
||||
html_print_table($table);
|
||||
|
@ -398,7 +397,6 @@ function snmp_explorer() {
|
|||
ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
//ui_require_jquery_file ('autocomplete');
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
@ -425,7 +423,6 @@ $(document).ready (function () {
|
|||
$("#no_snmp").hide ();
|
||||
$("#form_interfaces").hide ();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
|
|
|
@ -92,7 +92,8 @@ if ($update) {
|
|||
|
||||
if ($name == '') {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$values = array ('id_sg' => $id,
|
||||
'id_name' => $name,
|
||||
'id_group' => $assign_group,
|
||||
|
@ -145,7 +146,8 @@ if ($create){
|
|||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating filter');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui_print_success_message ('Filter created successfully');
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +172,8 @@ $table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
|
|||
|
||||
if ($advanced_filter != '') {
|
||||
$filter_type = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
|
@ -211,7 +214,8 @@ if ($id) {
|
|||
html_print_input_hidden ('update', 1);
|
||||
html_print_input_hidden ('id', $id);
|
||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create', 1);
|
||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
||||
}
|
||||
|
@ -220,9 +224,7 @@ echo '</form>';
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function displayAdvancedFilter () {
|
||||
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
|
@ -240,7 +242,6 @@ echo '</form>';
|
|||
};
|
||||
|
||||
function displayNormalFilter () {
|
||||
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
|
||||
|
@ -257,11 +258,8 @@ echo '</form>';
|
|||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ if ($id) {
|
|||
$description = $report['description'];
|
||||
$group = $report['id_group'];
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$name = '';
|
||||
$group = '';
|
||||
$description = '';
|
||||
|
@ -80,7 +81,8 @@ if ($update) {
|
|||
|
||||
if ($name == '') {
|
||||
ui_print_error_message (__('Not updated. Blank name'));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$result = db_process_sql_update ('tnetflow_report',
|
||||
array (
|
||||
'id_name' => $name,
|
||||
|
@ -102,10 +104,12 @@ if ($create){
|
|||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_report', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
}
|
||||
|
@ -140,11 +144,11 @@ if ($id) {
|
|||
html_print_input_hidden ('update', 1);
|
||||
html_print_input_hidden ('id', $id);
|
||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create', 1);
|
||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
?>
|
|
@ -207,7 +207,8 @@ function netflow_stat_table ($data, $start_date, $end_date, $aggregate, $unit){
|
|||
$values[$agg] = $data[$j]['data'];
|
||||
$table->data[$x][0] = $agg;
|
||||
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$values[$agg] += $data[$j]['data'];
|
||||
$table->data[$x][0] = $agg;
|
||||
$table->data[$x][1] = format_numeric ($data[$j]['data']);
|
||||
|
|
|
@ -42,9 +42,10 @@ function networkmap_is_descendant ($node, $ascendant, $parents) {
|
|||
}
|
||||
|
||||
// Generate a dot graph definition for graphviz
|
||||
function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
|
||||
$layout = 'radial', $nooverlap = 0, $zoom = 1, $ranksep = 2.5, $center = 0,
|
||||
$regen = 1, $pure = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
|
||||
function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0,
|
||||
$font_size = 12, $layout = 'radial', $nooverlap = 0, $zoom = 1,
|
||||
$ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
|
||||
$id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
|
||||
$relative = false) {
|
||||
|
||||
$parents = array();
|
||||
|
@ -231,7 +232,8 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
// Save node parent information to define edges later
|
||||
if ($node_group['parent'] != "0" && $node_group['id_grupo'] != $group) {
|
||||
$parents[$node_count] = $nodes_groups[$node_group['parent']]['id_node'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$orphans[$node_count] = 1;
|
||||
}
|
||||
|
||||
|
@ -269,13 +271,15 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
$node_count ++;
|
||||
$agent_module = modules_get_agentmodule($key);
|
||||
$alerts_module = db_get_sql('SELECT count(*) as num
|
||||
FROM talert_template_modules WHERE id_agent_module = '.$key);
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = ' . $key);
|
||||
|
||||
if ($alerts_module == 0 && $modwithalerts) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($agent_module['id_module_group'] != $module_group && $module_group != 0){
|
||||
if ($agent_module['id_module_group'] != $module_group &&
|
||||
$module_group != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -329,7 +333,8 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
|
|||
// Verify that the parent is in the graph
|
||||
if (isset ($nodes[$parent_id])) {
|
||||
$graph .= networkmap_create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'groups', $id_networkmap);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$orphans[$node] = 1;
|
||||
}
|
||||
}
|
||||
|
@ -591,16 +596,22 @@ function networkmap_get_filter ($layout) {
|
|||
switch ($layout) {
|
||||
case 'flat':
|
||||
return 'dot';
|
||||
break;
|
||||
case 'radial':
|
||||
return 'twopi';
|
||||
break;
|
||||
case 'circular':
|
||||
return 'circo';
|
||||
break;
|
||||
case 'spring1':
|
||||
return 'neato';
|
||||
break;
|
||||
case 'spring2':
|
||||
return 'fdp';
|
||||
break;
|
||||
default:
|
||||
return 'twopi';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,8 @@ $options_form .= '<tr><td valign="top">' . __('No Overlap') . '<br />';
|
|||
$options_form .= html_print_checkbox ('nooverlap', '1', $nooverlap, true);
|
||||
$options_form .= '</td>';
|
||||
|
||||
if(($activeTab == 'groups' || $activeTab == 'policies') && $depth == 'all') {
|
||||
if (($activeTab == 'groups' || $activeTab == 'policies') &&
|
||||
$depth == 'all') {
|
||||
$options_form .= '<td valign="top">' . __('Only modules with alerts') . '<br />';
|
||||
$options_form .= html_print_checkbox ('modwithalerts', '1', $modwithalerts, true);
|
||||
$options_form .= '</td>';
|
||||
|
@ -347,7 +348,6 @@ if ($pure == "1") {
|
|||
$options_form .= '<td valign="top">' . __('Zoom') . '<br />';
|
||||
$options_form .= html_print_select ($zoom_array, 'zoom', $zoom, '', '', '', true, false, false, false);
|
||||
$options_form .= '</td>';
|
||||
|
||||
}
|
||||
|
||||
if ($nooverlap == 1) {
|
||||
|
@ -385,5 +385,4 @@ if($id_networkmap != 0) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -180,7 +180,8 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
// Read filter type
|
||||
if ($filter['advanced_filter'] != '') {
|
||||
$filter_type = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
|
@ -225,12 +226,10 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
html_print_submit_button (__('Save as new filter'), 'save_button', false, 'class="sub upd" onClick="return defineFilterName();"');
|
||||
|
||||
html_print_submit_button (__('Update current filter'), 'update_button', false, 'class="sub upd"');
|
||||
|
||||
}
|
||||
echo'</form>';
|
||||
|
||||
if ($draw != '') {
|
||||
|
||||
// Get the command to call nfdump
|
||||
$command = netflow_get_command ($filter);
|
||||
|
||||
|
@ -240,14 +239,11 @@ if ($draw != '') {
|
|||
// Draw
|
||||
netflow_draw_item ($start_date, $end_date, $chart_type, $filter, $command, $filter, $max_aggregates, $unique_id);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// Hide the normal filter and display the advanced filter
|
||||
function displayAdvancedFilter () {
|
||||
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
|
@ -264,7 +260,6 @@ if ($draw != '') {
|
|||
|
||||
// Hide the advanced filter and display the normal filter
|
||||
function displayNormalFilter () {
|
||||
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
|
||||
|
@ -281,8 +276,10 @@ if ($draw != '') {
|
|||
if (document.getElementById("text-name").value == '') {
|
||||
document.getElementById("table2-0").style.display = '';
|
||||
document.getElementById("table2-1").style.display = '';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -290,7 +287,8 @@ if ($draw != '') {
|
|||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
|
||||
|
@ -326,8 +324,11 @@ if ($draw != '') {
|
|||
|
||||
// Hide update filter button
|
||||
$("#submit-update_button").css("visibility", "hidden");
|
||||
|
||||
}
|
||||
else {
|
||||
// Load fields from DB
|
||||
} else {
|
||||
|
||||
// Get filter type
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/netflow/nf_live_view",
|
||||
|
@ -345,7 +346,8 @@ if ($draw != '') {
|
|||
// Check right filter type
|
||||
$("#radiobtn0001").attr("checked", "checked");
|
||||
$("#radiobtn0002").attr("checked", "");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#table2-3").css('display', 'none');
|
||||
$("#table2-4").css('display', 'none');
|
||||
$("#table2-5").css('display', '');
|
||||
|
@ -408,7 +410,5 @@ if ($draw != '') {
|
|||
$('#filter_group_color').css('color', '#000000');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue