Configuration, Registration and newsletter wizards

Former-commit-id: bbd367a10fd01c229c848b15572c4b1d6ccb75cf
This commit is contained in:
fbsanchez 2019-05-13 17:55:41 +02:00
parent 40af2205b1
commit ced1b32915
8 changed files with 1142 additions and 773 deletions

View File

@ -1,455 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
/**
* @package General
*/
global $config;
function display_register($data)
{
if ($data['instance_registered'] == 1) {
return false;
}
if ($data['force_register'] == 1) {
return true;
}
if ($data['force_register'] == 0) {
return false;
}
if ($data['identification_reminder'] == 0) {
return false;
}
if (!isset($data['identification_reminder_timestamp'])) {
return true;
}
if ($data['identification_reminder_timestamp'] < time()) {
return true;
}
return false;
}
function display_newsletter($data)
{
if ($data['newsletter_subscribed'] == 1) {
return false;
}
if ($data['force_newsletter'] == 1) {
return true;
}
if ($data['force_newsletter'] == 0) {
return false;
}
if ($data['newsletter_reminder'] === 0) {
return false;
}
if (!isset($data['newsletter_reminder_timestamp'])) {
return true;
}
if (!is_numeric($data['newsletter_reminder_timestamp'])) {
return true;
}
if ($data['newsletter_reminder_timestamp'] < time()) {
return true;
}
return false;
}
if (is_ajax()) {
include_once $config['homedir'].'/include/functions_update_manager.php';
$open_wizard = get_parameter('open_wizard', 0);
$not_return = get_parameter('not_return', 0);
$reset_initial_wizard = get_parameter('reset_initial_wizard', 0);
if ($reset_initial_wizard) {
config_update_value('initial_wizard', 0);
}
if ($open_wizard) {
$register_pandora = get_parameter('register_pandora', 0);
$newsletter = get_parameter('newsletter', 0);
$forced = get_parameter('forced', 0);
$future_8_days = (time() + 8 * SECONDS_1DAY);
$ui_feedback = [
'status' => true,
'message' => '',
];
if ($register_pandora) {
// Pandora register update
$um_message = update_manager_register_instance();
$ui_feedback['message'] .= $um_message['message'].'<br><br>';
if ($um_message['success']) {
config_update_value('instance_registered', 1);
$ui_feedback['status'] = true && $ui_feedback['status'];
} else {
$ui_feedback['status'] = false;
}
} else if (!$forced) {
config_update_value('identification_reminder_timestamp', $future_8_days);
}
if ($newsletter) {
// Pandora newsletter update
$email = get_parameter('email', '');
$um_message = update_manager_insert_newsletter($email);
$ui_feedback['message'] .= $um_message['message'];
if ($um_message['success']) {
db_process_sql_update('tusuario', ['middlename' => 1], ['id_user' => $config['id_user']]);
$ui_feedback['status'] = true && $ui_feedback['status'];
} else {
$ui_feedback['status'] = false;
}
} else if (!$forced) {
db_process_sql_update('tusuario', ['lastname' => $future_8_days], ['id_user' => $config['id_user']]);
}
// Form answer JSON
$ui_feedback['status'] = $ui_feedback['status'] ? 1 : 0;
echo io_json_mb_encode($ui_feedback);
}
if (!$not_return) {
return;
}
}
// Check if user is admin
if (!license_free()) {
return;
}
if (!users_is_admin($config['id_user'])) {
return;
}
// Get data to display properly the wizard
$wizard_data = [];
$wizard_data['newsletter_subscribed'] = db_get_value('middlename', 'tusuario', 'id_user', $config['id_user']);
// force_* = 1 -> force show
// force_* = 0 -> force hide
// force_* = -1 -> show or hide depends reminder and timestamp
$wizard_data['force_newsletter'] = get_parameter('force_newsletter', -1);
$wizard_data['newsletter_reminder'] = db_get_value('firstname', 'tusuario', 'id_user', $config['id_user']);
$wizard_data['newsletter_reminder_timestamp'] = db_get_value('lastname', 'tusuario', 'id_user', $config['id_user']);
$wizard_data['instance_registered'] = $config['instance_registered'];
$wizard_data['force_register'] = get_parameter('force_register', -1);
$wizard_data['identification_reminder'] = $config['identification_reminder'];
$wizard_data['identification_reminder_timestamp'] = $config['identification_reminder_timestamp'];
$display_newsletter = display_newsletter($wizard_data);
$display_register = display_register($wizard_data);
$display_forced = ($wizard_data['force_newsletter'] != -1) || ($wizard_data['force_register'] != -1);
// Return if it is fully completed
if ((!$display_register) && (!$display_newsletter)) {
return false;
}
$return_button = get_parameter('return_button', 0) == 1;
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
// Avoid to show default email
if ($email == 'admin@example.com') {
$email = '';
}
// Prints accept register license
echo '<div id="login_accept_register" title="'.__('The %s community wizard', get_product_name()).'" style="">';
echo '<div style="margin: 5px 0 10px; float: left; padding-left: 15px;">';
echo html_print_image('images/pandora_circle_big.png', true);
echo '</div>';
echo '<div style="font-size: 12pt; margin: 5px 20px; float: left; padding-top: 23px;">';
echo __('Stay up to date with the %s community', get_product_name()).'.';
echo '</div>';
echo '<div id="license_newsletter">';
echo '<p>'.__('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on the database owned by Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', get_product_name(), get_product_name(), get_product_name()).'</p>';
echo '<p>'.__('In the same fashion, when subscribed to the newsletter you accept that your email will pass on to a database property of Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the newsletter subscription options.', get_product_name()).'</p>';
echo '</div>';
echo '<div style="position:absolute; margin: 0 auto; bottom: 0px; padding-top:10px; position:relative; border: 1px solid #FFF;">';
echo '<div style="float: right;">';
html_print_submit_button(__('Finish'), 'finish_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
$display_status_return = $return_button ? 'block' : 'none';
echo '<div style="float: right; width: 20%; display: '.$display_status_return.';">';
html_print_submit_button(__('Return'), 'return_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"');
echo '</div>';
echo '<div style="float: left; margin-left: 0px; width: 50%; text-align: left;">';
html_print_checkbox('register', 1, false, false, false, 'cursor: \'pointer\'');
echo '&nbsp;<span style="font-size: 12px;" id="label-register">'.__('Join the %s community!', get_product_name()).'!</span><br>';
html_print_checkbox('newsletter', 1, false, false, false, 'cursor: \'pointer\'');
echo '&nbsp;<span style="font-size: 12px;" id="label-newsletter">'.__('Subscribe to our newsletter').'</span>';
echo '<br>';
echo '<div id="email_container">';
echo '&nbsp;<span id="label-email-newsletter"style="font-size: 12px; display: none">'.__('Email').': </span>';
html_print_input_text_extended('email-newsletter', $email, 'text-email-newsletter', '', 30, 255, false, '', ['style' => 'display:none; width: 200px;']);
echo '&nbsp;<span id="label-email-newsletter"style="font-size: 12px; display: none">'.__('Email').': </span>';
echo '&nbsp;<span id="required-email-newsletter">*'.__('Required').' </span>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
// Print yes or not dialog
echo '<div id="login_registration_yesno" title="'.__('%s instance identification wizard', get_product_name()).'" style="">';
echo '<div style="font-size: 12pt; margin: 20px;">';
echo __('Do you want to continue without any registration').'?';
echo '</div>';
echo '<div style="float: left; padding-left: 15px; padding-top: 20px;">';
html_print_submit_button(__('No'), 'no_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel" style="width:100px;"');
echo '</div>';
echo '<div style="float: right; padding-right: 15px; padding-top: 20px;">';
html_print_submit_button(__('Yes'), 'yes_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"');
echo '</div>';
echo '</div>';
// Print feedback user dialog
echo '<div id="ui_messages_feedback" style="">';
echo '<div style="float: left; margin: 15px; margin-left: 5px;">';
echo html_print_image('images/success_circle_big.png', true);
echo '</div>';
echo '<div id="feedback_message" style="font-size: 13pt; margin: 15px 20px; padding-left:80px;"></div>';
echo '</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
//Show newsletter and register checkboxes
var display_register = <?php echo json_encode($display_register); ?>;
var display_newsletter = <?php echo json_encode($display_newsletter); ?>;
var display_forced = <?php echo json_encode($display_forced); ?>;
var return_button = <?php echo json_encode($return_button); ?>;
////////////////////////////////////////////////////////////////////////
//HELPER FUNCTIONS
function submit_open_wizard (register, newsletter, email, forced) {
register = register;
newsletter = newsletter ? 1 : 0;
forced = forced ? 1 : 0;
var feedback_message = '';
var feedback_status = 1;
jQuery.post ("ajax.php",
{"page": "general/login_identification_wizard",
"open_wizard": 1,
"register_pandora": register,
"newsletter": newsletter,
"email": email,
"forced": forced},
function (data) {
var feedback_message = '';
var feedback_status = 1;
jQuery.each (data, function (i, val) {
if (i == 'message') feedback_message = val;
if (i == 'status') feedback_status = val;
});
if (feedback_status == 0) {
$("#ui_messages_feedback img").attr("src", "images/fail_circle_big.png");
} else {
$("#ui_messages_feedback img").attr("src", "images/success_circle_big.png");
}
$("#feedback_message").html(feedback_message);
},
"json"
);
}
////////////////////////////////////////////////////////////////////////
//EVENT FUNCTIONS
$("#submit-return_dialog_button").click (function () {
$("#login_accept_register" ).dialog('close');
$("#all-required").hide();
$("#login_id_dialog" ).dialog('open');
jQuery.post ("ajax.php",
{"page": "general/login_identification_wizard",
"reset_initial_wizard": 1},
function (data) {}
);
});
$("#submit-finish_dialog_button").click (function () {
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
var register = $("#checkbox-register").is(':checked');
var email = $("#text-email-newsletter").val();
if (email == '' && newsletter) {
$("#label-email-newsletter").show();
$("#text-email-newsletter").show();
$("#required-email-newsletter").show();
return;
}
if (!register && display_register && !display_forced) {
$("#login_registration_yesno").dialog('open');
} else {
var register_forced = register ? 1 : 0;
submit_open_wizard (register_forced, newsletter, email, display_forced);
$("#login_accept_register" ).dialog('close');
if (register || newsletter) {
$("#ui_messages_feedback").dialog('open');
}
}
});
$("#submit-no_registration").click (function () {
$("#login_registration_yesno").dialog('close');
});
$("#submit-yes_registration").click (function () {
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
var email = $("#text-email-newsletter").val();
submit_open_wizard (0, newsletter, email, display_forced);
$("#login_registration_yesno").dialog('close');
$("#login_accept_register" ).dialog('close');
});
$("#checkbox-newsletter").click (function () {
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
if (!return_button && newsletter) {
$("#label-email-newsletter").show();
$("#text-email-newsletter").show();
}
if (!newsletter) {
$("#label-email-newsletter").hide();
$("#text-email-newsletter").hide();
$("#required-email-newsletter").hide();
}
});
////////////////////////////////////////////////////////////////////////
//DISPLAY
$(document).ready (function () {
$("#login_accept_register").dialog({
resizable: false,
draggable: true,
modal: true,
height: 320,
width: 750
});
$("#login_registration_yesno").dialog({
resizable: false,
draggable: true,
modal: true,
width: 320,
overlay: {
opacity: 1,
background: "black"
},
autoOpen: false
});
$("#ui_messages_feedback").dialog({
resizable: false,
draggable: true,
modal: true,
width: 300,
overlay: {
opacity: 1,
background: "black"
},
autoOpen: false
});
//Display return button if required
if (return_button) {
$("#submit-return_dialog_button").show ();
}
// Remove the completed parts
if (!display_register) {
$("#checkbox-register").attr ('style', 'display: none !important');
$("#label-register").hide ();
}
if (!display_newsletter) {
$("#checkbox-newsletter").attr ('style', 'display: none !important');
$("#label-newsletter").hide ();
}
});
/* ]]> */
</script>
<style type="text/css">
#required-email-newsletter{
font-size : 9px;
color: red;
margin-left: -2px;
margin-top: 3px;
position: absolute;
display: none;
}
#email_container{
margin-top: 3px;
width: 500px;
}
#license_newsletter {
height: 100px;
width: 100%;
overflow-y: scroll;
border: 1px solid #E4E4E4;
border-radius: 3px;
}
#license_newsletter p{
padding: 0 3px;
}
.ui-widget-overlay {
background: #000;
opacity: .6;
}
.ui-draggable {
cursor: inherit;
}
</style>

