mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php, extensions/update_manager/lib/libupdate_manager.php, godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php, godmode/alerts/alert_list.list.php, godmode/massive/massive_add_profiles.php, godmode/massive/massive_edit_modules.php, godmode/servers/manage_recontask.php, godmode/setup/setup_visuals.php, include/functions_api.php, include/functions_graph.php, include/functions_messages.php, include/graphs/functions_flot.php, include/graphs/flot/pandora.flot.js, operation/tree.php, operation/agentes/status_events.php, operation/agentes/ver_agente.php, operation/events/events_list.php, operation/events/events_marquee.php, operation/events/events_rss.php: cleaned source code style. * godmode/reporting/reporting_builder.item_editor.php, include/functions_ui.php, include/ajax/agent.php: continue to change to the new function "ui_print_agent_autocomplete_input" to make more easy (and standar) the autocomplete agent input. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b4e5748f7e
commit
02a119099f
@ -1,3 +1,27 @@
|
|||||||
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* extensions/resource_registration.php, extensions/system_info.php,
|
||||||
|
extensions/update_manager/lib/libupdate_manager.php,
|
||||||
|
godmode/agentes/modificar_agente.php,
|
||||||
|
godmode/alerts/alert_actions.php,
|
||||||
|
godmode/alerts/alert_list.list.php,
|
||||||
|
godmode/massive/massive_add_profiles.php,
|
||||||
|
godmode/massive/massive_edit_modules.php,
|
||||||
|
godmode/servers/manage_recontask.php,
|
||||||
|
godmode/setup/setup_visuals.php, include/functions_api.php,
|
||||||
|
include/functions_graph.php, include/functions_messages.php,
|
||||||
|
include/graphs/functions_flot.php,
|
||||||
|
include/graphs/flot/pandora.flot.js, operation/tree.php,
|
||||||
|
operation/agentes/status_events.php,
|
||||||
|
operation/agentes/ver_agente.php, operation/events/events_list.php,
|
||||||
|
operation/events/events_marquee.php,
|
||||||
|
operation/events/events_rss.php: cleaned source code style.
|
||||||
|
|
||||||
|
* godmode/reporting/reporting_builder.item_editor.php,
|
||||||
|
include/functions_ui.php, include/ajax/agent.php: continue to change
|
||||||
|
to the new function "ui_print_agent_autocomplete_input" to make more
|
||||||
|
easy (and standar) the autocomplete agent input.
|
||||||
|
|
||||||
2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
|
2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* gomode/netflow/nf_item_list.php
|
* gomode/netflow/nf_item_list.php
|
||||||
|
@ -526,7 +526,7 @@ function um_delete_directory($dirname) {
|
|||||||
if (!is_dir($dirname."/".$file))
|
if (!is_dir($dirname."/".$file))
|
||||||
unlink($dirname."/".$file);
|
unlink($dirname."/".$file);
|
||||||
else
|
else
|
||||||
um_delete_directory($dirname.'/'.$file);
|
um_delete_directory($dirname . '/' . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dir_handle);
|
closedir($dir_handle);
|
||||||
@ -739,9 +739,9 @@ function um_db_get_all_auths () {
|
|||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
$auths = array();
|
$auths = array();
|
||||||
while(true) {
|
while (true) {
|
||||||
$auth = um_std_from_result($result, $cont);
|
$auth = um_std_from_result($result, $cont);
|
||||||
if($auth === false) {
|
if ($auth === false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$auths[$auth->id] = $auth;
|
$auths[$auth->id] = $auth;
|
||||||
|
@ -157,7 +157,8 @@ if ($update_action) {
|
|||||||
"Trying to access Alert Management");
|
"Trying to access Alert Management");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
||||||
}
|
}
|
||||||
@ -211,21 +212,22 @@ if ($delete_action) {
|
|||||||
|
|
||||||
$al_action = alerts_get_alert_action ($id);
|
$al_action = alerts_get_alert_action ($id);
|
||||||
|
|
||||||
if ($al_action !== false){
|
if ($al_action !== false) {
|
||||||
// If user tries to delete an action with group=ALL
|
// If user tries to delete an action with group=ALL
|
||||||
if ($al_action['id_group'] == 0){
|
if ($al_action['id_group'] == 0) {
|
||||||
// then must have "PM" access privileges
|
// then must have "PM" access privileges
|
||||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Alert Management");
|
"Trying to access Alert Management");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
||||||
// If user tries to delete an action of others groups
|
// If user tries to delete an action of others groups
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$own_info = get_user_info ($config['id_user']);
|
$own_info = get_user_info ($config['id_user']);
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "LM"));
|
$own_groups = array_keys(users_get_groups($config['id_user'], "LM"));
|
||||||
@ -236,7 +238,7 @@ if ($delete_action) {
|
|||||||
if ($is_in_group)
|
if ($is_in_group)
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "", true);
|
||||||
else{
|
else {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Alert Management");
|
"Trying to access Alert Management");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
@ -84,7 +84,7 @@ if ($groups_user === false) {
|
|||||||
$groups_id = implode(',', array_keys($groups_user));
|
$groups_id = implode(',', array_keys($groups_user));
|
||||||
|
|
||||||
$form_filter .= "<tr>\n";
|
$form_filter .= "<tr>\n";
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||||
|
@ -517,6 +517,12 @@ html_print_input_hidden('id_item', $idItem);
|
|||||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
|
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
|
||||||
$params['use_input_server'] = true;
|
$params['use_input_server'] = true;
|
||||||
$params['input_server_id'] = 'hidden-server_name';
|
$params['input_server_id'] = 'hidden-server_name';
|
||||||
|
if (($config['metaconsole'] == 1) &&
|
||||||
|
(defined('METACONSOLE'))) {
|
||||||
|
//It is a page in the new metaconsole.
|
||||||
|
$params['metaconsole_enabled'] = true;
|
||||||
|
$params['javascript_ajax_page'] = '../../ajax.php';
|
||||||
|
}
|
||||||
ui_print_agent_autocomplete_input($params);
|
ui_print_agent_autocomplete_input($params);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -231,7 +231,8 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1) && defined('METACONSOL
|
|||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$data[] = array('id' => $agent['id_agente'],
|
$data[] = array('id' => $agent['id_agente'],
|
||||||
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
|
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
|
||||||
'ip' => io_safe_output($agent['direccion']));
|
'ip' => io_safe_output($agent['direccion']),
|
||||||
|
'server' => io_safe_output($server['server_name']));
|
||||||
}
|
}
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
|
@ -2395,14 +2395,14 @@ function api_get_plugins($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
function api_set_create_network_module_from_component($agent_name, $component_name, $thrash1, $thrash2) {
|
function api_set_create_network_module_from_component($agent_name, $component_name, $thrash1, $thrash2) {
|
||||||
$agent_id = agents_get_agent_id($agent_name);
|
$agent_id = agents_get_agent_id($agent_name);
|
||||||
|
|
||||||
if (!$agent_id){
|
if (!$agent_id) {
|
||||||
returnError('error_network_module_from_component', __('Error creating module from network component. Agent doesn\'t exists.'));
|
returnError('error_network_module_from_component', __('Error creating module from network component. Agent doesn\'t exists.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$component= db_get_row ('tnetwork_component', 'name', $component_name);
|
$component= db_get_row ('tnetwork_component', 'name', $component_name);
|
||||||
|
|
||||||
if (!$component){
|
if (!$component) {
|
||||||
returnError('error_network_module_from_component', __('Error creating module from network component. Network component doesn\'t exists.'));
|
returnError('error_network_module_from_component', __('Error creating module from network component. Network component doesn\'t exists.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2420,7 +2420,7 @@ function api_set_create_network_module_from_component($agent_name, $component_na
|
|||||||
// Create module
|
// Create module
|
||||||
$module_id = modules_create_agent_module ($agent_id, $component_name, $component, true);
|
$module_id = modules_create_agent_module ($agent_id, $component_name, $component, true);
|
||||||
|
|
||||||
if (!$module_id){
|
if (!$module_id) {
|
||||||
returnError('error_network_module_from_component', __('Error creating module from network component. Error creating module.'));
|
returnError('error_network_module_from_component', __('Error creating module from network component. Error creating module.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2932,17 +2932,17 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
* @param $thrash3 Don't use
|
* @param $thrash3 Don't use
|
||||||
*/
|
*/
|
||||||
function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
if ($id == ""){
|
if ($id == "") {
|
||||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_policy cannot be left blank.'));
|
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_policy cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == ""){
|
if ($other['data'][0] == "") {
|
||||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Module_name cannot be left blank.'));
|
returnError('error_network_data_module_policy', __('Error adding network module to policy. Module_name cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][1] < 6 or $other['data'][1] > 18){
|
if ($other['data'][1] < 6 or $other['data'][1] > 18) {
|
||||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_module_type is not correct for network modules.'));
|
returnError('error_network_data_module_policy', __('Error adding network module to policy. Id_module_type is not correct for network modules.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2977,7 +2977,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
$values['snmp_oid'] = $other['data'][19];
|
$values['snmp_oid'] = $other['data'][19];
|
||||||
$values['custom_id'] = $other['data'][20];
|
$values['custom_id'] = $other['data'][20];
|
||||||
|
|
||||||
if ($name_module_policy !== false){
|
if ($name_module_policy !== false) {
|
||||||
if ($name_module_policy[0]['name'] == $other['data'][0]){
|
if ($name_module_policy[0]['name'] == $other['data'][0]){
|
||||||
returnError('error_network_data_module_policy', __('Error adding network module to policy. The module is already in the policy.'));
|
returnError('error_network_data_module_policy', __('Error adding network module to policy. The module is already in the policy.'));
|
||||||
return;
|
return;
|
||||||
@ -3074,17 +3074,17 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
* @param $thrash3 Don't use
|
* @param $thrash3 Don't use
|
||||||
*/
|
*/
|
||||||
function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
if ($id == ""){
|
if ($id == "") {
|
||||||
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_policy cannot be left blank.'));
|
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_policy cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == ""){
|
if ($other['data'][0] == "") {
|
||||||
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Module_name cannot be left blank.'));
|
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Module_name cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][22] == ""){
|
if ($other['data'][22] == "") {
|
||||||
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_plugin cannot be left blank.'));
|
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. Id_plugin cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3123,8 +3123,8 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
$values['plugin_pass'] = $other['data'][23];
|
$values['plugin_pass'] = $other['data'][23];
|
||||||
$values['plugin_parameter'] = $other['data'][24];
|
$values['plugin_parameter'] = $other['data'][24];
|
||||||
|
|
||||||
if ($name_module_policy !== false){
|
if ($name_module_policy !== false) {
|
||||||
if ($name_module_policy[0]['name'] == $other['data'][0]){
|
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||||
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. The module is already in the policy.'));
|
returnError('error_add_plugin_module_policy', __('Error adding plugin module to policy. The module is already in the policy.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3136,7 +3136,6 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
returnData('string', array('type' => 'string', 'data' => $success));
|
returnData('string', array('type' => 'string', 'data' => $success));
|
||||||
else
|
else
|
||||||
returnError('error_add_plugin_module_policy', 'Error adding plugin module to policy.');
|
returnError('error_add_plugin_module_policy', 'Error adding plugin module to policy.');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3353,12 +3352,12 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d
|
|||||||
* @param $thrash3 Don't use
|
* @param $thrash3 Don't use
|
||||||
*/
|
*/
|
||||||
function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
||||||
if ($id == ""){
|
if ($id == "") {
|
||||||
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_policy cannot be left blank.'));
|
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_policy cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][0] == ""){
|
if ($other['data'][0] == "") {
|
||||||
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Module_name cannot be left blank.'));
|
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Module_name cannot be left blank.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3371,25 +3370,25 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][2] < 15 or $other['data'][2] > 18){
|
if ($other['data'][2] < 15 or $other['data'][2] > 18) {
|
||||||
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_module_type is not correct for SNMP modules.'));
|
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. Id_module_type is not correct for SNMP modules.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# SNMP version 3
|
# SNMP version 3
|
||||||
if ($other['data'][13] == "3"){
|
if ($other['data'][13] == "3") {
|
||||||
|
|
||||||
if ($other['data'][22] != "AES" and $other['data'][22] != "DES"){
|
if ($other['data'][22] != "AES" and $other['data'][22] != "DES") {
|
||||||
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
|
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exists. Set it to \'AES\' or \'DES\'. '));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][24] != "authNoPriv" and $other['data'][24] != "authPriv" and $other['data'][24] != "noAuthNoPriv"){
|
if ($other['data'][24] != "authNoPriv" and $other['data'][24] != "authPriv" and $other['data'][24] != "noAuthNoPriv") {
|
||||||
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
|
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_sec_level doesn\'t exists. Set it to \'authNoPriv\' or \'authPriv\' or \'noAuthNoPriv\'. '));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['data'][25] != "MD5" and $other['data'][25] != "SHA"){
|
if ($other['data'][25] != "MD5" and $other['data'][25] != "SHA") {
|
||||||
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
|
returnError('error_add_snmp_module_policy', __('Error in creation SNMP module. snmp3_auth_method doesn\'t exists. Set it to \'MD5\' or \'SHA\'. '));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3450,8 +3449,8 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($name_module_policy !== false){
|
if ($name_module_policy !== false) {
|
||||||
if ($name_module_policy[0]['name'] == $other['data'][0]){
|
if ($name_module_policy[0]['name'] == $other['data'][0]) {
|
||||||
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. The module is already in the policy.'));
|
returnError('error_add_snmp_module_policy', __('Error adding SNMP module to policy. The module is already in the policy.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2128,18 +2128,43 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||||||
$none_module_text = $parameters['none_module_text'];
|
$none_module_text = $parameters['none_module_text'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$print_input_server = false; //Default value
|
||||||
|
if (isset($parameters['print_input_server'])) {
|
||||||
|
$print_input_server = $parameters['print_input_server'];
|
||||||
|
}
|
||||||
|
|
||||||
$use_input_server = false; //Default value
|
$use_input_server = false; //Default value
|
||||||
if (isset($parameters['use_input_server'])) {
|
if (isset($parameters['use_input_server'])) {
|
||||||
$use_input_server = $parameters['use_input_server'];
|
$use_input_server = $parameters['use_input_server'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$input_server_id = false; //Default value
|
$input_server_name = uniqid('server_'); //Default value
|
||||||
if (isset($parameters['input_server_id'])) {
|
if (isset($parameters['input_server_id'])) {
|
||||||
$input_server_id = $parameters['input_server_id'];
|
$input_server_id = $parameters['input_server_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$input_server_id = 'hidden-' . $input_server_name; //Default value
|
||||||
|
if (isset($parameters['input_server_id'])) {
|
||||||
|
$input_server_id = $parameters['input_server_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$input_server_value = ''; //Default value
|
||||||
|
if (isset($parameters['input_server_value'])) {
|
||||||
|
$input_server_value = $parameters['input_server_value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$metaconsole_enabled = false; //Default value
|
||||||
|
if (isset($parameters['metaconsole_enabled'])) {
|
||||||
|
$metaconsole_enabled = $parameters['metaconsole_enabled'];
|
||||||
|
}
|
||||||
|
|
||||||
// Javascript configurations
|
// Javascript configurations
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
|
$javascript_ajax_page = 'ajax.php'; //Default value
|
||||||
|
if (isset($parameters['javascript_ajax_page'])) {
|
||||||
|
$javascript_ajax_page = $parameters['javascript_ajax_page'];
|
||||||
|
}
|
||||||
|
|
||||||
$javascript_function_action_after_select = ''; //Default value
|
$javascript_function_action_after_select = ''; //Default value
|
||||||
$javascript_function_action_after_select_js_call = ''; //Default value
|
$javascript_function_action_after_select_js_call = ''; //Default value
|
||||||
if (isset($parameters['javascript_function_action_after_select'])) {
|
if (isset($parameters['javascript_function_action_after_select'])) {
|
||||||
@ -2199,10 +2224,20 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||||||
inputs.push ("get_agent_modules_json=1");
|
inputs.push ("get_agent_modules_json=1");
|
||||||
inputs.push ("page=operation/agentes/ver_agente");
|
inputs.push ("page=operation/agentes/ver_agente");
|
||||||
|
|
||||||
|
if (' . ((int)$metaconsole_enabled) . ') {
|
||||||
|
inputs.push ("server_name=" + $("#' . $input_server_id . '").val());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((' . ((int)$print_hidden_input_idagent) . ')
|
||||||
|
|| (' . ((int)$use_hidden_input_idagent) . ')) {
|
||||||
|
|
||||||
|
inputs.push ("id_agent=" + $("#' . $hidden_input_idagent_id . '").val());
|
||||||
|
}
|
||||||
|
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: inputs.join ("&"),
|
data: inputs.join ("&"),
|
||||||
type: "GET",
|
type: "POST",
|
||||||
url: action="ajax.php",
|
url: action="' . $javascript_ajax_page . '",
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
@ -2304,7 +2339,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||||||
data: data_params,
|
data: data_params,
|
||||||
async: false,
|
async: false,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: action="ajax.php",
|
url: action="' . $javascript_ajax_page . '",
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
@ -2319,25 +2354,36 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
var agent_name = ui.item.name;
|
var agent_name = ui.item.name;
|
||||||
var agent_id = ui.item.id;
|
var agent_id = ui.item.id;
|
||||||
var server_name = ui.item.ip;
|
var server_name;
|
||||||
|
|
||||||
|
if (' . ((int)$metaconsole_enabled) . ') {
|
||||||
|
server_name = ui.item.server;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
server_name = ui.item.ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Put the name
|
//Put the name
|
||||||
$(this).val(agent_name);
|
$(this).val(agent_name);
|
||||||
|
|
||||||
if (' . ((int)$javascript_is_function_select) . ') {
|
|
||||||
' . $javascript_name_function_select . '(agent_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((' . ((int)$print_hidden_input_idagent) . ')
|
if ((' . ((int)$print_hidden_input_idagent) . ')
|
||||||
|| (' . ((int)$use_hidden_input_idagent) . ')) {
|
|| (' . ((int)$use_hidden_input_idagent) . ')) {
|
||||||
$("#' . $hidden_input_idagent_id . '").val(agent_id);
|
$("#' . $hidden_input_idagent_id . '").val(agent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Put the server id into the hidden input
|
//Put the server id into the hidden input
|
||||||
if (' . ((int)$use_input_server) . ') {
|
if ((' . ((int)$use_input_server) . ')
|
||||||
|
|| (' . ((int)$print_input_server) . ')) {
|
||||||
$("#' . $input_server_id . '").val(server_name);
|
$("#' . $input_server_id . '").val(server_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Call the function to select (example fill the modules)
|
||||||
|
if (' . ((int)$javascript_is_function_select) . ') {
|
||||||
|
' . $javascript_name_function_select . '(agent_name);
|
||||||
|
}
|
||||||
|
|
||||||
//Function to call after the select
|
//Function to call after the select
|
||||||
if (' . ((int)!empty($javascript_function_action_after_select_js_call)) . ') {
|
if (' . ((int)!empty($javascript_function_action_after_select_js_call)) . ') {
|
||||||
' . $javascript_function_action_after_select_js_call . '
|
' . $javascript_function_action_after_select_js_call . '
|
||||||
@ -2409,6 +2455,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||||||
$hidden_input_idagent_value, $hidden_input_idagent_id, true);
|
$hidden_input_idagent_value, $hidden_input_idagent_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($print_input_server) {
|
||||||
|
$html .= html_print_input_hidden_extended($input_server_name,
|
||||||
|
$input_server_value, $input_server_id, true);
|
||||||
|
}
|
||||||
|
|
||||||
//Write the javascript
|
//Write the javascript
|
||||||
if ($javascript) {
|
if ($javascript) {
|
||||||
if ($javascript_tags) {
|
if ($javascript_tags) {
|
||||||
|
@ -142,8 +142,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
|||||||
$colors = array();
|
$colors = array();
|
||||||
|
|
||||||
$index = array_keys(reset($chart_data));
|
$index = array_keys(reset($chart_data));
|
||||||
foreach($index as $serie_key) {
|
foreach ($index as $serie_key) {
|
||||||
if(isset($color[$serie_key])) {
|
if (isset($color[$serie_key])) {
|
||||||
$colors[] = $color[$serie_key]['color'];
|
$colors[] = $color[$serie_key]['color'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -157,21 +157,21 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
|||||||
foreach($values as $key => $value) {
|
foreach($values as $key => $value) {
|
||||||
$jsvar = "data_".$graph_id."_".$key;
|
$jsvar = "data_".$graph_id."_".$key;
|
||||||
|
|
||||||
if(!isset($serie_types[$key])) {
|
if (!isset($serie_types[$key])) {
|
||||||
$serie_types2[$jsvar] = 'line';
|
$serie_types2[$jsvar] = 'line';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$serie_types2[$jsvar] = $serie_types[$key];
|
$serie_types2[$jsvar] = $serie_types[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($serie_types2[$jsvar] == 'points' && $value == 0) {
|
if ($serie_types2[$jsvar] == 'points' && $value == 0) {
|
||||||
$data[$jsvar][] = 'null';
|
$data[$jsvar][] = 'null';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$data[$jsvar][] = $value;
|
$data[$jsvar][] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($legend[$key])) {
|
if (!isset($legend[$key])) {
|
||||||
$legend2[$jsvar] = 'null';
|
$legend2[$jsvar] = 'null';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -201,22 +201,22 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
|||||||
// Max is "n-1" because start with 0
|
// Max is "n-1" because start with 0
|
||||||
$max_x--;
|
$max_x--;
|
||||||
|
|
||||||
if($menu) {
|
if ($menu) {
|
||||||
$threshold = false;
|
$threshold = false;
|
||||||
if($yellow_threshold != 0 || $red_threshold != 0) {
|
if ($yellow_threshold != 0 || $red_threshold != 0) {
|
||||||
$threshold = true;
|
$threshold = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbuttons = 2;
|
$nbuttons = 2;
|
||||||
|
|
||||||
if($threshold) {
|
if ($threshold) {
|
||||||
$nbuttons++;
|
$nbuttons++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu_width = 18 * $nbuttons + 8;
|
$menu_width = 18 * $nbuttons + 8;
|
||||||
$return .= "<div id='menu_$graph_id' style='display:none; text-align:center; width:".$menu_width."px; position:relative; border: solid 1px #666; border-bottom: 0px; padding: 4px 4px 4px 4px'>
|
$return .= "<div id='menu_$graph_id' style='display:none; text-align:center; width:".$menu_width."px; position:relative; border: solid 1px #666; border-bottom: 0px; padding: 4px 4px 4px 4px'>
|
||||||
<a href='javascript:'><img id='menu_cancelzoom_$graph_id' src='".$homeurl."images/zoom_cross.disabled.png' alt='".__('Cancel zoom')."' title='".__('Cancel zoom')."'></a>";
|
<a href='javascript:'><img id='menu_cancelzoom_$graph_id' src='".$homeurl."images/zoom_cross.disabled.png' alt='".__('Cancel zoom')."' title='".__('Cancel zoom')."'></a>";
|
||||||
if($threshold) {
|
if ($threshold) {
|
||||||
$return .= "<a href='javascript:'><img id='menu_threshold_$graph_id' src='".$homeurl."images/chart_curve_threshold.png' alt='".__('Warning and Critical thresholds')."' title='".__('Warning and Critical thresholds')."'></a>";
|
$return .= "<a href='javascript:'><img id='menu_threshold_$graph_id' src='".$homeurl."images/chart_curve_threshold.png' alt='".__('Warning and Critical thresholds')."' title='".__('Warning and Critical thresholds')."'></a>";
|
||||||
}
|
}
|
||||||
$return .= "<a href='javascript:'><img id='menu_overview_$graph_id' src='".$homeurl."images/chart_curve_overview.png' alt='".__('Overview graph')."' title='".__('Overview graph')."'></a>
|
$return .= "<a href='javascript:'><img id='menu_overview_$graph_id' src='".$homeurl."images/chart_curve_overview.png' alt='".__('Overview graph')."' title='".__('Overview graph')."'></a>
|
||||||
@ -235,8 +235,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
|||||||
$legend_events = '';
|
$legend_events = '';
|
||||||
$legend_alerts = '';
|
$legend_alerts = '';
|
||||||
|
|
||||||
foreach($chart_extra_data as $i => $data) {
|
foreach ($chart_extra_data as $i => $data) {
|
||||||
switch($i) {
|
switch ($i) {
|
||||||
case 'legend_alerts':
|
case 'legend_alerts':
|
||||||
$legend_alerts = $data;
|
$legend_alerts = $data;
|
||||||
break;
|
break;
|
||||||
@ -275,7 +275,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
|||||||
$colors = implode($separator, $colors);
|
$colors = implode($separator, $colors);
|
||||||
|
|
||||||
// transform into string to pass to javascript
|
// transform into string to pass to javascript
|
||||||
if($force_integer) {
|
if ($force_integer) {
|
||||||
$force_integer = 'true';
|
$force_integer = 'true';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -353,7 +353,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
|
|||||||
$return .= "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
$return .= "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||||
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
||||||
|
|
||||||
if($water_mark != '') {
|
if ($water_mark != '') {
|
||||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
||||||
$watermark = 'true';
|
$watermark = 'true';
|
||||||
}
|
}
|
||||||
@ -372,14 +372,14 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
|
|||||||
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
$i = count($graph_data);
|
$i = count($graph_data);
|
||||||
foreach($graph_data as $label => $values) {
|
foreach ($graph_data as $label => $values) {
|
||||||
$labels[] = io_safe_output($label);
|
$labels[] = io_safe_output($label);
|
||||||
$i--;
|
$i--;
|
||||||
|
|
||||||
foreach($values as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
$jsvar = "data_".$graph_id."_".$key;
|
$jsvar = "data_".$graph_id."_".$key;
|
||||||
|
|
||||||
if($multicolor) {
|
if ($multicolor) {
|
||||||
for($j = count($graph_data) - 1; $j>=0; $j--) {
|
for($j = count($graph_data) - 1; $j>=0; $j--) {
|
||||||
if($j == $i) {
|
if($j == $i) {
|
||||||
$data[$jsvar.$i][$j] = $value;
|
$data[$jsvar.$i][$j] = $value;
|
||||||
@ -411,7 +411,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
|
|||||||
|
|
||||||
$values2 = array();
|
$values2 = array();
|
||||||
|
|
||||||
foreach($data as $jsvar => $values) {
|
foreach ($data as $jsvar => $values) {
|
||||||
$values2[] = implode($separator,$values);
|
$values2[] = implode($separator,$values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||||||
$return .= "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
$return .= "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||||
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
||||||
|
|
||||||
if($water_mark != '') {
|
if ($water_mark != '') {
|
||||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
||||||
$watermark = 'true';
|
$watermark = 'true';
|
||||||
}
|
}
|
||||||
@ -458,8 +458,8 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||||||
$colors = array();
|
$colors = array();
|
||||||
$index = array_keys(reset($graph_data));
|
$index = array_keys(reset($graph_data));
|
||||||
|
|
||||||
foreach($index as $serie_key) {
|
foreach ($index as $serie_key) {
|
||||||
if(isset($color[$serie_key])) {
|
if (isset($color[$serie_key])) {
|
||||||
$colors[] = $color[$serie_key]['color'];
|
$colors[] = $color[$serie_key]['color'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -478,11 +478,11 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||||||
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
$i = count($graph_data);
|
$i = count($graph_data);
|
||||||
foreach($graph_data as $label => $values) {
|
foreach ($graph_data as $label => $values) {
|
||||||
$labels[] = io_safe_output($label);
|
$labels[] = io_safe_output($label);
|
||||||
$i--;
|
$i--;
|
||||||
|
|
||||||
foreach($values as $key => $value) {
|
foreach ($values as $key => $value) {
|
||||||
$jsvar = "data_".$graph_id."_".$key;
|
$jsvar = "data_".$graph_id."_".$key;
|
||||||
|
|
||||||
if($multicolor) {
|
if($multicolor) {
|
||||||
@ -500,7 +500,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||||||
}
|
}
|
||||||
|
|
||||||
//$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
|
//$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
|
||||||
if($value > $max) {
|
if ($value > $max) {
|
||||||
$max = $value;
|
$max = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,5 +655,4 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -316,10 +316,14 @@ if (is_ajax ()) {
|
|||||||
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
|
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
|
||||||
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
|
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
|
|
||||||
if (metaconsole_load_external_db($connection) == NOERR) {
|
if (metaconsole_load_external_db($connection) == NOERR) {
|
||||||
/* Get all agents if no agent was given */
|
/* Get all agents if no agent was given */
|
||||||
if ($id_agent == 0)
|
if ($id_agent == 0)
|
||||||
$id_agent = array_keys (agents_get_group_agents (array_keys (users_get_groups ()), $search, "none"));
|
$id_agent = array_keys (
|
||||||
|
agents_get_group_agents (
|
||||||
|
array_keys (users_get_groups ()), $search, "none"));
|
||||||
|
|
||||||
|
|
||||||
$agent_modules = agents_get_modules ($id_agent,
|
$agent_modules = agents_get_modules ($id_agent,
|
||||||
($fields != '' ? explode (',', $fields) : "*"),
|
($fields != '' ? explode (',', $fields) : "*"),
|
||||||
|
@ -1135,7 +1135,9 @@ foreach ($result as $event) {
|
|||||||
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
||||||
}
|
}
|
||||||
$string .= '</td></tr>';
|
$string .= '</td></tr>';
|
||||||
} else if ($event["criticity"] == 3) {
|
}
|
||||||
|
|
||||||
|
if ($event["criticity"] == 3) {
|
||||||
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Warning instructions') . '</td><td align="left">';
|
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Warning instructions') . '</td><td align="left">';
|
||||||
if ($event["warning_instructions"] != '') {
|
if ($event["warning_instructions"] != '') {
|
||||||
$string .= $event["warning_instructions"];
|
$string .= $event["warning_instructions"];
|
||||||
@ -1146,7 +1148,9 @@ foreach ($result as $event) {
|
|||||||
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
||||||
}
|
}
|
||||||
$string .= '</td></tr>';
|
$string .= '</td></tr>';
|
||||||
} else if ($event["criticity"] == 0) {
|
}
|
||||||
|
|
||||||
|
if ($event["criticity"] == 0) {
|
||||||
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">';
|
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">';
|
||||||
if ($event["unknown_instructions"] != '') {
|
if ($event["unknown_instructions"] != '') {
|
||||||
$string .= $event["unknown_instructions"];
|
$string .= $event["unknown_instructions"];
|
||||||
|
@ -194,8 +194,8 @@ if (is_ajax ())
|
|||||||
case 'module':
|
case 'module':
|
||||||
//Replace separator token "articapandora_32_pandoraartica_" for " "
|
//Replace separator token "articapandora_32_pandoraartica_" for " "
|
||||||
//example:
|
//example:
|
||||||
// "Load_articapandora_32_pandoraartica_Average"
|
//"Load_articapandora_32_pandoraartica_Average"
|
||||||
// result -> "Load Average"
|
//result -> "Load Average"
|
||||||
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id);
|
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id);
|
||||||
|
|
||||||
$name = io_safe_input($name);
|
$name = io_safe_input($name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user