diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 02e8e1ebce..2b0701c6b9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-06-18 Juan Manuel Ramon + + * include/functions_config.php + operation/users/user_edit.php + godmode/massive/massive_add_action_alerts.php + godmode/reporting/reporting_builder.php + godmode/reporting/graphs.php: Fixed Php warning due to pass by + references variables and improvement in skins update. + + Merged from branches. + 2012-06-18 Vanessa Gil * include/functions_config.php: Don't display diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index f1f44e421c..9736f28ec1 100644 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -110,6 +110,11 @@ if ($add) { $groups = users_get_groups (); +// Avoid php warning +if (empty($alert_templates)) { + $alert_templates = ''; +} + $table->id = 'delete_table'; $table->width = '98%'; $table->data = array (); diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 7f8b4a4bce..3c41476765 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -48,7 +48,7 @@ switch ($activeTab){ case 'main': $buttons['graph_list']['active'] = true; $subsection = ' » '.__('Graph list'); break; - default: $subsection = reporting_enterprise_add_graph_template_subsection($activeTab, &$buttons); + default: $subsection = reporting_enterprise_add_graph_template_subsection($activeTab, $buttons); break; } diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index af6c32825d..752ffb1273 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -886,7 +886,7 @@ switch ($action) { break; // Added for report templates default: - if ($enterpriseEnable){ + if ($enterpriseEnable) { $buttons = array( 'list_reports' => array('active' => false, 'text' => '' . diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 54bc657544..ae457585a0 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -88,7 +88,7 @@ function config_update_config () { $style = (string) get_parameter ('style', $config["style"]); if ($style != $config['style']) $style = substr ($style, 0, strlen ($style) - 4); - + config_update_value ('language', (string) get_parameter ('language', $config["language"])); config_update_value ('remote_config', (string) get_parameter ('remote_config', $config["remote_config"])); config_update_value ('block_size', (int) get_parameter ('block_size', $config["block_size"])); @@ -126,7 +126,7 @@ function config_update_config () { config_update_value ('flash_charts', (bool) get_parameter ('flash_charts', $config["flash_charts"])); config_update_value ('attachment_store', (string) get_parameter ('attachment_store', $config["attachment_store"])); config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')); - + config_update_value ('custom_logo', (string) get_parameter ('custom_logo', $config["custom_logo"])); config_update_value ('history_db_enabled', (bool) get_parameter ('history_db_enabled', $config['history_db_enabled'])); config_update_value ('history_db_host', (string) get_parameter ('history_db_host', $config['history_db_host'])); @@ -157,31 +157,31 @@ function config_update_config () { config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist', $config['autocreate_blacklist'])); config_update_value ('default_remote_profile', get_parameter ('default_remote_profile', $config['default_remote_profile'])); config_update_value ('default_remote_group', get_parameter ('default_remote_group', $config['default_remote_group'])); - + config_update_value ('ldap_server', get_parameter ('ldap_server', $config['ldap_server'])); config_update_value ('ldap_port', get_parameter ('ldap_port', $config['ldap_port'])); config_update_value ('ldap_version', get_parameter ('ldap_version', $config['ldap_version'])); config_update_value ('ldap_start_tls', get_parameter ('ldap_start_tls', $config['ldap_start_tls'])); config_update_value ('ldap_base_dn', get_parameter ('ldap_base_dn', $config['ldap_base_dn'])); config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr', $config['ldap_login_attr'])); - + config_update_value ('ad_server', get_parameter ('ad_server', $config['ad_server'])); config_update_value ('ad_port', get_parameter ('ad_port', $config['ad_port'])); config_update_value ('ad_start_tls', get_parameter ('ad_start_tls', $config['ad_start_tls'])); config_update_value ('ad_domain', get_parameter ('ad_domain', $config['ad_domain'])); - + config_update_value ('rpandora_server', get_parameter ('rpandora_server', $config['rpandora_server'])); config_update_value ('rpandora_port', get_parameter ('rpandora_port', $config['rpandora_port'])); config_update_value ('rpandora_dbname', get_parameter ('rpandora_dbname', $config['rpandora_dbname'])); config_update_value ('rpandora_user', get_parameter ('rpandora_user', $config['rpandora_user'])); config_update_value ('rpandora_pass', get_parameter ('rpandora_pass', $config['rpandora_pass'])); - + config_update_value ('rbabel_server', get_parameter ('rbabel_server', $config['rbabel_server'])); config_update_value ('rbabel_port', get_parameter ('rbabel_port', $config['rbabel_port'])); config_update_value ('rbabel_dbname', get_parameter ('rbabel_dbname', $config['rbabel_dbname'])); config_update_value ('rbabel_user', get_parameter ('rbabel_user', $config['rbabel_user'])); config_update_value ('rbabel_pass', get_parameter ('rbabel_pass', $config['rbabel_pass'])); - + config_update_value ('rintegria_server', get_parameter ('rintegria_server', $config['rintegria_server'])); config_update_value ('rintegria_port', get_parameter ('rintegria_port', $config['rintegria_port'])); config_update_value ('rintegria_dbname', get_parameter ('rintegria_dbname', $config['rintegria_dbname'])); @@ -200,17 +200,11 @@ function config_update_config () { config_update_value ('api_password', get_parameter('api_password', "")); config_update_value ('collection_max_size', get_parameter('collection_max_size', $config['collection_max_size'])); - + config_update_value ('font_size', get_parameter('font_size', $config['font_size'])); - config_update_value ('refr', get_parameter('refr', $config['refr'])); + config_update_value ('refr', get_parameter('refr', $config['refr'])); config_update_value ('vc_refr', get_parameter('vc_refr', $config['vc_refr'])); - - config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small', $config['agent_size_text_small'])); - config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium', $config['agent_size_text_medium'])); - config_update_value ('module_size_text_small', get_parameter('module_size_text_small', $config['module_size_text_small'])); - config_update_value ('module_size_text_medium', get_parameter('module_size_text_medium', $config['module_size_text_medium'])); - config_update_value ('description_size_text', get_parameter('description_size_text', $config['description_size_text'])); - config_update_value ('item_title_size_text', get_parameter('item_title_size_text', $config['item_title_size_text'])); + enterprise_include_once('include/functions_policies.php'); $enterprise = enterprise_include_once ('include/functions_skins.php'); @@ -235,7 +229,7 @@ function config_update_config () { # 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'])) { @@ -252,7 +246,7 @@ function config_update_config () { */ function config_process_config () { global $config; - + $configs = db_get_all_rows_in_table ('tconfig'); if (empty ($configs)) { @@ -262,13 +256,13 @@ function config_process_config () { /* Compatibility fix */ foreach ($configs as $c) { - $config[$c['token']] = $c['value']; + $config[$c['token']] = $c['value']; } if (!isset ($config['language'])) { config_update_value ('language', 'en'); } - + if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { $config['homeurl'] = '/'.$config['homeurl']; } @@ -410,55 +404,55 @@ function config_process_config () { if (!isset ($config['fontpath'])) { config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/smallfont.ttf'); } - + if (!isset ($config['style'])) { config_update_value ( 'style', 'pandora'); } - + if (!isset ($config['flash_charts'])) { config_update_value ( 'flash_charts', true); } - + if (!isset ($config["custom_logo"])){ config_update_value ('custom_logo', 'none.png'); } - + if (!isset ($config['history_db_enabled'])) { config_update_value ( 'history_db_enabled', false); } - + if (!isset ($config['history_db_host'])) { config_update_value ( 'history_db_host', ''); } - + if (!isset ($config['history_db_port'])) { config_update_value ( 'history_db_port', 3306); } - + if (!isset ($config['history_db_name'])) { config_update_value ( 'history_db_name', 'pandora'); } - + if (!isset ($config['history_db_user'])) { config_update_value ( 'history_db_user', 'pandora'); } - + if (!isset ($config['history_db_pass'])) { config_update_value ( 'history_db_pass', ''); } - + if (!isset ($config['history_db_days'])) { config_update_value ( 'history_db_days', 0); } - + if (!isset ($config['history_db_step'])) { config_update_value ( 'history_db_step', 0); } - + if (!isset ($config['history_db_delay'])) { config_update_value ( 'history_db_delay', 0); } - + if (!isset ($config['activate_gis'])) { config_update_value ( 'activate_gis', 0); } @@ -482,119 +476,119 @@ function config_process_config () { if (!isset ($config['auth'])) { config_update_value ( 'auth', 'mysql'); } - + if (!isset ($config['autocreate_remote_users'])) { config_update_value ('autocreate_remote_users', 0); } - + if (!isset ($config['autocreate_blacklist'])) { config_update_value ('autocreate_blacklist', ''); } - + if (!isset ($config['default_remote_profile'])) { config_update_value ('default_remote_profile', 0); } - + if (!isset ($config['default_remote_group'])) { config_update_value ('default_remote_group', 0); } - + if (!isset ($config['ldap_server'])) { config_update_value ( 'ldap_server', 'localhost'); } - + if (!isset ($config['ldap_port'])) { config_update_value ( 'ldap_port', 389); } - + if (!isset ($config['ldap_version'])) { config_update_value ( 'ldap_version', '3'); } - + if (!isset ($config['ldap_start_tls'])) { config_update_value ( 'ldap_start_tls', 0); } - + if (!isset ($config['ldap_base_dn'])) { config_update_value ( 'ldap_base_dn', 'ou=People,dc=edu,dc=example,dc=org'); } - + if (!isset ($config['ldap_login_attr'])) { config_update_value ( 'ldap_login_attr', 'uid'); } - + if (!isset ($config['ad_server'])) { config_update_value ( 'ad_server', 'localhost'); } - + if (!isset ($config['ad_port'])) { config_update_value ( 'ad_port', 389); } - + if (!isset ($config['ad_start_tls'])) { config_update_value ( 'ad_start_tls', 0); } - + if (!isset ($config['ad_domain'])) { config_update_value ( 'ad_domain', ''); } - + if (!isset ($config['rpandora_server'])) { config_update_value ( 'rpandora_server', 'localhost'); } - + if (!isset ($config['rpandora_port'])) { config_update_value ( 'rpandora_port', 3306); } - + if (!isset ($config['rpandora_dbname'])) { config_update_value ( 'rpandora_dbname', 'pandora'); } - + if (!isset ($config['rpandora_user'])) { config_update_value ( 'rpandora_user', 'pandora'); } - + if (!isset ($config['rpandora_pass'])) { config_update_value ( 'rpandora_pass', ''); } - + if (!isset ($config['rbabel_server'])) { config_update_value ( 'rbabel_server', 'localhost'); } - + if (!isset ($config['rbabel_port'])) { config_update_value ( 'rbabel_port', 3306); } - + if (!isset ($config['rbabel_dbname'])) { config_update_value ( 'rbabel_dbname', 'babel'); } - + if (!isset ($config['rbabel_user'])) { config_update_value ( 'rbabel_user', 'babel'); } - + if (!isset ($config['rbabel_pass'])) { config_update_value ( 'rbabel_pass', ''); } - + if (!isset ($config['rintegria_server'])) { config_update_value ( 'rintegria_server', 'localhost'); } - + if (!isset ($config['rintegria_port'])) { config_update_value ( 'rintegria_port', 3306); } - + if (!isset ($config['rintegria_dbname'])) { config_update_value ( 'rintegria_dbname', 'integria'); } - + if (!isset ($config['rintegria_user'])) { config_update_value ( 'rintegria_user', 'integria'); } - + if (!isset ($config['rintegria_pass'])) { config_update_value ( 'rintegria_pass', ''); } @@ -624,9 +618,31 @@ function config_process_config () { } if (!isset ($config['relative_path']) && (isset ($_POST['nick']) || isset ($config['id_user'])) && isset($config['enterprise_installed'])) { + $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); - if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - if(isset($config['id_user'])) + if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { + + // Try to update user table in order to refresh skin inmediatly + $is_user_updating = get_parameter("sec2", ""); + + if ($is_user_updating == 'operation/users/user_edit') { + $id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter + $user_info = get_user_info ($id); + + //If current user is editing himself or if the user has UM (User Management) rights on any groups the user is part of AND the authorization scheme allows for users/admins to update info + if (($config["id_user"] == $id || check_acl ($config["id_user"], users_get_groups ($id), "UM")) && $config["user_can_update_info"]) { + $view_mode = false; + } else { + $view_mode = true; + } + + if (isset ($_GET["modified"]) && !$view_mode) { + $upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]); + $return_update_skin = update_user ($id, $upd_info); + } + } + + if (isset($config['id_user'])) $relative_path = enterprise_hook('skins_set_image_skin_path',array($config['id_user'])); else $relative_path = enterprise_hook('skins_set_image_skin_path',array($_POST['nick'])); @@ -646,35 +662,11 @@ function config_process_config () { config_update_value ('refr', ''); } - if (!isset($config['agent_size_text_small'])) { - config_update_value ('agent_size_text_small', 15); - } - - if (!isset($config['agent_size_text_medium'])) { - config_update_value ('agent_size_text_medium', 50); - } - - if (!isset($config['module_size_text_small'])) { - config_update_value ('module_size_text_small', 15); - } - - if (!isset($config['module_size_text_medium'])) { - config_update_value ('module_size_text_medium', 50); - } - - if (!isset($config['description_size_text'])) { - config_update_value ('description_size_text', 50); - } - - if (!isset($config['item_title_size_text'])) { - config_update_value ('item_title_size_text', 40); - } - /* Finally, check if any value was overwritten in a form */ config_update_config(); } -function config_check () { +function config_check (){ global $config; // At this first version I'm passing errors using session variables, because the error management @@ -773,7 +765,7 @@ function config_check () { 'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true); } - pandora_update_manager_login(); + //pandora_update_manager_login(); if (isset($_SESSION['new_update'])) { if (!empty($_SESSION['return_installation_open'])) { if (!$_SESSION['return_installation_open']['return']) { diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index e855b47888..48cf3c838c 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -128,12 +128,12 @@ if (isset ($_GET["modified"]) && !$view_mode) { } // Reload page to update skin - if ($return){ + /* if ($return){ header ('location:' . $config['homeurl'] . '/index.php?sec=usuarios&sec2=operation/users/user_edit&status=1'); } else{ header ('location:' . $config['homeurl'] . '/index.php?sec=usuarios&sec2=operation/users/user_edit&status=0'); - } + }*/ $user_info = $upd_info; } @@ -247,7 +247,7 @@ $values = array ('Default' =>__('Default'), 'Dashboard'=>__('Dashboard'), 'Visua echo html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false); echo "  "; -$dashboards = get_user_dashboards ($user_info['id_user']); +$dashboards = get_user_dashboards ($config['id_user']); $dashboards_aux = array(); if ($dashboards === false) { $dashboards = array('None'=>'None'); @@ -258,7 +258,7 @@ if ($dashboards === false) { } echo html_print_select ($dashboards_aux, 'dashboard', $user_info["data_section"], '', '', '', true); -$layouts = visual_map_get_user_layouts ($user_info['id_user'], true); +$layouts = visual_map_get_user_layouts ($config['id_user'], true); $layouts_aux = array(); if ($layouts === false) { $layouts_aux = array('None'=>'None');