'Gray', 'blue-marble' => 'Blue marble', 'night-electric' => 'Night Electric', 'living' => 'Living Earth', ]; $local_file = 'include/javascript/timezonepicker/images/gray-400.png'; // 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' ); } // Update user info. 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', ''); $current_password = get_parameter_post('current_password', ''); $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']); $upd_info['default_event_filter'] = get_parameter('event_filter', null); $upd_info['block_size'] = get_parameter('block_size', $config['block_size']); $upd_info['middlename'] = get_parameter_switch('newsletter_reminder', $user_info['middlename']); $default_block_size = get_parameter('default_block_size', 0); if ($default_block_size) { $upd_info['block_size'] = 0; } 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; } $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', ''); // Save autorefresh list. $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); $upd_info['ehorus_user_level_user'] = get_parameter('ehorus_user_level_user'); $upd_info['ehorus_user_level_pass'] = get_parameter('ehorus_user_level_pass'); $upd_info['ehorus_user_level_enabled'] = get_parameter('ehorus_user_level_enabled', 0); $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id); $section = io_safe_output($upd_info['section']); if (($section == 'Event list') || ($section == 'Group view') || ($section == 'Alert detail') || ($section == 'Tactical view') || ($section == 'Default') ) { $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)) { $correct_password = false; $user_credentials_check = process_user_login($config['id_user'], $current_password, true); if ($user_credentials_check !== false) { $correct_password = true; } if ($config['user_can_update_password'] && $password_confirm == $password_new) { if ($correct_password === true) { if ((!$is_admin || $config['enable_pass_policy_admin']) && $config['enable_pass_policy'] ) { $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 ($current_password === '') { $error_msg = __('Current password of user is required to perform password change'); } else { $error_msg = __('Current password of user is not correct'); } } } 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; } // 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. if ($return) { if (!empty($password_new) && !empty($password_confirm)) { $success_msg = __('Password successfully updated'); } // 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'] == '') ) { $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'); } } ui_print_result_message( $return, $success_msg, $error_msg, $user_auth_error ); } 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']; ui_print_result_message( $return, $success_msg, $error_msg, $user_auth_error ); } } // Prints action status for current message. if ($status != -1) { ui_print_result_message( $status, __('User info successfully updated'), __('Error updating user info') ); } if (defined('METACONSOLE')) { echo '
'.__('User ID').':
'; $user_id .= ''.$id.''.__('Block size for pagination').'
'; if ($user_info['block_size'] == 0) { $block_size = $config['global_block_size']; } else { $block_size = $user_info['block_size']; } $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 .= ''.__('Default').' ('.$config['global_block_size'].')'.ui_print_help_tip(__('If checkbox is clicked then block size global configuration is used'), true).''.__('Language').':
'; $language .= html_print_select_from_sql( 'SELECT id_language, name FROM tlanguage', 'language', $user_info['language'], '', __('Default'), 'default', true, '', '', '', '', '', 10 ).''.__('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true).'
'; $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'), 'Dashboard' => __('Dashboard'), ]; $home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).''.__('Skin').':
'; $skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).''.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'
'; $timezone .= html_print_timezone_select('timezone', $user_info['timezone']).''.__('Double authentication').'
'; if (($config['2FA_all_users'] == '' && !$double_auth_enabled) || ($config['2FA_all_users'] != '' && !$double_auth_enabled) || ($config['double_auth_enabled'] == '' && $double_auth_enabled) || check_acl($config['id_user'], 0, 'PM') ) { $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); } // Dialog. $double_authentication .= ''.__('Event filter').'
'; $event_filter .= html_print_select_from_sql( 'SELECT id_filter, id_name FROM tevent_filter', 'event_filter', $user_info['default_event_filter'], '', __('None'), null, true ).''.__('Newsletter Subscribed').':
'; if ($user_info['middlename'] > 0) { $newsletter .= ''.__('Already subscribed to %s newsletter', get_product_name()).''; } else { $newsletter .= ''.__('Subscribe to our newsletter').''.__('Newsletter Reminder').':
'; $newsletter_reminder .= html_print_switch( [ 'name' => 'newsletter_reminder', 'value' => $newsletter_reminder_value, 'disabled' => false, ] ); } $newsletter_reminder .= ''._('Autorefresh').ui_print_help_tip( __('This will activate autorefresh in selected pages'), true ).'
'; $select_out = html_print_select( $autorefresh_list_out, 'autorefresh_list_out[]', '', '', '', '', true, true, true, '', false, 'width:100%' ); $arrows = ' '; $select_in = html_print_select( $autorefresh_list, 'autorefresh_list[]', '', '', '', '', true, true, true, '', false, 'width:100%' ); $table_ichanges = ''.__('Full list of pages').':
'.__('List of pages with autorefresh').':
'.__('Time autorefresh'); $time_autorefresh .= ui_print_help_tip( __('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), true ).'
'; $time_autorefresh .= html_print_select( $times, 'time_autorefresh', $user_info['time_autorefresh'], '', '', '', true, false, false ).''.__('Comments').':
'; $comments .= html_print_textarea( 'comments', 2, 60, $user_info['comments'], (($view_mode) ? 'readonly="readonly"' : ''), true ); $comments .= html_print_input_hidden('quick_language_change', 1, true); foreach ($timezones as $timezone_name => $tz) { if ($timezone_name == 'America/Montreal') { $timezone_name = 'America/Toronto'; } else if ($timezone_name == 'Asia/Chongqing') { $timezone_name = 'Asia/Shanghai'; } $area_data_timezone_polys .= ''; foreach ($tz['polys'] as $coords) { $area_data_timezone_polys .= ''; } $area_data_timezone_rects .= ''; foreach ($tz['rects'] as $coords) { $area_data_timezone_rects .= ''; } } if (is_metaconsole()) { echo ''; echo ''.__('Profiles/Groups assigned to this user').'
'; } $table = new stdClass(); $table->width = '100%'; $table->class = 'info_table'; if (defined('METACONSOLE')) { $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'; } $table->data = []; $table->head = []; $table->align = []; $table->style = []; if (!defined('METACONSOLE')) { $table->style[0] = 'font-weight: bold'; $table->style[1] = 'font-weight: bold'; } $table->head[0] = __('Profile name'); $table->head[1] = __('Group'); $table->head[2] = __('Tags'); $table->align = []; $table->align[1] = 'left'; $table->data = []; $result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $id); if ($result === false) { $result = []; } foreach ($result as $profile) { $data[0] = ''.profile_get_name($profile['id_perfil']).''; if ($config['show_group_name']) { $data[1] = ui_print_group_icon( $profile['id_grupo'], true ).' '; } else { $data[1] = ui_print_group_icon( $profile['id_grupo'], true ).' '.ui_print_truncate_text(groups_get_name($profile['id_grupo'], true), GENERIC_SIZE_TEXT).''; } $tags_ids = explode(',', $profile['tags']); $tags = tags_get_tags($tags_ids); $data[2] = tags_get_tags_formatted($tags); array_push($table->data, $data); } 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.') ]); } // Close edit_user_profiles. echo '