Clean the source code style.

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

View File

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

View File

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

View File

@ -243,7 +243,7 @@ $table->data[3][1] = html_print_select_groups(false, "AR", false, 'grupo', $grup
$table->data[4][0] = __('Interval');
$table->data[4][1] = html_print_extended_select_for_time ('intervalo', $intervalo, '', '', '0', 10, true);
if($intervalo<300){
if ($intervalo < SECONDS_5MINUTES) {
$table->data[4][1] .= clippy_context_help("interval_agent_min");
}
$table->data[5][0] = __('OS');

View File

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

View File

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

View File

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

View File

@ -307,8 +307,12 @@ $(document).ready (function () {
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
}
else {
$("[name=field" + i + "_value]").val($("[name=field" + i + "_value]").val());
$("[name=field" + i + "_recovery_value]").val($("[name=field" + i + "_recovery_value]").val());
$("[name=field" + i + "_value]")
.val($("[name=field" + i + "_value]")
.val());
$("[name=field" + i + "_recovery_value]")
.val($("[name=field" + i + "_recovery_value]")
.val());
}
// Add help hint only in first field
if (i == 1) {

View File

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

View File

@ -95,7 +95,8 @@ if(!defined('METACONSOLE')){
echo "<td align=right>";
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/edit_category&action=new&pure='.(int)$config['pure'].'">';
html_print_input_hidden ("create_category", "1", true);
html_print_submit_button (__('Create category'), 'create_button', false, 'class="sub next"');
html_print_submit_button (__('Create category'),
'create_button', false, 'class="sub next"');
echo "</form>";
echo "</td>";
echo "</tr>";

View File

@ -172,7 +172,8 @@ else
html_print_input_hidden ('update_category', 1);
echo "</td>";
echo "<td align=right>";
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub next"');
html_print_submit_button (__('Update'), 'update_button',
false, 'class="sub next"');
echo "</td>";
}
if ($action == "new") {
@ -192,11 +193,13 @@ if(defined('METACONSOLE')){
echo "<td align=right>";
if ($action == "update") {
html_print_input_hidden ('update_category', 1);
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub next"');
html_print_submit_button (__('Update'), 'update_button', false,
'class="sub next"');
}
if ($action == "new") {
html_print_input_hidden ('create_category', 1);
html_print_submit_button (__('Create'), 'create_button', false, 'class="sub next"');
html_print_submit_button (__('Create'), 'create_button', false,
'class="sub next"');
}
echo "</td>";
echo "</tr>";

View File

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

View File

@ -327,7 +327,8 @@ if (check_acl($config['id_user'], 0, "PM")) {
echo '<br />';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
html_print_submit_button(__('Create group'), 'crt', false,
'class="sub next"');
echo '</div>';
echo '</form>';
}

View File

@ -946,7 +946,9 @@ else
}
$result_servers = array();
foreach ($metaconsole_connections as $metaconsole_element) {
$connection_data = enterprise_hook('metaconsole_get_connection', array($metaconsole_element));
$connection_data = enterprise_hook(
'metaconsole_get_connection',
array($metaconsole_element));
$result_servers[$connection_data['server_name']] = $connection_data['server_name'];
}
// Print select combo with metaconsole servers

View File

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

View File

@ -1644,14 +1644,16 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3){
if ($id_module == "") {
returnError('error_update_network_module', __('Error updating network module. Module name cannot be left blank.'));
returnError('error_update_network_module',
__('Error updating network module. Module name cannot be left blank.'));
return;
}
$check_id_module = db_get_value ('id_agente_modulo', 'tagente_modulo', 'id_agente_modulo', $id_module);
if (!$check_id_module) {
returnError('error_update_network_module', __('Error updating network module. Id_module doesn\'t exists.'));
returnError('error_update_network_module',
__('Error updating network module. Id_module doesn\'t exists.'));
return;
}
@ -1660,7 +1662,9 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3){
$id_agent_old = db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module);
if ($id_agent_old != $other['data'][0]) {
$id_module_exists = db_get_value_filter ('id_agente_modulo', 'tagente_modulo', array('nombre' => $module_name, 'id_agente' => $other['data'][0]));
$id_module_exists = db_get_value_filter ('id_agente_modulo',
'tagente_modulo',
array('nombre' => $module_name, 'id_agente' => $other['data'][0]));
if ($id_module_exists) {
returnError('error_update_network_module',
@ -2298,21 +2302,28 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
if ($other['data'][13] == "3") {
if ($other['data'][22] != "AES" and $other['data'][22] != "DES") {
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return;
}
if ($other['data'][24] != "authNoPriv" and $other['data'][24] != "authPriv" and $other['data'][24] != "noAuthNoPriv"){
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
if ($other['data'][24] != "authNoPriv"
and $other['data'][24] != "authPriv"
and $other['data'][24] != "noAuthNoPriv") {
returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return;
}
if ($other['data'][25] != "MD5" and $other['data'][25] != "SHA") {
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
returnError('error_create_snmp_module',
__('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return;
}
$snmp_module_fields = array('id_agente',
$snmp_module_fields = array(
'id_agente',
'disabled',
'id_module_group',
'min_warning',
@ -2347,7 +2358,8 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
'min_ff_event_critical');
}
else {
$snmp_module_fields = array('id_agente',
$snmp_module_fields = array(
'id_agente',
'disabled',
'id_module_group',
'min_warning',
@ -2618,13 +2630,18 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2) {
return;
}
if ($other['data'][25] != "authNoPriv" and $other['data'][25] != "authPriv" and $other['data'][25] != "noAuthNoPriv"){
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
if ($other['data'][25] != "authNoPriv"
and $other['data'][25] != "authPriv"
and $other['data'][25] != "noAuthNoPriv") {
returnError('error_set_new_snmp_component',
__('Error creating SNMP component. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return;
}
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") {
returnError('error_set_new_snmp_component', __('Error creating SNMP component. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
returnError('error_set_new_snmp_component',
__('Error creating SNMP component. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return;
}
@ -3275,24 +3292,28 @@ function api_set_create_module_template($id, $thrash1, $other, $thrash3) {
}
if ($id == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_template cannot be left blank.'));
returnError('error_module_to_template',
__('Error assigning module to template. Id_template cannot be left blank.'));
return;
}
if ($other['data'][0] == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_module cannot be left blank.'));
returnError('error_module_to_template',
__('Error assigning module to template. Id_module cannot be left blank.'));
return;
}
if ($other['data'][1] == "") {
returnError('error_module_to_template', __('Error assigning module to template. Id_agent cannot be left blank.'));
returnError('error_module_to_template',
__('Error assigning module to template. Id_agent cannot be left blank.'));
return;
}
$result_template = alerts_get_alert_template($id);
if (!$result_template) {
returnError('error_module_to_template', __('Error assigning module to template. Id_template doensn\'t exists.'));
returnError('error_module_to_template',
__('Error assigning module to template. Id_template doensn\'t exists.'));
return;
}
@ -3472,7 +3493,8 @@ function api_set_validate_all_alerts($id, $thrash1, $other, $thrash3) {
$agents_string = implode(',', $result_agents);
$sql = sprintf ("SELECT talert_template_modules.id
$sql = sprintf ("
SELECT talert_template_modules.id
FROM talert_template_modules
INNER JOIN tagente_modulo t2
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
@ -3556,7 +3578,8 @@ function api_set_validate_all_policy_alerts($id, $thrash1, $other, $thrash3) {
// If the policy has alerts
if (count($result_pol_alerts) != 0) {
$sql = sprintf ("SELECT id
$sql = sprintf ("
SELECT id
FROM talert_template_modules
WHERE id_policy_alerts IN (%s)",
$id_pol_alerts);
@ -3899,13 +3922,17 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) {
}
if ($module_policy[0]['id_module'] != 1) {
returnError('error_update_data_module_policy', __('Error updating data module in policy. Module type is not network type.'));
returnError('error_update_data_module_policy',
__('Error updating data module in policy. Module type is not network type.'));
return;
}
$fields_data_module = array('id','description', 'id_module_group', 'min', 'max', 'post_process', 'module_interval',
'min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical',
'history_data', 'configuration_data', 'disabled_types_event', 'module_macros');
$fields_data_module = array(
'id','description', 'id_module_group', 'min', 'max',
'post_process', 'module_interval', 'min_warning', 'max_warning',
'str_warning', 'min_critical', 'max_critical', 'str_critical',
'history_data', 'configuration_data', 'disabled_types_event',
'module_macros');
$cont = 0;
foreach ($fields_data_module as $field) {
@ -3917,13 +3944,15 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) {
}
$result_update = enterprise_hook('policies_update_module', array($other['data'][0], $values, false));
$result_update = enterprise_hook('policies_update_module',
array($other['data'][0], $values, false));
if ($result_update < 0)
returnError('error_update_data_module_policy', 'Error updating policy module.');
else
returnData('string', array('type' => 'string', 'data' => __('Data policy module updated.')));
returnData('string',
array('type' => 'string', 'data' => __('Data policy module updated.')));
}
/**
@ -4630,32 +4659,45 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
if ($other['data'][12] == "3") {
if ($other['data'][21] != "AES" and $other['data'][21] != "DES") {
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
return;
}
if ($other['data'][23] != "authNoPriv" and $other['data'][23] != "authPriv" and $other['data'][23] != "noAuthNoPriv"){
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
if ($other['data'][23] != "authNoPriv"
and $other['data'][23] != "authPriv"
and $other['data'][23] != "noAuthNoPriv") {
returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
return;
}
if ($other['data'][24] != "MD5" and $other['data'][24] != "SHA") {
returnError('error_update_snmp_module_policy', __('Error updating SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
returnError('error_update_snmp_module_policy',
__('Error updating SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
return;
}
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description', 'custom_string_1',
'custom_string_2', 'custom_string_3', 'plugin_parameter', 'plugin_user', 'plugin_pass');
$fields_snmp_module = array('id','disabled', 'id_module_group',
'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event',
'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
'custom_id', 'description', 'custom_string_1',
'custom_string_2', 'custom_string_3', 'plugin_parameter',
'plugin_user', 'plugin_pass');
}
else {
$fields_snmp_module = array('id','disabled', 'id_module_group', 'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event', 'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max', 'custom_id', 'description');
$fields_snmp_module = array('id','disabled', 'id_module_group',
'min_warning', 'max_warning', 'str_warning', 'min_critical',
'max_critical', 'str_critical', 'min_ff_event',
'history_data', 'tcp_port', 'tcp_send', 'snmp_community',
'snmp_oid', 'module_interval', 'post_process', 'min', 'max',
'custom_id', 'description');
}
$cont = 0;
@ -4667,13 +4709,15 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
$cont++;
}
$result_update = enterprise_hook('policies_update_module', array($other['data'][0], $values, false));
$result_update = enterprise_hook('policies_update_module',
array($other['data'][0], $values, false));
if ($result_update < 0)
returnError('error_update_snmp_module_policy', 'Error updating policy module.');
else
returnData('string', array('type' => 'string', 'data' => __('SNMP policy module updated.')));
returnData('string',
array('type' => 'string', 'data' => __('SNMP policy module updated.')));
}
@ -4720,7 +4764,8 @@ function api_set_apply_policy($id, $thrash1, $other, $thrash3) {
return -1;
}
else {
returnError('error_apply_policy', __('Error applying policy. This policy is already pending to apply.'));
returnError('error_apply_policy',
__('Error applying policy. This policy is already pending to apply.'));
return;
}
}
@ -5236,18 +5281,21 @@ function api_set_enable_disable_user ($id, $thrash2, $other, $thrash3) {
}
if ($id == "") {
returnError('error_enable_disable_user', 'Error enable/disable user. Id_user cannot be left blank.');
returnError('error_enable_disable_user',
__('Error enable/disable user. Id_user cannot be left blank.'));
return;
}
if ($other['data'][0] != "0" and $other['data'][0] != "1") {
returnError('error_enable_disable_user', 'Error enable/disable user. Enable/disable value cannot be left blank.');
returnError('error_enable_disable_user',
__('Error enable/disable user. Enable/disable value cannot be left blank.'));
return;
}
if (users_get_user_by_id($id) == false) {
returnError('error_enable_disable_user', 'Error enable/disable user. The user doesn\'t exists.');
returnError('error_enable_disable_user',
__('Error enable/disable user. The user doesn\'t exists.'));
return;
}
@ -5255,14 +5303,17 @@ function api_set_enable_disable_user ($id, $thrash2, $other, $thrash3) {
if (is_error($result)) {
// TODO: Improve the error returning more info
returnError('error_enable_disable_user', __('Error in user enabling/disabling.'));
returnError('error_enable_disable_user',
__('Error in user enabling/disabling.'));
}
else {
if ($other['data'][0] == "0") {
returnData('string', array('type' => 'string', 'data' => __('Enabled user.')));
returnData('string',
array('type' => 'string', 'data' => __('Enabled user.')));
}
else {
returnData('string', array('type' => 'string', 'data' => __('Disabled user.')));
returnData('string',
array('type' => 'string', 'data' => __('Disabled user.')));
}
}
}
@ -7697,24 +7748,28 @@ function api_set_enable_disable_agent ($id, $thrash2, $other, $thrash3) {
}
if ($id == "") {
returnError('error_enable_disable_agent', 'Error enable/disable agent. Id_agent cannot be left blank.');
returnError('error_enable_disable_agent',
__('Error enable/disable agent. Id_agent cannot be left blank.'));
return;
}
if ($other['data'][0] != "0" and $other['data'][0] != "1") {
returnError('error_enable_disable_agent', 'Error enable/disable agent. Enable/disable value cannot be left blank.');
returnError('error_enable_disable_agent',
__('Error enable/disable agent. Enable/disable value cannot be left blank.'));
return;
}
if (agents_get_name($id) == false) {
returnError('error_enable_disable_agent', 'Error enable/disable agent. The agent doesn\'t exists.');
returnError('error_enable_disable_agent',
__('Error enable/disable agent. The agent doesn\'t exists.'));
return;
}
$disabled = ( $other['data'][0] ? 0 : 1 );
$result = db_process_sql_update('tagente', array('disabled' => $disabled), array('id_agente' => $id));
$result = db_process_sql_update('tagente',
array('disabled' => $disabled), array('id_agente' => $id));
if (is_error($result)) {
// TODO: Improve the error returning more info
@ -7722,10 +7777,14 @@ function api_set_enable_disable_agent ($id, $thrash2, $other, $thrash3) {
}
else {
if ($disabled == 0) {
returnData('string', array('type' => 'string', 'data' => __('Enabled agent.')));
returnData('string',
array('type' => 'string',
'data' => __('Enabled agent.')));
}
else {
returnData('string', array('type' => 'string', 'data' => __('Disabled agent.')));
returnData('string',
array('type' => 'string',
'data' => __('Disabled agent.')));
}
}
}

View File

@ -1478,7 +1478,8 @@ function events_get_severity_types ($severity_id){
if (isset($config['text_char_long'])) {
foreach ($diferent_types as $key => $type) {
if ($key == $severity_id) {
$severity_desc = ui_print_truncate_text($type, $config['text_char_long'], false, true, false);
$severity_desc = ui_print_truncate_text($type,
$config['text_char_long'], false, true, false);
}
}
}

View File

@ -31,7 +31,10 @@
*
* @return array Void array or prediction of the module data.
*/
function forecast_projection_graph($module_id, $period = 5184000, $prediction_period, $max_value = false, $min_value = false, $csv = false){
function forecast_projection_graph($module_id,
$period = SECONDS_2MONTHS, $prediction_period, $max_value = false,
$min_value = false, $csv = false) {
global $config;
$max_exec_time = ini_get('max_execution_time');
@ -269,7 +272,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
*
* @return mixed timestamp with the prediction date or false
*/
function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0, $min_value = 0){
function forecast_prediction_date ($module_id,
$period = SECONDS_2MONTHS, $max_value = 0, $min_value = 0) {
// Checks interval
if ($min_value > $max_value) {
return false;

View File

@ -2004,14 +2004,16 @@ function graph_db_agentes_modulos($width, $height) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente
$modules = db_get_all_rows_sql ('
SELECT COUNT(id_agente_modulo), id_agente
FROM tagente_modulo
WHERE delete_pending = 0
GROUP BY id_agente
ORDER BY 1 DESC LIMIT 10');
break;
case "oracle":
$modules = db_get_all_rows_sql ('SELECT COUNT(id_agente_modulo), id_agente
$modules = db_get_all_rows_sql ('
SELECT COUNT(id_agente_modulo), id_agente
FROM tagente_modulo
WHERE rownum <= 10
AND delete_pending = 0

View File

@ -731,7 +731,8 @@ function modules_get_agentmodule ($id_agentmodule) {
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
break;
case "oracle":
$fields = db_get_all_rows_filter('USER_TAB_COLUMNS', 'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME');
$fields = db_get_all_rows_filter('USER_TAB_COLUMNS',
'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME');
foreach ($fields as $field) {
$fields_[] = $field['column_name'];
}

View File

@ -502,7 +502,8 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
if (isset ($filter[$extra_filter]) && $filter[$extra_filter] != '') {
$filter[$extra_filter] .= ',';
}
$filter[$extra_filter] = implode (',', array_keys ($values['sources']));
$filter[$extra_filter] = implode (',',
array_keys($values['sources']));
}
else {
$values = array ();
@ -571,7 +572,11 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
$values['data'][$interval_start][$source] = 0;
}
$data = netflow_get_stats ($interval_start, $interval_end, $filter, $aggregate, $max, $unit, $connection_name);
$data = netflow_get_stats($interval_start,
$interval_end, $filter, $aggregate, $max, $unit,
$connection_name);
foreach ($data as $line) {
// Address resolution start

View File

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

View File

@ -374,10 +374,16 @@ if ($pure) {
// Filter form
if ($print_agent) {
if(defined('METACONSOLE')) {
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Show Options'));;
ui_toggle(
printFormFilterAlert($id_group, $filter, $free_search,
$url, $filter_standby, $tag_filter, true, $strict_user),
__('Show Options'));;
}
else {
ui_toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, $tag_filter, true, $strict_user),__('Alert control filter'), __('Toggle filter(s)'));
ui_toggle(
printFormFilterAlert($id_group, $filter, $free_search,
$url, $filter_standby, $tag_filter, true, $strict_user),
__('Alert control filter'), __('Toggle filter(s)'));
}
}
@ -631,14 +637,17 @@ $('#ag_group').change (function (){
$("#tag_filter").css('display', 'none');
if (is_meta) {
$("#table1-0-4").css('display', 'none');
} else {
}
else {
$("#table2-0-4").css('display', 'none');
}
} else {
}
else {
$("#tag_filter").css('display', '');
if (is_meta) {
$("#table1-0-4").css('display', '');
} else {
}
else {
$("#table2-0-4").css('display', '');
}
}

View File

@ -59,17 +59,25 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
$to_date = date("U", strtotime($to_date));
// Make the query
$sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule";
$sql1="
SELECT *
FROM tdatos
WHERE id_agente = $id_agent
AND id_agente_modulo = $id_agentmodule";
$tipo = modules_get_moduletype_name (modules_get_agentmodule_type ($id_agentmodule));
if ($tipo == "generic_data_string")
$sql1 = "SELECT *
$sql1 = "
SELECT *
FROM tagente_datos_string
WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule
WHERE utimestamp > $from_date AND utimestamp < $to_date
AND id_agente_modulo = $id_agentmodule
ORDER BY utimestamp DESC";
else
$sql1 = "SELECT *
$sql1 = "
SELECT *
FROM tagente_datos
WHERE utimestamp > $from_date AND utimestamp < $to_date AND id_agente_modulo = $id_agentmodule
WHERE utimestamp > $from_date AND utimestamp < $to_date
AND id_agente_modulo = $id_agentmodule
ORDER BY utimestamp DESC";
$result1 = db_get_all_rows_sql ($sql1, true);
if ($result1 === false) {

View File

@ -531,7 +531,9 @@ foreach ($custom_fields as $custom_field) {
if (defined('METACONSOLE')) {
$table->colspan[2][0] = 7;
$table->data[2][0] = ui_toggle(html_print_table($table_custom_fields, true), __('Advanced Options'),'',true,true);
$table->data[2][0] = ui_toggle(
html_print_table($table_custom_fields, true),
__('Advanced Options'), '', true, true);
$filters .= html_print_table($table, true);
$filters .= "</form>";

View File

@ -168,7 +168,11 @@ if($searchAlerts) {
break;
}
$alertsraw = agents_get_alerts_simple ($agents, "all_enabled", array('offset' => get_parameter ('offset',0), 'limit' => $config['block_size'], 'order' => $order['field'] . " " . $order['order']), $whereAlerts);
$alertsraw = agents_get_alerts_simple($agents, "all_enabled",
array('offset' => get_parameter ('offset', 0),
'limit' => $config['block_size'],
'order' => $order['field'] . " " . $order['order']),
$whereAlerts);
$stringSearchPHP = substr($stringSearchSQL,1,strlen($stringSearchSQL)-2);

View File

@ -45,11 +45,13 @@ else {
$reports = false;
if ($searchReports) {
$sql = "SELECT id_report, name, description
$sql = "
SELECT id_report, name, description
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition.
" LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
$sql_count = "SELECT COUNT(id_report) AS count
$sql_count = "
SELECT COUNT(id_report) AS count
FROM treport
WHERE (name LIKE '%" . $stringSearchSQL . "%' OR description LIKE '%" . $stringSearchSQL . "%')".$reports_condition;

View File

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