View File

@ -1,273 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
/**
* @package General
*/
global $config;
if (is_ajax()) {
$save_identification = get_parameter('save_required_wizard', 0);
$change_language = get_parameter('change_language', 0);
$cancel_wizard = get_parameter('cancel_wizard', 0);
// Updates the values get on the identification wizard
if ($save_identification) {
$email = get_parameter('email', false);
$timezone = get_parameter('timezone', false);
$language = get_parameter('language', false);
if ($email !== false) {
config_update_value('language', $language);
}
if ($timezone !== false) {
config_update_value('timezone', $timezone);
}
if ($email !== false) {
db_process_sql_update(
'tusuario',
['email' => $email],
['id_user' => $config['id_user']]
);
}
// Update the alert action Mail to XXX/Administrator if it is set to default
$mail_check = 'yourmail@domain.es';
$mail_alert = alerts_get_alert_action_field1(1);
if ($mail_check === $mail_alert && $email !== false) {
alerts_update_alert_action(
1,
[
'field1' => $email,
'field1_recovery' => $email,
]
);
}
config_update_value('initial_wizard', 1);
}
// Change the language if is change in checkbox
if ($change_language !== 0) {
config_update_value('language', $change_language);
}
if ($cancel_wizard !== 0) {
config_update_value('initial_wizard', 1);
}
return;
}
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
// Avoid to show default email
if ($email == 'admin@example.com') {
$email = '';
}
// Prints first step pandora registration
echo '<div id="login_id_dialog" title="'.__('%s instance identification wizard', get_product_name()).'" style="display: none;">';
echo '<div style="font-size: 10pt; margin: 20px;">';
echo __('Please fill the following information in order to configure your %s instance successfully', get_product_name()).'.';
echo '</div>';
echo '<div style="">';
$table = new StdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->size = [];
$table->size[0] = '40%';
$table->style[0] = 'font-weight:bold';
$table->size[1] = '60%';
$table->border = '5px solid';
$table->data[0][0] = __('Language code');
$table->data[0][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage',
'language',
$config['language'],
'',
'',
'',
true
);
$zone_name = [
'Africa' => __('Africa'),
'America' => __('America'),
'Antarctica' => __('Antarctica'),
'Arctic' => __('Arctic'),
'Asia' => __('Asia'),
'Atlantic' => __('Atlantic'),
'Australia' => __('Australia'),
'Europe' => __('Europe'),
'Indian' => __('Indian'),
'Pacific' => __('Pacific'),
'UTC' => __('UTC'),
];
if ($zone_selected == '') {
if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0];
} else {
$zone_selected = 'Europe';
}
}
$timezones = timezone_identifiers_list();
foreach ($timezones as $timezone) {
if (strpos($timezone, $zone_selected) !== false) {
$timezone_country = preg_replace('/^.*\//', '', $timezone);
$timezone_n[$timezone] = $timezone_country;
}
}
$table->data[2][0] = __('Timezone setup').' '.ui_print_help_tip(
__('Must have the same time zone as the system or database to avoid mismatches of time.'),
true
);
$table->data[2][1] = html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone()', '', '', true);
$table->data[2][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$table->data[4][0] = __('E-mail for receiving alerts');
$table->data[4][1] = html_print_input_text('email', $email, '', 50, 255, true);
html_print_table($table);
echo '</div>';
echo '<div style="position:absolute; margin: 0 auto; bottom: 0px; right: 10px; border: 1px solid #FFF; width: 570px">';
echo '<div style="float: right; width: 20%;">';
html_print_submit_button(__('Register'), 'id_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
echo '<div style="float: right; width: 20%;">';
html_print_button(__('Cancel'), 'cancel', false, '', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
echo '<div id="all-required" style="float: right; margin-right: 30px; display: none; color: red;">';
echo __('All fields required');
echo '</div>';
echo '</div>';
echo '</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
var default_language_displayed;
////////////////////////////////////////////////////////////////////////
//HELPER FUNCTIONS
function show_timezone () {
zone = $("#zone").val();
$.ajax({
type: "POST",
url: "ajax.php",
data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone,
dataType: "json",
success: function(data) {
$("#timezone").empty();
jQuery.each (data, function (id, value) {
timezone = value;
var timezone_country = timezone.replace (/^.*\//g, "");
$("select[name='timezone']").append($("<option>").val(timezone).html(timezone_country));
});
}
});
}
////////////////////////////////////////////////////////////////////////
//EVENT FUNCTIONS
$("#submit-id_dialog_button").click (function () {
//All fields required
if ($("#text-email").val() == '') {
$("#all-required").show();
} else {
var timezone = $("#timezone").val();
var language = $("#language").val();
var email_identification = $("#text-email").val();
jQuery.post ("ajax.php",
{"page": "general/login_required",
"save_required_wizard": 1,
"email": email_identification,
"language": language,
"timezone": timezone},
function (data) {}
);
$("#login_id_dialog").dialog('close');
first_time_identification ();
}
});
$("#language").click(function () {
var change_language = $("#language").val();
if (change_language === default_language_displayed) return;
jQuery.post ("ajax.php",
{"page": "general/login_required",
"change_language": change_language},
function (data) {}
).done(function () {
location.reload();
});
});
////////////////////////////////////////////////////////////////////////
//DISPLAY
$(document).ready (function () {
$("#login_id_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
height: 280,
width: 630,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
default_language_displayed = $("#language").val();
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
$("#button-cancel").click (function () {
jQuery.post ("ajax.php",
{"page": "general/login_required",
"cancel_wizard": 1},
function (data) {}
);
$("#login_id_dialog" ).dialog('close');
});
});
/* ]]> */
</script>

View File

@ -0,0 +1,154 @@
<?php
/**
* Update Manager registration process client controller.
*
* @category Client controller
* @package Pandora FMS
* @subpackage Update manager
* @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.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/include/functions_update_manager.php';
if (is_ajax()) {
// Parse responses, flow control.
$configuration_wizard = get_parameter('save_required_wizard', 0);
$change_language = get_parameter('change_language', 0);
$cancel_wizard = get_parameter('cancel_wizard', 0);
// Console registration.
$cancel_registration = get_parameter('cancel_registration', 0);
$register_console = get_parameter('register_console', 0);
// Newsletter.
$cancel_newsletter = get_parameter('cancel_newsletter', 0);
$register_newsletter = get_parameter('register_newsletter', 0);
$feedback = [];
// Configuration wizard process.
if ($configuration_wizard) {
$feedback = config_wiz_process();
}
if ($change_language) {
// Change the language if is change in checkbox.
config_update_value('language', $change_language);
}
if ($cancel_wizard) {
config_update_value('initial_wizard', 1);
}
// Update Manager registration.
if ($cancel_registration) {
config_update_value('pandora_uid', 'OFFLINE');
}
if ($register_console) {
$feedback = registration_wiz_process();
}
// Newsletter.
if ($cancel_newsletter) {
db_process_sql_update(
'tusuario',
['middlename' => 0],
['id_user' => $config['id_user']]
);
// XXX: Also notify UpdateManager.
}
if ($register_newsletter) {
$feedback = newsletter_wiz_process();
}
if (is_array($feedback)) {
echo json_encode($feedback);
}
// Ajax calls finish here.
exit();
}
ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true
|| $config['initial_wizard'] != '1';
$newsletter = !db_get_value(
'middlename',
'tusuario',
'id_user',
$config['id_user']
);
$registration = isset($config['pandora_uid']) !== true
|| $config['pandora_uid'] == '';
if ($initial) {
// Show all forms in order.
// 1- Ask for email, timezone, etc. Fullfill alerts and user mail.
config_wiz_modal(
false,
true,
(($registration === true) ? 'show_registration_wizard()' : null)
);
}
if ($registration) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
// Launch only if not being launch from 'initial'.
!$initial,
(($newsletter === true) ? 'show_newsletter_wizard()' : null)
);
}
if ($newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
);
}
?>
<script type="text/javascript">
$(document).ready (function () {
});
</script>

View File

@ -208,7 +208,8 @@ if (!isset($config['inventory_changes_blacklist'])) {
if (!isset($config['url_update_manager'])) {
config_update_value(
'url_update_manager',
'https://licensing.artica.es/pandoraupdate7/server.php'
// 'https://licensing.artica.es/pandoraupdate7/server.php'
'https://172.17.0.3/server.php'
);
}

View File

@ -27,6 +27,894 @@
* ============================================================================
*/
/*
*
* Registration functions - Start.
*
*/
/**
* Parses responses from configuration wizard.
*
* @return void
*/
function config_wiz_process()
{
$email = get_parameter('email', false);
$timezone = get_parameter('timezone', false);
$language = get_parameter('language', false);
if ($email !== false) {
config_update_value('language', $language);
}
if ($timezone !== false) {
config_update_value('timezone', $timezone);
}
if ($email !== false) {
db_process_sql_update(
'tusuario',
['email' => $email],
['id_user' => $config['id_user']]
);
}
// Update the alert action Mail to XXX/Administrator
// if it is set to default.
$mail_check = 'yourmail@domain.es';
$mail_alert = alerts_get_alert_action_field1(1);
if ($mail_check === $mail_alert && $email !== false) {
alerts_update_alert_action(
1,
[
'field1' => $email,
'field1_recovery' => $email,
]
);
}
config_update_value('initial_wizard', 1);
}
/**
* Generates base code to print main configuration modal.
*
* Asks for timezone, mail.
*
* @param boolean $return Print output or not.
* @param boolean $launch Process JS modal.
* @param string $callback Call to JS function at end.
*
* @return string HTML.
*/
function config_wiz_modal(
$return=false,
$launch=true,
$callback=false
) {
global $config;
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
// Avoid to show default email.
if ($email == 'admin@example.com') {
$email = '';
}
$output = '';
// Prints first step pandora registration.
$output .= '<div id="configuration_wizard" title="'.__('%s configuration wizard', get_product_name()).'" style="display: none;">';
$output .= '<div style="font-size: 10pt; margin: 20px;">';
$output .= __('Please fill the following information in order to configure your %s instance successfully', get_product_name()).'.';
$output .= '</div>';
$output .= '<div style="">';
$table = new StdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->size = [];
$table->size[0] = '40%';
$table->style[0] = 'font-weight:bold';
$table->size[1] = '60%';
$table->border = '5px solid';
$table->data[0][0] = __('Language code');
$table->data[0][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage',
'language',
$config['language'],
'',
'',
'',
true
);
$zone_name = [
'Africa' => __('Africa'),
'America' => __('America'),
'Antarctica' => __('Antarctica'),
'Arctic' => __('Arctic'),
'Asia' => __('Asia'),
'Atlantic' => __('Atlantic'),
'Australia' => __('Australia'),
'Europe' => __('Europe'),
'Indian' => __('Indian'),
'Pacific' => __('Pacific'),
'UTC' => __('UTC'),
];
if ($zone_selected == '') {
if ($config['timezone'] != '') {
$zone_array = explode('/', $config['timezone']);
$zone_selected = $zone_array[0];
} else {
$zone_selected = 'Europe';
}
}
$timezones = timezone_identifiers_list();
foreach ($timezones as $timezone) {
if (strpos($timezone, $zone_selected) !== false) {
$timezone_country = preg_replace('/^.*\//', '', $timezone);
$timezone_n[$timezone] = $timezone_country;
}
}
$table->data[2][0] = __('Timezone setup').' '.ui_print_help_tip(
__('Must have the same time zone as the system or database to avoid mismatches of time.'),
true
);
$table->data[2][1] = html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone()', '', '', true);
$table->data[2][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$table->data[4][0] = __('E-mail for receiving alerts');
$table->data[4][1] = html_print_input_text('email', $email, '', 50, 255, true);
$output .= html_print_table($table, true);
$output .= '</div>';
$output .= '<div style="float: left">';
$output .= html_print_submit_button(
__('Cancel'),
'cancel',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel submit-cancel" style="width:100px;"',
true
);
$output .= '</div>';
$output .= '<div style="float: right">';
$output .= html_print_submit_button(
__('Continue'),
'register-next',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"',
true
);
$output .= '</div>';
$output .= '<div id="all-required" style="clear:both; float: right; margin-right: 30px; display: none; color: red;">';
$output .= __('All fields required');
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
// Verification modal.
$output .= '<div id="wiz_ensure_cancel" title="Confirmation Required" style="display: none;">';
$output .= '<div style="font-size: 12pt; margin: 20px;">';
$output .= __('Are you sure you don\'t want to configure a base email?');
$output .= '<p>';
$output .= __('You could change this options later in "alert actions" and setting your account.');
$output .= '</p>';
$output .= '</div>';
$output .= '</div>';
ob_start();
?>
<script type="text/javascript">
function show_timezone () {
zone = $("#zone").val();
$.ajax({
type: "POST",
url: "ajax.php",
data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone,
dataType: "json",
success: function(data) {
$("#timezone").empty();
jQuery.each (data, function (id, value) {
timezone = value;
var timezone_country = timezone.replace (/^.*\//g, "");
$("select[name='timezone']")
.append(
$("<option>")
.val(timezone)
.html(timezone_country)
);
});
}
});
}
$("#language").click(function () {
var change_language = $("#language").val();
if (change_language === default_language_displayed) return;
jQuery.post (
"ajax.php",
{
"page": "general/register",
"change_language": change_language
},
function (data) {}
).done(function () {
location.reload();
});
});
function show_configuration_wizard() {
$("#configuration_wizard").dialog({
resizable: true,
draggable: true,
modal: true,
width: 630,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
default_language_displayed = $("#language").val();
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
// CLICK EVENTS: Cancel and Registration
$("#submit-cancel").click (function (e) {
e.preventDefault();
$("#wiz_ensure_cancel").dialog({
buttons: [
{
"text": "No",
"class": 'submit-cancel',
"click" : function() {
$(this).dialog("close");
}
},
{
"text": "Yes",
"class": 'submit-next',
"click" : function() {
jQuery.post (
"ajax.php",
{
"page": "general/register",
"cancel_wizard": 1
},
function (data) {}
);
$(this).dialog("close");
$("#configuration_wizard" ).dialog('close');
}
}
]
});
$("#wiz_ensure_cancel").dialog('open');
});
$("#submit-register-next").click (function () {
// All fields are required.
if ($("#text-email").val() == '') {
$("#all-required").show();
} else {
var timezone = $("#timezone").val();
var language = $("#language").val();
var email_identification = $("#text-email").val();
jQuery.post (
"ajax.php",
{
"page": "general/register",
"save_required_wizard": 1,
"email": email_identification,
"language": language,
"timezone": timezone
},
function (data) {
<?php
if (isset($callback) && $callback != '') {
echo $callback;
}
?>
}
);
$("#configuration_wizard").dialog('close');
}
});
}
<?php
if ($launch === true) {
?>
$(document).ready (function () {
show_configuration_wizard();
});
<?php
}
?>
</script>
<?php
// Add js.
$output .= ob_get_clean();
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Parse registration wiz.
*
* @return array Status feedback.
*/
function registration_wiz_process()
{
global $config;
$register_pandora = get_parameter('register_pandora', 0);
$next_check = (time() + 1 * SECONDS_1DAY);
$ui_feedback = [
'status' => true,
'message' => '',
];
// Pandora register update.
$um_message = update_manager_register_instance();
$ui_feedback['message'] .= $um_message['message'].'<br><br>';
$ui_feedback['status'] = $um_message['success'] && $ui_feedback['status'];
if ($ui_feedback['status']) {
// Store next identification reminder.
config_update_value(
'identification_reminder_timestamp',
$next_check
);
}
return $ui_feedback;
}
/**
* Shows a modal to register current console in UpdateManager.
*
* @param boolean $return Return or show html.
* @param boolean $launch Execute wizard.
* @param string $callback Call function when done.
*
* @return string HTML code.
*/
function registration_wiz_modal(
$return=false,
$launch=true,
$callback=false
) {
global $config;
$output = '';
$product_name = get_product_name();
$output .= '<div id="registration_wizard" title="';
$output .= __('Register to Update Manager');
$output .= '" style="display: none;">';
$output .= '<div style="margin: 5px 0 10px; float: left; padding-left: 15px;">';
$output .= html_print_image('images/pandora_circle_big.png', true);
$output .= '</div>';
$output .= '<div style="font-size: 12pt; margin: 5px 20px; float: left; padding-top: 23px;">';
$output .= __(
'Keep this %s console up to date with latest updates.',
$product_name
);
$output .= '</div>';
$output .= '<div class="license_text" style="clear:both;">';
$output .= '<p>';
$output .= __('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on a database owned by %s. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', $product_name, $product_name, $product_name, $product_name);
$output .= '</p>';
$output .= '</div>';
$output .= '<div class="submit_buttons_container">';
$output .= '<div style="float: left;">';
$output .= html_print_submit_button(
__('Cancel'),
'cancel_registration',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="color: red; width:100px;"',
true
);
$output .= '</div>';
$output .= '<div style="float: right;">';
$output .= html_print_submit_button(
__('OK!'),
'register',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"',
true
);
$output .= '</div>';
$output .= '</div>';
$output .= '<div style="clear:both"></div>';
$output .= '<br/>';
$output .= '</div>';
// Verification modal.
$output .= '<div id="reg_ensure_cancel" title="Confirmation Required" style="display: none;">';
$output .= '<div style="font-size: 12pt; margin: 20px;">';
$output .= __('Are you sure you don\'t want to use update manager?');
$output .= '<p>';
$output .= __('You will need to update your system manually, through source code or RPM packages to be up to date with latest updates.');
$output .= '</p>';
$output .= '</div>';
$output .= '</div>';
// Results modal.
$output .= '<div id="reg_result" title="Registration process result" style="display: none;">';
$output .= '<div id="reg_result_content" style="font-size: 12pt; margin: 20px;">';
$output .= '</div>';
$output .= '</div>';
ob_start();
?>
<script type="text/javascript">
function show_registration_wizard() {
$("#registration_wizard").dialog({
resizable: true,
draggable: true,
modal: true,
width: 630,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
default_language_displayed = $("#language").val();
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
// CLICK EVENTS: Cancel and Registration
$("#submit-cancel_registration").click (function (e) {
e.preventDefault();
$("#reg_ensure_cancel").dialog({
buttons: [
{
"text": "No",
"class": 'submit-cancel',
"click" : function() {
$(this).dialog("close");
}
},
{
"text": "Yes",
"class": 'submit-next',
"click" : function() {
jQuery.post (
"ajax.php",
{
"page": "general/register",
"cancel_registration": 1
},
function (data) {}
);
$(this).dialog("close");
$("#registration_wizard" ).dialog('close');
}
}
]
});
$("#reg_ensure_cancel").dialog('open');
});
$("#submit-register").click (function () {
// All fields are required.
if ($("#text-email").val() == '') {
$("#all-required").show();
} else {
var timezone = $("#timezone").val();
var language = $("#language").val();
var email_identification = $("#text-email").val();
jQuery.post (
"ajax.php",
{
"page": "general/register",
"register_console": 1
},
function (data) {
cl = '';
msg = 'no response';
try {
json = JSON.parse(data);
cl = json.status
msg = json.message;
} catch (error) {
msg = 'Failed: ' + error;
cl = 'error';
}
if (!cl || cl == 'error') {
cl = 'error';
} else {
// Success.
}
$('#reg_result_content').html(msg);
$('#reg_result').addClass(cl);
$('#reg_result').dialog({
buttons: [
{
"text": "OK",
"class": "submit-next",
"click": function() {
$(this).dialog('close');
$("#registration_wizard").dialog('close');
<?php
if (isset($callback) && $callback != '') {
echo $callback;
}
?>
}
}
]
});
}
);
}
});
}
<?php
if ($launch === true) {
?>
$(document).ready (function () {
show_registration_wizard();
});
<?php
}
?>
</script>
<?php
// Add js.
$output .= ob_get_clean();
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Parse newsletter wiz.
*
* @return array Status feedback.
*/
function newsletter_wiz_process()
{
global $config;
$email = get_parameter('email', '');
// Pandora newsletter update.
$um_message = update_manager_insert_newsletter($email);
$ui_feedback['message'] = $um_message['message'];
if ($um_message['success']) {
// Success or already registered.
db_process_sql_update(
'tusuario',
['middlename' => 1],
['id_user' => $config['id_user']]
);
$ui_feedback['status'] = $um_message['success'];
} else {
$ui_feedback['status'] = false;
}
return $ui_feedback;
}
/**
* Show a modal allowing the user register into newsletter.
*
* @param boolean $return Print content o return it.
* @param boolean $launch Launch directly on load or not.
* @param string $callback Call function when done.
*
* @return string HTML code.
*/
function newsletter_wiz_modal(
$return=false,
$launch=true,
$callback=false
) {
global $config;
$output = '';
$product_name = get_product_name();
$email = db_get_value(
'email',
'tusuario',
'id_user',
$config['id_user']
);
// Avoid to show default email.
if ($email == 'admin@example.com') {
$email = '';
}
$output .= '<div id="newsletter_wizard" title="';
$output .= __('Wanna be up to date?');
$output .= '" style="display: none;">';
$output .= '<div style="margin: 5px 0 10px; float: left; padding-left: 15px;">';
$output .= html_print_image('images/pandora_circle_big.png', true);
$output .= '</div>';
$output .= '<div style="font-size: 12pt; margin: 5px 20px; float: left; padding-top: 23px;">';
$output .= __(
'Keep this %s up to date with latest updates.',
$product_name
);
$output .= '</div>';
$output .= '<div class="license_text" style="clear:both;">';
$output .= '<p>';
$output .= __('In the same fashion, when subscribed to the newsletter you accept that your email will pass on to a database property of %s. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the newsletter subscription options.', $product_name, $product_name);
$output .= '</p>';
$output .= '</div>';
// Show regiter to newsletter state.
$show_newsletter = ($display_newsletter !== true) ? 'inline-block' : 'none';
$output .= '<div style="margin-left: 4em;">';
$output .= '<div id="box_newsletter">';
$output .= '<span id="label-email-newsletter">'.__('Email').' </span>';
$output .= html_print_input_text_extended(
'email-newsletter',
$email,
'text-email-newsletter',
'',
30,
255,
false,
'',
['style' => 'display:'.$show_newsletter.'; width: 200px;'],
true
);
$output .= '</div><br /><br />';
$output .= '<div class="submit_buttons_container">';
$output .= '<div style="float: left;">';
$output .= html_print_submit_button(
__('Cancel'),
'cancel_newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="color: red; width:100px;"',
true
);
$output .= '</div>';
$output .= '<div style="float: right;">';
$output .= html_print_submit_button(
__('OK!'),
'newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"',
true
);
$output .= '</div>';
$output .= '</div>';
$output .= '<div style="clear:both"></div>';
$output .= '<br/>';
$output .= '</div>';
$output .= '</div>';
// Verification modal.
$output .= '<div id="news_ensure_cancel" title="Confirmation Required" style="display: none;">';
$output .= '<div style="font-size: 12pt; margin: 20px;">';
$output .= __('Are you sure you don\'t want to subscribe?');
$output .= '<p>';
$output .= __('You will miss all news about amazing features and fixes!');
$output .= '</p>';
$output .= '</div>';
$output .= '</div>';
// Results modal.
$output .= '<div id="news_result" title="Subscription process result" style="display: none;">';
$output .= '<div id="news_result_content" style="font-size: 12pt; margin: 20px;">';
$output .= '</div>';
$output .= '</div>';
ob_start();
?>
<script type="text/javascript">
function show_newsletter_wizard() {
$("#newsletter_wizard").dialog({
resizable: true,
draggable: true,
modal: true,
width: 630,
overlay: {
opacity: 0.5,
background: "black"
},
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
default_language_displayed = $("#language").val();
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
$(".ui-draggable").css("cursor", "inherit");
// CLICK EVENTS: Cancel and Registration
$("#submit-cancel_newsletter").click (function (e) {
e.preventDefault();
$("#news_ensure_cancel").dialog({
buttons: [
{
text: "No",
"class": 'submit-cancel',
click : function() {
$(this).dialog('close');
}
},
{
text: "Yes",
"class": 'submit-next',
click : function() {
jQuery.post ("ajax.php",
{
"page": "general/register",
"cancel_newsletter": 1
},
function (data) {}
);
$(this).dialog("close");
$("#newsletter_wizard" ).dialog('close');
}
}
]
});
$("#news_ensure_cancel").dialog('open');
});
$("#submit-newsletter").click (function () {
// All fields are required.
if ($("#text-email").val() == '') {
$("#all-required").show();
} else {
var timezone = $("#timezone").val();
var language = $("#language").val();
var email_identification = $("#text-email-newsletter").val();
jQuery.post (
"ajax.php",
{
"page": "general/register",
"register_newsletter": 1,
"email": email_identification
},
function (data) {
cl = '';
msg = 'no response';
try {
json = JSON.parse(data);
cl = json.status
msg = json.message;
} catch (error) {
msg = 'Failed: ' + error;
cl = 'error';
}
if (!cl || cl == 'error') {
cl = 'error';
} else {
// Success.
}
$('#news_result_content').html(msg);
$('#news_result').addClass(cl);
$('#news_result').dialog({
buttons: {
'Ok': function() {
$(this).dialog('close');
$("#newsletter_wizard").dialog('close');
<?php
if (isset($callback) && $callback != '') {
echo $callback;
}
?>
}
}
});
}
);
}
});
}
<?php
if ($launch === true) {
?>
$(document).ready (function () {
show_newsletter_wizard();
});
<?php
}
?>
</script>
<?php
$output .= ob_get_clean();
if (!$return) {
echo $output;
}
return $output;
}
/*
*
* Registration functions - End.
*
*/
function update_manager_get_config_values()
{
@ -210,7 +1098,6 @@ function update_manager_install_package_step2()
function update_manager_main()
{
global $config;
?>
<script type="text/javascript">
<?php
@ -500,6 +1387,13 @@ function update_manager_curl_request($action, $additional_params=false)
}
/**
* Subscribes an email account into newsletter.
*
* @param string $email E-mail.
*
* @return array With success [true/false], message [string].
*/
function update_manager_insert_newsletter($email)
{
global $config;
@ -511,6 +1405,11 @@ function update_manager_insert_newsletter($email)
$params = [
'email' => $email,
'language' => $config['language'],
'license' => db_get_value_filter(
'value',
'tupdate_settings',
['key' => 'customer_key']
),
];
$result = update_manager_curl_request('new_newsletter', $params);
@ -530,22 +1429,27 @@ function update_manager_insert_newsletter($email)
'success' => true,
'message' => __('E-mail successfully subscribed to newsletter.'),
];
}
} else {
return [
'success' => false,
'success' => true,
'message' => __('E-mail has already subscribed to newsletter.'),
];
}
default:
return [
'success' => false,
'message' => __('Update manager returns error code: ').$result['http_status'].'.',
];
break;
}
}
/**
* Registers this console into UpdateManager.
*
* @return array With success [true/false], message [string].
*/
function update_manager_register_instance()
{
global $config;
@ -555,6 +1459,11 @@ function update_manager_register_instance()
'language' => $config['language'],
'timezone' => $config['timezone'],
'email' => $email,
'license' => db_get_value_filter(
'value',
'tupdate_settings',
['key' => 'customer_key']
),
];
$result = update_manager_curl_request('new_register', $params);
@ -562,7 +1471,7 @@ function update_manager_register_instance()
if (!$result['success']) {
return [
'success' => false,
'message' => __('Remote server error on newsletter request'),
'message' => __('Error while registering console.').'<br/>'.$result['update_message'],
];
}
@ -584,19 +1493,18 @@ function update_manager_register_instance()
'success' => true,
'message' => __('Pandora successfully subscribed with UID: ').$puid.'.',
];
}
} else {
return [
'success' => false,
'message' => __('Unsuccessful subscription.'),
];
}
break;
default:
return [
'success' => false,
'message' => __('Update manager returns error code: ').$result['http_status'].'.',
];
break;
}
}

View File

@ -70,13 +70,13 @@
float: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: 0.5em 1em 0.5em 0 !important;
cursor: pointer !important;
background: white !important;
background-color: white !important;
border: 1px solid #82b92e !important;
height: 30px !important;
width: 90px !important;
margin: 0.5em 1em 0.5em 0;
cursor: pointer;
background: white;
background-color: white;
border: 1px solid #82b92e;
height: 30px;
width: 90px;
}
.ui-widget-header .ui-icon {
background-image: url(../images/ui-icons_444444_256x240.png) !important;

View File

@ -0,0 +1,56 @@
input[type="submit"].submit-cancel,
button.submit-cancel {
color: #fb4444 !important;
border: 1px solid #fb4444 !important;
background: #fff !important;
padding: 5px;
font-size: 1.3em;
margin: 0.5em 1em 0.5em 0 !important;
cursor: pointer !important;
text-align: center !important;
height: 30px !important;
width: 90px !important;
}
input[type="submit"].submit-cancel:hover,
button.submit-cancel:hover {
color: #fff !important;
background: #fb4444 !important;
}
input[type="submit"].submit-next,
button.submit-next {
color: #82b92e !important;
border: 1px solid #82b92e !important;
background: #fff !important;
padding: 5px;
font-size: 1.3em;
margin: 0.5em 1em 0.5em 0 !important;
cursor: pointer !important;
text-align: center !important;
height: 30px !important;
width: 90px !important;
}
input[type="submit"].submit-next:hover,
button.submit-next:hover {
color: #fff !important;
background: #82b92e !important;
}
div.submit_buttons_container {
position: absolute;
margin: 10px auto 0px;
bottom: 0px;
width: 90%;
position: relative;
clear: both;
height: 4em;
}
.license_text {
width: 95%;
overflow-y: auto;
text-align: justify;
margin: 1em auto;
}

View File

@ -986,31 +986,9 @@ if ($old_global_counter_chat != $now_global_counter_chat) {
}
}
// Pop-ups display order:
// 1) login_required (timezone and email)
// 2) identification (newsletter and register)
// 3) last_message (update manager message popup
// 4) login_help (online help, enterpirse version, forums, documentation)
if (is_user_admin($config['id_user'])
&& (!isset($config['initial_wizard']) || $config['initial_wizard'] != 1)
) {
include_once 'general/login_required.php';
}
require_once 'general/register.php';
if (get_parameter('login', 0) !== 0) {
// Display news dialog
include_once 'general/news_dialog.php';
// Display login help info dialog
// If it's configured to not skip this
$display_previous_popup = false;
if (license_free() && is_user_admin($config['id_user']) && $config['initial_wizard'] == 1) {
$display_previous_popup = include_once 'general/login_identification_wizard.php';
if ($display_previous_popup === false) {
$display_previous_popup = include_once 'general/last_message.php';
}
}
if ((!isset($config['skip_login_help_dialog']) || $config['skip_login_help_dialog'] == 0)
&& $display_previous_popup === false
&& $config['initial_wizard'] == 1