mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch 'ent-1668-update-manager' into 'develop'
license forms sync MC-N See merge request artica/pandorafms!2441
This commit is contained in:
commit
dd8af874fa
@ -1,15 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
// Pandora FMS- http://pandorafms.com
|
/**
|
||||||
// ==================================================
|
* License form.
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* @category Form
|
||||||
// modify it under the terms of the GNU General Public License
|
* @package Pandora FMS
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @subpackage Enterprise
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @version 1.0.0
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* @license See below
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
// GNU General Public License for more details.
|
* ______ ___ _______ _______ ________
|
||||||
// Load global vars
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* 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.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// File begin.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
@ -22,22 +39,38 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||||||
|
|
||||||
$update_settings = (bool) get_parameter_post('update_settings');
|
$update_settings = (bool) get_parameter_post('update_settings');
|
||||||
|
|
||||||
ui_print_page_header(__('License management'), 'images/extensions.png', false, '', true);
|
if (is_metaconsole()) {
|
||||||
|
// Metaconsole.
|
||||||
|
ui_require_javascript_file_enterprise('load_enterprise', true);
|
||||||
|
enterprise_include_once('include/functions_license.php');
|
||||||
|
} else {
|
||||||
|
ui_print_page_header(
|
||||||
|
__('License management'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if ($update_settings) {
|
ui_require_javascript_file_enterprise('load_enterprise');
|
||||||
foreach ($_POST['keys'] as $key => $value) {
|
enterprise_include_once('include/functions_license.php');
|
||||||
db_process_sql_update(
|
}
|
||||||
'tupdate_settings',
|
|
||||||
[db_escape_key_identifier('value') => $value],
|
if ($update_settings) {
|
||||||
[db_escape_key_identifier('key') => $key]
|
if (!is_metaconsole()) {
|
||||||
);
|
// Node.
|
||||||
}
|
foreach ($_POST['keys'] as $key => $value) {
|
||||||
|
db_process_sql_update(
|
||||||
ui_print_success_message(__('License updated'));
|
'tupdate_settings',
|
||||||
|
[db_escape_key_identifier('value') => $value],
|
||||||
|
[db_escape_key_identifier('key') => $key]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_success_message(__('License updated'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_require_javascript_file_enterprise('load_enterprise');
|
|
||||||
enterprise_include_once('include/functions_license.php');
|
|
||||||
$license = enterprise_hook('license_get_info');
|
$license = enterprise_hook('license_get_info');
|
||||||
|
|
||||||
$rows = db_get_all_rows_in_table('tupdate_settings');
|
$rows = db_get_all_rows_in_table('tupdate_settings');
|
||||||
@ -55,11 +88,20 @@ if (enterprise_installed()) {
|
|||||||
echo '</script>';
|
echo '</script>';
|
||||||
|
|
||||||
echo '<form method="post">';
|
echo '<form method="post">';
|
||||||
|
// Retrieve UM url configured (or default).
|
||||||
|
$url = get_um_url();
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table->head[0] = __('Licence');
|
||||||
|
$table->head_colspan[0] = 3;
|
||||||
|
$table->headstyle[0] = 'text-align: center';
|
||||||
|
$table->style[0] = 'font-weight: bold;';
|
||||||
|
}
|
||||||
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
||||||
@ -98,13 +140,17 @@ if (enterprise_installed()) {
|
|||||||
html_print_input_hidden('update_settings', 1);
|
html_print_input_hidden('update_settings', 1);
|
||||||
html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"');
|
html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"');
|
||||||
echo ' ';
|
echo ' ';
|
||||||
html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub next"');
|
html_print_button(__('Request new license'), '', false, 'generate_request_code()', 'class="sub next"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (is_metaconsole()) {
|
||||||
echo '<link rel="stylesheet" href="'.ui_get_full_url(false, false, false, false).'include/styles/pandora.css" type="text/css">';
|
ui_require_css_file('pandora_enterprise', '../../'.ENTERPRISE_DIR.'/include/styles/');
|
||||||
echo '<link rel="stylesheet" href="'.ui_get_full_url(false, false, false, false).'enterprise/include/styles/pandora_enterprise.css" type="text/css">';
|
ui_require_css_file('register', '../../include/styles/');
|
||||||
|
} else {
|
||||||
|
ui_require_css_file('pandora');
|
||||||
|
ui_require_css_file('pandora_enterprise', ENTERPRISE_DIR.'/include/styles/');
|
||||||
|
ui_require_css_file('register');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
|
if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
|
||||||
@ -116,7 +162,7 @@ if (enterprise_hook('print_activate_licence_dialog') == ENTERPRISE_NOT_HOOK) {
|
|||||||
echo ''.__('To get your <b>%s Enterprise License</b>:', get_product_name()).'<br />';
|
echo ''.__('To get your <b>%s Enterprise License</b>:', get_product_name()).'<br />';
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
echo '<li>';
|
echo '<li>';
|
||||||
echo ''.sprintf(__('Go to %s'), '<a target="_blank" href="https://licensing.artica.es/pandoraupdate7/index.php?section=generate_key_client">https://licensing.artica.es/pandoraupdate7/index.php?section=generate_key_client</a>');
|
echo ''.sprintf(__('Go to %s'), '<a target="_blank" href="'.$url.'/index.php?section=generate_key_client">'.$url.'index.php?section=generate_key_client</a>');
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
echo '<li>';
|
echo '<li>';
|
||||||
echo ''.__('Enter the <b>auth key</b> and the following <b>request key</b>:');
|
echo ''.__('Enter the <b>auth key</b> and the following <b>request key</b>:');
|
||||||
|
@ -28,7 +28,7 @@ $action_update_url_update_manager = (bool) get_parameter(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!$action_update_url_update_manager) {
|
if (!$action_update_url_update_manager) {
|
||||||
$url_update_manager = get_parameter('url_update_manager', $config['url_update_manager']);
|
$url_update_manager = get_parameter('url_update_manager', get_um_url());
|
||||||
$update_manager_proxy_server = get_parameter('update_manager_proxy_server', $config['update_manager_proxy_server']);
|
$update_manager_proxy_server = get_parameter('update_manager_proxy_server', $config['update_manager_proxy_server']);
|
||||||
$update_manager_proxy_port = get_parameter('update_manager_proxy_port', $config['update_manager_proxy_port']);
|
$update_manager_proxy_port = get_parameter('update_manager_proxy_port', $config['update_manager_proxy_port']);
|
||||||
$update_manager_proxy_user = get_parameter('update_manager_proxy_user', $config['update_manager_proxy_user']);
|
$update_manager_proxy_user = get_parameter('update_manager_proxy_user', $config['update_manager_proxy_user']);
|
||||||
|
@ -2740,6 +2740,31 @@ function config_check()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves base url stored for Update Manager.
|
||||||
|
*
|
||||||
|
* @return string URL.
|
||||||
|
*/
|
||||||
|
function get_um_url()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (isset($config['url_update_manager'])) {
|
||||||
|
$url = $config['url_update_manager'];
|
||||||
|
$url = substr($url, 0, (strlen($url) - strpos(strrev($url), '/')));
|
||||||
|
} else {
|
||||||
|
$url = 'https://licensing.artica.es/pandoraupdate7/';
|
||||||
|
config_update_value(
|
||||||
|
'url_update_manager',
|
||||||
|
'https://licensing.artica.es/pandoraupdate7/server.php'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return in bytes
|
* Return in bytes
|
||||||
*
|
*
|
||||||
|
@ -1211,7 +1211,7 @@ function update_manager_check_online_free_packages_available()
|
|||||||
];
|
];
|
||||||
|
|
||||||
$curlObj = curl_init();
|
$curlObj = curl_init();
|
||||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
curl_setopt($curlObj, CURLOPT_URL, get_um_url());
|
||||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||||
@ -1285,7 +1285,7 @@ function update_manager_check_online_free_packages($is_ajax=true)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$curlObj = curl_init();
|
$curlObj = curl_init();
|
||||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
curl_setopt($curlObj, CURLOPT_URL, get_um_url());
|
||||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||||
@ -1436,7 +1436,7 @@ function update_manager_curl_request($action, $additional_params=false)
|
|||||||
$params['action'] = $action;
|
$params['action'] = $action;
|
||||||
|
|
||||||
$curlObj = curl_init();
|
$curlObj = curl_init();
|
||||||
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
|
curl_setopt($curlObj, CURLOPT_URL, get_um_url());
|
||||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($curlObj, CURLOPT_POST, true);
|
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user