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:
parent
b4b233c478
commit
26320dddfc
|
@ -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>
|
||||
|
||||
* include/functions_api.php: Improve returns of
|
||||
|
|
|
@ -311,7 +311,8 @@ foreach ($actions as $action) {
|
|||
}
|
||||
if (isset($data)){
|
||||
html_print_table ($table);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('No alert actions configured')."</div>";
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ $(document).ready (function () {
|
|||
.data("item.autocomplete", item)
|
||||
.append(text)
|
||||
.appendTo(ul);
|
||||
};
|
||||
};
|
||||
|
||||
//Force the size of autocomplete
|
||||
$(".ui-autocomplete").css("max-height", "100px");
|
||||
|
@ -257,17 +257,17 @@ $(document).ready (function () {
|
|||
}).click (function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$("#action_loading").show ();
|
||||
});
|
||||
|
||||
|
||||
$("#action_select").change(function () {
|
||||
if ($("#action_select").attr ("value") != '0') {
|
||||
$('#advanced_action').show();
|
||||
}
|
||||
else {
|
||||
$('#advanced_action').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -283,9 +283,11 @@ $(document).ready (function () {
|
|||
function (data, status) {
|
||||
if (data === false) {
|
||||
$("#value", $value).append ("<em><?php echo __('Unknown') ?></em>");
|
||||
} else if (data == "") {
|
||||
}
|
||||
else if (data == "") {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (data);
|
||||
}
|
||||
$loading.hide ();
|
||||
|
|
|
@ -124,7 +124,7 @@ if ($delete_alert) {
|
|||
$alert_template_name = db_get_value ("name", "talert_templates","id", $id_alert_template);
|
||||
$module_name = db_get_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
|
||||
$agent_name = agents_get_name (db_get_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
|
||||
|
||||
|
||||
$result = alerts_delete_alert_agent_module ($id_alert_agent_module);
|
||||
|
||||
if ($result) {
|
||||
|
@ -136,7 +136,8 @@ if ($delete_alert) {
|
|||
"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) {
|
||||
|
@ -160,7 +161,8 @@ if ($add_action) {
|
|||
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) {
|
||||
|
@ -176,7 +178,8 @@ if ($delete_action) {
|
|||
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) {
|
||||
|
@ -191,7 +194,8 @@ if ($enable_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) {
|
||||
|
@ -206,7 +210,8 @@ if ($disable_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) {
|
||||
|
@ -221,7 +226,8 @@ if ($standbyon_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) {
|
||||
|
@ -236,7 +242,8 @@ if ($standbyoff_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) {
|
||||
|
@ -267,15 +274,16 @@ else {
|
|||
html_print_image ("images/config.png", true, array ("title" => __('Builder alert'))) .'</a>'));
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
|
||||
if ($tab == 'list') {
|
||||
ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons);
|
||||
}
|
||||
|
||||
echo $messageAction;
|
||||
|
||||
|
||||
switch ($tab) {
|
||||
case 'list':
|
||||
if ($group == 0) {
|
||||
|
@ -304,4 +312,4 @@ else {
|
|||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -137,7 +137,7 @@ if ($update_template) {
|
|||
if ($delete_template) {
|
||||
$id = get_parameter ('id');
|
||||
$al_template = alerts_get_alert_template($id);
|
||||
|
||||
|
||||
if ($al_template !== false){
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
if ($al_template['id_group'] == 0){
|
||||
|
@ -169,11 +169,13 @@ if ($delete_template) {
|
|||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Header
|
||||
ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/god2.png", false, "", true);
|
||||
|
||||
}
|
||||
|
||||
$result = alerts_delete_alert_template ($id);
|
||||
|
||||
if ($result) {
|
||||
|
@ -261,10 +263,10 @@ foreach ($templates as $template) {
|
|||
|
||||
$data[0] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'">'.
|
||||
$template['name'].'</a>';
|
||||
|
||||
|
||||
$data[1] = ui_print_group_icon ($template["id_group"], true);
|
||||
$data[3] = alerts_get_alert_templates_type_name ($template['type']);
|
||||
|
||||
|
||||
$data[4] = '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template" style="display: inline; float: left">';
|
||||
$data[4] .= html_print_input_hidden ('duplicate_template', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('source_id', $template['id'], true);
|
||||
|
@ -281,9 +283,10 @@ foreach ($templates as $template) {
|
|||
}
|
||||
|
||||
ui_pagination ($total_templates, $url);
|
||||
if (isset($data)){
|
||||
if (isset($data)) {
|
||||
html_print_table ($table);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('No alert templates defined')."</div>";
|
||||
}
|
||||
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);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
?>
|
|
@ -62,7 +62,7 @@ if ($al_action !== false){
|
|||
"Trying to access Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -104,7 +104,7 @@ $own_info = get_user_info ($config['id_user']);
|
|||
// Only display group "All" if user is administrator or has "PM" privileges
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
$display_all_group = true;
|
||||
else
|
||||
else
|
||||
$display_all_group = false;
|
||||
$table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, 'group', $group, '', '', 0, true);
|
||||
|
||||
|
@ -142,7 +142,8 @@ if ($id) {
|
|||
html_print_input_hidden ('id', $id);
|
||||
html_print_input_hidden ('update_action', 1);
|
||||
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create_action', 1);
|
||||
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
|
||||
}
|
||||
|
@ -154,16 +155,22 @@ ui_require_javascript_file ('pandora_alerts');
|
|||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
<?php if ($id_command) : ?>
|
||||
original_command = "<?php $command = alerts_get_alert_command_command ($id_command);
|
||||
$command = io_safe_output($command);
|
||||
echo addslashes($command);
|
||||
?>";
|
||||
render_command_preview ();
|
||||
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);
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if ($id_command)
|
||||
{
|
||||
?>
|
||||
original_command = "<?php
|
||||
$command = alerts_get_alert_command_command ($id_command);
|
||||
$command = io_safe_output($command);
|
||||
echo addslashes($command);
|
||||
?>";
|
||||
render_command_preview ();
|
||||
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);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
$("#id_command").change (function () {
|
||||
values = Array ();
|
||||
values.push ({name: "page",
|
||||
|
@ -188,4 +195,4 @@ $(document).ready (function () {
|
|||
$("#text-field2").keyup (render_command_preview);
|
||||
$("#textarea_field3").keyup (render_command_preview);
|
||||
});
|
||||
</script>
|
||||
</script>
|
|
@ -64,10 +64,11 @@ if ($id) {
|
|||
html_print_input_hidden ('id', $id);
|
||||
html_print_input_hidden ('update_command', 1);
|
||||
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create_command', 1);
|
||||
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
?>
|
|
@ -48,7 +48,8 @@ function print_alert_compound_steps ($step, $id) {
|
|||
echo __('Step').' 1 » ';
|
||||
echo '<span>'.__('Conditions').'</span>';
|
||||
echo '</a>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo __('Step').' 1 » ';
|
||||
echo '<span>'.__('Conditions').'</span>';
|
||||
}
|
||||
|
@ -67,7 +68,8 @@ function print_alert_compound_steps ($step, $id) {
|
|||
echo __('Step').' 2 » ';
|
||||
echo '<span>'.__('Firing').'</span>';
|
||||
echo '</a>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo __('Step').' 2 » ';
|
||||
echo '<span>'.__('Firing').'</span>';
|
||||
}
|
||||
|
@ -85,7 +87,8 @@ function print_alert_compound_steps ($step, $id) {
|
|||
echo __('Step').' 3 » ';
|
||||
echo '<span>'.__('Recovery').'</span>';
|
||||
echo '</a>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
echo __('Step').' 3 » ';
|
||||
echo '<span>'.__('Recovery').'</span>';
|
||||
}
|
||||
|
@ -96,7 +99,7 @@ function print_alert_compound_steps ($step, $id) {
|
|||
|
||||
function update_compound ($step) {
|
||||
global $config;
|
||||
|
||||
|
||||
$id = (int) get_parameter ('id');
|
||||
|
||||
if (empty ($id))
|
||||
|
@ -142,10 +145,10 @@ function update_compound ($step) {
|
|||
$min_alerts = (int) get_parameter ('min_alerts');
|
||||
if ($threshold == -1)
|
||||
$threshold = (int) get_parameter ('other_threshold');
|
||||
|
||||
|
||||
switch ($config['dbtype']){
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
case "postgresql":
|
||||
$values = array ('monday' => $monday,
|
||||
'tuesday' => $tuesday,
|
||||
'wednesday' => $wednesday,
|
||||
|
@ -177,14 +180,14 @@ function update_compound ($step) {
|
|||
'min_alerts' => $min_alerts
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$result = alerts_update_alert_compound ($id, $values);
|
||||
|
||||
/* Update actions */
|
||||
$remove_actions = alerts_get_alert_compound_actions ($id);
|
||||
$add_actions = (array) get_parameter ('actions');
|
||||
|
||||
|
||||
if (!empty ($remove_actions)) {
|
||||
foreach ($remove_actions as $key => $action) {
|
||||
alerts_delete_alert_compound_action ($key);
|
||||
|
@ -266,6 +269,7 @@ if ($id && ! $create_compound) {
|
|||
$field3_recovery = $compound['field3_recovery'];
|
||||
$id_agent = $compound['id_agent'];
|
||||
$id_group = agents_get_agent_group ($id_agent);
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
|
@ -541,7 +545,8 @@ else {
|
|||
$data[3] = alerts_get_alert_template_name ($alert['id_alert_template']);
|
||||
if ($condition['operation'] == 'NOP') {
|
||||
$data[4] = html_print_input_hidden ('operations['.$alert['id'].']', 'NOP', true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$data[4] = html_print_select (alerts_compound_operations (),
|
||||
'operations['.$alert['id'].']', $condition['operation'], '', '', '', true);
|
||||
}
|
||||
|
@ -683,12 +688,20 @@ ui_require_jquery_file ('timeentry');
|
|||
var block_size = <?php echo $config['block_size']; ?>;
|
||||
var alerts;
|
||||
var compound_alerts;
|
||||
<?php if ($id_agent && isset ($alerts) && $alerts) : ?>
|
||||
<?php
|
||||
if ($id_agent && isset ($alerts) && $alerts) {
|
||||
?>
|
||||
alerts = Array ();
|
||||
<?php foreach ($alerts as $alert) : ?>
|
||||
alerts[<?php echo $alert['id'] ?>] = eval ("("+'<?php echo json_encode ($alert); ?>'+")");
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
foreach ($alerts as $alert) {
|
||||
?>
|
||||
alerts[<?php echo $alert['id'] ?>] = eval ("("+'<?php echo json_encode ($alert); ?>'+")");
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
function remove_alert () {
|
||||
$(this).parents ("tr:first").remove ();
|
||||
|
@ -701,7 +714,8 @@ function remove_alert () {
|
|||
.attr ("name", "operations["+id+"]")
|
||||
.attr ("value", "NOP");
|
||||
$("td:last", tr).append (input);
|
||||
} else if (len == 0) {
|
||||
}
|
||||
else if (len == 0) {
|
||||
$("#conditions_list").hide ();
|
||||
}
|
||||
return false;
|
||||
|
@ -722,7 +736,8 @@ function add_alert () {
|
|||
.attr ("name", "operations["+id+"]")
|
||||
.attr ("value", "NOP");
|
||||
$(td).append (input);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$(td).append ($("select#operations:last").clone ()
|
||||
.show ()
|
||||
.attr ("name", "operations["+id+"]")
|
||||
|
@ -905,7 +920,8 @@ $(document).ready (function () {
|
|||
$("#text-other_threshold").attr ("value", "");
|
||||
$("#compound-threshold-other_label").show ();
|
||||
$("#compound-threshold-other_input").show ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#compound-threshold-other_label").hide ();
|
||||
$("#compound-threshold-other_input").hide ();
|
||||
}
|
||||
|
@ -933,7 +949,8 @@ $(document).ready (function () {
|
|||
$("#recovery_notify").change (function () {
|
||||
if (this.value == 1) {
|
||||
$("#compound-field2, #compound-field3").show ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#compound-field2, #compound-field3").hide ();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -83,10 +83,11 @@ if ($id) {
|
|||
html_print_input_hidden ('id', $id);
|
||||
html_print_input_hidden ('update_special_day', 1);
|
||||
html_print_submit_button (__('Update'), 'create', false, 'class="sub upd"');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create_special_day', 1);
|
||||
html_print_submit_button (__('Create'), 'create', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
?>
|
|
@ -817,19 +817,24 @@ $(document).ready (function () {
|
|||
if (type == "regex") {
|
||||
if (enabled) {
|
||||
$("span#example").empty ().append (matches);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("span#example").empty ().append (matches_not);
|
||||
}
|
||||
} else if (type == "max_min") {
|
||||
}
|
||||
else if (type == "max_min") {
|
||||
if (enabled) {
|
||||
$("span#example").empty ().append (between);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("span#example").empty ().append (between_not);
|
||||
}
|
||||
} else if (type == "onchange") {
|
||||
}
|
||||
else if (type == "onchange") {
|
||||
if (enabled) {
|
||||
$("span#example").empty ().append (onchange);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("span#example").empty ().append (onchange_not);
|
||||
}
|
||||
}
|
||||
|
@ -849,7 +854,8 @@ $(document).ready (function () {
|
|||
$("#text-other_threshold").attr ("value", "");
|
||||
$("#template-threshold-other_label").show ();
|
||||
$("#template-threshold-other_input").show ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#template-threshold-other_label").hide ();
|
||||
$("#template-threshold-other_input").hide ();
|
||||
}
|
||||
|
@ -858,7 +864,8 @@ $(document).ready (function () {
|
|||
$("#recovery_notify").change (function () {
|
||||
if (this.value == 1) {
|
||||
$("#template-field2, #template-field3").show ();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$("#template-field2, #template-field3").hide ();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -85,10 +85,11 @@ if ($add_graph) {
|
|||
db_pandora_audit("Report management", "Create graph #$id_graph");
|
||||
else
|
||||
db_pandora_audit("Report management", "Fail try to create graph");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$id_graph = false;
|
||||
}
|
||||
|
||||
|
||||
if(!$id_graph)
|
||||
$edit_graph = false;
|
||||
}
|
||||
|
@ -104,9 +105,9 @@ if ($update_graph) {
|
|||
$stacked = get_parameter('stacked');
|
||||
$events = get_parameter('events');
|
||||
$alerts = get_parameter('alerts');
|
||||
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
||||
|
||||
$success = db_process_sql_update('tgraph',
|
||||
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'events' => $events),
|
||||
array('id_graph' => $id_graph));
|
||||
|
@ -114,8 +115,9 @@ if ($update_graph) {
|
|||
db_pandora_audit("Report management", "Update graph #$id_graph");
|
||||
else
|
||||
db_pandora_audit("Report management", "Fail try to update graph #$id_graph");
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
else {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
@ -130,13 +132,13 @@ if ($add_module) {
|
|||
$id_modules = get_parameter('module');
|
||||
$id_agents = get_parameter('id_agents');
|
||||
$weight = get_parameter('weight');
|
||||
|
||||
|
||||
$id_agent_modules = db_get_all_rows_sql("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN (".
|
||||
implode(',', $id_agents).
|
||||
") AND nombre IN ('".
|
||||
implode("','", $id_modules).
|
||||
"')");
|
||||
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
foreach($id_agent_modules as $id_agent_module)
|
||||
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
|
||||
|
@ -150,7 +152,7 @@ if ($delete_module) {
|
|||
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
|
||||
}
|
||||
|
||||
if($change_weight){
|
||||
if ($change_weight) {
|
||||
$weight = get_parameter ('weight');
|
||||
$id_gs = get_parameter ('graph');
|
||||
db_process_sql_update('tgraph_source',
|
||||
|
@ -158,7 +160,7 @@ if($change_weight){
|
|||
array('id_gs' => $id_gs));
|
||||
}
|
||||
|
||||
if($edit_graph) {
|
||||
if ($edit_graph) {
|
||||
$buttons = array(
|
||||
'main' => array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=main&edit_graph=1&id=' . $id_graph . '">' .
|
||||
|
@ -199,10 +201,10 @@ switch ($tab) {
|
|||
break;
|
||||
}
|
||||
|
||||
if($add_graph)
|
||||
if ($add_graph)
|
||||
ui_print_result_message($id_graph, __('Graph stored successfully'), __('There was a problem storing Graph'));
|
||||
|
||||
if($add_module)
|
||||
if ($add_module)
|
||||
ui_print_result_message($result, __('Module added successfully'), __('There was a problem adding Module'));
|
||||
|
||||
if ($update_graph)
|
||||
|
@ -252,4 +254,4 @@ switch ($active_tab) {
|
|||
require_once('godmode/reporting/graph_builder.graph_editor.php');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -122,7 +122,8 @@ if ($multiple_delete) {
|
|||
$str_ids = implode (',', $ids);
|
||||
if ($result) {
|
||||
db_pandora_audit("Report management", "Multiple delete graph: $str_ids");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Report management", "Fail try to delete graphs: $str_ids");
|
||||
}
|
||||
|
||||
|
@ -135,7 +136,7 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
|||
$return_all_group = true;
|
||||
else
|
||||
$return_all_group = false;
|
||||
|
||||
|
||||
$graphs = custom_graphs_get_user ($config['id_user'], false, $return_all_group, "IW");
|
||||
|
||||
if (! empty ($graphs)) {
|
||||
|
|
|
@ -158,24 +158,24 @@ else
|
|||
|
||||
if (!$maps) {
|
||||
echo '<div class="nf">'.('No maps defined').'</div>';
|
||||
} else {
|
||||
foreach ($maps as $map) {
|
||||
}
|
||||
else {
|
||||
foreach ($maps as $map) {
|
||||
|
||||
$data = array ();
|
||||
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/visual_console/render_view&id='.
|
||||
$map['id'].'&refr=' . $refr . '">'.$map['name'].'</a>';
|
||||
$map['id'].'&refr=' . $refr . '">'.$map['name'].'</a>';
|
||||
|
||||
$data[1] = ui_print_group_icon ($map['id_group'], true);
|
||||
$data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "IW")) {
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "IW")) {
|
||||
|
||||
$data[3] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
|
||||
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
||||
}
|
||||
array_push ($table->data, $data);
|
||||
|
||||
}
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
@ -194,4 +194,4 @@ if (check_acl ($config['id_user'], 0, "IW")) {
|
|||
echo '</form>';
|
||||
}
|
||||
echo '</div>';
|
||||
?>
|
||||
?>
|
|
@ -210,7 +210,8 @@ switch ($activeTab) {
|
|||
|
||||
$statusProcessInDB = array('flag' => true, 'message' => $message);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// One item per module
|
||||
if (empty($name_modules)) {
|
||||
$statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true));
|
||||
|
@ -305,7 +306,7 @@ if ($action == 'new' || $idVisualConsole === false){
|
|||
$action = 'new';
|
||||
$visualConsoleName = "";
|
||||
}
|
||||
|
||||
|
||||
$buttons[$activeTab]['active'] = true;
|
||||
|
||||
ui_print_page_header(__('Visual console') . " » " . $visualConsoleName, "images/reporting_edit.png", false, "visual_console_editor_" . $activeTab . "_tab", true, $buttons);
|
||||
|
@ -329,4 +330,4 @@ switch ($activeTab) {
|
|||
require_once('godmode/reporting/visual_console_builder.editor.php');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -216,7 +216,7 @@ $(document).ready (function () {
|
|||
|
||||
return;
|
||||
});
|
||||
|
||||
|
||||
$("#id_agents").change ( function() {
|
||||
if ($("#hidden-item_per_agent_test").val() == 0)
|
||||
agent_changed_by_multiple_agents();
|
||||
|
@ -265,7 +265,7 @@ function hidden_rows() {
|
|||
}
|
||||
|
||||
function item_per_agent_change(itemPerAgent) {
|
||||
|
||||
|
||||
// Disable Module select
|
||||
if (itemPerAgent == 1) {
|
||||
$('#module').empty();
|
||||
|
@ -276,7 +276,8 @@ function item_per_agent_change(itemPerAgent) {
|
|||
$('#label_type').append ($('<option></option>').html (<?php echo "'" . __('None') . "'"; ?>).attr('value', 'none'));
|
||||
|
||||
$('#hidden-item_per_agent_test').val(1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$('#module').removeAttr('disabled');
|
||||
$('#hidden-item_per_agent_test').val(0);
|
||||
$('#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'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
|
@ -240,7 +240,7 @@ $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarc
|
|||
$zone_selected = get_parameter('zone');
|
||||
if ($zone_selected == "") {
|
||||
if ($config["timezone"] != "") {
|
||||
list($zone) = split("/", $config["timezone"]);
|
||||
list($zone) = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -565,7 +565,7 @@ function alerts_get_alert_template ($id_alert_template) {
|
|||
if (empty ($id_alert_template))
|
||||
return false;
|
||||
|
||||
switch ($config['dbtype']){
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
return db_get_row ('talert_templates', 'id', $id_alert_template);
|
||||
|
|
|
@ -161,7 +161,7 @@ function isInACL($ip) {
|
|||
// If the IP is not in the list, we check one by one, all the wildcard registers
|
||||
foreach($config['list_ACL_IPs_for_API'] as $acl_ip) {
|
||||
if(preg_match('/\*/', $acl_ip)) {
|
||||
|
||||
|
||||
// Scape for protection
|
||||
$acl_ip = str_replace('.','\.',$acl_ip);
|
||||
|
||||
|
|
|
@ -44,9 +44,10 @@ function config_create_value ($token, $value) {
|
|||
function config_update_value ($token, $value) {
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
if (!isset ($config[$token])) {
|
||||
$config[$token] = $value;
|
||||
return (bool) config_create_value ($token, $value);
|
||||
|
@ -143,7 +144,7 @@ function config_update_config () {
|
|||
config_update_value ('enable_pass_policy_admin', get_parameter('enable_pass_policy_admin'));
|
||||
config_update_value ('enable_pass_history', get_parameter('enable_pass_history'));
|
||||
config_update_value ('compare_pass', get_parameter('compare_pass'));
|
||||
}
|
||||
}
|
||||
/////////////
|
||||
break;
|
||||
case 'godmode/setup/setup_auth':
|
||||
|
@ -247,7 +248,7 @@ function config_update_config () {
|
|||
///////////////
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
$enterprise = enterprise_include_once ('include/functions_skins.php');
|
||||
if ($enterprise !== ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -391,7 +392,9 @@ function config_process_config () {
|
|||
*/
|
||||
$temp_list_ACL_IPs_for_API = array();
|
||||
if (isset($config['list_ACL_IPs_for_API'])) {
|
||||
$temp_list_ACL_IPs_for_API = explode(';', $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']);
|
||||
}
|
||||
}
|
||||
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
|
||||
$keysConfig = array_keys($config);
|
||||
|
@ -631,8 +634,9 @@ function config_process_config () {
|
|||
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');
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
|
||||
|
@ -712,7 +716,7 @@ function config_check () {
|
|||
|
||||
// Check default password for "admin"
|
||||
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
|
||||
if ($is_admin) {
|
||||
if ($is_admin) {
|
||||
$hashpass = db_get_sql ("SELECT password FROM tusuario WHERE id_user = 'admin'");
|
||||
if ($hashpass == "1da7ee7d45b96d0e1f45ee4ee23da560"){
|
||||
$config["alert_cnt"]++;
|
||||
|
@ -722,7 +726,7 @@ function config_check () {
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_writable ("attachment")){
|
||||
if (!is_writable ("attachment")) {
|
||||
$config["alert_cnt"]++;
|
||||
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||
array('message' => __('Attachment directory is not writable by HTTP Server').'</h3>'.'<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory'),
|
||||
|
|
|
@ -59,7 +59,8 @@ function menu_print_menu (&$menu) {
|
|||
|
||||
if (! isset ($main['id'])) {
|
||||
$id = 'menu_'.++$idcounter;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$id = $main['id'];
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,8 @@ function menu_print_menu (&$menu) {
|
|||
|
||||
if (($sec == $mainsec) && ($showSubsection)) {
|
||||
$classes[] = 'selected';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$classes[] = 'not_selected';
|
||||
if ($extensionInMenuParameter == $mainsec)
|
||||
$classes[] = 'selected';
|
||||
|
@ -135,21 +137,25 @@ function menu_print_menu (&$menu) {
|
|||
foreach ($sub['subsecs'] as $god_path) {
|
||||
|
||||
if (strpos($sec2, $god_path) !== false) {
|
||||
$selected_submenu2=true;
|
||||
$selected_submenu2=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//If there is only a string just compare
|
||||
if (strpos($sec2, $sub['subsecs']) !== false) {
|
||||
$selected_submenu2=true;
|
||||
$selected_submenu2=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Set class
|
||||
if (($sec2 == $subsec2 || $allsec2 == $subsec2 || $selected_submenu2) && isset ($sub[$subsec2]["options"])
|
||||
&& (get_parameter_get ($sub[$subsec2]["options"]["name"]) == $sub[$subsec2]["options"]["value"])) {
|
||||
if (($sec2 == $subsec2 || $allsec2 == $subsec2 ||
|
||||
$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
|
||||
$class .= 'submenu_selected selected';
|
||||
$selected = true;
|
||||
|
@ -158,7 +164,7 @@ function menu_print_menu (&$menu) {
|
|||
elseif (($sec2 == $subsec2 || $allsec2 == $subsec2|| $selected_submenu2) && !isset ($sub[$subsec2]["options"])) {
|
||||
$class .= 'submenu_selected selected';
|
||||
$selected = true;
|
||||
|
||||
|
||||
$hasExtensions = (array_key_exists('hasExtensions',$main)) ? $main['hasExtensions'] : false;
|
||||
if (($extensionInMenuParameter != '') && ($hasExtensions))
|
||||
$visible = true;
|
||||
|
@ -204,7 +210,7 @@ function menu_print_menu (&$menu) {
|
|||
if (isset($sub['enterprise'])) {
|
||||
$icon_enterprise = (bool)$sub['enterprise'];
|
||||
}
|
||||
|
||||
|
||||
if ($icon_enterprise) {
|
||||
$imageIcon ='enterprise/extensions/'.$sub["icon"];
|
||||
}
|
||||
|
@ -224,7 +230,8 @@ function menu_print_menu (&$menu) {
|
|||
|
||||
|
||||
$secExtension = null;
|
||||
if (array_key_exists('sec',$sub)) $secExtension = $sub["sec"];
|
||||
if (array_key_exists('sec',$sub))
|
||||
$secExtension = $sub["sec"];
|
||||
if (strlen($secExtension) > 0) {
|
||||
$secUrl = $secExtension;
|
||||
$extensionInMenu = 'extension_in_menu='.$mainsec.'&';
|
||||
|
@ -236,19 +243,20 @@ function menu_print_menu (&$menu) {
|
|||
|
||||
if (isset ($sub["text"]) || $selected) {
|
||||
$title = ' title="' . $sub["text"] . ' "';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$title = '';
|
||||
}
|
||||
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&sec2='.$subsec2.($sub["refr"] ? '&refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
|
||||
|
||||
if(isset($sub['sub2'])) {
|
||||
if (isset($sub['sub2'])) {
|
||||
$submenu_output .= html_print_image("include/styles/images/toggle.png", true, array("class" => "toggle", "alt" => "toogle"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Print second level submenu
|
||||
if(isset($sub['sub2'])) {
|
||||
if (isset($sub['sub2'])) {
|
||||
|
||||
//Display if father is selected
|
||||
$display = "style='display:none'";
|
||||
|
@ -278,17 +286,17 @@ function menu_print_menu (&$menu) {
|
|||
$submenu_output .= $submenu2_list;
|
||||
$submenu_output .= "</ul>";
|
||||
}
|
||||
|
||||
|
||||
//Submenu close list!
|
||||
$submenu_output .= '</li>';
|
||||
$submenu_output .= '</li>';
|
||||
}
|
||||
|
||||
// Choose valid section (sec)
|
||||
|
||||
|
||||
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $main["sec2"])) == false){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Print out the first level
|
||||
$output .= '<li class="'.implode (" ", $classes).'" id="icon_'.$id.'">';
|
||||
$output .= '<a href="index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'">'.$main["text"].'</a>' . html_print_image("include/styles/images/toggle.png", true, array("class" => "toggle", "alt" => "toogle"));
|
||||
|
@ -345,11 +353,11 @@ function menu_get_full_sec() {
|
|||
function menu_get_sec($with_categories = false) {
|
||||
$menu = menu_get_full_sec();
|
||||
unset($menu['class']);
|
||||
|
||||
|
||||
$in_godmode = false;
|
||||
foreach($menu as $k => $v) {
|
||||
if($with_categories) {
|
||||
if(!$in_godmode && $k[0] == 'g') {
|
||||
if ($with_categories) {
|
||||
if (!$in_godmode && $k[0] == 'g') {
|
||||
// Hack to dont confuse with gis activated because godmode
|
||||
// sec starts with g (like gismaps)
|
||||
if($k != 'gismaps') {
|
||||
|
@ -357,7 +365,7 @@ function menu_get_sec($with_categories = false) {
|
|||
}
|
||||
}
|
||||
|
||||
if($in_godmode) {
|
||||
if ($in_godmode) {
|
||||
$category = __('Administration');
|
||||
}
|
||||
else {
|
||||
|
@ -371,7 +379,7 @@ function menu_get_sec($with_categories = false) {
|
|||
$sec_array[$k] = $v['text'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $sec_array;
|
||||
}
|
||||
|
||||
|
@ -387,7 +395,7 @@ function menu_get_sec($with_categories = false) {
|
|||
* @return array Sections list
|
||||
*/
|
||||
function menu_get_sec_pages($sec,$menu_hash = false) {
|
||||
if($menu_hash === false) {
|
||||
if ($menu_hash === false) {
|
||||
$menu = menu_get_full_sec();
|
||||
}
|
||||
else {
|
||||
|
@ -396,9 +404,9 @@ function menu_get_sec_pages($sec,$menu_hash = false) {
|
|||
|
||||
// Get the sec2 of the main section
|
||||
$sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text'];
|
||||
|
||||
|
||||
// Get the sec2 of the subsections
|
||||
foreach($menu[$sec]['sub'] as $k => $v) {
|
||||
foreach ($menu[$sec]['sub'] as $k => $v) {
|
||||
// Avoid special cases of standalone windows
|
||||
if(preg_match('/^javascript:/',$k) || preg_match('/\.php/',$k)) {
|
||||
continue;
|
||||
|
@ -410,7 +418,7 @@ function menu_get_sec_pages($sec,$menu_hash = false) {
|
|||
|
||||
$sec2_array[$k] = $v['text'];
|
||||
}
|
||||
|
||||
|
||||
return $sec2_array;
|
||||
}
|
||||
|
||||
|
@ -424,16 +432,15 @@ function menu_get_sec_pages($sec,$menu_hash = false) {
|
|||
*/
|
||||
function menu_sec2_in_sec($sec,$sec2) {
|
||||
$sec2_array = menu_get_sec_pages($sec);
|
||||
|
||||
|
||||
// If this value has various parameters, we only get the first
|
||||
$sec2 = explode('&',$sec2);
|
||||
$sec2 = $sec2[0];
|
||||
|
||||
if($sec2_array != null && in_array($sec2,array_keys($sec2_array))) {
|
||||
|
||||
if ($sec2_array != null && in_array($sec2,array_keys($sec2_array))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -51,7 +51,8 @@ function messages_create_message ($usuario_origen, $usuario_destino, $subject, $
|
|||
|
||||
if ($return === false) {
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -204,14 +205,16 @@ function messages_get_count ($user = false, $incl_read = false) {
|
|||
global $config;
|
||||
$user = $config["id_user"];
|
||||
}
|
||||
|
||||
if (empty ($incl_read)) {
|
||||
$filter = "AND estado = 0";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter = "";
|
||||
}
|
||||
$sql = sprintf("SELECT COUNT(*)
|
||||
FROM tmensajes WHERE id_usuario_destino='%s' %s", $user, $filter);
|
||||
|
||||
|
||||
return (int) db_get_sql ($sql);
|
||||
}
|
||||
|
||||
|
@ -229,7 +232,7 @@ function messages_get_count_sent ($user = false) {
|
|||
}
|
||||
$sql = sprintf("SELECT COUNT(*)
|
||||
FROM tmensajes WHERE id_usuario_origen='%s'", $user);
|
||||
|
||||
|
||||
return (int) db_get_sql ($sql);
|
||||
}
|
||||
|
||||
|
@ -250,7 +253,7 @@ function messages_get_overview ($order = "status", $order_dir = "ASC") {
|
|||
case "timestamp":
|
||||
case "sender":
|
||||
case "subject":
|
||||
break;
|
||||
break;
|
||||
case "status":
|
||||
default:
|
||||
$order = "estado, timestamp";
|
||||
|
@ -294,7 +297,7 @@ function messages_get_overview_sent ($order = "timestamp", $order_dir = "ASC") {
|
|||
case "timestamp":
|
||||
case "sender":
|
||||
case "subject":
|
||||
break;
|
||||
break;
|
||||
case "status":
|
||||
default:
|
||||
$order = "estado, timestamp";
|
||||
|
|
|
@ -280,7 +280,8 @@ function netflow_data_table ($data, $start_date, $end_date, $aggregate) {
|
|||
for ($j = 0; $j < $source_count; $j++) {
|
||||
if (isset ($values[$source_index[$j]])) {
|
||||
$table->data[$i][$j+1] = format_numeric ($values[$source_index[$j]]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$table->data[$i][$j+1] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +369,7 @@ function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggreg
|
|||
if ($aggregate == 'none') {
|
||||
netflow_save_cache ($values, $cache_file);
|
||||
}
|
||||
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -390,13 +391,13 @@ function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max,
|
|||
$command .= " -s $aggregate/$unit -n $max -t " .date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||
exec($command, $string);
|
||||
|
||||
if(! is_array($string)){
|
||||
if (! is_array($string)) {
|
||||
return array ();
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$values = array();
|
||||
foreach($string as $line){
|
||||
foreach ($string as $line) {
|
||||
if ($line == '') {
|
||||
break;
|
||||
}
|
||||
|
@ -477,7 +478,7 @@ function netflow_get_filter_arguments ($filter) {
|
|||
}
|
||||
|
||||
// Normal filter
|
||||
if ($filter['ip_dst'] != ''){
|
||||
if ($filter['ip_dst'] != '') {
|
||||
$filter_args .= ' "(';
|
||||
$val_ipdst = explode(',', $filter['ip_dst']);
|
||||
for($i = 0; $i < count ($val_ipdst); $i++){
|
||||
|
@ -494,7 +495,7 @@ function netflow_get_filter_arguments ($filter) {
|
|||
}
|
||||
$filter_args .= ')';
|
||||
}
|
||||
if ($filter['ip_src'] != ''){
|
||||
if ($filter['ip_src'] != '') {
|
||||
if ($filter_args == '') {
|
||||
$filter_args .= ' "(';
|
||||
}
|
||||
|
@ -502,7 +503,7 @@ function netflow_get_filter_arguments ($filter) {
|
|||
$filter_args .= ' and (';
|
||||
}
|
||||
$val_ipsrc = explode(',', $filter['ip_src']);
|
||||
for($i = 0; $i < count ($val_ipsrc); $i++){
|
||||
for ($i = 0; $i < count ($val_ipsrc); $i++) {
|
||||
if ($i > 0) {
|
||||
$filter_args .= ' or ';
|
||||
}
|
||||
|
@ -524,7 +525,7 @@ function netflow_get_filter_arguments ($filter) {
|
|||
$filter_args .= ' and (';
|
||||
}
|
||||
$val_dstport = explode(',', $filter['dst_port']);
|
||||
for($i = 0; $i < count ($val_dstport); $i++){
|
||||
for ($i = 0; $i < count ($val_dstport); $i++) {
|
||||
if ($i > 0) {
|
||||
$filter_args .= ' or ';
|
||||
}
|
||||
|
@ -540,7 +541,7 @@ function netflow_get_filter_arguments ($filter) {
|
|||
$filter_args .= ' and (';
|
||||
}
|
||||
$val_srcport = explode(',', $filter['src_port']);
|
||||
for($i = 0; $i < count ($val_srcport); $i++){
|
||||
for ($i = 0; $i < count ($val_srcport); $i++) {
|
||||
if ($i > 0) {
|
||||
$filter_args .= ' or ';
|
||||
}
|
||||
|
|
|
@ -1612,7 +1612,8 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
|
|||
|
||||
if ($max_warning != $min_warning) {
|
||||
$data .= format_for_graph($max_warning) ."/". format_for_graph ($min_warning);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$data .= __("N/A");
|
||||
}
|
||||
|
||||
|
@ -1620,7 +1621,8 @@ function ui_print_module_warn_value ($max_warning, $min_warning, $str_warning, $
|
|||
|
||||
if ($max_critical != $min_critical){
|
||||
$data .= format_for_graph($max_critical) ."/". format_for_graph ($min_critical);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$data .= __("N/A");
|
||||
}
|
||||
$data .= "</span>";
|
||||
|
@ -1793,50 +1795,50 @@ function ui_get_include_contents ($filename, $params = false) {
|
|||
*/
|
||||
|
||||
function ui_toggle($code, $name, $title = '', $hidde_default = true) {
|
||||
// Generate unique Id
|
||||
$uniqid = uniqid('');
|
||||
|
||||
// Options
|
||||
if($hidde_default) {
|
||||
$style = 'display:none';
|
||||
$toggle_a = "$('#tgl_div_".$uniqid."').show();";
|
||||
$toggle_b = "$('#tgl_div_".$uniqid."').hide();";
|
||||
$image_a = html_print_image("images/go.png", true, false, true);
|
||||
$image_b = html_print_image("images/down.png", true, false, true);
|
||||
$original = "images/down.png";
|
||||
}else {
|
||||
$style = '';
|
||||
$toggle_a = "$('#tgl_div_".$uniqid."').hide();";
|
||||
$toggle_b = "$('#tgl_div_".$uniqid."').show();";
|
||||
$image_a = html_print_image("images/down.png", true, false, true);
|
||||
$image_b = html_print_image("images/go.png", true, false, true);
|
||||
$original = "images/go.png";
|
||||
}
|
||||
|
||||
// Link to toggle
|
||||
echo '<a href="#" id="tgl_ctrl_'.$uniqid.'"><b>'.$name.'</b> '.html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)).'</a><br /><br />';
|
||||
|
||||
// Code into a div
|
||||
echo "<div id='tgl_div_".$uniqid."' style='".$style."'>\n";
|
||||
echo $code;
|
||||
echo "</div>";
|
||||
|
||||
// JQuery Toggle
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '/* <![CDATA[ */';
|
||||
echo "$(document).ready (function () {";
|
||||
|
||||
echo "$('#tgl_ctrl_".$uniqid."').toggle(function() {";
|
||||
echo $toggle_a;
|
||||
echo "$('#image_".$uniqid."').attr({src: '".$image_a."'});";
|
||||
echo "}, function() {";
|
||||
echo $toggle_b;
|
||||
echo "$('#image_".$uniqid."').attr({src: '".$image_b."'});";
|
||||
// Generate unique Id
|
||||
$uniqid = uniqid('');
|
||||
|
||||
// Options
|
||||
if ($hidde_default) {
|
||||
$style = 'display:none';
|
||||
$toggle_a = "$('#tgl_div_".$uniqid."').show();";
|
||||
$toggle_b = "$('#tgl_div_".$uniqid."').hide();";
|
||||
$image_a = html_print_image("images/go.png", true, false, true);
|
||||
$image_b = html_print_image("images/down.png", true, false, true);
|
||||
$original = "images/down.png";
|
||||
}
|
||||
else {
|
||||
$style = '';
|
||||
$toggle_a = "$('#tgl_div_".$uniqid."').hide();";
|
||||
$toggle_b = "$('#tgl_div_".$uniqid."').show();";
|
||||
$image_a = html_print_image("images/down.png", true, false, true);
|
||||
$image_b = html_print_image("images/go.png", true, false, true);
|
||||
$original = "images/go.png";
|
||||
}
|
||||
|
||||
// Link to toggle
|
||||
echo '<a href="#" id="tgl_ctrl_'.$uniqid.'"><b>'.$name.'</b> '.html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)).'</a><br /><br />';
|
||||
|
||||
// Code into a div
|
||||
echo "<div id='tgl_div_".$uniqid."' style='".$style."'>\n";
|
||||
echo $code;
|
||||
echo "</div>";
|
||||
|
||||
// JQuery Toggle
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '/* <![CDATA[ */';
|
||||
echo "$(document).ready (function () {";
|
||||
echo "$('#tgl_ctrl_".$uniqid."').toggle(function() {";
|
||||
echo $toggle_a;
|
||||
echo "$('#image_".$uniqid."').attr({src: '".$image_a."'});";
|
||||
echo "}, function() {";
|
||||
echo $toggle_b;
|
||||
echo "$('#image_".$uniqid."').attr({src: '".$image_b."'});";
|
||||
echo "});";
|
||||
echo "});";
|
||||
echo "});";
|
||||
echo '/* ]]> */';
|
||||
echo '</script>';
|
||||
echo '/* ]]> */';
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,8 +42,8 @@ check_login ();
|
|||
session_write_close ();
|
||||
|
||||
|
||||
if(!isInACL($_SERVER['REMOTE_ADDR'])){
|
||||
db_pandora_audit("ACL Violation",
|
||||
if (!isInACL($_SERVER['REMOTE_ADDR'])) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access marquee without ACL Access");
|
||||
require ("../../general/noaccess.php");
|
||||
exit;
|
||||
|
@ -51,7 +51,7 @@ if(!isInACL($_SERVER['REMOTE_ADDR'])){
|
|||
|
||||
$groups = users_get_groups ($config["id_user"], "AR");
|
||||
//Otherwise select all groups the user has rights to.
|
||||
if(!empty($groups)) {
|
||||
if (!empty($groups)) {
|
||||
$sql_group_filter = " AND id_grupo IN (".implode (",", array_keys ($groups)).")";
|
||||
}
|
||||
else {
|
||||
|
@ -65,13 +65,24 @@ if (!check_acl ($config["id_user"], 0, "PM")) {
|
|||
|
||||
switch ($config["dbtype"]) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -79,7 +90,9 @@ $result = db_get_all_rows_sql ($sql);
|
|||
foreach ($result as $row) {
|
||||
$agente = "";
|
||||
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 . " : ";
|
||||
}
|
||||
$output .= strtoupper($agente) . $row["evento"]. " , ". human_time_comparation($row["timestamp"]);
|
||||
|
|
|
@ -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_daemon', '/usr/bin/nfcapd');
|
||||
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 ('pass_size', 4);
|
||||
INSERT INTO tconfig (token, value) VALUES ('pass_needs_numbers', 0);
|
||||
|
|
|
@ -87,7 +87,7 @@ INSERT INTO "tconfig" ("token", "value") VALUES
|
|||
('netflow_interval', '300'),
|
||||
('netflow_daemon', '/usr/bin/nfcapd'),
|
||||
('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),
|
||||
('pass_size', 4),
|
||||
('pass_needs_numbers', 0),
|
||||
|
|
|
@ -86,7 +86,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('netflow_interval', '300'),
|
||||
('netflow_daemon', '/usr/bin/nfcapd'),
|
||||
('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),
|
||||
('pass_size', 4),
|
||||
('pass_needs_numbers', 0),
|
||||
|
|
Loading…
Reference in New Issue