';
+ } else {
+ $output .= '
';
+ }
+
+ $first_block_printed = true;
+ }
+
+ $output .= '
';
+
+ foreach ($row['columns'] as $column) {
+ $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
+ $padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
+ $padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
+ $extra_styles = isset($column['style']) ? $column['style'] : '';
+
+ $output .= '
';
+
+ foreach ($column['inputs'] as $input) {
+ if (is_array($input)) {
+ if ($input['arguments']['type'] != 'submit') {
+ $output .= $this->printBlockAsGrid($input, true);
+ } else {
+ $output_submit .= $this->printBlockAsGrid($input, true);
+ }
+ } else {
+ $output .= $input;
+ }
+ }
+
+ $output .= '
';
+ }
+
+ $output .= '
';
+ }
+
+ $output .= '
';
+
+ $output .= '
';
+ $output .= '';
+ $output .= '';
+
+ if ($return === false) {
+ echo $output;
+ }
+
+ return $output_head.$output;
+
+ }
+
+
+ /**
+ * Print a form as a list.
+ *
+ * @param array $data Definition of target form to be printed.
+ * @param boolean $return Return as string or direct output.
+ *
+ * @return string HTML code.
+ */
+ public function printFormAsList(array $data, bool $return=false)
+ {
+ $form = $data['form'];
+ $inputs = $data['inputs'];
+ $js = $data['js'];
+ $cb_function = $data['cb_function'];
+ $cb_args = $data['cb_args'];
+
+ $output_head = '
';
+ $output .= '';
+
+ if ($return === false) {
+ echo $output;
+ }
+
+ return $output_head.$output;
+
+ }
+
+
/**
* Print a big button element (huge image, big text and link).
*
diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php
index fef3f3c97c..b8c3705046 100644
--- a/pandora_console/include/ajax/alert_list.ajax.php
+++ b/pandora_console/include/ajax/alert_list.ajax.php
@@ -153,24 +153,48 @@ if ($show_update_action_menu) {
$id_alert = (int) get_parameter('id_alert');
$module_name = modules_get_agentmodule_name($id_agent_module);
- $agent_alias = modules_get_agentmodule_agent_alias($id_agent);
+
+ $agent_alias = modules_get_agentmodule_agent_alias($id_agent_module);
$id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert);
- $action_opction = db_get_row('talert_template_module_actions', 'id_alert_template_module', $id_alert);
+ $action_opction = db_get_row(
+ 'talert_template_module_actions',
+ 'id_alert_template_module',
+ $id_alert
+ );
$data .= '
';
echo $data;
return;
diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index 718a3a6c71..1ab383b672 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -1254,11 +1254,49 @@ function fill_permissions_ldap($sr)
global $config;
$permissions = [];
$permissions_profile = [];
- if ((bool) $config['ldap_save_profile'] === false) {
+ if (defined('METACONSOLE')) {
+ $meta = true;
+ }
+
+ if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) {
+ $result = 0;
$result = db_get_all_rows_filter(
'tusuario_perfil',
['id_usuario' => $sr['uid'][0]]
);
+ if ($result == false) {
+ $permissions[0]['profile'] = $config['default_remote_profile'];
+ $permissions[0]['groups'][] = $config['default_remote_group'];
+ $permissions[0]['tags'] = $config['default_assign_tags'];
+ $permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
+ return $permissions;
+ }
+
+ foreach ($result as $perms) {
+ $permissions_profile[] = [
+ 'profile' => $perms['id_perfil'],
+ 'groups' => [$perms['id_grupo']],
+ 'tags' => $perms['tags'],
+ 'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
+ ];
+ }
+
+ return $permissions_profile;
+ }
+
+ if ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') {
+ $result = db_get_all_rows_filter(
+ 'tusuario_perfil',
+ ['id_usuario' => $sr['uid'][0]]
+ );
+ if ($result == false) {
+ $permissions[0]['profile'] = $config['default_remote_profile'];
+ $permissions[0]['groups'][] = $config['default_remote_group'];
+ $permissions[0]['tags'] = $config['default_assign_tags'];
+ $permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
+ return $permissions;
+ }
+
foreach ($result as $perms) {
$permissions_profile[] = [
'profile' => $perms['id_perfil'],
@@ -1268,18 +1306,54 @@ function fill_permissions_ldap($sr)
];
}
- if (empty($permissions_profile)) {
- $permissions[0]['profile'] = $config['default_remote_profile'];
- $permissions[0]['groups'][] = $config['default_remote_group'];
- $permissions[0]['tags'] = $config['default_assign_tags'];
- $permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
- return $permissions;
- } else {
- return $permissions_profile;
- }
+ return $permissions_profile;
}
- if ($config['autocreate_remote_users']) {
+ if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 1) {
+ $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
+ foreach ($ldap_adv_perms as $ldap_adv_perm) {
+ $permissions[] = [
+ 'profile' => $ldap_adv_perm['profile'],
+ 'groups' => $ldap_adv_perm['group'],
+ 'tags' => implode(',', $ldap_adv_perm['tags']),
+ 'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
+ ];
+ }
+
+ return $permissions;
+ }
+
+ if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) {
+ $result = db_get_all_rows_filter(
+ 'tusuario_perfil',
+ ['id_usuario' => $sr['uid'][0]]
+ );
+ if ($result == false) {
+ $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
+ foreach ($ldap_adv_perms as $ldap_adv_perm) {
+ $permissions[] = [
+ 'profile' => $ldap_adv_perm['profile'],
+ 'groups' => $ldap_adv_perm['group'],
+ 'tags' => implode(',', $ldap_adv_perm['tags']),
+ 'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
+ ];
+ return $permissions;
+ }
+ }
+
+ foreach ($result as $perms) {
+ $permissions_profile[] = [
+ 'profile' => $perms['id_perfil'],
+ 'groups' => [$perms['id_grupo']],
+ 'tags' => $perms['tags'],
+ 'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
+ ];
+ };
+
+ return $permissions_profile;
+ }
+
+ if ($config['autocreate_remote_users'] && $config['ldap_save_profile'] == 1) {
$permissions[0]['profile'] = $config['default_remote_profile'];
$permissions[0]['groups'][] = $config['default_remote_group'];
$permissions[0]['tags'] = $config['default_assign_tags'];
diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php
index 7259287d68..1b5a114287 100644
--- a/pandora_console/include/class/ConsoleSupervisor.php
+++ b/pandora_console/include/class/ConsoleSupervisor.php
@@ -194,6 +194,20 @@ class ConsoleSupervisor
$this->checkCronRunning();
}
+ /*
+ * Check if instance is registered.
+ * NOTIF.UPDATEMANAGER.REGISTRATION
+ */
+
+ $this->checkUpdateManagerRegistration();
+
+ /*
+ * Check if there're new messages in UM.
+ * NOTIF.UPDATEMANAGER.MESSAGES
+ */
+
+ $this->getUMMessages();
+
}
@@ -406,6 +420,20 @@ class ConsoleSupervisor
$this->checkCronRunning();
}
+ /*
+ * Check if instance is registered.
+ * NOTIF.UPDATEMANAGER.REGISTRATION
+ */
+
+ $this->checkUpdateManagerRegistration();
+
+ /*
+ * Check if there're new messages in UM.
+ * NOTIF.UPDATEMANAGER.MESSAGES
+ */
+
+ $this->getUMMessages();
+
}
@@ -571,6 +599,7 @@ class ConsoleSupervisor
case 'NOTIF.UPDATEMANAGER.OPENSETUP':
case 'NOTIF.UPDATEMANAGER.UPDATE':
case 'NOTIF.UPDATEMANAGER.MINOR':
+ case 'NOTIF.UPDATEMANAGER.MESSAGES':
case 'NOTIF.CRON.CONFIGURED':
default:
// NOTIF.SERVER.STATUS.
@@ -1913,25 +1942,15 @@ class ConsoleSupervisor
global $config;
$login = get_parameter('login', false);
- if (license_free() === true
- && users_is_admin($config['id_user']) === true
- ) {
- $login = get_parameter('login', false);
- // Registration advice.
- if ((isset($config['instance_registered']) === true
- || ($config['instance_registered'] != 1)) && ($login === false)
- ) {
- $this->notify(
- [
- 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
- 'title' => __('This instance is not registered in the Update manager section'),
- 'message' => __('Click
here to start the registration process'),
- 'url' => 'javascript: force_run_register();',
- ]
- );
- } else {
- $this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION');
- }
+ if (update_manager_verify_registration() === false) {
+ $this->notify(
+ [
+ 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
+ 'title' => __('This instance is not registered in the Update manager section'),
+ 'message' => __('Click
here to start the registration process'),
+ 'url' => 'javascript: force_run_register();',
+ ]
+ );
} else {
$this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION');
}
@@ -2217,4 +2236,70 @@ class ConsoleSupervisor
}
+ /**
+ * Search for messages.
+ *
+ * @return void
+ */
+ public function getUMMessages()
+ {
+ global $config;
+
+ if (update_manager_verify_registration() === false) {
+ // Console not subscribed.
+ return;
+ }
+
+ // Avoid contact for messages too much often.
+ if (isset($config['last_um_check'])
+ && time() < $config['last_um_check']
+ ) {
+ return;
+ }
+
+ // Only ask for messages once a day.
+ $future = (time() + 2 * SECONDS_1HOUR);
+ config_update_value('last_um_check', $future);
+
+ include_once $config['homedir'].'/include/functions_update_manager.php';
+
+ $params = [
+ 'pandora_uid' => $config['pandora_uid'],
+ 'timezone' => $config['timezone'],
+ 'language' => $config['language'],
+ ];
+
+ $result = update_manager_curl_request('get_messages', $params);
+
+ try {
+ if ($result['success'] === true) {
+ $messages = json_decode($result['update_message'], true);
+ }
+ } catch (Exception $e) {
+ error_log($e->getMessage());
+ };
+
+ if (is_array($messages)) {
+ $source_id = get_notification_source_id(
+ 'Official communication'
+ );
+ foreach ($messages as $message) {
+ if (!isset($message['url'])) {
+ $message['url'] = '#';
+ }
+
+ $this->notify(
+ [
+ 'type' => 'NOTIF.UPDATEMANAGER.MESSAGES.'.$message['id'],
+ 'title' => $message['subject'],
+ 'message' => base64_decode($message['message_html']),
+ 'url' => $message['url'],
+ ],
+ $source_id
+ );
+ }
+ }
+ }
+
+
}
diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php
index dc28a696e7..dff9d227e1 100644
--- a/pandora_console/include/class/CustomNetScan.class.php
+++ b/pandora_console/include/class/CustomNetScan.class.php
@@ -360,7 +360,7 @@ class CustomNetScan extends Wizard
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
- // Header
+ // Header.
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
@@ -385,7 +385,7 @@ class CustomNetScan extends Wizard
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
- // Header
+ // Header.
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
}
@@ -594,7 +594,7 @@ class CustomNetScan extends Wizard
// XXX: Could be improved validating inputs before continue (JS)
// Print NetScan page 0.
- $this->printForm($form, false, true);
+ $this->printFormAsList($form);
}
}
@@ -742,7 +742,7 @@ class CustomNetScan extends Wizard
get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'");
})'.$change;
- $this->printForm($form, false, true);
+ $this->printFormAsList($form);
}
if (isset($this->page) === true && $this->page === 2) {
diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php
index d5e9056be5..90e2f2a0d4 100644
--- a/pandora_console/include/class/NetworkMap.class.php
+++ b/pandora_console/include/class/NetworkMap.class.php
@@ -3467,19 +3467,18 @@ class NetworkMap
$output .= '
';
- $output .= '
![]()
'arrow_minimap_'.$networkmap['id']]);
$output .= '
';
$output .= '
';
- $output .= '

