2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
<?php
|
2022-06-10 12:57:25 +02:00
|
|
|
/**
|
|
|
|
* Update manager.
|
|
|
|
*
|
|
|
|
* @category Update Manager
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Community
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
* Copyright (c) 2005-2022 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
|
2022-06-10 12:57:25 +02:00
|
|
|
// Begin.
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
global $config;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2022-06-10 12:57:25 +02:00
|
|
|
// The ajax is in include/ajax/update_manager.php.
|
2019-01-30 16:18:44 +01:00
|
|
|
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
2022-02-01 13:39:18 +01:00
|
|
|
db_pandora_audit(
|
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
|
|
|
'Trying to access Setup Management'
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
include 'general/noaccess.php';
|
|
|
|
return;
|
2016-04-13 13:51:01 +02:00
|
|
|
}
|
|
|
|
|
2022-03-28 12:20:36 +02:00
|
|
|
require_once $config['homedir'].'/vendor/autoload.php';
|
2021-06-14 13:56:42 +02:00
|
|
|
|
2018-11-14 18:15:48 +01:00
|
|
|
$php_version = phpversion();
|
|
|
|
$php_version_array = explode('.', $php_version);
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($php_version_array[0] < 7) {
|
2022-11-22 16:31:09 +01:00
|
|
|
include_once 'general/php_message.php';
|
2018-11-14 18:15:48 +01:00
|
|
|
}
|
|
|
|
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
$tab = get_parameter('tab', 'online');
|
|
|
|
|
2019-08-08 09:23:23 +02:00
|
|
|
$buttons['setup'] = [
|
2022-06-10 12:57:25 +02:00
|
|
|
'active' => ($tab === 'setup') ? true : false,
|
2022-03-30 14:41:47 +02:00
|
|
|
'text' => '<a href="'.ui_get_full_url(
|
|
|
|
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup'
|
2022-06-10 10:17:23 +02:00
|
|
|
).'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'</a>',
|
2022-03-30 14:41:47 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
$buttons['history'] = [
|
2022-06-10 12:57:25 +02:00
|
|
|
'active' => ($tab === 'history') ? true : false,
|
2022-03-30 14:41:47 +02:00
|
|
|
'text' => '<a href="'.ui_get_full_url(
|
|
|
|
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=histo'
|
|
|
|
).'ry">'.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'</a>',
|
2019-08-08 09:23:23 +02:00
|
|
|
];
|
|
|
|
|
2021-08-11 11:27:07 +02:00
|
|
|
$buttons['offline'] = [
|
2022-06-10 12:57:25 +02:00
|
|
|
'active' => ($tab === 'offline') ? true : false,
|
2022-03-30 14:41:47 +02:00
|
|
|
'text' => '<a href="'.ui_get_full_url(
|
|
|
|
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offli'
|
2022-06-10 10:17:23 +02:00
|
|
|
).'ne">'.html_print_image('images/box.png', true, ['title' => __('Offline update'), 'class' => 'invert_filter']).'</a>',
|
2021-08-11 11:27:07 +02:00
|
|
|
];
|
2019-08-08 09:23:23 +02:00
|
|
|
|
|
|
|
$buttons['online'] = [
|
2022-06-10 12:57:25 +02:00
|
|
|
'active' => ($tab === 'online') ? true : false,
|
2022-03-30 14:41:47 +02:00
|
|
|
'text' => '<a href="'.ui_get_full_url(
|
|
|
|
'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=onlin'
|
2022-06-10 10:17:23 +02:00
|
|
|
).'e">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update'), 'class' => 'invert_filter']).'</a>',
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
switch ($tab) {
|
2022-04-07 09:46:51 +02:00
|
|
|
case 'history':
|
2022-06-10 10:17:23 +02:00
|
|
|
$title = __('Journal');
|
2022-04-07 09:46:51 +02:00
|
|
|
break;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'setup':
|
2022-06-10 10:17:23 +02:00
|
|
|
$title = __('Setup');
|
2019-01-30 16:18:44 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'offline':
|
2022-06-10 10:17:23 +02:00
|
|
|
$title = __('Offline');
|
2019-01-30 16:18:44 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'online':
|
2021-08-11 11:27:07 +02:00
|
|
|
default:
|
2022-06-10 10:17:23 +02:00
|
|
|
$title = __('Online');
|
2019-01-30 16:18:44 +01:00
|
|
|
break;
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
}
|
|
|
|
|
2022-06-10 10:17:23 +02:00
|
|
|
ui_print_standard_header(
|
2019-01-30 16:18:44 +01:00
|
|
|
$title,
|
|
|
|
'images/gm_setup.png',
|
|
|
|
false,
|
2020-05-29 11:37:06 +02:00
|
|
|
'',
|
2019-01-30 16:18:44 +01:00
|
|
|
true,
|
2022-06-10 10:17:23 +02:00
|
|
|
$buttons,
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'link' => '',
|
|
|
|
'label' => 'Warp Update',
|
|
|
|
],
|
|
|
|
]
|
2019-01-30 16:18:44 +01:00
|
|
|
);
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
|
|
|
|
switch ($tab) {
|
2022-03-30 14:41:47 +02:00
|
|
|
case 'history':
|
|
|
|
include $config['homedir'].'/godmode/update_manager/update_manager.history.php';
|
|
|
|
break;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
case 'setup':
|
|
|
|
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'offline':
|
2021-06-14 13:56:42 +02:00
|
|
|
$mode = \UpdateManager\UI\Manager::MODE_OFFLINE;
|
|
|
|
include $config['homedir'].'/godmode/um_client/index.php';
|
2019-01-30 16:18:44 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'online':
|
|
|
|
default:
|
2022-06-13 12:32:04 +02:00
|
|
|
if (is_metaconsole() === false && has_metaconsole() === true) {
|
|
|
|
$meta_puid = null;
|
|
|
|
|
|
|
|
$server_id = $config['metaconsole_node_id'];
|
|
|
|
$dbh = (object) $config['dbconnection'];
|
|
|
|
|
|
|
|
// Connect to metaconsole.
|
|
|
|
$result_code = metaconsole_load_external_db(
|
|
|
|
[
|
|
|
|
'dbhost' => $config['replication_dbhost'],
|
|
|
|
'dbuser' => $config['replication_dbuser'],
|
|
|
|
'dbpass' => io_output_password($config['replication_dbpass']),
|
|
|
|
'dbname' => $config['replication_dbname'],
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($result_code < 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$value = db_get_value('value', 'tconfig', 'token', 'pandora_uid');
|
|
|
|
|
|
|
|
$meta_puid = $value;
|
|
|
|
|
|
|
|
// Return connection to node.
|
|
|
|
metaconsole_restore_db();
|
|
|
|
|
|
|
|
if ($meta_puid === false || $meta_puid === null) {
|
|
|
|
ui_print_warning_message(__('Please register on metaconsole first.'));
|
|
|
|
break;
|
|
|
|
}
|
2022-04-21 18:09:26 +02:00
|
|
|
}
|
2022-06-13 12:32:04 +02:00
|
|
|
|
|
|
|
$mode = \UpdateManager\UI\Manager::MODE_ONLINE;
|
|
|
|
include $config['homedir'].'/godmode/um_client/index.php';
|
2019-01-30 16:18:44 +01:00
|
|
|
break;
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
}
|