';
diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php
new file mode 100644
index 0000000000..1f2b3fd883
--- /dev/null
+++ b/pandora_console/general/register.php
@@ -0,0 +1,181 @@
+ -1],
+ ['id_user' => $config['id_user']]
+ );
+
+ // XXX: Also notify UpdateManager.
+ }
+
+ if ($register_newsletter) {
+ $feedback = newsletter_wiz_process();
+ }
+
+ if (is_array($feedback)) {
+ echo json_encode($feedback);
+ }
+
+
+ // Ajax calls finish here.
+ exit();
+}
+
+
+ui_require_css_file('register');
+
+$initial = isset($config['initial_wizard']) !== true
+ || $config['initial_wizard'] != '1';
+
+$newsletter = db_get_value(
+ 'middlename',
+ 'tusuario',
+ 'id_user',
+ $config['id_user']
+);
+$show_newsletter = $newsletter == '0' || $newsletter == '';
+
+$registration = isset($config['pandora_uid']) !== true
+ || $config['pandora_uid'] == '';
+
+
+if ($initial) {
+ // Show all forms in order.
+ // 1- Ask for email, timezone, etc. Fullfill alerts and user mail.
+ config_wiz_modal(
+ false,
+ true,
+ (($registration === true) ? 'show_registration_wizard()' : null)
+ );
+}
+
+if ($registration) {
+ // Prepare registration wizard, not launch. leave control to flow.
+ registration_wiz_modal(
+ false,
+ // Launch only if not being launch from 'initial'.
+ !$initial,
+ (($show_newsletter === true) ? 'force_run_newsletter()' : null)
+ );
+} else {
+ if ($show_newsletter) {
+ // Show newsletter wizard for current user.
+ newsletter_wiz_modal(
+ false,
+ // Launch only if not being call from 'registration'.
+ !$registration && !$initial
+ );
+ }
+}
+
+?>
+
diff --git a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php
index 2a61f02de4..b40cf80855 100644
--- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php
+++ b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php
@@ -317,7 +317,6 @@ $table->data[0][0] = '
'.__('Target IP').'';
$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
$table->data[0][2] = '
'.__('Namespace').'';
-$table->data[0][2] .= ui_print_help_icon('wminamespace', true);
$table->data[0][3] = html_print_input_text('tcp_send', $tcp_send, '', 15, 60, true);
$table->data[1][0] = '
'.__('Username').'';
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 35674550b3..8ebfdb296a 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -579,11 +579,11 @@ if ($id_agente) {
switch ($tab) {
case 'main':
$tab_description = '- '.__('Setup');
+ $help_header = 'main_tab';
break;
case 'collection':
$tab_description = '- '.__('Collection');
- $help_header = 'collection_tab';
break;
case 'inventory':
@@ -601,6 +601,8 @@ if ($id_agente) {
$tab_description = '- '.__('Modules');
if ($type_module_t == 'webux') {
$help_header = 'wux_console';
+ } else {
+ $help_header = 'local_module_tab';
}
break;
@@ -611,7 +613,6 @@ if ($id_agente) {
case 'template':
$tab_description = '- '.__('Templates');
- $help_header = 'template_tab';
break;
case 'gis':
@@ -631,14 +632,17 @@ if ($id_agente) {
switch (get_parameter('wizard_section')) {
case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard');
+ $help_header = 'agent_snmp_explorer_tab';
break;
case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard');
+ $help_header = 'agent_snmp_interfaces_explorer_tab';
break;
case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard');
+ $help_header = 'agent_snmp_wmi_explorer_tab';
break;
default:
diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php
index 9d49bb0a96..cee4825faa 100644
--- a/pandora_console/godmode/agentes/module_manager_editor.php
+++ b/pandora_console/godmode/agentes/module_manager_editor.php
@@ -591,7 +591,7 @@ ui_toggle(
);
ui_toggle(
html_print_table($table_macros, true),
- __('Custom macros').ui_print_help_icon('module_macros', true)
+ __('Custom macros')
);
if ($moduletype != 13) {
diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php
index 85114161b6..5d6db9cfdf 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_common.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_common.php
@@ -159,6 +159,7 @@ if ($disabledBecauseInPolicy) {
}
$update_module_id = (int) get_parameter_get('update_module');
+$edit_module = (bool) get_parameter_get('edit_module');
$table_simple = new stdClass();
$table_simple->id = 'simple';
$table_simple->width = '100%';
@@ -270,7 +271,7 @@ if (!$in_policy) {
}
}
-$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon('module_type', true);
+$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) {
@@ -350,6 +351,35 @@ if (!$edit) {
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
}
+if ($edit_module) {
+ $id_module_type = (int) $id_module_type;
+ if (($id_module_type >= 1 && $id_module_type <= 5)
+ || ($id_module_type >= 21 && $id_module_type <= 23)
+ || ($id_module_type == 100)
+ ) {
+ $help_header = 'local_module';
+ }
+
+ if ($id_module_type === 6 || $id_module_type === 7
+ ) {
+ $help_header = 'icmp_module_tab';
+ }
+
+ if ($id_module_type >= 15 && $id_module_type <= 18) {
+ $help_header = 'snmp_module_tab';
+ }
+
+ if ($id_module_type >= 8 && $id_module_type <= 11) {
+ $help_header = 'tcp_module_tab';
+ }
+
+ if ($id_module_type >= 30 && $id_module_type <= 33) {
+ $help_header = 'webserver_module_tab';
+ }
+
+ $table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_header, true);
+}
+
if ($disabledBecauseInPolicy) {
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
}
@@ -1224,7 +1254,124 @@ $(document).ready (function () {
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
var type_name_selected = type_names[type_selected];
-
+ var element = document.getElementById("module_type_help");
+ var language = "" ;
+ element.onclick = function (event) {
+ if(type_name_selected == 'async_data' ||
+ type_name_selected == 'async_proc' ||
+ type_name_selected == 'async_string' ||
+ type_name_selected == 'generic_proc'||
+ type_name_selected == 'generic_data' ||
+ type_name_selected == 'generic_data_inc' ||
+ type_name_selected == 'generic_data_inc_abs'||
+ type_name_selected == 'generic_data_string' ||
+ type_name_selected == 'keep_alive'
+ ){
+ if (language == 'es'){
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+ else{
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+
+
+ }
+ if(type_name_selected == 'remote_icmp' ||
+ type_name_selected == 'remote_icmp_proc'
+ ){
+ if(language == 'es'){
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+ else{
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+
+
+ }
+ if(type_name_selected == 'remote_snmp_string' ||
+ type_name_selected == 'remote_snmp_proc' ||
+ type_name_selected == 'remote_snmp_inc' ||
+ type_name_selected == 'remote_snmp'
+ ){
+ if(language == 'es'){
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+ else{
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+
+
+ }
+ if(type_name_selected == 'remote_tcp_string' ||
+ type_name_selected == 'remote_tcp_proc' ||
+ type_name_selected == 'remote_tcp_inc' ||
+ type_name_selected == 'remote_tcp'
+ ){
+ if(language == 'es'){
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+ else{
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+
+
+ }
+ if(type_name_selected == 'web_data' ||
+ type_name_selected == 'web_proc' ||
+ type_name_selected == 'web_content_data' ||
+ type_name_selected == 'web_content_string'
+ ){
+ if(language == 'es'){
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+ else{
+ window.open(
+ 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
+ '_blank',
+ 'width=800,height=600'
+ );
+ }
+
+
+ }
+ }
+
if (type_name_selected.match(/_string$/) == null) {
// Numeric types
$('#string_critical').hide();
diff --git a/pandora_console/godmode/agentes/module_manager_editor_wmi.php b/pandora_console/godmode/agentes/module_manager_editor_wmi.php
index d15cd6477f..5c89c11d9e 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_wmi.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_wmi.php
@@ -42,7 +42,7 @@ if (empty($update_module_id)) {
}
$data = [];
-$data[0] = __('Target IP');
+$data[0] = __('Target IP').' '.ui_print_help_icon('wmi_module_tab', true);
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
$data[3] = html_print_input_text(
diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php
index c8c8748178..eef8d5fbdf 100644
--- a/pandora_console/godmode/agentes/planned_downtime.editor.php
+++ b/pandora_console/godmode/agentes/planned_downtime.editor.php
@@ -1,16 +1,32 @@
"
".html_print_image('images/list.png', true, ['title' => __('List')]).'',
+ 'text' => "
".html_print_image(
+ 'images/list.png',
+ true,
+ ['title' => __('List')]
+ ).'',
];
-// Header
+// Header.
ui_print_page_header(
__('Planned Downtime'),
'images/gm_monitoring.png',
false,
- 'planned_downtime',
+ 'planned_downtime_editor',
true,
$buttons
);
-// recursion group filter
+// Recursion group filter.
$recursion = get_parameter('recursion', $_POST['recursion']);
-// Initialize data
-$id_group = (int) get_parameter('id_group');
-$name = (string) get_parameter('name');
-$description = (string) get_parameter('description');
+// Initialize data.
+$id_group = (int) get_parameter('id_group');
+$name = (string) get_parameter('name');
+$description = (string) get_parameter('description');
-$type_downtime = (string) get_parameter('type_downtime', 'quiet');
-$type_execution = (string) get_parameter('type_execution', 'once');
-$type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
+$type_downtime = (string) get_parameter('type_downtime', 'quiet');
+$type_execution = (string) get_parameter('type_execution', 'once');
+$type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
$utimestamp = get_system_time();
-// Fake utimestamp to retrieve the string date of the system
+// Fake utimestamp to retrieve the string date of the system.
$system_time = ($utimestamp - get_fixed_offset());
-$once_date_from = (string) get_parameter('once_date_from', date(DATE_FORMAT, $utimestamp));
-$once_time_from = (string) get_parameter('once_time_from', date(TIME_FORMAT, $utimestamp));
-$once_date_to = (string) get_parameter('once_date_to', date(DATE_FORMAT, $utimestamp));
-$once_time_to = (string) get_parameter('once_time_to', date(TIME_FORMAT, ($utimestamp + SECONDS_1HOUR)));
+$once_date_from = (string) get_parameter(
+ 'once_date_from',
+ date(DATE_FORMAT, $utimestamp)
+);
+$once_time_from = (string) get_parameter(
+ 'once_time_from',
+ date(TIME_FORMAT, $utimestamp)
+);
+$once_date_to = (string) get_parameter(
+ 'once_date_to',
+ date(DATE_FORMAT, $utimestamp)
+);
+$once_time_to = (string) get_parameter(
+ 'once_time_to',
+ date(TIME_FORMAT, ($utimestamp + SECONDS_1HOUR))
+);
-$periodically_day_from = (int) get_parameter('periodically_day_from', 1);
-$periodically_day_to = (int) get_parameter('periodically_day_to', 31);
-$periodically_time_from = (string) get_parameter('periodically_time_from', date(TIME_FORMAT, $system_time));
-$periodically_time_to = (string) get_parameter('periodically_time_to', date(TIME_FORMAT, ($system_time + SECONDS_1HOUR)));
+$periodically_day_from = (int) get_parameter(
+ 'periodically_day_from',
+ 1
+);
+$periodically_day_to = (int) get_parameter(
+ 'periodically_day_to',
+ 31
+);
+$periodically_time_from = (string) get_parameter(
+ 'periodically_time_from',
+ date(TIME_FORMAT, $system_time)
+);
+$periodically_time_to = (string) get_parameter(
+ 'periodically_time_to',
+ date(TIME_FORMAT, ($system_time + SECONDS_1HOUR))
+);
-$monday = (bool) get_parameter('monday');
-$tuesday = (bool) get_parameter('tuesday');
-$wednesday = (bool) get_parameter('wednesday');
-$thursday = (bool) get_parameter('thursday');
-$friday = (bool) get_parameter('friday');
-$saturday = (bool) get_parameter('saturday');
-$sunday = (bool) get_parameter('sunday');
+$monday = (bool) get_parameter('monday');
+$tuesday = (bool) get_parameter('tuesday');
+$wednesday = (bool) get_parameter('wednesday');
+$thursday = (bool) get_parameter('thursday');
+$friday = (bool) get_parameter('friday');
+$saturday = (bool) get_parameter('saturday');
+$sunday = (bool) get_parameter('sunday');
-$first_create = (int) get_parameter('first_create');
-$create_downtime = (int) get_parameter('create_downtime');
-$update_downtime = (int) get_parameter('update_downtime');
-$edit_downtime = (int) get_parameter('edit_downtime');
-$id_downtime = (int) get_parameter('id_downtime');
+$first_create = (int) get_parameter('first_create');
+$create_downtime = (int) get_parameter('create_downtime');
+$update_downtime = (int) get_parameter('update_downtime');
+$edit_downtime = (int) get_parameter('edit_downtime');
+$id_downtime = (int) get_parameter('id_downtime');
-$id_agent = (int) get_parameter('id_agent');
-$insert_downtime_agent = (int) get_parameter('insert_downtime_agent');
-$delete_downtime_agent = (int) get_parameter('delete_downtime_agent');
+$id_agent = (int) get_parameter('id_agent');
+$insert_downtime_agent = (int) get_parameter('insert_downtime_agent');
+$delete_downtime_agent = (int) get_parameter('delete_downtime_agent');
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
-// User groups with AD or AW permission for ACL checks
-$user_groups_ad = array_keys(users_get_groups($config['id_user'], $access));
+// User groups with AD or AW permission for ACL checks.
+$user_groups_ad = array_keys(
+ users_get_groups($config['id_user'], $access)
+);
-// INSERT A NEW DOWNTIME_AGENT ASSOCIATION
+// INSERT A NEW DOWNTIME_AGENT ASSOCIATION.
if ($insert_downtime_agent === 1) {
- // Check AD permission on downtime
- $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
+ // Check AD permission on downtime.
+ $downtime_group = db_get_value(
+ 'id_group',
+ 'tplanned_downtime',
+ 'id',
+ $id_downtime
+ );
- if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
+ if ($downtime_group === false
+ || !in_array($downtime_group, $user_groups_ad)
+ ) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
@@ -116,17 +169,27 @@ if ($insert_downtime_agent === 1) {
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
- // 'Is running' check
- $is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime);
+ // 'Is running' check.
+ $is_running = (bool) db_get_value(
+ 'executed',
+ 'tplanned_downtime',
+ 'id',
+ $id_downtime
+ );
if ($is_running) {
- ui_print_error_message(__('This elements cannot be modified while the downtime is being executed'));
+ ui_print_error_message(
+ __('This elements cannot be modified while the downtime is being executed')
+ );
} else {
foreach ($agents as $agent_id) {
- // check module belongs to the agent
+ // Check module belongs to the agent.
if ($modules_selection_mode == 'all') {
$check = false;
foreach ($module_names as $module_name) {
- $check_module = modules_get_agentmodule_id($module_name, $agent_id);
+ $check_module = modules_get_agentmodule_id(
+ $module_name,
+ $agent_id
+ );
if (!empty($check_module)) {
$check = true;
}
@@ -137,10 +200,17 @@ if ($insert_downtime_agent === 1) {
}
}
- // Check AD permission on agent
- $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
+ // Check AD permission on agent.
+ $agent_group = db_get_value(
+ 'id_grupo',
+ 'tagente',
+ 'id_agente',
+ $agent_id
+ );
- if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
+ if ($agent_group === false
+ || !in_array($agent_group, $user_groups_ad)
+ ) {
continue;
}
@@ -149,11 +219,17 @@ if ($insert_downtime_agent === 1) {
'id_agent' => $agent_id,
'all_modules' => $all_modules,
];
- $result = db_process_sql_insert('tplanned_downtime_agents', $values);
+ $result = db_process_sql_insert(
+ 'tplanned_downtime_agents',
+ $values
+ );
if ($result && !$all_modules) {
foreach ($module_names as $module_name) {
- $module = modules_get_agentmodule_id($module_name, $agent_id);
+ $module = modules_get_agentmodule_id(
+ $module_name,
+ $agent_id
+ );
if (empty($module)) {
continue;
@@ -164,7 +240,10 @@ if ($insert_downtime_agent === 1) {
'id_agent' => $agent_id,
'id_agent_module' => $module['id_agente_modulo'],
];
- $result = db_process_sql_insert('tplanned_downtime_modules', $values);
+ $result = db_process_sql_insert(
+ 'tplanned_downtime_modules',
+ $values
+ );
if ($result) {
$values = ['id_user' => $config['id_user']];
@@ -180,14 +259,21 @@ if ($insert_downtime_agent === 1) {
}
}
-// DELETE A DOWNTIME_AGENT ASSOCIATION
+// DELETE A DOWNTIME_AGENT ASSOCIATION.
if ($delete_downtime_agent === 1) {
$id_da = (int) get_parameter('id_downtime_agent');
- // Check AD permission on downtime
- $downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
+ // Check AD permission on downtime.
+ $downtime_group = db_get_value(
+ 'id_group',
+ 'tplanned_downtime',
+ 'id',
+ $id_downtime
+ );
- if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
+ if ($downtime_group === false
+ || !in_array($downtime_group, $user_groups_ad)
+ ) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
@@ -196,10 +282,17 @@ if ($delete_downtime_agent === 1) {
return;
}
- // Check AD permission on agent
- $agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
+ // Check AD permission on agent.
+ $agent_group = db_get_value(
+ 'id_grupo',
+ 'tagente',
+ 'id_agente',
+ $id_agent
+ );
- if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
+ if ($agent_group === false
+ || !in_array($agent_group, $user_groups_ad)
+ ) {
db_pandora_audit(
'ACL Violation',
'Trying to access downtime scheduler'
@@ -208,17 +301,27 @@ if ($delete_downtime_agent === 1) {
return;
}
- // 'Is running' check
- $is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime);
+ // 'Is running' check.
+ $is_running = (bool) db_get_value(
+ 'executed',
+ 'tplanned_downtime',
+ 'id',
+ $id_downtime
+ );
if ($is_running) {
- ui_print_error_message(__('This elements cannot be modified while the downtime is being executed'));
+ ui_print_error_message(
+ __('This elements cannot be modified while the downtime is being executed')
+ );
} else {
$row_to_delete = db_get_row('tplanned_downtime_agents', 'id', $id_da);
- $result = db_process_sql_delete('tplanned_downtime_agents', ['id' => $id_da]);
+ $result = db_process_sql_delete(
+ 'tplanned_downtime_agents',
+ ['id' => $id_da]
+ );
if ($result) {
- // Delete modules in downtime
+ // Delete modules in downtime.
db_process_sql_delete(
'tplanned_downtime_modules',
[
@@ -230,7 +333,7 @@ if ($delete_downtime_agent === 1) {
}
}
-// UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION)
+// UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION).
if ($create_downtime || $update_downtime) {
$check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $name);
@@ -239,22 +342,32 @@ if ($create_downtime || $update_downtime) {
$now = time();
if ($type_execution == 'once' && !$config['past_planned_downtimes'] && $datetime_from < $now) {
- ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time'));
+ ui_print_error_message(
+ __('Not created. Error inserting data. Start time must be higher than the current time')
+ );
} else if ($type_execution == 'once' && $datetime_from >= $datetime_to) {
- ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'));
+ ui_print_error_message(
+ __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date')
+ );
} else if ($type_execution == 'once' && $datetime_to <= $now && !$config['past_planned_downtimes']) {
- ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'));
+ ui_print_error_message(
+ __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time')
+ );
} else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))
) {
- ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time'));
+ ui_print_error_message(
+ __('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
+ );
} else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from > $periodically_day_to) {
- ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end day must be higher than the start day'));
+ ui_print_error_message(
+ __('Not created. Error inserting data').'. '.__('The end day must be higher than the start day')
+ );
} else {
$sql = '';
if ($create_downtime) {
- // Check AD permission on new downtime
+ // Check AD permission on new downtime.
if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit(
'ACL Violation',
@@ -295,7 +408,10 @@ if ($create_downtime || $update_downtime) {
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to'];
}
- $result = db_process_sql_insert('tplanned_downtime', $values);
+ $result = db_process_sql_insert(
+ 'tplanned_downtime',
+ $values
+ );
} else {
ui_print_error_message(
__('Each planned downtime must have a different name')
@@ -309,7 +425,7 @@ if ($create_downtime || $update_downtime) {
} else if ($update_downtime) {
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
- // Check AD permission on OLD downtime
+ // Check AD permission on OLD downtime.
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
db_pandora_audit(
'ACL Violation',
@@ -319,7 +435,7 @@ if ($create_downtime || $update_downtime) {
return;
}
- // Check AD permission on NEW downtime group
+ // Check AD permission on NEW downtime group.
if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit(
'ACL Violation',
@@ -329,14 +445,17 @@ if ($create_downtime || $update_downtime) {
return;
}
- // 'Is running' check
+ // 'Is running' check.
$is_running = (bool) $old_downtime['executed'];
$values = [];
if (trim(io_safe_output($name)) == '') {
- ui_print_error_message(__('Planned downtime must have a name'));
+ ui_print_error_message(
+ __('Planned downtime must have a name')
+ );
}
- // When running only certain items can be modified for the 'once' type
+
+ // When running only certain items can be modified for the 'once' type.
else if ($is_running && $type_execution == 'once') {
$values = [
'description' => $description,
@@ -344,7 +463,9 @@ if ($create_downtime || $update_downtime) {
'id_user' => $config['id_user'],
];
} else if ($is_running) {
- ui_print_error_message(__('Cannot be modified while the downtime is being executed'));
+ ui_print_error_message(
+ __('Cannot be modified while the downtime is being executed')
+ );
} else {
$values = [
'name' => $name,
@@ -376,7 +497,11 @@ if ($create_downtime || $update_downtime) {
}
if (!empty($values)) {
- $result = db_process_sql_update('tplanned_downtime', $values, ['id' => $id_downtime]);
+ $result = db_process_sql_update(
+ 'tplanned_downtime',
+ $values,
+ ['id' => $id_downtime]
+ );
}
}
@@ -399,7 +524,7 @@ if ($create_downtime || $update_downtime) {
// Have any data to show ?
if ($id_downtime > 0) {
- // Columns of the table tplanned_downtime
+ // Columns of the table tplanned_downtime.
$columns = [
'id',
'name',
@@ -436,7 +561,8 @@ if ($id_downtime > 0) {
break;
case 'oracle':
- // Oracle doesn't have TIME type, so we should transform the DATE value
+ // Oracle doesn't have TIME type,
+ // so we should transform the DATE value.
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
@@ -500,7 +626,8 @@ if ($id_downtime > 0) {
$running = (bool) $result['executed'];
}
-// when the planned downtime is in execution, only action to postpone on once type is enabled and the other are disabled.
+// When the planned downtime is in execution,
+// only action to postpone on once type is enabled and the other are disabled.
$disabled_in_execution = (int) $running;
$table = new StdClass();
@@ -508,11 +635,40 @@ $table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->data[0][0] = __('Name');
-$table->data[0][1] = html_print_input_text('name', $name, '', 25, 40, true, $disabled_in_execution);
+$table->data[0][1] = html_print_input_text(
+ 'name',
+ $name,
+ '',
+ 25,
+ 40,
+ true,
+ $disabled_in_execution
+);
$table->data[1][0] = __('Group');
-$table->data[1][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', 0, true, false, true, '', $disabled_in_execution);
+$table->data[1][1] = html_print_select_groups(
+ false,
+ $access,
+ true,
+ 'id_group',
+ $id_group,
+ '',
+ '',
+ 0,
+ true,
+ false,
+ true,
+ '',
+ $disabled_in_execution
+);
$table->data[2][0] = __('Description');
-$table->data[2][1] = html_print_textarea('description', 3, 35, $description, '', true);
+$table->data[2][1] = html_print_textarea(
+ 'description',
+ 3,
+ 35,
+ $description,
+ '',
+ true
+);
$table->data[3][0] = __('Type').ui_print_help_tip(
__('Quiet: Modules will not generate events or fire alerts.').'
'.__('Disable Agents: Disables the selected agents.').'
'.__('Disable Alerts: Disable alerts for the selected agents.'),
@@ -554,7 +710,7 @@ $table->data[4][1] = html_print_select(
);
$days = array_combine(range(1, 31), range(1, 31));
-$table->data[5][0] = __('Configure the time').' '.ui_print_help_icon('planned_downtime_time', true);
+$table->data[5][0] = __('Configure the time').' ';
;
$table->data[5][1] = "
@@ -678,7 +834,7 @@ if ($id_downtime > 0) {
echo "
";
}
-// Editor form
+// Editor form.
html_print_table($table);
html_print_input_hidden('id_agent', $id_agent);
@@ -686,10 +842,20 @@ echo ' ';
if ($id_downtime > 0) {
html_print_input_hidden('update_downtime', 1);
html_print_input_hidden('id_downtime', $id_downtime);
- html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
+ html_print_submit_button(
+ __('Update'),
+ 'updbutton',
+ false,
+ 'class="sub upd"'
+ );
} else {
html_print_input_hidden('create_downtime', 1);
- html_print_submit_button(__('Add'), 'crtbutton', false, 'class="sub wand"');
+ html_print_submit_button(
+ __('Add'),
+ 'crtbutton',
+ false,
+ 'class="sub wand"'
+ );
}
echo ' ';
@@ -700,11 +866,11 @@ if ($id_downtime > 0) {
$filter_group = (int) get_parameter('filter_group', 0);
- // User AD groups to str for the filter
+ // User AD groups to str for the filter.
$id_groups_str = implode(',', $user_groups_ad);
if (empty($id_groups_str)) {
- // Restrictive filter on error. This will filter all the downtimes
+ // Restrictive filter on error. This will filter all the downtimes.
$id_groups_str = '-1';
}
@@ -752,7 +918,7 @@ if ($id_downtime > 0) {
$agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'alias');
- // item[] = ;
+
$agents = array_combine($agent_ids, $agent_names);
if ($agents === false) {
$agents = [];
@@ -763,7 +929,6 @@ if ($id_downtime > 0) {
$disabled_add_button = true;
}
-
echo " |