mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
UMC ImSureWhatImDoingWhenInstallingOfflinePatchesBecouseImGoingToIgnoreYourMessages
This commit is contained in:
parent
d65eaed8ba
commit
6434095be5
@ -289,11 +289,16 @@ if (is_array($config) === true
|
||||
&& (bool) $config['history_db_enabled'] === true
|
||||
) {
|
||||
ob_start();
|
||||
$password = $config['history_db_pass'];
|
||||
if (function_exists('io_output_password') === true) {
|
||||
$password = io_output_password($config['history_db_pass']);
|
||||
}
|
||||
|
||||
$dbhHistory = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$password,
|
||||
$config['history_db_port']
|
||||
);
|
||||
ob_get_clean();
|
||||
@ -312,6 +317,11 @@ $insecure = false;
|
||||
$pandora_url = ui_get_full_url('godmode/um_client', false, false, false);
|
||||
|
||||
if (is_array($config) === true) {
|
||||
$allowOfflinePatches = false;
|
||||
if (isset($config['allow_offline_patches']) === true) {
|
||||
$allowOfflinePatches = (bool) $config['allow_offline_patches'];
|
||||
}
|
||||
|
||||
if (isset($config['secure_update_manager']) === false) {
|
||||
$config['secure_update_manager'] = null;
|
||||
}
|
||||
@ -425,6 +435,7 @@ $ui = new Manager(
|
||||
'remote_config' => $remote_config,
|
||||
'propagate_updates' => $is_metaconsole,
|
||||
'proxy' => $proxy,
|
||||
'allowOfflinePatches' => $allowOfflinePatches,
|
||||
'set_maintenance_mode' => function () {
|
||||
if (function_exists('config_update_value') === true) {
|
||||
config_update_value('maintenance_mode', 1);
|
||||
|
@ -84,6 +84,13 @@ class Manager
|
||||
*/
|
||||
private $authCode;
|
||||
|
||||
/**
|
||||
* Allow install offline packages not following current version.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $allowOfflinePatches = false;
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@ -144,6 +151,10 @@ class Manager
|
||||
$settings['offline'] = true;
|
||||
}
|
||||
|
||||
if (isset($settings['allowOfflinePatches']) === true) {
|
||||
$this->allowOfflinePatches = (bool) $settings['allowOfflinePatches'];
|
||||
}
|
||||
|
||||
$this->umc = new Client($settings);
|
||||
}
|
||||
|
||||
@ -228,18 +239,19 @@ class Manager
|
||||
View::render(
|
||||
'offline',
|
||||
[
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
'version' => $this->umc->getVersion(),
|
||||
'mr' => $this->umc->getMR(),
|
||||
'error' => $this->umc->getLastError(),
|
||||
'asset' => function ($rp) {
|
||||
echo $this->getUrl($rp);
|
||||
},
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'progress' => $this->umc->getUpdateProgress(),
|
||||
'running' => $this->umc->isRunning(),
|
||||
'insecure' => $this->umc->isInsecure(),
|
||||
'authCode' => $this->authCode,
|
||||
'ajax' => $this->ajaxUrl,
|
||||
'ajaxPage' => $this->ajaxPage,
|
||||
'progress' => $this->umc->getUpdateProgress(),
|
||||
'running' => $this->umc->isRunning(),
|
||||
'insecure' => $this->umc->isInsecure(),
|
||||
'allowOfflinePatches' => $this->allowOfflinePatches,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* exported form_upload */
|
||||
/* global $,ajax,cleanExit,preventExit,umConfirm,umErrorMsg */
|
||||
/* global texts,ajaxPage,insecureMode */
|
||||
/* global ImSureWhatImDoing */
|
||||
|
||||
/**
|
||||
*
|
||||
@ -222,6 +223,26 @@ function form_upload(url, auth, current_package) {
|
||||
}
|
||||
});
|
||||
} else if (Math.round(parseFloat(number_update)) != target_version) {
|
||||
if (ImSureWhatImDoing == undefined || ImSureWhatImDoing == false) {
|
||||
umConfirm({
|
||||
message:
|
||||
'<span class="warning"></span><p>' +
|
||||
(server_update
|
||||
? texts.notGoingToInstallUnoficialServerWarning
|
||||
: texts.notGoingToInstallUnoficialWarning) +
|
||||
"</p>",
|
||||
title: texts.warning,
|
||||
size: 535,
|
||||
onAccept: function() {
|
||||
location.reload();
|
||||
},
|
||||
onDeny: function() {
|
||||
cancelUpdate();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
umConfirm({
|
||||
message:
|
||||
'<span class="warning"></span><p>' +
|
||||
|
@ -83,7 +83,9 @@
|
||||
'fileList': "<?php echo __('Files included in this package'); ?>",
|
||||
'ignoresign': "<?php echo __('Ignore'); ?>",
|
||||
'verifysigntitle': "<?php echo __('Verify package signature'); ?>",
|
||||
'verifysigns': "<?php echo __('Copy into the textarea the signature validation token you can retrieve from %s and press OK to verify the package, press ignore to avoid signature verification', 'https://support.pandorafms.com'); ?>"
|
||||
'verifysigns': "<?php echo __('Copy into the textarea the signature validation token you can retrieve from %s and press OK to verify the package, press ignore to avoid signature verification', 'https://support.pandorafms.com'); ?>",
|
||||
'notGoingToInstallUnoficialServerWarning': "<?php echo __('This update does not correspond with next version of %s and is not going to be installed unless patches are allowed. Please enable patches in settings.', get_product_name()); ?>",
|
||||
'notGoingToInstallUnoficialWarning': "<?php echo __('This server update does not correspond with current console version and is not going to be installed unless patches are allowed. Please enable patches in settings.'); ?>",
|
||||
}
|
||||
|
||||
var insecureMode = <?php echo ($insecure === true) ? 'true' : 'false'; ?>;
|
||||
@ -96,4 +98,6 @@
|
||||
);
|
||||
}
|
||||
|
||||
var ImSureWhatImDoing = <?php echo (false === $allowOfflinePatches) ? 'false' : 'true'; ?>;
|
||||
|
||||
</script>
|
||||
|
@ -93,6 +93,10 @@ if (!$action_update_url_update_manager) {
|
||||
'update_manager_proxy_password',
|
||||
$config['update_manager_proxy_password']
|
||||
);
|
||||
$allow_offline_patches = get_parameter_switch(
|
||||
'allow_offline_patches',
|
||||
$config['allow_offline_patches']
|
||||
);
|
||||
|
||||
if ($action_update_url_update_manager) {
|
||||
$result = config_update_value(
|
||||
@ -134,6 +138,13 @@ if (!$action_update_url_update_manager) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$result = config_update_value(
|
||||
'allow_offline_patches',
|
||||
$allow_offline_patches
|
||||
);
|
||||
}
|
||||
|
||||
if ($result && license_free()) {
|
||||
$result = config_update_value(
|
||||
'identification_reminder',
|
||||
@ -154,6 +165,7 @@ if (!$action_update_url_update_manager) {
|
||||
$update_manager_proxy_port = get_parameter('update_manager_proxy_port', '');
|
||||
$update_manager_proxy_user = get_parameter('update_manager_proxy_user', '');
|
||||
$update_manager_proxy_password = get_parameter('update_manager_proxy_password', '');
|
||||
$allow_offline_patches = get_parameter_switch('allow_offline_patches', false);
|
||||
|
||||
|
||||
if ($action_update_url_update_manager) {
|
||||
@ -196,6 +208,13 @@ if (!$action_update_url_update_manager) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$result = config_update_value(
|
||||
'allow_offline_patches',
|
||||
$allow_offline_patches
|
||||
);
|
||||
}
|
||||
|
||||
if ($result && license_free()) {
|
||||
$result = config_update_value('identification_reminder', $identification_reminder);
|
||||
}
|
||||
@ -288,33 +307,39 @@ $table->data[5][1] = html_print_input_password(
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[6][0] = __('Allow offline patches:');
|
||||
$table->data[6][1] = html_print_switch(
|
||||
[
|
||||
'name' => 'allow_offline_patches',
|
||||
'value' => $allow_offline_patches,
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$table->data[6][0] = __('Registration ID:');
|
||||
$table->data[6][1] = '<i>'.$config['pandora_uid'].'</i>';
|
||||
$table->data[7][0] = __('Registration ID:');
|
||||
$table->data[7][1] = '<i>'.$config['pandora_uid'].'</i>';
|
||||
|
||||
if (update_manager_verify_registration() === true && users_is_admin()) {
|
||||
$table->data[7][0] = __('Cancel registration:');
|
||||
$table->data[7][1] = '<a href="';
|
||||
$table->data[8][0] = __('Cancel registration:');
|
||||
$table->data[8][1] = '<a href="';
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$table->data[7][1] .= ui_get_full_url(
|
||||
$table->data[8][1] .= ui_get_full_url(
|
||||
'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1'
|
||||
);
|
||||
} else {
|
||||
$table->data[7][1] .= ui_get_full_url(
|
||||
$table->data[8][1] .= ui_get_full_url(
|
||||
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1'
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[7][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
|
||||
$table->data[8][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (license_free()) {
|
||||
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
|
||||
$table->data[8][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[8][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[8][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
$table->data[9][0] = __('Pandora FMS community reminder').ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this Pandora instance'), true);
|
||||
$table->data[9][1] = __('Yes').' '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).' ';
|
||||
$table->data[9][1] .= __('No').' '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true);
|
||||
}
|
||||
|
||||
html_print_input_hidden('action_update_url_update_manager', 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user