From ab3cfd4cc97f3b2ef8f0552b5571f9b84a2a74ca Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Tue, 9 Jul 2019 14:08:06 +0200 Subject: [PATCH 1/2] new tocken user edit newslatter info --- .../godmode/users/configure_user.php | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 47788284fe..662df7ecee 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) { $user_info['not_login'] = false; $user_info['strict_acl'] = false; $user_info['session_time'] = 0; + $user_info['middlename'] = 0; + if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { $user_info['id_skin'] = ''; } @@ -218,6 +220,7 @@ if ($create_user) { } $values['not_login'] = (bool) get_parameter('not_login', false); + $values['middlename'] = get_parameter('middlename', 0); $values['strict_acl'] = (bool) get_parameter('strict_acl', false); $values['session_time'] = (int) get_parameter('session_time', 0); @@ -317,12 +320,13 @@ if ($update_user) { $values['timezone'] = (string) get_parameter('timezone'); $values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_custom_view'] = (int) get_parameter('default_custom_view'); - // eHorus user level conf + + // eHorus user level conf. $values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false); $values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user'); $values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass'); - + $values['middlename'] = get_parameter('middlename', 0); $dashboard = get_parameter('dashboard', ''); $visual_console = get_parameter('visual_console', ''); @@ -869,13 +873,27 @@ foreach ($event_filter_data as $filter) { $table->data[16][0] = __('Default event filter'); $table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false); +$table->data[17][0] = __('Disabled newsletter'); +if ($user_info['middlename'] >= 0) { + $middlename = false; +} else { + $middlename = true; +} + +$table->data[17][1] = html_print_checkbox( + 'middlename', + -1, + $middlename, + true +); + if ($config['ehorus_user_level_conf']) { - $table->data[17][0] = __('eHorus user acces enabled'); - $table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); - $table->data[18][0] = __('eHorus user'); - $table->data[19][0] = __('eHorus password'); - $table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true); - $table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true); + $table->data[18][0] = __('eHorus user acces enabled'); + $table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); + $table->data[19][0] = __('eHorus user'); + $table->data[20][0] = __('eHorus password'); + $table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true); + $table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true); } From bd070b706bad475c94d758091b9785397aca37f4 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 11 Jul 2019 12:45:52 +0200 Subject: [PATCH 2/2] fixed minor error --- pandora_console/general/register.php | 32 +++++++++---------- .../include/class/ConsoleSupervisor.php | 2 +- pandora_console/include/functions_config.php | 8 +++++ pandora_console/operation/users/user_edit.php | 31 +++++++++--------- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index e6a26bb250..b1d58aada4 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -122,7 +122,6 @@ if (is_ajax()) { exit(); } - ui_require_css_file('register'); $initial = isset($config['initial_wizard']) !== true @@ -150,26 +149,27 @@ if ($initial && users_is_admin()) { ); } -if ($registration && users_is_admin()) { - // Prepare registration wizard, not launch. leave control to flow. - registration_wiz_modal( - false, - // Launch only if not being launch from 'initial'. - !$initial, - (($show_newsletter === true) ? 'force_run_newsletter()' : null) - ); -} else { - if ($show_newsletter) { - // Show newsletter wizard for current user. - newsletter_wiz_modal( +if (!$config['disabled_newsletter']) { + if ($registration && users_is_admin()) { + // Prepare registration wizard, not launch. leave control to flow. + registration_wiz_modal( false, - // Launch only if not being call from 'registration'. - !$registration && !$initial + // Launch only if not being launch from 'initial'. + !$initial, + (($show_newsletter === true) ? 'force_run_newsletter()' : null) ); + } else { + if ($show_newsletter) { + // Show newsletter wizard for current user. + newsletter_wiz_modal( + false, + // Launch only if not being call from 'registration'. + !$registration && !$initial + ); + } } } - $newsletter = null; ?> diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index af688fb5a0..d03b360c16 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -1976,7 +1976,7 @@ class ConsoleSupervisor 'id_user', $config['id_user'] ); - if (license_free() === true + if (!$config['disabled_newsletter'] && $newsletter != 1 && $login === false ) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 0964cf59a3..558260f7a8 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -395,6 +395,10 @@ function config_update_config() $error_update[] = __('Enable Update Manager'); } + if (!config_update_value('disabled_newsletter', get_parameter('disabled_newsletter'))) { + $error_update[] = __('Disabled newsletter'); + } + if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) { $error_update[] = __('Ipam Ocuppied Manager Critical'); } @@ -1723,6 +1727,10 @@ function config_process_config() config_update_value('enable_update_manager', 1); } + if (!isset($config['disabled_newsletter'])) { + config_update_value('disabled_newsletter', 0); + } + if (!isset($config['ipam_ocuppied_critical_treshold'])) { config_update_value('ipam_ocuppied_critical_treshold', 90); } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 9e267c5c2d..b8b42ad945 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -426,24 +426,25 @@ if (check_acl($config['id_user'], 0, 'ER')) { ).''; } +if (!$config['disabled_newsletter']) { + $newsletter = '

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

'; + $newsletter_reminder .= html_print_switch( + [ + 'name' => 'newsletter_reminder', + 'value' => $newsletter_reminder_value, + 'disabled' => false, + ] + ); + } -$newsletter = '

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

'; - $newsletter_reminder .= html_print_switch( - [ - 'name' => 'newsletter_reminder', - 'value' => $newsletter_reminder_value, - 'disabled' => false, - ] - ); + $newsletter_reminder .= '
'; } -$newsletter_reminder .= '
'; - $autorefresh_list_out = [];