diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3e19574b32..01f6d0bba8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2014-06-10 Miguel de Dios + + * include/functions_config.php, + include/functions_update_manager.php, index.php, + general/logon_ok.php, extensions/update_manager.php, + godmode/update_manager_xxx/update_manager.online.php: work in the + first version of new update manager. + 2014-06-10 Miguel de Dios * godmode/update_manager_xxx/update_manager.online.php, diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index 4607571e40..8177405958 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -239,7 +239,7 @@ extensions_add_operation_menu_option (__('Update manager'), null, null, "v1r1"); extensions_add_godmode_menu_option (__('Update manager settings'), 'PM', null, null, "v1r1"); extensions_add_main_function ('pandora_update_manager_main'); extensions_add_godmode_function ('pandora_update_manager_godmode'); -extensions_add_login_function ('pandora_update_manager_login'); +//extensions_add_login_function ('pandora_update_manager_login'); pandora_update_manager_install (); diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index c1455460f5..3da0b0ebe9 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -30,12 +30,14 @@ require_once ($config["homedir"] . '/include/functions_graph.php'); ui_print_page_header (__('Welcome to Pandora FMS Web Console')); -if(tags_has_user_acl_tags()) { +if (tags_has_user_acl_tags()) { ui_print_tags_warning(); } -// --------------------------------------------------------------------------- + + +// --------------------------------------------------------------------- // Site news ! -// --------------------------------------------------------------------------- +// --------------------------------------------------------------------- echo '
'; //////////////////NEWS BOARD///////////////////////////// diff --git a/pandora_console/godmode/update_manager_xxx/update_manager.online.php b/pandora_console/godmode/update_manager_xxx/update_manager.online.php index 5151148742..8267487df9 100644 --- a/pandora_console/godmode/update_manager_xxx/update_manager.online.php +++ b/pandora_console/godmode/update_manager_xxx/update_manager.online.php @@ -20,6 +20,13 @@ ui_require_css_file('update_manager', 'godmode/update_manager_xxx/'); require_once("include/functions_update_manager.php"); enterprise_include_once("include/functions_update_manager.php"); +$current_package = 0; +if (isset($config['current_package'])) + $current_package = $config['current_package']; + +echo "

" . sprintf(__("The last version of package installed is: %d"), + $current_package) . "

"; + /* Translators: Do not translade Update Manager, it's the name of the program */ ui_print_info_message( '

' . diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e87acaced6..6fde8733e3 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1181,7 +1181,8 @@ function config_check () { // Check default password for "admin" $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); if ($is_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"){ $config["alert_cnt"]++; $_SESSION["alert_msg"] .= ui_print_error_message( @@ -1303,7 +1304,7 @@ function config_check () { $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.'), + 'message' => __('There is a new update please go to menu Administration and into extensions go to Update Manager for more details.'), 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); } } diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 96c4d55b9d..4f9e39a022 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -40,7 +40,7 @@ function update_manager_get_config_values() { //~ $limit_count = 2; $build_version = "140514"; $pandora_version = "4.1"; - $license = "INTEGRIA-FREE"; + //$license = "INTEGRIA-FREE"; return array( @@ -213,6 +213,47 @@ function update_manager_main() { 'newest_package', + 'license' => $um_config_values['license'], + 'limit_count' => $um_config_values['limit_count'], + 'current_package' => $um_config_values['current_update'], + 'version' => $um_config_values['version'], + 'build' => $um_config_values['build']); + + $curlObj = curl_init(); + curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']); + curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curlObj, CURLOPT_POST, true); + curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params); + curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false); + + $result = curl_exec($curlObj); + $http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE); + curl_close($curlObj); + + + if ($http_status >= 400 && $http_status < 500) { + return false; + } + elseif ($http_status >= 500) { + return false; + } + else { + if ($is_ajax) { + return true; + } + else { + return false; + } + } +} function update_manager_check_online_free_packages ($is_ajax=true) { global $config; diff --git a/pandora_console/index.php b/pandora_console/index.php index ac4d11bdec..f75c1f1446 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -206,7 +206,7 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { || $config['enable_pass_policy_admin'])) && (defined('PANDORA_ENTERPRISE')) && ($config['enable_pass_policy'])) { - include_once(ENTERPRISE_DIR."/include/auth/mysql.php"); + include_once(ENTERPRISE_DIR . "/include/auth/mysql.php"); $blocked = login_check_blocked($nick); @@ -233,7 +233,8 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { //login ok and password has expired require_once ('general/login_page.php'); - db_pandora_audit("Password expired", "Password expired: ".$nick, $nick); + db_pandora_audit("Password expired", + "Password expired: " . $nick, $nick); while (@ob_end_flush ()); exit (""); } @@ -297,10 +298,10 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { //Remove everything that might have to do with people's passwords or logins unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good); - $user_language = get_user_language ($config['id_user']); + $user_language = get_user_language($config['id_user']); $l10n = NULL; - if (file_exists ('./include/languages/'.$user_language.'.mo')) { + if (file_exists ('./include/languages/' . $user_language . '.mo')) { $l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo')); $l10n->load_tables(); } @@ -359,7 +360,19 @@ if ($process_login) { /* Call all extensions login function */ extensions_call_login_function (); + unset($_SESSION['new_update']); + require_once("include/functions_update_manager.php"); + enterprise_include_once("include/functions_update_manager.php"); + + if (enterprise_installed()) { + $result = update_manager_check_online_enterprise_packages_available(); + } + else { + $result = update_manager_check_online_free_packages_available(); + } + if ($result) + $_SESSION['new_update'] = 'new'; //Set the initial global counter for chat. users_get_last_global_counter('session');