2012-08-02 Miguel de Dios <miguel.dedios@artica.es>

* pandoradb_data.sql, pandoradb.data.postgreSQL.sql,
	pandoradb.data.oracle.sql, include/functions_config.php: fixed the
	"list_ACL_IPs_for_API" update.
	
	* operation/events/events_marquee.php, godmode/setup/setup.php,
	godmode/reporting/graph_builder.php,
	godmode/reporting/map_builder.php, godmode/reporting/graphs.php,
	godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/visual_console_builder.php,
	godmode/alerts/configure_alert_compound.php,
	godmode/alerts/alert_list.php,
	godmode/alerts/configure_alert_template.php,
	godmode/alerts/alert_templates.php,
	godmode/alerts/configure_alert_action.php,
	godmode/alerts/configure_alert_command.php,
	godmode/alerts/alert_actions.php,
	godmode/alerts/alert_list.builder.php,
	godmode/alerts/configure_alert_special_days.php,
	include/functions_api.php, include/functions_ui.php,
	include/functions_netflow.php, include/functions_alerts.php,
	include/functions_menu.php, include/functions_messages.php: cleaned
	source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6846 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-08-03 12:48:09 +00:00
parent ba23ce80c2
commit 3646e7b843
27 changed files with 324 additions and 219 deletions

View File

@ -1,3 +1,28 @@
2012-08-02 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb_data.sql, pandoradb.data.postgreSQL.sql,
pandoradb.data.oracle.sql, include/functions_config.php: fixed the
"list_ACL_IPs_for_API" update.
* operation/events/events_marquee.php, godmode/setup/setup.php,
godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, godmode/reporting/graphs.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.builder.php,
godmode/alerts/configure_alert_special_days.php,
include/functions_api.php, include/functions_ui.php,
include/functions_netflow.php, include/functions_alerts.php,
include/functions_menu.php, include/functions_messages.php: cleaned
source code style.
2012-08-02 Sergio Martin <sergio.martin@artica.es> 2012-08-02 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php: Improve returns of * include/functions_api.php: Improve returns of

View File

@ -311,7 +311,8 @@ foreach ($actions as $action) {
} }
if (isset($data)){ if (isset($data)){
html_print_table ($table); html_print_table ($table);
} else { }
else {
echo "<div class='nf'>".__('No alert actions configured')."</div>"; echo "<div class='nf'>".__('No alert actions configured')."</div>";
} }

View File