';
+ $output .= html_print_image('/images/icono_borrar.png', true, ['id' => 'image_hide_show_labels']);
$output .= '
';
$output .= '
'image_hide_show_labels']);
$output .= '
';
// Close networkconsole_id div.
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index e3ce79afd1..e0180374e9 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC190516';
-$pandora_version = 'v7.0NG.734';
+$build_version = 'PC190527';
+$pandora_version = 'v7.0NG.735';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 8628efb700..73b787ff99 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -3951,3 +3951,1329 @@ function mask2cidr($mask)
$base = ip2long('255.255.255.255');
return (32 - log((($long ^ $base) + 1), 2));
}
+
+
+function get_help_info($section_name)
+{
+ global $config;
+ // hd($section_name);
+ $user_language = get_user_language($id_user);
+
+ $es = false;
+ $result = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:';
+ if ($user_language == 'es') {
+ $es = true;
+ $result = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:';
+ }
+
+ switch ($section_name) {
+ case 'tactical_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_t.C3.A1ctica';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Tactical_view';
+ }
+ break;
+
+ case 'group_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_Grupos';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Group_view';
+ }
+ break;
+
+ case 'tree_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_.C3.A1rbol';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#The_Tree_View';
+ }
+ break;
+
+ case 'monitor_detail_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Detalles_Monitores';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Monitor_Details';
+ }
+ break;
+
+ case 'tag_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_etiquetas';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Tag_view';
+ }
+ break;
+
+ case 'alert_validation':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Detalles_de_Alertas';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Alert_Details';
+ }
+ break;
+
+ case 'agents_alerts_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_agente_.2F_alerta';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Agent.2F_Alert_View';
+ }
+ break;
+
+ case 'agents_module_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_agente_.2F_modulo';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Agents_.2F_Modules_View';
+ }
+ break;
+
+ case 'module_groups_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Vista_de_grupos_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Module_Groups_View';
+ }
+ break;
+
+ case 'snmp_browser_view':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Navegador_SNMP_de_Pandora_FMS';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Pandora_FMS_SNMP_MIB_Browser';
+ }
+ break;
+
+ case 'snmp_trap_generator_view':
+ if ($es) {
+ $result .= 'Monitorizacion_traps_SNMP&printable=yes#Generador_de_Traps';
+ } else {
+ $result .= 'SNMP_traps_Monitoring&printable=yes#Trap_Generator';
+ }
+ break;
+
+ case 'real_time_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Gr.C3.A1ficas_Real-time';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Real-time_Graphs';
+ }
+ break;
+
+ case 'agent_status':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Detalles_del_agente';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Agent_Details';
+ }
+ break;
+
+ case 'agent_main_tab':
+ if ($es) {
+ $result .= 'Intro_Monitorizacion&printable=yes#Visualizaci.C3.B3n_del_agente';
+ } else {
+ $result .= 'Intro_Monitoring&printable=yes#Agent_configuration_in_the_console_2';
+ }
+ break;
+
+ case 'alert_config':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Creaci.C3.B3n_de_una_Acci.C3.B3n';
+ } else {
+ $result .= 'Alerts&printable=yes#Creating_an_Action';
+ }
+ break;
+
+ case 'alert_macros':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Macros_sustituibles_en_los_campos_Field1.2C_Field2.2C_Field3..._Field10';
+ } else {
+ $result .= 'Alerts&printable=yes#Replaceable_Macros_within_Field_1_through_Field_10';
+ }
+ break;
+
+ case 'alerts_config':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Configuraci.C3.B3n_de_alertas_en_Pandora_FMS';
+ } else {
+ $result .= 'Alerts&printable=yes#Alert_Configuration_in_Pandora_FMS';
+ }
+ break;
+
+ case 'alert_special_days':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Lista_de_d.C3.ADas_especiales';
+ } else {
+ $result .= 'Alerts&printable=yes#List_of_special_days';
+ }
+ break;
+
+ case 'alerts':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Alertas';
+ } else {
+ $result .= 'Policy&printable=yes#Alerts';
+ }
+ break;
+
+ case 'collections':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Colecciones_de_ficheros';
+ } else {
+ $result .= 'Policy&printable=yes#File_Collections';
+ }
+ break;
+
+ case 'component_groups':
+ if ($es) {
+ $result .= 'Plantillas_y_Componentes&printable=yes#Grupos_de_componentes';
+ } else {
+ $result .= 'Templates_and_components&printable=yes#Component_Groups';
+ }
+ break;
+
+ case 'configure_gis_map':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'GIS&printable=yes#Introduction';
+ }
+ break;
+
+ case 'configure_gis_map_edit':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#GIS_Maps';
+ } else {
+ $result .= 'GIS&printable=yes#GIS_Maps';
+ }
+ break;
+
+ case 'event_alert':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Introducci.C3.B3n_2';
+ } else {
+ $result .= 'Events&printable=yes#Introduction_2';
+ }
+ break;
+
+ case 'eventview':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Events&printable=yes#Introduction';
+ }
+ break;
+
+ case 'export_server':
+ if ($es) {
+ $result .= 'ExportServer&printable=yes#A.C3.B1adir_un_servidor_de_destino';
+ } else {
+ $result .= 'Export_Server&printable=yes#Adding_a_Target_Server';
+ }
+ break;
+
+ case 'external_alert':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Alertas_Externas';
+ } else {
+ $result .= 'Policy&printable=yes#External_Alerts';
+ }
+ break;
+
+ case 'gis_tab':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#Configuraci.C3.B3n_del_Agent_GIS';
+ } else {
+ $result .= 'GIS&printable=yes#The_Agent.27s_GIS_Setup';
+ }
+ break;
+
+ case 'graph_builder':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Crear_Gr.C3.A1ficas_combinadas';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Creating_combined_graphs';
+ }
+ break;
+
+ case 'graph_editor':
+ if ($es) {
+ $result .= 'Presentacion_datos/visualizacion&printable=yes#Agregar_elementos_a_gr.C3.A1ficas_combinadas';
+ } else {
+ $result .= 'Data_Presentation/Visualization&printable=yes#Adding_elements_to_combined_graphs';
+ }
+ break;
+
+ case 'dashboards_tab':
+ if ($es) {
+ $result .= 'Dashboard&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Dashboard&printable=yes#Introduction';
+ }
+ break;
+
+ case 'history_database':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Base_de_datos_hist.C3.B3rica';
+ } else {
+ $result .= 'Console_Setup&printable=yes#The_History_Database';
+ }
+ break;
+
+ case 'inventory_tab':
+ if ($es) {
+ $result .= 'Inventario&printable=yes#M.C3.B3dulos_de_inventario';
+ } else {
+ $result .= 'Inventory&printable=yes#Inventory_Modules';
+ }
+ break;
+
+ case 'ipam_list_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'IPAM&printable=yes#Introduction';
+ }
+ break;
+
+ case 'ipam_calculator_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Calculadora_de_subredes';
+ } else {
+ $result .= 'IPAM&printable=yes#Subnetwork_calculator';
+ }
+ break;
+
+ case 'ipam_vlan_config_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Vlan_IPAM';
+ } else {
+ $result .= 'IPAM&printable=yes#VLAN_IPAM';
+ }
+ break;
+
+ case 'ipam_vlan_statistics_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Estad.C3.ADsticas_IPAM_Vlan';
+ } else {
+ $result .= 'IPAM&printable=yes#IPAM_VLAN_Stats';
+ }
+ break;
+
+ case 'ipam_vlan_wizard_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Wizard_IPAM_Vlan';
+ } else {
+ $result .= 'IPAM&printable=yes#IPAM_VLAN_Wizard:';
+ }
+ break;
+
+ case 'ipam_supernet_config_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#IPAM_Supernet';
+ } else {
+ $result .= 'IPAM&printable=yes#IPAM_Supernet';
+ }
+ break;
+
+ case 'ipam_supernet_map_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Mapa_Superred_IPAM';
+ } else {
+ $result .= 'IPAM&printable=yes#IPAM_Supernet_Map';
+ }
+ break;
+
+ case 'ipam_supernet_statistics_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Estad.C3.ADsticas_IPAM_Superred';
+ } else {
+ $result .= 'IPAM&printable=yes#IPAM_Supernet_Stats';
+ }
+ break;
+
+ case 'ipam_new_tab':
+ case 'ipam_edit_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Vista_de_edici.C3.B3n';
+ } else {
+ $result .= 'IPAM&printable=yes#Edit_view';
+ }
+ break;
+
+ case 'ipam_massive_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Vista_Operaciones_masivas';
+ } else {
+ $result .= 'IPAM&printable=yes#Massive_operations_view';
+ }
+ break;
+
+ case 'ipam_network_tab':
+ case 'ipam_force_tab':
+ if ($es) {
+ $result .= 'IPAM&printable=yes#Vista_de_iconos';
+ } else {
+ $result .= 'IPAM&printable=yes#Icon_view';
+ }
+ break;
+
+ case 'macros_visual_maps':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Macros_en_las_consolas_visuales';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Macros_in_Visual_Consoles';
+ }
+ break;
+
+ case 'linked_map_status_calc':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Mapa_asociado';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Associated_Map';
+ }
+ break;
+
+ case 'main_tab':
+ if ($es) {
+ $result .= 'Intro_Monitorizacion&printable=yes#Configuraci.C3.B3n_del_agente_en_consola';
+ } else {
+ $result .= 'Intro_Monitoring&printable=yes#Agent_configuration_in_the_console';
+ }
+ break;
+
+ case 'manage_alert_list':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Gestionar_alertas_desde_el_agente';
+ } else {
+ $result .= 'Alerts&printable=yes#Managing_Alerts_from_within_the_Agent';
+ }
+ break;
+
+ case 'alert_scalate':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Escalado_de_alertas';
+ } else {
+ $result .= 'Alerts&printable=yes#Scaling_Alerts';
+ }
+ break;
+
+ case 'map_builder_intro':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Introduction';
+ }
+ break;
+
+ case 'map_builder_favorite':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Consolas_visuales_favoritas';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Favorite_visual_consoles';
+ }
+ break;
+
+ case 'map_builder_template':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Plantillas_de_consolas_visuales';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Visual_Console_Templates';
+ }
+ break;
+
+ case 'map_builder_wizard':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Asistente_de_consola_visuales';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Wizard_Visual_Console';
+ }
+ break;
+
+ case 'module_linking':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Tipos_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Policy&printable=yes#Types_of_Modules';
+ }
+ break;
+
+ case 'network_map_enterprise_edit':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_de_red&printable=yes#Mapa_de_red_no_vac.C3.ADo';
+ } else {
+ $result .= 'Data_Presentation/Network_Maps&printable=yes#Non_empty_network_map';
+ }
+ break;
+
+ case 'network_map_enterprise_list':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_de_red&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Data_Presentation/Network_Maps&printable=yes#Introduction';
+ }
+ break;
+
+ case 'network_map_enterprise_empty':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_de_red&printable=yes#Mapa_de_red_vac.C3.ADo';
+ } else {
+ $result .= 'Data_Presentation/Network_Maps&printable=yes#Empty_network_map';
+ }
+ break;
+
+ case 'network_map_enterprise_view':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_de_red&printable=yes#Vista_de_un_mapa_de_red';
+ } else {
+ $result .= 'Data_Presentation/Network_Maps&printable=yes#Network_map_view';
+ }
+ break;
+
+ case 'transactional_view':
+ if ($es) {
+ $result .= 'Monitorizacion_transaccional&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Transactional_Monitoring&printable=yes#Introduction';
+ }
+ break;
+
+ case 'pcap_filter':
+ if ($es) {
+ $result .= 'Netflow&printable=yes#Creaci.C3.B3n_del_filtro';
+ } else {
+ $result .= 'Netflow&printable=yes#Filter_creation';
+ }
+ break;
+
+ case 'planned_downtime':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Introducci.C3.B3n_4';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Introduction_4';
+ }
+ break;
+
+ case 'planned_downtime_editor':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Creaci.C3.B3n_parada_planificada';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Create_a_scheduled_downtime';
+ }
+ break;
+
+ case 'plugin_definition':
+ if ($es) {
+ $result .= 'Anexo_Server_Plugins&printable=yes#Registro_manual_de_un_plugin_en_la_consola';
+ } else {
+ $result .= 'Anexo_Server_plugins_developement&printable=yes#Plugin_manual_registration';
+ }
+ break;
+
+ case 'plugin_macros':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Macros_internas';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Internal_Macros';
+ }
+ break;
+
+ case 'plugin_policy':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Plugins_de_agente';
+ } else {
+ $result .= 'Policy&printable=yes#Agent_Plug_Ins';
+ }
+ break;
+
+ case 'policy_queue':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Gesti.C3.B3n_de_la_cola_de_pol.C3.ADticas';
+ } else {
+ $result .= 'Policy&printable=yes#Policy_Queues_Management';
+ }
+ break;
+
+ case 'prediction_source_module':
+ if ($es) {
+ $result .= 'Monitorizacion_otra&printable=yes#Tipos_de_monitorizaci.C3.B3n_predictiva';
+ } else {
+ $result .= 'Other_Monitoring&printable=yes#Types_of_predictive_monitoring';
+ }
+ break;
+
+ case 'wmi_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_de_Windows_remotos_con_WMI';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Windows_Remote_Monitoring_with_WMI';
+ }
+ break;
+
+ case 'template_reporting_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#Introduction';
+ }
+ break;
+
+ case 'reporting_template_list_item_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Pesta.C3.B1a_List_Items';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_.27List_Items.27_Tab';
+ }
+ break;
+
+ case 'reporting_template_item_editor_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Pesta.C3.B1a_Item_editor';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_.27Item_Editor.27_Tab';
+ }
+ break;
+
+ case 'reporting_template_advanced_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Opciones_avanzadas_de_informe';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_Advanced_Options_Tab';
+ }
+ break;
+
+ case 'reporting_advanced_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Opciones_avanzadas_de_informe';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_Advanced_Options_Tab';
+ }
+ break;
+
+ case 'reporting_global_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Global';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_Global_Tab';
+ }
+ break;
+
+ case 'reporting_item_editor_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Pesta.C3.B1a_Item_editor';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_.27Item_Editor.27_Tab';
+ }
+ break;
+
+ case 'reporting_list_items_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Pesta.C3.B1a_List_Items';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_.27List_Items.27_Tab';
+ }
+ break;
+
+ case 'reporting_wizard_sla_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Wizard_SLA';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_SLA_Wizard_Tab';
+ }
+ break;
+
+ case 'reporting_wizard_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Wizard_general';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#The_Wizard_Tab';
+ }
+ break;
+
+ case 'response_macros':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Event_Responses_macros';
+ } else {
+ $result .= 'Events&printable=yes#Event_Responses_macros';
+ }
+ break;
+
+ case 'events_responses_tab':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Introducci.C3.B3n_3';
+ } else {
+ $result .= 'Events&printable=yes#Introduction_3';
+ }
+ break;
+
+ case 'servers':
+ if ($es) {
+ $result .= 'Interfaz&printable=yes#Gesti.C3.B3n_de_servidores';
+ } else {
+ $result .= 'Interface&printable=yes#Server_management';
+ }
+ break;
+
+ case 'snmpwalk':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Navegador_SNMP_de_Pandora_FMS';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Pandora_FMS_SNMP_MIB_Browser';
+ }
+ break;
+
+ case 'tags_config':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Sistemas_de_permisos_ampliados_mediante_etiquetas_.28tags.29';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Permission_system_extended_by_tags';
+ }
+ break;
+
+ case 'transactional_map_phases':
+ if ($es) {
+ $result .= 'Monitorizacion_transaccional&printable=yes#Creaci.C3.B3n_del_.C3.A1rbol_de_fases';
+ } else {
+ $result .= 'Transactional_Monitoring&printable=yes#Creating_the_phase_tree';
+ }
+ break;
+
+ case 'transactional_map_phases_data':
+ if ($es) {
+ $result .= 'Monitorizacion_transaccional&printable=yes#Configuraci.C3.B3n_de_los_scripts_de_control';
+ } else {
+ $result .= 'Transactional_Monitoring&printable=yes#Control_scripts_configuration';
+ }
+ break;
+
+ case 'wizard_reporting_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Informes&printable=yes#Asistente_de_plantillas';
+ } else {
+ $result .= 'Data_Presentation/Reports&printable=yes#Template_Wizard';
+ }
+ break;
+
+ case 'user_edit_notifications':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Configuraci.C3.B3n_de_notificaciones';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Notification_configuration';
+ }
+ break;
+
+ case 'view_services':
+ if ($es) {
+ $result .= 'Servicios&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Services&printable=yes#Introduction';
+ }
+ break;
+
+ case 'visual_console_editor_data_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Creaci.C3.B3n_-_Datos_generales';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Creation_-_General_data';
+ }
+ break;
+
+ case 'visual_console_editor_editor_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Creaci.C3.B3n_y_edici.C3.B3n_de_consolas_visuales';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Creation_and_edition_of_Visual_Consoles';
+ }
+ break;
+
+ case 'visual_console_editor_list_elements_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Creaci.C3.B3n_-_lista_de_elementos';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Creation_-_List_of_Elements';
+ }
+ break;
+
+ case 'visual_console_editor_wizard_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Creaci.C3.B3n_-_Wizard';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Creation_-_Wizard';
+ }
+ break;
+
+ case 'visual_console_editor_wizard_services_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Creaci.C3.B3n_-_Wizard_de_Servicios';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Creation_-_Service_Wizard';
+ }
+ break;
+
+ case 'visual_console_tab':
+ if ($es) {
+ $result .= 'Presentacion_datos/Mapas_visuales&printable=yes#Mapa_asociado';
+ } else {
+ $result .= 'Data_Presentation/Visual_Maps&printable=yes#Associated_Map';
+ }
+ break;
+
+ case 'view_created_map_services_tab':
+ if ($es) {
+ $result .= 'Servicios&printable=yes#Vista_de_mapa_de_servicio';
+ } else {
+ $result .= 'Services&printable=yes#Service_Map_View';
+ }
+ break;
+
+ case 'view_created_services_tab':
+ if ($es) {
+ $result .= 'Servicios&printable=yes#Lista_simple_de_un_servicio_y_todos_los_elementos_que_contiene';
+ } else {
+ $result .= 'Services&printable=yes#List-based_view_of_a_Service_and_its_Elements';
+ }
+ break;
+
+ case 'config_service_element_tab':
+ if ($es) {
+ $result .= 'Servicios&printable=yes#Configuraci.C3.B3n_de_elementos';
+ } else {
+ $result .= 'Services&printable=yes#Element_Configuration';
+ }
+ break;
+
+ case 'config_service_tab':
+ if ($es) {
+ $result .= 'Servicios&printable=yes#Configuraci.C3.B3n_inicial';
+ } else {
+ $result .= 'Services&printable=yes#Initial_Configuration';
+ }
+ break;
+
+ case 'other_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Otra_configuraci.C3.B3n';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Other_configuration';
+ }
+ break;
+
+ case 'services_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_servicios';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Services_configuration';
+ }
+ break;
+
+ case 'visual_consoles_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_de_las_consolas_visuales';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Visual_console_configuration';
+ }
+ break;
+
+ case 'charts_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_de_gr.C3.A1ficas';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Chart_settings';
+ }
+ break;
+
+ case 'front_and_text_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_de_Fuente_y_texto';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Font_and_text_settings';
+ }
+ break;
+
+ case 'gis_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_GIS';
+ } else {
+ $result .= 'Console_Setup&printable=yes#GIS_configuration';
+ }
+ break;
+
+ case 'style_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_de_estilo';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Style_configuration';
+ }
+ break;
+
+ case 'behavoir_conf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Configuraci.C3.B3n_del_comportamiento';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Behaviour_configuration';
+ }
+ break;
+
+ case 'setup_ehorus_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#eHorus';
+ } else {
+ $result .= 'Console_Setup&printable=yes#EHorus';
+ }
+ break;
+
+ case 'diagnostic_tool_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Diagnostic_tool';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Diagnostic_tool';
+ }
+ break;
+
+ case 'performance_metrics_tab':
+ if ($es) {
+ $result .= 'Optimizacion&printable=yes#Comprobaci.C3.B3n_del_fichero_my.ini.2Fcnf';
+ } else {
+ $result .= 'Optimization&printable=yes#Check_my.ini.2Fcnf_settings';
+ }
+ break;
+
+ case 'db_status_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#DB_Schema_Check';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#DB_Schema_Check';
+ }
+ break;
+
+ case 'database_backup_utility_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Backup';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Backup';
+ }
+ break;
+
+ case 'update_manager_offline_tab':
+ if ($es) {
+ $result .= 'Actualizacion&printable=yes#Actualizaciones_.22offline.22';
+ } else {
+ $result .= 'Anexo_Upgrade&printable=yes#.22Offline.22_updates';
+ }
+ break;
+
+ case 'update_manager_online_tab':
+ if ($es) {
+ $result .= 'Actualizacion&printable=yes#Actualizaciones_.22online.22';
+ } else {
+ $result .= 'Anexo_Upgrade&printable=yes#.22Online.22_updates';
+ }
+ break;
+
+ case 'others_database_maintenance_options_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Otros';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Others';
+ }
+ break;
+
+ case 'database_maintenance_options_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Opciones_de_mantenimiento_de_la_base_de_datos';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Database_maintenance_options';
+ }
+ break;
+
+ case 'database_maintenance_status_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Estado_del_mantenimiento_de_las_bases_de_datos';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Database_maintenance_status';
+ }
+ break;
+
+ case 'historical_database_maintenance_options_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Opciones_de_mantenimiento_de_la_base_de_datos_hist.C3.B3rica';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Historical_database_maintenance_options';
+ }
+ break;
+
+ case 'setup_enterprise_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#Enterprise';
+ } else {
+ $result .= 'Console_Setup&printable=yes#Features_of_the_Enterprise_Version';
+ }
+ break;
+
+ case 'setup_general_tab':
+ if ($es) {
+ $result .= 'Configuracion_Consola&printable=yes#General_Setup';
+ } else {
+ $result .= 'Console_Setup&printable=yes#General_Setup';
+ }
+ break;
+
+ case 'export_target_tab':
+ if ($es) {
+ $result .= 'ExportServer&printable=yes#A.C3.B1adir_un_servidor_de_destino';
+ } else {
+ $result .= 'Export_Server&printable=yes#Adding_a_Target_Server';
+ }
+ break;
+
+ case 'servers_ha_clusters_tab':
+ if ($es) {
+ $result .= 'HA&printable=yes#Alta_disponibilidad_del_Servidor_de_Datos';
+ } else {
+ $result .= 'HA&printable=yes#HA_of_Data_Server';
+ }
+ break;
+
+ case 'plugins_tab':
+ if ($es) {
+ $result .= 'Anexo_Agent_Plugins&printable=yes#Caracter.C3.ADsticas_b.C3.A1sicas_de_plugin_de_agente';
+ } else {
+ $result .= 'Anexo_Agent_Plugins&printable=yes#Basic_Features_of_the_Agent_Plugin';
+ }
+ break;
+
+ case 'agent_snmp_explorer_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Wizard_SNMP';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#SNMP_Wizard';
+ }
+ break;
+
+ case 'agent_snmp_interfaces_explorer_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#SNMP_Interfaces_wizard';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#SNMP_Interface_Wizard';
+ }
+ break;
+
+ case 'agent_snmp_wmi_explorer_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Wizard_WMI';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#WMI_Wizard';
+ }
+ break;
+
+ case 'group_list_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Introducci.C3.B3n_2';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Introduction_2';
+ }
+ break;
+
+ case 'acl_setup_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Introducci.C3.B3n_3';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Introduction_3';
+ }
+ break;
+
+ case 'profile_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Perfiles_en_Pandora_FMS';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Profiles_in_Pandora_FMS';
+ }
+ break;
+
+ case 'configure_profiles_tab':
+ if ($es) {
+ $result .= 'Gestion_y_Administracion&printable=yes#Perfiles_en_Pandora_FMS';
+ } else {
+ $result .= 'Managing_and_Administration&printable=yes#Profiles_in_Pandora_FMS';
+ }
+ break;
+
+ case 'network_component_tab':
+ if ($es) {
+ $result .= 'Plantillas_y_Componentes&printable=yes#Componentes_de_red';
+ } else {
+ $result .= 'Templates_and_components&printable=yes#Network_Components';
+ }
+ break;
+
+ case 'local_component_tab':
+ if ($es) {
+ $result .= 'Plantillas_y_Componentes&printable=yes#Componentes_locales';
+ } else {
+ $result .= 'Templates_and_components&printable=yes#Local_Components';
+ }
+ break;
+
+ case 'module_template_tab':
+ if ($es) {
+ $result .= 'Plantillas_y_Componentes&printable=yes#Plantillas_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Templates_and_components&printable=yes#Module_Templates';
+ }
+ break;
+
+ case 'agent_autoconf_tab':
+ if ($es) {
+ $result .= 'Configuracion_Agentes&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Configuration_Agents&printable=yes#Introduction';
+ }
+ break;
+
+ case 'policies_management_tab':
+ if ($es) {
+ $result .= 'Politicas&printable=yes#Introducci.C3.B3n';
+ } else {
+ $result .= 'Policy&printable=yes#Introduction';
+ }
+ break;
+
+ case 'massive_agents_tab':
+ if ($es) {
+ $result .= 'Operaciones_Masivas&printable=yes#Edici.C3.B3n_masiva_de_agentes';
+ } else {
+ $result .= 'Massive_Operations&printable=yes#Agent_massive_edition';
+ }
+ break;
+
+ case 'massive_modules_tab':
+ if ($es) {
+ $result .= 'Operaciones_Masivas&printable=yes#Edici.C3.B3n_masiva_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Massive_Operations&printable=yes#Modules_massive_edition';
+ }
+ break;
+
+ case 'massive_policies_tab':
+ if ($es) {
+ $result .= 'Operaciones_Masivas&printable=yes#Editar_m.C3.B3dulos_de_pol.C3.ADticas_masivamente';
+ } else {
+ $result .= 'Massive_Operations&printable=yes#Edit_policy_modules_massively';
+ }
+ break;
+
+ case 'alert_templates_tab':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Introducci.C3.B3n_4';
+ } else {
+ $result .= 'Alerts&printable=yes#Introduction_4';
+ }
+ break;
+
+ case 'configure_alert_template_step_1':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Paso_1:_General';
+ } else {
+ $result .= 'Alerts&printable=yes#Step_1:_General';
+ }
+ break;
+
+ case 'configure_alert_template_step_2':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Paso_2:_Condiciones';
+ } else {
+ $result .= 'Alerts&printable=yes#Step_2:_Conditions';
+ }
+ break;
+
+ case 'configure_alert_template_step_3':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Paso_3:_Campos_avanzados';
+ } else {
+ $result .= 'Alerts&printable=yes#Step_3:_Advanced_fields';
+ }
+ break;
+
+ case 'alerts_action':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Introducci.C3.B3n_3';
+ } else {
+ $result .= 'Alerts&printable=yes#Introduction_3';
+ }
+ break;
+
+ case 'alerts_command_tab':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Introducci.C3.B3n_2';
+ } else {
+ $result .= 'Alerts&printable=yes#Introduction_2';
+ }
+ break;
+
+ case 'alerts_config_command_tab':
+ if ($es) {
+ $result .= 'Alertas&printable=yes#Creaci.C3.B3n_de_un_comando_para_una_alerta';
+ } else {
+ $result .= 'Alerts&printable=yes#Command_Creation_for_an_Alert';
+ }
+ break;
+
+ case 'configure_alert_event_step_1':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Creaci.C3.B3n_alerta_de_evento';
+ } else {
+ $result .= 'Events&printable=yes#Event_Alert_creation';
+ }
+ break;
+
+ case 'configure_event_rule_tab':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Creaci.C3.B3n_alerta_de_evento';
+ } else {
+ $result .= 'Events&printable=yes#Event_Alert_creation';
+ }
+ break;
+
+ case 'snmp_alert_overview_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_traps_SNMP&printable=yes#Introducci.C3.B3n_2';
+ } else {
+ $result .= 'SNMP_traps_Monitoring&printable=yes#Introduction_2';
+ }
+ break;
+
+ case 'snmp_alert_update_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_traps_SNMP&printable=yes#A.C3.B1adir_una_alerta';
+ } else {
+ $result .= 'SNMP_traps_Monitoring&printable=yes#Alert_Creation';
+ }
+ break;
+
+ case 'sound_console_tab':
+ if ($es) {
+ $result .= 'Eventos&printable=yes#Uso';
+ } else {
+ $result .= 'Events&printable=yes#Use';
+ }
+ break;
+
+ case 'local_module_tab':
+ if ($es) {
+ $result .= 'Intro_Monitorizacion&printable=yes#Par.C3.A1metros_comunes';
+ } else {
+ $result .= 'Intro_Monitoring&printable=yes#Common_Parameters';
+ }
+ break;
+
+ case 'local_module':
+ if ($es) {
+ $result .= 'Operacion&printable=yes#Tipos_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Operations&printable=yes#Types_of_Modules';
+ }
+ break;
+
+ case 'data_server_module_tab':
+ if ($es) {
+ $result .= 'Operacion&printable=yes#Tipos_de_m.C3.B3dulos';
+ } else {
+ $result .= 'Operations&printable=yes#Types_of_Modules';
+ }
+ break;
+
+ case 'network_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#ICMP_Monitoring';
+ }
+ break;
+
+ case 'wux_console':
+ if ($es) {
+ $result .= 'Monitorizacion_Usuario&printable=yes#Crear_un_m.C3.B3dulo_de_an.C3.A1lisis_web_en_Pandora_FMS_Console';
+ } else {
+ $result .= 'User_Monitorization&printable=yes#Creating_a_Web_Analytics_module_in_Pandora_FMS_Console';
+ }
+ break;
+
+ case 'gis_basic_configurations_tab':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#Configuraci.C3.B3n_B.C3.A1sica';
+ } else {
+ $result .= 'GIS&printable=yes#Basic_Configuration';
+ }
+ break;
+
+ case 'gis_map_connection_tab':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#Mapas_Open_Street';
+ } else {
+ $result .= 'GIS&printable=yes#Open_Street_Maps';
+ }
+ break;
+
+ case 'icmp_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#ICMP_Monitoring';
+ }
+ break;
+
+ case 'snmp_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP';
+ }
+ break;
+
+ case 'tcp_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#TCP_Monitoring';
+ }
+ break;
+
+ case 'webserver_module_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web';
+ } else {
+ $result .= 'Web_Monitoring&printable=yes#Creating_Web_Modules';
+ }
+ break;
+
+ case 'wmi_query_tab':
+ if ($es) {
+ $result .= 'Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_de_Windows_remotos_con_WMI';
+ } else {
+ $result .= 'Remote_Monitoring&printable=yes#Windows_Remote_Monitoring_with_WMI';
+ }
+ break;
+
+ case 'module_type_tab':
+ if ($es) {
+ $result .= 'Operacion&printable=yes#Tipos_de_m.C3.B3dulos';
+ } else {
+ $result .= '';
+ }
+ break;
+
+ case 'render_view_tab':
+ if ($es) {
+ $result .= 'Pandora_GIS&printable=yes#Operaci.C3.B3n';
+ } else {
+ $result .= 'GIS&printable=yes#Operation';
+ }
+ break;
+ }
+
+ // hd($result);
+ return $result;
+}
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index a1c6953d34..1036593727 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -2744,6 +2744,31 @@ function config_check()
}
+/**
+ * Retrieves base url stored for Update Manager.
+ *
+ * @return string URL.
+ */
+function get_um_url()
+{
+ global $config;
+
+ if (isset($config['url_update_manager'])) {
+ $url = $config['url_update_manager'];
+ $url = substr($url, 0, (strlen($url) - strpos(strrev($url), '/')));
+ } else {
+ $url = 'https://licensing.artica.es/pandoraupdate7/';
+ config_update_value(
+ 'url_update_manager',
+ 'https://licensing.artica.es/pandoraupdate7/server.php'
+ );
+ }
+
+ return $url;
+
+}
+
+
/**
* Return in bytes
*
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 4d1fed36e0..81a3365fc5 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -1,16 +1,32 @@
0) {
- // Propagate the last known data to the end of the interval
+ // Propagate the last known data to the end of the interval.
$nextData = [
'datos' => $data[(count($data) - 1)]['datos'],
'utimestamp' => $date_array['final_date'],
@@ -114,9 +144,8 @@ function grafico_modulo_sparse_data_chart(
array_push($data, $nextData);
}
- // Check available data
+ // Check available data.
if (count($data) < 1) {
- // return fs_error_image ();
return false;
}
@@ -126,7 +155,7 @@ function grafico_modulo_sparse_data_chart(
$array_percentil = [];
foreach ($data as $k => $v) {
- // convert array
+ // Convert array.
if ($params['flag_overlapped']) {
$array_data['sum'.$series_suffix]['data'][$k] = [
(($v['utimestamp'] + $date_array['period'] ) * 1000),
@@ -139,40 +168,43 @@ function grafico_modulo_sparse_data_chart(
];
}
- // min
+ // Min.
if ($min_value > $v['datos']) {
$min_value = $v['datos'];
}
- // max
+ // Max.
if ($max_value < $v['datos']) {
$max_value = $v['datos'];
}
- // avg
+ // Avg.
$sum_data += $v['datos'];
$count_data++;
- // percentil
- if (!is_null($params['percentil']) && $params['percentil']) {
+ // Percentil.
+ if (!isset($params['percentil']) && $params['percentil']) {
$array_percentil[] = $v['datos'];
}
}
- $array_data['sum'.$series_suffix]['min'] = $min_value;
- $array_data['sum'.$series_suffix]['max'] = $max_value;
- $array_data['sum'.$series_suffix]['avg'] = ($sum_data / $count_data);
+ $array_data['sum'.$series_suffix]['min'] = $min_value;
+ $array_data['sum'.$series_suffix]['max'] = $max_value;
+ $array_data['sum'.$series_suffix]['avg'] = ($sum_data / $count_data);
$array_data['sum'.$series_suffix]['agent_module_id'] = $agent_module_id;
$array_data['sum'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
- $array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
- $array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
- $array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
+ $array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
+ $array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
+ $array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
- if (!is_null($params['percentil'])
+ if (!isset($params['percentil'])
&& $params['percentil']
&& !$params['flag_overlapped']
) {
- $percentil_result = get_percentile($params['percentil'], $array_percentil);
+ $percentil_result = get_percentile(
+ $params['percentil'],
+ $array_percentil
+ );
$array_data['percentil'.$series_suffix]['data'][0] = [
($date_array['start_date'] * 1000),
$percentil_result,
@@ -188,6 +220,17 @@ function grafico_modulo_sparse_data_chart(
}
+/**
+ * Prepare data for send to function js paint charts.
+ *
+ * @param integer $agent_module_id ID.
+ * @param array $date_array Date stasrt finish and period.
+ * @param array $data_module_graph Data module.
+ * @param array $params Params graphs.
+ * @param integer $series_suffix Int.
+ *
+ * @return array Prepare data to paint js.
+ */
function grafico_modulo_sparse_data(
$agent_module_id,
$date_array,
@@ -210,7 +253,7 @@ function grafico_modulo_sparse_data(
$params['type_mode_graph']
);
} else {
- // uncompress data except boolean and string.
+ // Uncompress data except boolean and string.
if ($data_module_graph['id_module_type'] == 23
|| $data_module_graph['id_module_type'] == 3
|| $data_module_graph['id_module_type'] == 17
@@ -232,6 +275,7 @@ function grafico_modulo_sparse_data(
$series_suffix
);
} else {
+ $data_slice = ($date_array['period'] / (250 * $params['zoom']) + 100);
$array_data = fullscale_data(
$agent_module_id,
$date_array,
@@ -239,7 +283,7 @@ function grafico_modulo_sparse_data(
$params['percentil'],
$series_suffix,
$params['flag_overlapped'],
- $data_slice = ($date_array['period'] / (250 * $params['zoom']) + 100),
+ $data_slice,
$params['type_mode_graph']
);
}
@@ -253,12 +297,13 @@ function grafico_modulo_sparse_data(
$array_data['sum'.$series_suffix]['agent_module_id'] = $agent_module_id;
$array_data['sum'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
- $array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
- $array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
- $array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
- $array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
+ $array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
+ $array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
+ $array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
+ $array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
- // This is for a specific type of report that consists in passing an interval and doing the average sum and avg.
+ // This is for a specific type of report that consists in passing
+ // an interval and doing the average sum and avg.
if ($params['force_interval'] != '') {
$period_time_interval = ($date_array['period'] * 1000);
$start_period = ($date_array['start_date'] * 1000);
@@ -270,7 +315,9 @@ function grafico_modulo_sparse_data(
while ($period_time_interval > 0) {
foreach ($array_data['sum1']['data'] as $key => $value) {
- if ($value[0] >= $start_period && $value[0] < ($start_period + $params['time_interval'] * 1000)) {
+ if ($value[0] >= $start_period
+ && $value[0] < ($start_period + $params['time_interval'] * 1000)
+ ) {
$sum_data = $value[1];
$array_data_only[] = $value[1];
$count_data++;
@@ -278,7 +325,9 @@ function grafico_modulo_sparse_data(
} else {
if ($params['force_interval'] == 'max_only') {
$acum_array_data[$i][0] = $start_period;
- if (is_array($array_data_only) && count($array_data_only) > 0) {
+ if (is_array($array_data_only)
+ && count($array_data_only) > 0
+ ) {
$acum_array_data[$i][1] = max($array_data_only);
$data_last_acum = $array_data_only[(count($array_data_only) - 1)];
} else {
@@ -288,7 +337,9 @@ function grafico_modulo_sparse_data(
if ($params['force_interval'] == 'min_only') {
$acum_array_data[$i][0] = $start_period;
- if (is_array($array_data_only) && count($array_data_only) > 0) {
+ if (is_array($array_data_only)
+ && count($array_data_only) > 0
+ ) {
$acum_array_data[$i][1] = min($array_data_only);
$data_last_acum = $array_data_only[(count($array_data_only) - 1)];
} else {
@@ -298,7 +349,9 @@ function grafico_modulo_sparse_data(
if ($params['force_interval'] == 'avg_only') {
$acum_array_data[$i][0] = $start_period;
- if (is_array($array_data_only) && count($array_data_only) > 0) {
+ if (is_array($array_data_only)
+ && count($array_data_only) > 0
+ ) {
$acum_array_data[$i][1] = ($sum_data / $count_data);
} else {
$acum_array_data[$i][1] = $data_last_acum;
@@ -317,7 +370,7 @@ function grafico_modulo_sparse_data(
$period_time_interval = ($period_time_interval - $params['time_interval']);
}
- // drag the last value to paint the graph correctly
+ // Drag the last value to paint the graph correctly.
$acum_array_data[] = [
0 => $start_period,
1 => $acum_array_data[($i - 1)][1],
@@ -361,7 +414,6 @@ function grafico_modulo_sparse_data(
$date_array['final_date'],
$data_module_graph['history_db'],
1
- // fix the time ranges to start_date - final_date
);
if ($unknown_events !== false) {
@@ -496,57 +548,55 @@ function grafico_modulo_sparse_data(
}
-/*
- $params =array(
- 'agent_module_id' => $agent_module_id,
- 'period' => $period,
- 'show_events' => false,
- 'width' => $width,
- 'height' => $height,
- 'title' => '',
- 'unit_name' => null,
- 'show_alerts' => false,
- 'date' => 0,
- 'unit' => '',
- 'baseline' => 0,
- 'return_data' => 0,
- 'show_title' => true,
- 'only_image' => false,
- 'homeurl' => $config['homeurl'],
- 'ttl' => 1,
- 'adapt_key' => '',
- 'compare' => false,
- 'show_unknown' => false,
- 'menu' => true,
- 'backgroundColor' => 'white',
- 'percentil' => null,
- 'dashboard' => false,
- 'vconsole' => false,
- 'type_graph' => 'area',
- 'fullscale' => false,
- 'id_widget_dashboard' => false,
- 'force_interval' => '',
- 'time_interval' => 300,
- 'array_data_create' => 0,
- 'show_legend' => true,
- 'show_overview' => true,
- 'return_img_base_64' => false,
- 'image_treshold' => false,
- 'graph_combined' => false,
- 'zoom' => 1,
- 'server_id' => null,
- 'stacked' => 0,
- );
-*/
+/**
+ * Functions tu create graphs.
+ *
+ * @param array $params Details builds graphs. For example:
+ * 'agent_module_id' => $agent_module_id,
+ * 'period' => $period,
+ * 'show_events' => false,
+ * 'width' => $width,
+ * 'height' => $height,
+ * 'title' => '',
+ * 'unit_name' => null,
+ * 'show_alerts' => false,
+ * 'date' => 0,
+ * 'unit' => '',
+ * 'baseline' => 0,
+ * 'return_data' => 0,
+ * 'show_title' => true,
+ * 'only_image' => false,
+ * 'homeurl' => $config['homeurl'],
+ * 'ttl' => 1,
+ * 'adapt_key' => '',
+ * 'compare' => false,
+ * 'show_unknown' => false,
+ * 'menu' => true,
+ * 'backgroundColor' => 'white',
+ * 'percentil' => null,
+ * 'dashboard' => false,
+ * 'vconsole' => false,
+ * 'type_graph' => 'area',
+ * 'fullscale' => false,
+ * 'id_widget_dashboard' => false,
+ * 'force_interval' => '',
+ * 'time_interval' => 300,
+ * 'array_data_create' => 0,
+ * 'show_legend' => true,
+ * 'show_overview' => true,
+ * 'return_img_base_64' => false,
+ * 'image_treshold' => false,
+ * 'graph_combined' => false,
+ * 'zoom' => 1,
+ * 'server_id' => null,
+ * 'stacked' => 0.
+ *
+ * @return string html Content graphs.
+ */
function grafico_modulo_sparse($params)
{
global $config;
- /*
- XXXXXXXXXXXX Documnetar
- *Set all variable
- */
-
if (!isset($params) || !is_array($params)) {
return false;
}
@@ -694,11 +744,10 @@ function grafico_modulo_sparse($params)
}
if (!isset($params['zoom'])) {
- $params['zoom'] = $config['zoom_graph'] ? $config['zoom_graph'] : 1;
+ $params['zoom'] = ($config['zoom_graph']) ? $config['zoom_graph'] : 1;
}
if (!isset($params['type_mode_graph'])) {
- // $config['type_mode_graph']
$params['type_mode_graph'] = $config['type_mode_graph'];
}
@@ -716,10 +765,11 @@ function grafico_modulo_sparse($params)
$params['stacked'] = 0;
}
- // XXXX Configurable
- $params['grid_color'] = '#C1C1C1';
+ // TODO: Configurable.
+ $params['grid_color'] = '#C1C1C1';
$params['legend_color'] = '#636363';
- $params['font'] = $config['fontpath'];
+
+ $params['font'] = $config['fontpath'];
$params['font_size'] = $config['font_size'];
$params['short_data'] = $config['short_module_graph_data'];
@@ -730,8 +780,8 @@ function grafico_modulo_sparse($params)
global $graphic_type;
global $array_events_alerts;
- $array_data = [];
- $legend = [];
+ $array_data = [];
+ $legend = [];
$array_events_alerts = [];
$date_array = [];
@@ -746,26 +796,36 @@ function grafico_modulo_sparse($params)
);
$data_module_graph = [];
- $data_module_graph['history_db'] = db_search_in_history_db($date_array['start_date']);
- $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name($agent_module_id);
- $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias($agent_module_id);
- $data_module_graph['agent_id'] = $module_data['id_agente'];
- $data_module_graph['module_name'] = $module_data['nombre'];
+ $data_module_graph['history_db'] = db_search_in_history_db(
+ $date_array['start_date']
+ );
+ $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name(
+ $agent_module_id
+ );
+ $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
+ $agent_module_id
+ );
+ $data_module_graph['agent_id'] = $module_data['id_agente'];
+ $data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
- $data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
- $data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
- $data_module_graph['w_min'] = $module_data['min_warning'];
- $data_module_graph['w_max'] = $module_data['max_warning'];
- $data_module_graph['w_inv'] = $module_data['warning_inverse'];
- $data_module_graph['c_min'] = $module_data['min_critical'];
- $data_module_graph['c_max'] = $module_data['max_critical'];
- $data_module_graph['c_inv'] = $module_data['critical_inverse'];
- $data_module_graph['unit'] = $module_data['unit'];
+ $data_module_graph['module_type'] = modules_get_moduletype_name(
+ $data_module_graph['id_module_type']
+ );
+ $data_module_graph['uncompressed'] = is_module_uncompressed(
+ $data_module_graph['module_type']
+ );
+ $data_module_graph['w_min'] = $module_data['min_warning'];
+ $data_module_graph['w_max'] = $module_data['max_warning'];
+ $data_module_graph['w_inv'] = $module_data['warning_inverse'];
+ $data_module_graph['c_min'] = $module_data['min_critical'];
+ $data_module_graph['c_max'] = $module_data['max_critical'];
+ $data_module_graph['c_inv'] = $module_data['critical_inverse'];
+ $data_module_graph['unit'] = $module_data['unit'];
} else {
$data_module_graph = false;
}
- // format of the graph
+ // Format of the graph.
if (empty($params['unit'])) {
$params['unit'] = $module_data['unit'];
if (modules_is_unit_macro($params['unit'])) {
@@ -775,7 +835,12 @@ function grafico_modulo_sparse($params)
if (!$params['array_data_create']) {
if ($params['baseline']) {
- $array_data = get_baseline_data($agent_module_id, $date_array, $data_module_graph, $params);
+ $array_data = get_baseline_data(
+ $agent_module_id,
+ $date_array,
+ $data_module_graph,
+ $params
+ );
} else {
if ($params['compare'] !== false) {
$series_suffix = 2;
@@ -801,10 +866,14 @@ function grafico_modulo_sparse($params)
switch ($params['compare']) {
case 'separated':
case 'overlapped':
- // Store the chart calculated
+ // Store the chart calculated.
$array_data_prev = $array_data;
$legend_prev = $legend;
break;
+
+ default:
+ // Not defined.
+ break;
}
}
@@ -857,7 +926,7 @@ function grafico_modulo_sparse($params)
$data_module_graph['series_suffix'] = $series_suffix;
- // Check available data
+ // Check available data.
if ($params['compare'] === 'separated') {
if (!empty($array_data)) {
$return = area_graph(
@@ -931,67 +1000,41 @@ function grafico_modulo_sparse($params)
/**
- * Produces a combined/user defined graph
+ * Functions tu create graphs.
*
- * @param array List of source modules
- * @param array List of weighs for each module
- * @param int Period (in seconds)
- * @param int Width, in pixels
- * @param int Height, in pixels
- * @param string Title for graph
- * @param string Unit name, for render in legend
- * @param int Show events in graph (set to 1)
- * @param int Show alerts in graph (set to 1)
- * @param int Pure mode (without titles) (set to 1)
- * @param int Date to start of getting info.
- * @param mixed If is a projection graph this parameter will be module data with prediction data (the projection)
- * or false in other case.
- * @param array List of names for the items. Should have the same size as the module list.
- * @param array List of units for the items. Should have the same size as the module list.
- * @param bool Show the last value of the item on the list.
- * @param bool Show the max value of the item on the list.
- * @param bool Show the min value of the item on the list.
- * @param bool Show the average value of the item on the list.
+ * @param array $module_list Array modules.
+ * @param array $params Details builds graphs. For example:
+ * 'period' => $period,
+ * 'show_events' => false,
+ * 'width' => $width,
+ * 'height' => $height,
+ * 'title' => '',
+ * 'unit_name' => null,
+ * 'show_alerts' => false,
+ * 'date' => 0,
+ * 'unit' => '',
+ * 'only_image' => false,
+ * 'homeurl' => '',
+ * 'ttl' => 1,
+ * 'percentil' => null,
+ * 'dashboard' => false,
+ * 'vconsole' => false,
+ * 'fullscale' => false,
+ * 'id_widget_dashboard' => false.
+ * @param array $params_combined Details builds graphs. For example:
+ * 'weight_list' => array(),
+ * 'stacked' => 0,
+ * 'projection' => false,
+ * 'labels' => array(),
+ * 'from_interface' => false,
+ * 'summatory' => 0,
+ * 'average' => 0,
+ * 'modules_series' => 0,
+ * 'id_graph' => 0,
+ * 'return' => 1.
*
- * @return Mixed
+ * @return string html Content graphs.
*/
-
-
-/*
- $params =array(
- 'period' => $period,
- 'show_events' => false,
- 'width' => $width,
- 'height' => $height,
- 'title' => '',
- 'unit_name' => null,
- 'show_alerts' => false,
- 'date' => 0,
- 'unit' => '',
- 'only_image' => false,
- 'homeurl' => '',
- 'ttl' => 1,
- 'percentil' => null,
- 'dashboard' => false,
- 'vconsole' => false,
- 'fullscale' => false,
- 'id_widget_dashboard' => false,
- );
-
- $params_combined = array(
- 'weight_list' => array(),
- 'stacked' => 0,
- 'projection' => false,
- 'labels' => array(),
- 'from_interface' => false,
- 'summatory' => 0,
- 'average' => 0,
- 'modules_series' => 0,
- 'id_graph' => 0,
- 'return' => 1
- );
-*/
-
function graphic_combined_module(
$module_list,
$params,
@@ -1171,18 +1214,24 @@ function graphic_combined_module(
$params_combined['graph_combined'] = true;
if ($params['only_image']) {
- return generator_chart_to_pdf('combined', $params, $params_combined, $module_list);
+ return generator_chart_to_pdf(
+ 'combined',
+ $params,
+ $params_combined,
+ $module_list
+ );
}
if (!isset($params['zoom'])) {
$params['zoom'] = 1;
}
- // XXXX Configurable
+ // TODO: Configurable.
$params['grid_color'] = '#C1C1C1';
$params['legend_color'] = '#636363';
- $params['font'] = $config['fontpath'];
- $params['font_size'] = $config['font_size'];
+
+ $params['font'] = $config['fontpath'];
+ $params['font_size'] = $config['font_size'];
$params['short_data'] = $config['short_module_graph_data'];
@@ -1228,8 +1277,10 @@ function graphic_combined_module(
array_push($modules, $source['id_agent_module']);
array_push($weights, $source['weight']);
if ($source['label'] != '' || $params_combined['labels']) {
- $item['type'] = 'custom_graph';
- $item['id_agent'] = agents_get_module_id($source['id_agent_module']);
+ $item['type'] = 'custom_graph';
+ $item['id_agent'] = agents_get_module_id(
+ $source['id_agent_module']
+ );
$item['id_agent_module'] = $source['id_agent_module'];
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
}
@@ -1281,13 +1332,13 @@ function graphic_combined_module(
}
}
- $width = $params['width'];
- $height = $params['height'];
- $homeurl = $params['homeurl'];
- $ttl = $params['ttl'];
+ $width = $params['width'];
+ $height = $params['height'];
+ $homeurl = $params['homeurl'];
+ $ttl = $params['ttl'];
$background_color = $params['backgroundColor'];
- $datelimit = $date_array['start_date'];
- $fixed_font_size = $config['font_size'];
+ $datelimit = $date_array['start_date'];
+ $fixed_font_size = $config['font_size'];
if ($config['fixed_graph'] == false) {
$water_mark = [
@@ -1344,22 +1395,32 @@ function graphic_combined_module(
);
$data_module_graph = [];
- $data_module_graph['history_db'] = db_search_in_history_db($date_array['start_date']);
- $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name($agent_module_id);
- $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias($agent_module_id);
- $data_module_graph['agent_id'] = $module_data['id_agente'];
- $data_module_graph['module_name'] = $module_data['nombre'];
+ $data_module_graph['history_db'] = db_search_in_history_db(
+ $date_array['start_date']
+ );
+ $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name(
+ $agent_module_id
+ );
+ $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
+ $agent_module_id
+ );
+ $data_module_graph['agent_id'] = $module_data['id_agente'];
+ $data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
- $data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
- $data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
- $data_module_graph['w_min'] = $module_data['min_warning'];
- $data_module_graph['w_max'] = $module_data['max_warning'];
- $data_module_graph['w_inv'] = $module_data['warning_inverse'];
- $data_module_graph['c_min'] = $module_data['min_critical'];
- $data_module_graph['c_max'] = $module_data['max_critical'];
- $data_module_graph['c_inv'] = $module_data['critical_inverse'];
- $data_module_graph['module_id'] = $agent_module_id;
- $data_module_graph['unit'] = $module_data['unit'];
+ $data_module_graph['module_type'] = modules_get_moduletype_name(
+ $data_module_graph['id_module_type']
+ );
+ $data_module_graph['uncompressed'] = is_module_uncompressed(
+ $data_module_graph['module_type']
+ );
+ $data_module_graph['w_min'] = $module_data['min_warning'];
+ $data_module_graph['w_max'] = $module_data['max_warning'];
+ $data_module_graph['w_inv'] = $module_data['warning_inverse'];
+ $data_module_graph['c_min'] = $module_data['min_critical'];
+ $data_module_graph['c_max'] = $module_data['max_critical'];
+ $data_module_graph['c_inv'] = $module_data['critical_inverse'];
+ $data_module_graph['module_id'] = $agent_module_id;
+ $data_module_graph['unit'] = $module_data['unit'];
// Stract data.
$array_data_module = grafico_modulo_sparse_data(
@@ -1400,10 +1461,11 @@ function graphic_combined_module(
// Work around for fixed the agents name with huge size chars.
$fixed_font_size = $config['font_size'];
- // $array_events_alerts[$series_suffix] = $events;
$i++;
- if (is_metaconsole() && $params_combined['type_report'] == 'automatic_graph') {
+ if (is_metaconsole()
+ && $params_combined['type_report'] == 'automatic_graph'
+ ) {
metaconsole_restore_db();
}
}
@@ -1418,7 +1480,7 @@ function graphic_combined_module(
}
if ($params_combined['projection']) {
- // If projection doesn't have data then don't draw graph
+ // If projection doesn't have data then don't draw graph.
if ($output_projection != null) {
$date_array_projection = max($output_projection);
$date_array['final_date'] = ($date_array_projection[0] / 1000);
@@ -1426,9 +1488,13 @@ function graphic_combined_module(
}
}
- // summatory and average series
- if ($params_combined['stacked'] == CUSTOM_GRAPH_AREA || $params_combined['stacked'] == CUSTOM_GRAPH_LINE) {
- if ($params_combined['summatory'] || $params_combined['average']) {
+ // Summatory and average series.
+ if ($params_combined['stacked'] == CUSTOM_GRAPH_AREA
+ || $params_combined['stacked'] == CUSTOM_GRAPH_LINE
+ ) {
+ if ($params_combined['summatory']
+ || $params_combined['average']
+ ) {
$array_data = combined_graph_summatory_average(
$array_data,
$params_combined['average'],
@@ -1471,9 +1537,19 @@ function graphic_combined_module(
$do_it_critical_inverse = true;
foreach ($module_list as $index => $id_module) {
- // Get module warning_min and critical_min
- $warning_min = db_get_value('min_warning', 'tagente_modulo', 'id_agente_modulo', $id_module);
- $critical_min = db_get_value('min_critical', 'tagente_modulo', 'id_agente_modulo', $id_module);
+ // Get module warning_min and critical_min.
+ $warning_min = db_get_value(
+ 'min_warning',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
+ $critical_min = db_get_value(
+ 'min_critical',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
if ($index == 0) {
$compare_warning = $warning_min;
@@ -1494,8 +1570,18 @@ function graphic_combined_module(
if ($do_it_warning_min || $do_it_critical_min) {
foreach ($module_list as $index => $id_module) {
- $warning_max = db_get_value('max_warning', 'tagente_modulo', 'id_agente_modulo', $id_module);
- $critical_max = db_get_value('max_critical', 'tagente_modulo', 'id_agente_modulo', $id_module);
+ $warning_max = db_get_value(
+ 'max_warning',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
+ $critical_max = db_get_value(
+ 'max_critical',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
if ($index == 0) {
$yellow_up = $warning_max;
@@ -1517,8 +1603,18 @@ function graphic_combined_module(
if ($do_it_warning_min || $do_it_critical_min) {
foreach ($module_list as $index => $id_module) {
- $warning_inverse = db_get_value('warning_inverse', 'tagente_modulo', 'id_agente_modulo', $id_module);
- $critical_inverse = db_get_value('critical_inverse', 'tagente_modulo', 'id_agente_modulo', $id_module);
+ $warning_inverse = db_get_value(
+ 'warning_inverse',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
+ $critical_inverse = db_get_value(
+ 'critical_inverse',
+ 'tagente_modulo',
+ 'id_agente_modulo',
+ $id_module
+ );
if ($index == 0) {
$yellow_inverse = $warning_inverse;
@@ -1538,18 +1634,24 @@ function graphic_combined_module(
}
}
- if ($do_it_warning_min && $do_it_warning_max && $do_it_warning_inverse) {
+ if ($do_it_warning_min
+ && $do_it_warning_max
+ && $do_it_warning_inverse
+ ) {
$yellow_threshold = $compare_warning;
$threshold_data['yellow_threshold'] = $compare_warning;
- $threshold_data['yellow_up'] = $yellow_up;
- $threshold_data['yellow_inverse'] = (bool) $yellow_inverse;
+ $threshold_data['yellow_up'] = $yellow_up;
+ $threshold_data['yellow_inverse'] = (bool) $yellow_inverse;
}
- if ($do_it_critical_min && $do_it_critical_max && $do_it_critical_inverse) {
+ if ($do_it_critical_min
+ && $do_it_critical_max
+ && $do_it_critical_inverse
+ ) {
$red_threshold = $compare_critical;
$threshold_data['red_threshold'] = $compare_critical;
- $threshold_data['red_up'] = $red_up;
- $threshold_data['red_inverse'] = (bool) $red_inverse;
+ $threshold_data['red_up'] = $red_up;
+ $threshold_data['red_inverse'] = (bool) $red_inverse;
}
$params['threshold_data'] = $threshold_data;
@@ -1596,9 +1698,12 @@ function graphic_combined_module(
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[$i])) {
- $server = metaconsole_get_connection_by_id($module_item['server']);
+ $server = metaconsole_get_connection_by_id(
+ $module_item['server']
+ );
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
@@ -1635,16 +1740,27 @@ function graphic_combined_module(
$value = false;
}
- if (!empty($params_combined['labels']) && isset($params_combined['labels'][$module])) {
+ if (!empty($params_combined['labels'])
+ && isset($params_combined['labels'][$module])
+ ) {
$label = io_safe_input($params_combined['labels'][$module]);
} else {
- $alias = db_get_value('alias', 'tagente', 'id_agente', $temp[$module]['id_agente']);
+ $alias = db_get_value(
+ 'alias',
+ 'tagente',
+ 'id_agente',
+ $temp[$module]['id_agente']
+ );
$label = $alias.': '.$temp[$module]['nombre'];
}
$temp[$module]['label'] = $label;
$temp[$module]['value'] = $value;
- $temp_max = reporting_get_agentmodule_data_max($module, $params['period'], $params['date']);
+ $temp_max = reporting_get_agentmodule_data_max(
+ $module,
+ $params['period'],
+ $params['date']
+ );
if ($temp_max < 0) {
$temp_max = 0;
}
@@ -1655,7 +1771,11 @@ function graphic_combined_module(
$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
}
- $temp_min = reporting_get_agentmodule_data_min($module, $params['period'], $params['date']);
+ $temp_min = reporting_get_agentmodule_data_min(
+ $module,
+ $params['period'],
+ $params['date']
+ );
if ($temp_min < 0) {
$temp_min = 0;
}
@@ -1663,7 +1783,8 @@ function graphic_combined_module(
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the
+ // report template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
@@ -1688,7 +1809,12 @@ function graphic_combined_module(
$color,
$module_name_list,
$long_index,
- ui_get_full_url('images/image_problem_area_small.png', false, false, false),
+ ui_get_full_url(
+ 'images/image_problem_area_small.png',
+ false,
+ false,
+ false
+ ),
'',
'',
$water_mark,
@@ -1699,7 +1825,6 @@ function graphic_combined_module(
$homeurl,
$background_color
);
-
break;
case CUSTOM_GRAPH_GAUGE:
@@ -1708,9 +1833,12 @@ function graphic_combined_module(
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from
+ // the report template in metaconsole.
if (is_array($module_list[$i])) {
- $server = metaconsole_get_connection_by_id($module_item['server']);
+ $server = metaconsole_get_connection_by_id(
+ $module_item['server']
+ );
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
@@ -1747,7 +1875,14 @@ function graphic_combined_module(
$temp[$module]['label'] = ($params_combined['labels'][$module] != '') ? $params_combined['labels'][$module] : $temp[$module]['nombre'];
$temp[$module]['value'] = $value;
- $temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'], 'module_small', false, true, false, '..');
+ $temp[$module]['label'] = ui_print_truncate_text(
+ $temp[$module]['label'],
+ 'module_small',
+ false,
+ true,
+ false,
+ '..'
+ );
if ($temp[$module]['unit'] == '%') {
$temp[$module]['min'] = 0;
@@ -1755,7 +1890,11 @@ function graphic_combined_module(
} else {
$min = $temp[$module]['min'];
if ($temp[$module]['max'] == 0) {
- $max = reporting_get_agentmodule_data_max($module, $params['period'], $params['date']);
+ $max = reporting_get_agentmodule_data_max(
+ $module,
+ $params['period'],
+ $params['date']
+ );
} else {
$max = $temp[$module]['max'];
}
@@ -1767,7 +1906,8 @@ function graphic_combined_module(
$temp[$module]['gauge'] = uniqid('gauge_');
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
@@ -1794,13 +1934,17 @@ function graphic_combined_module(
$height,
$color,
$module_name_list,
- ui_get_full_url('images/image_problem_area_small.png', false, false, false),
+ ui_get_full_url(
+ 'images/image_problem_area_small.png',
+ false,
+ false,
+ false
+ ),
$config['fontpath'],
$fixed_font_size,
'',
$homeurl
);
-
break;
case CUSTOM_GRAPH_HBARS:
@@ -1809,9 +1953,12 @@ function graphic_combined_module(
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[$i])) {
- $server = metaconsole_get_connection_by_id($module_item['server']);
+ $server = metaconsole_get_connection_by_id(
+ $module_item['server']
+ );
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
@@ -1840,17 +1987,25 @@ function graphic_combined_module(
modules_get_agentmodule_agent_name($module)
);
- if (!empty($params_combined['labels']) && isset($params_combined['labels'][$module])) {
+ if (!empty($params_combined['labels'])
+ && isset($params_combined['labels'][$module])
+ ) {
$label = $params_combined['labels'][$module];
} else {
- $alias = db_get_value('alias', 'tagente', 'id_agente', $module_data['id_agente']);
+ $alias = db_get_value(
+ 'alias',
+ 'tagente',
+ 'id_agente',
+ $module_data['id_agente']
+ );
$label = $alias.' - '.$module_data['nombre'];
}
$temp[$label]['g'] = round($temp_data, 4);
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
@@ -1874,7 +2029,12 @@ function graphic_combined_module(
$color,
$module_name_list,
$long_index,
- ui_get_full_url('images/image_problem_area_small.png', false, false, false),
+ ui_get_full_url(
+ 'images/image_problem_area_small.png',
+ false,
+ false,
+ false
+ ),
'',
'',
$water_mark,
@@ -1896,7 +2056,12 @@ function graphic_combined_module(
$color,
$module_name_list,
$long_index,
- ui_get_full_url('images/image_problem_area_small.png', false, false, false),
+ ui_get_full_url(
+ 'images/image_problem_area_small.png',
+ false,
+ false,
+ false
+ ),
'',
'',
$water_mark,
@@ -1918,9 +2083,12 @@ function graphic_combined_module(
foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[$i])) {
- $server = metaconsole_get_connection_by_id($module_item['server']);
+ $server = metaconsole_get_connection_by_id(
+ $module_item['server']
+ );
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
@@ -1959,10 +2127,19 @@ function graphic_combined_module(
$total_modules += $value;
- if (!empty($params_combined['labels']) && isset($params_combined['labels'][$module])) {
- $label = io_safe_output($params_combined['labels'][$module]);
+ if (!empty($params_combined['labels'])
+ && isset($params_combined['labels'][$module])
+ ) {
+ $label = io_safe_output(
+ $params_combined['labels'][$module]
+ );
} else {
- $alias = db_get_value('alias', 'tagente', 'id_agente', $data_module['id_agente']);
+ $alias = db_get_value(
+ 'alias',
+ 'tagente',
+ 'id_agente',
+ $data_module['id_agente']
+ );
$label = io_safe_output($alias.': '.$data_module['nombre']);
}
@@ -1971,7 +2148,8 @@ function graphic_combined_module(
'unit' => $data_module['unit'],
];
if ($config['metaconsole']) {
- // Automatic custom graph from the report template in metaconsole
+ // Automatic custom graph from the report
+ // template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
@@ -2004,7 +2182,6 @@ function graphic_combined_module(
false,
$background_color
);
-
break;
}
@@ -2016,8 +2193,24 @@ function graphic_combined_module(
}
-function combined_graph_summatory_average($array_data, $average=false, $summatory=false, $modules_series=false, $baseline=false)
-{
+/**
+ * Function for convert data summatory.
+ *
+ * @param array $array_data Data array.
+ * @param boolean $average Average.
+ * @param boolean $summatory Summatory.
+ * @param boolean $modules_series Series module.
+ * @param boolean $baseline Baseline data.
+ *
+ * @return array Data.
+ */
+function combined_graph_summatory_average(
+ $array_data,
+ $average=false,
+ $summatory=false,
+ $modules_series=false,
+ $baseline=false
+) {
if (isset($array_data) && is_array($array_data)) {
foreach ($array_data as $key => $value) {
if (strpos($key, 'sum') !== false) {
@@ -2035,10 +2228,13 @@ function combined_graph_summatory_average($array_data, $average=false, $summator
$data_array_pop = [];
$count = 0;
- while (count($data_array_reverse['sum0']) > 0) {
+ $count_data_array_reverse = count($data_array_reverse['sum0']);
+ while ($count_data_array_reverse > 0) {
foreach ($data_array_reverse as $key_reverse => $value_reverse) {
if (is_array($value_reverse) && count($value_reverse) > 0) {
- $data_array_pop[$key_reverse] = array_pop($data_array_reverse[$key_reverse]);
+ $data_array_pop[$key_reverse] = array_pop(
+ $data_array_reverse[$key_reverse]
+ );
}
}
@@ -2092,12 +2288,18 @@ function combined_graph_summatory_average($array_data, $average=false, $summator
$count++;
}
- if ($summatory && isset($array_sum_reverse) && is_array($array_sum_reverse) && count($array_sum_reverse) > 0) {
+ if ($summatory && isset($array_sum_reverse)
+ && is_array($array_sum_reverse)
+ && count($array_sum_reverse) > 0
+ ) {
$array_data['summatory']['data'] = $array_sum_reverse;
$array_data['summatory']['color'] = 'purple';
}
- if ($average && isset($array_avg_reverse) && is_array($array_avg_reverse) && count($array_avg_reverse) > 0) {
+ if ($average && isset($array_avg_reverse)
+ && is_array($array_avg_reverse)
+ && count($array_avg_reverse) > 0
+ ) {
if ($baseline) {
$array_data['baseline']['data'] = $array_avg_reverse;
$array_data['baseline']['color'] = 'green';
@@ -2118,19 +2320,28 @@ function combined_graph_summatory_average($array_data, $average=false, $summator
/**
* Print a graph with access data of agents
*
- * @param integer id_agent Agent ID
- * @param integer width pie graph width
- * @param integer height pie graph height
- * @param integer period time period
- * @param bool return or echo the result flag
+ * @param integer $id_agent Agent ID.
+ * @param integer $width Pie graph width.
+ * @param integer $height Pie graph height.
+ * @param integer $period Time period.
+ * @param boolean $return Return.
+ * @param boolean $tree View tree.
+ *
+ * @return string Return or echo the result flag.
*/
-function graphic_agentaccess($id_agent, $width, $height, $period=0, $return=false, $tree=false)
-{
+function graphic_agentaccess(
+ $id_agent,
+ $width,
+ $height,
+ $period=0,
+ $return=false,
+ $tree=false
+) {
global $config;
global $graphic_type;
- $date = get_system_time();
- $datelimit = ($date - $period);
+ $date = get_system_time();
+ $datelimit = ($date - $period);
$data_array = [];
$data = db_get_all_rows_sql(
@@ -2160,7 +2371,12 @@ function graphic_agentaccess($id_agent, $width, $height, $period=0, $return=fals
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
- 'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
+ 'url' => ui_get_full_url(
+ 'images/logo_vertical_water.png',
+ false,
+ false,
+ false
+ ),
];
}
@@ -3704,7 +3920,14 @@ function graph_graphic_moduleevents($id_agent, $id_module, $width, $height, $per
}
-// Prints an error image
+/**
+ * Function for retun image no data.
+ *
+ * @param integer $width Width.
+ * @param integer $height Height.
+ *
+ * @return string Image.
+ */
function fs_error_image($width=300, $height=110)
{
global $config;
@@ -3712,15 +3935,29 @@ function fs_error_image($width=300, $height=110)
}
+/**
+ * Function for uncompressed data module for cherts.
+ *
+ * @param integer $agent_module_id Id modulo.
+ * @param array $date_array Date start, finish, period.
+ * @param integer $show_unknown Show Unknown.
+ * @param integer $show_percentil Show Percentil.
+ * @param integer $series_suffix Series.
+ * @param boolean $compare Type compare.
+ * @param boolean $data_slice Size slice.
+ * @param string $type_mode_graph Type.
+ *
+ * @return array Return array data uncompresess.
+ */
function fullscale_data(
$agent_module_id,
$date_array,
$show_unknown=0,
$show_percentil=0,
- $series_suffix,
+ $series_suffix=0,
$compare=false,
$data_slice=false,
- $type_mode_graph
+ $type_mode_graph=''
) {
global $config;
$data_uncompress = db_uncompress_module_data(
@@ -3732,218 +3969,234 @@ function fullscale_data(
$data = [];
$previous_data = 0;
- // normal
+ // Normal.
$min_value_total = PHP_INT_MAX;
- $max_value_total = -PHP_INT_MAX;
- // max
+ $max_value_total = (-PHP_INT_MAX);
+ // Max.
$max_value_min = PHP_INT_MAX;
- $max_value_max = -PHP_INT_MAX;
- // min
+ $max_value_max = (-PHP_INT_MAX);
+ // Min.
$min_value_min = PHP_INT_MAX;
- $min_value_max = -PHP_INT_MAX;
- // avg
+ $min_value_max = (-PHP_INT_MAX);
+ // Avg.
$avg_value_min = PHP_INT_MAX;
- $avg_value_max = -PHP_INT_MAX;
+ $avg_value_max = (-PHP_INT_MAX);
$flag_unknown = 0;
$array_percentil = [];
if ($data_slice) {
- foreach ($data_uncompress as $k) {
- $sum_data = 0;
- $count_data = 0;
- $min_value = PHP_INT_MAX;
- $max_value = -PHP_INT_MAX;
- $flag_virtual_data = 0;
- foreach ($k['data'] as $v) {
- if (isset($v['type']) && $v['type'] == 1) {
- // skip unnecesary virtual data
- continue;
- $flag_virtual_data = 1;
- }
+ if (isset($data_uncompress) === true
+ && is_array($data_uncompress) === true
+ ) {
+ foreach ($data_uncompress as $k) {
+ $sum_data = 0;
+ $count_data = 0;
+ $min_value = PHP_INT_MAX;
+ $max_value = (-PHP_INT_MAX);
+ $flag_virtual_data = 0;
+ foreach ($k['data'] as $v) {
+ if (isset($v['type']) && $v['type'] == 1) {
+ // Skip unnecesary virtual data.
+ continue;
+ $flag_virtual_data = 1;
+ }
- if ($compare) {
- // * 1000 need js utimestam mlsecond
- $real_date = (($v['utimestamp'] + $date_array['period']) * 1000);
- } else {
- $real_date = ($v['utimestamp'] * 1000);
- }
+ if ($compare) {
+ // Data * 1000 need js utimestam mlsecond.
+ $real_date = (($v['utimestamp'] + $date_array['period']) * 1000);
+ } else {
+ $real_date = ($v['utimestamp'] * 1000);
+ }
- if ($v['datos'] === null) {
- // Unknown
- if ($show_unknown) {
- if (!$compare) {
- if ($flag_unknown) {
- $data['unknown'.$series_suffix]['data'][] = [
- $real_date,
- 1,
- ];
- } else {
- $data['unknown'.$series_suffix]['data'][] = [
- ($real_date - 1),
- 0,
- ];
- $data['unknown'.$series_suffix]['data'][] = [
- $real_date,
- 1,
- ];
- $flag_unknown = 1;
+ if ($v['datos'] === null) {
+ // Unknown.
+ if ($show_unknown) {
+ if (!$compare) {
+ if ($flag_unknown) {
+ $data['unknown'.$series_suffix]['data'][] = [
+ $real_date,
+ 1,
+ ];
+ } else {
+ $data['unknown'.$series_suffix]['data'][] = [
+ ($real_date - 1),
+ 0,
+ ];
+ $data['unknown'.$series_suffix]['data'][] = [
+ $real_date,
+ 1,
+ ];
+ $flag_unknown = 1;
+ }
+ }
+ }
+
+ $v['datos'] = $previous_data;
+ } else {
+ // Normal.
+ $previous_data = $v['datos'];
+ if ($show_unknown) {
+ if (!$compare) {
+ if ($flag_unknown) {
+ $data['unknown'.$series_suffix]['data'][] = [
+ $real_date,
+ 0,
+ ];
+ $flag_unknown = 0;
+ }
}
}
}
- $v['datos'] = $previous_data;
- } else {
- // normal
- $previous_data = $v['datos'];
- if ($show_unknown) {
- if (!$compare) {
- if ($flag_unknown) {
- $data['unknown'.$series_suffix]['data'][] = [
- $real_date,
- 0,
- ];
- $flag_unknown = 0;
- }
+ if (isset($v['datos']) && $v['datos']) {
+ // Max.
+ if ($v['datos'] >= $max_value) {
+ $max_value = $v['datos'];
+ }
+
+ // Min.
+ if ($v['datos'] <= $min_value) {
+ $min_value = $v['datos'];
+ }
+
+ // Avg sum.
+ $sum_data += $v['datos'];
+ }
+
+ // Avg count.
+ $count_data++;
+
+ if ($show_percentil && !$compare) {
+ $array_percentil[] = $v['datos'];
+ }
+
+ $last_data = $v['datos'];
+ }
+
+ if (!$flag_virtual_data) {
+ if ($compare) {
+ // Data * 1000 need js utimestam mlsecond.
+ $real_date = (($k['data'][0]['utimestamp'] + $date_array['period']) * 1000);
+ } else {
+ $real_date = ($k['data'][0]['utimestamp'] * 1000);
+ }
+
+ $data['sum'.$series_suffix]['data'][] = [
+ $real_date,
+ ($sum_data / $count_data),
+ ];
+ if ($type_mode_graph && !$params['baseline']) {
+ if ($min_value != PHP_INT_MAX) {
+ $data['min'.$series_suffix]['data'][] = [
+ $real_date,
+ $min_value,
+ ];
+ }
+
+ if ($max_value != (-PHP_INT_MAX)) {
+ $data['max'.$series_suffix]['data'][] = [
+ $real_date,
+ $max_value,
+ ];
+ }
+ } else {
+ if ($min_value != PHP_INT_MAX) {
+ $data['sum'.$series_suffix]['slice_data'][$real_date]['min'] = $min_value;
+ }
+
+ $data['sum'.$series_suffix]['slice_data'][$real_date]['avg'] = ($sum_data / $count_data);
+
+ if ($max_value != (-PHP_INT_MAX)) {
+ $data['sum'.$series_suffix]['slice_data'][$real_date]['max'] = $max_value;
}
}
- }
- if (isset($v['datos']) && $v['datos']) {
- // max
- if ($v['datos'] >= $max_value) {
- $max_value = $v['datos'];
+ // Max total.
+ if ($max_value >= $max_value_total
+ && $max_value != (-PHP_INT_MAX)
+ ) {
+ $max_value_total = $max_value;
}
- // min
- if ($v['datos'] <= $min_value) {
- $min_value = $v['datos'];
+ // Min total.
+ if ($min_value <= $min_value_total
+ && $min_value != PHP_INT_MAX
+ ) {
+ $min_value_total = $min_value;
}
- // avg sum
- $sum_data += $v['datos'];
- }
+ // Avg sum total.
+ $sum_data_total += ($sum_data / $count_data);
- // avg count
- $count_data++;
+ // Avg count total.
+ $count_data_total++;
- if ($show_percentil && !$compare) {
- $array_percentil[] = $v['datos'];
- }
+ if ($type_mode_graph && !$params['baseline']) {
+ // MIN.
+ // max min.
+ if ($min_value >= $min_value_max
+ && $min_value != PHP_INT_MAX
+ ) {
+ $min_value_max = $min_value;
+ }
- $last_data = $v['datos'];
- }
+ // Min min.
+ if ($min_value <= $min_value_min
+ && $min_value != PHP_INT_MAX
+ ) {
+ $min_value_min = $min_value;
+ }
- if (!$flag_virtual_data) {
- if ($compare) {
- // * 1000 need js utimestam mlsecond
- $real_date = (($k['data'][0]['utimestamp'] + $date_array['period']) * 1000);
- } else {
- $real_date = ($k['data'][0]['utimestamp'] * 1000);
- }
+ // Avg sum min.
+ if ($min_value != PHP_INT_MAX) {
+ $sum_data_min += $min_value;
+ }
- $data['sum'.$series_suffix]['data'][] = [
- $real_date,
- ($sum_data / $count_data),
- ];
- if ($type_mode_graph && !$params['baseline']) {
- if ($min_value != PHP_INT_MAX) {
- $data['min'.$series_suffix]['data'][] = [
- $real_date,
- $min_value,
- ];
+ // MAX.
+ // Max max.
+ if ($max_value >= $max_value_max
+ && $max_value != (-PHP_INT_MAX)
+ ) {
+ $max_value_max = $max_value;
+ }
+
+ // Min max.
+ if ($max_value <= $max_value_min
+ && $max_value != (-PHP_INT_MAX)
+ ) {
+ $max_value_min = $max_value;
+ }
+
+ // Avg Sum max.
+ if ($max_value != (-PHP_INT_MAX)) {
+ $sum_data_max += $max_value;
+ }
+
+ // AVG.
+ // Max max.
+ if (($sum_data / $count_data) >= $avg_value_max) {
+ $avg_value_max = ($sum_data / $count_data);
+ }
+
+ // Min max.
+ if (($sum_data / $count_data) <= $avg_value_min) {
+ $avg_value_min = ($sum_data / $count_data);
+ }
+
+ // Avg sum max.
+ $sum_data_avg += ($sum_data / $count_data);
}
-
- if ($max_value != -PHP_INT_MAX) {
- $data['max'.$series_suffix]['data'][] = [
- $real_date,
- $max_value,
- ];
- }
- } else {
- if ($min_value != PHP_INT_MAX) {
- $data['sum'.$series_suffix]['slice_data'][$real_date]['min'] = $min_value;
- }
-
- $data['sum'.$series_suffix]['slice_data'][$real_date]['avg'] = ($sum_data / $count_data);
-
- if ($max_value != -PHP_INT_MAX) {
- $data['sum'.$series_suffix]['slice_data'][$real_date]['max'] = $max_value;
- }
- }
-
- // max_total
- if ($max_value >= $max_value_total && $max_value != -PHP_INT_MAX) {
- $max_value_total = $max_value;
- }
-
- // min_total
- if ($min_value <= $min_value_total && $min_value != PHP_INT_MAX) {
- $min_value_total = $min_value;
- }
-
- // avg sum_total
- $sum_data_total += ($sum_data / $count_data);
-
- // avg count_total
- $count_data_total++;
-
- if ($type_mode_graph && !$params['baseline']) {
- /*
- MIN*/
- // max_min
- if ($min_value >= $min_value_max && $min_value != PHP_INT_MAX) {
- $min_value_max = $min_value;
- }
-
- // min_min
- if ($min_value <= $min_value_min && $min_value != PHP_INT_MAX) {
- $min_value_min = $min_value;
- }
-
- // avg sum_min
- if ($min_value != PHP_INT_MAX) {
- $sum_data_min += $min_value;
- }
-
- /*
- MAX*/
- // max_max
- if ($max_value >= $max_value_max && $max_value != -PHP_INT_MAX) {
- $max_value_max = $max_value;
- }
-
- // min_max
- if ($max_value <= $max_value_min && $max_value != -PHP_INT_MAX) {
- $max_value_min = $max_value;
- }
-
- // avg sum_max
- if ($max_value != -PHP_INT_MAX) {
- $sum_data_max += $max_value;
- }
-
- /*
- AVG*/
- // max_max
- if (($sum_data / $count_data) >= $avg_value_max) {
- $avg_value_max = ($sum_data / $count_data);
- }
-
- // min_max
- if (($sum_data / $count_data) <= $avg_value_min) {
- $avg_value_min = ($sum_data / $count_data);
- }
-
- // avg sum_max
- $sum_data_avg += ($sum_data / $count_data);
}
}
}
$data['sum'.$series_suffix]['min'] = $min_value_total;
$data['sum'.$series_suffix]['max'] = $max_value_total;
- $data['sum'.$series_suffix]['avg'] = ($sum_data_total / $count_data_total);
+ $data['sum'.$series_suffix]['avg'] = 0;
+ if (isset($count_data_total) === true) {
+ $data['sum'.$series_suffix]['avg'] = ($sum_data_total / $count_data_total);
+ }
if ($type_mode_graph && !$params['baseline']) {
$data['min'.$series_suffix]['min'] = $min_value_min;
@@ -3966,19 +4219,19 @@ function fullscale_data(
foreach ($data_uncompress as $k) {
foreach ($k['data'] as $v) {
if (isset($v['type']) && $v['type'] == 1) {
- // skip unnecesary virtual data
+ // Skip unnecesary virtual data.
continue;
}
if ($compare) {
- // * 1000 need js utimestam mlsecond
+ // Data * 1000 need js utimestam mlsecond.
$real_date = (($v['utimestamp'] + $date_array['period']) * 1000);
} else {
$real_date = ($v['utimestamp'] * 1000);
}
if ($v['datos'] === null) {
- // Unknown
+ // Unknown.
if ($show_unknown) {
if (!$compare) {
if ($flag_unknown) {
@@ -4005,7 +4258,7 @@ function fullscale_data(
$previous_data,
];
} else {
- // normal
+ // Normal.
$previous_data = $v['datos'];
$data['sum'.$series_suffix]['data'][] = [
$real_date,
@@ -4025,21 +4278,21 @@ function fullscale_data(
}
if (isset($v['datos']) && $v['datos']) {
- // max
+ // Max.
if ((float) $v['datos'] >= $max_value_max) {
$max_value_max = $v['datos'];
}
- // min
+ // Min.
if ((float) $v['datos'] <= $min_value_min) {
$min_value_min = $v['datos'];
}
- // avg sum
+ // Avg sum.
$sum_data += $v['datos'];
}
- // avg count
+ // Avg count.
$count_data++;
if ($show_percentil && !$compare) {
@@ -4052,7 +4305,7 @@ function fullscale_data(
$data['sum'.$series_suffix]['min'] = $min_value_min;
$data['sum'.$series_suffix]['max'] = $max_value_max;
- $data['sum'.$series_suffix]['avg'] = $count_data == 0 ? 0 : ($sum_data / $count_data);
+ $data['sum'.$series_suffix]['avg'] = ($count_data == 0) ? 0 : ($sum_data / $count_data);
}
if ($show_percentil && !$compare) {
@@ -4078,7 +4331,7 @@ function fullscale_data(
}
}
- // Add missed last data
+ // Add missed last data.
if ($compare) {
$data['sum'.$series_suffix]['data'][] = [
(($date_array['final_date'] + $date_array['period']) * 1000),
@@ -4101,7 +4354,11 @@ function fullscale_data(
];
} else {
$data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['min'] = $min_value;
- $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = ($sum_data / $count_data);
+ $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = 0;
+ if (isset($count_data) === true) {
+ $data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['avg'] = ($sum_data / $count_data);
+ }
+
$data['sum'.$series_suffix]['slice_data'][($date_array['final_date'] * 1000)]['max'] = $max_value;
}
}
@@ -4124,7 +4381,7 @@ function graph_netflow_aggregate_area($data, $period, $width, $height, $ttl=1, $
return;
}
- // Calculate source indexes
+ // Calculate source indexes.
foreach ($data['sources'] as $key => $value) {
$i = 0;
foreach ($data['data'] as $k => $v) {
@@ -4143,7 +4400,12 @@ function graph_netflow_aggregate_area($data, $period, $width, $height, $ttl=1, $
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
- 'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
+ 'url' => ui_get_full_url(
+ 'images/logo_vertical_water.png',
+ false,
+ false,
+ false
+ ),
];
$water_mark = $config['homedir'].'/images/logo_vertical_water.png';
@@ -4949,8 +5211,22 @@ function graph_monitor_wheel($width=550, $height=600, $filter=false)
}
-function get_baseline_data($agent_module_id, $date_array, $data_module_graph, $params)
-{
+/**
+ * Function that on a date requests 3 times that period and takes an average.
+ *
+ * @param integer $agent_module_id ID module.
+ * @param array $date_array Date array start finish period.
+ * @param array $data_module_graph Data module.
+ * @param array $params Params.
+ *
+ * @return array Data baseline graph.
+ */
+function get_baseline_data(
+ $agent_module_id,
+ $date_array,
+ $data_module_graph,
+ $params
+) {
$period = $date_array['period'];
$date = $date_array['final_date'];
$array_data = [];
@@ -4989,8 +5265,18 @@ function get_baseline_data($agent_module_id, $date_array, $data_module_graph, $p
}
$result['avg'] = (($array_data[0]['sum0']['avg'] + $array_data[1]['sum1']['avg'] + $array_data[2]['sum2']['avg'] + $array_data[3]['sum3']['avg']) / 4);
- $result['max'] = max($array_data[0]['sum0']['max'], $array_data[1]['sum1']['max'], $array_data[2]['sum2']['max'], $array_data[3]['sum3']['max']);
- $result['min'] = min($array_data[0]['sum0']['min'], $array_data[1]['sum1']['min'], $array_data[2]['sum2']['min'], $array_data[3]['sum3']['min']);
+ $result['max'] = max(
+ $array_data[0]['sum0']['max'],
+ $array_data[1]['sum1']['max'],
+ $array_data[2]['sum2']['max'],
+ $array_data[3]['sum3']['max']
+ );
+ $result['min'] = min(
+ $array_data[0]['sum0']['min'],
+ $array_data[1]['sum1']['min'],
+ $array_data[2]['sum2']['min'],
+ $array_data[3]['sum3']['min']
+ );
$result['agent_module_id'] = $array_data[0]['sum0']['agent_module_id'];
$result['id_module_type'] = $array_data[0]['sum0']['id_module_type'];
diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php
index 35066129bc..1bc54c9c89 100644
--- a/pandora_console/include/functions_messages.php
+++ b/pandora_console/include/functions_messages.php
@@ -442,14 +442,15 @@ function messages_get_count_sent(string $user='')
/**
* Get message overview in array
*
- * @param string $order How to order them valid:
- * (status (default), subject, timestamp, sender).
- * @param string $order_dir Direction of order
- * (ASC = Ascending, DESC = Descending).
- * @param boolean $incl_read Include read messages in return.
- * @param boolean $incl_source_info Include source info.
- * @param integer $limit Maximum number of result in the query.
- * @param array $other_filter Add a filter on main query.
+ * @param string $order How to order them valid:
+ * (status (default), subject, timestamp, sender).
+ * @param string $order_dir Direction of order
+ * (ASC = Ascending, DESC = Descending).
+ * @param boolean $incl_read Include read messages in return.
+ * @param boolean $incl_source_info Include source info.
+ * @param integer $limit Maximum number of result in the query.
+ * @param array $other_filter Add a filter on main query.
+ * @param string $join_other_filter How to join filter on main query.
*
* @return integer The number of messages this user has
*/
@@ -459,7 +460,8 @@ function messages_get_overview(
bool $incl_read=true,
bool $incl_source_info=false,
int $limit=0,
- array $other_filter=[]
+ array $other_filter=[],
+ string $join_other_filter='AND'
) {
global $config;
@@ -529,7 +531,11 @@ function messages_get_overview(
$config['id_user'],
$config['id_user'],
$read,
- db_format_array_where_clause_sql($other_filter, 'AND', ' AND '),
+ db_format_array_where_clause_sql(
+ $other_filter,
+ $join_other_filter,
+ ' AND '
+ ),
$order,
($limit !== 0) ? ' LIMIT '.$limit : ''
);
diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php
index a498ef54d3..66efd3d4a7 100644
--- a/pandora_console/include/functions_notifications.php
+++ b/pandora_console/include/functions_notifications.php
@@ -972,13 +972,32 @@ function notifications_print_dropdown()
*/
function notifications_print_dropdown_element($message_info)
{
+ $action = '';
+
+ switch ($message_info['description']) {
+ case 'Official communication':
+ $action = 'show_modal(this.id);';
+ $target = '';
+ $body_preview = __('Click here to get more information');
+ break;
+
+ default:
+ $action = '';
+ $target = '_blank';
+ $body_preview = strip_tags(
+ io_safe_output($message_info['mensaje']),
+ '
'
+ );
+ break;
+ }
+
return sprintf(
"
%s
@@ -990,10 +1009,12 @@ function notifications_print_dropdown_element($message_info)
",
+ $action.';click_on_notification_toast(event)',
$message_info['id_mensaje'],
messages_get_url($message_info['id_mensaje']),
+ $target,
html_print_image('images/'.$message_info['icon'], true),
io_safe_output($message_info['subject']),
- strip_tags(io_safe_output($message_info['mensaje']), '
')
+ $body_preview
);
}
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index a877361766..735e6f295f 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1914,6 +1914,11 @@ function reporting_event_report_module(
$return['title'] = $content['name'];
$return['subtitle'] = agents_get_alias($content['id_agent']).' - '.io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
+ $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
+
if (is_metaconsole()) {
metaconsole_restore_db();
}
@@ -1921,7 +1926,6 @@ function reporting_event_report_module(
$return['description'] = $content['description'];
$return['show_extended_events'] = $content['show_extended_events'];
$return['date'] = reporting_get_date_text($report, $content);
- $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$event_filter = $content['style'];
$return['show_summary_group'] = $event_filter['show_summary_group'];
@@ -2741,6 +2745,17 @@ function reporting_group_report($report, $content)
}
+/**
+ * Create data report event agent.
+ *
+ * @param array $report Data report.
+ * @param array $content Content report.
+ * @param string $type Type report.
+ * @param integer $force_width_chart Force width.
+ * @param integer $force_height_chart Force height.
+ *
+ * @return array Data.
+ */
function reporting_event_report_agent(
$report,
$content,
@@ -2761,26 +2776,26 @@ function reporting_event_report_agent(
$history = true;
}
- $return['title'] = $content['name'];
- $return['subtitle'] = agents_get_alias($content['id_agent']);
- $return['description'] = $content['description'];
- $return['date'] = reporting_get_date_text($report, $content);
- $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ $return['title'] = $content['name'];
+ $return['subtitle'] = agents_get_alias($content['id_agent']);
+ $return['description'] = $content['description'];
+ $return['date'] = reporting_get_date_text($report, $content);
+
$return['show_summary_group'] = $content['style']['show_summary_group'];
$return['show_extended_events'] = $content['show_extended_events'];
$style = $content['style'];
- // filter
- $show_summary_group = $style['show_summary_group'];
- $filter_event_severity = json_decode($style['filter_event_severity'], true);
- $filter_event_type = json_decode($style['filter_event_type'], true);
- $filter_event_status = json_decode($style['filter_event_status'], true);
+ // Filter.
+ $show_summary_group = $style['show_summary_group'];
+ $filter_event_severity = json_decode($style['filter_event_severity'], true);
+ $filter_event_type = json_decode($style['filter_event_type'], true);
+ $filter_event_status = json_decode($style['filter_event_status'], true);
$filter_event_filter_search = $style['event_filter_search'];
- // graph
- $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
- $event_graph_by_criticity = $style['event_graph_by_criticity'];
+ // Graph.
+ $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
+ $event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$return['data'] = reporting_get_agents_detailed_event(
@@ -2825,6 +2840,13 @@ function reporting_event_report_agent(
$metaconsole_dbtable = false;
}
+ $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($label != '') {
+ $label = reporting_label_macro($content, $label);
+ }
+
+ $return['label'] = $label;
+
if ($event_graph_by_user_validator) {
$data_graph = events_get_count_events_validated_by_user(
['id_agent' => $content['id_agent']],
@@ -2908,7 +2930,7 @@ function reporting_event_report_agent(
metaconsole_restore_db();
}
- // total_events
+ // Total events.
if ($return['data'] != '') {
$return['total_events'] = count($return['data']);
} else {
@@ -2941,7 +2963,11 @@ function reporting_historical_data($report, $content)
$return['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
+
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
$return['keys'] = [
__('Date'),
@@ -3017,7 +3043,6 @@ function reporting_database_serialized($report, $content)
$return['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
- $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$keys = [];
if (isset($content['header_definition']) && ($content['header_definition'] != '')) {
@@ -3043,6 +3068,11 @@ function reporting_database_serialized($report, $content)
metaconsole_connect($server);
}
+ $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
+
$datelimit = ($report['datetime'] - $content['period']);
$search_in_history_db = db_search_in_history_db($datelimit);
@@ -3589,7 +3619,12 @@ function reporting_alert_report_agent($report, $content)
$return['subtitle'] = $agent_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
+
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
+
$module_list = agents_get_modules($content['id_agent']);
$data = [];
@@ -3721,6 +3756,9 @@ function reporting_alert_report_module($report, $content)
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
$data_row = [];
@@ -3923,7 +3961,6 @@ function reporting_monitor_report($report, $content)
$return['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
- $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content['server_name']);
@@ -3932,6 +3969,11 @@ function reporting_monitor_report($report, $content)
metaconsole_connect($server);
}
+ $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ if ($return['label'] != '') {
+ $return['label'] = reporting_label_macro($content, $return['label']);
+ }
+
$module_name = io_safe_output(
modules_get_agentmodule_name($content['id_agent_module'])
);
@@ -5515,6 +5557,10 @@ function reporting_advanced_sla(
$max_value = 0;
$min_value = 0;
$inverse_interval = 1;
+ } else if ($agentmodule_info['id_tipo_modulo'] == '100') {
+ $max_value = 0.9;
+ $min_value = 0;
+ $inverse_interval = 1;
}
}
}
@@ -7331,6 +7377,7 @@ function reporting_simple_graph(
$report,
$content
);
+
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if ($label != '') {
$label = reporting_label_macro($content, $label);
@@ -7342,7 +7389,7 @@ function reporting_simple_graph(
$return['chart'] = '';
- // Get chart
+ // Get chart.
reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
if (!empty($force_width_chart)) {
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index eac317863b..ce7d182e53 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -1266,11 +1266,11 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri
*
* @return string The help tip
*/
-function ui_print_help_icon($help_id, $return=false, $home_url='', $image='images/help_green.png', $is_relative=false)
+function ui_print_help_icon($help_id, $return=false, $home_url='', $image='images/help_green.png', $is_relative=false, $id='')
{
global $config;
- // Do not display the help icon if help is disabled
+ // Do not display the help icon if help is disabled.
if ($config['disable_help']) {
return '';
}
@@ -1283,13 +1283,16 @@ function ui_print_help_icon($help_id, $return=false, $home_url='', $image='image
$home_url = '../../'.$home_url;
}
+ $url = get_help_info($help_id);
+
$output = html_print_image(
$image,
true,
[
'class' => 'img_help',
'title' => __('Help'),
- 'onclick' => "open_help ('".$help_id."','".$home_url."','".$config['id_user']."')",
+ 'onclick' => "open_help ('".$url."')",
+ 'id' => $id,
],
false,
$is_relative && is_metaconsole()
diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php
index 6912aa05ff..fb499e45e7 100755
--- a/pandora_console/include/functions_update_manager.php
+++ b/pandora_console/include/functions_update_manager.php
@@ -1,7 +1,6 @@
$email],
+ ['id_user' => $config['id_user']]
+ );
+ }
+
+ // Update the alert action Mail to XXX/Administrator
+ // if it is set to default.
+ $mail_check = 'yourmail@domain.es';
+ $mail_alert = alerts_get_alert_action_field1(1);
+ if ($mail_check === $mail_alert && $email !== false) {
+ alerts_update_alert_action(
+ 1,
+ [
+ 'field1' => $email,
+ 'field1_recovery' => $email,
+ ]
+ );
+ }
+
+ config_update_value('initial_wizard', 1);
+}
+
+
+/**
+ * Generates base code to print main configuration modal.
+ *
+ * Asks for timezone, mail.
+ *
+ * @param boolean $return Print output or not.
+ * @param boolean $launch Process JS modal.
+ * @param string $callback Call to JS function at end.
+ *
+ * @return string HTML.
+ */
+function config_wiz_modal(
+ $return=false,
+ $launch=true,
+ $callback=false
+) {
+ global $config;
+
+ $email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
+ // Avoid to show default email.
+ if ($email == 'admin@example.com') {
+ $email = '';
+ }
+
+ $output = '';
+
+ // Prints first step pandora registration.
+ $output .= '';
+
+ $output .= '
';
+ $output .= __('Please fill the following information in order to configure your %s instance successfully', get_product_name()).'.';
+ $output .= '
';
+
+ $output .= '
';
+ $table = new StdClass();
+ $table->class = 'databox filters';
+ $table->width = '100%';
+ $table->data = [];
+ $table->size = [];
+ $table->size[0] = '40%';
+ $table->style[0] = 'font-weight:bold';
+ $table->size[1] = '60%';
+ $table->border = '5px solid';
+
+ $table->data[0][0] = __('Language code');
+ $table->data[0][1] = html_print_select_from_sql(
+ 'SELECT id_language, name FROM tlanguage',
+ 'language',
+ $config['language'],
+ '',
+ '',
+ '',
+ true
+ );
+
+ $zone_name = [
+ 'Africa' => __('Africa'),
+ 'America' => __('America'),
+ 'Antarctica' => __('Antarctica'),
+ 'Arctic' => __('Arctic'),
+ 'Asia' => __('Asia'),
+ 'Atlantic' => __('Atlantic'),
+ 'Australia' => __('Australia'),
+ 'Europe' => __('Europe'),
+ 'Indian' => __('Indian'),
+ 'Pacific' => __('Pacific'),
+ 'UTC' => __('UTC'),
+ ];
+
+ if ($zone_selected == '') {
+ if ($config['timezone'] != '') {
+ $zone_array = explode('/', $config['timezone']);
+ $zone_selected = $zone_array[0];
+ } else {
+ $zone_selected = 'Europe';
+ }
+ }
+
+ $timezones = timezone_identifiers_list();
+ foreach ($timezones as $timezone) {
+ if (strpos($timezone, $zone_selected) !== false) {
+ $timezone_country = preg_replace('/^.*\//', '', $timezone);
+ $timezone_n[$timezone] = $timezone_country;
+ }
+ }
+
+ $table->data[2][0] = __('Timezone setup').' '.ui_print_help_tip(
+ __('Must have the same time zone as the system or database to avoid mismatches of time.'),
+ true
+ );
+ $table->data[2][1] = html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone()', '', '', true);
+ $table->data[2][1] .= ' '.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
+
+ $table->data[4][0] = __('E-mail for receiving alerts');
+ $table->data[4][1] = html_print_input_text('email', $email, '', 50, 255, true);
+
+ $output .= html_print_table($table, true);
+ $output .= '
';
+
+ $output .= '
';
+ $output .= html_print_submit_button(
+ __('Cancel'),
+ 'cancel',
+ false,
+ 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel submit-cancel" style="width:100px;"',
+ true
+ );
+ $output .= '
';
+ $output .= '
';
+ $output .= html_print_submit_button(
+ __('Continue'),
+ 'register-next',
+ false,
+ 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next" style="width:100px;"',
+ true
+ );
+ $output .= '
';
+ $output .= '
';
+ $output .= __('All fields required');
+ $output .= '
';
+ $output .= '
';
+
+ $output .= '
';
+
+ ob_start();
+ ?>
+
+
+
+ true,
+ 'message' => '',
+ ];
+
+ // Pandora register update.
+ $um_message = update_manager_register_instance();
+ $ui_feedback['message'] .= $um_message['message'].'
';
+ $ui_feedback['status'] = $um_message['success'] && $ui_feedback['status'];
+
+ if ($ui_feedback['status']) {
+ // Store next identification reminder.
+ config_update_value(
+ 'identification_reminder_timestamp',
+ $next_check
+ );
+ }
+
+ return $ui_feedback;
+}
+
+
+/**
+ * Shows a modal to register current console in UpdateManager.
+ *
+ * @param boolean $return Return or show html.
+ * @param boolean $launch Execute wizard.
+ * @param string $callback Call function when done.
+ *
+ * @return string HTML code.
+ */
+function registration_wiz_modal(
+ $return=false,
+ $launch=true,
+ $callback=false
+) {
+ global $config;
+ $output = '';
+
+ $product_name = get_product_name();
+
+ $output .= '
';
+
+ ob_start();
+ ?>
+
+
+ 1],
+ ['id_user' => $config['id_user']]
+ );
+ $ui_feedback['status'] = $um_message['success'];
+ } else {
+ $ui_feedback['status'] = false;
+ }
+
+ return $ui_feedback;
+}
+
+
+/**
+ * Show a modal allowing the user register into newsletter.
+ *
+ * @param boolean $return Print content o return it.
+ * @param boolean $launch Launch directly on load or not.
+ * @param string $callback Call function when done.
+ *
+ * @return string HTML code.
+ */
+function newsletter_wiz_modal(
+ $return=false,
+ $launch=true,
+ $callback=false
+) {
+ global $config;
+
+ $output = '';
+
+ $product_name = get_product_name();
+ $email = db_get_value(
+ 'email',
+ 'tusuario',
+ 'id_user',
+ $config['id_user']
+ );
+
+ // Avoid to show default email.
+ if ($email == 'admin@example.com') {
+ $email = '';
+ }
+
+ $output .= '
';
+
+ ob_start();
+ ?>
+
+
+ $license,
@@ -49,11 +978,18 @@ function update_manager_get_config_values()
'limit_count' => $limit_count,
'build' => $build_version,
'version' => $pandora_version,
+ 'puid' => $config['pandora_uid'],
];
}
-// Function to remove dir and files inside
+/**
+ * Function to remove dir and files inside.
+ *
+ * @param string $dir Path to dir.
+ *
+ * @return void
+ */
function rrmdir($dir)
{
if (is_dir($dir)) {
@@ -77,6 +1013,11 @@ function rrmdir($dir)
}
+/**
+ * Install updates step2.
+ *
+ * @return void
+ */
function update_manager_install_package_step2()
{
global $config;
@@ -90,9 +1031,9 @@ function update_manager_install_package_step2()
$path = sys_get_temp_dir().'/pandora_oum/'.$package;
- // All files extracted
+ // All files extracted.
$files_total = $path.'/files.txt';
- // Files copied
+ // Files copied.
$files_copied = $path.'/files.copied.txt';
$return = [];
@@ -101,93 +1042,109 @@ function update_manager_install_package_step2()
}
if (file_exists($path)) {
- if ($files_h = fopen($files_total, 'r')) {
- while ($line = stream_get_line($files_h, 65535, "\n")) {
- $line = trim($line);
-
- // Tries to move the old file to the directory backup inside the extracted package
- if (file_exists($config['homedir'].'/'.$line)) {
- rename($config['homedir'].'/'.$line, $path.'/backup/'.$line);
- }
-
- // Tries to move the new file to the Integria directory
- $dirname = dirname($line);
- if (!file_exists($config['homedir'].'/'.$dirname)) {
- $dir_array = explode('/', $dirname);
- $temp_dir = '';
- foreach ($dir_array as $dir) {
- $temp_dir .= '/'.$dir;
- if (!file_exists($config['homedir'].$temp_dir)) {
- mkdir($config['homedir'].$temp_dir);
- }
- }
- }
-
- if (is_dir($path.'/'.$line)) {
- if (!file_exists($config['homedir'].'/'.$line)) {
- mkdir($config['homedir'].'/'.$line);
- file_put_contents($files_copied, $line."\n", (FILE_APPEND | LOCK_EX));
- }
- } else {
- // Copy the new file
- if (rename($path.'/'.$line, $config['homedir'].'/'.$line)) {
- // Append the moved file to the copied files txt
- if (!file_put_contents($files_copied, $line."\n", (FILE_APPEND | LOCK_EX))) {
- // If the copy process fail, this code tries to restore the files backed up before
- if ($files_copied_h = fopen($files_copied, 'r')) {
- while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
- $line_c = trim($line_c);
- if (!rename($path.'/backup/'.$line, $config['homedir'].'/'.$line_c)) {
- $backup_status = __('Some of your files might not be recovered.');
- }
- }
-
- if (!rename($path.'/backup/'.$line, $config['homedir'].'/'.$line)) {
- $backup_status = __('Some of your files might not be recovered.');
- }
-
- fclose($files_copied_h);
- } else {
- $backup_status = __('Some of your old files might not be recovered.');
- }
-
- fclose($files_h);
- $return['status'] = 'error';
- $return['message'] = __("Line '$line' not copied to the progress file.").' '.$backup_status;
- echo json_encode($return);
- return;
- }
- } else {
- // If the copy process fail, this code tries to restore the files backed up before
- if ($files_copied_h = fopen($files_copied, 'r')) {
- while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
- $line_c = trim($line_c);
- if (!rename($path.'/backup/'.$line, $config['homedir'].'/'.$line)) {
- $backup_status = __('Some of your old files might not be recovered.');
- }
- }
-
- fclose($files_copied_h);
- } else {
- $backup_status = __('Some of your files might not be recovered.');
- }
-
- fclose($files_h);
- $return['status'] = 'error';
- $return['message'] = __("File '$line' not copied.").' '.$backup_status;
- echo json_encode($return);
- return;
- }
- }
- }
-
- fclose($files_h);
- } else {
+ $files_h = fopen($files_total, 'r');
+ if ($files_h === false) {
$return['status'] = 'error';
$return['message'] = __('An error ocurred while reading a file.');
echo json_encode($return);
return;
}
+
+ while ($line = stream_get_line($files_h, 65535, "\n")) {
+ $line = trim($line);
+
+ // Tries to move the old file to the directory backup
+ // inside the extracted package.
+ if (file_exists($config['homedir'].'/'.$line)) {
+ rename($config['homedir'].'/'.$line, $path.'/backup/'.$line);
+ }
+
+ // Tries to move the new file to the Integria directory.
+ $dirname = dirname($line);
+ if (!file_exists($config['homedir'].'/'.$dirname)) {
+ $dir_array = explode('/', $dirname);
+ $temp_dir = '';
+ foreach ($dir_array as $dir) {
+ $temp_dir .= '/'.$dir;
+ if (!file_exists($config['homedir'].$temp_dir)) {
+ mkdir($config['homedir'].$temp_dir);
+ }
+ }
+ }
+
+ if (is_dir($path.'/'.$line)) {
+ if (!file_exists($config['homedir'].'/'.$line)) {
+ mkdir($config['homedir'].'/'.$line);
+ file_put_contents($files_copied, $line."\n", (FILE_APPEND | LOCK_EX));
+ }
+ } else {
+ // Copy the new file.
+ if (rename($path.'/'.$line, $config['homedir'].'/'.$line)) {
+ // Append the moved file to the copied files txt.
+ if (!file_put_contents($files_copied, $line."\n", (FILE_APPEND | LOCK_EX))) {
+ // If the copy process fail, this code tries to
+ // restore the files backed up before.
+ $files_copied_h = fopen($files_copied, 'r');
+ if ($files_copied_h === false) {
+ $backup_status = __('Some of your old files might not be recovered.');
+ } else {
+ while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
+ $line_c = trim($line_c);
+ if (!rename($path.'/backup/'.$line, $config['homedir'].'/'.$line_c)) {
+ $backup_status = __('Some of your files might not be recovered.');
+ }
+ }
+
+ if (!rename($path.'/backup/'.$line, $config['homedir'].'/'.$line)) {
+ $backup_status = __('Some of your files might not be recovered.');
+ }
+
+ fclose($files_copied_h);
+ }
+
+ fclose($files_h);
+ $return['status'] = 'error';
+ $return['message'] = __(
+ 'Line "%s" not copied to the progress file.',
+ $line
+ ).' '.$backup_status;
+ echo json_encode($return);
+ return;
+ }
+ } else {
+ // If the copy process fail, this code tries to restore
+ // the files backed up before.
+ $files_copied_h = fopen($files_copied, 'r');
+ if ($files_copied_h === false) {
+ $backup_status = __('Some of your files might not be recovered.');
+ } else {
+ while ($line_c = stream_get_line($files_copied_h, 65535, "\n")) {
+ $line_c = trim($line_c);
+ if (!rename(
+ $path.'/backup/'.$line,
+ $config['homedir'].'/'.$line
+ )
+ ) {
+ $backup_status = __('Some of your old files might not be recovered.');
+ }
+ }
+
+ fclose($files_copied_h);
+ }
+
+ fclose($files_h);
+ $return['status'] = 'error';
+ $return['message'] = __(
+ 'Line "%s" not copied to the progress file.',
+ $line
+ ).' '.$backup_status;
+ echo json_encode($return);
+ return;
+ }
+ }
+ }
+
+ fclose($files_h);
} else {
$return['status'] = 'error';
$return['message'] = __('The package does not exist');
@@ -197,20 +1154,28 @@ function update_manager_install_package_step2()
update_manager_enterprise_set_version($version);
$product_name = get_product_name();
- db_pandora_audit("Update $product_name", "Update version: $version of $product_name by ".$config['id_user']);
+
+ // Generate audit entry.
+ db_pandora_audit(
+ 'Update '.$product_name,
+ 'Update version: '.$version.' of '.$product_name.' by '.$config['id_user']
+ );
$return['status'] = 'success';
$return['message'] = __('The package is installed.');
echo json_encode($return);
- return;
}
+/**
+ * Launch update manager client.
+ *
+ * @return void
+ */
function update_manager_main()
{
global $config;
-
?>
';
- // Parent layer
+ // Parent layer.
$return .= '