2008-08-22 20:07:32 +02:00
< ? php
2019-05-27 19:00:48 +02:00
/**
2022-11-15 08:05:04 +01:00
* Agent Creation / Edition view
2019-05-27 19:00:48 +02:00
*
* @ category Agent editor / builder .
* @ package Pandora FMS
* @ subpackage Classic agent management view .
2022-11-15 08:05:04 +01:00
* @ version 2.0 . 0
2019-05-27 19:00:48 +02:00
* @ license See below
*
* ______ ___ _______ _______ ________
2023-06-08 12:42:10 +02:00
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
2019-05-27 19:00:48 +02:00
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
2023-06-08 11:53:13 +02:00
* Copyright ( c ) 2005 - 2023 Pandora FMS
2023-06-08 13:19:01 +02:00
* Please see https :// pandorafms . com / community / for full contribution list
2019-05-27 19:00:48 +02:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
* ============================================================================
*/
// Begin.
2019-01-30 16:18:44 +01:00
enterprise_include ( 'godmode/agentes/agent_manager.php' );
require_once 'include/functions_clippy.php' ;
require_once 'include/functions_servers.php' ;
require_once 'include/functions_gis.php' ;
require_once $config [ 'homedir' ] . '/include/functions_agents.php' ;
require_once $config [ 'homedir' ] . '/include/functions_users.php' ;
2022-11-15 08:05:04 +01:00
if ( is_ajax () === true ) {
2019-01-30 16:18:44 +01:00
global $config ;
$search_parents_2 = ( bool ) get_parameter ( 'search_parents_2' );
if ( $search_parents_2 ) {
include_once 'include/functions_agents.php' ;
$id_agent = ( int ) get_parameter ( 'id_agent' );
$string = ( string ) get_parameter ( 'q' );
2019-05-27 19:00:48 +02:00
// Field q is what autocomplete plugin gives.
2019-01-30 16:18:44 +01:00
$filter = [];
2022-02-01 15:18:45 +01:00
$filter [] = '(nombre LIKE "%' . $string . '%" OR direccion LIKE "%' . $string . '%" OR comentarios LIKE "%' . $string . '%" OR alias LIKE "%' . $string . '%")' ;
2019-01-30 16:18:44 +01:00
$filter [] = 'id_agente != ' . $id_agent ;
2019-05-27 19:00:48 +02:00
$agents = agents_get_agents (
$filter ,
[
'id_agente' ,
'nombre' ,
'direccion' ,
]
);
2019-01-30 16:18:44 +01:00
if ( $agents === false ) {
$agents = [];
}
$data = [];
foreach ( $agents as $agent ) {
$data [] = [
'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
'ip' => io_safe_output ( $agent [ 'direccion' ]),
];
}
echo io_json_mb_encode ( $data );
return ;
}
$get_modules_json_for_multiple_snmp = ( bool ) get_parameter ( 'get_modules_json_for_multiple_snmp' , 0 );
2019-06-25 15:19:40 +02:00
$get_common_modules = ( bool ) get_parameter ( 'get_common_modules' , 1 );
2019-01-30 16:18:44 +01:00
if ( $get_modules_json_for_multiple_snmp ) {
include_once 'include/graphs/functions_utils.php' ;
$idSNMP = get_parameter ( 'id_snmp' );
$id_snmp_serialize = get_parameter ( 'id_snmp_serialize' );
$snmp = unserialize_in_temp ( $id_snmp_serialize , false );
$oid_snmp = [];
$out = false ;
foreach ( $idSNMP as $id ) {
foreach ( $snmp [ $id ] as $key => $value ) {
2019-05-27 21:30:46 +02:00
// Check if it has "ifXXXX" syntax and skip it.
2019-01-30 16:18:44 +01:00
if ( ! preg_match ( '/if/' , $key )) {
continue ;
}
$oid_snmp [ $value [ 'oid' ]] = $key ;
}
if ( $out === false ) {
$out = $oid_snmp ;
} else {
2019-06-25 15:19:40 +02:00
$commons = array_intersect ( $out , $oid_snmp );
if ( $get_common_modules ) {
2021-11-19 10:51:46 +01:00
// Common modules is selected (default).
2019-06-25 15:19:40 +02:00
$out = $commons ;
} else {
2021-11-19 10:51:46 +01:00
// All modules is selected.
2019-06-25 15:19:40 +02:00
$array1 = array_diff ( $out , $oid_snmp );
$array2 = array_diff ( $oid_snmp , $out );
$out = array_merge ( $commons , $array1 , $array2 );
}
2019-01-30 16:18:44 +01:00
}
$oid_snmp = [];
}
echo io_json_mb_encode ( $out );
}
2019-05-27 21:30:46 +02:00
// And and remove groups use the same function.
2019-01-30 16:18:44 +01:00
$add_secondary_groups = get_parameter ( 'add_secondary_groups' );
$remove_secondary_groups = get_parameter ( 'remove_secondary_groups' );
if ( $add_secondary_groups || $remove_secondary_groups ) {
$id_agent = get_parameter ( 'id_agent' );
$groups_to_add = get_parameter ( 'groups' );
if ( enterprise_installed ()) {
if ( empty ( $groups_to_add )) {
return 0 ;
}
enterprise_include ( 'include/functions_agents.php' );
$ret = enterprise_hook (
'agents_update_secondary_groups' ,
[
$id_agent ,
2021-11-19 10:51:46 +01:00
(( $add_secondary_groups ) ? $groups_to_add : []),
(( $remove_secondary_groups ) ? $groups_to_add : []),
2019-01-30 16:18:44 +01:00
]
);
// Echo 0 in case of error. 0 Otherwise.
2021-11-19 10:51:46 +01:00
echo (( bool ) $ret === true ) ? 1 : 0 ;
2019-01-30 16:18:44 +01:00
}
}
return ;
2009-06-09 13:25:47 +02:00
}
2009-04-13 17:05:21 +02:00
2011-04-13 18:11:02 +02:00
ui_require_javascript_file ( 'openlayers.pandora' );
2010-02-09 18:06:25 +01:00
2022-11-15 08:05:04 +01:00
if ( isset ( $id_agente ) === false ) {
2022-01-20 10:55:23 +01:00
db_pandora_audit (
AUDIT_LOG_ACL_VIOLATION ,
'Trying to access agent manager witout an agent'
);
2019-01-30 16:18:44 +01:00
include 'general/noaccess.php' ;
return ;
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
}
2007-02-27 20:03:56 +01:00
2022-11-15 08:05:04 +01:00
$new_agent = ( empty ( $id_agente ) === true ) ? true : false ;
if ( $new_agent === true ) {
if ( empty ( $direccion_agente ) === false && empty ( $nombre_agente ) === true ) {
2019-01-30 16:18:44 +01:00
$nombre_agente = $direccion_agente ;
}
$servers = servers_get_names ();
2022-11-15 08:05:04 +01:00
if ( empty ( $servers ) === false ) {
2019-01-30 16:18:44 +01:00
$array_keys_servers = array_keys ( $servers );
$server_name = reset ( $array_keys_servers );
}
2022-11-15 08:05:04 +01:00
} else {
2019-05-27 21:30:46 +02:00
// Agent remote configuration editor.
2019-01-30 16:18:44 +01:00
enterprise_include_once ( 'include/functions_config_agents.php' );
2022-11-15 08:05:04 +01:00
if ( enterprise_installed () === true ) {
2019-01-30 16:18:44 +01:00
$filename = config_agents_get_agent_config_filenames ( $id_agente );
}
2013-01-09 17:19:20 +01:00
}
2008-11-20 15:09:26 +01:00
2019-01-30 16:18:44 +01:00
$disk_conf_delete = ( bool ) get_parameter ( 'disk_conf_delete' );
2019-05-27 21:30:46 +02:00
// Agent remote configuration DELETE.
2022-11-15 08:05:04 +01:00
if ( $disk_conf_delete === true ) {
2019-01-30 16:18:44 +01:00
// TODO: Get this working on computers where the Pandora server(s) are not on the webserver
2019-05-27 21:30:46 +02:00
// TODO: Get a remote_config editor working in the open version.
2019-01-30 16:18:44 +01:00
@ unlink ( $filename [ 'md5' ]);
@ unlink ( $filename [ 'conf' ]);
2008-06-19 02:24:05 +02:00
}
2023-02-24 12:05:53 +01:00
echo '<div class="max_floating_element_size">' ;
2022-02-03 12:56:36 +01:00
echo '<form autocomplete="new-password" name="conf_agent" id="form_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">' ;
2008-11-20 15:09:26 +01:00
2019-05-27 15:41:23 +02:00
// Custom ID.
$custom_id_div = '<div class="label_select">' ;
2022-11-15 16:02:40 +01:00
$custom_id_div .= '<p class="font_10pt">' . __ ( 'Custom ID' ) . ': </p>' ;
2019-05-27 15:41:23 +02:00
$custom_id_div .= html_print_input_text (
'custom_id' ,
$custom_id ,
'' ,
16 ,
255 ,
true ,
false ,
false ,
'' ,
'agent_custom_id'
) . '</div>' ;
2022-11-11 16:15:17 +01:00
// Get groups.
$groups = users_get_groups ( $config [ 'id_user' ], 'AR' , false );
// Get modules.
$modules = db_get_all_rows_sql (
' SELECT id_agente_modulo as id_module , nombre as name FROM tagente_modulo
2023-07-06 12:30:26 +02:00
WHERE id_agente = ' . $id_agente
2022-11-11 16:15:17 +01:00
);
$modules_values = [];
$modules_values [ 0 ] = __ ( 'Any' );
if ( is_array ( $modules ) === true ) {
foreach ( $modules as $m ) {
$modules_values [ $m [ 'id_module' ]] = $m [ 'name' ];
}
}
2022-11-15 08:05:04 +01:00
// Remote configuration available.
if ( isset ( $filename ) === true && file_exists ( $filename [ 'md5' ]) === true ) {
$remote_agent = true ;
$agent_md5 = md5 ( io_safe_output ( agents_get_name ( $id_agente )), false );
} else {
$remote_agent = false ;
}
2022-11-11 16:15:17 +01:00
// Get Servers.
$servers = servers_get_names ();
// Set the agent have not server.
if ( array_key_exists ( $server_name , $servers ) === false ) {
$server_name = 0 ;
}
if ( $new_agent === true ) {
// Set first server by default.
$servers_get_names = $servers ;
$array_keys_servers_get_names = array_keys ( $servers_get_names );
$server_name = reset ( $array_keys_servers_get_names );
}
2022-11-15 08:05:04 +01:00
// QR Code table.
if ( $new_agent === false ) {
$CodeQRContent .= html_print_div ([ 'id' => 'qr_container_image' ], true );
$CodeQRContent .= html_print_anchor (
[
'id' => 'qr_code_agent_view' ,
'href' => ui_get_full_url ( 'mobile/index.php?page=agent&id=' . $id_agente ),
],
true
);
$CodeQRContent .= '<br/>' . $custom_id_div ;
// QR code div.
$CodeQRTable = html_print_div (
[
2022-11-15 16:02:40 +01:00
'class' => 'agent_qr' ,
2022-11-15 08:05:04 +01:00
'content' => $CodeQRContent ,
],
true
);
} else {
$CodeQRTable = '' ;
}
// Advanced mode.
if ( enterprise_installed () === true ) {
// Safe operation mode.
if ( $new_agent === false ) {
$sql_modules = db_get_all_rows_sql (
' SELECT id_agente_modulo as id_module , nombre as name FROM tagente_modulo
WHERE id_agente = ' . $id_agente
);
$safe_mode_modules = [];
$safe_mode_modules [ 0 ] = __ ( 'Any' );
if ( is_array ( $sql_modules ) === true ) {
foreach ( $sql_modules as $m ) {
$safe_mode_modules [ $m [ 'id_module' ]] = $m [ 'name' ];
}
}
}
// Calculate cps value - agents.
if ( $new_agent === false ) {
$cps_val = service_agents_cps ( $id_agente );
} else {
// No agent defined, use received cps as base value.
if ( $cps >= 0 ) {
$cps_val = $cps ;
}
}
2023-05-22 10:01:57 +02:00
}
2022-11-15 08:05:04 +01:00
2023-05-22 10:01:57 +02:00
// Parent agents.
$paramsParentAgent = [];
$paramsParentAgent [ 'return' ] = true ;
2023-07-19 15:48:33 +02:00
$paramsParentAgent [ 'show_helptip' ] = true ;
2023-05-22 10:01:57 +02:00
$paramsParentAgent [ 'input_name' ] = 'id_parent' ;
$paramsParentAgent [ 'print_hidden_input_idagent' ] = true ;
$paramsParentAgent [ 'hidden_input_idagent_name' ] = 'id_agent_parent' ;
$paramsParentAgent [ 'hidden_input_idagent_value' ] = $id_parent ;
$paramsParentAgent [ 'value' ] = db_get_value ( 'alias' , 'tagente' , 'id_agente' , $id_parent );
$paramsParentAgent [ 'selectbox_id' ] = 'cascade_protection_module' ;
$paramsParentAgent [ 'javascript_is_function_select' ] = true ;
$paramsParentAgent [ 'cascade_protection' ] = true ;
$paramsParentAgent [ 'input_style' ] = 'width: 100%;' ;
if ( $id_agente !== 0 ) {
// Deletes the agent's offspring.
$paramsParentAgent [ 'delete_offspring_agents' ] = $id_agente ;
2022-11-15 08:05:04 +01:00
}
$listIcons = gis_get_array_list_icons ();
$arraySelectIcon = [];
foreach ( $listIcons as $index => $value ) {
$arraySelectIcon [ $index ] = $index ;
}
// Agent icons.
$path = 'images/gis_map/icons/' ;
// TODO set better method the path.
$table_adv_agent_icon = '<div class="label_select"><p class="input_label">' . __ ( 'Agent icon' ) . '</p>' ;
if ( $icon_path == '' ) {
$display_icons = 'none' ;
// Hack to show no icon. Use any given image to fix not found image errors.
$path_without = 'images/spinner.gif' ;
$path_default = 'images/spinner.gif' ;
$path_ok = 'images/spinner.gif' ;
$path_bad = 'images/spinner.gif' ;
$path_warning = 'images/spinner.gif' ;
} else {
$display_icons = '' ;
$path_without = $path . $icon_path . '.default.png' ;
$path_default = $path . $icon_path . '.default.png' ;
$path_ok = $path . $icon_path . '.ok.png' ;
$path_bad = $path . $icon_path . '.bad.png' ;
$path_warning = $path . $icon_path . '.warning.png' ;
}
2022-11-11 16:15:17 +01:00
$tableAgent = new stdClass ();
2022-11-15 16:02:40 +01:00
$tableAgent -> class = 'floating_form primary_form' ;
2022-11-11 16:15:17 +01:00
$tableAgent -> data = [];
$tableAgent -> style = [];
$tableAgent -> cellclass = [];
$tableAgent -> colspan = [];
$tableAgent -> rowspan = [];
2022-11-15 08:05:04 +01:00
2022-11-11 16:15:17 +01:00
// Agent name.
if ( $new_agent === false ) {
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_name' ][ 0 ] = __ ( 'Agent name' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'name' ] = 'w540px' ;
2023-02-14 10:41:40 +01:00
$tableAgent -> cellstyle [ 'name' ][ 0 ] = 'width: 100%;' ;
$tableAgent -> data [ 'name' ][ 0 ] = html_print_input_text ( 'agente' , $nombre_agente , '' , 76 , 100 , true , false , false , '' , 'w100p' );
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'name' ][ 0 ] .= html_print_div (
2022-11-11 16:15:17 +01:00
[
'class' => 'moduleIdBox' ,
'content' => __ ( 'ID' ) . ' <span class="font_14pt">' . $id_agente . '</span>' ,
],
true
);
// Agent options for QR code.
$agent_options_update = 'agent_options_update' ;
}
// Alias.
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_alias' ][ 0 ] = __ ( 'Alias' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'alias' ] = 'w540px' ;
2022-11-16 12:24:11 +01:00
$tableAgent -> data [ 'alias' ][ 0 ] = html_print_input_text ( 'alias' , $alias , '' , 50 , 100 , true , false , true , '' , 'w540px' );
2022-11-11 16:15:17 +01:00
if ( $new_agent === true ) {
2022-11-15 16:02:40 +01:00
$tableAgent -> rowclass [ 'additional_alias' ] = 'subinput' ;
$tableAgent -> data [ 'additional_alias' ][ 0 ] = html_print_checkbox_switch ( 'alias_as_name' , 1 , $config [ 'alias_as_name' ], true );
$tableAgent -> data [ 'additional_alias' ][ 1 ] = __ ( 'Use alias as name' );
2022-11-15 08:05:04 +01:00
} else {
2022-12-16 12:55:56 +01:00
if ( $remote_agent === true ) {
$tableAgent -> data [ 'alias' ][ 0 ] .= html_print_anchor (
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente=' . $id_agente . '&disk_conf=' . $agent_md5 ,
'content' => html_print_image (
'images/remote-configuration@svg.svg' ,
true ,
[
'border' => 0 ,
'title' => __ ( 'This agent can be remotely configured' ),
'class' => 'invert_filter after_input_icon' ,
]
),
],
true
);
}
2022-11-11 16:15:17 +01:00
}
// Ip adress.
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_ip_address' ] = __ ( 'IP Address' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'ip_address' ] = 'w540px' ;
2022-11-16 12:24:11 +01:00
$tableAgent -> data [ 'ip_address' ][ 0 ] = html_print_input_text ( 'direccion' , $direccion_agente , '' , 16 , 100 , true , false , false , '' , 'w540px' );
2022-11-15 16:02:40 +01:00
$tableAgent -> rowclass [ 'additional_ip_address' ] = 'subinput' ;
$tableAgent -> data [ 'additional_ip_address' ][ 0 ] = html_print_checkbox_switch ( 'unique_ip' , 1 , $config [ 'unique_ip' ], true );
$tableAgent -> data [ 'additional_ip_address' ][ 1 ] = __ ( 'Unique IP' );
$tableAgent -> cellclass [ 'additional_ip_address' ][ 1 ] = 'w120px' ;
$tableAgent -> data [ 'additional_ip_address' ][ 2 ] = html_print_input (
2022-11-11 16:15:17 +01:00
[
'type' => 'switch' ,
'id' => 'fixed_ip' ,
'name' => 'fixed_ip' ,
'value' => $fixed_ip ,
]
2022-12-15 12:42:35 +01:00
);
2022-07-15 13:40:54 +02:00
2019-04-17 09:27:15 +02:00
$table_ip .= '</div></div>' ;
2016-09-22 10:27:35 +02:00
2019-04-17 09:27:15 +02:00
if ( $id_agente ) {
2019-01-30 16:18:44 +01:00
$ip_all = agents_get_addresses ( $id_agente );
2016-09-22 10:27:35 +02:00
2019-04-17 09:27:15 +02:00
$table_ip .= '<div class="label_select">' ;
$table_ip .= '<div class="label_select_parent">' ;
$table_ip .= '<div class="label_select_child_left">' . html_print_select ( $ip_all , 'address_list' , $direccion_agente , '' , '' , 0 , true ) . '</div>' ;
2022-08-29 13:13:59 +02:00
$table_ip .= '<div class="label_select_child_right">' . html_print_checkbox_switch ( 'delete_ip' , 1 , false , true ) . __ ( 'Delete selected IPs' ) . '</div>' ;
2019-04-17 09:27:15 +02:00
$table_ip .= '</div></div>' ;
2007-08-23 17:52:42 +02:00
}
2007-04-18 11:58:26 +02:00
2014-05-30 12:51:33 +02:00
?>
< style type = " text/css " >
2019-01-30 16:18:44 +01:00
#qr_code_agent_view img {
display : inline ! important ;
}
2014-05-30 12:51:33 +02:00
</ style >
< ? php
2019-01-30 16:18:44 +01:00
$groups = users_get_groups ( $config [ 'id_user' ], 'AR' , false );
2017-02-16 16:05:21 +01:00
2019-01-30 16:18:44 +01:00
$modules = db_get_all_rows_sql (
' SELECT id_agente_modulo as id_module , nombre as name FROM tagente_modulo
WHERE id_agente = ' . $id_parent
2022-11-11 16:15:17 +01:00
);
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'additional_ip_address' ][ 3 ] = __ ( 'Fix IP address' );
$tableAgent -> data [ 'additional_ip_address' ][ 3 ] .= ui_print_help_tip ( __ ( 'Avoid automatic IP address update when agent IP changes.' ), true );
2022-11-11 16:15:17 +01:00
// IP Address List.
if ( $new_agent === false ) {
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_ip_address_list' ] = __ ( 'IP Address list' );
2022-11-16 12:24:11 +01:00
$tableAgent -> data [ 'ip_address_list' ][ 0 ] = html_print_select ( agents_get_addresses ( $id_agente ), 'address_list' , $direccion_agente , '' , '' , 0 , true , false , true , 'w540px' );
2022-11-15 16:02:40 +01:00
$tableAgent -> rowclass [ 'additional_ip_address_list' ] = 'subinput' ;
$tableAgent -> data [ 'additional_ip_address_list' ][ 0 ] = html_print_checkbox_switch ( 'delete_ip' , 1 , false , true );
$tableAgent -> data [ 'additional_ip_address_list' ][ 1 ] = __ ( 'Delete selected IPs' );
2022-11-11 16:15:17 +01:00
}
// Select primary group.
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_primary_group' ][ 0 ] = __ ( 'Primary group' );
2022-11-11 16:15:17 +01:00
if ( isset ( $groups [ $grupo ]) === true || $new_agent === true ) {
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'primary_group' ] = 'w540px' ;
2022-11-11 16:15:17 +01:00
// Cannot change primary group if user have not permission for that group.
2022-11-21 14:49:07 +01:00
$tableAgent -> data [ 'primary_group' ][ 0 ] = html_print_select_groups (
false ,
'AW' ,
false ,
'grupo' ,
$grupo ,
'' ,
'' ,
0 ,
true ,
false ,
true ,
'' ,
false ,
'' ,
'' ,
false ,
'id_grupo' ,
false ,
false ,
false ,
'540px' ,
2023-02-16 10:59:45 +01:00
false ,
true ,
2022-11-11 16:15:17 +01:00
);
} else {
2022-11-21 14:49:07 +01:00
$tableAgent -> data [ 'primary_group' ][ 0 ] .= groups_get_name ( $grupo );
$tableAgent -> data [ 'primary_group' ][ 0 ] .= html_print_input_hidden ( 'grupo' , $grupo , true );
2022-11-11 16:15:17 +01:00
}
2023-03-15 15:58:28 +01:00
$tableAgent -> data [ 'primary_group' ][ 0 ] .= '<span id="group_preview">' ;
$tableAgent -> data [ 'primary_group' ][ 0 ] .= ui_print_group_icon (
$grupo ,
true ,
'' ,
( $id_agente === 0 ) ? 'display: none;' : '' ,
true ,
false ,
false ,
'after_input_icon'
2022-11-15 08:05:04 +01:00
);
2023-03-15 15:58:28 +01:00
$tableAgent -> data [ 'primary_group' ][ 0 ] .= '</span>' ;
2022-11-11 16:15:17 +01:00
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_interval' ][ 0 ] = __ ( 'Interval' );
2022-11-21 14:49:07 +01:00
// $tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent -> rowclass [ 'interval' ] = 'w540px' ;
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'interval' ][ 0 ] = html_print_extended_select_for_time (
2022-11-11 16:15:17 +01:00
'intervalo' ,
$intervalo ,
'' ,
'' ,
'0' ,
10 ,
true ,
false ,
true ,
2022-11-15 16:02:40 +01:00
'w33p'
2022-11-11 16:15:17 +01:00
);
if ( $intervalo < SECONDS_5MINUTES ) {
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'interval' ][ 0 ] .= clippy_context_help ( 'interval_agent_min' );
2022-11-11 16:15:17 +01:00
}
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_os' ][ 0 ] = __ ( 'OS' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'os' ] = 'w540px' ;
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'os' ][ 0 ] = html_print_select_from_sql (
2022-11-11 16:15:17 +01:00
'SELECT id_os, name FROM tconfig_os' ,
'id_os' ,
$id_os ,
'' ,
'' ,
'0' ,
2022-11-16 12:24:11 +01:00
true ,
false ,
true ,
false ,
'width: 540px;'
2022-11-11 16:15:17 +01:00
);
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'os' ][ 0 ] .= html_print_div (
2022-11-11 16:15:17 +01:00
[
2022-12-15 12:42:35 +01:00
'class' => 'after_input_icon' ,
2022-11-15 16:02:40 +01:00
'id' => 'os_preview' ,
2022-11-15 08:05:04 +01:00
'content' => ui_print_os_icon (
$id_os ,
false ,
true
),
2022-11-11 16:15:17 +01:00
],
true
);
2023-09-06 17:00:16 +02:00
$tableAgent -> data [ 'caption_os_version' ][ 0 ] = __ ( 'OS version' );
$tableAgent -> rowclass [ 'os_version' ] = 'w540px' ;
$tableAgent -> data [ 'os_version' ][ 0 ] = html_print_input_text (
'os_version' ,
$os_version ,
'' ,
16 ,
100 ,
true ,
false ,
false ,
'' ,
'w540px'
);
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_server' ][ 0 ] = __ ( 'Server' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'server' ] = 'w540px' ;
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'server' ][ 0 ] = html_print_select (
2022-11-11 16:15:17 +01:00
$servers ,
'server_name' ,
$server_name ,
'' ,
__ ( 'None' ),
0 ,
2022-11-15 16:02:40 +01:00
true ,
false ,
true ,
2022-11-21 14:49:07 +01:00
'w540px' ,
false ,
'width: 540px;'
2022-11-11 16:15:17 +01:00
);
// Description.
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'caption_description' ][ 0 ] = __ ( 'Description' );
2022-11-21 14:49:07 +01:00
$tableAgent -> rowclass [ 'description' ] = 'w540px' ;
2022-11-15 16:02:40 +01:00
$tableAgent -> data [ 'description' ][ 0 ] = html_print_textarea (
2022-11-11 16:15:17 +01:00
'comentarios' ,
3 ,
2022-11-15 08:05:04 +01:00
80 ,
2022-11-11 16:15:17 +01:00
$comentarios ,
'' ,
true ,
2022-11-16 12:24:11 +01:00
'agent_description w540px'
2022-11-11 16:15:17 +01:00
);
2022-11-15 08:05:04 +01:00
html_print_div (
2022-07-15 13:40:54 +02:00
[
2023-02-14 14:06:51 +01:00
'class' => 'box-flat white_table_flex white_box agent_details_col' ,
'style' => 'display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px' ,
2022-11-15 08:05:04 +01:00
'content' => html_print_table ( $tableAgent , true ) . $CodeQRTable ,
2022-08-16 11:56:05 +02:00
]
2022-11-15 08:05:04 +01:00
);
2022-06-08 13:10:01 +02:00
2023-11-16 14:07:38 +01:00
// Basic Options.
$tableBasicAgent = new stdClass ();
$tableBasicAgent -> class = 'filter-table-adv' ;
$tableBasicAgent -> data = [];
$disabledBasic = false ;
$tableClassDisabled = '' ;
2023-11-28 12:52:27 +01:00
if ( $new_agent === true || $remote_agent === false || $has_remote_conf === false ) {
2023-11-16 14:07:38 +01:00
$disabledBasic = true ;
$tableClassDisabled = ' basic-options-disabled' ;
}
if ( enterprise_installed ()) {
// Get all plugins (BASIC OPTIONS).
$agent_plugin = new PandoraFMS\Agent ( $id_agente );
$plugins = $agent_plugin -> getPlugins ();
// Check if some plugin was enabled/disabled in conf.
foreach ( $plugins as $key => $row ) {
2023-11-29 10:27:40 +01:00
if ( preg_match ( '/pandora_hardening/' , $row [ 'raw' ]) === 1 ) {
2023-11-16 14:07:38 +01:00
if ( $row [ 'disabled' ] === 1 ) {
$security_hardening = 0 ;
} else {
$security_hardening = 1 ;
}
2022-06-08 13:10:01 +02:00
}
2023-11-29 10:27:40 +01:00
if ( $id_os === '1' || $id_os === '8' ) {
if ( preg_match ( '/(module_plugin grep_log_module ).*/' , $row [ 'raw' ]) === 1 ) {
if ( $row [ 'disabled' ] === 1 ) {
$enable_log_collector = 0 ;
} else {
$enable_log_collector = 1 ;
}
}
if ( preg_match ( '/(module_plugin inventory).*/' , $row [ 'raw' ]) === 1 ) {
if ( $row [ 'disabled' ] === 1 ) {
$enable_inventory = 0 ;
} else {
$enable_inventory = 1 ;
}
}
} else {
2023-11-30 12:53:59 +01:00
if ( preg_match ( '/.vbs/' , $row [ 'raw' ]) === 1 && preg_match ( '/nettraffic.vbs/' , $row [ 'raw' ]) === 0 && preg_match ( '/software_installed.vbs/' , $row [ 'raw' ]) === 0 && preg_match ( '/df.vbs/' , $row [ 'raw' ]) === 0 && preg_match ( '/win_cf.vbs/' , $row [ 'raw' ]) === 0 ) {
2023-11-29 10:27:40 +01:00
if ( $row [ 'disabled' ] === 1 ) {
$enable_inventory = 0 ;
} else {
$enable_inventory = 1 ;
}
2023-11-16 14:07:38 +01:00
}
}
2023-11-29 10:27:40 +01:00
}
2023-11-16 14:07:38 +01:00
2023-11-29 10:27:40 +01:00
if ( $id_os === '9' ) {
$modules = $agent_plugin -> getModules ();
foreach ( $modules as $key => $row ) {
if ( preg_match ( '/PandoraAgent_log/' , $row [ 'raw' ]) === 1 ) {
if ( $row [ 'disabled' ] === 1 ) {
$enable_log_collector = 0 ;
} else {
$enable_log_collector = 1 ;
}
2023-11-16 14:07:38 +01:00
}
2022-06-08 13:10:01 +02:00
}
2023-11-16 14:07:38 +01:00
}
2022-06-08 13:10:01 +02:00
2023-11-16 14:07:38 +01:00
unset ( $agent_plugin , $plugins );
if (( $new_agent === true && $config [ 'current_package' ] >= 774 ) || ( $agent_version >= 774 && $new_agent === false )) {
2023-11-28 12:52:27 +01:00
if ( $disabledBasic === true || $has_remote_conf === false ) {
2023-11-16 14:07:38 +01:00
$message = __ ( 'Remote config disabled, please activate to enable agent basic options' );
$tableBasicAgent -> data [] = '<span>' . $message . '</span>' ;
}
2022-06-08 13:10:01 +02:00
2023-11-16 14:07:38 +01:00
$tableBasicAgent -> data [] = html_print_label_input_block (
__ ( 'Enable security hardening monitoring' ),
html_print_input (
2022-06-08 13:10:01 +02:00
[
2023-11-16 14:07:38 +01:00
'type' => 'switch' ,
'id' => 'security_hardening' ,
'name' => 'security_hardening' ,
'value' => $security_hardening ,
'disabled' => $disabledBasic ,
2022-06-08 13:10:01 +02:00
]
2023-11-24 10:54:48 +01:00
) . html_print_input_hidden ( 'options_package' , '1' , true )
2023-11-16 14:07:38 +01:00
);
$tableBasicAgent -> data [] = html_print_label_input_block (
__ ( 'Enable log collection' ),
html_print_input (
[
'type' => 'switch' ,
'id' => 'enable_log_collector' ,
'name' => 'enable_log_collector' ,
'value' => $enable_log_collector ,
'disabled' => $disabledBasic ,
]
)
);
2022-06-08 13:10:01 +02:00
}
2023-11-16 14:07:38 +01:00
$tableBasicAgent -> data [] = html_print_label_input_block (
__ ( 'Enable inventory' ),
html_print_input (
[
'type' => 'switch' ,
'id' => 'enable_inventory' ,
'name' => 'enable_inventory' ,
'value' => $enable_inventory ,
'disabled' => $disabledBasic ,
]
) . html_print_input_hidden ( 'enable_basic_options' , '1' , true )
);
if ( $config [ 'ehorus_enabled' ] === '1' ) {
$pandoraRC_Id = html_print_image (
'images/alert_recovered@svg.svg' ,
true ,
[
'class' => 'invert_filter main_menu_icon' ,
'title' => __ ( 'Pandora RC connected with id ' ) . $config [ 'ehorus_custom_field' ],
]
);
} else {
$pandoraRC_Id = html_print_image (
'images/alerts.svg' ,
true ,
[
'class' => 'invert_filter main_menu_icon' ,
'title' => __ ( 'This agent do not have a Pandora RC agent installed, install one.' ),
]
);
2019-05-13 15:54:06 +02:00
}
2023-11-16 14:07:38 +01:00
$tableBasicAgent -> data [] = html_print_label_input_block (
__ ( 'Enable remote control' ),
$pandoraRC_Id
);
$WarningPackage = '' ;
if (( $new_agent === true && $config [ 'current_package' ] < 774 ) || ( $agent_version < 774 && $new_agent === false )) {
$WarningPackage = html_print_image (
'images/alert-yellow@svg.svg' ,
true ,
[
'title' => __ ( 'Only available for agents 774 or higher' ),
'alt' => __ ( 'Only available for agents 774 or higher' ),
'class' => 'main_menu_icon mrgn_lft_5px' ,
]
);
2019-05-13 15:54:06 +02:00
}
2023-11-16 14:07:38 +01:00
} else {
$tableBasicAgent -> data [] = '<span>' . __ ( 'Remote config is enabled only in the Enteprise version' ) . '</span>' ;
$tableBasicAgent -> data [] .= html_print_input_hidden (
'enable_basic_options' ,
'0' ,
true
);
}
ui_toggle (
html_print_table ( $tableBasicAgent , true ),
'<span class="subsection_header_title">' . __ ( 'Basic options' ) . $WarningPackage . '</span>' ,
'' ,
'basic_options' ,
true ,
false ,
'white_box_content' ,
'no-border white_table_graph' . $tableClassDisabled ,
'box-flat white_table_graph invisible'
);
2019-05-13 15:02:13 +02:00
2022-11-15 08:05:04 +01:00
// Advanced options.
$tableAdvancedAgent = new stdClass ();
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> class = 'filter-table-adv floating_form primary_form' ;
2022-11-15 08:05:04 +01:00
$tableAdvancedAgent -> data = [];
$tableAdvancedAgent -> style = [];
$tableAdvancedAgent -> cellclass = [];
$tableAdvancedAgent -> colspan = [];
$tableAdvancedAgent -> rowspan = [];
2023-05-22 10:01:57 +02:00
if ( enterprise_installed () === true ) {
// Secondary groups.
$tableAdvancedAgent -> data [ 'secondary_groups' ][] = html_print_label_input_block (
__ ( 'Secondary groups' ),
html_print_select_agent_secondary (
$agent ,
$id_agente ,
[ 'selected_post' => $secondary_groups ]
)
);
}
2023-02-24 12:05:53 +01:00
2022-11-15 08:05:04 +01:00
// Parent agent.
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'parent_agent' ][] = html_print_label_input_block (
2023-07-19 15:48:33 +02:00
__ ( 'Agent parent' ),
2023-02-24 12:05:53 +01:00
ui_print_agent_autocomplete_input ( $paramsParentAgent )
);
2022-11-15 08:05:04 +01:00
if ( enterprise_installed () === true ) {
2023-02-24 12:05:53 +01:00
$cascadeProtectionContents = [];
$cascadeProtectionContents [] = html_print_checkbox_switch (
2019-05-27 21:30:46 +02:00
'cascade_protection' ,
1 ,
$cascade_protection ,
true
2022-11-15 08:05:04 +01:00
);
2019-09-12 10:29:14 +02:00
2023-02-24 12:05:53 +01:00
$cascadeProtectionContents [] = html_print_select (
2019-09-12 10:29:14 +02:00
$modules_values ,
'cascade_protection_module' ,
$cascade_protection_module ,
'' ,
'' ,
0 ,
2022-11-15 16:02:40 +01:00
true ,
false ,
true ,
'w220p'
2019-09-12 10:29:14 +02:00
);
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'caption_cascade_protection' ][] = html_print_label_input_block (
__ ( 'Cascade protection modules' ),
html_print_div (
[
'class' => 'flex-row-center' ,
'content' => implode ( '' , $cascadeProtectionContents ),
],
true
)
);
2018-08-23 08:28:02 +02:00
}
2019-01-30 16:18:44 +01:00
2022-11-15 08:05:04 +01:00
// Module Definition (Learn mode).
2023-02-24 12:05:53 +01:00
$switchButtons = [];
$switchButtons [] = html_print_radio_button_extended (
2019-01-30 16:18:44 +01:00
'modo' ,
1 ,
2019-05-03 13:07:58 +02:00
__ ( 'Learning mode' ),
2019-01-30 16:18:44 +01:00
$modo ,
false ,
'show_modules_not_learning_mode_context_help();' ,
2019-05-03 13:07:58 +02:00
'' ,
2019-01-30 16:18:44 +01:00
true
);
2023-02-24 12:05:53 +01:00
$switchButtons [] = html_print_radio_button_extended (
2019-01-30 16:18:44 +01:00
'modo' ,
0 ,
2019-05-03 13:07:58 +02:00
__ ( 'Normal mode' ),
2019-01-30 16:18:44 +01:00
$modo ,
false ,
'show_modules_not_learning_mode_context_help();' ,
2019-05-03 13:07:58 +02:00
'' ,
2019-01-30 16:18:44 +01:00
true
);
2023-02-24 12:05:53 +01:00
$switchButtons [] = html_print_radio_button_extended (
2019-01-30 16:18:44 +01:00
'modo' ,
2 ,
2019-05-03 13:07:58 +02:00
__ ( 'Autodisable mode' ),
2019-01-30 16:18:44 +01:00
$modo ,
false ,
'show_modules_not_learning_mode_context_help();' ,
2019-05-03 13:07:58 +02:00
'' ,
2019-01-30 16:18:44 +01:00
true
);
2018-08-23 08:28:02 +02:00
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'module_definition' ][] = html_print_label_input_block (
__ ( 'Module definition' ),
html_print_div (
[
'class' => 'switch_radio_button' ,
'content' => implode ( '' , $switchButtons ),
],
true
)
2019-06-04 22:16:58 +02:00
);
2018-08-23 08:28:02 +02:00
2022-11-15 08:05:04 +01:00
// CPS - Cascade Protection Services.
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'cps_value' ][] = html_print_label_input_block (
__ ( 'Cascade protection services' ),
html_print_checkbox_switch ( 'cps' , $cps_val , ( $cps >= 0 ), true )
);
2010-02-04 10:42:46 +01:00
2022-11-15 08:05:04 +01:00
// Update GIS data.
if (( bool ) $config [ 'activate_gis' ] === true ) {
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'gis' ][] = html_print_label_input_block (
__ ( 'Update new GIS data' ),
html_print_checkbox_switch ( 'update_gis_data' , 1 , ( $new_agent === true ), true )
);
2019-01-30 16:18:44 +01:00
}
2010-02-04 10:42:46 +01:00
2022-11-15 08:05:04 +01:00
// Agent Icons.
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'agent_icon' ][] = html_print_label_input_block (
__ ( 'Agent icon' ),
html_print_select (
$arraySelectIcon ,
'icon_path' ,
$icon_path ,
'changeIcons();' ,
__ ( 'None' ),
'' ,
true ,
false ,
true ,
'w540px'
2023-05-19 11:00:39 +02:00
) . '<div class="flex mrgn_top_6px mrgn_btn_5px">' . html_print_image (
2023-02-24 12:05:53 +01:00
$path_ok ,
true ,
[
'id' => 'icon_ok' ,
'style' => 'display:' . $display_icons . ';' ,
2023-05-19 11:00:39 +02:00
'width' => '30' ,
'class' => 'mrgn_right_5px' ,
2023-02-24 12:05:53 +01:00
]
) . html_print_image (
$path_bad ,
true ,
[
'id' => 'icon_bad' ,
'style' => 'display:' . $display_icons . ';' ,
2023-05-19 11:00:39 +02:00
'width' => '30' ,
'class' => 'mrgn_right_5px' ,
2023-02-24 12:05:53 +01:00
]
) . html_print_image (
$path_warning ,
true ,
[
'id' => 'icon_warning' ,
'style' => 'display:' . $display_icons . ';' ,
2023-05-19 11:00:39 +02:00
'width' => '30' ,
'class' => 'mrgn_right_5px' ,
2023-02-24 12:05:53 +01:00
]
2023-05-19 11:00:39 +02:00
) . '</div>'
2022-11-15 08:05:04 +01:00
);
2019-05-03 13:07:58 +02:00
2022-11-15 08:05:04 +01:00
// Url address.
if ( enterprise_installed () === true ) {
2023-02-24 12:05:53 +01:00
$urlAddressInput = html_print_input_text (
2022-11-15 08:05:04 +01:00
'url_description' ,
$url_description ,
'' ,
45 ,
255 ,
true ,
false ,
false ,
'' ,
2022-11-21 14:49:07 +01:00
'w540px' ,
2022-11-15 08:05:04 +01:00
'' ,
);
2019-09-25 17:52:06 +02:00
} else {
2023-02-24 12:05:53 +01:00
$urlAddressInput = html_print_input_text (
2022-11-15 08:05:04 +01:00
'url_description' ,
$url_description ,
'' ,
45 ,
255 ,
true
);
2019-09-25 17:52:06 +02:00
}
2019-05-03 13:07:58 +02:00
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'url_description' ][] = html_print_label_input_block (
__ ( 'URL Address' ),
$urlAddressInput
);
2022-11-15 08:05:04 +01:00
// Agent status.
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'agent_status' ][] = html_print_label_input_block (
__ ( 'Disabled mode' ),
html_print_checkbox_switch (
'disabled' ,
1 ,
$disabled ,
true
)
2022-11-15 08:05:04 +01:00
);
2022-02-03 12:56:36 +01:00
2022-11-15 08:05:04 +01:00
// Quiet mode.
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'agent_quiet' ][] = html_print_label_input_block (
__ ( 'Quiet' ),
html_print_checkbox_switch ( 'quiet' , 1 , $quiet , true )
);
2019-05-27 15:41:23 +02:00
2022-11-15 08:05:04 +01:00
// Remote configuration.
if ( $new_agent === false && isset ( $filename ) === true && file_exists ( $filename [ 'md5' ]) === true ) {
2023-02-24 12:05:53 +01:00
$remoteConfigurationElements = [];
$remoteConfigurationElements [] = html_print_input_text (
2022-11-15 08:05:04 +01:00
'remote_file_timestamp' ,
date ( 'F d Y H:i:s' , fileatime ( $filename [ 'md5' ])),
'' ,
2022-12-16 12:55:56 +01:00
0 ,
100 ,
2022-11-15 08:05:04 +01:00
true ,
2022-11-21 14:49:07 +01:00
true ,
false ,
'' ,
2022-12-16 12:55:56 +01:00
'w540px'
2022-11-15 08:05:04 +01:00
);
2023-02-24 12:05:53 +01:00
$remoteConfigurationElements [] = html_print_anchor (
2022-11-15 08:05:04 +01:00
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente=' . $id_agente ,
'content' => html_print_image (
2022-12-16 12:55:56 +01:00
'images/delete.svg' ,
2022-11-15 08:05:04 +01:00
true ,
[
2022-12-16 12:55:56 +01:00
'border' => 0 ,
'title' => __ ( 'Delete remote configuration file' ),
'class' => 'invert_filter after_input_icon' ,
2022-11-15 08:05:04 +01:00
]
),
],
true
);
2023-02-24 12:05:53 +01:00
$tableAdvancedAgent -> data [ 'remote_configuration' ][] = html_print_label_input_block (
__ ( 'Remote configuration' ),
html_print_div (
[
'class' => 'flex-row-center' ,
'content' => implode ( '' , $remoteConfigurationElements ),
],
true
)
);
2019-05-27 15:41:23 +02:00
}
2022-11-15 08:05:04 +01:00
// Safe operation mode.
2023-02-24 12:05:53 +01:00
$safeOperationElements = [];
$safeOperationElements [] = html_print_checkbox_switch (
'safe_mode' ,
1 ,
$safe_mode ,
true
);
$safeOperationElements [] = html_print_select (
$safe_mode_modules ,
'safe_mode_module' ,
$safe_mode_module ,
'' ,
'' ,
0 ,
true
);
$tableAdvancedAgent -> data [ 'safe_operation' ][] = html_print_label_input_block (
__ ( 'Safe operation mode' ),
html_print_div (
[
'class' => 'flex-row-center' ,
'content' => implode ( '' , $safeOperationElements ),
],
true
)
);
2019-05-03 13:07:58 +02:00
2023-11-27 13:25:52 +01:00
if ( enterprise_installed () === true ) {
$tableAdvancedAgent -> data [ 'vul_scan_enabled' ][] = html_print_label_input_block (
__ ( 'Vulnerability scanning' ),
html_print_select (
[
0 => __ ( 'Disabled' ),
1 => __ ( 'Enabled' ),
2 => __ ( 'Use global settings' ),
],
'vul_scan_enabled' ,
$vul_scan_enabled ,
'' ,
'' ,
0 ,
true
)
);
}
2023-12-12 15:30:10 +01:00
$tableAdvancedAgent -> data [ 'ignore_unknown' ][] = html_print_label_input_block (
2023-12-14 18:11:34 +01:00
__ ( 'Ignore unknown' ) . ui_print_help_tip ( __ ( 'This disables the calculation of the unknown state in the agent and any of its modules, so it will never transition to unknown. The state it reflects is the last known status.' ), true ),
2023-12-12 15:30:10 +01:00
html_print_checkbox_switch (
'ignore_unknown' ,
1 ,
$ignore_unknown ,
true ,
false
)
);
2023-10-24 18:02:14 +02:00
2023-05-22 10:01:57 +02:00
ui_toggle (
html_print_table ( $tableAdvancedAgent , true ),
'<span class="subsection_header_title">' . __ ( 'Advanced options' ) . '</span>' ,
'' ,
'' ,
true ,
false ,
'white_box_content' ,
'no-border white_table_graph'
);
2010-08-25 14:04:42 +02:00
2022-11-15 08:05:04 +01:00
// Custom fields.
$customOutputData = '' ;
2010-08-25 14:04:42 +02:00
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.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/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
$fields = db_get_all_fields_in_table ( 'tagent_custom_fields' );
2010-08-25 14:04:42 +02:00
2019-01-30 16:18:44 +01:00
if ( $fields === false ) {
$fields = [];
}
2010-08-25 14:04:42 +02:00
foreach ( $fields as $field ) {
2022-11-15 08:05:04 +01:00
// Filling the data.
2019-03-07 13:37:36 +01:00
$combo = [];
$combo = $field [ 'combo_values' ];
2023-08-04 12:23:09 +02:00
$combo = explode ( ',' , ( empty ( $combo ) === true ) ? '' : $combo );
2019-03-07 13:37:36 +01:00
$combo_values = [];
foreach ( $combo as $value ) {
$combo_values [ $value ] = $value ;
}
2019-01-30 16:18:44 +01:00
$custom_value = db_get_value_filter (
'description' ,
'tagent_custom_data' ,
[
'id_field' => $field [ 'id_field' ],
'id_agent' => $id_agente ,
]
);
if ( $custom_value === false ) {
$custom_value = '' ;
}
2022-11-15 08:05:04 +01:00
if (( bool ) $field [ 'is_password_type' ] === true ) {
$customContent = html_print_input_text_extended (
2019-01-30 16:18:44 +01:00
'customvalue_' . $field [ 'id_field' ],
$custom_value ,
'customvalue_' . $field [ 'id_field' ],
'' ,
30 ,
100 ,
$view_mode ,
'' ,
'' ,
true ,
true
);
2022-11-16 10:28:50 +01:00
} else if ( $field [ 'is_link_enabled' ]) {
2023-06-05 13:01:16 +02:00
list ( $link_text , $link_url ) = json_decode ( io_safe_output ( $custom_value ), true );
2022-11-16 10:28:50 +01:00
2022-11-22 11:50:07 +01:00
if ( json_last_error () !== JSON_ERROR_NONE ) {
$link_text = '' ;
$link_url = '' ;
2022-11-16 10:28:50 +01:00
}
2023-03-27 14:34:05 +02:00
$customContent = '<span style="line-height: 3.5;">' . __ ( 'Link text:' ) . '</span>' ;
$customContent .= '<br>' ;
$customContent .= html_print_textarea (
2022-11-22 11:50:07 +01:00
'customvalue_' . $field [ 'id_field' ] . '[]' ,
2 ,
2023-03-15 17:02:25 +01:00
1000 ,
2022-11-22 11:50:07 +01:00
$link_text ,
2023-02-14 14:06:51 +01:00
'class="min-height-30px w100p"' ,
2022-11-22 11:50:07 +01:00
true
);
2023-03-27 14:34:05 +02:00
$customContent .= '<br>' ;
$customContent .= '<span style="line-height: 3.5;">' . __ ( 'Link URL:' ) . '</span>' ;
$customContent .= '<br>' ;
$customContent .= html_print_textarea (
2022-11-22 11:50:07 +01:00
'customvalue_' . $field [ 'id_field' ] . '[]' ,
2 ,
2023-03-15 17:02:25 +01:00
1000 ,
2022-11-22 11:50:07 +01:00
$link_url ,
2023-02-14 14:06:51 +01:00
'class="min-height-30px w100p"' ,
2022-11-22 11:50:07 +01:00
true
);
2019-01-30 16:18:44 +01:00
} else {
2022-11-15 08:05:04 +01:00
$customContent = html_print_textarea (
2019-01-30 16:18:44 +01:00
'customvalue_' . $field [ 'id_field' ],
2 ,
2023-03-15 17:02:25 +01:00
1000 ,
2019-01-30 16:18:44 +01:00
$custom_value ,
2023-02-14 14:06:51 +01:00
'class="min-height-30px w100p"' ,
2019-01-30 16:18:44 +01:00
true
);
}
2022-11-15 08:05:04 +01:00
if ( empty ( $field [ 'combo_values' ]) === false ) {
$customContent = html_print_input (
2021-04-06 18:51:14 +02:00
[
'type' => 'select_search' ,
'fields' => $combo_values ,
'name' => 'customvalue_' . $field [ 'id_field' ],
'selected' => $custom_value ,
'nothing' => __ ( 'None' ),
'nothing_value' => '' ,
'return' => true ,
'sort' => false ,
'size' => '400px' ,
'dropdownAutoWidth' => true ,
]
2019-03-07 13:37:36 +01:00
);
};
2022-11-15 08:05:04 +01:00
$customOutputData .= ui_toggle (
html_print_div (
[ 'content' => $customContent ],
true
),
$field [ 'name' ],
$field [ 'name' ],
'custom_field_toggle_' . $field [ 'id_field' ],
true ,
true ,
);
2010-08-25 14:04:42 +02:00
}
2022-11-15 08:05:04 +01:00
if ( empty ( $fields ) === false ) {
2019-05-31 09:50:59 +02:00
ui_toggle (
2022-11-15 08:05:04 +01:00
$customOutputData ,
2023-01-04 15:46:32 +01:00
'<span class="subsection_header_title">' . __ ( 'Custom fields' ) . '</span>' ,
2019-05-31 09:50:59 +02:00
'' ,
2019-06-04 13:57:55 +02:00
'' ,
2019-06-04 22:16:58 +02:00
true ,
2019-05-31 09:50:59 +02:00
false ,
2023-03-15 17:02:25 +01:00
'white_box white_box_opened white_table_graph_fixed no_border' ,
2022-11-15 08:05:04 +01:00
'no-border custom_fields_elements'
2019-05-31 09:50:59 +02:00
);
2010-08-25 14:04:42 +02:00
}
2008-11-20 15:09:26 +01:00
2019-03-07 13:37:36 +01:00
// The context help about the learning mode.
2014-09-22 13:37:23 +02:00
if ( $modo == 0 ) {
2021-05-10 11:10:43 +02:00
echo " <span id='modules_not_learning_mode_context_help' class='pdd_r_10px'> " ;
2019-01-30 16:18:44 +01:00
} else {
2021-05-10 11:10:43 +02:00
echo " <span id='modules_not_learning_mode_context_help' class='invisible'> " ;
2014-09-22 13:37:23 +02:00
}
2019-01-30 16:18:44 +01:00
echo clippy_context_help ( 'modules_not_learning_mode' );
echo '</span>' ;
2018-08-28 10:23:25 +02:00
2022-11-11 16:15:17 +01:00
if ( $new_agent === false ) {
2022-11-21 14:49:07 +01:00
$actionButtons = html_print_submit_button (
2019-01-30 16:18:44 +01:00
__ ( 'Update' ),
'updbutton' ,
false ,
2022-10-24 19:55:22 +02:00
[ 'icon' => 'update' ],
true
2019-01-30 16:18:44 +01:00
);
2022-11-21 14:49:07 +01:00
$actionButtons .= html_print_input_hidden ( 'update_agent' , 1 );
$actionButtons .= html_print_input_hidden ( 'id_agente' , $id_agente );
2022-11-11 16:15:17 +01:00
if ( is_management_allowed () === true ) {
2023-11-29 16:00:46 +01:00
$clusters = agents_get_agent_belongs_cluster ( $id_agente );
$cluster_belongs = '' ;
if ( empty ( $clusters ) === false ) {
$clusters = array_reduce (
$clusters ,
function ( $carry , $item ) {
$carry [] = $item [ 'name' ];
return $carry ;
}
);
$cluster_belongs = implode ( ', ' , $clusters );
}
2022-11-21 14:49:07 +01:00
$actionButtons .= html_print_button (
2022-11-11 16:15:17 +01:00
__ ( 'Delete agent' ),
'deleteAgent' ,
false ,
2023-11-29 16:00:46 +01:00
'deleteAgentDialog(' . $id_agente . ', "' . $cluster_belongs . '")' ,
2022-11-11 16:15:17 +01:00
[
'icon' => 'delete' ,
2022-11-21 14:49:07 +01:00
'mode' => 'secondary dialog_opener' ,
2022-11-11 16:15:17 +01:00
],
true
);
}
2019-01-30 16:18:44 +01:00
} else {
2022-11-21 14:49:07 +01:00
$actionButtons = html_print_input_hidden ( 'create_agent' , 1 );
$actionButtons .= html_print_submit_button (
2019-01-30 16:18:44 +01:00
__ ( 'Create' ),
'crtbutton' ,
false ,
2022-10-24 19:55:22 +02:00
[ 'icon' => 'wand' ],
true
2019-01-30 16:18:44 +01:00
);
2007-02-27 20:03:56 +01:00
}
2019-01-30 16:18:44 +01:00
2022-11-21 14:49:07 +01:00
$actionButtons .= html_print_go_back_button (
2022-11-16 16:04:22 +01:00
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente' ,
[ 'button_class' => '' ],
true
2022-10-24 19:55:22 +02:00
);
2022-11-21 14:49:07 +01:00
html_print_action_buttons ( $actionButtons , [ 'type' => 'form_action' ]);
2022-11-16 16:04:22 +01:00
2022-11-15 08:05:04 +01:00
echo '</div></div>' ;
2022-10-24 19:55:22 +02:00
echo '</form>' ;
2009-04-13 17:05:21 +02:00
2016-06-08 19:15:43 +02:00
ui_require_jquery_file ( 'pandora.controls' );
ui_require_jquery_file ( 'ajaxqueue' );
ui_require_jquery_file ( 'bgiframe' );
2009-03-04 Sancho Lerena <slerena@artica.es>
* extras/: New directory with extra contents (scripts, tools, samples)
* index.php: Add new permission check for /attachment directory. Probably
could be extended and wrapped into a function. This should be only called
once, this is the reason why is placed here and not in config_process.
* pandora_console_upgrade: Force MYSQL run, even if SQL return error (useful
for applying over a older 3.0 version for example).
* pandoradb_data.sql: Was missing some tconfig variables.
* extras/*.sql: Missing somre tconfig variables and other minor issues fixed
* extensions/update_manager/main.php: Description of update manager patch
wider. Probably needs more formatting in the future.
* extras/sample_login.php: Sample on how to implement autologin feature.
* footer.php: I hope solve the frakkin image problem.
* godmode/agents/agent_manager.php: proper ACL check notice.
* godmode/alerts/alert_list.php: Fixed notice.
* godmode/reporting/map_builder.php: Added link to wizard and item count.
* godmode/reporting/map_builder_wizard.php: Added new feature, a wizard
to populate the visual map, using agents from a combo, depending on the
map selected. Could have a lot of improvements, it's a basic start. Allow
to choose agents and image maps and space between images. Puts in a reticle
automatically adjusting at 600px width.
* godmode/setup.php: Checkbox for trap_forward was bad, fixed.
* config_process.php: Fixed version to 3.0-dev
* functions_html.php: Default of 0 in text boxes makes them unusable on
default values, funny :-)
* include/functions_reporting.php: Fixed a notice on unknown variable
on function get_group_stat().
* operation/agentes/alerts_status.php: Filter on module status is made now
with combos, like the rest of the filters in the GUI.
* operation/events/events.php: a missing div makes graph float outside the
filter box. TODO: Hidder filter makes free-width style buggy here.
* operation/reporting/reporting_viewer.php: Fixed layout issue.
* operation/visual_console/render_view.php: Added ACL check.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1510 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-04 18:57:00 +01:00
?>
2016-06-08 19:15:43 +02:00
2009-04-13 17:05:21 +02:00
< script type = " text/javascript " >
2019-04-17 09:27:15 +02:00
// Show/Hide custom field row.
function show_custom_field_row ( id ){
if ( $ ( '#field-' + id ) . css ( 'display' ) == 'none' ){
$ ( '#field-' + id ) . css ( 'display' , 'table-row' );
$ ( '#name_field-' + id ) . addClass ( 'custom_field_row_opened' );
}
else {
$ ( '#field-' + id ) . css ( 'display' , 'none' );
$ ( '#name_field-' + id ) . removeClass ( 'custom_field_row_opened' );
}
}
2023-11-29 16:00:46 +01:00
function deleteAgentDialog ( $idAgente , cluster ) {
var msg_cluster = '' ;
if ( cluster ) {
msg_cluster = " <?php echo __('This agent belongs to the clusters'); ?> " ;
msg_cluster += ': ' ;
msg_cluster += cluster ;
msg_cluster += '. ' ;
}
2022-11-16 16:04:22 +01:00
confirmDialog ({
title : " <?php echo __('Delete agent'); ?> " ,
2023-11-29 16:00:46 +01:00
message : msg_cluster + " <?php echo __('This action is not reversible. Are you sure'); ?> " ,
2022-11-16 16:04:22 +01:00
onAccept : function () {
window . location . assign ( 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=' + $idAgente );
}
});
}
2019-04-17 09:27:15 +02:00
2019-01-30 16:18:44 +01:00
//Use this function for change 3 icons when change the selectbox
function changeIcons () {
var icon = $ ( " #icon_path :selected " ) . val ();
$ ( " #icon_without_status " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_default " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_ok " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_bad " ) . attr ( " src " , " images/spinner.png " );
$ ( " #icon_warning " ) . attr ( " src " , " images/spinner.png " );
if ( icon . length == 0 ) {
$ ( " #icon_without_status " ) . attr ( " style " , " display:none; " );
$ ( " #icon_default " ) . attr ( " style " , " display:none; " );
$ ( " #icon_ok " ) . attr ( " style " , " display:none; " );
$ ( " #icon_bad " ) . attr ( " style " , " display:none; " );
$ ( " #icon_warning " ) . attr ( " style " , " display:none; " );
}
else {
$ ( " #icon_without_status " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .default.png " );
$ ( " #icon_default " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .default.png " );
$ ( " #icon_ok " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .ok.png " );
$ ( " #icon_bad " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .bad.png " );
$ ( " #icon_warning " ) . attr ( " src " ,
" <?php echo $path ; ?> " + icon + " .warning.png " );
$ ( " #icon_without_status " ) . attr ( " style " , " " );
$ ( " #icon_default " ) . attr ( " style " , " " );
$ ( " #icon_ok " ) . attr ( " style " , " " );
$ ( " #icon_bad " ) . attr ( " style " , " " );
$ ( " #icon_warning " ) . attr ( " style " , " " );
}
}
function show_modules_not_learning_mode_context_help () {
if ( $ ( " input[name='modo'][value=0] " ) . is ( ':checked' )) {
2019-05-03 13:07:58 +02:00
$ ( " #modules_not_learning_mode_context_help " ) . show () . css ( 'padding-right' , '8px' );
2019-01-30 16:18:44 +01:00
}
else {
$ ( " #modules_not_learning_mode_context_help " ) . hide ();
}
}
$ ( document ) . ready ( function () {
2019-04-12 13:09:26 +02:00
2020-10-20 16:15:42 +02:00
var $id_agent = '<?php echo $id_agente; ?>' ;
2019-04-12 13:09:26 +02:00
var previous_primary_group_select ;
$ ( " #grupo " ) . on ( 'focus' , function () {
previous_primary_group_select = this . value ;
}) . change ( function () {
if ( $ ( " #secondary_groups_selected option[value= " + $ ( " #grupo " ) . val () + " ] " ) . length ) {
alert ( " <?php echo __('Secondary group cannot be primary too.'); ?> " );
$ ( " #grupo " ) . val ( previous_primary_group_select );
} else {
previous_primary_group_select = this . value ;
}
});
2019-01-30 16:18:44 +01:00
$ ( " select#id_os " ) . pandoraSelectOS ();
2021-05-20 17:15:27 +02:00
$ ( 'select#grupo' ) . pandoraSelectGroupIcon ();
2019-01-30 16:18:44 +01:00
var checked = $ ( " #checkbox-cascade_protection " ) . is ( " :checked " );
if ( checked ) {
$ ( " #cascade_protection_module " ) . removeAttr ( " disabled " );
}
else {
$ ( " #cascade_protection_module " ) . attr ( " disabled " , 'disabled' );
}
2023-07-19 15:48:33 +02:00
$ ( " #text-id_parent " ) . change ( function (){
const parent = $ ( " #text-id_parent " ) . val ();
if ( parent != '' ) {
$ ( " #checkbox-cascade_protection " ) . prop ( 'checked' , true );
$ ( " #cascade_protection_module " ) . removeAttr ( " disabled " );
}
else {
$ ( " #cascade_protection_module " ) . val ( 0 );
$ ( " #cascade_protection_module " ) . attr ( " disabled " , 'disabled' );
$ ( " #text-id_parent " ) . removeAttr ( " required " );
$ ( " #cascade_protection_module " ) . empty ();
$ ( " #checkbox-cascade_protection " ) . prop ( 'checked' , false );
}
});
2019-01-30 16:18:44 +01:00
$ ( " #checkbox-cascade_protection " ) . change ( function () {
2023-11-16 14:07:38 +01:00
var checked = $ ( " #checkbox-cascade_protection " ) . is ( " :checked " );
if ( checked ) {
2019-01-30 16:18:44 +01:00
$ ( " #cascade_protection_module " ) . removeAttr ( " disabled " );
2023-07-19 15:48:33 +02:00
$ ( " #text-id_parent " ) . attr ( " required " , " required " );
2019-01-30 16:18:44 +01:00
}
else {
$ ( " #cascade_protection_module " ) . val ( 0 );
$ ( " #cascade_protection_module " ) . attr ( " disabled " , 'disabled' );
2023-07-19 15:48:33 +02:00
$ ( " #text-id_parent " ) . removeAttr ( " required " );
2019-01-30 16:18:44 +01:00
}
});
2023-11-16 14:07:38 +01:00
2019-01-30 16:18:44 +01:00
var safe_mode_checked = $ ( " #checkbox-safe_mode " ) . is ( " :checked " );
if ( safe_mode_checked ) {
$ ( " #safe_mode_module " ) . removeAttr ( " disabled " );
}
else {
$ ( " #safe_mode_module " ) . attr ( " disabled " , 'disabled' );
}
2023-11-16 14:07:38 +01:00
2019-01-30 16:18:44 +01:00
$ ( " #checkbox-safe_mode " ) . change ( function () {
var safe_mode_checked = $ ( " #checkbox-safe_mode " ) . is ( " :checked " );
2023-11-16 14:07:38 +01:00
2019-01-30 16:18:44 +01:00
if ( safe_mode_checked ) {
$ ( " #safe_mode_module " ) . removeAttr ( " disabled " );
}
else {
$ ( " #safe_mode_module " ) . val ( 0 );
$ ( " #safe_mode_module " ) . attr ( " disabled " , 'disabled' );
}
});
2020-10-20 16:15:42 +02:00
if ( typeof $id_agent !== 'undefined' && $id_agent !== '0' ) {
paint_qrcode (
" <?php echo ui_get_full_url('mobile/index.php?page=agent&id='. $id_agente ); ?> " ,
" #qr_code_agent_view " ,
2022-11-16 16:04:22 +01:00
128 ,
128
2020-10-20 16:15:42 +02:00
);
}
2019-07-04 16:20:01 +02:00
$ ( " #text-agente " ) . prop ( 'readonly' , true );
2019-01-30 16:18:44 +01:00
2022-08-08 10:23:11 +02:00
// Disable fixed ip button if empty.
if ( $ ( " #text-direccion " ) . val () == '' ) {
$ ( " #fixed_ip " ) . prop ( 'disabled' , true );
}
$ ( " #text-direccion " ) . on ( 'input' , function ( e ){
if ( $ ( " #text-direccion " ) . val () == '' ) {
$ ( " #fixed_ip " ) . prop ( 'disabled' , true );
} else {
$ ( " #fixed_ip " ) . prop ( 'disabled' , false );
}
});
2023-11-16 14:07:38 +01:00
check_basic_options ();
$ ( '#id_os' ) . on ( 'change' , function (){
check_basic_options ();
})
2019-01-30 16:18:44 +01:00
});
2023-11-16 14:07:38 +01:00
function check_basic_options (){
if ( $ ( '#id_os' ) . val () == 1 || $ ( '#id_os' ) . val () == 8 || $ ( '#id_os' ) . val () == 9 ) {
$ ( '#basic_options' ) . removeClass ( 'invisible' );
} else {
$ ( '#basic_options' ) . addClass ( 'invisible' );
}
}
2013-03-01 12:13:58 +01:00
</ script >