diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 3a8611f3c7..7c45b2a285 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -141,6 +141,7 @@ if ($table !== null) { unset($table); +$table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; $table->data = []; diff --git a/pandora_console/godmode/massive/massive_edit_users.php b/pandora_console/godmode/massive/massive_edit_users.php new file mode 100644 index 0000000000..2f1cbeb4fe --- /dev/null +++ b/pandora_console/godmode/massive/massive_edit_users.php @@ -0,0 +1,717 @@ +'.__('metaconsole').''; + } else { + $url = __('any node'); + } + + ui_print_warning_message( + __( + 'This node is configured with centralized mode. All profiles user information is read only. Go to %s to manage it.', + $url + ) + ); + + return; +} + +if (is_metaconsole() === true) { + include_once $config['homedir'].'/include/functions_visual_map.php'; + open_meta_frame(); +} + +$edit_users = (int) get_parameter('edit_users'); +if ($edit_users === 1) { + $users = get_parameter('id_users', false, false); + if ($users !== false) { + $update = []; + + $language = (string) get_parameter('language', '-1'); + if ($language !== '-1') { + $update['language'] = $language; + } + + $block_size_change = (int) get_parameter('block_size_change'); + if ($block_size_change === 0) { + $block_size = (int) get_parameter('block_size', -1); + if ($block_size !== -1) { + $update['block_size'] = $block_size; + } + } + + $section = get_parameter('section', '-1'); + if ($section !== '-1') { + $update['section'] = $section; + } + + $data_section = get_parameter('data_section', ''); + $dashboard = get_parameter('dashboard', ''); + $visual_console = get_parameter('visual_console', ''); + $section = io_safe_output($section); + + if (($section === 'Event list') || ($section === 'Group view') + || ($section === 'Alert detail') || ($section === 'Tactical view') + || ($section === 'Default') + ) { + $update['data_section'] = ''; + } else if ($section === 'Dashboard') { + $update['data_section'] = $dashboard; + } else if ($section === 'Visual console') { + $update['data_section'] = $visual_console; + } + + $event = (int) get_parameter('event_filter', -1); + if ($event !== -1) { + $update['default_event_filter'] = $event; + } + + $autorefresh_list = get_parameter_post('autorefresh_list', [0 => '-1']); + if ($autorefresh_list[0] !== '-1') { + if (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) { + $update['autorefresh_white_list'] = ''; + } else { + $update['autorefresh_white_list'] = json_encode($autorefresh_list); + } + } + + $time_autorefresh = (int) get_parameter('time_autorefresh', -1); + if ($time_autorefresh !== -1) { + $update['time_autorefresh'] = $time_autorefresh; + } + + $timezone = (string) get_parameter('timezone', '-1'); + if ($timezone !== '-1') { + $update['timezone'] = $timezone; + } + + $disabled = (int) get_parameter('disabled', -1); + if ($disabled !== -1) { + $update['disabled'] = $disabled; + } + + $error = []; + $success = []; + foreach ($users as $key => $user) { + if (empty($update) === false) { + $result = update_user($user, $update); + if ($result === false) { + $error[] = $user; + } else { + $success[] = $user; + } + } else { + $error[] = $user; + } + } + + if (empty($success) === false) { + ui_print_success_message( + __( + 'Users updated successfully (%s)', + implode( + ',', + $success + ) + ) + ); + } + + if (empty($error) === false) { + ui_print_error_message( + __( + 'Users cannot be updated (%s)', + implode(',', $error) + ) + ); + } + } +} + +if (is_metaconsole() === false) { + 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', + ]; + + $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' + ); +} + + +$get_users = get_users(); +$users = []; +if (empty($get_users) === false) { + foreach ($get_users as $key => $value) { + $users[$key] = $key; + } +} + +$users_div = '
'.__('Users').'
'; +$users_div .= html_print_select( + $users, + 'id_users[]', + 0, + false, + '', + '', + true, + true, + true, + '', + false, + '', + false, + false, + false, + '', + false, + false, + false, + false, + true, + true, + true +).'