mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2012-04-12 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, extensions/update_manager.php, extensions/update_manager/lib/functions.ajax.php, extensions/update_manager/lib/libupdate_manager_client.php, extensions/update_manager/lib/functions.php, extensions/update_manager/settings.php, extensions/update_manager/main.php, extensions/update_manager/update_pandora.php: added feature to update the Pandora Console open. Merged from the branch "pandora_4.0" git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5957 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5825003cd3
commit
d73b391e16
@ -1,3 +1,16 @@
|
|||||||
|
2012-04-12 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_config.php, extensions/update_manager.php,
|
||||||
|
extensions/update_manager/lib/functions.ajax.php,
|
||||||
|
extensions/update_manager/lib/libupdate_manager_client.php,
|
||||||
|
extensions/update_manager/lib/functions.php,
|
||||||
|
extensions/update_manager/settings.php,
|
||||||
|
extensions/update_manager/main.php,
|
||||||
|
extensions/update_manager/update_pandora.php: added feature to update the
|
||||||
|
Pandora Console open.
|
||||||
|
|
||||||
|
Merged from the branch "pandora_4.0"
|
||||||
|
|
||||||
2012-04-12 Ramon Novoa <rnovoa@artica.es>
|
2012-04-12 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* operation/servers/recon_view.php: Fixed a broken link.
|
* operation/servers/recon_view.php: Fixed a broken link.
|
||||||
|
@ -14,6 +14,30 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
if (is_ajax ()) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
check_login ();
|
||||||
|
|
||||||
|
if (! check_acl ($config["id_user"], 0, "PM")) {
|
||||||
|
db_pandora_audit("ACL Violation",
|
||||||
|
"Trying to access event viewer");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once('update_manager/lib/functions.ajax.php');
|
||||||
|
|
||||||
|
$checking_online_enterprise_package =
|
||||||
|
(bool)get_parameter('checking_online_enterprise_package', false);
|
||||||
|
|
||||||
|
if ($checking_online_enterprise_package) {
|
||||||
|
checking_online_enterprise_package();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function load_update_manager_lib () {
|
function load_update_manager_lib () {
|
||||||
set_time_limit (0);
|
set_time_limit (0);
|
||||||
require_once ('update_manager/load_updatemanager.php');
|
require_once ('update_manager/load_updatemanager.php');
|
||||||
@ -33,34 +57,6 @@ function update_settings_database_connection () {
|
|||||||
function pandora_update_manager_install () {
|
function pandora_update_manager_install () {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (isset ($config['update_manager_installed'])) {
|
|
||||||
$update_server_path = db_get_value('value', 'tupdate_settings', '`key`', 'update_server_path');
|
|
||||||
|
|
||||||
|
|
||||||
////OVERWRITE EVER THE UPDATE SERVER PATH.//////////////////////
|
|
||||||
/*
|
|
||||||
The server path is ever the value from PHP. And you wonder
|
|
||||||
"Why?". Yes, I wonder too. And it is for when the user update
|
|
||||||
the Pandora Console PHP files to new version, this conf param
|
|
||||||
"automagic" change to new path for the new updates in the new
|
|
||||||
version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($update_server_path != '/pandoraupdate4/server.php') {
|
|
||||||
$result = db_process_sql_update('tupdate_settings',
|
|
||||||
array('value' => '/pandoraupdate4/server.php'),
|
|
||||||
array('key' => 'update_server_path'));
|
|
||||||
|
|
||||||
if ($result === false) {
|
|
||||||
db_pandora_audit("ERROR update extension", "Error in the update the extension 'update manager' when update the 'update_server_path' field.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/* Already installed */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
load_update_manager_lib ();
|
load_update_manager_lib ();
|
||||||
|
|
||||||
/* SQL installation */
|
/* SQL installation */
|
||||||
@ -97,21 +93,24 @@ function pandora_update_manager_uninstall () {
|
|||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
db_process_sql ('DELETE FROM `tconfig` WHERE `token` = "update_manager_installed"');
|
db_process_sql ('DELETE FROM `tconfig`
|
||||||
|
WHERE `token` = "update_manager_installed"');
|
||||||
db_process_sql ('DROP TABLE `tupdate_settings`');
|
db_process_sql ('DROP TABLE `tupdate_settings`');
|
||||||
db_process_sql ('DROP TABLE `tupdate_journal`');
|
db_process_sql ('DROP TABLE `tupdate_journal`');
|
||||||
db_process_sql ('DROP TABLE `tupdate`');
|
db_process_sql ('DROP TABLE `tupdate`');
|
||||||
db_process_sql ('DROP TABLE `tupdate_package`');
|
db_process_sql ('DROP TABLE `tupdate_package`');
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
db_process_sql ('DELETE FROM "tconfig" WHERE "token" = \'update_manager_installed\'');
|
db_process_sql ('DELETE FROM "tconfig"
|
||||||
|
WHERE "token" = \'update_manager_installed\'');
|
||||||
db_process_sql ('DROP TABLE "tupdate_settings"');
|
db_process_sql ('DROP TABLE "tupdate_settings"');
|
||||||
db_process_sql ('DROP TABLE "tupdate_journal"');
|
db_process_sql ('DROP TABLE "tupdate_journal"');
|
||||||
db_process_sql ('DROP TABLE "tupdate"');
|
db_process_sql ('DROP TABLE "tupdate"');
|
||||||
db_process_sql ('DROP TABLE "tupdate_package"');
|
db_process_sql ('DROP TABLE "tupdate_package"');
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
db_process_sql ('DELETE FROM tconfig WHERE token = \'update_manager_installed\'');
|
db_process_sql ('DELETE FROM tconfig
|
||||||
|
WHERE token = \'update_manager_installed\'');
|
||||||
db_process_sql ('DROP TABLE tupdate_settings');
|
db_process_sql ('DROP TABLE tupdate_settings');
|
||||||
db_process_sql ('DROP TABLE tupdate_journal');
|
db_process_sql ('DROP TABLE tupdate_journal');
|
||||||
db_process_sql ('DROP TABLE tupdate');
|
db_process_sql ('DROP TABLE tupdate');
|
||||||
@ -132,39 +131,41 @@ function pandora_update_manager_main () {
|
|||||||
update_settings_database_connection ();
|
update_settings_database_connection ();
|
||||||
|
|
||||||
require_once ('update_manager/main.php');
|
require_once ('update_manager/main.php');
|
||||||
|
|
||||||
|
main_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
function pandora_update_manager_login () {
|
function pandora_update_manager_login () {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// If first time, make the first autoupdate and disable it in DB
|
|
||||||
if (!isset($config["autoupdate"])){
|
|
||||||
$config["autoupdate"] = 1;
|
|
||||||
|
|
||||||
db_process_sql_insert('tconfig', array('token' => 'autoupdate', 'value' => 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($config["autoupdate"] == 0)
|
if ($config["autoupdate"] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
load_update_manager_lib ();
|
unset($_SESSION['new_update']);
|
||||||
|
|
||||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
if (enterprise_installed()) {
|
||||||
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||||
$config['dbpass'], $config['dbname']);
|
$config['dbpass'], $config['dbname']);
|
||||||
$settings = um_db_load_settings ();
|
$settings = um_db_load_settings ();
|
||||||
|
|
||||||
$user_key = get_user_key ($settings);
|
$user_key = get_user_key ($settings);
|
||||||
|
|
||||||
$package = um_client_check_latest_update ($settings, $user_key);
|
$package = um_client_check_latest_update ($settings, $user_key);
|
||||||
|
|
||||||
if (is_object ($package)) {
|
if (is_object ($package)) {
|
||||||
echo '<div class="notify">';
|
if ($package->id != 'ERROR_NON_NUMERIC_FOUND')
|
||||||
echo '<img src="images/information.png" alt="info" /> ';
|
$_SESSION['new_update'] = 'new';
|
||||||
echo __('There\'s a new update for Pandora');
|
}
|
||||||
echo '. <a href="index.php?sec=extensions&sec2=extensions/update_manager">';
|
}
|
||||||
echo __('More info');
|
else {
|
||||||
echo '</a>';
|
require(
|
||||||
echo '</div>';
|
"extensions/update_manager/lib/functions.ajax.php");
|
||||||
|
|
||||||
|
$result = update_pandora_get_packages_online_ajax(false);
|
||||||
|
|
||||||
|
if ($result['correct']) {
|
||||||
|
$_SESSION['new_update'] = 'new';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,12 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
function update_pandora_get_packages_online_ajax() {
|
function update_pandora_get_packages_online_ajax($ajax = true) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
require_once($config["homedir"] .
|
||||||
|
"/extensions/update_manager/lib/functions.php");
|
||||||
|
|
||||||
global $conf_update_pandora;
|
global $conf_update_pandora;
|
||||||
if (empty($conf_update_pandora))
|
if (empty($conf_update_pandora))
|
||||||
$conf_update_pandora = update_pandora_get_conf();
|
$conf_update_pandora = update_pandora_get_conf();
|
||||||
@ -56,7 +60,14 @@ function update_pandora_get_packages_online_ajax() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$value = $result->value();
|
$value = $result->value();
|
||||||
$package = $value->scalarval();
|
list($k,$v) = $value->structeach();
|
||||||
|
if ($k == 'package') {
|
||||||
|
$package = $v->scalarval();
|
||||||
|
}
|
||||||
|
list($k,$v) = $value->structeach();
|
||||||
|
if ($k == 'timestamp') {
|
||||||
|
$timestamp = $v->scalarval();
|
||||||
|
}
|
||||||
|
|
||||||
$return['correct'] = 1;
|
$return['correct'] = 1;
|
||||||
if (empty($package)) {
|
if (empty($package)) {
|
||||||
@ -65,10 +76,15 @@ function update_pandora_get_packages_online_ajax() {
|
|||||||
|
|
||||||
$return['last'] = $last;
|
$return['last'] = $last;
|
||||||
$return['package'] = $package;
|
$return['package'] = $package;
|
||||||
|
$return['timestamp'] = date($config["date_format"], $timestamp);
|
||||||
|
$return['text_adv'] = html_print_image('images/world.png', true);
|
||||||
$return['end'] = 1;
|
$return['end'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
if ($ajax)
|
||||||
|
echo json_encode($return);
|
||||||
|
else
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_pandora_download_package() {
|
function update_pandora_download_package() {
|
||||||
@ -79,6 +95,10 @@ function update_pandora_download_package() {
|
|||||||
|
|
||||||
require_once ($config["homedir"] .
|
require_once ($config["homedir"] .
|
||||||
"/extensions/update_manager/lib/libupdate_manager_client.php");
|
"/extensions/update_manager/lib/libupdate_manager_client.php");
|
||||||
|
require_once ($config["homedir"] .
|
||||||
|
"/extensions/update_manager/lib/libupdate_manager.php");
|
||||||
|
require_once ($config["homedir"] .
|
||||||
|
"/extensions/update_manager/load_updatemanager.php");
|
||||||
|
|
||||||
$dir = $config['attachment_store'] . '/update_pandora/';
|
$dir = $config['attachment_store'] . '/update_pandora/';
|
||||||
|
|
||||||
@ -106,113 +126,158 @@ function update_pandora_download_package() {
|
|||||||
$return = array('correct' => 0);
|
$return = array('correct' => 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$conf_update_pandora['last_contact'] = time();
|
|
||||||
update_pandora_update_conf();
|
|
||||||
|
|
||||||
$value = $result->value();
|
$value = $result->value();
|
||||||
$package_url = $value->scalarval();
|
$package_url = $value->scalarval();
|
||||||
|
|
||||||
if (empty($package_url)) {
|
if ($conf_update_pandora['download_mode'] == 'wget') {
|
||||||
$info_json = json_encode(array('correct' => 0));
|
$command = "wget " .
|
||||||
|
$package_url . " -P " . $dir .
|
||||||
file_put_contents('/tmp/' . $package . '.info.txt', $info_json, LOCK_EX);
|
" -o /tmp/" . $package . ".info.txt";
|
||||||
|
|
||||||
$return = array('correct' => 0);
|
$return = array('correct' => 0);
|
||||||
|
|
||||||
|
exec($command);
|
||||||
|
unlink('/tmp/' . $package . '.info.txt');
|
||||||
|
|
||||||
|
$return['correct'] = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$targz = $package;
|
if (empty($package_url)) {
|
||||||
$url = $package_url;
|
$info_json = json_encode(array('correct' => 0));
|
||||||
|
|
||||||
$file = fopen($dir . $targz, "w");
|
file_put_contents('/tmp/' . $package . '.info.txt',
|
||||||
|
$info_json, LOCK_EX);
|
||||||
|
|
||||||
$mch = curl_multi_init();
|
$return = array('correct' => 0);
|
||||||
$c = curl_init();
|
|
||||||
|
|
||||||
curl_setopt($c, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
|
||||||
curl_setopt($c, CURLOPT_FILE, $file);
|
|
||||||
|
|
||||||
curl_multi_add_handle($mch ,$c);
|
|
||||||
$running = null;
|
|
||||||
do {
|
|
||||||
curl_multi_exec($mch ,$running);
|
|
||||||
$info = curl_getinfo ($c);
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data['correct'] = 1;
|
|
||||||
$data['filename'] = $targz;
|
|
||||||
$data['size'] = $info['download_content_length'];
|
|
||||||
$data['size_download'] = $info['size_download'];
|
|
||||||
$data['speed_download'] = $info['speed_download'];
|
|
||||||
|
|
||||||
$info_json = json_encode($data);
|
|
||||||
|
|
||||||
file_put_contents('/tmp/' . $package . '.info.txt', $info_json, LOCK_EX);
|
|
||||||
|
|
||||||
sleep(1);
|
|
||||||
}
|
}
|
||||||
while($running > 0);
|
else {
|
||||||
|
$targz = $package;
|
||||||
|
$url = $package_url;
|
||||||
|
|
||||||
$return = array('correct' => 1);
|
$file = fopen($dir . $targz, "w");
|
||||||
|
|
||||||
|
$mch = curl_multi_init();
|
||||||
|
$c = curl_init();
|
||||||
|
|
||||||
|
curl_setopt($c, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($c, CURLOPT_FILE, $file);
|
||||||
|
|
||||||
|
curl_multi_add_handle($mch ,$c);
|
||||||
|
$running = null;
|
||||||
|
do {
|
||||||
|
curl_multi_exec($mch ,$running);
|
||||||
|
if ($running == 0) {
|
||||||
|
fclose($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
$info = curl_getinfo ($c);
|
||||||
|
html_debug_print($info, true);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['correct'] = 1;
|
||||||
|
$data['filename'] = $targz;
|
||||||
|
$data['size'] = $info['download_content_length'];
|
||||||
|
$data['size_download'] = $info['size_download'];
|
||||||
|
$data['speed_download'] = $info['speed_download'];
|
||||||
|
$data['total_time'] = $info['total_time'];
|
||||||
|
|
||||||
|
$info_json = json_encode($data);
|
||||||
|
|
||||||
|
file_put_contents('/tmp/' . $package . '.info.txt',
|
||||||
|
$info_json, LOCK_EX);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
while($running > 0);
|
||||||
|
|
||||||
|
$return = array('correct' => 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($return['correct']) {
|
||||||
|
$conf_update_pandora['last_contact'] = time();
|
||||||
|
update_pandora_update_conf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$return['mode'] = $conf_update_pandora['download_mode'];
|
||||||
|
$return['filename'] = $package;
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_pandora_check_download_package() {
|
function update_pandora_check_download_package() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
global $conf_update_pandora;
|
||||||
|
if (empty($conf_update_pandora))
|
||||||
|
$conf_update_pandora = update_pandora_get_conf();
|
||||||
|
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
$package = get_parameter('package', '');
|
if ($conf_update_pandora['download_mode'] == 'wget') {
|
||||||
$return = array('correct' => 1,
|
$return = array('correct' => 1,
|
||||||
'info_download' => "<b>Size:</b> %s/%s bytes <b>Speed:</b> %s bytes/second",
|
'info_download' => __('In progress...') . html_print_image('images/spinner.gif', true),
|
||||||
'progres_bar' => progress_bar(0, 300, 20, '0%', 1, false, "#00ff00"),
|
'mode' => 'wget');
|
||||||
'progres_bar_text' => '0%',
|
|
||||||
'percent' => 0);
|
|
||||||
|
|
||||||
$info_json = @file_get_contents('/tmp/' . $package . '.info.txt');
|
|
||||||
|
|
||||||
$info = json_decode($info_json, true);
|
|
||||||
|
|
||||||
if ($info['correct'] == 0) {
|
|
||||||
$return['correct'] = 0;
|
|
||||||
unlink('/tmp/' . $package . '.info.txt');
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$percent = 0;
|
|
||||||
$size_download = 0;
|
|
||||||
$size = 0;
|
|
||||||
$speed_download = 0;
|
|
||||||
if ($info['size_download'] > 0) {
|
|
||||||
$percent = format_numeric(
|
|
||||||
($info['size_download'] / $info['size']) * 100, 2);
|
|
||||||
$return['percent'] = $percent;
|
|
||||||
$size_download = $info['size_download'];
|
|
||||||
$size = $info['size'];
|
|
||||||
$speed_download = $info['speed_download'];
|
|
||||||
|
|
||||||
$return['info_download'] = sprintf($return['info_download'],
|
$package = get_parameter('package', '');
|
||||||
format_for_graph($size_download, 2), format_for_graph($size, 2),
|
$return = array('correct' => 1,
|
||||||
format_for_graph($speed_download, 2));
|
'info_download' => "<b>" . __('Size') . ":</b> %s/%s " . __('bytes') . " " .
|
||||||
|
"<b>" . __('Speed') . ":</b> %s " . __('bytes/second') ."<br />" .
|
||||||
|
"<b>" . __('Time') . ":</b> %s",
|
||||||
|
'progres_bar' => progress_bar(0, 300, 20, '0%', 1, false, "#00ff00"),
|
||||||
|
'progres_bar_text' => '0%',
|
||||||
|
'percent' => 0,
|
||||||
|
'mode' => 'curl');
|
||||||
|
|
||||||
|
$info_json = @file_get_contents('/tmp/' . $package . '.info.txt');
|
||||||
|
|
||||||
|
$info = json_decode($info_json, true);
|
||||||
|
|
||||||
|
if ($info['correct'] == 0) {
|
||||||
|
$return['correct'] = 0;
|
||||||
|
unlink('/tmp/' . $package . '.info.txt');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['info_download'] = __('<b>Starting: </b> connect to server');
|
$percent = 0;
|
||||||
}
|
$size_download = 0;
|
||||||
|
$size = 0;
|
||||||
|
$speed_download = 0;
|
||||||
|
$total_time = 0;
|
||||||
|
if ($info['size_download'] > 0) {
|
||||||
|
$percent = format_numeric(
|
||||||
|
($info['size_download'] / $info['size']) * 100, 2);
|
||||||
|
$return['percent'] = $percent;
|
||||||
|
$size_download = $info['size_download'];
|
||||||
|
$size = $info['size'];
|
||||||
|
$speed_download = $info['speed_download'];
|
||||||
|
$total_time = $info['total_time'];
|
||||||
|
|
||||||
$img = progress_bar($percent, 300, 20, $percent . '%', 1, false, "#00ff00");
|
$return['info_download'] = sprintf($return['info_download'],
|
||||||
$return['progres_bar'] = $img;
|
format_for_graph($size_download, 2), format_for_graph($size, 2),
|
||||||
preg_match_all('/src=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
format_for_graph($speed_download, 2),
|
||||||
$return['progres_bar_src'] = $attr[1];
|
human_time_description_raw($total_time));
|
||||||
preg_match_all('/alt=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
}
|
||||||
$return['progres_bar_alt'] = $attr[1];
|
else {
|
||||||
preg_match_all('/title=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
$return['info_download'] = __('<b>Starting: </b> connect to server');
|
||||||
$return['progres_bar_title'] = $attr[1];
|
}
|
||||||
$return['filename'] = $info['filename'];
|
|
||||||
|
$img = progress_bar($percent, 300, 20, $percent . '%', 1, false, "#00ff00");
|
||||||
|
$return['progres_bar'] = $img;
|
||||||
|
preg_match_all('/src=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
||||||
|
$return['progres_bar_src'] = $attr[1];
|
||||||
|
preg_match_all('/alt=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
||||||
|
$return['progres_bar_alt'] = $attr[1];
|
||||||
|
preg_match_all('/title=[\'\"]([^\"^\']*)[\'\"]/i', $img, $attr);
|
||||||
|
$return['progres_bar_title'] = $attr[1];
|
||||||
|
$return['filename'] = $info['filename'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
@ -229,12 +294,16 @@ function update_pandora_install_package() {
|
|||||||
$package = get_parameter('package', '');
|
$package = get_parameter('package', '');
|
||||||
$filename = get_parameter('filename', '');
|
$filename = get_parameter('filename', '');
|
||||||
|
|
||||||
|
unlink("/tmp/$package.info.txt");
|
||||||
|
|
||||||
//Get total files
|
//Get total files
|
||||||
$command = 'tar tzvf ' . $dir . $filename . '| wc -l > /tmp/' . $package . '.info.txt';
|
//The grep command is because the fucking tar don't apply
|
||||||
|
//strip-components in mode "t"
|
||||||
|
$command = 'tar tzvf ' . $dir . $filename . ' | grep -v "pandora_console/$" | wc -l > /tmp/' . $package . '.info.txt';
|
||||||
exec($command, $output, $status);
|
exec($command, $output, $status);
|
||||||
html_debug_print($command, true);
|
html_debug_print($command, true);
|
||||||
|
|
||||||
$command = 'tar xzvf ' . $dir . $filename . ' -C ' . $config['homedir'] . ' 1>/tmp/' . $package . '.files.info.txt';
|
$command = 'tar xzvf ' . $dir . $filename . ' --strip-components=1 -C ' . $config['homedir'] . ' 1>/tmp/' . $package . '.files.info.txt';
|
||||||
html_debug_print($command, true);
|
html_debug_print($command, true);
|
||||||
|
|
||||||
//Maybe this line run for seconds or minutes
|
//Maybe this line run for seconds or minutes
|
||||||
@ -263,7 +332,7 @@ function update_pandora_check_install_package() {
|
|||||||
$files = @file('/tmp/' . $package . '.files.info.txt');
|
$files = @file('/tmp/' . $package . '.files.info.txt');
|
||||||
if (empty($files))
|
if (empty($files))
|
||||||
$files = array();
|
$files = array();
|
||||||
$total = (int)file_get_contents('/tmp/' . $package . '.info.txt');
|
$total = (int)@file_get_contents('/tmp/' . $package . '.info.txt');
|
||||||
|
|
||||||
$return = array('correct' => 1,
|
$return = array('correct' => 1,
|
||||||
'info' => "<div id='list_files_install'
|
'info' => "<div id='list_files_install'
|
||||||
@ -299,4 +368,70 @@ function update_pandora_check_install_package() {
|
|||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checking_online_enterprise_package() {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once ($config["homedir"] .
|
||||||
|
"/extensions/update_manager/lib/libupdate_manager_client.php");
|
||||||
|
require_once ($config["homedir"] .
|
||||||
|
"/extensions/update_manager/lib/libupdate_manager.php");
|
||||||
|
require_once ($config["homedir"] .
|
||||||
|
"/extensions/update_manager/load_updatemanager.php");
|
||||||
|
|
||||||
|
$return = array('correct' => 1, 'text' => '',
|
||||||
|
'enable_buttons' => false, 'details_text' => '',
|
||||||
|
'version_package_text' => '');
|
||||||
|
|
||||||
|
$settings = um_db_load_settings();
|
||||||
|
$user_key = get_user_key($settings);
|
||||||
|
|
||||||
|
//Disabled output error messages
|
||||||
|
$package = @um_client_check_latest_update ($settings, $user_key);
|
||||||
|
//Get error message
|
||||||
|
$error_message = '';
|
||||||
|
$error = error_get_last();
|
||||||
|
if (!empty($error)) {
|
||||||
|
$error_message = $error['message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($package === true) {
|
||||||
|
$return['text'] = ui_print_success_message(
|
||||||
|
array('message' => __('Your system is up-to-date'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
elseif ($package === false) {
|
||||||
|
$return['text'] = ui_print_error_message(
|
||||||
|
array('message' => __('Server authorization rejected'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
elseif ($package === 0) {
|
||||||
|
$return['text'] = ui_print_error_message(
|
||||||
|
array('message' => __('Server connection failed'),
|
||||||
|
'no_close' => true), '', true) . '<br />' .
|
||||||
|
$error_message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($package->id == 'ERROR_NON_NUMERIC_FOUND') {
|
||||||
|
$return['text'] = ui_print_error_message(
|
||||||
|
array('message' => __('Server unknow error'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$return['enable_buttons'] = true;
|
||||||
|
$return['version_package_text'] = '<strong>'.__('Id').'</strong>: ' .
|
||||||
|
$package->id .
|
||||||
|
' <strong>'.__('Timestamp').'</strong>: ' .
|
||||||
|
$package->timestamp;
|
||||||
|
|
||||||
|
$return['text'] = ui_print_success_message(
|
||||||
|
array('message' => __('There\'s a new update for Pandora FMS'),
|
||||||
|
'no_close' => true), '', true) .
|
||||||
|
$return['version_package_text'];
|
||||||
|
|
||||||
|
$return['details_text'] = html_entity_decode($package->description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -37,6 +37,8 @@ function update_pandora_get_conf() {
|
|||||||
$conf['last_installed'] = $row['value'];
|
$conf['last_installed'] = $row['value'];
|
||||||
$row = db_get_row('tconfig', 'token', 'update_pandora_conf_last_contact');
|
$row = db_get_row('tconfig', 'token', 'update_pandora_conf_last_contact');
|
||||||
$conf['last_contact'] = $row['value'];
|
$conf['last_contact'] = $row['value'];
|
||||||
|
$row = db_get_row('tconfig', 'token', 'update_pandora_conf_download_mode');
|
||||||
|
$conf['download_mode'] = $row['value'];
|
||||||
|
|
||||||
$conf['dir'] = $config['attachment_store'] . '/update_pandora/';
|
$conf['dir'] = $config['attachment_store'] . '/update_pandora/';
|
||||||
|
|
||||||
@ -52,7 +54,8 @@ function update_pandora_installation() {
|
|||||||
//The url of update manager.
|
//The url of update manager.
|
||||||
$conf_update_pandora = array('url' => 'http://192.168.70.213/pandora.tar.gz',
|
$conf_update_pandora = array('url' => 'http://192.168.70.213/pandora.tar.gz',
|
||||||
'last_installed' => '',
|
'last_installed' => '',
|
||||||
'last_contact' => '');
|
'last_contact' => '',
|
||||||
|
'download_mode' => 'curl');
|
||||||
|
|
||||||
$values = array('token' => 'update_pandora_conf_url',
|
$values = array('token' => 'update_pandora_conf_url',
|
||||||
'value' => $conf_update_pandora['url']);
|
'value' => $conf_update_pandora['url']);
|
||||||
@ -63,6 +66,9 @@ function update_pandora_installation() {
|
|||||||
$values = array('token' => 'update_pandora_conf_last_contact',
|
$values = array('token' => 'update_pandora_conf_last_contact',
|
||||||
'value' => $conf_update_pandora['last_contact']);
|
'value' => $conf_update_pandora['last_contact']);
|
||||||
$return = db_process_sql_insert('tconfig', $values);
|
$return = db_process_sql_insert('tconfig', $values);
|
||||||
|
$values = array('token' => 'update_pandora_conf_download_mode',
|
||||||
|
'value' => $conf_update_pandora['download_mode']);
|
||||||
|
$return = db_process_sql_insert('tconfig', $values);
|
||||||
|
|
||||||
ui_print_result_message($return, __('Succesful store conf data in DB.'),
|
ui_print_result_message($return, __('Succesful store conf data in DB.'),
|
||||||
__('Unsuccesful store conf data in DB.'));
|
__('Unsuccesful store conf data in DB.'));
|
||||||
@ -93,6 +99,9 @@ function update_pandora_update_conf() {
|
|||||||
$values = array('value' => $conf_update_pandora['last_contact']);
|
$values = array('value' => $conf_update_pandora['last_contact']);
|
||||||
$return = db_process_sql_update('tconfig', $values,
|
$return = db_process_sql_update('tconfig', $values,
|
||||||
array('token' => 'update_pandora_conf_last_contact'));
|
array('token' => 'update_pandora_conf_last_contact'));
|
||||||
|
$values = array('value' => $conf_update_pandora['download_mode']);
|
||||||
|
$return = db_process_sql_update('tconfig', $values,
|
||||||
|
array('token' => 'update_pandora_conf_download_mode'));
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
@ -113,16 +122,19 @@ function update_pandora_get_list_downloaded_packages($mode = 'operation') {
|
|||||||
$packages[] = $entry;
|
$packages[] = $entry;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$time_file = date($config["date_format"],
|
||||||
|
filemtime($conf_update_pandora['dir'] . $entry));
|
||||||
|
|
||||||
if ($conf_update_pandora['last_installed'] == $entry) {
|
if ($conf_update_pandora['last_installed'] == $entry) {
|
||||||
$packages[] = array('name' => $entry,
|
$packages[] = array('name' => $entry,
|
||||||
'current' => true);
|
'current' => true,
|
||||||
|
'time' => $time_file);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$packages[] = array('name' => $entry,
|
$packages[] = array('name' => $entry,
|
||||||
'current' => false);
|
'current' => false,
|
||||||
|
'time' => $time_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +205,9 @@ function update_pandora_print_javascript_admin() {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var disabled_download_package = false;
|
||||||
var last = 0;
|
var last = 0;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
ajax_get_online_package_list_admin();
|
ajax_get_online_package_list_admin();
|
||||||
|
|
||||||
@ -204,6 +218,13 @@ function update_pandora_print_javascript_admin() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function delete_package(package) {
|
||||||
|
url = window.location + "&delete_package=1"
|
||||||
|
+ '&package=' + package;
|
||||||
|
|
||||||
|
window.location.replace(url);
|
||||||
|
}
|
||||||
|
|
||||||
function ajax_start_install_package(package) {
|
function ajax_start_install_package(package) {
|
||||||
$(".package_name").html(package);
|
$(".package_name").html(package);
|
||||||
|
|
||||||
@ -223,6 +244,7 @@ function update_pandora_print_javascript_admin() {
|
|||||||
$("#dialog_download").show();
|
$("#dialog_download").show();
|
||||||
|
|
||||||
$("#title_downloading_update_pandora").hide();
|
$("#title_downloading_update_pandora").hide();
|
||||||
|
$("#title_downloaded_update_pandora").show();
|
||||||
$("#title_installing_update_pandora").show();
|
$("#title_installing_update_pandora").show();
|
||||||
|
|
||||||
install_package(package, package);
|
install_package(package, package);
|
||||||
@ -233,7 +255,7 @@ function update_pandora_print_javascript_admin() {
|
|||||||
|
|
||||||
$("#dialog_download").dialog({
|
$("#dialog_download").dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
draggable: false,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 400,
|
height: 400,
|
||||||
width: 600,
|
width: 600,
|
||||||
@ -257,6 +279,13 @@ function update_pandora_print_javascript_admin() {
|
|||||||
data: parameters,
|
data: parameters,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
if (data['correct'] == 1) {
|
||||||
|
if (data['mode'] == 'wget') {
|
||||||
|
disabled_download_package = true;
|
||||||
|
$("#progress_bar_img img").show();
|
||||||
|
install_package(package, data['filename']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -275,19 +304,29 @@ function update_pandora_print_javascript_admin() {
|
|||||||
data: parameters,
|
data: parameters,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
if (disabled_download_package)
|
||||||
|
return;
|
||||||
|
|
||||||
if (data['correct'] == 1) {
|
if (data['correct'] == 1) {
|
||||||
$("#info_text").show();
|
if (data['mode'] == 'wget') {
|
||||||
$("#info_text").html(data['info_download']);
|
$("#info_text").show();
|
||||||
|
$("#info_text").html(data['info_download']);
|
||||||
$("#progress_bar_img img").attr('src', data['progres_bar_src']);
|
$("#progress_bar_img img").hide();
|
||||||
$("#progress_bar_img img").attr('alt', data['progres_bar_alt']);
|
|
||||||
$("#progress_bar_img img").attr('title', data['progres_bar_title']);
|
|
||||||
|
|
||||||
if (data['percent'] < 100) {
|
|
||||||
check_download_package(package);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
install_package(package, data['filename']);
|
$("#info_text").show();
|
||||||
|
$("#info_text").html(data['info_download']);
|
||||||
|
|
||||||
|
$("#progress_bar_img img").attr('src', data['progres_bar_src']);
|
||||||
|
$("#progress_bar_img img").attr('alt', data['progres_bar_alt']);
|
||||||
|
$("#progress_bar_img img").attr('title', data['progres_bar_title']);
|
||||||
|
|
||||||
|
if (data['percent'] < 100) {
|
||||||
|
check_download_package(package);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
install_package(package, data['filename']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -320,6 +359,7 @@ function update_pandora_print_javascript_admin() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#title_downloading_update_pandora").hide();
|
$("#title_downloading_update_pandora").hide();
|
||||||
|
$("#title_downloaded_update_pandora").show();
|
||||||
$("#title_installing_update_pandora").show();
|
$("#title_installing_update_pandora").show();
|
||||||
|
|
||||||
check_install_package(package, filename);
|
check_install_package(package, filename);
|
||||||
@ -362,6 +402,11 @@ function update_pandora_print_javascript_admin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ajax_get_online_package_list_admin() {
|
function ajax_get_online_package_list_admin() {
|
||||||
|
var buttonUpdateTemplate = '<?php
|
||||||
|
html_print_button(__('Update'), 'update', false,
|
||||||
|
'ajax_start_download_package(\\\'pandoraFMS\\\');', 'class="sub upd"');
|
||||||
|
?>';
|
||||||
|
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
parameters['page'] = "<?php echo $extension_php_file;?>";
|
parameters['page'] = "<?php echo $extension_php_file;?>";
|
||||||
parameters['get_packages_online'] = 1;
|
parameters['get_packages_online'] = 1;
|
||||||
@ -374,16 +419,20 @@ function update_pandora_print_javascript_admin() {
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data['correct'] == 1) {
|
if (data['correct'] == 1) {
|
||||||
|
buttonUpdate = buttonUpdateTemplate.replace('pandoraFMS', data['package']);
|
||||||
|
|
||||||
$("tbody", "#online_packages").append(
|
$("tbody", "#online_packages").append(
|
||||||
'<tr class="package_' + data['package'] + '">' +
|
'<tr class="package_' + data['package'] + '">' +
|
||||||
'<td style=" text-align:left; width:80%;" class="name_package">' +
|
'<td style=" text-align:left; width:50%;" class="name_package">' +
|
||||||
|
'<?php echo '<b>' . __('There is a new version:') . '</b> '; ?>' +
|
||||||
data['package'] +
|
data['package'] +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
|
'<td style=" text-align:left; width:30%;" class="timestamp_package">' +
|
||||||
|
data['timestamp'] +
|
||||||
|
'</td>' +
|
||||||
'<td style=" text-align:center; width:50px;">' +
|
'<td style=" text-align:center; width:50px;">' +
|
||||||
'<a href="javascript: ajax_start_download_package(\'' + data['package'] + '\')">' +
|
buttonUpdate +
|
||||||
'<?php html_print_image('images/down.png', false,
|
' ' + data['text_adv'] +
|
||||||
array('alt' => __('Download and install'), 'title' => __('Download and install'))); ?>' +
|
|
||||||
'</a>' +
|
|
||||||
'</td>' +
|
'</td>' +
|
||||||
'</tr>');
|
'</tr>');
|
||||||
|
|
||||||
@ -398,6 +447,16 @@ function update_pandora_print_javascript_admin() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(".spinner_row", "#online_packages").remove();
|
$(".spinner_row", "#online_packages").remove();
|
||||||
|
row_html = '<tr class="package_' + data['package'] + '">' +
|
||||||
|
'<td style=" text-align:left; width:80%;" class="name_package">' +
|
||||||
|
data['package'] +
|
||||||
|
'</td>' +
|
||||||
|
'<td style=" text-align:center; width:50px;"></td>' +
|
||||||
|
'</tr>';
|
||||||
|
console.log(row_html);
|
||||||
|
$("tbody", "#online_packages").append(row_html); return;
|
||||||
|
$("tbody", "#online_packages").append(
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -405,4 +464,108 @@ function update_pandora_print_javascript_admin() {
|
|||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_offline_enterprise_package(&$settings, $user_key) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (isset($_FILES["fileloaded"]["error"])
|
||||||
|
&& !$_FILES["fileloaded"]["error"]) {
|
||||||
|
$extension = substr($_FILES["fileloaded"]["name"],
|
||||||
|
strlen($_FILES["fileloaded"]["name"])-4, 4);
|
||||||
|
|
||||||
|
if ($extension != '.oum') {
|
||||||
|
ui_print_error_message(__('Incorrect file extension'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tempDir = sys_get_temp_dir()."/tmp_oum/";
|
||||||
|
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
if ($zip->open($_FILES["fileloaded"]['tmp_name']) === TRUE) {
|
||||||
|
$zip->extractTo($tempDir);
|
||||||
|
$zip->close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$error = ui_print_error_message(__('Update cannot be opened'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$package = um_package_info_from_paths ($tempDir);
|
||||||
|
if ($package === false) {
|
||||||
|
ui_print_error_message(
|
||||||
|
__('Error, the file package is empty or corrupted.'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$settings = um_db_load_settings ();
|
||||||
|
|
||||||
|
if ($settings->current_update >= $package->id) {
|
||||||
|
ui_print_error_message(
|
||||||
|
__('Your system version is higher or equal than the loaded package'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$binary_paths = um_client_get_files ($tempDir."binary/");
|
||||||
|
|
||||||
|
foreach ($binary_paths as $key => $paths) {
|
||||||
|
foreach($paths as $index => $path) {
|
||||||
|
$tempDir_scaped = preg_replace('/\//', '\/', $tempDir."binary");
|
||||||
|
$binary_paths[$key][$index] = preg_replace('/^'.$tempDir_scaped.'/', ' ', $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$code_paths = um_client_get_files ($tempDir."code/");
|
||||||
|
|
||||||
|
foreach ($code_paths as $key => $paths) {
|
||||||
|
foreach($paths as $index => $path) {
|
||||||
|
$tempDir_scaped = preg_replace('/\//', '\/', $tempDir."code");
|
||||||
|
$code_paths[$key][$index] = preg_replace('/^'.$tempDir_scaped.'/', ' ', $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_paths = um_client_get_files ($tempDir);
|
||||||
|
foreach ($sql_paths as $key => $paths) {
|
||||||
|
foreach ($paths as $index => $path) {
|
||||||
|
if ($path != $tempDir || ($key == 'info_package' && $path == $tempDir)) {
|
||||||
|
unset($sql_paths[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$updates_binary = array();
|
||||||
|
$updates_code = array();
|
||||||
|
$updates_sql = array();
|
||||||
|
|
||||||
|
if (!empty($binary_paths)) {
|
||||||
|
$updates_binary = um_client_update_from_paths ($binary_paths, $tempDir, $package->id, 'binary');
|
||||||
|
}
|
||||||
|
if (!empty($code_paths)) {
|
||||||
|
$updates_code = um_client_update_from_paths ($code_paths, $tempDir, $package->id, 'code');
|
||||||
|
}
|
||||||
|
if (!empty($sql_paths)) {
|
||||||
|
$updates_sql = um_client_update_from_paths ($sql_paths, $tempDir, $package->id, 'sql');
|
||||||
|
}
|
||||||
|
|
||||||
|
um_delete_directory($tempDir);
|
||||||
|
|
||||||
|
$updates= array_merge((array) $updates_binary, (array) $updates_code, (array) $updates_sql);
|
||||||
|
|
||||||
|
$package->updates = $updates;
|
||||||
|
|
||||||
|
$settings = um_db_load_settings ();
|
||||||
|
|
||||||
|
if (um_client_upgrade_to_package($package, $settings, true)) {
|
||||||
|
ui_print_success_message(
|
||||||
|
__('Successfully upgraded'));
|
||||||
|
|
||||||
|
//Refresh the settings object.
|
||||||
|
$settings = um_db_load_settings ();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_print_error_message(__('Cannot be upgraded'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui_print_error_message(__('File cannot be uploaded'));
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -634,6 +634,8 @@ function um_client_upgrade_to_package ($package, $settings, $force = true, $upda
|
|||||||
}
|
}
|
||||||
|
|
||||||
function um_client_upgrade_to_latest ($user_key, $force = true) {
|
function um_client_upgrade_to_latest ($user_key, $force = true) {
|
||||||
|
$success = false;
|
||||||
|
|
||||||
$settings = um_db_load_settings ();
|
$settings = um_db_load_settings ();
|
||||||
db_process_sql_begin();
|
db_process_sql_begin();
|
||||||
do {
|
do {
|
||||||
@ -655,6 +657,8 @@ function um_client_upgrade_to_latest ($user_key, $force = true) {
|
|||||||
|
|
||||||
/* Break on error, when there are no more packages on the server (server return true)
|
/* Break on error, when there are no more packages on the server (server return true)
|
||||||
or on auth failure (server return false) */
|
or on auth failure (server return false) */
|
||||||
|
|
||||||
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
function um_client_db_connect (&$settings = NULL) {
|
function um_client_db_connect (&$settings = NULL) {
|
||||||
|
@ -12,240 +12,218 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
// Load global vars
|
return;
|
||||||
global $config;
|
|
||||||
|
|
||||||
require_once("update_pandora.php");
|
function main_view() {
|
||||||
|
// Load global vars
|
||||||
|
global $config;
|
||||||
|
|
||||||
check_login ();
|
require_once("update_pandora.php");
|
||||||
|
|
||||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
check_login ();
|
||||||
$config['dbpass'], $config['dbname']);
|
|
||||||
|
|
||||||
$settings = um_db_load_settings ();
|
if (! check_acl ($config["id_user"], 0, "PM")) {
|
||||||
$error = '';
|
db_pandora_audit("ACL Violation",
|
||||||
|
"Trying to access event viewer");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$url = 'index.php?sec=extensions&sec2=extensions/update_manager';
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||||
|
$config['dbpass'], $config['dbname']);
|
||||||
|
|
||||||
$update_free = (bool)get_parameter('update_free', false);
|
$settings = um_db_load_settings ();
|
||||||
|
$user_key = get_user_key ($settings);
|
||||||
|
|
||||||
$buttons_active = array();
|
$buttons = array(
|
||||||
if ($update_free) {
|
'admin' => array(
|
||||||
$buttons_active['updatemanager'] = false;
|
'active' => false,
|
||||||
$buttons_active['updatefree'] = true;
|
'text' => '<a href="index.php?sec=gextensions&sec2=extensions/update_manager">' .
|
||||||
}
|
html_print_image ("images/god7.png",
|
||||||
else {
|
true, array ("title" => __('Update manager'))) .'</a>'));
|
||||||
$buttons_active['updatemanager'] = true;
|
|
||||||
$buttons_active['updatefree'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$buttons = array(
|
ui_print_page_header (__('Update manager'), "images/extensions.png",
|
||||||
'updatefree' => array('active' => $buttons_active['updatefree'],
|
false, "", false, $buttons);
|
||||||
'text' => '<a href="'.$url.'&update_free=1">' .
|
|
||||||
html_print_image("images/upd.png", true, array ("title" => __('Update free'))) .'</a>'),
|
|
||||||
'updatemanager' => array('active' => $buttons_active['updatemanager'],
|
|
||||||
'text' => '<a href="'.$url.'&update_manager=1">' .
|
|
||||||
html_print_image("images/package.png", true, array ("title" => __('Update manager'))) .'</a>'));
|
|
||||||
|
|
||||||
|
|
||||||
ui_print_page_header (__('Update manager'), "images/extensions.png",
|
|
||||||
false, "", false, $buttons);
|
|
||||||
|
|
||||||
if ($update_free) {
|
|
||||||
//Call to update pandora free.
|
|
||||||
|
|
||||||
update_pandora_administration();
|
|
||||||
|
|
||||||
//Don't call the code of update manager.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($settings->customer_key == FREE_USER) {
|
|
||||||
echo '<div class="notify" style="width: 80%; text-align:left;" >';
|
|
||||||
echo html_print_image("images/information.png", true) . ' ';
|
|
||||||
/* Translators: Do not translade Update Manager, it's the name of the program */
|
|
||||||
echo __('The new <a href="http://updatemanager.sourceforge.net">Update Manager</a> client is shipped with Pandora FMS It helps system administrators to update their Pandora FMS automatically, since the Update Manager does the task of getting new modules, new plugins and new features (even full migrations tools for future versions) automatically.');
|
|
||||||
echo '<p />';
|
|
||||||
echo __('Update Manager is one of the most advanced features of Pandora FMS Enterprise version, for more information visit <a href="http://pandorafms.com">http://pandorafms.com</a>.');
|
|
||||||
echo '<p />';
|
|
||||||
echo __('Update Manager sends anonymous information about Pandora FMS usage (number of agents and modules running). To disable it, just delete extension or remove remote server address from Update Manager plugin setup.');
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_key = get_user_key ($settings);
|
|
||||||
$update_package = (bool) get_parameter_post ('update_package');
|
|
||||||
|
|
||||||
if ($update_package) {
|
|
||||||
if ($config['enterprise_installed'] == 1) {
|
|
||||||
echo '<h2>'.__('Updating').'...</h2>';
|
|
||||||
flush ();
|
|
||||||
$force = (bool) get_parameter_post ('force_update');
|
|
||||||
|
|
||||||
um_client_upgrade_to_latest ($user_key, $force);
|
|
||||||
/* TODO: Add a new in tnews */
|
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
main_view_enterprise($settings, $user_key);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<h5 class="error">' . __('This is an Enterprise feature. Visit %s for more information.', '<a href="http://pandorafms.com">http://pandorafms.com</a>') . '</h5>';
|
main_view_open($settings, $user_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_FILES["fileloaded"]["error"]) && !$_FILES["fileloaded"]["error"]) {
|
function main_view_enterprise($settings, $user_key) {
|
||||||
$extension = substr($_FILES["fileloaded"]["name"], strlen($_FILES["fileloaded"]["name"])-4, 4);
|
global $config;
|
||||||
if($extension != '.oum') {
|
|
||||||
$error = '<h5 class="error">'.__('Incorrect file extension').'</h5>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$tempDir = sys_get_temp_dir()."/tmp_oum/";
|
|
||||||
|
|
||||||
$zip = new ZipArchive;
|
$update_package = (bool) get_parameter_post ('update_package');
|
||||||
if ($zip->open($_FILES["fileloaded"]['tmp_name']) === TRUE) {
|
|
||||||
$zip->extractTo($tempDir);
|
|
||||||
$zip->close();
|
|
||||||
} else {
|
|
||||||
$error = '<h5 class="error">'.__('Update cannot be opened').'</h5>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$package = um_package_info_from_paths ($tempDir);
|
if ($update_package) {
|
||||||
if ($package === false) {
|
if (enterprise_installed()) {
|
||||||
$error = '<h5 class="error">'.__('Error, the file package is empty or corrupted.').'</h5>';
|
$force = (bool) get_parameter_post ('force_update');
|
||||||
|
|
||||||
|
$success = um_client_upgrade_to_latest ($user_key, $force);
|
||||||
|
/* TODO: Add a new in tnews */
|
||||||
|
|
||||||
|
ui_print_result_message($success,
|
||||||
|
__('Success update to the last package.'),
|
||||||
|
__('Error update to the last package.'));
|
||||||
|
|
||||||
|
//Reload the update manager settings
|
||||||
|
|
||||||
|
$settings = um_db_load_settings ();
|
||||||
|
$user_key = get_user_key ($settings);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$settings = um_db_load_settings ();
|
ui_print_error_message(__('This is an Enterprise feature. Visit %s for more information.', '<a href="http://pandorafms.com">http://pandorafms.com</a>'));
|
||||||
|
|
||||||
if($settings->current_update >= $package->id) {
|
|
||||||
$error = '<h5 class="error">'.__('Your system version is higher or equal than the loaded package').'</h5>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$binary_paths = um_client_get_files ($tempDir."binary/");
|
|
||||||
|
|
||||||
foreach($binary_paths as $key => $paths) {
|
|
||||||
foreach($paths as $index => $path) {
|
|
||||||
$tempDir_scaped = preg_replace('/\//', '\/', $tempDir."binary");
|
|
||||||
$binary_paths[$key][$index] = preg_replace('/^'.$tempDir_scaped.'/', ' ', $path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$code_paths = um_client_get_files ($tempDir."code/");
|
|
||||||
|
|
||||||
foreach($code_paths as $key => $paths) {
|
|
||||||
foreach($paths as $index => $path) {
|
|
||||||
$tempDir_scaped = preg_replace('/\//', '\/', $tempDir."code");
|
|
||||||
$code_paths[$key][$index] = preg_replace('/^'.$tempDir_scaped.'/', ' ', $path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_paths = um_client_get_files ($tempDir);
|
|
||||||
foreach($sql_paths as $key => $paths) {
|
|
||||||
foreach($paths as $index => $path) {
|
|
||||||
if($path != $tempDir || ($key == 'info_package' && $path == $tempDir)) {
|
|
||||||
unset($sql_paths[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$updates_binary = array();
|
|
||||||
$updates_code = array();
|
|
||||||
$updates_sql = array();
|
|
||||||
|
|
||||||
if(!empty($binary_paths)) {
|
|
||||||
$updates_binary = um_client_update_from_paths ($binary_paths, $tempDir, $package->id, 'binary');
|
|
||||||
}
|
|
||||||
if(!empty($code_paths)) {
|
|
||||||
$updates_code = um_client_update_from_paths ($code_paths, $tempDir, $package->id, 'code');
|
|
||||||
}
|
|
||||||
if(!empty($sql_paths)) {
|
|
||||||
$updates_sql = um_client_update_from_paths ($sql_paths, $tempDir, $package->id, 'sql');
|
|
||||||
}
|
|
||||||
|
|
||||||
um_delete_directory($tempDir);
|
|
||||||
|
|
||||||
$updates= array_merge((array) $updates_binary, (array) $updates_code, (array) $updates_sql);
|
|
||||||
|
|
||||||
$package->updates = $updates;
|
|
||||||
|
|
||||||
$settings = um_db_load_settings ();
|
|
||||||
|
|
||||||
if(um_client_upgrade_to_package ($package, $settings, true)) {
|
|
||||||
echo '<h5 class="suc">'.__('Successfully upgraded').'.</h5>';
|
|
||||||
$settings = um_db_load_settings ();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo '<h5 class="error">'.__('Cannot be upgraded').'</h5>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
$error = '<h5 class="error">'.__('File cannot be uploaded').'</h5>';
|
|
||||||
}
|
|
||||||
|
|
||||||
db_clean_cache();
|
if (!empty($_FILES)) {
|
||||||
$settings = um_db_load_settings ();
|
install_offline_enterprise_package($settings, $user_key);
|
||||||
$user_key = get_user_key ($settings);
|
|
||||||
|
|
||||||
$package = um_client_check_latest_update ($settings, $user_key);
|
|
||||||
|
|
||||||
if (check_acl ($config['id_user'], 0, 'PM')) {
|
|
||||||
if ($package === true) {
|
|
||||||
echo '<h5 class="suc">'.__('Your system is up-to-date').'.</h5>';
|
|
||||||
}
|
|
||||||
elseif ($package === false) {
|
|
||||||
echo '<h5 class="error">'.__('Server authorization rejected').'</h5>';
|
|
||||||
}
|
|
||||||
elseif ($package === 0) {
|
|
||||||
echo '<h5 class="error">'.__('Server connection failed').'</h5>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo '<h5 class="suc">'.__('There\'s a new update for Pandora FMS').'</h5>';
|
|
||||||
|
|
||||||
$table->width = '98%';
|
|
||||||
$table->data = array ();
|
|
||||||
|
|
||||||
$table->data[0][0] = '<strong>'.__('Id').'</strong>';
|
|
||||||
$table->data[0][1] = $package->id;
|
|
||||||
|
|
||||||
$table->data[1][0] = '<strong>'.__('Timestamp').'</strong>';
|
|
||||||
$table->data[1][1] = $package->timestamp;
|
|
||||||
|
|
||||||
$table->data[2][0] = '<strong>'.__('Description').'</strong>';
|
|
||||||
$table->data[2][1] = html_entity_decode ($package->description);
|
|
||||||
|
|
||||||
html_print_table ($table);
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
echo '<form method="post">';
|
|
||||||
echo __('Overwrite local changes');
|
|
||||||
html_print_checkbox ('force_update', '1', false);
|
|
||||||
echo '<p />';
|
|
||||||
html_print_input_hidden ('update_package', 1);
|
|
||||||
html_print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"');
|
|
||||||
echo '</form>';
|
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($error != '' && isset($_FILES["fileloaded"]["error"])) {
|
|
||||||
echo $error;
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($table);
|
|
||||||
|
|
||||||
|
$table = null;
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->data = array ();
|
$table->style = array();
|
||||||
$table->colspan[0][0] = 2;
|
$table->style[0] = 'font-weight: bolder; font-size: 20px;';
|
||||||
|
$table->data = array();
|
||||||
|
$table->data[0][0] = __('Your Pandora FMS Enterprise version number is')
|
||||||
|
. ' ' . $settings->current_update;
|
||||||
|
html_print_table($table);
|
||||||
|
|
||||||
$table->data[0][0] = '<h4>'.__('Offline packages loader').'</h4>';
|
|
||||||
$table->data[1][0] = '<input type="hidden" name="upload_package" value="1">';
|
|
||||||
$table->data[1][0] .= '<input type="file" size="55" name="fileloaded">';
|
/* Translators: Do not translade Update Manager, it's the name of the program */
|
||||||
$table->data[1][1] = '<input type="submit" name="upload_button" value="'.__('Upload').'">';
|
ui_print_info_message(
|
||||||
|
'<p>' .
|
||||||
|
__('The new <a href="http://updatemanager.sourceforge.net">Update Manager</a> client is shipped with Pandora FMS It helps system administrators to update their Pandora FMS automatically, since the Update Manager does the task of getting new modules, new plugins and new features (even full migrations tools for future versions) automatically.') .
|
||||||
|
'</p>' .
|
||||||
|
'<p>' .
|
||||||
|
__('Update Manager is one of the most advanced features of Pandora FMS Enterprise version, for more information visit <a href="http://pandorafms.com">http://pandorafms.com</a>.') .
|
||||||
|
'</p>' .
|
||||||
|
'<p>' .
|
||||||
|
__('Update Manager sends anonymous information about Pandora FMS usage (number of agents and modules running). To disable it, just delete extension or remove remote server address from Update Manager plugin setup.') .
|
||||||
|
'</p>');
|
||||||
|
|
||||||
|
|
||||||
|
echo '<h4>' . __('Online') . '</h4>';
|
||||||
|
$table = null;
|
||||||
|
$table->width = '98%';
|
||||||
|
$table->size = array();
|
||||||
|
$table->size[0] = '60%';
|
||||||
|
$table->size[1] = '15%';
|
||||||
|
$table->size[2] = '25%';
|
||||||
|
$table->colspan = array();
|
||||||
|
$table->colspan[0][0] = 3;
|
||||||
|
$table->data = array();
|
||||||
|
$table->data[1][0] = '<span id="box_ajax_checking_online">' .
|
||||||
|
__('Checking for a update') . ' ' . html_print_image('images/spinner.gif', true) .
|
||||||
|
'</span>';
|
||||||
|
$table->data[1][1] = html_print_button(__('Details'),
|
||||||
|
'details_online', true, 'show_details();', 'class="sub search"', true);
|
||||||
|
$table->data[1][2] = __('Force') . ': ' .
|
||||||
|
html_print_checkbox ('force_update', '1', false, true) .
|
||||||
|
html_print_submit_button(__('Update'), 'update_online', true,
|
||||||
|
'class="sub upd"', true);
|
||||||
|
|
||||||
|
echo '<form method="post">';
|
||||||
|
html_print_input_hidden ('update_package', 1);
|
||||||
|
html_print_table($table);
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div id="dialog" title="<?php echo __('Details packge'); ?>"
|
||||||
|
style="display: none;">
|
||||||
|
<div style="position:absolute; top:20%; text-align: center; left: 0%; right: 0%; width: 600px;">
|
||||||
|
<div id="dialog_version_package" style="margin-left: 40px; margin-bottom: 20px; text-align: left;">
|
||||||
|
</div>
|
||||||
|
<div id="dialog_description" style="margin-left: 40px; text-align: left; height: 250px; width: 550px; overflow: auto;">
|
||||||
|
</div>
|
||||||
|
<div id="button_close" style="position: absolute; top:280px; right:43%;">
|
||||||
|
<?php
|
||||||
|
html_print_submit_button(__("Close"),
|
||||||
|
'hide_dialog', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only" style="width:100px;"');
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo '<h4>' . __('Offline') . '</h4>';
|
||||||
|
$table = null;
|
||||||
|
$table->width = '98%';
|
||||||
|
$table->data = array();
|
||||||
|
$table->data[1][0] = '<h5>'.__('Offline packages loader').'</h5>' .
|
||||||
|
'<input type="hidden" name="upload_package" value="1">' .
|
||||||
|
'<input type="file" size="55" name="fileloaded">' .
|
||||||
|
' <input class="sub next" type="submit" name="upload_button" value="' . __('Upload') . '">';
|
||||||
|
|
||||||
echo '<form method="post" enctype="multipart/form-data">';
|
echo '<form method="post" enctype="multipart/form-data">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#submit-hide_dialog").click (function () {
|
||||||
|
$("#dialog" ).dialog('close');
|
||||||
|
});
|
||||||
|
|
||||||
|
ajax_checking_online_enterprise_package();
|
||||||
|
});
|
||||||
|
|
||||||
|
function show_details() {
|
||||||
|
$("#dialog").dialog({
|
||||||
|
resizable: false,
|
||||||
|
draggable: false,
|
||||||
|
modal: true,
|
||||||
|
height: 400,
|
||||||
|
width: 600,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
},
|
||||||
|
bgiframe: jQuery.browser.msie
|
||||||
|
});
|
||||||
|
$("#dialog").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajax_checking_online_enterprise_package() {
|
||||||
|
var parameters = {};
|
||||||
|
parameters['page'] = 'extensions/update_manager';
|
||||||
|
parameters['checking_online_enterprise_package'] = 1;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: 'ajax.php',
|
||||||
|
data: parameters,
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
$("#box_ajax_checking_online").html(data['text']);
|
||||||
|
$("#dialog_version_package").html(data['version_package_text']);
|
||||||
|
$("#dialog_description").html(data['details_text']);
|
||||||
|
|
||||||
|
if (data['enable_buttons']) {
|
||||||
|
$("input[name='details_online']").attr('disabled', '');
|
||||||
|
$("input[name='update_online']").attr('disabled', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h4>'.__('Your system version number is').': '.$settings->current_update.'</h4>';
|
function main_view_open($settings, $user_key) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
update_pandora_administration($settings, $user_key);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -22,17 +22,39 @@ if (! check_acl ($config['id_user'], 0, 'PM')) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include ("extensions/update_manager/lib/functions.php");
|
||||||
|
|
||||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||||
$config['dbpass'], $config['dbname']);
|
$config['dbpass'], $config['dbname']);
|
||||||
|
|
||||||
$update_settings = (bool) get_parameter_post ('update_settings');
|
$update_settings = (bool) get_parameter_post ('update_settings');
|
||||||
|
|
||||||
ui_print_page_header (__('Update manager').' - '. __('Settings'), "images/extensions.png", false, "", true, "" );
|
$buttons = array(
|
||||||
|
'admin' => array(
|
||||||
|
'active' => false,
|
||||||
|
'text' => '<a href="index.php?sec=extensions&sec2=extensions/update_manager">' .
|
||||||
|
html_print_image ("images/eye.png",
|
||||||
|
true, array ("title" => __('Update manager'))) .'</a>'));
|
||||||
|
|
||||||
|
ui_print_page_header (__('Update manager').' - '. __('Settings'),
|
||||||
|
"images/extensions.png", false, "", true, $buttons);
|
||||||
|
|
||||||
if ($update_settings) {
|
if ($update_settings) {
|
||||||
foreach ($_POST['keys'] as $key => $value) {
|
foreach ($_POST['keys'] as $key => $value) {
|
||||||
um_db_update_setting ($key, $value);
|
um_db_update_setting ($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!enterprise_installed()) {
|
||||||
|
global $conf_update_pandora;
|
||||||
|
if (empty($conf_update_pandora))
|
||||||
|
$conf_update_pandora = update_pandora_get_conf();
|
||||||
|
|
||||||
|
$conf_update_pandora['download_mode'] =
|
||||||
|
get_parameter('download_mode', 'curl');
|
||||||
|
|
||||||
|
update_pandora_update_conf();
|
||||||
|
}
|
||||||
|
|
||||||
echo "<h3 class=suc>".__('Update manager settings updated')."</h3>";
|
echo "<h3 class=suc>".__('Update manager settings updated')."</h3>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,9 +71,8 @@ $table->data[0][1] = html_print_input_text ('keys[customer_key]', $settings->cus
|
|||||||
$table->data[1][0] = '<strong>'.__('Update server host').'</strong>';
|
$table->data[1][0] = '<strong>'.__('Update server host').'</strong>';
|
||||||
$table->data[1][1] = html_print_input_text ('keys[update_server_host]', $settings->update_server_host, '', 20, 255, true);
|
$table->data[1][1] = html_print_input_text ('keys[update_server_host]', $settings->update_server_host, '', 20, 255, true);
|
||||||
|
|
||||||
$table->data[2][0] = '<strong>'.__('Update server path').'</strong>'
|
$table->data[2][0] = '<strong>'.__('Update server path').'</strong>';
|
||||||
. ui_print_help_tip (__('The server path is automatically updated with each Pandora Console version.'), true);
|
$table->data[2][1] = html_print_input_text ('keys[update_server_path]', $settings->update_server_path, '', 40, 255, true);
|
||||||
$table->data[2][1] = html_print_input_text ('keys[update_server_path]', $settings->update_server_path, '', 40, 255, true, true);
|
|
||||||
|
|
||||||
$table->data[3][0] = '<strong>'.__('Update server port').'</strong>';
|
$table->data[3][0] = '<strong>'.__('Update server port').'</strong>';
|
||||||
$table->data[3][1] = html_print_input_text ('keys[update_server_port]', $settings->update_server_port, '', 5, 5, true);
|
$table->data[3][1] = html_print_input_text ('keys[update_server_port]', $settings->update_server_port, '', 5, 5, true);
|
||||||
@ -74,6 +95,21 @@ $table->data[8][1] = html_print_input_text ('keys[proxy_user]', $settings->proxy
|
|||||||
$table->data[9][0] = '<strong>'.__('Proxy password').'</strong>';
|
$table->data[9][0] = '<strong>'.__('Proxy password').'</strong>';
|
||||||
$table->data[9][1] = html_print_input_password ('keys[proxy_pass]', $settings->proxy_pass, '', 40, 255, true);
|
$table->data[9][1] = html_print_input_password ('keys[proxy_pass]', $settings->proxy_pass, '', 40, 255, true);
|
||||||
|
|
||||||
|
if (!enterprise_installed()) {
|
||||||
|
global $conf_update_pandora;
|
||||||
|
if (empty($conf_update_pandora))
|
||||||
|
$conf_update_pandora = update_pandora_get_conf();
|
||||||
|
|
||||||
|
$methods = array(
|
||||||
|
'wget' => __('WGET, no interactive, external command, fast'),
|
||||||
|
'curl' =>__('CURL, interactive, internal command, slow'));
|
||||||
|
|
||||||
|
$table->data[10][0] = '<strong>' . __('Download Method') . '</strong>';
|
||||||
|
$table->data[10][1] = html_print_select($methods,
|
||||||
|
'download_mode', $conf_update_pandora['download_mode'], '', '',
|
||||||
|
0, true);
|
||||||
|
}
|
||||||
|
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_input_hidden ('update_settings', 1);
|
html_print_input_hidden ('update_settings', 1);
|
||||||
@ -82,9 +118,3 @@ echo '</div>';
|
|||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<style>
|
|
||||||
#text-keys\[update_server_path\] {
|
|
||||||
color: grey;
|
|
||||||
background: #DDDDDD;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -50,7 +50,7 @@ if (is_ajax ()) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_pandora_administration() {
|
function update_pandora_administration($settings, $user_key) {
|
||||||
global $config;
|
global $config;
|
||||||
global $conf_update_pandora;
|
global $conf_update_pandora;
|
||||||
|
|
||||||
@ -68,62 +68,62 @@ function update_pandora_administration() {
|
|||||||
update_pandora_installation();
|
update_pandora_installation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$delete_package = (bool)get_parameter('delete_package');
|
||||||
|
if ($delete_package) {
|
||||||
|
$package = get_parameter('package');
|
||||||
|
|
||||||
|
$dir = $config['attachment_store'] . '/update_pandora/';
|
||||||
|
|
||||||
|
$result = unlink($dir . $package);
|
||||||
|
}
|
||||||
|
|
||||||
$conf_update_pandora = update_pandora_get_conf();
|
$conf_update_pandora = update_pandora_get_conf();
|
||||||
|
|
||||||
echo "<h3>" . __('Downloaded Packages') . "</h3>";
|
|
||||||
$list_downloaded_packages = update_pandora_get_list_downloaded_packages('administration');
|
|
||||||
$table = null;
|
$table = null;
|
||||||
$table->width = '80%';
|
$table->width = '98%';
|
||||||
$table->size = array('80%', '50px');
|
$table->style = array();
|
||||||
$table->head = array(__('Packages'), __('Action'));
|
$table->style[0] = 'font-weight: bolder; font-size: 20px;';
|
||||||
$table->align = array('left', 'center');
|
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
foreach ($list_downloaded_packages as $package) {
|
$table->data[0][0] = __('Your Pandora FMS open source package installed is') .
|
||||||
$actions = '';
|
' ' . $conf_update_pandora['last_installed'];
|
||||||
if (!isset($package['empty'])) {
|
|
||||||
if (!$package['current']) {
|
|
||||||
$actions = '<a href="javascript: ajax_start_install_package(\'' . $package['name'] . '\');">' .
|
|
||||||
html_print_image('images/b_white.png', true, array('alt'=>
|
|
||||||
__('Install this version'), 'title' => __('Install this version'))) .
|
|
||||||
'</a>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$actions = '<a href="javascript: ajax_start_install_package(\'' . $package['name'] . '\');">' .
|
|
||||||
html_print_image('images/b_yellow.png', true, array('alt'=>
|
|
||||||
__('Reinstall this version'), 'title' => __('Reinstall this version'))) .
|
|
||||||
'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$table->data[] = array($package['name'], $actions);
|
|
||||||
}
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo "<h3>" . __('Online Package') . "</h3>";
|
|
||||||
|
|
||||||
echo '<table id="online_packages" class="databox" width="80%" cellspacing="4" cellpadding="4" border="0" style="">';
|
ui_print_info_message(
|
||||||
echo '<thead><tr>
|
'<p>' .
|
||||||
<th class="header c0" scope="col">' . __('Package') . '</th>
|
__('This is a automatilly update Pandora Console only. Be careful if you have changed any php file of console, please make a backup this modified files php. Because the update action ovewrite all php files in Pandora console.') .
|
||||||
<th class="header c1" scope="col">' . __('Action') . '</th>
|
'</p>' .
|
||||||
</tr></thead>';
|
'<p>' .
|
||||||
echo '<tbody>
|
__('Update Manager sends anonymous information about Pandora FMS usage (number of agents and modules running). To disable it, just delete extension or remove remote server address from Update Manager plugin setup.') .
|
||||||
<tr id="online_packages-0" class="spinner_row" style="">
|
'</p>'
|
||||||
<td id="online_packages-0-0" style=" text-align:left; width:80%;">' .
|
);
|
||||||
__('Get list online Package') . " " . html_print_image('images/spinner.gif', true) .
|
|
||||||
'</td>
|
|
||||||
<td id="online_packages-0-1" style=" text-align:center; width:50px;"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>';
|
|
||||||
echo '</table>';
|
|
||||||
|
|
||||||
|
$table = null;
|
||||||
|
$table->width = '98%';
|
||||||
|
$table->data = array();
|
||||||
|
$table->data[0][0] = '<h4>' . __('Online') . '</h4>';
|
||||||
|
$table->data[1][0] =
|
||||||
|
'<table id="online_packages" class="databox" width="80%" cellspacing="4" cellpadding="4" border="0" style="">' .
|
||||||
|
'<tbody>
|
||||||
|
<tr id="online_packages-0" class="spinner_row" style="">
|
||||||
|
<td id="online_packages-0-0" style=" text-align:left; width:80%;">' .
|
||||||
|
__('Get list online Package') . " " . html_print_image('images/spinner.gif', true) .
|
||||||
|
'</td>
|
||||||
|
<td id="online_packages-0-1" style=" text-align:center; width:50px;"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>' .
|
||||||
|
'</table>';
|
||||||
|
html_print_table($table);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div id="dialog_download" title="<?php echo __('Process packge'); ?>"
|
<div id="dialog_download" title="<?php echo __('Process packge'); ?>"
|
||||||
style="display:none; -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)'; filter: alpha(opacity=50);">
|
style="display:none;">
|
||||||
<div style="position:absolute; top:20%; text-align: center; left:0%; right:0%; width:600px;">
|
<div style="position:absolute; top:20%; text-align: center; left:0%; right:0%; width:600px;">
|
||||||
<?php
|
<?php
|
||||||
echo '<h2 id="title_downloading_update_pandora">' . __('Downloading <span class="package_name">package</span> in progress') . " ";
|
echo '<h2 id="title_downloading_update_pandora">' . __('Downloading <span class="package_name">package</span> in progress') . " ";
|
||||||
html_print_image('images/spinner.gif');
|
html_print_image('images/spinner.gif');
|
||||||
echo '</h2>';
|
echo '</h2>';
|
||||||
|
echo '<h2 style="display: none;" id="title_downloaded_update_pandora">' . __('Downloaded <span class="package_name">package</span>') . '</h2>';
|
||||||
echo '<h2 style="display: none;" id="title_installing_update_pandora">' . __('Installing <span class="package_name">package</span> in progress') . " ";
|
echo '<h2 style="display: none;" id="title_installing_update_pandora">' . __('Installing <span class="package_name">package</span> in progress') . " ";
|
||||||
html_print_image('images/spinner.gif');
|
html_print_image('images/spinner.gif');
|
||||||
echo '</h2>';
|
echo '</h2>';
|
||||||
@ -134,7 +134,7 @@ function update_pandora_administration() {
|
|||||||
echo progress_bar(0, 300, 20, 0 . '%', 1, false, "#00ff00");
|
echo progress_bar(0, 300, 20, 0 . '%', 1, false, "#00ff00");
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "<div style='padding-top: 20px; display: none;' id='info_text'>
|
echo "<div style='padding-top: 10px; display: none;' id='info_text'>
|
||||||
<b>Size:</b> 666/666 kbytes <b>Speed:</b> 666 bytes/second
|
<b>Size:</b> 666/666 kbytes <b>Speed:</b> 666 bytes/second
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
@ -148,6 +148,43 @@ function update_pandora_administration() {
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$tableMain = null;
|
||||||
|
$tableMain->width = '98%';
|
||||||
|
$tableMain->data = array();
|
||||||
|
$tableMain->data[0][0] = '<h4>' . __('Downloaded Packages') . '</h4>';
|
||||||
|
|
||||||
|
$list_downloaded_packages = update_pandora_get_list_downloaded_packages('administration');
|
||||||
|
$table = null;
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->size = array('50%', '25%', '25%');
|
||||||
|
$table->align = array('left', 'center');
|
||||||
|
$table->data = array();
|
||||||
|
foreach ($list_downloaded_packages as $package) {
|
||||||
|
$actions = '';
|
||||||
|
if (!isset($package['empty'])) {
|
||||||
|
if (!$package['current']) {
|
||||||
|
$actions = html_print_button(__('Install'),
|
||||||
|
'install_' . uniqid(), false,
|
||||||
|
'ajax_start_install_package(\'' . $package['name'] . '\');',
|
||||||
|
'class="sub next" style="width: 40%;"', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$actions = html_print_button(__('Reinstall'),
|
||||||
|
'reinstall_' . uniqid(), false,
|
||||||
|
'ajax_start_install_package(\'' . $package['name'] . '\');',
|
||||||
|
'class="sub upd" style="width: 40%;"', true);
|
||||||
|
}
|
||||||
|
$actions .= ' ' . html_print_button(__('Delete'),
|
||||||
|
'delete' . uniqid(), false,
|
||||||
|
'delete_package(\'' . $package['name'] . '\');',
|
||||||
|
'class="sub delete" style="width: 40%;"', true);
|
||||||
|
}
|
||||||
|
$table->data[] = array($package['name'], $package['time'], $actions);
|
||||||
|
}
|
||||||
|
$tableMain->data[1][0] = html_print_table($table, true);
|
||||||
|
|
||||||
|
html_print_table($tableMain);
|
||||||
|
|
||||||
ui_require_css_file ('dialog');
|
ui_require_css_file ('dialog');
|
||||||
ui_require_jquery_file ('ui.core');
|
ui_require_jquery_file ('ui.core');
|
||||||
ui_require_jquery_file ('ui.dialog');
|
ui_require_jquery_file ('ui.dialog');
|
||||||
|
@ -622,87 +622,114 @@ function config_process_config () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function config_check (){
|
function config_check (){
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// At this first version I'm passing errors using session variables, because the error management
|
// At this first version I'm passing errors using session variables, because the error management
|
||||||
// is done by an AJAX request. Better solutions could be implemented in the future :-)
|
// is done by an AJAX request. Better solutions could be implemented in the future :-)
|
||||||
|
|
||||||
// Check default password for "admin"
|
// Check default password for "admin"
|
||||||
$hashpass = db_get_sql ("SELECT password FROM tusuario WHERE id_user = 'admin'");
|
$hashpass = db_get_sql ("SELECT password FROM tusuario WHERE id_user = 'admin'");
|
||||||
if ($hashpass == "1da7ee7d45b96d0e1f45ee4ee23da560"){
|
if ($hashpass == "1da7ee7d45b96d0e1f45ee4ee23da560"){
|
||||||
$config["alert_cnt"]++;
|
$config["alert_cnt"]++;
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Default password for "Admin" user has not been changed.').'</h3>'.'<p>'.__('Please change the default password because is a common vulnerability reported.').'</p>';
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
}
|
array('message' => __('Default password for "Admin" user has not been changed.').'</h3>'.'<p>'.__('Please change the default password because is a common vulnerability reported.'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_writable ("attachment")){
|
if (!is_writable ("attachment")){
|
||||||
$config["alert_cnt"]++;
|
$config["alert_cnt"]++;
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Attachment directory is not writable by HTTP Server').'</h3>'.'<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory').'</p>';
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
}
|
array('message' => __('Attachment directory is not writable by HTTP Server').'</h3>'.'<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
// Get remote file dir.
|
// Get remote file dir.
|
||||||
$remote_config = db_get_value_filter('value', 'tconfig', array('token' => 'remote_config'));
|
$remote_config = db_get_value_filter('value', 'tconfig', array('token' => 'remote_config'));
|
||||||
|
|
||||||
if (defined ('PANDORA_ENTERPRISE')){
|
if (enterprise_installed()) {
|
||||||
|
if (!is_writable ($remote_config)){
|
||||||
|
$config["alert_cnt"]++;
|
||||||
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
|
array('message' => __('Remote configuration directory is not writtable for the console').' - $remote_config',
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_writable ($remote_config)){
|
$remote_config_conf = $remote_config . "/conf";
|
||||||
$config["alert_cnt"]++;
|
if (!is_writable ($remote_config_conf)){
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Remote configuration directory is not writtable for the console').' - $remote_config</h3>';
|
$config["alert_cnt"]++;
|
||||||
}
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
|
array('message' => __('Remote configuration directory is not writtable for the console').' - $remote_config',
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
$remote_config_conf = $remote_config . "/conf";
|
$remote_config_col = $remote_config . "/collections";
|
||||||
if (!is_writable ($remote_config_conf)){
|
if (!is_writable ($remote_config_col)){
|
||||||
$config["alert_cnt"]++;
|
$config["alert_cnt"]++;
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Remote configuration directory is not writtable for the console').' - $remote_config</h3>';
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
}
|
array('message' => __('Remote configuration directory is not writtable for the console').' - $remote_config',
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$remote_config_col = $remote_config . "/collections";
|
// Check attachment directory (too much files?)
|
||||||
if (!is_writable ($remote_config_col)){
|
|
||||||
$config["alert_cnt"]++;
|
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Remote configuration directory is not writtable for the console').' - $remote_config</h3>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check attachment directory (too much files?)
|
$filecount = count(glob($config["homedir"]."/attachment/*"));
|
||||||
|
// 100 temporal files of trash should be enough for most people.
|
||||||
|
if ($filecount > 100) {
|
||||||
|
$config["alert_cnt"]++;
|
||||||
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
|
array('title' => __('Too much files in your tempora/attachment directory'),
|
||||||
|
'message' => __("There are too much files in attachment directory. This is not fatal, but you should consider cleaning up your attachment directory manually"). " ( $filecount ". __("files") . " )",
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
$filecount = count(glob($config["homedir"]."/attachment/*"));
|
// Check database maintance
|
||||||
// 100 temporal files of trash should be enough for most people.
|
$db_maintance = db_get_value_filter ('value', 'tconfig', array('token' => 'db_maintance'));
|
||||||
if ($filecount > 100){
|
$now = date("U");
|
||||||
$config["alert_cnt"]++;
|
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__('Too much files in your tempora/attachment directory').'</h3>';
|
|
||||||
$_SESSION["alert_msg"] .= __("There are too much files in attachment directory. This is not fatal, but you should consider cleaning up your attachment directory manually"). " ( $filecount ". __("files") . " )";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check database maintance
|
// First action in order to know if it's a new installation or db maintenance never have been executed
|
||||||
$db_maintance = db_get_value_filter ('value', 'tconfig', array('token' => 'db_maintance'));
|
$first_action = db_get_value_filter('utimestamp', 'tsesion', array('1' => '1', 'order' => 'id_sesion ASC'));
|
||||||
$now = date("U");
|
$fresh_installation = $now - $first_action;
|
||||||
|
|
||||||
// First action in order to know if it's a new installation or db maintenance never have been executed
|
$resta = $now - $db_maintance;
|
||||||
$first_action = db_get_value_filter('utimestamp', 'tsesion', array('1 = 1', 'order' => 'id_sesion ASC'));
|
// ~ about 50 hr
|
||||||
$fresh_installation = $now - $first_action;
|
if (($resta > 190000 AND $fresh_installation> 190000)){
|
||||||
|
$config["alert_cnt"]++;
|
||||||
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
|
array('title' => __("Database maintance problem"),
|
||||||
|
'message' => __('Your database is not well maintained. Seems that it have more than 48hr without a proper maintance. Please review Pandora FMS documentation about how to execute this maintance process (pandora_db.pl) and enable it as soon as possible'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
$resta = $now - $db_maintance;
|
$fontpath = db_get_value_filter('value', 'tconfig', array('token' => 'fontpath'));
|
||||||
// ~ about 50 hr
|
if (($fontpath == "") OR (!file_exists ($fontpath))) {
|
||||||
if (($resta > 190000 AND $fresh_installation> 190000)){
|
$config["alert_cnt"]++;
|
||||||
$config["alert_cnt"]++;
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__("Database maintance problem").'</h3>';
|
array('title' => __("Default font doesnt exist"),
|
||||||
$_SESSION["alert_msg"] .= __('Your database is not well maintained. Seems that it have more than 48hr without a proper maintance. Please review Pandora FMS documentation about how to execute this maintance process (pandora_db.pl) and enable it as soon as possible').'</h3>';
|
'message' => __('Your defined font doesnt exist or is not defined. Please check font parameters in your config'),
|
||||||
}
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
$fontpath = db_get_value_filter('value', 'tconfig', array('token' => 'fontpath'));
|
global $develop_bypass;
|
||||||
if (($fontpath == "") OR (!file_exists ($fontpath))) {
|
|
||||||
$config["alert_cnt"]++;
|
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__("Default font doesnt exist").'</h3>';
|
|
||||||
$_SESSION["alert_msg"] .= __('Your defined font doesnt exist or is not defined. Please check font parameters in your config').'</h3>';
|
|
||||||
}
|
|
||||||
|
|
||||||
global $develop_bypass;
|
if ($develop_bypass == 1){
|
||||||
|
$config["alert_cnt"]++;
|
||||||
if ($develop_bypass == 1){
|
$_SESSION["alert_msg"] .= ui_print_error_message(
|
||||||
$config["alert_cnt"]++;
|
array('title' => __("Developer mode is enabled"),
|
||||||
$_SESSION["alert_msg"] .= '<h3 class="error">'.__("Developer mode is enabled").'</h3>';
|
'message' => __('Your Pandora FMS has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production system. This value is written in the main index.php file'),
|
||||||
$_SESSION["alert_msg"] .= __('Your Pandora FMS has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production system. This value is written in the main index.php file').'</h3>';
|
'no_close' => true), '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//pandora_update_manager_login();
|
||||||
|
if (isset($_SESSION['new_update'])) {
|
||||||
|
if ($_SESSION['new_update'] == 'new') {
|
||||||
|
$config["alert_cnt"]++;
|
||||||
|
$_SESSION["alert_msg"] .= ui_print_info_message(
|
||||||
|
array('title' => __("New update of Pandora Console"),
|
||||||
|
'message' => __('There is a new update please go to menu operation and into extensions go to Update Manager for more details.'),
|
||||||
|
'no_close' => true), '', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user