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
2019-04-22 15:45:57 +02:00
/**
2019-05-14 13:41:21 +02:00
* Extension to self monitor Pandora FMS Console
*
* @ category Update Manager
* @ package Pandora FMS
* @ subpackage Update Manager Online
* @ version 1.0 . 0
* @ license See below
*
* ______ ___ _______ _______ ________
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
2019-04-22 15:45:57 +02:00
* Copyright ( c ) 2005 - 2019 Artica Soluciones Tecnologicas
* Please see http :// pandorafms . org for full contribution list
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
2019-05-14 13:41:21 +02:00
* as published by the Free Software Foundation for version 2.
2019-04-22 15:45:57 +02:00
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
2019-05-14 13:41:21 +02:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
2019-04-22 15:45:57 +02:00
* GNU General Public License for more details .
2019-05-14 13:41:21 +02:00
* ============================================================================
2019-04-22 15:45:57 +02:00
*/
2019-05-14 13:41:21 +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 ();
2016-04-13 13:51:01 +02:00
2019-01-30 16:18:44 +01:00
if ( ! check_acl ( $config [ 'id_user' ], 0 , 'PM' ) && ! is_user_admin ( $config [ 'id_user' ])) {
db_pandora_audit ( 'ACL Violation' , 'Trying to access Setup Management' );
include 'general/noaccess.php' ;
return ;
2016-04-13 13:51:01 +02:00
}
2014-06-10 16:56:15 +02:00
ui_require_css_file ( 'update_manager' , 'godmode/update_manager/' );
2019-05-22 15:40:17 +02:00
require_once __DIR__ . '/../../include/functions_update_manager.php' ;
2017-01-26 14:54:26 +01:00
2019-01-30 16:18:44 +01:00
enterprise_include_once ( 'include/functions_update_manager.php' );
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
2019-05-22 15:40:17 +02:00
require_once __DIR__ . '/../../include/functions_config.php' ;
2014-06-10 16:34:27 +02:00
2019-05-14 13:41:21 +02:00
$memory_limit_min = '500M' ;
$post_max_size_min = '800M' ;
$upload_max_filesize_min = '800M' ;
$PHPmemory_limit_min = config_return_in_bytes ( $memory_limit_min );
2019-05-16 12:50:16 +02:00
$PHPpost_max_size_min = config_return_in_bytes ( $post_max_size );
$PHPupload_max_filesize_min = config_return_in_bytes ( $upload_max_filesize_min );
2019-05-14 13:41:21 +02:00
$php_settings_fine = 0 ;
$PHP_SETTINGS_REQUIRED = 3 ;
2016-09-22 11:12:19 +02:00
2019-05-14 13:41:21 +02:00
$memory_limit = config_return_in_bytes ( ini_get ( 'memory_limit' ));
if ( $memory_limit < $PHPmemory_limit_min ) {
2019-01-30 16:18:44 +01:00
ui_print_error_message (
2019-05-14 13:41:21 +02:00
sprintf (
__ ( 'Your PHP has set memory limit in %s. To use Update Manager Online, please set it to %s' ),
ini_get ( 'memory_limit' ),
$memory_limit_min
)
2019-01-30 16:18:44 +01:00
);
2019-05-14 13:41:21 +02:00
} else {
$php_settings_fine ++ ;
2014-06-26 17:00:43 +02:00
}
2019-01-30 16:18:44 +01:00
2019-05-14 13:41:21 +02:00
$post_max_size = config_return_in_bytes ( ini_get ( 'post_max_size' ));
if ( $post_max_size < $PHPpost_max_size_min ) {
2019-01-30 16:18:44 +01:00
ui_print_error_message (
2019-05-14 13:41:21 +02:00
sprintf (
__ ( 'Your PHP has post_max_size limited to %s. To use Update Manager Online, please set it to %s' ),
ini_get ( 'post_max_size' ),
$post_max_size_min
)
2019-01-30 16:18:44 +01:00
);
2019-05-14 13:41:21 +02:00
} else {
$php_settings_fine ++ ;
2015-02-11 15:40:22 +01:00
}
2019-01-30 16:18:44 +01:00
2019-05-14 13:41:21 +02:00
$upload_max_filesize = config_return_in_bytes ( ini_get ( 'upload_max_filesize' ));
if ( $upload_max_filesize < $PHPupload_max_filesize_min ) {
2019-01-30 16:18:44 +01:00
ui_print_error_message (
2019-05-14 13:41:21 +02:00
sprintf (
__ ( 'Your PHP has set maximum allowed size for uploaded files limit in %s. To use Update Manager Online, please set it to %s' ),
ini_get ( 'upload_max_filesize' ),
$upload_max_filesize_min
)
2019-01-30 16:18:44 +01:00
);
} else {
2019-05-14 13:41:21 +02:00
$php_settings_fine ++ ;
2017-01-26 14:54:26 +01:00
}
2016-09-22 11:12:19 +02:00
2019-05-14 13:41:21 +02:00
// Verify registry.
if ( update_manager_verify_registration () === false ) {
ui_require_css_file ( 'register' );
registration_wiz_modal ( false , true , 'location.reload()' );
ui_print_error_message (
__ ( 'Update Manager Online requires registration' )
);
2019-04-24 12:45:07 +02:00
} else {
2019-05-14 13:41:21 +02:00
// Console registered.
$current_package = update_manager_get_current_package ();
if ( ! enterprise_installed ()) {
$open = true ;
}
// Translators: Do not translade Update Manager, it's the name of the program.
if ( is_metaconsole ()) {
echo " <style type='text/css' media='screen'>
@ import 'styles/meta_pandora.css' ;
</ style > " ;
}
if ( is_metaconsole ()) {
$baseurl = ui_get_full_url ( false , false , false , false );
echo ' <link rel="stylesheet" type="text/css" href="' . $baseurl . '/godmode/update_manager/update_manager.css">' ;
echo " <div id='box_online' class='box_online_meta'> " ;
} else {
echo " <div id='box_online'> " ;
}
if ( $php_settings_fine >= $PHP_SETTINGS_REQUIRED ) {
echo " <span class='loading' style='font-size:18pt;'> " ;
echo " <img src='images/wait.gif' /> " ;
echo '</span>' ;
}
echo '<p style="font-weight: 600;">' . __ ( 'The latest version of package installed is:' ) . '</p>' ;
if ( $open ) {
echo '<div id="pkg_version" style="font-size:40pt;">' . $build_version . '</div>' ;
} else {
echo '<div id="pkg_version">' . $current_package . '</div>' ;
}
echo " <div class='checking_package' style='font-size:18pt;width:100%; display: none;'> " ;
echo __ ( 'Checking for the newest package.' );
echo '</div>' ;
echo " <div class='downloading_package' style='font-size:18pt;width:100%; display: none;'> " ;
echo __ ( 'Downloading for the newest package.' );
echo '</div>' ;
echo " <div class='content'></div> " ;
echo " <div class='progressbar' style='display: none;'><img class='progressbar_img' src='' /></div> " ;
2019-01-30 16:18:44 +01:00
/*
2019-05-14 13:41:21 +02:00
* -------------------------------------------------------------------------
* Hello there ! : )
* We added some of what seems to be " buggy " messages to the openSource
* version recently . This is not to force open - source users to move to the
* enterprise version , this is just to inform people using Pandora FMS open
* source that it requires skilled people to maintain and keep it running
* smoothly without professional support . This does not imply open - source
* version is limited in any way . If you check the recently added code , it
* contains only warnings and messages , no limitations except one :
* we removed the option to add custom logo in header .
*
* In the Update Manager section , it warns about the ' danger’ of applying
* automated updates without a proper backup , remembering in the process
* that the Enterprise version comes with a human - tested package .
*
* Maintaining an OpenSource version with more than 500 agents is not so
* easy , that ' s why someone using a Pandora with 8000 agents should consider
* asking for support . It ' s not a joke , we know of many setups with a huge
* number of agents , and we hate to hear that “its becoming unstable and
* slow” : (
*
* You can of course remove the warnings , that ' s why we include the source
* and do not use any kind of trick . And that ' s why we added here this
* comment , to let you know this does not reflect any change in our
* opensource mentality of does the last 14 years .
* -------------------------------------------------------------------------
*/
if ( $open ) {
echo " <div class='update_manager_open'>
< div class = 'update_manager_warning' >
< div >< img src = 'images/icono_info.png' ></ div >
< div >< p > " .__('WARNING: You are just one click away from an automated update. This may result in a damaged system, including loss of data and operativity. Check you have a recent backup. OpenSource updates are automatically created packages, and there is no WARRANTY or SUPPORT. If you need professional support and warranty, please upgrade to Enterprise Version.'). " </ p ></ div >
</ div >
< div style = 'text-align:center; margin-top:10px;' >
< a class = 'update_manager_button_open' href = 'https://pandorafms.com/pandora-fms-enterprise/' target = '_blank' > About Enterprise </ a >
</ div >
</ div > " ;
}
if ( $php_settings_fine >= $PHP_SETTINGS_REQUIRED ) {
$enterprise = enterprise_hook ( 'update_manager_enterprise_main' );
if ( $enterprise == ENTERPRISE_NOT_HOOK ) {
// Open view.
update_manager_main ();
}
?>
< script type = " text/javascript " >
var isopen = " <?php echo $open ; ?> " ;
if ( isopen ){
$ ( document ) . ready ( function () {
$ ( 'body' ) . append ( " <div id='opacidad' style='position:fixed;background:black;opacity:0.6;z-index:1'></div> " );
jQuery . post ( " ajax.php " ,
{
" page " : " general/alert_enterprise " ,
" message " : " infomodal " },
function ( data , status ) {
$ ( " #alert_messages " ) . hide ()
. css ( " opacity " , 1 )
. empty ()
. append ( data )
. show ();
},
" html "
);
return false ;
});
}
</ script >
< ? php
}
2016-11-07 16:54:19 +01:00
}