From 268da0caaa5aa42e44eaded068cbd54909567707 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Fri, 18 Jan 2013 17:41:00 +0000 Subject: [PATCH] 2013-01-18 Juan Manuel Ramon * include/functions_menu.php include/functions_config.php godmode/menu.php godmode/setup/setup_general.php godmode/setup/setup_netflow.php godmode/setup/setup.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/setup_visuals.php: Changed style views to tabs. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7510 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 + pandora_console/godmode/menu.php | 22 +- pandora_console/godmode/setup/performance.php | 3 - pandora_console/godmode/setup/setup.php | 353 +++------------ pandora_console/godmode/setup/setup_auth.php | 2 - .../godmode/setup/setup_general.php | 322 +++++++++++++ .../godmode/setup/setup_netflow.php | 3 - .../godmode/setup/setup_visuals.php | 36 +- pandora_console/include/functions_config.php | 423 +++++++++--------- pandora_console/include/functions_menu.php | 5 +- 10 files changed, 656 insertions(+), 525 deletions(-) create mode 100644 pandora_console/godmode/setup/setup_general.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 06d90f4dca..0f1fbb213e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-01-18 Juan Manuel Ramon + + * include/functions_menu.php + include/functions_config.php + godmode/menu.php + godmode/setup/setup_general.php + godmode/setup/setup_netflow.php + godmode/setup/setup.php + godmode/setup/performance.php + godmode/setup/setup_auth.php + godmode/setup/setup_visuals.php: Changed style views to tabs. + 2013-01-18 Sergio Martin * include/functions_config.php diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 198eb7c9b0..9225adae2d 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -201,26 +201,19 @@ if (check_acl ($config['id_user'], 0, "PM")) { // Setup $menu_godmode["gsetup"]["text"] = __('Setup'); - $menu_godmode["gsetup"]["sec2"] = "godmode/setup/setup"; + $menu_godmode["gsetup"]["sec2"] = "godmode/setup/setup§ion=general"; $menu_godmode["gsetup"]["id"] = "god-setup"; $sub = array (); - $sub["godmode/setup/setup_auth"]["text"] = __('Authentication'); - $sub["godmode/setup/performance"]["text"] = __('Performance'); - $sub["godmode/setup/setup_visuals"]["text"] = __('Visual styles'); $sub["godmode/setup/file_manager"]["text"] = __('File manager'); - if ($config['activate_netflow']) - $sub["godmode/setup/setup_netflow"]["text"] = __('Netflow'); - if ($config['log_collector'] == 1) { - enterprise_hook ('log_collector_submenu'); - } + if ($config['activate_gis']) $sub["godmode/setup/gis"]["text"] = __('Map conections GIS'); $sub["godmode/setup/links"]["text"] = __('Links'); $sub["godmode/setup/news"]["text"] = __('Site news'); $sub["godmode/setup/os"]["text"] = __('Edit OS'); - enterprise_hook ('historydb_submenu'); + enterprise_hook ('enterprise_acl_submenu'); enterprise_hook ('skins_submenu'); $sub["extras/pandora_diag"]["text"] = __('Diagnostic info'); @@ -228,15 +221,6 @@ if (check_acl ($config['id_user'], 0, "PM")) { $menu_godmode["gsetup"]["sub"] = $sub; } -if (check_acl ($config['id_user'], 0, "AW")) { - if ($config['activate_netflow']) { - //Netflow - $menu_godmode["netf"]["text"] = __('Netflow filters'); - $menu_godmode["netf"]["sec2"] = "godmode/netflow/nf_edit"; - $menu_godmode["netf"]["id"] = "god-netflow"; - } -} - if (check_acl ($config['id_user'], 0, "DM")) { $menu_godmode["gdbman"]["text"] = __('DB maintenance'); $menu_godmode["gdbman"]["sec2"] = "godmode/db/db_main"; diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 4586c13baa..e28998fdf3 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -36,9 +36,6 @@ enterprise_include_once ('godmode/setup/setup.php'); */ -// Header -ui_print_page_header (__('Performance configuration'), "", false, "", true); - $table->width = '98%'; $table->data = array (); diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 1d7133f468..b35c13ea27 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -50,6 +50,7 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us return; } // Load enterprise extensions +enterprise_include_once ('include/functions_setup.php'); enterprise_include_once ('godmode/setup/setup.php'); /* @@ -61,301 +62,85 @@ enterprise_include_once ('godmode/setup/setup.php'); to add it there. */ -// Header -ui_print_page_header (__('General configuration'), "", false, "", true); +// Gets section to jump to another section +$section = (string) get_parameter ("section", "general"); +$buttons = array(); -$table->width = '100%'; -$table->data = array (); -$table->size = array(); -$table->size[0] = '30%'; -$table->size[1] = '70%'; +// Draws header +$buttons['general'] = array('active' => false, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('General'))) . ''); -// Current config["language"] could be set by user, not taken from global setup ! +$buttons = setup_enterprise_add_Tabs($buttons); -switch ($config["dbtype"]) { - case "mysql": - $current_system_lang = db_get_sql ('SELECT `value` - FROM tconfig WHERE `token` = "language"'); - break; - case "postgresql": - $current_system_lang = db_get_sql ('SELECT "value" - FROM tconfig WHERE "token" = \'language\''); - break; - case "oracle": - $current_system_lang = db_get_sql ('SELECT value - FROM tconfig WHERE token = \'language\''); - break; -} - -if ($current_system_lang == "") { - $current_system_lang = "en"; -} - -$table->data[0][0] = __('Language code for Pandora'); -$table->data[0][1] = html_print_select_from_sql ( - 'SELECT id_language, name FROM tlanguage', - 'language', $current_system_lang , '', '', '', true); - -$table->data[1][0] = __('Remote config directory') . - ui_print_help_tip (__("Directory where agent remote configuration is stored."), true); - -$table->data[1][1] = html_print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); - -$table->data[6][0] = __('Auto login (hash) password'); -$table->data[6][1] = html_print_input_text ('loginhash_pwd', $config["loginhash_pwd"], '', 15, 15, true); - -$table->data[9][0] = __('Time source') . ui_print_help_icon ("timesource", true); -$sources["system"] = __('System'); -$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[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[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); - -$table->data[15][0] = __('IP list with API access') . ui_print_help_icon ("ip_api_list", true); -if (isset($_POST["list_ACL_IPs_for_API"])) { - $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); -} -else { - $list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])); -} -$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); - -$table->data[16][0] = __('API password') . - ui_print_help_tip (__("Please be careful if you put a password put https access."), true); -$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[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[19][0] = __('Enable Netflow'); -$table->data[19][1] = __('Yes').' '.html_print_radio_button ('activate_netflow', 1, '', $config["activate_netflow"], true).'  '; -$table->data[19][1] .= __('No').' '.html_print_radio_button ('activate_netflow', 0, '', $config["activate_netflow"], true); - -if ($config["integria_enabled"]) { - require_once('include/functions_incidents.php'); - $invent = incidents_call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories"); - $bad_input = false; - // Wrong connection to api, bad password - if (empty($invent)) { - $bad_input = true; - } - - $inventories = array(); - // Right connection but theres is no inventories - if ($invent == 'false') { - unset($invent); - $invent = array(); - } - // Checks if URL is right - else { - $invent = explode("\n",$invent); - } - // Wrong URL - if ((strripos($config['integria_url'], '.php') !== false)) { - $bad_input = true; - } - // Check page result and detect errors - else { - foreach ($invent as $inv) { - if ((stristr($inv, 'ERROR 404') !== false) - OR (stristr($inv, 'Status 404') !== false) - OR (stristr($inv, 'Internal Server Error') !== false)) { - $inventories[""] = __('None'); - $bad_input = true; - break; - } - } - } - $table->data[20][0] = __('Integria URL') . ui_print_help_icon ("integria_url", true); - $table->data[20][1] = html_print_input_text ('integria_url', $config["integria_url"], '', 25, 255, true); - // If something goes wrong - if ($bad_input){ - $table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect'))); - } - - $table->data[21][0] = __('Integria API password'); - $table->data[21][1] = html_print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true); - - if (!$bad_input) { - foreach ($invent as $inv) { - if ($inv == '') { - continue; - } - $invexp = explode(',',$inv); - if (substr($invexp[1], 0, 1) == '"' - && substr($invexp[1], strlen($invexp[1])-1, 1) == '"') { - $invexp[1] = substr($invexp[1], 1, strlen($invexp[1])-2); - } +$buttons['auth'] = array('active' => false, + 'text' => '' . + html_print_image("images/books.png", true, array ("title" => __('Authentication'))) . ''); - $inventories[$invexp[0]] = $invexp[1]; - } - } - $table->data[22][0] = __('Integria inventory'); - $table->data[22][1] = html_print_select($inventories, 'integria_inventory', $config["integria_inventory"], '', '', '', true); -} +$buttons['perf'] = array('active' => false, + 'text' => '' . + html_print_image("images/up.png", true, array ("title" => __('Performance'))) . ''); + +$buttons['vis'] = array('active' => false, + 'text' => '' . + html_print_image("images/chart_curve.png", true, array ("title" => __('Visual styles'))) . ''); -$zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarctica' => __('Antarctica'), 'Arctic' => __('Arctic'), 'Asia' => __('Asia'), 'Atlantic' => __('Atlantic'), 'Australia' => __('Australia'), 'Europe' => __('Europe'), 'Indian' => __('Indian'), 'Pacific' => __('Pacific'), 'UTC' => __('UTC')); - -$zone_selected = get_parameter('zone'); -if ($zone_selected == "") { - if ($config["timezone"] != "") { - list($zone) = explode("/", $config["timezone"]); - $zone_selected = $zone; - } - else { - $zone_selected = 'Europe'; +if (check_acl ($config['id_user'], 0, "AW")) { + if ($config['activate_netflow']) { + $buttons['net'] = array('active' => false, + 'text' => '' . + html_print_image("images/networkmap/so_cisco_new.png", true, array ("title" => __('Netflow'))) . ''); } } -$timezones = timezone_identifiers_list(); -foreach ($timezones as $timezone) { - if (strpos($timezone, $zone_selected) !== false) { - $timezone_n[$timezone] = $timezone; - } +$subpage = setup_enterprise_add_subsection_main($section, $buttons); + +switch ($section) { + case 'general': + $buttons['general']['active'] = true; + $subpage = ' » ' . __('General'); + break; + case 'auth': + $buttons['auth']['active'] = true; + $subpage = ' » ' . __('Authentication'); + break; + case 'perf': + $buttons['perf']['active'] = true; + $subpage = ' » ' . __('Performance'); + break; + case 'vis': + $buttons['vis']['active'] = true; + $subpage = ' » ' . __('Visual styles'); + break; + case 'net': + $buttons['net']['active'] = true; + $subpage = ' » ' . __('Netflow'); + break; } -$table->data[23][0] = __('Timezone setup'); -$table->data[23][1] = html_print_input_text_extended ('timezone_text', $config["timezone"], 'text-timezone_text', '', 25, 25, false, '', 'readonly', true); -$table->data[23][1] .= ''.html_print_image ('images/pencil.png', true, array ('title' => __('Change timezone'))).''; -$table->data[23][1] .= "  ". html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true); -$table->data[23][1] .= "  ". html_print_select($timezone_n, 'timezone', $config["timezone"], '', '', '', true); - - -$sounds = get_sounds(); -$table->data[24][0] = __('Sound for Alert fired'); -$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true); -$table->data[24][1] .= ' ' . html_print_image("images/control_play.png", true, array("id" => "button_sound_alert", "style" => "vertical-align: middle;", "width" => "16")) . ''; -$table->data[24][1] .= '
'; - -$table->data[25][0] = __('Sound for Monitor critical'); -$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true); -$table->data[25][1] .= ' ' . html_print_image("images/control_play.png", true, array("id" => "button_sound_critical", "style" => "vertical-align: middle;", "width" => "16")) . ''; -$table->data[25][1] .= '
'; - -$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 ('value', 'tupdate_settings', '`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] .= ''; - -$table->data[28][0] = __('Public URL'); -$table->data[28][0] .= ui_print_help_tip(__('Set this value when your PandoraFMS across inverse proxy or for example with mod_proxy of Apache.'), true); -$table->data[28][1] = html_print_input_text ('public_url', $config['public_url'], '', 40, 255, true); - -$table->data[29][0] = __('Referer security'); -$table->data[29][0] .= ui_print_help_tip(__('When it is set as "yes" in some important sections check if the user have gone from url Pandora.'), true); -$table->data[29][1] = __('Yes') . '   ' . - html_print_radio_button ('referer_security', 1, '', $config["referer_security"], true) . - '  '; -$table->data[29][1] .= __('No') . '   ' . - html_print_radio_button ('referer_security', 0, '', $config["referer_security"], true); +// Header +ui_print_page_header (__('Configuration') . $subpage, "", false, "", true, $buttons); +switch ($section) { + case "general": + require_once($config['homedir'] . "/godmode/setup/setup_general.php"); + break; + case "auth": + require_once($config['homedir'] . "/godmode/setup/setup_auth.php"); + break; + case "perf": + require_once($config['homedir'] . "/godmode/setup/performance.php"); + break; + case "net": + require_once($config['homedir'] . "/godmode/setup/setup_netflow.php"); + break; + case "vis": + require_once($config['homedir'] . "/godmode/setup/setup_visuals.php"); + break; + default: + enterprise_hook('setup_enterprise_select_tab', array($section)); + break; +} ?> - -'; -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 '
'; -echo ''; - -function get_sounds() { - global $config; - - $return = array(); - - $files = scandir($config['homedir'] . '/include/sounds'); - - foreach ($files as $file) { - if (strstr($file, 'wav') !== false) { - $return['include/sounds/' . $file] = $file; - } - } - - return $return; -} -?> diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 7ff1cffcea..81447afb9e 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -29,8 +29,6 @@ include_once($config['homedir'] . "/include/functions_profile.php"); // Load enterprise extensions enterprise_include ('godmode/setup/setup_auth.php'); -// Header -ui_print_page_header (__('Authentication configuration'), "", false, "", true); $table->data = array (); $table->width = '98%'; diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php new file mode 100644 index 0000000000..bc1bbcabe7 --- /dev/null +++ b/pandora_console/godmode/setup/setup_general.php @@ -0,0 +1,322 @@ +width = '100%'; +$table->data = array (); +$table->size = array(); +$table->size[0] = '30%'; +$table->size[1] = '70%'; + +// Current config["language"] could be set by user, not taken from global setup ! + +switch ($config["dbtype"]) { + case "mysql": + $current_system_lang = db_get_sql ('SELECT `value` + FROM tconfig WHERE `token` = "language"'); + break; + case "postgresql": + $current_system_lang = db_get_sql ('SELECT "value" + FROM tconfig WHERE "token" = \'language\''); + break; + case "oracle": + $current_system_lang = db_get_sql ('SELECT value + FROM tconfig WHERE token = \'language\''); + break; +} + +if ($current_system_lang == "") { + $current_system_lang = "en"; +} + +$table->data[0][0] = __('Language code for Pandora'); +$table->data[0][1] = html_print_select_from_sql ( + 'SELECT id_language, name FROM tlanguage', + 'language', $current_system_lang , '', '', '', true); + +$table->data[1][0] = __('Remote config directory') . + ui_print_help_tip (__("Directory where agent remote configuration is stored."), true); + +$table->data[1][1] = html_print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); + +$table->data[6][0] = __('Auto login (hash) password'); +$table->data[6][1] = html_print_input_text ('loginhash_pwd', $config["loginhash_pwd"], '', 15, 15, true); + +$table->data[9][0] = __('Time source') . ui_print_help_icon ("timesource", true); +$sources["system"] = __('System'); +$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[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[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); + +$table->data[15][0] = __('IP list with API access') . ui_print_help_icon ("ip_api_list", true); +if (isset($_POST["list_ACL_IPs_for_API"])) { + $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); +} +else { + $list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])); +} +$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); + +$table->data[16][0] = __('API password') . + ui_print_help_tip (__("Please be careful if you put a password put https access."), true); +$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[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[19][0] = __('Enable Netflow'); +$table->data[19][1] = __('Yes').' '.html_print_radio_button ('activate_netflow', 1, '', $config["activate_netflow"], true).'  '; +$table->data[19][1] .= __('No').' '.html_print_radio_button ('activate_netflow', 0, '', $config["activate_netflow"], true); + +if ($config["integria_enabled"]) { + require_once('include/functions_incidents.php'); + $invent = incidents_call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories"); + $bad_input = false; + // Wrong connection to api, bad password + if (empty($invent)) { + $bad_input = true; + } + + $inventories = array(); + // Right connection but theres is no inventories + if ($invent == 'false') { + unset($invent); + $invent = array(); + } + // Checks if URL is right + else { + $invent = explode("\n",$invent); + } + // Wrong URL + if ((strripos($config['integria_url'], '.php') !== false)) { + $bad_input = true; + } + // Check page result and detect errors + else { + foreach ($invent as $inv) { + if ((stristr($inv, 'ERROR 404') !== false) + OR (stristr($inv, 'Status 404') !== false) + OR (stristr($inv, 'Internal Server Error') !== false)) { + $inventories[""] = __('None'); + $bad_input = true; + break; + } + } + } + $table->data[20][0] = __('Integria URL') . ui_print_help_icon ("integria_url", true); + $table->data[20][1] = html_print_input_text ('integria_url', $config["integria_url"], '', 25, 255, true); + // If something goes wrong + if ($bad_input){ + $table->data[20][1] .= html_print_image('images/error.png', true, array('title' => __('URL and/or Integria password are incorrect'))); + } + + $table->data[21][0] = __('Integria API password'); + $table->data[21][1] = html_print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true); + + if (!$bad_input) { + foreach ($invent as $inv) { + if ($inv == '') { + continue; + } + $invexp = explode(',',$inv); + if (substr($invexp[1], 0, 1) == '"' + && substr($invexp[1], strlen($invexp[1])-1, 1) == '"') { + $invexp[1] = substr($invexp[1], 1, strlen($invexp[1])-2); + } + + $inventories[$invexp[0]] = $invexp[1]; + } + } + $table->data[22][0] = __('Integria inventory'); + $table->data[22][1] = html_print_select($inventories, 'integria_inventory', $config["integria_inventory"], '', '', '', true); +} + +$zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarctica' => __('Antarctica'), 'Arctic' => __('Arctic'), 'Asia' => __('Asia'), 'Atlantic' => __('Atlantic'), 'Australia' => __('Australia'), 'Europe' => __('Europe'), 'Indian' => __('Indian'), 'Pacific' => __('Pacific'), 'UTC' => __('UTC')); + +$zone_selected = get_parameter('zone'); +if ($zone_selected == "") { + if ($config["timezone"] != "") { + list($zone) = explode("/", $config["timezone"]); + $zone_selected = $zone; + } + else { + $zone_selected = 'Europe'; + } +} + +$timezones = timezone_identifiers_list(); +foreach ($timezones as $timezone) { + if (strpos($timezone, $zone_selected) !== false) { + $timezone_n[$timezone] = $timezone; + } +} + +$table->data[23][0] = __('Timezone setup'); +$table->data[23][1] = html_print_input_text_extended ('timezone_text', $config["timezone"], 'text-timezone_text', '', 25, 25, false, '', 'readonly', true); +$table->data[23][1] .= ''.html_print_image ('images/pencil.png', true, array ('title' => __('Change timezone'))).''; +$table->data[23][1] .= "  ". html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true); +$table->data[23][1] .= "  ". html_print_select($timezone_n, 'timezone', $config["timezone"], '', '', '', true); + + +$sounds = get_sounds(); +$table->data[24][0] = __('Sound for Alert fired'); +$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true); +$table->data[24][1] .= ' ' . html_print_image("images/control_play.png", true, array("id" => "button_sound_alert", "style" => "vertical-align: middle;", "width" => "16")) . ''; +$table->data[24][1] .= '
'; + +$table->data[25][0] = __('Sound for Monitor critical'); +$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true); +$table->data[25][1] .= ' ' . html_print_image("images/control_play.png", true, array("id" => "button_sound_critical", "style" => "vertical-align: middle;", "width" => "16")) . ''; +$table->data[25][1] .= '
'; + +$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 ('value', 'tupdate_settings', '`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] .= ''; + +$table->data[28][0] = __('Public URL'); +$table->data[28][0] .= ui_print_help_tip(__('Set this value when your PandoraFMS across inverse proxy or for example with mod_proxy of Apache.'), true); +$table->data[28][1] = html_print_input_text ('public_url', $config['public_url'], '', 40, 255, true); + +$table->data[29][0] = __('Referer security'); +$table->data[29][0] .= ui_print_help_tip(__('When it is set as "yes" in some important sections check if the user have gone from url Pandora.'), true); +$table->data[29][1] = __('Yes') . '   ' . + html_print_radio_button ('referer_security', 1, '', $config["referer_security"], true) . + '  '; +$table->data[29][1] .= __('No') . '   ' . + html_print_radio_button ('referer_security', 0, '', $config["referer_security"], true); + + +echo '
'; + +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 '
'; +echo '
'; + + +?> + + diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index d6252b5372..82f9a18e9a 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -30,9 +30,6 @@ if (! check_acl ($config["id_user"], 0, "IR")) { return; } -//Header -ui_print_page_header (__('Netflow Manager'), "images/networkmap/so_cisco_new.png", false, "", true); - $update = (bool) get_parameter ("update"); $table->width = '70%'; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 2fcdd97759..ef5c234f5b 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -39,9 +39,6 @@ enterprise_include ('godmode/setup/setup_visuals.php'); require_once ('include/functions_themes.php'); require_once ('include/functions_gis.php'); -// Header -ui_print_page_header (__('Visual configuration'), "", false, "", true); - $table->width = '98%'; $table->data = array (); @@ -309,4 +306,37 @@ $(document).ready (function () { $('#submit-update_button').trigger('click'); }); }); + +function changeIcons() { + icon = $("#gis_default_icon :selected").val(); + + $("#icon_without_status").attr("src", "images/spinner.png"); + $("#icon_default").attr("src", "images/spinner.png"); + $("#icon_ok").attr("src", "images/spinner.png"); + $("#icon_bad").attr("src", "images/spinner.png"); + $("#icon_warning").attr("src", "images/spinner.png"); + + if (icon.length == 0) { + $("#icon_without_status").attr("style", "display:none;"); + $("#icon_default").attr("style", "display:none;"); + $("#icon_ok").attr("style", "display:none;"); + $("#icon_bad").attr("style", "display:none;"); + $("#icon_warning").attr("style", "display:none;"); + } + else { + $("#icon_without_status").attr("src", "" + icon + ".default.png"); + $("#icon_default").attr("src", "" + icon + ".default.png"); + $("#icon_ok").attr("src", "" + icon + ".ok.png"); + $("#icon_bad").attr("src", "" + icon + ".bad.png"); + $("#icon_warning").attr("src", "" + icon + ".warning.png"); + $("#icon_without_status").attr("style", ""); + $("#icon_default").attr("style", ""); + $("#icon_ok").attr("style", ""); + $("#icon_bad").attr("style", ""); + $("#icon_warning").attr("style", ""); + } + + //$("#icon_default").attr("src", "" + icon + +} + diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index a2d97dcccd..6fbcf391c0 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -89,222 +89,225 @@ function config_update_config () { $sec2 = get_parameter_get('sec2'); switch($sec2) { case 'godmode/setup/setup': + $section_setup = get_parameter ('section'); //////// MAIN SETUP - config_update_value ('language', (string) get_parameter ('language')); - config_update_value ('remote_config', (string) get_parameter ('remote_config')); - config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd')); - config_update_value ('timesource', (string) get_parameter ('timesource')); - config_update_value ('autoupdate', (bool) get_parameter ('autoupdate')); - config_update_value ('https', (bool) get_parameter ('https')); - config_update_value ('attachment_store', (string) get_parameter ('attachment_store')); - config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')); - config_update_value ('api_password', get_parameter('api_password')); - config_update_value ('activate_gis', (bool) get_parameter ('activate_gis')); - config_update_value ('integria_enabled', get_parameter ('integria_enabled')); - config_update_value ('integria_inventory', get_parameter ('integria_inventory')); - config_update_value ('integria_api_password', get_parameter ('integria_api_password')); - config_update_value ('integria_url', get_parameter ('integria_url')); - $timezone = (string) get_parameter ('timezone'); - if ($timezone != "") { - config_update_value ('timezone', $timezone); - } - config_update_value ('sound_alert', get_parameter('sound_alert')); - config_update_value ('sound_critical', get_parameter('sound_critical')); - config_update_value ('sound_warning', get_parameter('sound_warning')); - # 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); - } - } - if(isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { - config_update_value ('trap2agent', (string) get_parameter ('trap2agent')); - config_update_value ('acl_enterprise', get_parameter ('acl_enterprise')); - config_update_value ('metaconsole', get_parameter ('metaconsole')); - config_update_value ('collection_max_size', get_parameter('collection_max_size')); - config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow')); - config_update_value ('event_replication', (int)get_parameter('event_replication')); - config_update_value ('replication_interval', (int)get_parameter('replication_interval')); - config_update_value ('replication_dbhost', (string)get_parameter('replication_dbhost')); - config_update_value ('replication_dbname', (string)get_parameter('replication_dbname')); - config_update_value ('replication_dbuser', (string)get_parameter('replication_dbuser')); - config_update_value ('replication_dbpass', (string)get_parameter('replication_dbpass')); - config_update_value ('replication_dbport', (string)get_parameter('replication_dbport')); - config_update_value ('replication_mode', (string)get_parameter('replication_mode')); - config_update_value ('public_url', get_parameter('public_url')); - config_update_value ('referer_security', get_parameter('referer_security')); - - config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy')); - config_update_value ('pass_size', get_parameter('pass_size')); - config_update_value ('pass_expire', get_parameter('pass_expire')); - config_update_value ('first_login', get_parameter('first_login')); - config_update_value ('mins_fail_pass', get_parameter('mins_fail_pass')); - config_update_value ('number_attempts', get_parameter('number_attempts')); - config_update_value ('pass_needs_numbers', get_parameter('pass_needs_numbers')); - config_update_value ('pass_needs_symbols', get_parameter('pass_needs_symbols')); - config_update_value ('enable_pass_policy_admin', get_parameter('enable_pass_policy_admin')); - config_update_value ('enable_pass_history', get_parameter('enable_pass_history')); - config_update_value ('compare_pass', get_parameter('compare_pass')); - } - - config_update_value ('log_collector', (bool)get_parameter('log_collector')); - ///////////// - break; - case 'godmode/setup/setup_auth': - //////// AUTHENTICATION SETUP - config_update_value ('auth', get_parameter ('auth')); - config_update_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users')); - config_update_value ('default_remote_profile', get_parameter ('default_remote_profile')); - config_update_value ('default_remote_group', get_parameter ('default_remote_group')); - config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')); - - config_update_value ('ad_server', get_parameter ('ad_server')); - config_update_value ('ad_port', get_parameter ('ad_port')); - config_update_value ('ad_start_tls', get_parameter ('ad_start_tls')); - config_update_value ('ad_domain', get_parameter ('ad_domain')); - - config_update_value ('ldap_server', get_parameter ('ldap_server')); - config_update_value ('ldap_port', get_parameter ('ldap_port')); - config_update_value ('ldap_version', get_parameter ('ldap_version')); - config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls')); - config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn')); - config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr')); - - config_update_value ('rpandora_server', get_parameter ('rpandora_server')); - config_update_value ('rpandora_port', get_parameter ('rpandora_port')); - config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname')); - config_update_value ('rpandora_user', get_parameter ('rpandora_user')); - config_update_value ('rpandora_pass', get_parameter ('rpandora_pass')); - - config_update_value ('rbabel_server', get_parameter ('rbabel_server')); - config_update_value ('rbabel_port', get_parameter ('rbabel_port')); - config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname')); - config_update_value ('rbabel_user', get_parameter ('rbabel_user')); - config_update_value ('rbabel_pass', get_parameter ('rbabel_pass')); - - config_update_value ('rintegria_server', get_parameter ('rintegria_server')); - config_update_value ('rintegria_port', get_parameter ('rintegria_port')); - config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname')); - config_update_value ('rintegria_user', get_parameter ('rintegria_user')); - config_update_value ('rintegria_pass', get_parameter ('rintegria_pass')); - ///////////// - break; - case 'godmode/setup/performance': - //////// PERFORMANCE SETUP - config_update_value ('event_purge', get_parameter ('event_purge')); - config_update_value ('metaconsole_events_history', get_parameter ('metaconsole_events_history')); - config_update_value ('trap_purge', get_parameter ('trap_purge')); - config_update_value ('string_purge', get_parameter ('string_purge')); - config_update_value ('audit_purge', get_parameter ('audit_purge')); - config_update_value ('gis_purge', get_parameter ('gis_purge')); - config_update_value ('days_purge', (int) get_parameter ('days_purge')); - config_update_value ('days_delete_unknown', (int) get_parameter ('days_delete_unknown')); - config_update_value ('days_compact', (int) get_parameter ('days_compact')); - config_update_value ('step_compact', (int) get_parameter ('step_compact')); - config_update_value ('sla_period', (int) get_parameter ('sla_period')); - config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr')); - config_update_value ('realtimestats', get_parameter ('realtimestats')); - config_update_value ('stats_interval', get_parameter ('stats_interval')); - config_update_value ('agentaccess', (int) get_parameter ('agentaccess')); - config_update_value ('compact_header', (bool) get_parameter ('compact_header')); - config_update_value ('num_files_attachment', (int) get_parameter ('num_files_attachment')); - ///////////// - break; - case 'godmode/setup/setup_visuals': - //////// VISUAL STYLES SETUP - config_update_value ('date_format', (string) get_parameter ('date_format')); - config_update_value ('prominent_time', (string) get_parameter ('prominent_time')); - config_update_value ('graph_color1', (string) get_parameter ('graph_color1')); - config_update_value ('graph_color2', (string) get_parameter ('graph_color2')); - config_update_value ('graph_color3', (string) get_parameter ('graph_color3')); - config_update_value ('graph_res', (int) get_parameter ('graph_res')); - $style = (string) get_parameter ('style'); - if ($style != $config['style']) - $style = substr ($style, 0, strlen ($style) - 4); - config_update_value ('style', $style); - config_update_value ('block_size', (int) get_parameter ('block_size')); - config_update_value ('round_corner', (bool) get_parameter ('round_corner')); - config_update_value ('status_images_set', (string) get_parameter ('status_images_set')); - config_update_value ('fontpath', (string) get_parameter ('fontpath')); - config_update_value ('font_size', get_parameter('font_size')); - config_update_value ('flash_charts', (bool) get_parameter ('flash_charts')); - config_update_value ('custom_logo', (string) get_parameter ('custom_logo')); - config_update_value ('enable_refr', get_parameter('enable_refr')); - config_update_value ('refr', get_parameter('refr')); - config_update_value ('vc_refr', get_parameter('vc_refr')); - config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')); - config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium')); - config_update_value ('module_size_text_small', get_parameter('module_size_text_small')); - config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium')); - config_update_value ('description_size_text', get_parameter('description_size_text')); - config_update_value ('item_title_size_text', get_parameter('item_title_size_text')); - config_update_value ('gis_label', get_parameter ('gis_label')); - config_update_value ('gis_default_icon', get_parameter ('gis_default_icon')); - - $interval_values = get_parameter ('interval_values'); - - // Add new interval value if is provided - $interval_value = (float) get_parameter ('interval_value', 0); + // Setup now is divided in different tabs + switch ($section_setup) { + case 'general': + config_update_value ('language', (string) get_parameter ('language')); + config_update_value ('remote_config', (string) get_parameter ('remote_config')); + config_update_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd')); + config_update_value ('timesource', (string) get_parameter ('timesource')); + config_update_value ('autoupdate', (bool) get_parameter ('autoupdate')); + config_update_value ('https', (bool) get_parameter ('https')); + config_update_value ('attachment_store', (string) get_parameter ('attachment_store')); + config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')); + config_update_value ('api_password', get_parameter('api_password')); + config_update_value ('activate_gis', (bool) get_parameter ('activate_gis')); + config_update_value ('integria_enabled', get_parameter ('integria_enabled')); + config_update_value ('integria_inventory', get_parameter ('integria_inventory')); + config_update_value ('integria_api_password', get_parameter ('integria_api_password')); + config_update_value ('integria_url', get_parameter ('integria_url')); + config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow')); + $timezone = (string) get_parameter ('timezone'); + if ($timezone != "") { + config_update_value ('timezone', $timezone); + } + config_update_value ('sound_alert', get_parameter('sound_alert')); + config_update_value ('sound_critical', get_parameter('sound_critical')); + config_update_value ('sound_warning', get_parameter('sound_warning')); + # Update of Pandora FMS license + $update_manager_installed = db_get_value('value', 'tconfig', 'token', 'update_manager_installed'); + + if ($update_manager_installed == 1) { + $license_info_key = get_parameter('license_info_key', ''); + if (!empty($license_info_key)) { + $values = array("value" => $license_info_key); + $where = array("key" => 'customer_key'); + $update_manage_settings_result = db_process_sql_update('tupdate_settings', $values, $where); + } + } + config_update_value ('public_url', get_parameter('public_url')); + config_update_value ('referer_security', get_parameter('referer_security')); + break; + case 'enterprise': + if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { + config_update_value ('trap2agent', (string) get_parameter ('trap2agent')); + config_update_value ('acl_enterprise', get_parameter ('acl_enterprise')); + config_update_value ('metaconsole', get_parameter ('metaconsole')); + config_update_value ('collection_max_size', get_parameter('collection_max_size')); + config_update_value ('event_replication', (int)get_parameter('event_replication')); + if ((int)get_parameter('event_replication') == 1) { + config_update_value ('replication_interval', (int)get_parameter('replication_interval')); + config_update_value ('replication_dbhost', (string)get_parameter('replication_dbhost')); + config_update_value ('replication_dbname', (string)get_parameter('replication_dbname')); + config_update_value ('replication_dbuser', (string)get_parameter('replication_dbuser')); + config_update_value ('replication_dbpass', (string)get_parameter('replication_dbpass')); + config_update_value ('replication_dbport', (string)get_parameter('replication_dbport')); + config_update_value ('replication_mode', (string)get_parameter('replication_mode')); + } + config_update_value ('log_collector', (bool)get_parameter('log_collector')); + } + break; + case 'pass': + if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { + config_update_value ('enable_pass_policy', get_parameter('enable_pass_policy')); + config_update_value ('pass_size', get_parameter('pass_size')); + config_update_value ('pass_expire', get_parameter('pass_expire')); + config_update_value ('first_login', get_parameter('first_login')); + config_update_value ('mins_fail_pass', get_parameter('mins_fail_pass')); + config_update_value ('number_attempts', get_parameter('number_attempts')); + config_update_value ('pass_needs_numbers', get_parameter('pass_needs_numbers')); + config_update_value ('pass_needs_symbols', get_parameter('pass_needs_symbols')); + config_update_value ('enable_pass_policy_admin', get_parameter('enable_pass_policy_admin')); + config_update_value ('enable_pass_history', get_parameter('enable_pass_history')); + config_update_value ('compare_pass', get_parameter('compare_pass')); + } + break; + case 'auth': + //////// AUTHENTICATION SETUP + config_update_value ('auth', get_parameter ('auth')); + config_update_value ('autocreate_remote_users', get_parameter ('autocreate_remote_users')); + config_update_value ('default_remote_profile', get_parameter ('default_remote_profile')); + config_update_value ('default_remote_group', get_parameter ('default_remote_group')); + config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')); + + config_update_value ('ad_server', get_parameter ('ad_server')); + config_update_value ('ad_port', get_parameter ('ad_port')); + config_update_value ('ad_start_tls', get_parameter ('ad_start_tls')); + config_update_value ('ad_domain', get_parameter ('ad_domain')); + + config_update_value ('ldap_server', get_parameter ('ldap_server')); + config_update_value ('ldap_port', get_parameter ('ldap_port')); + config_update_value ('ldap_version', get_parameter ('ldap_version')); + config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls')); + config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn')); + config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr')); + + config_update_value ('rpandora_server', get_parameter ('rpandora_server')); + config_update_value ('rpandora_port', get_parameter ('rpandora_port')); + config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname')); + config_update_value ('rpandora_user', get_parameter ('rpandora_user')); + config_update_value ('rpandora_pass', get_parameter ('rpandora_pass')); + + config_update_value ('rbabel_server', get_parameter ('rbabel_server')); + config_update_value ('rbabel_port', get_parameter ('rbabel_port')); + config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname')); + config_update_value ('rbabel_user', get_parameter ('rbabel_user')); + config_update_value ('rbabel_pass', get_parameter ('rbabel_pass')); + + config_update_value ('rintegria_server', get_parameter ('rintegria_server')); + config_update_value ('rintegria_port', get_parameter ('rintegria_port')); + config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname')); + config_update_value ('rintegria_user', get_parameter ('rintegria_user')); + config_update_value ('rintegria_pass', get_parameter ('rintegria_pass')); + ///////////// + break; + case 'perf': + //////// PERFORMANCE SETUP + config_update_value ('event_purge', get_parameter ('event_purge')); + $check_metaconsole_events_history = get_parameter ('metaconsole_events_history', -1); + if ($check_metaconsole_events_history != -1) + config_update_value ('metaconsole_events_history', get_parameter ('metaconsole_events_history')); + config_update_value ('trap_purge', get_parameter ('trap_purge')); + config_update_value ('string_purge', get_parameter ('string_purge')); + config_update_value ('audit_purge', get_parameter ('audit_purge')); + config_update_value ('gis_purge', get_parameter ('gis_purge')); + config_update_value ('days_purge', (int) get_parameter ('days_purge')); + config_update_value ('days_delete_unknown', (int) get_parameter ('days_delete_unknown')); + config_update_value ('days_compact', (int) get_parameter ('days_compact')); + config_update_value ('step_compact', (int) get_parameter ('step_compact')); + config_update_value ('sla_period', (int) get_parameter ('sla_period')); + config_update_value ('event_view_hr', (int) get_parameter ('event_view_hr')); + config_update_value ('realtimestats', get_parameter ('realtimestats')); + config_update_value ('stats_interval', get_parameter ('stats_interval')); + config_update_value ('agentaccess', (int) get_parameter ('agentaccess')); + config_update_value ('compact_header', (bool) get_parameter ('compact_header')); + config_update_value ('num_files_attachment', (int) get_parameter ('num_files_attachment')); + ///////////// + break; + + case 'vis': + //////// VISUAL STYLES SETUP + config_update_value ('date_format', (string) get_parameter ('date_format')); + config_update_value ('prominent_time', (string) get_parameter ('prominent_time')); + config_update_value ('graph_color1', (string) get_parameter ('graph_color1')); + config_update_value ('graph_color2', (string) get_parameter ('graph_color2')); + config_update_value ('graph_color3', (string) get_parameter ('graph_color3')); + config_update_value ('graph_res', (int) get_parameter ('graph_res')); + $style = (string) get_parameter ('style'); + if ($style != $config['style']) + $style = substr ($style, 0, strlen ($style) - 4); + config_update_value ('style', $style); + config_update_value ('block_size', (int) get_parameter ('block_size')); + config_update_value ('round_corner', (bool) get_parameter ('round_corner')); + config_update_value ('status_images_set', (string) get_parameter ('status_images_set')); + config_update_value ('fontpath', (string) get_parameter ('fontpath')); + config_update_value ('font_size', get_parameter('font_size')); + config_update_value ('flash_charts', (bool) get_parameter ('flash_charts')); + config_update_value ('custom_logo', (string) get_parameter ('custom_logo')); + config_update_value ('enable_refr', get_parameter('enable_refr')); + config_update_value ('refr', get_parameter('refr')); + config_update_value ('vc_refr', get_parameter('vc_refr')); + config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')); + config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium')); + config_update_value ('module_size_text_small', get_parameter('module_size_text_small')); + config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium')); + config_update_value ('description_size_text', get_parameter('description_size_text')); + config_update_value ('item_title_size_text', get_parameter('item_title_size_text')); + config_update_value ('gis_label', get_parameter ('gis_label')); + config_update_value ('gis_default_icon', get_parameter ('gis_default_icon')); + + $interval_values = get_parameter ('interval_values'); + + // Add new interval value if is provided + $interval_value = (float) get_parameter ('interval_value', 0); - if($interval_value > 0) { - $interval_unit = (int) get_parameter ('interval_unit'); - $new_interval = $interval_value * $interval_unit; + if($interval_value > 0) { + $interval_unit = (int) get_parameter ('interval_unit'); + $new_interval = $interval_value * $interval_unit; - if($interval_values === '') { - $interval_values = $new_interval; - } - else { - $interval_values_array = explode(',',$interval_values); - if(!in_array($new_interval, $interval_values_array)) { - $interval_values_array[] = $new_interval; + if($interval_values === '') { + $interval_values = $new_interval; + } + else { + $interval_values_array = explode(',',$interval_values); + if(!in_array($new_interval, $interval_values_array)) { + $interval_values_array[] = $new_interval; + $interval_values = implode(',',$interval_values_array); + } + } + } + + // Delete interval value if is required + $interval_to_delete = (float) get_parameter('interval_to_delete'); + if($interval_to_delete > 0) { + $interval_values_array = explode(',',$interval_values); + foreach($interval_values_array as $k => $iva) { + if($interval_to_delete == $iva) { + unset($interval_values_array[$k]); + } + } $interval_values = implode(',',$interval_values_array); } - } - } - - // Delete interval value if is required - $interval_to_delete = (float) get_parameter('interval_to_delete'); - if($interval_to_delete > 0) { - $interval_values_array = explode(',',$interval_values); - foreach($interval_values_array as $k => $iva) { - if($interval_to_delete == $iva) { - unset($interval_values_array[$k]); - } - } - $interval_values = implode(',',$interval_values_array); - } - config_update_value ('interval_values', $interval_values); + config_update_value ('interval_values', $interval_values); - ///////////// - break; - case 'enterprise/godmode/setup/setup_history': - //////// HISTORY DATABASE SETUP - config_update_value ('history_db_enabled', (bool) get_parameter ('history_db_enabled')); - config_update_value ('history_db_host', (string) get_parameter ('history_db_host')); - config_update_value ('history_db_port', (int) get_parameter ('history_db_port')); - config_update_value ('history_db_name', (string) get_parameter ('history_db_name')); - config_update_value ('history_db_user', (string) get_parameter ('history_db_user')); - config_update_value ('history_db_pass', (string) get_parameter ('history_db_pass')); - config_update_value ('history_db_days', (string) get_parameter ('history_db_days')); - config_update_value ('history_db_step', (string) get_parameter ('history_db_step')); - config_update_value ('history_db_delay', (string) get_parameter ('history_db_delay')); - /////////////// - break; - case 'godmode/setup/setup_netflow': - config_update_value ('netflow_path', get_parameter ('netflow_path')); - config_update_value ('netflow_interval', get_parameter ('netflow_interval')); - config_update_value ('netflow_daemon', get_parameter ('netflow_daemon')); - config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump')); - config_update_value ('netflow_max_resolution', get_parameter ('netflow_max_resolution')); - break; - case 'enterprise/godmode/setup/setup_log_collector': - config_update_value ('log_dir', (string)get_parameter('log_dir')); - break; + break; + case 'net': + config_update_value ('netflow_path', get_parameter ('netflow_path')); + config_update_value ('netflow_interval', get_parameter ('netflow_interval')); + config_update_value ('netflow_daemon', get_parameter ('netflow_daemon')); + config_update_value ('netflow_nfdump', get_parameter ('netflow_nfdump')); + config_update_value ('netflow_max_resolution', get_parameter ('netflow_max_resolution')); + break; + case 'log': + config_update_value ('log_dir', (string)get_parameter('log_dir')); + break; + + } + + } enterprise_include_once('include/functions_policies.php'); @@ -335,7 +338,7 @@ function config_process_config () { if (!isset ($config['language'])) { config_update_value ('language', 'en'); } - + if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { $config['homeurl'] = '/'.$config['homeurl']; } diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 47fff7a86c..bd1ed75d5f 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -353,6 +353,8 @@ function menu_get_full_sec() { * */ function menu_add_extras(&$menu) { + global $config; + $menu_extra = array(); $menu_extra['gusuarios']['sub']['godmode/users/configure_user']['text'] = __('Configure user'); $menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile'); @@ -368,7 +370,8 @@ function menu_add_extras(&$menu) { $menu_extra['reporting']['sub']['operation/visual_console/render_view']['text'] = __('View visual console'); $menu_extra['reporting']['sub']['godmode/reporting/graph_builder']['text'] = __('Manage custom graphs'); $menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard'); - $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); + if ($config['activate_gis']) + $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); $menu_extra['workspace']['sub']['operation/incidents/incident_statistics']['text'] = __('Incidents statistics'); $menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages'); $menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups');