2006-03-27 05:37:27 +02:00
< ? php
2019-02-19 14:55:44 +01:00
/**
* Extension to manage a list of gateways and the node address where they should
* point to .
*
* @ category Extensions
* @ package Pandora FMS
* @ subpackage Community
* @ version 1.0 . 0
* @ license See below
*
* ______ ___ _______ _______ ________
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
* Copyright ( c ) 2005 - 2019 Artica Soluciones Tecnologicas
* Please see http :// pandorafms . org for full contribution list
* 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 .
* ============================================================================
*/
2009-06-08 20:18:20 +02:00
2010-03-02 20:25:51 +01:00
global $config ;
2006-07-11 16:48:04 +02:00
2019-03-12 08:56:45 +01:00
// Load the header.
2019-02-18 15:14:24 +01:00
require $config [ 'homedir' ] . '/operation/users/user_edit_header.php' ;
2013-05-20 10:42:02 +02:00
2019-04-09 18:18:10 +02:00
if ( ! is_metaconsole ()) {
date_default_timezone_set ( 'UTC' );
include 'include/javascript/timezonepicker/includes/parser.inc' ;
// Read in options for map builder.
$bases = [
'gray' => 'Gray' ,
'blue-marble' => 'Blue marble' ,
'night-electric' => 'Night Electric' ,
'living' => 'Living Earth' ,
];
2019-04-12 10:10:04 +02:00
$local_file = 'include/javascript/timezonepicker/images/gray-400.png' ;
2019-04-09 18:18:10 +02:00
// Dimensions must always be exact since the imagemap does not scale.
$array_size = getimagesize ( $local_file );
$map_width = $array_size [ 0 ];
$map_height = $array_size [ 1 ];
$timezones = timezone_picker_parse_files (
$map_width ,
$map_height ,
'include/javascript/timezonepicker/tz_world.txt' ,
'include/javascript/timezonepicker/tz_islands.txt'
);
}
2019-03-12 08:56:45 +01:00
// Update user info.
2019-01-30 16:18:44 +01:00
if ( isset ( $_GET [ 'modified' ]) && ! $view_mode ) {
if ( html_print_csrf_error ()) {
return ;
}
$upd_info = [];
$upd_info [ 'fullname' ] = get_parameter_post ( 'fullname' , $user_info [ 'fullname' ]);
$upd_info [ 'firstname' ] = get_parameter_post ( 'firstname' , $user_info [ 'firstname' ]);
$upd_info [ 'lastname' ] = get_parameter_post ( 'lastname' , $user_info [ 'lastname' ]);
$password_new = get_parameter_post ( 'password_new' , '' );
$password_confirm = get_parameter_post ( 'password_conf' , '' );
$upd_info [ 'email' ] = get_parameter_post ( 'email' , '' );
$upd_info [ 'phone' ] = get_parameter_post ( 'phone' , '' );
$upd_info [ 'comments' ] = get_parameter_post ( 'comments' , '' );
$upd_info [ 'language' ] = get_parameter_post ( 'language' , $user_info [ 'language' ]);
$upd_info [ 'timezone' ] = get_parameter_post ( 'timezone' , '' );
$upd_info [ 'id_skin' ] = get_parameter ( 'skin' , $user_info [ 'id_skin' ]);
2019-02-19 14:55:44 +01:00
$upd_info [ 'default_event_filter' ] = get_parameter ( 'event_filter' , null );
2019-01-30 16:18:44 +01:00
$upd_info [ 'block_size' ] = get_parameter ( 'block_size' , $config [ 'block_size' ]);
2019-05-23 19:22:05 +02:00
$upd_info [ 'middlename' ] = get_parameter_switch ( 'newsletter_reminder' , $user_info [ 'middlename' ]);
2019-01-30 16:18:44 +01:00
$default_block_size = get_parameter ( 'default_block_size' , 0 );
if ( $default_block_size ) {
$upd_info [ 'block_size' ] = 0 ;
}
2019-05-23 19:22:05 +02:00
if ( $upd_info [ 'middlename' ] == 1 ) {
// User wants to enable newsletter reminders.
if ( $user_info [ 'middlename' ] > 0 ) {
// User has already registered!. No sense.
$upd_info [ 'middlename' ] = $user_info [ 'middlename' ];
} else {
// Force subscription reminder.
$upd_info [ 'middlename' ] = 0 ;
}
}
if ( $upd_info [ 'middlename' ] == 0 || $upd_info [ 'middlename' ] == 0 ) {
// Switch is ON. user had not registered.
$newsletter_reminder_value = 1 ;
} else if ( $upd_info [ 'middlename' ] < 1 ) {
// Switch is OFF. User do not want to register.
$newsletter_reminder_value = 0 ;
} else if ( $upd_info [ 'middlename' ] > 0 ) {
// Switc is OFF. User is already registered!
$newsletter_reminder_value = 0 ;
}
2019-01-30 16:18:44 +01:00
$upd_info [ 'section' ] = get_parameter ( 'section' , $user_info [ 'section' ]);
$upd_info [ 'data_section' ] = get_parameter ( 'data_section' , '' );
$dashboard = get_parameter ( 'dashboard' , '' );
$visual_console = get_parameter ( 'visual_console' , '' );
2019-05-09 19:23:18 +02:00
2019-02-19 14:55:44 +01:00
// Save autorefresh list.
2019-01-30 16:18:44 +01:00
$autorefresh_list = get_parameter_post ( 'autorefresh_list' );
if (( $autorefresh_list [ 0 ] === '' ) || ( $autorefresh_list [ 0 ] === '0' )) {
$upd_info [ 'autorefresh_white_list' ] = '' ;
} else {
$upd_info [ 'autorefresh_white_list' ] = json_encode ( $autorefresh_list );
}
$upd_info [ 'time_autorefresh' ] = ( int ) get_parameter ( 'time_autorefresh' , 0 );
2019-05-28 13:14:42 +02:00
$upd_info [ 'ehorus_user_level_user' ] = get_parameter ( 'ehorus_user_level_user' );
$upd_info [ 'ehorus_user_level_pass' ] = get_parameter ( 'ehorus_user_level_pass' );
2019-05-10 15:32:25 +02:00
2019-01-30 16:18:44 +01:00
$is_admin = db_get_value ( 'is_admin' , 'tusuario' , 'id_user' , $id );
$section = io_safe_output ( $upd_info [ 'section' ]);
2019-02-19 14:55:44 +01:00
if (( $section == 'Event list' ) || ( $section == 'Group view' )
|| ( $section == 'Alert detail' ) || ( $section == 'Tactical view' )
|| ( $section == 'Default' )
) {
2019-01-30 16:18:44 +01:00
$upd_info [ 'data_section' ] = '' ;
} else if ( $section == 'Dashboard' ) {
$upd_info [ 'data_section' ] = $dashboard ;
} else if ( $section == 'Visual console' ) {
$upd_info [ 'data_section' ] = $visual_console ;
}
if ( ! empty ( $password_new )) {
if ( $config [ 'user_can_update_password' ] && $password_confirm == $password_new ) {
2019-02-19 14:55:44 +01:00
if (( ! $is_admin || $config [ 'enable_pass_policy_admin' ])
&& $config [ 'enable_pass_policy' ]
) {
2019-01-30 16:18:44 +01:00
$pass_ok = login_validate_pass ( $password_new , $id , true );
if ( $pass_ok != 1 ) {
ui_print_error_message ( $pass_ok );
} else {
$return = update_user_password ( $id , $password_new );
if ( $return ) {
$return2 = save_pass_history ( $id , $password_new );
}
}
} else {
$return = update_user_password ( $id , $password_new );
}
} else if ( $password_new !== 'NON-INIT' ) {
$error_msg = __ ( 'Passwords didn\'t match or other problem encountered while updating passwords' );
}
} else if ( empty ( $password_new ) && empty ( $password_confirm )) {
$return = true ;
} else if ( empty ( $password_new ) || empty ( $password_confirm )) {
$return = false ;
}
2019-02-19 14:55:44 +01:00
// No need to display "error" here, because when no update is needed
// (no changes in data) SQL function returns 0 (FALSE), but is not an error,
// just no change. Previous error message could be confussing to the user.
2019-01-30 16:18:44 +01:00
if ( $return ) {
if ( ! empty ( $password_new ) && ! empty ( $password_confirm )) {
$success_msg = __ ( 'Password successfully updated' );
}
2019-02-19 14:55:44 +01:00
// If info is valid then proceed with update.
if (( filter_var ( $upd_info [ 'email' ], FILTER_VALIDATE_EMAIL ) || $upd_info [ 'email' ] == '' )
&& ( preg_match ( '/^[0-9- ]+$/D' , $upd_info [ 'phone' ]) || $upd_info [ 'phone' ] == '' )
) {
2019-01-30 16:18:44 +01:00
$return_update_user = update_user ( $id , $upd_info );
if ( $return_update_user === false ) {
$error_msg = __ ( 'Error updating user info' );
} else if ( $return_update_user == true ) {
$success_msg = __ ( 'User info successfully updated' );
} else {
if ( ! empty ( $password_new ) && ! empty ( $password_confirm )) {
$success_msg = __ ( 'Password successfully updated' );
} else {
$return = false ;
$error_msg = __ ( 'No changes have been made' );
}
}
2019-02-19 14:55:44 +01:00
ui_print_result_message (
$return ,
$success_msg ,
$error_msg ,
$user_auth_error
);
2019-01-30 16:18:44 +01:00
} else if ( ! filter_var ( $upd_info [ 'email' ], FILTER_VALIDATE_EMAIL )) {
ui_print_error_message ( __ ( 'Please enter a valid email' ));
} else if ( ! preg_match ( '/^[0-9- ]+$/D' , $upd_info [ 'phone' ])) {
ui_print_error_message ( __ ( 'Please enter a valid phone number' ));
}
$user_info = $upd_info ;
} else {
if ( ! $error_msg ) {
$error_msg = __ ( 'Error updating passwords: ' );
}
$user_auth_error = $config [ 'auth_error' ];
2019-02-19 14:55:44 +01:00
ui_print_result_message (
$return ,
$success_msg ,
$error_msg ,
$user_auth_error
);
2019-01-30 16:18:44 +01:00
}
}
2019-02-19 14:55:44 +01:00
// Prints action status for current message.
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
if ( $status != - 1 ) {
2019-01-30 16:18:44 +01:00
ui_print_result_message (
$status ,
__ ( 'User info successfully updated' ),
__ ( 'Error updating user info' )
);
2011-08-31 09:21:18 +02:00
}
2019-01-30 16:18:44 +01:00
2015-06-08 11:05:19 +02:00
if ( defined ( 'METACONSOLE' )) {
2019-03-20 16:45:24 +01:00
echo '<div class="user_form_title">' . __ ( 'Edit my User' ) . '</div>' ;
2015-03-06 12:28:05 +01:00
}
2019-01-30 16:18:44 +01:00
2019-03-12 08:56:45 +01:00
2019-03-20 13:26:15 +01:00
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">' . __ ( 'User ID' ) . ': </p>' ;
2019-03-12 08:56:45 +01:00
$user_id .= '<span>' . $id . '</span></div>' ;
2019-03-20 13:26:15 +01:00
$full_name = ' <div class="label_select_simple">' . html_print_input_text_extended (
2019-02-19 14:55:44 +01:00
'fullname' ,
$user_info [ 'fullname' ],
'fullname' ,
'' ,
20 ,
100 ,
$view_mode ,
'' ,
2019-03-12 08:56:45 +01:00
[
'class' => 'input' ,
'placeholder' => __ ( 'Full (display) name' ),
],
2019-02-19 14:55:44 +01:00
true
2019-03-12 08:56:45 +01:00
) . '</div>' ;
2019-02-19 14:55:44 +01:00
2009-11-27 Sancho lerena <slerena@artica.es>
* operation/menu.php: User section has no ACL check, always can be seen.
* index.php: Added suppor for user-defined custom language (this code was
on my disk for 3 months, pending to be commited!).
* include/functions_db.php,
* include/functions_agents.php,
* godmode/alerts/alert_list.php,
* godmode/agentes/modificar_agente.php,
* godmode/agentes/configurar_agente.php: Added audit calls to several
management operations who don't have or have insufficient audit info.
* godmode/users/configure_user.php: Fixed several annoyings bugs. Added
custom language support, and added more audit info on management operations.
* godmode/users/user_list.php: More audit info.
* include/config_process.php: Add new debug option to render error log to
/pandora_console.log. Also set timezone if not defined (this makes warnings
on several PHP 5.x setups). Added user custom language support.
* include/functions_events.php: More audit info. Fixed problems with HTML
encoding render.
* functions_io.php: Some cleaning.
* include/functions_messages.php: Fixed problems with HTML
encoding render.
* functions_ui.php: Fixed problems with HTML encoding render in
print_string_substr() function.
* auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed.
* styles/pandora.css: removed green colored left border in default style.
* message.php, incident*: Fixed problems with HTML encoding render.
* user.php: Better ACL check before let user to view/edit another user.
* user_edit: Removed some un-used form fields, some arrangements in layout,
and FIXED forever problems with password change (new code written).
* users/user_statistics.php: Now user can see its own audit records.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
// Show "Picture" (in future versions, why not, allow users to upload it's own avatar here.
2019-01-30 16:18:44 +01:00
if ( is_user_admin ( $id )) {
2019-03-12 08:56:45 +01:00
$avatar = html_print_image ( 'images/people_1.png' , true , [ 'class' => 'user_avatar' ]);
2019-01-30 16:18:44 +01:00
} else {
2019-03-12 08:56:45 +01:00
$avatar = html_print_image ( 'images/people_2.png' , true , [ 'class' => 'user_avatar' ]);
2013-04-10 09:57:54 +02:00
}
2013-05-23 17:42:32 +02:00
2013-04-10 09:57:54 +02:00
if ( $view_mode === false ) {
2019-01-30 16:18:44 +01:00
$table -> rowspan [ 0 ][ 2 ] = 3 ;
} else {
$table -> rowspan [ 0 ][ 2 ] = 2 ;
2009-11-27 Sancho lerena <slerena@artica.es>
* operation/menu.php: User section has no ACL check, always can be seen.
* index.php: Added suppor for user-defined custom language (this code was
on my disk for 3 months, pending to be commited!).
* include/functions_db.php,
* include/functions_agents.php,
* godmode/alerts/alert_list.php,
* godmode/agentes/modificar_agente.php,
* godmode/agentes/configurar_agente.php: Added audit calls to several
management operations who don't have or have insufficient audit info.
* godmode/users/configure_user.php: Fixed several annoyings bugs. Added
custom language support, and added more audit info on management operations.
* godmode/users/user_list.php: More audit info.
* include/config_process.php: Add new debug option to render error log to
/pandora_console.log. Also set timezone if not defined (this makes warnings
on several PHP 5.x setups). Added user custom language support.
* include/functions_events.php: More audit info. Fixed problems with HTML
encoding render.
* functions_io.php: Some cleaning.
* include/functions_messages.php: Fixed problems with HTML
encoding render.
* functions_ui.php: Fixed problems with HTML encoding render in
print_string_substr() function.
* auth/mysql.php: is_user_admin() functions seems to be broken ¿?¿!. Fixed.
* styles/pandora.css: removed green colored left border in default style.
* message.php, incident*: Fixed problems with HTML encoding render.
* user.php: Better ACL check before let user to view/edit another user.
* user_edit: Removed some un-used form fields, some arrangements in layout,
and FIXED forever problems with password change (new code written).
* users/user_statistics.php: Now user can see its own audit records.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-11-27 21:02:12 +01:00
}
2019-01-30 16:18:44 +01:00
2013-04-10 09:57:54 +02:00
2019-03-20 13:26:15 +01:00
$email = '<div class="label_select_simple">' . html_print_input_text_extended ( 'email' , $user_info [ 'email' ], 'email' , '' , '25' , '100' , $view_mode , '' , [ 'class' => 'input' , 'placeholder' => __ ( 'E-mail' )], true ) . '</div>' ;
2019-03-12 08:56:45 +01:00
2019-03-20 13:26:15 +01:00
$phone = '<div class="label_select_simple">' . html_print_input_text_extended ( 'phone' , $user_info [ 'phone' ], 'phone' , '' , '20' , '30' , $view_mode , '' , [ 'class' => 'input' , 'placeholder' => __ ( 'Phone number' )], true ) . '</div>' ;
2013-04-10 09:57:54 +02:00
2009-01-22 18:44:33 +01:00
if ( $view_mode === false ) {
2019-01-30 16:18:44 +01:00
if ( $config [ 'user_can_update_password' ]) {
2019-03-20 13:26:15 +01:00
$new_pass = '<div class="label_select_simple"><span>' . html_print_input_text_extended ( 'password_new' , '' , 'password_new' , '' , '25' , '45' , $view_mode , '' , [ 'class' => 'input' , 'placeholder' => __ ( 'New Password' )], true , true ) . '</span></div>' ;
$new_pass_confirm = '<div class="label_select_simple"><span>' . html_print_input_text_extended ( 'password_conf' , '' , 'password_conf' , '' , '20' , '45' , $view_mode , '' , [ 'class' => 'input' , 'placeholder' => __ ( 'Password confirmation' )], true , true ) . '</span></div>' ;
2019-01-30 16:18:44 +01:00
} else {
2019-03-12 08:56:45 +01:00
$new_pass = '<i>' . __ ( 'You cannot change your password under the current authentication scheme' ) . '</i>' ;
$new_pass_confirm = '' ;
2019-01-30 16:18:44 +01:00
}
}
2019-03-20 13:26:15 +01:00
$size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">' . __ ( 'Block size for pagination' ) . '</p>' ;
2019-01-30 16:18:44 +01:00
if ( $user_info [ 'block_size' ] == 0 ) {
$block_size = $config [ 'global_block_size' ];
} else {
$block_size = $user_info [ 'block_size' ];
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.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_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.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_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2009-01-22 18:44:33 +01:00
2019-03-20 13:26:15 +01:00
$size_pagination .= html_print_input_text ( 'block_size' , $block_size , '' , 5 , 5 , true );
$size_pagination .= html_print_checkbox_switch ( 'default_block_size' , 1 , $user_info [ 'block_size' ] == 0 , true );
$size_pagination .= '<span>' . __ ( 'Default' ) . ' (' . $config [ 'global_block_size' ] . ')</span>' . ui_print_help_tip ( __ ( 'If checkbox is clicked then block size global configuration is used' ), true ) . '</div>' ;
2013-05-23 17:42:32 +02:00
2019-01-30 16:18:44 +01:00
$values = [
- 1 => __ ( 'Default' ),
1 => __ ( 'Yes' ),
0 => __ ( 'No' ),
];
2013-05-23 17:42:32 +02:00
2019-03-20 13:26:15 +01:00
$language = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Language' ) . ': </p>' ;
$language .= html_print_select_from_sql (
2019-01-30 16:18:44 +01:00
'SELECT id_language, name FROM tlanguage' ,
'language' ,
$user_info [ 'language' ],
'' ,
__ ( 'Default' ),
'default' ,
true ,
'' ,
'' ,
'' ,
'' ,
'' ,
10
2019-03-12 08:56:45 +01:00
) . '</div>' ;
2013-06-25 13:20:13 +02:00
2019-01-30 16:18:44 +01:00
$own_info = get_user_info ( $config [ 'id_user' ]);
if ( $own_info [ 'is_admin' ] || check_acl ( $config [ 'id_user' ], 0 , 'PM' )) {
$display_all_group = true ;
} else {
$display_all_group = false ;
}
2013-04-11 17:41:51 +02:00
$usr_groups = ( users_get_groups ( $config [ 'id_user' ], 'AR' , $display_all_group ));
$id_usr = $config [ 'id_user' ];
2018-04-30 15:34:46 +02:00
2013-04-22 19:43:28 +02:00
if ( ! $meta ) {
2019-03-20 13:26:15 +01:00
$home_screen = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Home screen' ) . ui_print_help_tip ( __ ( 'User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view' ), true ) . '</p>' ;
2019-01-30 16:18:44 +01:00
$values = [
'Default' => __ ( 'Default' ),
'Visual console' => __ ( 'Visual console' ),
'Event list' => __ ( 'Event list' ),
'Group view' => __ ( 'Group view' ),
'Tactical view' => __ ( 'Tactical view' ),
'Alert detail' => __ ( 'Alert detail' ),
'Other' => __ ( 'Other' ),
];
if ( enterprise_installed ()) {
$values [ 'Dashboard' ] = __ ( 'Dashboard' );
}
2019-03-20 13:26:15 +01:00
$home_screen .= html_print_select ( $values , 'section' , io_safe_output ( $user_info [ 'section' ]), 'show_data_section();' , '' , - 1 , true , false , false ) . '</div>' ;
2019-01-30 16:18:44 +01:00
if ( enterprise_installed ()) {
$dashboards = get_user_dashboards ( $config [ 'id_user' ]);
$dashboards_aux = [];
if ( $dashboards === false ) {
$dashboards = [ 'None' => 'None' ];
} else {
foreach ( $dashboards as $key => $dashboard ) {
$dashboards_aux [ $dashboard [ 'name' ]] = $dashboard [ 'name' ];
}
}
2019-03-12 08:56:45 +01:00
$home_screen .= html_print_select ( $dashboards_aux , 'dashboard' , $user_info [ 'data_section' ], '' , '' , '' , true );
2019-01-30 16:18:44 +01:00
}
$layouts = visual_map_get_user_layouts ( $config [ 'id_user' ], true );
$layouts_aux = [];
if ( $layouts === false ) {
$layouts_aux = [ 'None' => 'None' ];
} else {
foreach ( $layouts as $layout ) {
$layouts_aux [ $layout ] = $layout ;
}
}
2019-03-12 08:56:45 +01:00
$home_screen .= html_print_select ( $layouts_aux , 'visual_console' , $user_info [ 'data_section' ], '' , '' , '' , true );
$home_screen .= html_print_input_text ( 'data_section' , $user_info [ 'data_section' ], '' , 60 , 255 , true , false );
2019-01-30 16:18:44 +01:00
2019-02-19 14:55:44 +01:00
// User only can change skins if has more than one group.
2019-03-12 08:56:45 +01:00
$skin = '' ;
2019-01-30 16:18:44 +01:00
if ( function_exists ( 'skins_print_select' )) {
if ( count ( $usr_groups ) > 1 ) {
2019-03-20 13:26:15 +01:00
$skin = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Skin' ) . ': </p>' ;
$skin .= skins_print_select ( $id_usr , 'skin' , $user_info [ 'id_skin' ], '' , __ ( 'None' ), 0 , true ) . '</div>' ;
2019-01-30 16:18:44 +01:00
}
}
} else {
2019-03-12 08:56:45 +01:00
$home_screen = '' ;
$skin = '' ;
2018-04-30 15:34:46 +02:00
}
2019-03-20 13:26:15 +01:00
$timezone = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Timezone' ) . ': </p>' ;
$timezone .= html_print_timezone_select ( 'timezone' , $user_info [ 'timezone' ]) . '</div>' ;
2013-04-10 09:57:54 +02:00
2019-02-19 14:55:44 +01:00
// Double auth.
2014-12-11 16:17:35 +01:00
$double_auth_enabled = ( bool ) db_get_value ( 'id' , 'tuser_double_auth' , 'id_user' , $config [ 'id_user' ]);
2019-03-20 13:26:15 +01:00
2018-12-10 11:04:21 +01:00
if ( $config [ 'double_auth_enabled' ]) {
2019-03-20 13:26:15 +01:00
$double_authentication = '<div class="label_select_simple"><p class="edit_user_labels">' . __ ( 'Double authentication' ) . '</p>' ;
$double_authentication .= html_print_checkbox_switch ( 'double_auth' , 1 , $double_auth_enabled , true );
2019-03-21 15:58:10 +01:00
// Dialog.
$double_authentication .= '<div id="dialog-double_auth" style="display:none"><div id="dialog-double_auth-container"></div></div>' ;
2018-12-10 11:04:21 +01:00
}
2014-12-11 16:17:35 +01:00
if ( $double_auth_enabled ) {
2019-03-12 08:56:45 +01:00
$double_authentication .= html_print_button ( __ ( 'Show information' ), 'show_info' , false , 'javascript:show_double_auth_info();' , '' , true );
2014-12-11 16:17:35 +01:00
}
2019-01-30 16:18:44 +01:00
2019-03-20 13:26:15 +01:00
if ( isset ( $double_authentication )) {
$double_authentication .= '</div>' ;
}
2016-05-25 12:43:49 +02:00
2019-01-30 16:18:44 +01:00
if ( check_acl ( $config [ 'id_user' ], 0 , 'ER' )) {
2019-03-20 13:26:15 +01:00
$event_filter = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Event filter' ) . '</p>' ;
$event_filter .= html_print_select_from_sql (
2019-01-30 16:18:44 +01:00
'SELECT id_filter, id_name FROM tevent_filter' ,
'event_filter' ,
2019-02-19 14:55:44 +01:00
$user_info [ 'default_event_filter' ],
2019-01-30 16:18:44 +01:00
'' ,
__ ( 'None' ),
null ,
true
2019-03-20 13:26:15 +01:00
) . '</div>' ;
2019-05-23 18:54:04 +02:00
}
2019-01-30 16:18:44 +01:00
2019-05-23 18:54:04 +02:00
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">' . __ ( 'Newsletter Subscribed' ) . ': </p>' ;
2019-05-23 18:59:38 +02:00
if ( $user_info [ 'middlename' ] > 0 ) {
2019-05-23 19:22:05 +02:00
$newsletter .= '<span>' . __ ( 'Already subscribed to %s newsletter' , get_product_name ()) . '</span>' ;
2019-05-23 18:54:04 +02:00
} else {
$newsletter .= '<span><a href="javascript: force_run_newsletter();">' . __ ( 'Subscribe to our newsletter' ) . '</a></span></div>' ;
2019-05-23 19:22:05 +02:00
$newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">' . __ ( 'Newsletter Reminder' ) . ': </p>' ;
$newsletter_reminder .= html_print_switch (
[
'name' => 'newsletter_reminder' ,
'value' => $newsletter_reminder_value ,
'disabled' => false ,
]
);
2016-05-25 12:43:49 +02:00
}
2019-01-30 16:18:44 +01:00
2019-05-23 19:22:05 +02:00
$newsletter_reminder .= '</div>' ;
2019-05-23 18:54:04 +02:00
2016-09-05 10:31:43 +02:00
2019-01-30 16:18:44 +01:00
$autorefresh_list_out = [];
if ( is_metaconsole ()) {
2019-03-20 13:26:15 +01:00
$autorefresh_list_out [ 'monitoring/tactical' ] = 'Tactical view' ;
$autorefresh_list_out [ 'monitoring/group_view' ] = 'Group view' ;
2018-03-06 13:13:40 +01:00
} else {
2019-03-20 13:26:15 +01:00
$autorefresh_list_out [ 'operation/agentes/tactical' ] = 'Tactical view' ;
$autorefresh_list_out [ 'operation/agentes/group_view' ] = 'Group view' ;
2019-01-30 16:18:44 +01:00
}
2019-03-20 13:26:15 +01:00
$autorefresh_list_out [ 'operation/agentes/estado_agente' ] = 'Agent detail' ;
$autorefresh_list_out [ 'operation/agentes/alerts_status' ] = 'Alert detail' ;
$autorefresh_list_out [ 'operation/agentes/status_monitor' ] = 'Monitor detail' ;
$autorefresh_list_out [ 'enterprise/operation/services/services' ] = 'Services' ;
$autorefresh_list_out [ 'enterprise/dashboard/main_dashboard' ] = 'Dashboard' ;
$autorefresh_list_out [ 'operation/reporting/graph_viewer' ] = 'Graph Viewer' ;
$autorefresh_list_out [ 'operation/snmpconsole/snmp_view' ] = 'SNMP console' ;
$autorefresh_list_out [ 'operation/agentes/pandora_networkmap' ] = 'Network map' ;
$autorefresh_list_out [ 'operation/visual_console/render_view' ] = 'Visual console' ;
$autorefresh_list_out [ 'operation/events/events' ] = 'Events' ;
$autorefresh_list_out [ 'enterprise/godmode/reporting/cluster_view' ] = 'Cluster view' ;
2019-01-30 16:18:44 +01:00
if ( ! isset ( $autorefresh_list )) {
$select = db_process_sql ( " SELECT autorefresh_white_list FROM tusuario WHERE id_user = ' " . $config [ 'id_user' ] . " ' " );
$autorefresh_list = json_decode ( $select [ 0 ][ 'autorefresh_white_list' ]);
if ( $autorefresh_list === null ) {
$autorefresh_list [ 0 ] = __ ( 'None' );
} else {
$aux = [];
2019-02-19 14:55:44 +01:00
$count_autorefresh_list = count ( $autorefresh_list );
for ( $i = 0 ; $i < $count_autorefresh_list ; $i ++ ) {
2019-01-30 16:18:44 +01:00
$aux [ $autorefresh_list [ $i ]] = $autorefresh_list_out [ $autorefresh_list [ $i ]];
unset ( $autorefresh_list_out [ $autorefresh_list [ $i ]]);
$autorefresh_list [ $i ] = $aux ;
}
$autorefresh_list = $aux ;
}
} else {
if (( $autorefresh_list [ 0 ] === '' ) || ( $autorefresh_list [ 0 ] === '0' )) {
$autorefresh_list [ 0 ] = __ ( 'None' );
} else {
$aux = [];
2019-02-19 14:55:44 +01:00
$count_autorefresh_list = count ( $autorefresh_list );
for ( $i = 0 ; $i < $count_autorefresh_list ; $i ++ ) {
2019-01-30 16:18:44 +01:00
$aux [ $autorefresh_list [ $i ]] = $autorefresh_list_out [ $autorefresh_list [ $i ]];
unset ( $autorefresh_list_out [ $autorefresh_list [ $i ]]);
$autorefresh_list [ $i ] = $aux ;
}
2016-09-05 10:31:43 +02:00
2019-01-30 16:18:44 +01:00
$autorefresh_list = $aux ;
}
2016-09-05 10:31:43 +02:00
}
2019-03-20 13:26:15 +01:00
$autorefresh_show = '<p class="edit_user_labels">' . _ ( 'Autorefresh' ) . ui_print_help_tip (
2019-02-19 14:55:44 +01:00
__ ( 'This will activate autorefresh in selected pages' ),
true
2019-03-20 13:26:15 +01:00
) . '</p>' ;
2019-02-19 14:55:44 +01:00
$select_out = html_print_select (
$autorefresh_list_out ,
'autorefresh_list_out[]' ,
'' ,
'' ,
'' ,
'' ,
true ,
true ,
true ,
'' ,
false ,
2019-03-20 13:26:15 +01:00
'width:100%'
2019-02-19 14:55:44 +01:00
);
2019-01-30 16:18:44 +01:00
$arrows = ' ' ;
2019-02-19 14:55:44 +01:00
$select_in = html_print_select (
$autorefresh_list ,
'autorefresh_list[]' ,
'' ,
'' ,
'' ,
'' ,
true ,
true ,
true ,
'' ,
false ,
2019-03-20 13:26:15 +01:00
'width:100%'
2019-02-19 14:55:44 +01:00
);
2016-09-05 10:31:43 +02:00
2019-03-12 08:56:45 +01:00
$table_ichanges = ' < div class = " autorefresh_select " >
2019-03-20 13:26:15 +01:00
< div class = " autorefresh_select_list_out " >
< p class = " autorefresh_select_text " > '.__(' Full list of pages ').' : </ p >
< div > '.$select_out.' </ div >
</ div >
< div class = " autorefresh_select_arrows " >
< a href = " javascript: " > ' . html_print_image (
'images/darrowright_green.png' ,
2019-02-19 14:55:44 +01:00
true ,
[
'id' => 'right_autorefreshlist' ,
'alt' => __ ( 'Push selected pages into autorefresh list' ),
'title' => __ ( 'Push selected pages into autorefresh list' ),
]
) . ' </ a >
2019-03-20 13:26:15 +01:00
< a href = " javascript: " > ' . html_print_image (
'images/darrowleft_green.png' ,
2019-02-19 14:55:44 +01:00
true ,
[
'id' => 'left_autorefreshlist' ,
'alt' => __ ( 'Pop selected pages out of autorefresh list' ),
'title' => __ ( 'Pop selected pages out of autorefresh list' ),
]
) . ' </ a >
2019-03-20 13:26:15 +01:00
</ div >
< div class = " autorefresh_select_list " >
< p class = " autorefresh_select_text " > '.__(' List of pages with autorefresh ').' : </ p >
< div > '.$select_in.' </ div >
</ div >
</ div > ' ;
2019-03-12 08:56:45 +01:00
$autorefresh_show .= $table_ichanges ;
2016-09-05 10:31:43 +02:00
2019-02-19 14:55:44 +01:00
// Time autorefresh.
2019-03-20 13:26:15 +01:00
$times = get_refresh_time_array ();
$time_autorefresh = '<div class="label_select"><p class="edit_user_labels">' . __ ( 'Time autorefresh' );
2019-03-12 08:56:45 +01:00
$time_autorefresh .= ui_print_help_tip (
2019-02-19 14:55:44 +01:00
__ ( 'Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first' ),
true
2019-03-20 13:26:15 +01:00
) . '</p>' ;
2019-03-12 08:56:45 +01:00
$time_autorefresh .= html_print_select (
2019-02-19 14:55:44 +01:00
$times ,
'time_autorefresh' ,
$user_info [ 'time_autorefresh' ],
'' ,
'' ,
'' ,
true ,
false ,
false
2019-03-20 13:26:15 +01:00
) . '</div>' ;
2019-03-12 08:56:45 +01:00
2019-03-20 13:26:15 +01:00
$comments = '<p class="edit_user_labels">' . __ ( 'Comments' ) . ': </p>' ;
2019-03-12 08:56:45 +01:00
$comments .= html_print_textarea (
2019-02-19 14:55:44 +01:00
'comments' ,
2 ,
60 ,
$user_info [ 'comments' ],
(( $view_mode ) ? 'readonly="readonly"' : '' ),
true
);
2019-03-12 08:56:45 +01:00
$comments .= html_print_input_hidden ( 'quick_language_change' , 1 , true );
2012-03-08 17:42:31 +01:00
2019-04-09 18:18:10 +02:00
foreach ( $timezones as $timezone_name => $tz ) {
2019-04-12 09:20:55 +02:00
if ( $timezone_name == 'America/Montreal' ) {
$timezone_name = 'America/Toronto' ;
} else if ( $timezone_name == 'Asia/Chongqing' ) {
$timezone_name = 'Asia/Shanghai' ;
}
2019-04-09 18:18:10 +02:00
$area_data_timezone_polys .= '' ;
foreach ( $tz [ 'polys' ] as $coords ) {
$area_data_timezone_polys .= '<area data-timezone="' . $timezone_name . '" data-country="' . $tz [ 'country' ] . '" data-pin="' . implode ( ',' , $tz [ 'pin' ]) . '" data-offset="' . $tz [ 'offset' ] . '" shape="poly" coords="' . implode ( ',' , $coords ) . '" />' ;
}
$area_data_timezone_rects .= '' ;
foreach ( $tz [ 'rects' ] as $coords ) {
$area_data_timezone_rects .= '<area data-timezone="' . $timezone_name . '" data-country="' . $tz [ 'country' ] . '" data-pin="' . implode ( ',' , $tz [ 'pin' ]) . '" data-offset="' . $tz [ 'offset' ] . '" shape="rect" coords="' . implode ( ',' , $coords ) . '" />' ;
}
}
2019-05-21 17:14:29 +02:00
echo '<form name="user_mod" method="post" action="' . ui_get_full_url ( 'index.php?sec=workspace&sec2=operation/users/user_edit' ) . '&modified=1&id=' . $id . '&pure=' . $config [ 'pure' ] . '">' ;
2012-03-08 17:42:31 +01:00
2019-03-20 13:26:15 +01:00
echo ' < div id = " user_form " >
< div class = " user_edit_first_row " >
< div class = " edit_user_info white_box " >
< div class = " edit_user_info_left " > '.$avatar.$user_id.' </ div >
< div class = " edit_user_info_right " > '.$full_name.$email.$phone.$new_pass.$new_pass_confirm.' </ div >
</ div >
< div class = " edit_user_autorefresh white_box " > '.$autorefresh_show.$time_autorefresh.' </ div >
</ div >
< div class = " user_edit_second_row white_box " >
< div class = " edit_user_options " > '.$language.$size_pagination.$skin.$home_screen.$event_filter.$newsletter.$newsletter_reminder.$double_authentication.' </ div >
2019-04-12 09:20:55 +02:00
< div class = " edit_user_timezone " > ' . $timezone ;
2019-05-09 19:23:18 +02:00
2019-04-12 09:20:55 +02:00
if ( ! is_metaconsole ()) {
echo ' < div id = " timezone-picker " >
2019-04-12 10:10:04 +02:00
< img id = " timezone-image " src = " '. $local_file .' " width = " '. $map_width .' " height = " '. $map_height .' " usemap = " #timezone-map " />
< img class = " timezone-pin " src = " include/javascript/timezonepicker/images/pin.png " style = " padding-top: 4px; " />
< map name = " timezone-map " id = " timezone-map " > '.$area_data_timezone_polys.$area_data_timezone_rects.' </ map >
</ div > ' ;
2019-04-12 09:20:55 +02:00
}
echo ' </ div >
2019-03-20 13:26:15 +01:00
</ div >
< div class = " user_edit_third_row white_box " >
< div class = " edit_user_comments " > '.$comments.' </ div >
</ div >
</ div > ' ;
2019-05-13 17:28:23 +02:00
2019-05-28 13:14:42 +02:00
if ( $config [ 'ehorus_enabled' ] && $config [ 'ehorus_user_level_conf' ]) {
2019-05-13 17:28:23 +02:00
// eHorus user remote login
2019-05-10 15:32:25 +02:00
$table_remote = new StdClass ();
$table_remote -> data = [];
$table_remote -> width = '100%' ;
2019-05-13 17:28:23 +02:00
$table_remote -> id = 'ehorus-remote-setup' ;
$table_remote -> class = 'white_box' ;
2019-05-10 15:32:25 +02:00
$table_remote -> size [ 'name' ] = '30%' ;
$table_remote -> style [ 'name' ] = 'font-weight: bold' ;
2019-05-13 17:28:23 +02:00
2019-05-16 18:59:17 +02:00
// Title
$row = [];
$row [ 'control' ] = '<p class="edit_user_labels">' . __ ( 'eHorus user configuration' ) . ': </p>' ;
2019-05-28 13:14:42 +02:00
$table_remote -> data [ 'ehorus_user_level_conf' ] = $row ;
2019-05-16 18:59:17 +02:00
2019-05-10 15:32:25 +02:00
// User.
$row = [];
$row [ 'name' ] = __ ( 'User' );
2019-05-28 13:14:42 +02:00
$row [ 'control' ] = html_print_input_text ( 'ehorus_user_level_user' , $user_info [ 'ehorus_user_level_user' ], '' , 30 , 100 , true );
$table_remote -> data [ 'ehorus_user_level_user' ] = $row ;
2019-05-10 15:32:25 +02:00
// Pass.
$row = [];
$row [ 'name' ] = __ ( 'Password' );
2019-05-28 13:14:42 +02:00
$row [ 'control' ] = html_print_input_password ( 'ehorus_user_level_pass' , io_output_password ( $user_info [ 'ehorus_user_level_pass' ]), '' , 30 , 100 , true );
$table_remote -> data [ 'ehorus_user_level_pass' ] = $row ;
2019-05-10 15:32:25 +02:00
// Test.
$ehorus_port = db_get_value ( 'value' , 'tconfig' , 'token' , 'ehorus_port' );
$ehorus_host = db_get_value ( 'value' , 'tconfig' , 'token' , 'ehorus_hostname' );
$row = [];
$row [ 'name' ] = __ ( 'Test' );
$row [ 'control' ] = html_print_button ( __ ( 'Start' ), 'test-ehorus' , false , 'ehorus_connection_test("' . $ehorus_host . '",' . $ehorus_port . ')' , 'class="sub next"' , true );
2019-05-13 17:28:23 +02:00
$row [ 'control' ] .= ' <span id="test-ehorus-spinner" style="display:none;"> ' . html_print_image ( 'images/spinner.gif' , true ) . '</span>' ;
$row [ 'control' ] .= ' <span id="test-ehorus-success" style="display:none;"> ' . html_print_image ( 'images/status_sets/default/severity_normal.png' , true ) . '</span>' ;
$row [ 'control' ] .= ' <span id="test-ehorus-failure" style="display:none;"> ' . html_print_image ( 'images/status_sets/default/severity_critical.png' , true ) . '</span>' ;
2019-05-10 15:32:25 +02:00
$row [ 'control' ] .= '<span id="test-ehorus-message" style="display:none;"></span>' ;
$table_remote -> data [ 'ehorus_test' ] = $row ;
2019-05-16 18:59:17 +02:00
echo '<div class="ehorus_user_conf">' ;
2019-05-13 17:28:23 +02:00
2019-05-10 15:32:25 +02:00
html_print_table ( $table_remote );
2019-05-16 18:59:17 +02:00
echo '</div>' ;
2019-05-09 19:23:18 +02:00
}
2019-05-13 17:28:23 +02:00
echo '<div class="edit_user_button">' ;
2019-01-30 16:18:44 +01:00
if ( ! $config [ 'user_can_update_info' ]) {
echo '<i>' . __ ( 'You can not change your user info under the current authentication scheme' ) . '</i>' ;
} else {
html_print_csrf_hidden ();
html_print_submit_button ( __ ( 'Update' ), 'uptbutton' , $view_mode , 'class="sub upd"' );
2009-01-22 18:44:33 +01:00
}
2019-01-30 16:18:44 +01:00
2019-03-20 13:26:15 +01:00
echo '</div>' ;
2019-05-13 17:28:23 +02:00
echo '</form>' ;
2009-01-22 18:44:33 +01:00
2019-03-20 13:26:15 +01:00
echo '<div id="edit_user_profiles" class="white_box">' ;
2019-01-30 16:18:44 +01:00
if ( ! defined ( 'METACONSOLE' )) {
2019-03-20 13:26:15 +01:00
echo '<p class="edit_user_labels">' . __ ( 'Profiles/Groups assigned to this user' ) . '</p>' ;
2019-01-30 16:18:44 +01:00
}
2009-01-22 18:44:33 +01:00
2017-02-03 12:23:58 +01:00
$table = new stdClass ();
2015-06-12 15:50:46 +02:00
$table -> width = '100%' ;
2019-03-29 11:05:52 +01:00
$table -> class = 'info_table' ;
2015-06-08 11:05:19 +02:00
if ( defined ( 'METACONSOLE' )) {
2019-01-30 16:18:44 +01:00
$table -> width = '100%' ;
$table -> class = 'databox data' ;
$table -> title = __ ( 'Profiles/Groups assigned to this user' );
$table -> head_colspan [ 0 ] = 0 ;
$table -> headstyle [] = 'background-color: #82B93C' ;
$table -> headstyle [] = 'background-color: #82B93C' ;
$table -> headstyle [] = 'background-color: #82B93C' ;
2015-03-06 12:28:05 +01:00
}
2019-01-30 16:18:44 +01:00
$table -> data = [];
$table -> head = [];
$table -> align = [];
$table -> style = [];
2015-07-14 15:59:39 +02:00
2015-06-08 11:05:19 +02:00
if ( ! defined ( 'METACONSOLE' )) {
2019-01-30 16:18:44 +01:00
$table -> style [ 0 ] = 'font-weight: bold' ;
$table -> style [ 1 ] = 'font-weight: bold' ;
2015-03-06 12:28:05 +01:00
}
2015-07-14 15:59:39 +02:00
2010-05-20 14:07:19 +02:00
$table -> head [ 0 ] = __ ( 'Profile name' );
2010-07-19 18:20:11 +02:00
$table -> head [ 1 ] = __ ( 'Group' );
2013-01-09 10:25:07 +01:00
$table -> head [ 2 ] = __ ( 'Tags' );
2019-01-30 16:18:44 +01:00
$table -> align = [];
2015-06-12 15:50:46 +02:00
$table -> align [ 1 ] = 'left' ;
2009-01-22 18:44:33 +01:00
2019-01-30 16:18:44 +01:00
$table -> data = [];
2009-01-22 18:44:33 +01:00
2019-01-30 16:18:44 +01:00
$result = db_get_all_rows_field_filter ( 'tusuario_perfil' , 'id_usuario' , $id );
2009-01-22 18:44:33 +01:00
if ( $result === false ) {
2019-01-30 16:18:44 +01:00
$result = [];
2009-01-22 18:44:33 +01:00
}
foreach ( $result as $profile ) {
2019-01-30 16:18:44 +01:00
$data [ 0 ] = '<b>' . profile_get_name ( $profile [ 'id_perfil' ]) . '</b>' ;
if ( $config [ 'show_group_name' ]) {
2019-02-19 14:55:44 +01:00
$data [ 1 ] = ui_print_group_icon (
$profile [ 'id_grupo' ],
true
) . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=' . $profile [ 'id_grupo' ] . '"> </a>' ;
2019-01-30 16:18:44 +01:00
} else {
2019-02-19 14:55:44 +01:00
$data [ 1 ] = ui_print_group_icon (
$profile [ 'id_grupo' ],
true
) . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=' . $profile [ 'id_grupo' ] . '"> ' . ui_print_truncate_text ( groups_get_name ( $profile [ 'id_grupo' ], true ), GENERIC_SIZE_TEXT ) . '</a>' ;
2019-01-30 16:18:44 +01:00
}
$tags_ids = explode ( ',' , $profile [ 'tags' ]);
$tags = tags_get_tags ( $tags_ids );
$data [ 2 ] = tags_get_tags_formatted ( $tags );
2006-03-27 05:37:27 +02:00
2019-01-30 16:18:44 +01:00
array_push ( $table -> data , $data );
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/file_manager.php, godmode/setup/news.php,
godmode/users/configure_user.php, godmode/users/user_list.php,
godmode/massive/massive_copy_modules.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_delete_action_alerts.php,
godmode/massive/massive_delete_alerts.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_nc_groups.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php,
godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php, godmode/netflow/nf.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/agentes/estado_agente.php, operation/agentes/sla_view.php,
operation/agentes/tactical.php,
operation/agentes/estado_generalagente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/integria_incidents/incident_detail.php,
operation/gis_maps/index.php, operation/events/events_list.php,
operation/events/events.php, operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/graph_viewer.php, operation/search_reports.php,
operation/netflow/nf_view.php: cleaned source code.
* godmode/massive/massive_operations.php,
godmode/massive/massive_edit_modules.php: fixed the massive edition
of "any" module in agents.
Fixes: #3543484
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6806 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-24 18:38:48 +02:00
}
2019-01-30 16:18:44 +01:00
if ( ! empty ( $table -> data )) {
html_print_table ( $table );
} else {
ui_print_info_message ([ 'no_close' => true , 'message' => __ ( 'This user doesn\'t have any assigned profile/group.' ) ]);
2009-01-22 18:44:33 +01:00
}
2013-05-20 10:42:02 +02:00
2019-03-20 13:26:15 +01:00
// Close edit_user_profiles.
echo '</div>' ;
2013-05-20 10:42:02 +02:00
enterprise_hook ( 'close_meta_frame' );
2019-03-20 16:45:24 +01:00
if ( ! defined ( 'METACONSOLE' )) {
?>
2011-08-08 13:20:56 +02:00
2019-03-20 16:45:24 +01:00
< style >
/* Styles for timezone map */
2019-04-12 09:20:55 +02:00
#timezone-picker div.timezone-picker {
margin : 0 auto ;
2019-03-21 15:58:10 +01:00
}
2019-03-20 16:45:24 +01:00
</ style >
2019-04-12 09:20:55 +02:00
< script language = " javascript " type = " text/javascript " >
$ ( document ) . ready ( function () {
// Set up the picker to update target timezone and country select lists.
$ ( '#timezone-image' ) . timezonePicker ({
target : '#timezone' ,
});
// Optionally an auto-detect button to trigger JavaScript geolocation.
$ ( '#timezone-detect' ) . click ( function () {
$ ( '#timezone-image' ) . timezonePicker ( 'detectLocation' );
});
});
</ script >
2019-03-20 16:45:24 +01:00
< ? php
2019-04-12 09:20:55 +02:00
// Include OpenLayers and timezone user map library.
echo '<script type="text/javascript" src="' . ui_get_full_url ( 'include/javascript/timezonepicker/lib/jquery.timezone-picker.min.js' ) . '"></script>' . " \n \t " ;
echo '<script type="text/javascript" src="' . ui_get_full_url ( 'include/javascript/timezonepicker/lib/jquery.maphilight.min.js' ) . '"></script>' . " \n \t " ;
2019-03-20 16:45:24 +01:00
// Closes no meta condition.
2019-05-10 15:32:25 +02:00
}
2019-05-09 19:23:18 +02:00
2019-03-20 16:45:24 +01:00
?>
2019-03-20 13:26:15 +01:00
2011-08-08 13:20:56 +02:00
< script language = " javascript " type = " text/javascript " >
2019-03-20 13:26:15 +01:00
2011-08-08 13:20:56 +02:00
$ ( document ) . ready ( function () {
2016-09-05 10:31:43 +02:00
2019-01-30 16:18:44 +01:00
$ ( " #right_autorefreshlist " ) . click ( function () {
jQuery . each ( $ ( " select[name='autorefresh_list_out[]'] option:selected " ), function ( key , value ) {
imodule_name = $ ( value ) . html ();
if ( imodule_name != < ? php echo " ' " . __ ( 'None' ) . " ' " ; ?> ) {
id_imodule = $ ( value ) . attr ( 'value' );
$ ( " select[name='autorefresh_list[]'] " ) . append ( $ ( " <option></option> " ) . val ( id_imodule ) . html ( '<i>' + imodule_name + '</i>' ));
$ ( " #autorefresh_list_out " ) . find ( " option[value=' " + id_imodule + " '] " ) . remove ();
$ ( " #autorefresh_list " ) . find ( " option[value=''] " ) . remove ();
$ ( " #autorefresh_list " ) . find ( " option[value='0'] " ) . remove ();
if ( $ ( " #autorefresh_list_out option " ) . length == 0 ) {
$ ( " select[name='autorefresh_list_out[]'] " ) . append ( $ ( " <option></option> " ) . val ( '' ) . html ( '<i><?php echo __(' None '); ?></i>' ));
}
}
});
});
$ ( " #left_autorefreshlist " ) . click ( function () {
jQuery . each ( $ ( " select[name='autorefresh_list[]'] option:selected " ), function ( key , value ) {
imodule_name = $ ( value ) . html ();
if ( imodule_name != < ? php echo " ' " . __ ( 'None' ) . " ' " ; ?> ) {
id_imodule = $ ( value ) . attr ( 'value' );
$ ( " #autorefresh_list " ) . find ( " option[value=' " + id_imodule + " '] " ) . remove ();
$ ( " #autorefresh_list_out " ) . find ( " option[value=''] " ) . remove ();
$ ( " select[name='autorefresh_list_out[]'] " ) . append ( $ ( " <option><option> " ) . val ( id_imodule ) . html ( '<i>' + imodule_name + '</i>' ));
$ ( " #autorefresh_list_out option " ) . last () . remove ();
if ( $ ( " #autorefresh_list option " ) . length == 0 ) {
$ ( " select[name='autorefresh_list[]'] " ) . append ( $ ( " <option></option> " ) . val ( '' ) . html ( '<i><?php echo __(' None '); ?></i>' ));
}
}
});
});
$ ( " #submit-uptbutton " ) . click ( function () {
if ( $ ( " #autorefresh_list option " ) . length > 0 ) {
$ ( '#autorefresh_list option' ) . prop ( 'selected' , true );
}
});
check_default_block_size ()
$ ( " #checkbox-default_block_size " ) . change ( function () {
check_default_block_size ();
});
function check_default_block_size () {
if ( $ ( " #checkbox-default_block_size " ) . is ( ':checked' )) {
$ ( " #text-block_size " ) . attr ( 'disabled' , true );
}
else {
$ ( " #text-block_size " ) . removeAttr ( 'disabled' );
}
}
$ ( " input#checkbox-double_auth " ) . change ( function ( e ) {
e . preventDefault ();
if ( this . checked ) {
show_double_auth_activation ();
}
else {
show_double_auth_deactivation ();
}
});
show_data_section ();
2011-08-08 13:20:56 +02:00
});
2012-03-08 17:42:31 +01:00
function show_data_section () {
2019-01-30 16:18:44 +01:00
section = $ ( " #section " ) . val ();
switch ( section ) {
case < ? php echo " ' " . 'Dashboard' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Visual console' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " " );
break ;
case < ? php echo " ' " . 'Event list' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Group view' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Tactical view' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Alert detail' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Other' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
case < ? php echo " ' " . 'Default' . " ' " ; ?> :
$ ( " #text-data_section " ) . css ( " display " , " none " );
$ ( " #dashboard " ) . css ( " display " , " none " );
$ ( " #visual_console " ) . css ( " display " , " none " );
break ;
}
2012-03-08 17:42:31 +01:00
}
2014-12-11 16:17:35 +01:00
function show_double_auth_info () {
2019-01-30 16:18:44 +01:00
var userID = " <?php echo $config['id_user'] ; ?> " ;
var $loadingSpinner = $ ( " <img src= \" <?php echo $config['homeurl'] ; ?>/images/spinner.gif \" /> " );
var $dialogContainer = $ ( " div#dialog-double_auth-container " );
$dialogContainer . html ( $loadingSpinner );
// Load the info page
var request = $ . ajax ({
url : " <?php echo ui_get_full_url('ajax.php', false, false, false); ?> " ,
type : 'POST' ,
dataType : 'html' ,
data : {
page : 'include/ajax/double_auth.ajax' ,
id_user : userID ,
get_double_auth_data_page : 1 ,
containerID : $dialogContainer . prop ( 'id' )
},
complete : function ( xhr , textStatus ) {
},
success : function ( data , textStatus , xhr ) {
// isNaN = is not a number
if ( isNaN ( data )) {
$dialogContainer . html ( data );
}
// data is a number, convert it to integer to do the compare
else if ( Number ( data ) === - 1 ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('Authentication error').'</div></b>'; ?> " );
}
else {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('Error').'</div></b>'; ?> " );
}
},
error : function ( xhr , textStatus , errorThrown ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('There was an error loading the data').'</div></b>'; ?> " );
}
});
$ ( " div#dialog-double_auth " )
2019-03-12 08:56:45 +01:00
. css ( 'display' , 'block' )
2019-01-30 16:18:44 +01:00
. append ( $dialogContainer )
. dialog ({
resizable : true ,
draggable : true ,
modal : true ,
title : " <?php echo __('Double autentication information'); ?> " ,
overlay : {
opacity : 0.5 ,
background : " black "
},
width : 400 ,
height : 375 ,
close : function ( event , ui ) {
// Abort the ajax request
if ( typeof request != 'undefined' )
request . abort ();
// Remove the contained html
$dialogContainer . empty ();
}
})
. show ();
2014-12-11 16:17:35 +01:00
}
function show_double_auth_activation () {
2019-01-30 16:18:44 +01:00
var userID = " <?php echo $config['id_user'] ; ?> " ;
var $loadingSpinner = $ ( " <img src= \" <?php echo $config['homeurl'] ; ?>/images/spinner.gif \" /> " );
var $dialogContainer = $ ( " div#dialog-double_auth-container " );
$dialogContainer . html ( $loadingSpinner );
// Load the info page
var request = $ . ajax ({
url : " <?php echo ui_get_full_url('ajax.php', false, false, false); ?> " ,
type : 'POST' ,
dataType : 'html' ,
data : {
page : 'include/ajax/double_auth.ajax' ,
id_user : userID ,
get_double_auth_info_page : 1 ,
containerID : $dialogContainer . prop ( 'id' )
},
complete : function ( xhr , textStatus ) {
},
success : function ( data , textStatus , xhr ) {
// isNaN = is not a number
if ( isNaN ( data )) {
$dialogContainer . html ( data );
}
// data is a number, convert it to integer to do the compare
else if ( Number ( data ) === - 1 ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('Authentication error').'</div></b>'; ?> " );
}
else {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('Error').'</div></b>'; ?> " );
}
},
error : function ( xhr , textStatus , errorThrown ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('There was an error loading the data').'</div></b>'; ?> " );
}
});
$ ( " div#dialog-double_auth " ) . dialog ({
resizable : true ,
draggable : true ,
modal : true ,
title : " <?php echo __('Double autentication activation'); ?> " ,
overlay : {
opacity : 0.5 ,
background : " black "
},
width : 500 ,
height : 400 ,
close : function ( event , ui ) {
// Abort the ajax request
if ( typeof request != 'undefined' )
request . abort ();
// Remove the contained html
$dialogContainer . empty ();
document . location . reload ();
}
})
. show ();
2014-12-11 16:17:35 +01:00
}
function show_double_auth_deactivation () {
2019-01-30 16:18:44 +01:00
var userID = " <?php echo $config['id_user'] ; ?> " ;
var $loadingSpinner = $ ( " <img src= \" <?php echo $config['homeurl'] ; ?>/images/spinner.gif \" /> " );
var $dialogContainer = $ ( " div#dialog-double_auth-container " );
var message = " <p><?php echo __('Are you sure?').'<br>'.__('The double authentication will be deactivated'); ?></p> " ;
var $button = $ ( " <input type= \" button \" value= \" <?php echo __('Deactivate'); ?> \" /> " );
$dialogContainer
. empty ()
. append ( message )
. append ( $button );
var request ;
$button . click ( function ( e ) {
e . preventDefault ();
$dialogContainer . html ( $loadingSpinner );
// Deactivate the double auth
request = $ . ajax ({
url : " <?php echo ui_get_full_url('ajax.php', false, false, false); ?> " ,
type : 'POST' ,
dataType : 'json' ,
data : {
page : 'include/ajax/double_auth.ajax' ,
id_user : userID ,
deactivate_double_auth : 1
},
complete : function ( xhr , textStatus ) {
},
success : function ( data , textStatus , xhr ) {
if ( data === - 1 ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('Authentication error').'</div></b>'; ?> " );
}
else if ( data ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" green \" >'.__('The double autentication was deactivated successfully').'</div></b>'; ?> " );
}
else {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('There was an error deactivating the double autentication').'</div></b>'; ?> " );
}
},
error : function ( xhr , textStatus , errorThrown ) {
$dialogContainer . html ( " <?php echo '<b><div class= \" red \" >'.__('There was an error deactivating the double autentication').'</div></b>'; ?> " );
}
});
});
$ ( " div#dialog-double_auth " ) . dialog ({
resizable : true ,
draggable : true ,
modal : true ,
title : " <?php echo __('Double autentication activation'); ?> " ,
overlay : {
opacity : 0.5 ,
background : " black "
},
width : 300 ,
height : 150 ,
close : function ( event , ui ) {
// Abort the ajax request
if ( typeof request != 'undefined' )
request . abort ();
// Remove the contained html
$dialogContainer . empty ();
document . location . reload ();
}
})
. show ();
2014-12-11 16:17:35 +01:00
}
2019-05-09 19:23:18 +02:00
2019-05-10 15:32:25 +02:00
function ehorus_connection_test ( host , port ) {
2019-05-28 13:14:42 +02:00
var user = $ ( 'input#text-ehorus_user_level_user' ) . val ();
var pass = $ ( 'input#password-ehorus_user_level_pass' ) . val ();
2019-05-09 19:23:18 +02:00
2019-05-10 15:32:25 +02:00
debugger ;
2019-05-09 19:23:18 +02:00
var badRequestMessage = '<?php echo __(' Empty user or password '); ?>' ;
var notFoundMessage = '<?php echo __(' User not found '); ?>' ;
var invalidPassMessage = '<?php echo __(' Invalid password '); ?>' ;
var hideLoadingImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-spinner' ) . hide ();
2019-05-09 19:23:18 +02:00
}
var showLoadingImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-spinner' ) . show ();
2019-05-09 19:23:18 +02:00
}
var hideSuccessImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-success' ) . hide ();
2019-05-09 19:23:18 +02:00
}
var showSuccessImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-success' ) . show ();
2019-05-09 19:23:18 +02:00
}
var hideFailureImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-failure' ) . hide ();
2019-05-09 19:23:18 +02:00
}
var showFailureImage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-failure' ) . show ();
2019-05-09 19:23:18 +02:00
}
var hideMessage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-message' ) . hide ();
2019-05-09 19:23:18 +02:00
}
var showMessage = function () {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-message' ) . show ();
2019-05-09 19:23:18 +02:00
}
var changeTestMessage = function ( message ) {
2019-05-10 15:32:25 +02:00
$ ( '#test-ehorus-message' ) . text ( message );
2019-05-09 19:23:18 +02:00
}
hideSuccessImage ();
hideFailureImage ();
hideMessage ();
showLoadingImage ();
$ . ajax ({
url : 'https://' + host + ':' + port + '/login' ,
type : 'POST' ,
dataType : 'json' ,
data : {
user : user ,
pass : pass
}
})
. done ( function ( data , textStatus , xhr ) {
showSuccessImage ();
})
. fail ( function ( xhr , textStatus , errorThrown ) {
showFailureImage ();
if ( xhr . status === 400 ) {
changeTestMessage ( badRequestMessage );
}
else if ( xhr . status === 401 || xhr . status === 403 ) {
changeTestMessage ( invalidPassMessage );
}
else if ( xhr . status === 404 ) {
changeTestMessage ( notFoundMessage );
}
else if ( errorThrown === 'timeout' ) {
changeTestMessage ( timeoutMessage );
}
else {
changeTestMessage ( errorThrown );
}
showMessage ();
})
. always ( function ( xhr , textStatus ) {
hideLoadingImage ();
});
}
2013-03-14 17:52:05 +01:00
</ script >