'.__('Edit my User').''; } $user_id = '

'.__('User ID').':

'; $user_id .= ''.$id.'
'; $full_name = '
'.html_print_input_text_extended( 'fullname', $user_info['fullname'], 'fullname', '', 20, 100, $view_mode, '', [ 'class' => 'input', 'placeholder' => __('Full (display) name'), ], true ).'
'; // Show "Picture" (in future versions, why not, allow users to upload it's own avatar here. if (is_user_admin($id)) { $avatar = html_print_image('images/people_1.png', true, ['class' => 'user_avatar']); } else { $avatar = html_print_image('images/people_2.png', true, ['class' => 'user_avatar']); } if ($view_mode === false) { $table->rowspan[0][2] = 3; } else { $table->rowspan[0][2] = 2; } $email = '
'.html_print_input_text_extended('email', $user_info['email'], 'email', '', '25', '100', $view_mode, '', ['class' => 'input', 'placeholder' => __('E-mail')], true).'
'; $phone = '
'.html_print_input_text_extended('phone', $user_info['phone'], 'phone', '', '20', '30', $view_mode, '', ['class' => 'input', 'placeholder' => __('Phone number')], true).'
'; if ($view_mode === false) { if ($config['user_can_update_password']) { $new_pass = '
'.html_print_input_text_extended('password_new', '', 'password_new', '', '25', '45', $view_mode, '', ['class' => 'input', 'placeholder' => __('New Password')], true, true).'
'; $new_pass_confirm = '
'.html_print_input_text_extended('password_conf', '', 'password_conf', '', '20', '45', $view_mode, '', ['class' => 'input', 'placeholder' => __('Password confirmation')], true, true).'
'; } else { $new_pass = ''.__('You cannot change your password under the current authentication scheme').''; $new_pass_confirm = ''; } } $size_pagination = '

'.__('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).'
'; $values = [ -1 => __('Default'), 1 => __('Yes'), 0 => __('No'), ]; $language = '

'.__('Language').':

'; $language .= html_print_select_from_sql( 'SELECT id_language, name FROM tlanguage', 'language', $user_info['language'], '', __('Default'), 'default', true, '', '', '', '', '', 10 ).'
'; $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; } $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $id_usr = $config['id_user']; if (!$meta) { $home_screen = '

'.__('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).'

'; $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'); } $home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'
'; 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']; } } $home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true); } $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; } } $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); // User only can change skins if has more than one group. $skin = ''; if (function_exists('skins_print_select')) { if (count($usr_groups) > 1) { $skin = '

'.__('Skin').':

'; $skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'
'; } } } else { $home_screen = ''; $skin = ''; } $timezone = '

'.__('Timezone').':

'; $timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'
'; // Double auth. $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); if ($config['double_auth_enabled']) { $double_authentication = '

'.__('Double authentication').'

'; $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); } if ($double_auth_enabled) { $double_authentication .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true); // Dialog. $double_authentication .= ''; $double_authentication .= '
'; } if (isset($double_authentication)) { $double_authentication .= ''; } if (check_acl($config['id_user'], 0, 'ER')) { $event_filter = '

'.__('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 ).'
'; } else if (license_free()) { $newsletter = '

'.__('Newsletter Subscribed').':

'; if ($user_info['middlename']) { $newsletter .= ''.__('Already subscribed to %s newsletter', get_product_name()).'
'; } else { $newsletter .= ''.__('Subscribe to our newsletter').''; } $newsletter_reminder = '

'.__('Newsletter Reminder').':

'; if ($user_info['firstname'] != 0) { $user_info['firstname'] = 1; } $newsletter_reminder .= html_print_checkbox_switch('newsletter_reminder', 1, $user_info['firstname'], true).'
'; } $autorefresh_list_out = []; if (is_metaconsole()) { $autorefresh_list_out['monitoring/tactical'] = 'Tactical view'; $autorefresh_list_out['monitoring/group_view'] = 'Group view'; } else { $autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; $autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; } $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'; 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 = []; $count_autorefresh_list = count($autorefresh_list); for ($i = 0; $i < $count_autorefresh_list; $i++) { $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 = []; $count_autorefresh_list = count($autorefresh_list); for ($i = 0; $i < $count_autorefresh_list; $i++) { $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; unset($autorefresh_list_out[$autorefresh_list[$i]]); $autorefresh_list[$i] = $aux; } $autorefresh_list = $aux; } } $autorefresh_show = '

'._('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').':

'.$select_out.'
'.html_print_image( 'images/darrowright_green.png', true, [ 'id' => 'right_autorefreshlist', 'alt' => __('Push selected pages into autorefresh list'), 'title' => __('Push selected pages into autorefresh list'), ] ).' '.html_print_image( 'images/darrowleft_green.png', true, [ 'id' => 'left_autorefreshlist', 'alt' => __('Pop selected pages out of autorefresh list'), 'title' => __('Pop selected pages out of autorefresh list'), ] ).'

'.__('List of pages with autorefresh').':

'.$select_in.'
'; $autorefresh_show .= $table_ichanges; // Time autorefresh. $times = get_refresh_time_array(); $time_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').':

'; $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); echo '
'; echo '
'.$autorefresh_show.$time_autorefresh.'
'.$language.$size_pagination.$skin.$home_screen.$event_filter.$newsletter.$newsletter_reminder.$double_authentication.'
'.$timezone.'
'.$comments.'
'; echo '
'; if (!$config['user_can_update_info']) { echo ''.__('You can not change your user info under the current authentication scheme').''; } else { html_print_csrf_hidden(); html_print_submit_button(__('Update'), 'uptbutton', $view_mode, 'class="sub upd"'); } echo '
'; echo '
'; echo '
'; if (!defined('METACONSOLE')) { echo '

'.__('Profiles/Groups assigned to this user').'

'; } $table = new stdClass(); $table->width = '100%'; $table->class = 'databox data'; 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 '
'; enterprise_hook('close_meta_frame'); if (!defined('METACONSOLE')) { ?>