From 4cc9bda89b46a604c26dd28a51cc2a0aab814f5b Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 18 Apr 2012 08:08:04 +0000 Subject: [PATCH] 2012-04-18 Juan Manuel Ramon * include/functions_html.php include/styles/pandora.css include/javascript/jquery.pandora.js include/functions_config.php include/functions_ui.php extensions/update_manager.php extensions/update_manager/load_updatemanager.php extensions/update_manager/lib/functions.ajax.php extensions/update_manager/settings.php operation/system_alert.php general/login_page.php godmode/setup/setup.php: Changed layout in modal windows for license information also changed several styles. Merged from branches. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 18 +++++++++ pandora_console/extensions/update_manager.php | 34 ++++++++++++++-- .../update_manager/lib/functions.ajax.php | 24 +++++++++++ .../update_manager/load_updatemanager.php | 29 ++++++++++++-- .../extensions/update_manager/settings.php | 10 ++--- pandora_console/general/login_page.php | 2 +- pandora_console/godmode/setup/setup.php | 40 +++++++++++++------ pandora_console/include/functions_config.php | 38 +++++++++++++++++- pandora_console/include/functions_html.php | 4 ++ pandora_console/include/functions_ui.php | 2 +- .../include/javascript/jquery.pandora.js | 4 +- pandora_console/include/styles/pandora.css | 23 +++++++++-- pandora_console/operation/system_alert.php | 2 - 13 files changed, 193 insertions(+), 37 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b501ac76ad..4aca734950 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2012-04-18 Juan Manuel Ramon + + * include/functions_html.php + include/styles/pandora.css + include/javascript/jquery.pandora.js + include/functions_config.php + include/functions_ui.php + extensions/update_manager.php + extensions/update_manager/load_updatemanager.php + extensions/update_manager/lib/functions.ajax.php + extensions/update_manager/settings.php + operation/system_alert.php + general/login_page.php + godmode/setup/setup.php: Changed layout in modal windows for + license information also changed several styles. + + Merged from branches. + 2012-04-17 Miguel de Dios * include/functions_html.php, extensions/net_tools.php: cleaned diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index 96a656125e..845bdf3895 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -40,11 +40,37 @@ if (is_ajax ()) { } if ($get_license_info) { - - include_once("include/functions_db.php"); enterprise_include_once('include/functions_license.php'); - enterprise_hook('license_show_info'); + // If Pandora enterprise check license + $is_enteprise = enterprise_hook('license_show_info'); + + // If Open show info + if ($is_enteprise === ENTERPRISE_NOT_HOOK){ + $table->width = '98%'; + $table->data = array (); + $table->style = array(); + $table->style[0] = 'text-align: left'; + + echo '
'; + html_print_image('images/noaccess.png', false); + echo '
'; + + $table->data[0][0] = ''.__('Expires').''; + $table->data[0][1] = __('Never'); + $table->data[1][0] = ''.__('Platform Limit').''; + $table->data[1][1] = __('Unlimited'); + $table->data[2][0] = ''.__('Current Platform Count').''; + $count_agents = db_get_value_sql ('SELECT count(*) FROM tagente'); + $table->data[2][1] = $count_agents; + $table->data[3][0] = ''.__('License Mode').''; + $table->data[3][1] = __('Open Source Version'); + + echo '
'; + html_print_table ($table); + echo '
'; + } + } return; @@ -170,7 +196,7 @@ function pandora_update_manager_login () { } } else { - require( + require_once( "extensions/update_manager/lib/functions.ajax.php"); $result = update_pandora_get_packages_online_ajax(false); diff --git a/pandora_console/extensions/update_manager/lib/functions.ajax.php b/pandora_console/extensions/update_manager/lib/functions.ajax.php index 31eb3d8707..6db82933a2 100644 --- a/pandora_console/extensions/update_manager/lib/functions.ajax.php +++ b/pandora_console/extensions/update_manager/lib/functions.ajax.php @@ -14,6 +14,30 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +function check_keygen_online() { + global $config; + + require_once($config["homedir"] . + "/extensions/update_manager/lib/functions.php"); + + global $conf_update_pandora; + if (empty($conf_update_pandora)) + $conf_update_pandora = update_pandora_get_conf(); + + 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"); + + $last = get_parameter('last', 0); + + db_clean_cache(); + $settings = um_db_load_settings (); + return check_keygen ($settings); +} + function update_pandora_get_packages_online_ajax($ajax = true) { global $config; diff --git a/pandora_console/extensions/update_manager/load_updatemanager.php b/pandora_console/extensions/update_manager/load_updatemanager.php index e5cb581281..fbdb645ecc 100644 --- a/pandora_console/extensions/update_manager/load_updatemanager.php +++ b/pandora_console/extensions/update_manager/load_updatemanager.php @@ -25,21 +25,42 @@ if (! extension_loaded ('mysql')) require_once ('lib/libupdate_manager.php'); + +function check_keygen ($settings) { + global $config; + + if ($settings->customer_key != FREE_USER) { + if (! file_exists ($settings->keygen_path)) { + return ui_print_error_message( array('title' => __("Keygen error"), + 'message' => __('Pandora Console updates need a valid keygen file. Keygen file does not exists'), + 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); + } + if (! is_executable ($settings->keygen_path)) { + return ui_print_error_message( array('title' => __("Keygen error"), + 'message' => __('Pandora Console updates need a valid keygen file. Keygen file is not executable'), + 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); + + } + } + + return ''; +} + function get_user_key ($settings) { global $config; if ($settings->customer_key != FREE_USER) { if (! file_exists ($settings->keygen_path)) { - echo '

'; + /*echo '

'; echo __('Keygen file does not exists'); - echo '

'; + echo '';*/ return ''; } if (! is_executable ($settings->keygen_path)) { - echo '

'; + /*echo '

'; echo __('Keygen file is not executable'); - echo '

'; + echo '';*/ return ''; } diff --git a/pandora_console/extensions/update_manager/settings.php b/pandora_console/extensions/update_manager/settings.php index 2b0467e475..a71b8b390c 100644 --- a/pandora_console/extensions/update_manager/settings.php +++ b/pandora_console/extensions/update_manager/settings.php @@ -22,7 +22,7 @@ if (! check_acl ($config['id_user'], 0, 'PM')) { return; } -include ("extensions/update_manager/lib/functions.php"); +include_once ("extensions/update_manager/lib/functions.php"); um_db_connect ('mysql', $config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']); @@ -67,10 +67,10 @@ $table->data = array (); $table->data[0][0] = ''.__('Customer key').''; $table->data[0][1] = html_print_input_text ('keys[customer_key]', $settings->customer_key, '', 40, 255, true); -if (defined('PANDORA_ENTERPRISE')) { - $table->data[0][1] .= ' '.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).''; - $table->data[0][1] .= ''; -} + +$table->data[0][1] .= ' '.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).''; +$table->data[0][1] .= ''; + $table->data[1][0] = ''.__('Update server host').''; $table->data[1][1] = html_print_input_text ('keys[update_server_host]', $settings->update_server_host, '', 20, 255, true); diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index c53856727c..f98fb7b02f 100644 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -88,7 +88,7 @@ if (isset ($login_failed)) { echo '
'; echo '
'; - echo '' . $config["auth_error"] . ''; + echo '' . $config["auth_error"] . ''; echo '
'; echo '
'; diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 4042d3bd0a..4c00facd2c 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -52,8 +52,11 @@ enterprise_include ('godmode/setup/setup.php'); ui_print_page_header (__('General configuration'), "", false, "", true); -$table->width = '98%'; +$table->width = '100%'; $table->data = array (); +$table->size = array(); +$table->size[0] = '45%'; +$table->size[1] = '55%'; // Current config["language"] could be set by user, not taken from global setup ! @@ -90,12 +93,12 @@ $sources["sql"] = __('Database'); $table->data[9][1] = html_print_select ($sources, 'timesource', $config["timesource"], '', '', '', true); $table->data[10][0] = __('Automatic check for updates'); -$table->data[10][1] = __('Yes').' '.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'  '; -$table->data[10][1] .= __('No').' '.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true); +$table->data[10][1] = __('Yes').'   '.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'  '; +$table->data[10][1] .= __('No').'   '.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true); $table->data[11][0] = __('Enforce https'); -$table->data[11][1] = __('Yes').' '.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to Pandora FMS Console. Do you want to continue?') . "')) return false", '', true) .'  '; -$table->data[11][1] .= __('No').' '.html_print_radio_button ('https', 0, '', $config["https"], true); +$table->data[11][1] = __('Yes').'   '.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to Pandora FMS Console. Do you want to continue?') . "')) return false", '', true) .'  '; +$table->data[11][1] .= __('No').'   '.html_print_radio_button ('https', 0, '', $config["https"], true); $table->data[14][0] = __('Attachment store') . ui_print_help_tip (__("Directory where temporary data is stored."), true); $table->data[14][1] = html_print_input_text ('attachment_store', $config["attachment_store"], '', 50, 255, true); @@ -109,12 +112,12 @@ $table->data[16][0] = __('API password') . $table->data[16][1] = html_print_input_text('api_password', $config['api_password'], '', 25, 255, true); $table->data[17][0] = __('Enable GIS features in Pandora Console'); -$table->data[17][1] = __('Yes').' '.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'  '; -$table->data[17][1] .= __('No').' '.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); +$table->data[17][1] = __('Yes').'   '.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'  '; +$table->data[17][1] .= __('No').'   '.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); $table->data[18][0] = __('Enable Integria incidents in Pandora Console'); -$table->data[18][1] = __('Yes').' '.html_print_radio_button ('integria_enabled', 1, '', $config["integria_enabled"], true).'  '; -$table->data[18][1] .= __('No').' '.html_print_radio_button ('integria_enabled', 0, '', $config["integria_enabled"], true); +$table->data[18][1] = __('Yes').'   '.html_print_radio_button ('integria_enabled', 1, '', $config["integria_enabled"], true).'  '; +$table->data[18][1] .= __('No').'   '.html_print_radio_button ('integria_enabled', 0, '', $config["integria_enabled"], true); $table->data[19][0] = __('Enable Netflow'); $table->data[19][1] = __('Yes').' '.html_print_radio_button ('activate_netflow', 1, '', $config["activate_netflow"], true).'  '; @@ -201,6 +204,15 @@ $table->data[26][0] = __('Sound for Monitor warning'); $table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true); $table->data[26][1] .= ' ' . html_print_image("images/control_play.png", true, array("id" => "button_sound_warning", "style" => "vertical-align: middle;", "width" => "16")) . ''; $table->data[26][1] .= '
'; + +$table->data[27][0] = __('License information'); +$license_info = db_get_value_sql ('SELECT value FROM tupdate_settings WHERE `key`="customer_key"'); +if ($license_info === false) + $license_info = ''; +$table->data[27][1] = html_print_input_text ('license_info_key', $license_info, '', 40, 255, true); +$table->data[27][1] .= ' '.html_print_image('images/lock.png', true, array('class' => 'bot', 'title' => __('License info'))).''; +$table->data[27][1] .= ''; + ?> '; -html_print_input_hidden ('update_config', 1); -html_print_table ($table); +echo "
"; +echo "" . __('General options') . ""; + html_print_input_hidden ('update_config', 1); + html_print_table ($table); +echo "
"; + enterprise_hook ('setup'); echo '
'; html_print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"'); echo '
'; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2167322dcf..983ec6578b 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -215,6 +215,18 @@ function config_update_config () { $config['relative_path'] = get_parameter('relative_path', $config['relative_path']); } + # Update of Pandora FMS license + $update_manager_installed = db_get_value('value', 'tconfig', 'token', 'update_manager_installed'); + + if ($update_manager_installed == 1) { + + if (isset($_POST['license_info_key'])){ + $values = array("value" => get_parameter('license_info_key')); + $where = array("key" => 'customer_key'); + $update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where); + } + } + } /** @@ -726,10 +738,34 @@ 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 operation and into extensions go to Update Manager for more details.'), 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); } } + + if (enterprise_installed()) { + um_db_connect ('mysql', $config['dbhost'], $config['dbuser'], + $config['dbpass'], $config['dbname']); + + $settings = um_db_load_settings (); + + $result_check_keygen = check_keygen($settings); + + if (!empty($result_check_keygen)) { + $config["alert_cnt"]++; + $_SESSION["alert_msg"] .= $result_check_keygen; + } + } + else { + require_once("extensions/update_manager/lib/functions.ajax.php"); + + $result_check_keygen = check_keygen_online(); + + if (!empty($result_check_keygen)) { + $config["alert_cnt"]++; + $_SESSION["alert_msg"] .= $result_check_keygen; + } + } } ?> diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 06b5676f8d..aa64c34b61 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -837,6 +837,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes = * $table->titlestyle - Title style * $table->titleclass - Title class * $table->styleTable - Table style + * $table->caption - Table title * @param bool Whether to return an output string or echo now * * @return string HTML code if return parameter is true. @@ -954,6 +955,9 @@ function html_print_table (&$table, $return = false) { $output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"'; $output .= ' border="'.$table->border.'" class="'.$table->class.'" id="'.$tableid.'">'; $countcols = 0; + if (!empty($table->caption)) { + $output .= '

' . $table->caption . '

'; + } if (!empty ($table->head)) { $countcols = count ($table->head); $output .= ''; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index aa993a7966..7d53edb581 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -215,7 +215,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa - ' . $text_message . ' + ' . $text_message . ' '; diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index f8b30ea95f..51a46d9460 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -91,7 +91,7 @@ $(document).ready (function () { resizable: true, draggable: true, modal: true, - height: 200, + height: 250, width: 600, overlay: { opacity: 0.5, @@ -125,7 +125,7 @@ $(document).ready (function () { }, bgiframe: jQuery.browser.msie, width: 500, - height: 180 + height: 190 }) .show (); }, diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 55884fa10a..78d9578278 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1175,11 +1175,26 @@ ol.steps li.visited { } fieldset { - border: 2px solid #E9F3D2; - padding: 0 0 0 10px; - width: 90%; - margin-bottom: 15px; + background-color:#fafafa; + border: 1px solid #f2f2f2; + padding:0.5em; + margin-top:0.5em; + margin-right: -1px; + margin-bottom:1em; + position:relative; } +fieldset legend { + font-size:1.3em; + font-weight:bold; + #color:#3f4e2f; + color:#000; + #top:-2em; +} + +fieldset .databox { + border: 0px solid; +} + fieldset legend span, span#latest_value { font-style:italic; diff --git a/pandora_console/operation/system_alert.php b/pandora_console/operation/system_alert.php index e02e593a78..33fa130e94 100644 --- a/pandora_console/operation/system_alert.php +++ b/pandora_console/operation/system_alert.php @@ -2,8 +2,6 @@ // TODO: Poner esto resizable y dragable: http://jqueryui.com/demos/dialog -echo "
"; echo $_SESSION["alert_msg"]; -echo "
"; ?>