@ -283,9 +283,11 @@ $(document).ready (function () {
function (data, status) { function (data, status) {
if (data === false) { if (data === false) {
$("#value", $value).append ("<em><?php echo __('Unknown') ?></em>"); $("#value", $value).append ("<em><?php echo __('Unknown') ?></em>");
} else if (data == "") { }
else if (data == "") {
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>"); $("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
} else { }
else {
$("#value", $value).append (data); $("#value", $value).append (data);
} }
$loading.hide (); $loading.hide ();

View File

@ -136,7 +136,8 @@ if ($delete_alert) {
"Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'"); "Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_name'");
} }
$messageAction = ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully deleted'), __('Could not be deleted'), '', true);
} }
if ($add_action) { if ($add_action) {
@ -160,7 +161,8 @@ if ($add_action) {
db_pandora_audit("Alert management", 'Fail to add action ' . $id_action . ' in alert ' . $id_alert_module); db_pandora_audit("Alert management", 'Fail to add action ' . $id_action . ' in alert ' . $id_alert_module);
} }
$messageAction = ui_print_result_message ($result, __('Successfully added'), __('Could not be added'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully added'), __('Could not be added'), '', true);
} }
if ($delete_action) { if ($delete_action) {
@ -176,7 +178,8 @@ if ($delete_action) {
db_pandora_audit("Alert management", 'Fail to delete action ' . $id_action . ' in alert ' . $id_alert); db_pandora_audit("Alert management", 'Fail to delete action ' . $id_action . ' in alert ' . $id_alert);
} }
$messageAction = ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully deleted'), __('Could not be deleted'), '', true);
} }
if ($enable_alert) { if ($enable_alert) {
@ -191,7 +194,8 @@ if ($enable_alert) {
db_pandora_audit("Alert management", 'Fail to enable ' . $id_alert); db_pandora_audit("Alert management", 'Fail to enable ' . $id_alert);
} }
$messageAction = ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully enabled'), __('Could not be enabled'), '', true);
} }
if ($disable_alert) { if ($disable_alert) {
@ -206,7 +210,8 @@ if ($disable_alert) {
db_pandora_audit("Alert management", 'Fail to disable ' . $id_alert); db_pandora_audit("Alert management", 'Fail to disable ' . $id_alert);
} }
$messageAction = ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully disabled'), __('Could not be disabled'), '', true);
} }
if ($standbyon_alert) { if ($standbyon_alert) {
@ -221,7 +226,8 @@ if ($standbyon_alert) {
db_pandora_audit("Alert management", 'Fail to standby ' . $id_alert); db_pandora_audit("Alert management", 'Fail to standby ' . $id_alert);
} }
$messageAction = ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully set standby'), __('Could not be set standby'), '', true);
} }
if ($standbyoff_alert) { if ($standbyoff_alert) {
@ -236,7 +242,8 @@ if ($standbyoff_alert) {
db_pandora_audit("Alert management", 'Fail to standbyoff ' . $id_alert); db_pandora_audit("Alert management", 'Fail to standbyoff ' . $id_alert);
} }
$messageAction = ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'), '', true); $messageAction = ui_print_result_message ($result,
__('Successfully set off standby'), __('Could not be set off standby'), '', true);
} }
if ($id_agente) { if ($id_agente) {
@ -270,7 +277,8 @@ else {
if ($tab == 'list') { if ($tab == 'list') {
ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons); ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons);
} else { }
else {
ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons); ui_print_page_header(__('Alerts') . ' &raquo; ' . __('Manage alerts') . ' &raquo; ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons);
} }

View File

@ -170,9 +170,11 @@ if ($delete_template) {
exit; exit;
} }
} }
} else }
else {
// Header // Header
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "", true);
}
$result = alerts_delete_alert_template ($id); $result = alerts_delete_alert_template ($id);
@ -283,7 +285,8 @@ foreach ($templates as $template) {
ui_pagination ($total_templates, $url); ui_pagination ($total_templates, $url);
if (isset($data)) { if (isset($data)) {
html_print_table ($table); html_print_table ($table);
} else { }
else {
echo "<div class='nf'>".__('No alert templates defined')."</div>"; echo "<div class='nf'>".__('No alert templates defined')."</div>";
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -292,5 +295,4 @@ html_print_submit_button (__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden ('create_alert', 1); html_print_input_hidden ('create_alert', 1);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
?> ?>

View File

@ -142,7 +142,8 @@ if ($id) {
html_print_input_hidden ('id', $id); html_print_input_hidden ('id', $id);
html_print_input_hidden ('update_action', 1); html_print_input_hidden ('update_action', 1);
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"'); html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
} else { }
else {
html_print_input_hidden ('create_action', 1); html_print_input_hidden ('create_action', 1);
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"'); html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
} }
@ -154,8 +155,12 @@ ui_require_javascript_file ('pandora_alerts');
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
<?php if ($id_command) : ?> <?php
original_command = "<?php $command = alerts_get_alert_command_command ($id_command); if ($id_command)
{
?>
original_command = "<?php
$command = alerts_get_alert_command_command ($id_command);
$command = io_safe_output($command); $command = io_safe_output($command);
echo addslashes($command); echo addslashes($command);
?>"; ?>";
@ -163,7 +168,9 @@ $(document).ready (function () {
command_description = "<?php echo str_replace("\r\n","<br>",addslashes(io_safe_output(alerts_get_alert_command_description ($id_command)))); ?>"; command_description = "<?php echo str_replace("\r\n","<br>",addslashes(io_safe_output(alerts_get_alert_command_description ($id_command)))); ?>";
render_command_description(command_description); render_command_description(command_description);
<?php endif; ?> <?php
}
?>
$("#id_command").change (function () { $("#id_command").change (function () {
values = Array (); values = Array ();
values.push ({name: "page", values.push ({name: "page",

View File

@ -64,7 +64,8 @@ if ($id) {
html_print_input_hidden ('id', $id); html_print_input_hidden ('id', $id);
html_print_input_hidden ('update_command', 1); html_print_input_hidden ('update_command', 1);
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"'); html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
} else { }
else {
html_print_input_hidden ('create_command', 1); html_print_input_hidden ('create_command', 1);
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"'); html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
} }

View File

@ -48,7 +48,8 @@ function print_alert_compound_steps ($step, $id) {
echo __('Step').' 1 &raquo; '; echo __('Step').' 1 &raquo; ';
echo '<span>'.__('Conditions').'</span>'; echo '<span>'.__('Conditions').'</span>';
echo '</a>'; echo '</a>';
} else { }
else {
echo __('Step').' 1 &raquo; '; echo __('Step').' 1 &raquo; ';
echo '<span>'.__('Conditions').'</span>'; echo '<span>'.__('Conditions').'</span>';
} }
@ -67,7 +68,8 @@ function print_alert_compound_steps ($step, $id) {
echo __('Step').' 2 &raquo; '; echo __('Step').' 2 &raquo; ';
echo '<span>'.__('Firing').'</span>'; echo '<span>'.__('Firing').'</span>';
echo '</a>'; echo '</a>';
} else { }
else {
echo __('Step').' 2 &raquo; '; echo __('Step').' 2 &raquo; ';
echo '<span>'.__('Firing').'</span>'; echo '<span>'.__('Firing').'</span>';
} }
@ -85,7 +87,8 @@ function print_alert_compound_steps ($step, $id) {
echo __('Step').' 3 &raquo; '; echo __('Step').' 3 &raquo; ';
echo '<span>'.__('Recovery').'</span>'; echo '<span>'.__('Recovery').'</span>';
echo '</a>'; echo '</a>';
} else { }
else {
echo __('Step').' 3 &raquo; '; echo __('Step').' 3 &raquo; ';
echo '<span>'.__('Recovery').'</span>'; echo '<span>'.__('Recovery').'</span>';
} }
@ -266,6 +269,7 @@ if ($id && ! $create_compound) {
$field3_recovery = $compound['field3_recovery']; $field3_recovery = $compound['field3_recovery'];
$id_agent = $compound['id_agent']; $id_agent = $compound['id_agent'];
$id_group = agents_get_agent_group ($id_agent); $id_group = agents_get_agent_group ($id_agent);
if (! check_acl ($config['id_user'], $id_group, "AW")) { if (! check_acl ($config['id_user'], $id_group, "AW")) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access Alert Management"); "Trying to access Alert Management");
@ -541,7 +545,8 @@ else {
$data[3] = alerts_get_alert_template_name ($alert['id_alert_template']); $data[3] = alerts_get_alert_template_name ($alert['id_alert_template']);
if ($condition['operation'] == 'NOP') { if ($condition['operation'] == 'NOP') {
$data[4] = html_print_input_hidden ('operations['.$alert['id'].']', 'NOP', true); $data[4] = html_print_input_hidden ('operations['.$alert['id'].']', 'NOP', true);
} else { }
else {
$data[4] = html_print_select (alerts_compound_operations (), $data[4] = html_print_select (alerts_compound_operations (),
'operations['.$alert['id'].']', $condition['operation'], '', '', '', true); 'operations['.$alert['id'].']', $condition['operation'], '', '', '', true);
} }
@ -683,12 +688,20 @@ ui_require_jquery_file ('timeentry');
var block_size = <?php echo $config['block_size']; ?>; var block_size = <?php echo $config['block_size']; ?>;
var alerts; var alerts;
var compound_alerts; var compound_alerts;
<?php if ($id_agent && isset ($alerts) && $alerts) : ?> <?php
if ($id_agent && isset ($alerts) && $alerts) {
?>
alerts = Array (); alerts = Array ();
<?php foreach ($alerts as $alert) : ?> <?php
foreach ($alerts as $alert) {
?>
alerts[<?php echo $alert['id'] ?>] = eval ("("+'<?php echo json_encode ($alert); ?>'+")"); alerts[<?php echo $alert['id'] ?>] = eval ("("+'<?php echo json_encode ($alert); ?>'+")");
<?php endforeach; ?> <?php
<?php endif; ?> }
?>
<?php
}
?>
function remove_alert () { function remove_alert () {
$(this).parents ("tr:first").remove (); $(this).parents ("tr:first").remove ();
@ -701,7 +714,8 @@ function remove_alert () {
.attr ("name", "operations["+id+"]") .attr ("name", "operations["+id+"]")
.attr ("value", "NOP"); .attr ("value", "NOP");
$("td:last", tr).append (input); $("td:last", tr).append (input);
} else if (len == 0) { }
else if (len == 0) {
$("#conditions_list").hide (); $("#conditions_list").hide ();
} }
return false; return false;
@ -722,7 +736,8 @@ function add_alert () {
.attr ("name", "operations["+id+"]") .attr ("name", "operations["+id+"]")
.attr ("value", "NOP"); .attr ("value", "NOP");
$(td).append (input); $(td).append (input);
} else { }
else {
$(td).append ($("select#operations:last").clone () $(td).append ($("select#operations:last").clone ()
.show () .show ()
.attr ("name", "operations["+id+"]") .attr ("name", "operations["+id+"]")
@ -905,7 +920,8 @@ $(document).ready (function () {
$("#text-other_threshold").attr ("value", ""); $("#text-other_threshold").attr ("value", "");
$("#compound-threshold-other_label").show (); $("#compound-threshold-other_label").show ();
$("#compound-threshold-other_input").show (); $("#compound-threshold-other_input").show ();
} else { }
else {
$("#compound-threshold-other_label").hide (); $("#compound-threshold-other_label").hide ();
$("#compound-threshold-other_input").hide (); $("#compound-threshold-other_input").hide ();
} }
@ -933,7 +949,8 @@ $(document).ready (function () {
$("#recovery_notify").change (function () { $("#recovery_notify").change (function () {
if (this.value == 1) { if (this.value == 1) {
$("#compound-field2, #compound-field3").show (); $("#compound-field2, #compound-field3").show ();
} else { }
else {
$("#compound-field2, #compound-field3").hide (); $("#compound-field2, #compound-field3").hide ();
} }
}); });

View File

@ -83,7 +83,8 @@ if ($id) {
html_print_input_hidden ('id', $id); html_print_input_hidden ('id', $id);
html_print_input_hidden ('update_special_day', 1); html_print_input_hidden ('update_special_day', 1);
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"'); html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
} else { }
else {
html_print_input_hidden ('create_special_day', 1); html_print_input_hidden ('create_special_day', 1);
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"'); html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
} }

View File

@ -817,19 +817,24 @@ $(document).ready (function () {
if (type == "regex") { if (type == "regex") {
if (enabled) { if (enabled) {
$("span#example").empty ().append (matches); $("span#example").empty ().append (matches);
} else { }
else {
$("span#example").empty ().append (matches_not); $("span#example").empty ().append (matches_not);
} }
} else if (type == "max_min") { }
else if (type == "max_min") {
if (enabled) { if (enabled) {
$("span#example").empty ().append (between); $("span#example").empty ().append (between);
} else { }
else {
$("span#example").empty ().append (between_not); $("span#example").empty ().append (between_not);
} }
} else if (type == "onchange") { }
else if (type == "onchange") {
if (enabled) { if (enabled) {
$("span#example").empty ().append (onchange); $("span#example").empty ().append (onchange);
} else { }
else {
$("span#example").empty ().append (onchange_not); $("span#example").empty ().append (onchange_not);
} }
} }
@ -849,7 +854,8 @@ $(document).ready (function () {
$("#text-other_threshold").attr ("value", ""); $("#text-other_threshold").attr ("value", "");
$("#template-threshold-other_label").show (); $("#template-threshold-other_label").show ();
$("#template-threshold-other_input").show (); $("#template-threshold-other_input").show ();
} else { }
else {
$("#template-threshold-other_label").hide (); $("#template-threshold-other_label").hide ();
$("#template-threshold-other_input").hide (); $("#template-threshold-other_input").hide ();
} }
@ -858,7 +864,8 @@ $(document).ready (function () {
$("#recovery_notify").change (function () { $("#recovery_notify").change (function () {
if (this.value == 1) { if (this.value == 1) {
$("#template-field2, #template-field3").show (); $("#template-field2, #template-field3").show ();
} else { }
else {
$("#template-field2, #template-field3").hide (); $("#template-field2, #template-field3").hide ();
} }
}); });

View File

@ -85,7 +85,8 @@ if ($add_graph) {
db_pandora_audit("Report management", "Create graph #$id_graph"); db_pandora_audit("Report management", "Create graph #$id_graph");
else else
db_pandora_audit("Report management", "Fail try to create graph"); db_pandora_audit("Report management", "Fail try to create graph");
} else { }
else {
$id_graph = false; $id_graph = false;
} }
@ -115,7 +116,8 @@ if ($update_graph) {
else else
db_pandora_audit("Report management", "Fail try to update graph #$id_graph"); db_pandora_audit("Report management", "Fail try to update graph #$id_graph");
} else { }
else {
$success = false; $success = false;
} }
} }

View File

@ -122,7 +122,8 @@ if ($multiple_delete) {
$str_ids = implode (',', $ids); $str_ids = implode (',', $ids);
if ($result) { if ($result) {
db_pandora_audit("Report management", "Multiple delete graph: $str_ids"); db_pandora_audit("Report management", "Multiple delete graph: $str_ids");
} else { }
else {
db_pandora_audit("Report management", "Fail try to delete graphs: $str_ids"); db_pandora_audit("Report management", "Fail try to delete graphs: $str_ids");
} }

View File

@ -158,7 +158,8 @@ else
if (!$maps) { if (!$maps) {
echo '<div class="nf">'.('No maps defined').'</div>'; echo '<div class="nf">'.('No maps defined').'</div>';
} else { }
else {
foreach ($maps as $map) { foreach ($maps as $map) {
$data = array (); $data = array ();
@ -175,7 +176,6 @@ if (!$maps) {
$data[4] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>'; $data[4] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
} }
array_push ($table->data, $data); array_push ($table->data, $data);
} }
html_print_table ($table); html_print_table ($table);
} }

View File

@ -210,7 +210,8 @@ switch ($activeTab) {
$statusProcessInDB = array('flag' => true, 'message' => $message); $statusProcessInDB = array('flag' => true, 'message' => $message);
} else { }
else {
// One item per module // One item per module
if (empty($name_modules)) { if (empty($name_modules)) {
$statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true)); $statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true));

View File

@ -276,7 +276,8 @@ function item_per_agent_change(itemPerAgent) {
$('#label_type').append ($('<option></option>').html (<?php echo "'" . __('None') . "'"; ?>).attr('value', 'none')); $('#label_type').append ($('<option></option>').html (<?php echo "'" . __('None') . "'"; ?>).attr('value', 'none'));
$('#hidden-item_per_agent_test').val(1); $('#hidden-item_per_agent_test').val(1);
} else { }
else {
$('#module').removeAttr('disabled'); $('#module').removeAttr('disabled');
$('#hidden-item_per_agent_test').val(0); $('#hidden-item_per_agent_test').val(0);
$('#label_type').empty(); $('#label_type').empty();
@ -286,6 +287,5 @@ function item_per_agent_change(itemPerAgent) {
$('#label_type').append ($('<option></option>').html (<?php echo "'" . __('None') . "'"; ?>).attr('value', 'none')); $('#label_type').append ($('<option></option>').html (<?php echo "'" . __('None') . "'"; ?>).attr('value', 'none'));
} }
} }
</script> </script>

View File

@ -240,7 +240,7 @@ $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarc
$zone_selected = get_parameter('zone'); $zone_selected = get_parameter('zone');
if ($zone_selected == "") { if ($zone_selected == "") {
if ($config["timezone"] != "") { if ($config["timezone"] != "") {
list($zone) = split("/", $config["timezone"]); list($zone) = explode("/", $config["timezone"]);
$zone_selected = $zone; $zone_selected = $zone;
} }
else { else {

View File

@ -44,8 +44,9 @@ function config_create_value ($token, $value) {
function config_update_value ($token, $value) { function config_update_value ($token, $value) {
global $config; global $config;
if ($token == 'list_ACL_IPs_for_API') if ($token == 'list_ACL_IPs_for_API') {
$value = str_replace(array("\r\n", "\r", "\n"), ";", io_safe_output($value)); $value = str_replace(array("\r\n", "\r", "\n"), ";", io_safe_output($value));
}
if (!isset ($config[$token])) { if (!isset ($config[$token])) {
$config[$token] = $value; $config[$token] = $value;
@ -391,8 +392,10 @@ function config_process_config () {
*/ */
$temp_list_ACL_IPs_for_API = array(); $temp_list_ACL_IPs_for_API = array();
if (isset($config['list_ACL_IPs_for_API'])) { if (isset($config['list_ACL_IPs_for_API'])) {
if (!empty($config['list_ACL_IPs_for_API'])) {
$temp_list_ACL_IPs_for_API = explode(';', $config['list_ACL_IPs_for_API']); $temp_list_ACL_IPs_for_API = explode(';', $config['list_ACL_IPs_for_API']);
} }
}
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API; $config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
$keysConfig = array_keys($config); $keysConfig = array_keys($config);
@ -631,7 +634,8 @@ function config_process_config () {
config_update_value( 'api_password', ''); config_update_value( 'api_password', '');
} }
if (!isset ($config['relative_path']) && (isset ($_POST['nick']) || isset ($config['id_user'])) && isset($config['enterprise_installed'])) { if (!isset ($config['relative_path']) && (isset ($_POST['nick'])
|| isset ($config['id_user'])) && isset($config['enterprise_installed'])) {
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); $isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {

View File

@ -59,7 +59,8 @@ function menu_print_menu (&$menu) {
if (! isset ($main['id'])) { if (! isset ($main['id'])) {
$id = 'menu_'.++$idcounter; $id = 'menu_'.++$idcounter;
} else { }
else {
$id = $main['id']; $id = $main['id'];
} }
@ -74,7 +75,8 @@ function menu_print_menu (&$menu) {
if (($sec == $mainsec) && ($showSubsection)) { if (($sec == $mainsec) && ($showSubsection)) {
$classes[] = 'selected'; $classes[] = 'selected';
} else { }
else {
$classes[] = 'not_selected'; $classes[] = 'not_selected';
if ($extensionInMenuParameter == $mainsec) if ($extensionInMenuParameter == $mainsec)
$classes[] = 'selected'; $classes[] = 'selected';
@ -139,7 +141,8 @@ function menu_print_menu (&$menu) {
break; break;
} }
} }
} else { }
else {
//If there is only a string just compare //If there is only a string just compare
if (strpos($sec2, $sub['subsecs']) !== false) { if (strpos($sec2, $sub['subsecs']) !== false) {
$selected_submenu2=true; $selected_submenu2=true;
@ -148,8 +151,11 @@ function menu_print_menu (&$menu) {
} }
//Set class //Set class
if (($sec2 == $subsec2 || $allsec2 == $subsec2 || $selected_submenu2) && isset ($sub[$subsec2]["options"]) if (($sec2 == $subsec2 || $allsec2 == $subsec2 ||
&& (get_parameter_get ($sub[$subsec2]["options"]["name"]) == $sub[$subsec2]["options"]["value"])) { $selected_submenu2) && isset ($sub[$subsec2]["options"])
&& (
get_parameter_get ($sub[$subsec2]["options"]["name"]) == $sub[$subsec2]["options"]["value"])
) {
//If the subclass is selected and there are options and that options value is true //If the subclass is selected and there are options and that options value is true
$class .= 'submenu_selected selected'; $class .= 'submenu_selected selected';
$selected = true; $selected = true;
@ -224,7 +230,8 @@ function menu_print_menu (&$menu) {
$secExtension = null; $secExtension = null;
if (array_key_exists('sec',$sub)) $secExtension = $sub["sec"]; if (array_key_exists('sec',$sub))
$secExtension = $sub["sec"];
if (strlen($secExtension) > 0) { if (strlen($secExtension) > 0) {
$secUrl = $secExtension; $secUrl = $secExtension;
$extensionInMenu = 'extension_in_menu='.$mainsec.'&amp;'; $extensionInMenu = 'extension_in_menu='.$mainsec.'&amp;';
@ -236,7 +243,8 @@ function menu_print_menu (&$menu) {
if (isset ($sub["text"]) || $selected) { if (isset ($sub["text"]) || $selected) {
$title = ' title="' . $sub["text"] . ' "'; $title = ' title="' . $sub["text"] . ' "';
} else { }
else {
$title = ''; $title = '';
} }
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($sub["refr"] ? '&amp;refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>'; $submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($sub["refr"] ? '&amp;refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
@ -435,5 +443,4 @@ function menu_sec2_in_sec($sec,$sec2) {
return false; return false;
} }
?> ?>

View File

@ -51,7 +51,8 @@ function messages_create_message ($usuario_origen, $usuario_destino, $subject, $
if ($return === false) { if ($return === false) {
return false; return false;
} else { }
else {
return true; return true;
} }
} }
@ -204,9 +205,11 @@ function messages_get_count ($user = false, $incl_read = false) {
global $config; global $config;
$user = $config["id_user"]; $user = $config["id_user"];
} }
if (empty ($incl_read)) { if (empty ($incl_read)) {
$filter = "AND estado = 0"; $filter = "AND estado = 0";
} else { }
else {
$filter = ""; $filter = "";
} }
$sql = sprintf("SELECT COUNT(*) $sql = sprintf("SELECT COUNT(*)

View File

@ -280,7 +280,8 @@ function netflow_data_table ($data, $start_date, $end_date, $aggregate) {
for ($j = 0; $j < $source_count; $j++) { for ($j = 0; $j < $source_count; $j++) {
if (isset ($values[$source_index[$j]])) { if (isset ($values[$source_index[$j]])) {
$table->data[$i][$j+1] = format_numeric ($values[$source_index[$j]]); $table->data[$i][$j+1] = format_numeric ($values[$source_index[$j]]);
} else { }
else {
$table->data[$i][$j+1] = 0; $table->data[$i][$j+1] = 0;
} }
} }

View File

@ -1612,7 +1612,8 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
if ($max_warning != $min_warning) { if ($max_warning != $min_warning) {
$data .= format_for_graph($max_warning) ."/". format_for_graph ($min_warning); $data .= format_for_graph($max_warning) ."/". format_for_graph ($min_warning);
} else { }
else {
$data .= __("N/A"); $data .= __("N/A");
} }
@ -1620,7 +1621,8 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
if ($max_critical != $min_critical){ if ($max_critical != $min_critical){
$data .= format_for_graph($max_critical) ."/". format_for_graph ($min_critical); $data .= format_for_graph($max_critical) ."/". format_for_graph ($min_critical);
} else { }
else {
$data .= __("N/A"); $data .= __("N/A");
} }
$data .= "</span>"; $data .= "</span>";
@ -1804,7 +1806,8 @@ if($hidde_default) {
$image_a = html_print_image("images/go.png", true, false, true); $image_a = html_print_image("images/go.png", true, false, true);
$image_b = html_print_image("images/down.png", true, false, true); $image_b = html_print_image("images/down.png", true, false, true);
$original = "images/down.png"; $original = "images/down.png";
}else { }
else {
$style = ''; $style = '';
$toggle_a = "$('#tgl_div_".$uniqid."').hide();"; $toggle_a = "$('#tgl_div_".$uniqid."').hide();";
$toggle_b = "$('#tgl_div_".$uniqid."').show();"; $toggle_b = "$('#tgl_div_".$uniqid."').show();";
@ -1826,7 +1829,6 @@ echo "</div>";
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
echo '/* <![CDATA[ */'; echo '/* <![CDATA[ */';
echo "$(document).ready (function () {"; echo "$(document).ready (function () {";
echo "$('#tgl_ctrl_".$uniqid."').toggle(function() {"; echo "$('#tgl_ctrl_".$uniqid."').toggle(function() {";
echo $toggle_a; echo $toggle_a;
echo "$('#image_".$uniqid."').attr({src: '".$image_a."'});"; echo "$('#image_".$uniqid."').attr({src: '".$image_a."'});";

View File

@ -65,13 +65,24 @@ if (!check_acl ($config["id_user"], 0, "PM")) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = "SELECT evento, timestamp, id_agente FROM tevento WHERE 1=1 $sql_group_filter ORDER BY utimestamp DESC LIMIT 0 , $MAX_MARQUEE_EVENTS"; $sql = "SELECT evento, timestamp, id_agente
FROM tevento
WHERE 1=1 $sql_group_filter
ORDER BY utimestamp DESC
LIMIT 0 , $MAX_MARQUEE_EVENTS";
break; break;
case "postgresql": case "postgresql":
$sql = "SELECT evento, timestamp, id_agente FROM tevento WHERE 1=1 $sql_group_filter ORDER BY utimestamp DESC LIMIT $MAX_MARQUEE_EVENTS OFFSET 0"; $sql = "SELECT evento, timestamp, id_agente
FROM tevento
WHERE 1=1 $sql_group_filter
ORDER BY utimestamp DESC
LIMIT $MAX_MARQUEE_EVENTS OFFSET 0";
break; break;
case "oracle": case "oracle":
$sql = "SELECT evento, timestamp, id_agente FROM tevento WHERE (1=1 $sql_group_filter ) AND rownum <= $MAX_MARQUEE_EVENTS ORDER BY utimestamp DESC"; $sql = "SELECT evento, timestamp, id_agente
FROM tevento
WHERE (1=1 $sql_group_filter ) AND rownum <= $MAX_MARQUEE_EVENTS
ORDER BY utimestamp DESC";
break; break;
} }
@ -79,7 +90,9 @@ $result = db_get_all_rows_sql ($sql);
foreach ($result as $row) { foreach ($result as $row) {
$agente = ""; $agente = "";
if ($row["id_agente"] != 0){ if ($row["id_agente"] != 0){
$agente = db_get_sql ("SELECT nombre FROM tagente WHERE id_agente = ". $row["id_agente"]); $agente = db_get_sql ("SELECT nombre
FROM tagente
WHERE id_agente = ". $row["id_agente"]);
$agente = $agente . " : "; $agente = $agente . " : ";
} }
$output .= strtoupper($agente) . $row["evento"]. " , ". human_time_comparation($row["timestamp"]); $output .= strtoupper($agente) . $row["evento"]. " , ". human_time_comparation($row["timestamp"]);

View File

@ -91,7 +91,7 @@ INSERT INTO tconfig (token, value) VALUES ('netflow_path', '/var/spool/pandora/d
INSERT INTO tconfig (token, value) VALUES ('netflow_interval', '300'); INSERT INTO tconfig (token, value) VALUES ('netflow_interval', '300');
INSERT INTO tconfig (token, value) VALUES ('netflow_daemon', '/usr/bin/nfcapd'); INSERT INTO tconfig (token, value) VALUES ('netflow_daemon', '/usr/bin/nfcapd');
INSERT INTO tconfig (token, value) VALUES ('event_fields', 'evento,id_agente,estado,timestamp'); INSERT INTO tconfig (token, value) VALUES ('event_fields', 'evento,id_agente,estado,timestamp');
INSERT INTO tconfig (token, value) VALUES ('list_ACL_IPs_for_API_0', '127.0.0.1'); INSERT INTO tconfig (token, value) VALUES ('list_ACL_IPs_for_API', '127.0.0.1');
INSERT INTO tconfig (token, value) VALUES ('enable_pass_policy', 0); INSERT INTO tconfig (token, value) VALUES ('enable_pass_policy', 0);
INSERT INTO tconfig (token, value) VALUES ('pass_size', 4); INSERT INTO tconfig (token, value) VALUES ('pass_size', 4);
INSERT INTO tconfig (token, value) VALUES ('pass_needs_numbers', 0); INSERT INTO tconfig (token, value) VALUES ('pass_needs_numbers', 0);

View File

@ -87,7 +87,7 @@ INSERT INTO "tconfig" ("token", "value") VALUES
('netflow_interval', '300'), ('netflow_interval', '300'),
('netflow_daemon', '/usr/bin/nfcapd'), ('netflow_daemon', '/usr/bin/nfcapd'),
('event_fields', 'evento,id_agente,estado,timestamp'), ('event_fields', 'evento,id_agente,estado,timestamp'),
('list_ACL_IPs_for_API_0', '127.0.0.1'), ('list_ACL_IPs_for_API', '127.0.0.1'),
('enable_pass_policy', 0), ('enable_pass_policy', 0),
('pass_size', 4), ('pass_size', 4),
('pass_needs_numbers', 0), ('pass_needs_numbers', 0),

View File

@ -86,7 +86,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('netflow_interval', '300'), ('netflow_interval', '300'),
('netflow_daemon', '/usr/bin/nfcapd'), ('netflow_daemon', '/usr/bin/nfcapd'),
('event_fields', 'evento,id_agente,estado,timestamp'), ('event_fields', 'evento,id_agente,estado,timestamp'),
('list_ACL_IPs_for_API_0', '127.0.0.1'), ('list_ACL_IPs_for_API', '127.0.0.1'),
('enable_pass_policy', 0), ('enable_pass_policy', 0),
('pass_size', 4), ('pass_size', 4),
('pass_needs_numbers', 0), ('pass_needs_numbers', 0),