diff --git a/README.md b/README.md index 3187ac8487..15db18aa00 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,4 @@ Pandora FMS is a monitoring tool that not only measures if a parameter is right

![screenshot 4](http://wolf359.artica.es/public_images/pandora6.0sp3-sample-visual-console.png) + diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 1702ba40e0..1e6c6854a6 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.753-210330 +Version: 7.0NG.753-210407 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index e7aa071815..50959f54d6 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.753-210330" +pandora_version="7.0NG.753-210407" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 6cd1040763..4cd468afc8 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.753'; -use constant AGENT_BUILD => '210330'; +use constant AGENT_BUILD => '210407'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index a190459153..0d9669e329 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.753 -%define release 210330 +%define release 210407 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index f235de2b53..ec53b3c1f0 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.753 -%define release 210330 +%define release 210407 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index ef9b1bdf5b..9a51acb1c8 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.753" -PI_BUILD="210330" +PI_BUILD="210407" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index d19f17758b..35fde32cab 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210330} +{210407} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 872071af8e..7bfc42d7d0 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.753(Build 210330)") +#define PANDORA_VERSION ("7.0NG.753(Build 210407)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 310bdbd8e0..4a88adf11d 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.753(Build 210330))" + VALUE "ProductVersion", "(7.0NG.753(Build 210407))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 8be915a7ed..979f6b9ea9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.753-210330 +Version: 7.0NG.753-210407 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 4c1fde485b..e26fa1a9ef 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.753-210330" +pandora_version="7.0NG.753-210407" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/46.sql b/pandora_console/extras/mr/46.sql new file mode 100644 index 0000000000..63e0bf5843 --- /dev/null +++ b/pandora_console/extras/mr/46.sql @@ -0,0 +1,6 @@ +START TRANSACTION; + +ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DEFAULT ''; + + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index a72fffdc53..7945e60204 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -2519,7 +2519,7 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di -- ---------------------------------------------------------------------- -- Add column in table `tagent_custom_fields` -- ---------------------------------------------------------------------- -ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; +ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` TEXT NOT NULL DEFAULT ''; -- ---------------------------------------------------------------------- -- Add column in table `tnetflow_filter` diff --git a/pandora_console/general/first_task/cluster_builder.php b/pandora_console/general/first_task/cluster_builder.php index 7cae5f3a3b..08ea618cce 100644 --- a/pandora_console/general/first_task/cluster_builder.php +++ b/pandora_console/general/first_task/cluster_builder.php @@ -24,6 +24,14 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], return; } +\ui_print_page_header( + __('Monitoring').' » '.__('Clusters'), + 'images/chart.png', + false, + '', + false +); + ui_require_css_file('first_task'); ?> 'select_search', + 'fields' => $combo_values, + 'name' => 'customvalue_'.$field['id_field'], + 'selected' => $custom_value, + 'nothing' => __('None'), + 'nothing_value' => '', + 'return' => true, + 'sort' => false, + 'size' => '400px', + 'dropdownAutoWidth' => true, + ] ); }; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index f7ff804b50..63b9e03131 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -400,7 +400,7 @@ if ($id_agente) { // Module tab. $moduletab['text'] = ''.html_print_image( - 'images/module.png', + 'images/gm_modules.png', true, [ 'title' => __('Modules'), @@ -416,7 +416,7 @@ if ($id_agente) { // Alert tab. $alerttab['text'] = ''.html_print_image( - 'images/bell.png', + 'images/gm_alerts.png', true, [ 'title' => __('Alerts'), diff --git a/pandora_console/godmode/agentes/configure_field.php b/pandora_console/godmode/agentes/configure_field.php index 4a6b086d63..0f7a42820a 100755 --- a/pandora_console/godmode/agentes/configure_field.php +++ b/pandora_console/godmode/agentes/configure_field.php @@ -33,7 +33,7 @@ if ($id_field) { $name = $field['name']; $display_on_front = $field['display_on_front']; $is_password_type = $field['is_password_type']; - $combo_values = $field['combo_values']; + $combo_values = $field['combo_values'] ? $field['combo_values'] : ''; $is_combo_enable = $config['is_combo_enable']; ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, ''); } else { @@ -116,12 +116,12 @@ $table->data[4][0] = __('Combo values').ui_print_help_tip( __('Set values separated by comma'), true ); -$table->data[4][1] = html_print_input_text( +$table->data[4][1] = html_print_textarea( 'combo_values', + 3, + 65, io_safe_output($combo_values), '', - 35, - 200, true ); @@ -144,7 +144,7 @@ echo ''; \ No newline at end of file + diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 6c6e6f66b3..da85133c7f 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -882,9 +882,11 @@ foreach ($simple_alerts as $alert) { ['title' => __('Add action')] ); } else { - $data[4] .= ''; - $data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); - $data[4] .= ''; + if ((int) $alert['id_policy_alerts'] === 0) { + $data[4] .= ''; + $data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); + $data[4] .= ''; + } } } diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 7b9b43ed41..08e2c2e9f3 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -149,12 +149,12 @@ if ($id_group) { $table->data[2][1] .= html_print_select_groups( false, 'AR', - true, + false, 'id_parent', $id_parent, '', - '', - '', + __('None'), + -1, true, false, true, @@ -174,7 +174,9 @@ if ($id_group) { 'name' => 'id_parent', 'selected' => $id_parent, 'return' => true, - 'returnAllGroup' => true, + 'returnAllGroup' => false, + 'nothing' => __('None'), + 'nothing_value' => -1, ] ); $table->data[2][1] .= ''; @@ -182,7 +184,7 @@ if ($id_group) { if ($acl_parent) { $table->data[2][1] .= ' '; - $table->data[2][1] .= html_print_image('images/groups_small/'.groups_get_icon($id_parent).'.png', true); + $table->data[2][1] .= html_print_image('images/groups_small/'.( $id_parent != 0 ? groups_get_icon($id_parent) : 'without_group').'.png', true); $table->data[2][1] .= ''; } diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index f1a0cd607e..74ea0af8fe 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -39,14 +39,14 @@ require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_users.php'; -if (is_metaconsole()) { +if (is_metaconsole() === true) { enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('meta/include/functions_agents_meta.php'); enterprise_hook('open_meta_frame'); } -if (is_ajax()) { - if (! check_acl($config['id_user'], 0, 'AR')) { +if (is_ajax() === true) { + if (check_acl($config['id_user'], 0, 'AR') === false) { db_pandora_audit('ACL Violation', 'Trying to access Group Management'); include 'general/noaccess.php'; return; @@ -56,14 +56,14 @@ if (is_ajax()) { $get_group_agents = (bool) get_parameter('get_group_agents'); $get_is_disabled = (bool) get_parameter('get_is_disabled'); - if ($get_group_json) { + if ($get_group_json === true) { $id_group = (int) get_parameter('id_group'); - if ($id_group == 0) { + if ($id_group === 0 || $id_group === -1) { $group = [ 'id_grupo' => 0, - 'nombre' => 'All', - 'icon' => 'world', + 'nombre' => 'None', + 'icon' => '', 'parent' => 0, 'disabled' => 0, 'custom_id' => null, @@ -72,7 +72,7 @@ if (is_ajax()) { return; } - if (! check_acl($config['id_user'], $id_group, 'AR')) { + if (check_acl($config['id_user'], $id_group, 'AR') === false) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' @@ -87,7 +87,7 @@ if (is_ajax()) { return; } - if ($get_group_agents) { + if ($get_group_agents === true) { ob_clean(); $id_group = (int) get_parameter('id_group'); $disabled = (int) get_parameter('disabled', 0); @@ -108,10 +108,13 @@ if (is_ajax()) { // (by default and for compatibility show void agents). $show_void_agents = (int) get_parameter('show_void_agents', 1); $serialized = (bool) get_parameter('serialized', false); - $serialized_separator = (string) get_parameter('serialized_separator', '|'); + $serialized_separator = (string) get_parameter( + 'serialized_separator', + '|' + ); $force_serialized = (bool) get_parameter('force_serialized', false); - if (! check_acl($config['id_user'], $id_group, 'AR')) { + if (check_acl($config['id_user'], $id_group, 'AR') === false) { db_pandora_audit( 'ACL Violation', 'Trying to access Alert Management' @@ -120,12 +123,15 @@ if (is_ajax()) { return; } - if (https_is_running()) { + if (https_is_running() === true) { header('Content-type: application/json'); } if ($filter_agents_json != '') { - $filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true); + $filter['id_agente'] = json_decode( + io_safe_output($filter_agents_json), + true + ); } if ($all_agents) { @@ -142,7 +148,6 @@ if (is_ajax()) { $filter['status'] = $status_agents; } - // Juanma (22/05/2014) Fix: If remove void agents set. $_sql_post = ' 1=1 '; if ($show_void_agents == 0) { $_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\''; @@ -172,7 +177,7 @@ if (is_ajax()) { $agents_aux = []; foreach ($agents as $key => $value) { - if (preg_match('/'.$search.'/', io_safe_output($value))) { + if (preg_match('/'.$search.'/', io_safe_output($value)) === true) { $agents_aux[$key] = $value; } } @@ -197,7 +202,10 @@ if (is_ajax()) { 'id_tmetaconsole_setup' => $agent_info[0], ] ); - } else if ($serialized && !is_metaconsole() && $force_serialized) { + } else if ($serialized + && is_metaconsole() === false + && $force_serialized + ) { $agent_info = explode($serialized_separator, $k); $agent_disabled = db_get_value_filter( 'disabled', @@ -233,10 +241,14 @@ if (is_ajax()) { return; } - if ($get_is_disabled) { + if ($get_is_disabled === true) { $index = get_parameter('id_agent'); - $agent_disabled = db_get_value_filter('disabled', 'tagente', ['id_agente' => $index]); + $agent_disabled = db_get_value_filter( + 'disabled', + 'tagente', + ['id_agente' => $index] + ); $return['disabled'] = $agent_disabled; $return['id_agent'] = $index; @@ -268,8 +280,8 @@ if ($tab != 'credbox' && ! check_acl( include 'general/noaccess.php'; return; } else if ($tab == 'credbox' - && !check_acl($config['id_user'], 0, 'UM') - && !check_acl($config['id_user'], 0, 'PM') + && check_acl($config['id_user'], 0, 'UM') === false + && check_acl($config['id_user'], 0, 'PM') === false ) { db_pandora_audit( 'ACL Violation', @@ -339,7 +351,7 @@ switch ($tab) { } // Header. -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { agents_meta_print_header(); echo '
'; echo __('Edit or delete groups can cause problems with synchronization'); @@ -368,7 +380,7 @@ $delete_group = (bool) get_parameter('delete_group'); $pure = get_parameter('pure', 0); // Create group. -if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) { +if (($create_group) && (check_acl($config['id_user'], 0, 'PM') === true)) { $name = (string) get_parameter('name'); $icon = (string) get_parameter('icon'); $id_parent = (int) get_parameter('id_parent'); @@ -460,7 +472,7 @@ if ($update_group) { $values = [ 'nombre' => $name, 'icon' => empty($icon) ? '' : substr($icon, 0, -4), - 'parent' => $id_parent, + 'parent' => $id_parent == -1 ? 0 : $id_parent, 'disabled' => !$alerts_enabled, 'custom_id' => $custom_id, 'id_skin' => $skin, @@ -492,7 +504,7 @@ if ($update_group) { } // Delete group. -if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) { +if (($delete_group) && (check_acl($config['id_user'], 0, 'PM') === true)) { $id_group = (int) get_parameter('id_group'); $usedGroup = groups_check_used($id_group); @@ -508,28 +520,42 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) { $success_nodes = []; $error_nodes = []; // Check if the group can be deleted or not. - foreach ($servers as $server) { - if (metaconsole_connect($server) == NOERR) { - $result_exist_group = db_get_row_filter('tgrupo', ['nombre' => $group_name, 'id_grupo' => $id_group]); - if ($result_exist_group !== false) { - $used_group = groups_check_used($id_group); - // Save the names of the nodes that are empty and can be deleted, and those that cannot. - if (!$used_group['return']) { - $success_nodes[] .= $server['server_name']; - $success_counter++; - } else { - $error_nodes[] .= $server['server_name']; - $error_counter++; + if (isset($servers) === true + && is_array($servers) === true + ) { + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR) { + $result_exist_group = db_get_row_filter( + 'tgrupo', + [ + 'nombre' => $group_name, + 'id_grupo' => $id_group, + ] + ); + if ($result_exist_group !== false) { + $used_group = groups_check_used($id_group); + // Save the names of the nodes that are empty + // and can be deleted, and those that cannot. + if (!$used_group['return']) { + $success_nodes[] .= $server['server_name']; + $success_counter++; + } else { + $error_nodes[] .= $server['server_name']; + $error_counter++; + } } } - } - metaconsole_restore_db(); + metaconsole_restore_db(); + } } if ($error_counter > 0) { ui_print_error_message( - __('The group %s could not be deleted because it is not empty in the nodes', $group_name).': '.implode(', ', $error_nodes) + __( + 'The group %s could not be deleted because it is not empty in the nodes', + $group_name + ).': '.implode(', ', $error_nodes) ); $errors_meta = true; } else { @@ -540,60 +566,80 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) { $success_deleting = []; $error_connecting_node = []; // Delete the group in the nodes. - foreach ($servers as $server) { - if (metaconsole_connect($server) == NOERR) { - $group = db_get_row_filter( - 'tgrupo', - ['id_grupo' => $id_group] - ); + if (isset($servers) === true + && is_array($servers) === true + ) { + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR) { + $group = db_get_row_filter( + 'tgrupo', + ['id_grupo' => $id_group] + ); - db_process_sql_update( - 'tgrupo', - ['parent' => $group['parent']], - ['parent' => $id_group] - ); + db_process_sql_update( + 'tgrupo', + ['parent' => $group['parent']], + ['parent' => $id_group] + ); - db_process_sql_delete( - 'tgroup_stat', - ['id_group' => $id_group] - ); + db_process_sql_delete( + 'tgroup_stat', + ['id_group' => $id_group] + ); - $result = db_process_sql_delete( - 'tgrupo', - ['id_grupo' => $id_group] - ); + $result = db_process_sql_delete( + 'tgrupo', + ['id_grupo' => $id_group] + ); - if ($result === false) { - $error_deleting[] .= $server['server_name']; - $error_deleting_counter++; + if ($result === false) { + $error_deleting[] .= $server['server_name']; + $error_deleting_counter++; + } else { + $success_deleting[] .= $server['server_name']; + $success_deleting_counter++; + } } else { - $success_deleting[] .= $server['server_name']; - $success_deleting_counter++; + $error_deleting_counter++; + $error_connecting_node[] .= $server['server_name']; } - } else { - $error_deleting_counter++; - $error_connecting_node[] .= $server['server_name']; - } - metaconsole_restore_db(); + metaconsole_restore_db(); + } } - // If the group could not be deleted in any node, do not delete it in meta. + // If the group could not be deleted in any node, + // do not delete it in meta. if ($error_deleting_counter > 0) { $errors_meta = true; - if (!empty($error_connecting_node)) { - ui_print_error_message(__('Error connecting to %s', implode(', ', $error_connecting_node).'. The group has not been deleted in the metaconsole.')); + if (empty($error_connecting_node) === false) { + ui_print_error_message( + __( + 'Error connecting to %s', + implode( + ', ', + $error_connecting_node + ).'. The group has not been deleted in the metaconsole.' + ) + ); } - if (!empty($error_deleting)) { + if (empty($error_deleting) === false) { ui_print_error_message( - __('The group has not been deleted in the metaconsole due to an error in the node database').': '.implode(', ', $error_deleting) + __( + 'The group has not been deleted in the metaconsole due to an error in the node database' + ).': '.implode(', ', $error_deleting) ); } } if ($success_deleting_counter > 0) { - ui_print_success_message(__('The group %s has been deleted in the nodes', $group_name).': '.implode(', ', $success_deleting)); + ui_print_success_message( + __( + 'The group %s has been deleted in the nodes', + $group_name + ).': '.implode(', ', $success_deleting) + ); } } } @@ -624,12 +670,17 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) { if ($result && (!$usedGroup['return'])) { ui_print_success_message(__('Group successfully deleted')); } else { - ui_print_error_message(__('There was a problem deleting group')); + ui_print_error_message( + __('There was a problem deleting group') + ); } } } else { ui_print_error_message( - sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables'])) + sprintf( + __('The group is not empty. It is use in %s.'), + implode(', ', $usedGroup['tables']) + ) ); } } @@ -662,14 +713,14 @@ if ($tab == 'tree') { $search = (string) get_parameter('search', ''); $block_size = $config['block_size']; - if (!empty($search)) { + if (empty($search) === false) { $search_name = 'AND t.nombre LIKE "%'.$search.'%"'; } - if (!users_can_manage_group_all('AR')) { + if (users_can_manage_group_all('AR') === false) { $user_groups_acl = users_get_groups(false, 'AR'); - $groups_acl = implode(',', $user_groups_ACL); - if (empty($groups_acl)) { + $groups_acl = implode('","', $user_groups_acl); + if (empty($groups_acl) === true) { return ui_print_info_message( [ 'no_close' => true, @@ -678,13 +729,20 @@ if ($tab == 'tree') { ); } - $acl = 'AND t.id_grupo IN ('.$groups_acl.')'; + $acl = 'AND t.nombre IN ("'.$groups_acl.'")'; } $form = "
"; $form .= ""; $form .= ''; @@ -713,7 +771,7 @@ if ($tab == 'tree') { $groups = db_get_all_rows_sql($groups_sql); - if (!empty($groups)) { + if (empty($groups) === false) { // Count all groups for pagination only saw user and filters. $groups_sql_count = sprintf( 'SELECT count(*) @@ -799,7 +857,7 @@ if ($tab == 'tree') { ] ).''; - if (is_metaconsole()) { + if (is_metaconsole() === true) { $confirm_message = __('Are you sure? This group will also be deleted in all the nodes.'); } else { $confirm_message = __('Are you sure?'); @@ -841,11 +899,16 @@ if ($tab == 'tree') { 'pagination-bottom' ); } else { - ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]); + ui_print_info_message( + [ + 'no_close' => true, + 'message' => __('There are no defined groups'), + ] + ); } } -if (check_acl($config['id_user'], 0, 'PM')) { +if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { echo ''; echo '
'; html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"'); @@ -860,7 +923,7 @@ $tab = 'group_edition'; ?> - + @@ -900,7 +963,6 @@ $tab = 'group_edition'; treeController.init({ recipient: $("div#tree-controller-recipient"), - //detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }), page: parameters['page'], emptyMessage: "", foundMessage: "", diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 1a0326fd21..bde5b42dfc 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -819,24 +819,17 @@ foreach ($fields as $field) { } if ($field['combo_values'] !== '') { - $data[1] = html_print_select( - $combo_values, - 'customvalue_'.$field['id_field'], - $custom_value, - '', - __('No change'), - '', - true, - false, - false, - '', - false, - false, - false, - false, - false, - '', - false + $data[1] = html_print_input( + [ + 'type' => 'select_search', + 'fields' => $combo_values, + 'name' => 'customvalue_'.$field['id_field'], + 'selected' => $custom_value, + 'nothing' => __('No change'), + 'nothing_value' => '', + 'return' => true, + 'sort' => false, + ] ); }; diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index dce3b40dda..56e316aa96 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -46,7 +46,7 @@ if (defined('METACONSOLE')) { $sec = 'gmodules'; } -if (is_management_allowed() === true) { +if (is_management_allowed() === true || is_metaconsole()) { $create = (bool) get_parameter('create'); $update = (bool) get_parameter('update'); $delete = (bool) get_parameter('delete'); @@ -125,7 +125,7 @@ if ($delete) { ['id_sg' => $id] ); - if (($result !== false) and ($result1 !== false)) { + if (($result !== false) && ($result1 !== false)) { $result = true; } else { $result = false; @@ -187,7 +187,7 @@ if ($multiple_delete) { ); } -if (($id || $new) && !$delete && !$multiple_delete && is_management_allowed() === true) { +if (($id || $new) && !$delete && !$multiple_delete && (is_management_allowed() === true || is_metaconsole())) { include_once 'manage_nc_groups_form.php'; return; } @@ -230,7 +230,7 @@ $table->class = 'info_table'; $table->head = []; $table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false); $table->head[0] = __('Name'); -if (is_management_allowed() === true) { +if (is_management_allowed() === true || is_metaconsole()) { $table->head[1] = __('Action'); } @@ -262,15 +262,15 @@ foreach ($groups as $group) { } $table->cellclass[][1] = 'action_buttons'; - if (is_management_allowed() === true) { + if (is_management_allowed() === true || is_metaconsole()) { $data[1] = "".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).''; } array_push($table->data, $data); } -if (is_management_allowed() === false) { +if (is_management_allowed() === false && !is_metaconsole()) { ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.')); } @@ -278,7 +278,7 @@ if (isset($data)) { echo ""; html_print_input_hidden('multiple_delete', 1); html_print_table($table); - if (is_management_allowed() === true) { + if (is_management_allowed() === true || is_metaconsole()) { echo "
"; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo '
'; @@ -289,7 +289,7 @@ if (isset($data)) { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]); } -if (is_management_allowed() === true) { +if (is_management_allowed() === true || is_metaconsole()) { echo ''; echo '
'; html_print_input_hidden('new', 1); diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index d3a71e641f..3d71be414c 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -44,6 +44,9 @@ if (! check_acl($config['id_user'], 0, 'PM') return; } +// Load needed resources. +ui_require_css_file('setup.multicolumn'); + $update_config = get_parameter('update_config', 0); if ($update_config == 1 && $config['history_db_enabled'] == 1) { if (! isset($config['history_db_connection']) @@ -649,7 +652,7 @@ $table_other->data[16][1] = html_print_input_text( echo ''; -echo '
'; +echo '
'; echo ''.__('Database maintenance status').' '.ui_print_help_icon('database_maintenance_status_tab', true).''; html_print_table($table_status); echo '
'; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 70a46eea2e..219389f891 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -23,14 +23,17 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user } // FIX: this constant is declared to in godmode/reporting/reporting_builder.phps -// Constant with fonts directory +// Constant with fonts directory. define('_MPDF_TTFONTPATH', $config['homedir'].'/include/fonts/'); require_once 'include/functions_post_process.php'; -// Load enterprise extensions +// Load enterprise extensions. enterprise_include('godmode/setup/setup_visuals.php'); +// Load needed resources. +ui_require_css_file('setup.multicolumn'); + /* NOTICE FOR DEVELOPERS: @@ -116,10 +119,6 @@ if (enterprise_installed()) { $row++; } -echo '
'; -echo ''.__('Behaviour configuration').' '.ui_print_help_icon('behavoir_conf_tab', true).''; -html_print_table($table_behaviour); -echo '
'; // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // STYLE CONFIGURATION @@ -549,1024 +548,1037 @@ $table_styles->data[$row][1] = html_print_checkbox_switch( $row++; - // For 5.1 Autohidden menu feature - $table_styles->data['autohidden'][0] = __('Automatically hide submenu'); - $table_styles->data['autohidden'][1] = html_print_checkbox_switch( - 'autohidden_menu', - 1, - $config['autohidden_menu'], - true - ); +// For 5.1 Autohidden menu feature +$table_styles->data['autohidden'][0] = __('Automatically hide submenu'); +$table_styles->data['autohidden'][1] = html_print_checkbox_switch( + 'autohidden_menu', + 1, + $config['autohidden_menu'], + true +); - $table_styles->data[$row][0] = __('Visual effects and animation'); - $table_styles->data[$row][1] = html_print_checkbox_switch( - 'visual_animation', - 1, - $config['visual_animation'], - true - ); +$table_styles->data[$row][0] = __('Visual effects and animation'); +$table_styles->data[$row][1] = html_print_checkbox_switch( + 'visual_animation', + 1, + $config['visual_animation'], + true +); - echo '
'; - echo ''.__('Style configuration').' '.ui_print_help_icon('style_conf_tab', true).''; - html_print_table($table_styles); - echo '
'; - // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // GIS CONFIGURATION - // ---------------------------------------------------------------------- - $table_gis = new stdClass(); - $table_gis->width = '100%'; - $table_gis->class = 'databox filters'; - $table_gis->style[0] = 'font-weight: bold;'; - $table_gis->size[0] = '50%'; - $table_gis->data = []; +// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// GIS CONFIGURATION +// ---------------------------------------------------------------------- +$table_gis = new stdClass(); +$table_gis->width = '100%'; +$table_gis->class = 'databox filters'; +$table_gis->style[0] = 'font-weight: bold;'; +$table_gis->size[0] = '50%'; +$table_gis->data = []; - $table_gis->data[$row][0] = __('GIS Labels'); - $table_gis->data[$row][1] = html_print_checkbox_switch( - 'gis_label', - 1, - $config['gis_label'], - true - ); - $row++; +$table_gis->data[$row][0] = __('GIS Labels'); +$table_gis->data[$row][1] = html_print_checkbox_switch( + 'gis_label', + 1, + $config['gis_label'], + true +); +$row++; - $listIcons = gis_get_array_list_icons(); - $arraySelectIcon = []; - foreach ($listIcons as $index => $value) { - $arraySelectIcon[$index] = $index; - } +$listIcons = gis_get_array_list_icons(); +$arraySelectIcon = []; +foreach ($listIcons as $index => $value) { + $arraySelectIcon[$index] = $index; +} - $table_gis->data[$row][0] = __('Default icon in GIS'); - $table_gis->data[$row][1] = html_print_select( - $arraySelectIcon, - 'gis_default_icon', - $config['gis_default_icon'], - '', - __('Agent icon group'), - '', - true - ); - $table_gis->data[$row][1] .= ' '.html_print_button(__('View'), 'gis_icon_preview', false, '', 'class="sub camera logo_preview"', true); - $row++; +$table_gis->data[$row][0] = __('Default icon in GIS'); +$table_gis->data[$row][1] = html_print_select( + $arraySelectIcon, + 'gis_default_icon', + $config['gis_default_icon'], + '', + __('Agent icon group'), + '', + true +); +$table_gis->data[$row][1] .= ' '.html_print_button(__('View'), 'gis_icon_preview', false, '', 'class="sub camera logo_preview"', true); +$row++; - echo '
'; - echo ''.__('GIS configuration').' '.ui_print_help_icon('gis_conf_tab', true).''; - html_print_table($table_gis); - echo '
'; - // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // FONT AND TEXT CONFIGURATION - // ---------------------------------------------------------------------- - $table_font = new stdClass(); - $table_font->width = '100%'; - $table_font->class = 'databox filters'; - $table_font->style[0] = 'font-weight: bold;'; - $table_font->size[0] = '50%'; - $table_font->data = []; +// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// FONT AND TEXT CONFIGURATION +// ---------------------------------------------------------------------- +$table_font = new stdClass(); +$table_font->width = '100%'; +$table_font->class = 'databox filters'; +$table_font->style[0] = 'font-weight: bold;'; +$table_font->size[0] = '50%'; +$table_font->data = []; - $table_font->data[$row][0] = __('Graphs font family'); +$table_font->data[$row][0] = __('Graphs font family'); - // Load font families. - $fonts = []; - $dirFonts = scandir(_MPDF_TTFONTPATH); - foreach ($dirFonts as $entryDir) { - if (strstr($entryDir, '.ttf') !== false) { - $explode = explode('-', $entryDir); - if (count($explode) === 1) { - $fonts[$entryDir] = substr($entryDir, 0, (strlen($entryDir) - 4)); - } +// Load font families. +$fonts = []; +$dirFonts = scandir(_MPDF_TTFONTPATH); +foreach ($dirFonts as $entryDir) { + if (strstr($entryDir, '.ttf') !== false) { + $explode = explode('-', $entryDir); + if (count($explode) === 1) { + $fonts[$entryDir] = substr($entryDir, 0, (strlen($entryDir) - 4)); + } - if ($explode[1] === 'Regular.ttf') { - $fonts[$explode[0].'.ttf'] = $explode[0]; - } + if ($explode[1] === 'Regular.ttf') { + $fonts[$explode[0].'.ttf'] = $explode[0]; } } +} - $table_font->data[$row][1] = html_print_select( - $fonts, - 'fontpath', - io_safe_output($config['fontpath']), - '', - '', - 0, - true - ); +$table_font->data[$row][1] = html_print_select( + $fonts, + 'fontpath', + io_safe_output($config['fontpath']), + '', + '', + 0, + true +); - $row++; +$row++; - $table_font->data[$row][0] = __('Graphs font size'); +$table_font->data[$row][0] = __('Graphs font size'); - $font_size_array = [ - 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - 6 => 6, - 7 => 7, - 8 => 8, - 9 => 9, - 10 => 10, - 11 => 11, - 12 => 12, - 13 => 13, - 14 => 14, - 15 => 15, - ]; +$font_size_array = [ + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15, +]; - $table_font->data[$row][1] = html_print_select( - $font_size_array, - 'font_size', - $config['font_size'], - '', - '', - 0, - true - ); - $row++; +$table_font->data[$row][1] = html_print_select( + $font_size_array, + 'font_size', + $config['font_size'], + '', + '', + 0, + true +); +$row++; - $table_font->data[$row][0] = __('Agent size text'); - $table_font->data[$row][1] = __('Small:').html_print_input_text('agent_size_text_small', $config['agent_size_text_small'], '', 3, 3, true); - $table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('agent_size_text_medium', $config['agent_size_text_medium'], '', 3, 3, true); - $row++; +$table_font->data[$row][0] = __('Agent size text'); +$table_font->data[$row][1] = __('Small:').html_print_input_text('agent_size_text_small', $config['agent_size_text_small'], '', 3, 3, true); +$table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('agent_size_text_medium', $config['agent_size_text_medium'], '', 3, 3, true); +$row++; - $table_font->data[$row][0] = __('Module size text'); - $table_font->data[$row][1] = __('Small:').html_print_input_text('module_size_text_small', $config['module_size_text_small'], '', 3, 3, true); - $table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('module_size_text_medium', $config['module_size_text_medium'], '', 3, 3, true); - $row++; +$table_font->data[$row][0] = __('Module size text'); +$table_font->data[$row][1] = __('Small:').html_print_input_text('module_size_text_small', $config['module_size_text_small'], '', 3, 3, true); +$table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('module_size_text_medium', $config['module_size_text_medium'], '', 3, 3, true); +$row++; - $table_font->data[$row][0] = __('Description size text'); - $table_font->data[$row][1] = html_print_input_text('description_size_text', $config['description_size_text'], '', 3, 3, true); - $row++; +$table_font->data[$row][0] = __('Description size text'); +$table_font->data[$row][1] = html_print_input_text('description_size_text', $config['description_size_text'], '', 3, 3, true); +$row++; - $table_font->data[$row][0] = __('Item title size text'); - $table_font->data[$row][1] = html_print_input_text( - 'item_title_size_text', - $config['item_title_size_text'], - '', - 3, - 3, - true - ); - $row++; +$table_font->data[$row][0] = __('Item title size text'); +$table_font->data[$row][1] = html_print_input_text( + 'item_title_size_text', + $config['item_title_size_text'], + '', + 3, + 3, + true +); +$row++; - $table_font->data[$row][0] = __('Show unit along with value in reports'); - $table_font->data[$row][1] = html_print_checkbox_switch( - 'simple_module_value', - 1, - $config['simple_module_value'], - true - ); - $row++; +$table_font->data[$row][0] = __('Show unit along with value in reports'); +$table_font->data[$row][1] = html_print_checkbox_switch( + 'simple_module_value', + 1, + $config['simple_module_value'], + true +); +$row++; - echo '
'; - echo ''.__('Font and Text configuration').' '.ui_print_help_icon('front_and_text_conf_tab', true).''; - html_print_table($table_font); - echo '
'; - // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // CHARS CONFIGURATION - // ---------------------------------------------------------------------- - $table_chars = new stdClass(); - $table_chars->width = '100%'; - $table_chars->class = 'databox filters'; - $table_chars->style[0] = 'font-weight: bold;'; - $table_chars->size[0] = '50%'; - $table_chars->data = []; +// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// CHARS CONFIGURATION +// ---------------------------------------------------------------------- +$table_chars = new stdClass(); +$table_chars->width = '100%'; +$table_chars->class = 'databox filters'; +$table_chars->style[0] = 'font-weight: bold;'; +$table_chars->size[0] = '50%'; +$table_chars->data = []; - $table_chars->data[$row][0] = __('Graph color #1'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color1', - $config['graph_color1'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #1'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color1', + $config['graph_color1'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #2'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color2', - $config['graph_color2'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #2'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color2', + $config['graph_color2'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #3'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color3', - $config['graph_color3'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #3'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color3', + $config['graph_color3'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #4'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color4', - $config['graph_color4'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #4'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color4', + $config['graph_color4'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #5'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color5', - $config['graph_color5'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #5'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color5', + $config['graph_color5'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #6'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color6', - $config['graph_color6'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #6'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color6', + $config['graph_color6'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #7'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color7', - $config['graph_color7'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #7'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color7', + $config['graph_color7'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #8'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color8', - $config['graph_color8'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #8'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color8', + $config['graph_color8'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #9'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color9', - $config['graph_color9'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #9'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color9', + $config['graph_color9'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Graph color #10'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color10', - $config['graph_color10'], - '', - 8, - 8, - true - ); - $row++; +$table_chars->data[$row][0] = __('Graph color #10'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_color10', + $config['graph_color10'], + '', + 8, + 8, + true +); +$row++; - $table_chars->data[$row][0] = __('Value to interface graphics'); - $table_chars->data[$row][1] = html_print_input_text( - 'interface_unit', - $config['interface_unit'], - '', - 20, - 20, - true - ); - $row++; +$table_chars->data[$row][0] = __('Value to interface graphics'); +$table_chars->data[$row][1] = html_print_input_text( + 'interface_unit', + $config['interface_unit'], + '', + 20, + 20, + true +); +$row++; - $disabled_graph_precision = false; - if (enterprise_installed() === false) { - $disabled_graph_precision = true; +$disabled_graph_precision = false; +if (enterprise_installed() === false) { + $disabled_graph_precision = true; +} + +$table_chars->data[$row][0] = __('Data precision'); +$table_chars->data[$row][1] = html_print_input_text( + 'graph_precision', + $config['graph_precision'], + '', + 5, + 5, + true, + $disabled_graph_precision, + false, + 'onChange="change_precision()"' +); +$row++; + +if (isset($config['short_module_graph_data']) === false) { + $config['short_module_graph_data'] = true; +} + +$table_chars->data[$row][0] = __('Data precision in graphs'); +$table_chars->data[$row][1] = html_print_input_text( + 'short_module_graph_data', + $config['short_module_graph_data'], + '', + 5, + 5, + true, + $disabled_graph_precision, + false, + 'onChange="change_precision()"' +); +$row++; + +$table_chars->data[$row][0] = __( + 'Default line thickness for the Custom Graph.' +); +$table_chars->data[$row][1] = html_print_input_text( + 'custom_graph_width', + $config['custom_graph_width'], + '', + 5, + 5, + true +); +$row++; + +$table_chars->data[$row][0] = __('Number of elements in Custom Graph'); +$table_chars->data[$row][1] = html_print_input_text( + 'items_combined_charts', + $config['items_combined_charts'], + '', + 5, + 5, + true, + false, + false, + '' +); +$row++; + +$table_chars->data[$row][0] = __('Use round corners'); +$table_chars->data[$row][1] = html_print_checkbox_switch( + 'round_corner', + 1, + $config['round_corner'], + true +); +$row++; + +$table_chars->data[$row][0] = __('Chart fit to content'); +$table_chars->data[$row][1] = html_print_checkbox_switch( + 'maximum_y_axis', + 1, + $config['maximum_y_axis'], + true +); +$row++; + +$table_chars->data[$row][0] = __('Type of module charts'); +$table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( + 'type_module_charts', + 'area', + '', + $config['type_module_charts'] == 'area', + true +).'  '; +$table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( + 'type_module_charts', + 'line', + '', + $config['type_module_charts'] != 'area', + true +); +$row++; + +$table_chars->data[$row][0] = __('Type of interface charts'); +$table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( + 'type_interface_charts', + 'area', + '', + $config['type_interface_charts'] == 'area', + true +).'  '; +$table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( + 'type_interface_charts', + 'line', + '', + $config['type_interface_charts'] != 'area', + true +); +$row++; + +$table_chars->data[$row][0] = __('Percentile'); +$table_chars->data[$row][1] = html_print_input_text( + 'percentil', + $config['percentil'], + '', + 20, + 20, + true +); +$row++; + +$table_chars->data[$row][0] = __('Graph TIP view:'); + +$options_full_escale = []; +$options_full_escale[0] = __('None'); +$options_full_escale[1] = __('All'); +$options_full_escale[2] = __('On Boolean graphs'); + +$table_chars->data[$row][1] = html_print_select( + $options_full_escale, + 'full_scale_option', + $config['full_scale_option'], + '', + '', + 0, + true, + false, + false +); +$row++; + + +$table_chars->data[$row][0] = __('Graph mode'); + +$options_soft_graphs = []; +$options_soft_graphs[0] = __('Show only average by default'); +$options_soft_graphs[1] = __('Show MAX/AVG/MIN by default'); + +$table_chars->data[$row][1] = html_print_select( + $options_soft_graphs, + 'type_mode_graph', + $config['type_mode_graph'], + '', + '', + 0, + true, + false, + false +); +$row++; + +$table_chars->data[$row][0] = __('Zoom graphs:'); + +$options_zoom_graphs = []; +$options_zoom_graphs[1] = 'x1'; +$options_zoom_graphs[2] = 'x2'; +$options_zoom_graphs[3] = 'x3'; +$options_zoom_graphs[4] = 'x4'; +$options_zoom_graphs[5] = 'x5'; + +$table_chars->data[$row][1] = html_print_select( + $options_zoom_graphs, + 'zoom_graph', + $config['zoom_graph'], + '', + '', + 0, + true, + false, + false +); +$row++; + +// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// Visual Consoles +// ---------------------------------------------------------------------- +$table_vc = new stdClass(); +$table_vc->width = '100%'; +$table_vc->class = 'databox filters'; +$table_vc->style[0] = 'font-weight: bold'; +$table_vc->size[0] = '50%'; +$table_vc->data = []; + +// Remove when the new view reaches rock solid stability. +$table_vc->data[$row][0] = __('Legacy Visual Console View'); +$table_vc->data[$row][1] = html_print_checkbox_switch( + 'legacy_vc', + 1, + (bool) $config['legacy_vc'], + true +); +$row++; + +$intervals = [ + 10 => '10 '.__('seconds'), + 30 => '30 '.__('seconds'), + 60 => '1 '.__('minutes'), + 300 => '5 '.__('minutes'), + 900 => '15 '.__('minutes'), + 1800 => '30 '.__('minutes'), + 3600 => '1 '.__('hour'), +]; +$table_vc->data[$row][0] = __('Default cache expiration'); +$table_vc->data[$row][1] = html_print_extended_select_for_time( + 'vc_default_cache_expiration', + $config['vc_default_cache_expiration'], + '', + __('No cache'), + 0, + false, + true, + false, + false, + '', + false, + $intervals +); +$row++; + +$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console'); +$table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false); +$row++; + +$vc_favourite_view_array[0] = __('Classic view'); +$vc_favourite_view_array[1] = __('View of favorites'); +$table_vc->data[$row][0] = __('Type of view of visual consoles'); +$table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config['vc_favourite_view'], '', '', 0, true); +$row++; + +$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu'); +$table_vc->data[$row][1] = ""; +$row++; + +$table_vc->data[$row][0] = __('Default line thickness for the Visual Console'); +$table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', (int) $config['vc_line_thickness'], '', 5, 5, true); + + +// ---------------------------------------------------------------------- +// Services +// ---------------------------------------------------------------------- +$table_ser = new stdClass(); +$table_ser->width = '100%'; +$table_ser->class = 'databox filters'; +$table_ser->style[0] = 'font-weight: bold'; +$table_ser->size[0] = '50%'; +$table_ser->data = []; + +$table_ser->data['number'][0] = __('Number of favorite services to show in the menu'); +$table_ser->data['number'][1] = ""; + +// ---------------------------------------------------------------------- +// Reports +// ---------------------------------------------------------------------- +$table_report = new stdClass(); +$table_report->width = '100%'; +$table_report->class = 'databox filters'; +$table_report->style[0] = 'font-weight: bold;'; +$table_report->size[0] = '20%'; + +$table_report->data = []; + +$table_report->data[$row][0] = __('Show report info with description'); +$table_report->data[$row][1] = html_print_checkbox_switch( + 'custom_report_info', + 1, + $config['custom_report_info'], + true +); +$row++; + +$table_report->data[$row][0] = __('Custom report front page'); +$table_report->data[$row][1] = html_print_checkbox_switch( + 'custom_report_front', + 1, + $config['custom_report_front'], + true +); + +$row++; + +$table_report->data[$row][0] = __('PDF font size (px)'); +$table_report->data[$row][1] = ""; + +$row++; + +$table_report->data[$row][0] = __('HTML font size for SLA (em)'); +$table_report->data[$row][1] = ""; + +$row++; + +$table_report->data[$row][0] = __('PDF font family'); +$table_report->data[$row][1] = html_print_select( + $fonts, + 'custom_report_front_font', + $config['custom_report_front_font'], + false, + __('Default'), + '', + true +); + +$row++; + + +$table_report->data[$row][0] = __('Graph image height for HTML reports'); +$table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true); + +$row++; + +$interval_description = [ + 'large' => 'Long', + 'tiny' => 'Short', +]; +$table_report->data[$row][0] = __('Interval description'); +$table_report->data[$row][1] = html_print_select($interval_description, 'interval_description', $config['interval_description'], '', '', '', true, false, false); + +$row++; + +// ---------------------------------------------------------------------- +$dirItems = scandir($config['homedir'].'/images/custom_logo'); +foreach ($dirItems as $entryDir) { + if (strstr($entryDir, '.jpg') !== false || strstr($entryDir, '.png') !== false) { + $customLogos['images/custom_logo/'.$entryDir] = $entryDir; } +} - $table_chars->data[$row][0] = __('Data precision'); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_precision', - $config['graph_precision'], - '', - 5, - 5, - true, - $disabled_graph_precision, - false, - 'onChange="change_precision()"' - ); - $row++; +// Logo. +$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( + __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), + true +); - if (isset($config['short_module_graph_data']) === false) { - $config['short_module_graph_data'] = true; - } +$table_report->data['custom_report_front-logo'][1] = html_print_select( + $customLogos, + 'custom_report_front_logo', + io_safe_output($config['custom_report_front_logo']), + 'showPreview()', + __('Default'), + '', + true +); +// Preview. +$table_report->data['custom_report_front-preview'][0] = __('Custom report front').' - '.'Preview'; +if (empty($config['custom_report_front_logo'])) { + $config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg'; +} - $table_chars->data[$row][0] = __('Data precision in graphs'); - $table_chars->data[$row][1] = html_print_input_text( - 'short_module_graph_data', - $config['short_module_graph_data'], - '', - 5, - 5, - true, - $disabled_graph_precision, - false, - 'onChange="change_precision()"' - ); - $row++; +$table_report->data['custom_report_front-preview'][1] = ''.html_print_image($config['custom_report_front_logo'], true).''; - $table_chars->data[$row][0] = __( - 'Default line thickness for the Custom Graph.' - ); - $table_chars->data[$row][1] = html_print_input_text( - 'custom_graph_width', - $config['custom_graph_width'], - '', - 5, - 5, - true - ); - $row++; +// Header. +$table_report->data['custom_report_front-header'][0] = __('Custom report front').' - '.__('Header'); - $table_chars->data[$row][0] = __('Number of elements in Custom Graph'); - $table_chars->data[$row][1] = html_print_input_text( - 'items_combined_charts', - $config['items_combined_charts'], - '', - 5, - 5, - true, - false, - false, - '' - ); - $row++; +// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. +$table_report->data['custom_report_front-header'][1] = html_print_textarea( + 'custom_report_front_header', + 5, + 15, + io_safe_output($config['custom_report_front_header']), + 'class="w90p height_300px"', + true +); - $table_chars->data[$row][0] = __('Use round corners'); - $table_chars->data[$row][1] = html_print_checkbox_switch( - 'round_corner', - 1, - $config['round_corner'], - true - ); - $row++; +// First page. +// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. +if ($config['custom_report_front']) { + $firstpage_content = $config['custom_report_front_firstpage']; +} else { + $firstpage_content = io_safe_output($config['custom_report_front_firstpage']); +} - $table_chars->data[$row][0] = __('Chart fit to content'); - $table_chars->data[$row][1] = html_print_checkbox_switch( - 'maximum_y_axis', - 1, - $config['maximum_y_axis'], - true - ); - $row++; +$table_report->data['custom_report_front-first_page'][0] = __('Custom report front').' - '.__('First page'); +$custom_report_front_firstpage = str_replace( + '(_URLIMAGE_)', + ui_get_full_url(false, true, false, false), + io_safe_output($firstpage_content) +); +$table_report->data['custom_report_front-first_page'][1] = html_print_textarea( + 'custom_report_front_firstpage', + 15, + 15, + $custom_report_front_firstpage, + 'class="w90p height_300px"', + true +); - $table_chars->data[$row][0] = __('Type of module charts'); - $table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( - 'type_module_charts', - 'area', - '', - $config['type_module_charts'] == 'area', - true - ).'  '; - $table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( - 'type_module_charts', - 'line', - '', - $config['type_module_charts'] != 'area', - true - ); - $row++; +// Footer. +$table_report->data['custom_report_front-footer'][0] = __('Custom report front').' - '.__('Footer'); - $table_chars->data[$row][0] = __('Type of interface charts'); - $table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( - 'type_interface_charts', - 'area', - '', - $config['type_interface_charts'] == 'area', - true - ).'  '; - $table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( - 'type_interface_charts', - 'line', - '', - $config['type_interface_charts'] != 'area', - true - ); - $row++; - - $table_chars->data[$row][0] = __('Percentile'); - $table_chars->data[$row][1] = html_print_input_text( - 'percentil', - $config['percentil'], - '', - 20, - 20, - true - ); - $row++; - - $table_chars->data[$row][0] = __('Graph TIP view:'); - - $options_full_escale = []; - $options_full_escale[0] = __('None'); - $options_full_escale[1] = __('All'); - $options_full_escale[2] = __('On Boolean graphs'); - - $table_chars->data[$row][1] = html_print_select( - $options_full_escale, - 'full_scale_option', - $config['full_scale_option'], - '', - '', - 0, - true, - false, - false - ); - $row++; +// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. +$table_report->data['custom_report_front-footer'][1] = html_print_textarea( + 'custom_report_front_footer', + 5, + 15, + io_safe_output($config['custom_report_front_footer']), + 'class="w90p height_300px""', + true +); - $table_chars->data[$row][0] = __('Graph mode'); +// ---------------------------------------------------------------------- +// OTHER CONFIGURATION +// ---------------------------------------------------------------------- +$table_other = new stdClass(); +$table_other->width = '100%'; +$table_other->class = 'databox filters'; +$table_other->style[0] = 'font-weight: bold;'; +$table_other->size[0] = '50%'; +$table_other->size[1] = '26%'; +$table_other->size[2] = '12%'; +$table_other->size[3] = '12%'; +$table_other->data = []; - $options_soft_graphs = []; - $options_soft_graphs[0] = __('Show only average by default'); - $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default'); +$row++; - $table_chars->data[$row][1] = html_print_select( - $options_soft_graphs, - 'type_mode_graph', - $config['type_mode_graph'], - '', - '', - 0, - true, - false, - false - ); - $row++; +$table_other->data[$row][0] = __('Networkmap max width'); +$table_other->data[$row][1] = html_print_input_text( + 'networkmap_max_width', + $config['networkmap_max_width'], + '', + 10, + 20, + true +); +$row++; - $table_chars->data[$row][0] = __('Zoom graphs:'); +$table_other->data[$row][0] = __('Show only the group name'); +$table_other->data[$row][1] = html_print_checkbox_switch( + 'show_group_name', + 1, + $config['show_group_name'], + true +); +$row++; - $options_zoom_graphs = []; - $options_zoom_graphs[1] = 'x1'; - $options_zoom_graphs[2] = 'x2'; - $options_zoom_graphs[3] = 'x3'; - $options_zoom_graphs[4] = 'x4'; - $options_zoom_graphs[5] = 'x5'; +$table_other->data[$row][0] = __('Date format string'); +$table_other->data[$row][1] = ''.__('Example').' '.date($config['date_format']); +$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); +$row++; - $table_chars->data[$row][1] = html_print_select( - $options_zoom_graphs, - 'zoom_graph', - $config['zoom_graph'], - '', - '', - 0, - true, - false, - false - ); - $row++; +if ($config['prominent_time'] == 'comparation') { + $timestamp = false; + $comparation = true; + $compact = false; +} else if ($config['prominent_time'] == 'timestamp') { + $timestamp = true; + $comparation = false; + $compact = false; +} else if ($config['prominent_time'] == 'compact') { + $timestamp = false; + $comparation = false; + $compact = true; +} - echo '
'; - echo ''.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).''; - html_print_table($table_chars); - echo '
'; - // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // Visual Consoles - // ---------------------------------------------------------------------- - $table_vc = new stdClass(); - $table_vc->width = '100%'; - $table_vc->class = 'databox filters'; - $table_vc->style[0] = 'font-weight: bold'; - $table_vc->size[0] = '50%'; - $table_vc->data = []; +$table_other->data[$row][0] = __('Timestamp, time comparison, or compact mode'); +$table_other->data[$row][1] = '
'; +$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', __('Comparation in rollover'), $comparation, true); +$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'timestamp', __('Timestamp in rollover'), $timestamp, true); +$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'compact', __('Compact mode'), $compact, true); +$table_other->data[$row][1] .= '
'; - // Remove when the new view reaches rock solid stability. - $table_vc->data[$row][0] = __('Legacy Visual Console View'); - $table_vc->data[$row][1] = html_print_checkbox_switch( - 'legacy_vc', - 1, - (bool) $config['legacy_vc'], - true - ); - $row++; +$row++; - $intervals = [ - 10 => '10 '.__('seconds'), - 30 => '30 '.__('seconds'), - 60 => '1 '.__('minutes'), - 300 => '5 '.__('minutes'), - 900 => '15 '.__('minutes'), - 1800 => '30 '.__('minutes'), - 3600 => '1 '.__('hour'), - ]; - $table_vc->data[$row][0] = __('Default cache expiration'); - $table_vc->data[$row][1] = html_print_extended_select_for_time( - 'vc_default_cache_expiration', - $config['vc_default_cache_expiration'], - '', - __('No cache'), - 0, - false, - true, - false, - false, - '', - false, - $intervals - ); - $row++; +// ---------------------------------------------------------------------- +// CUSTOM VALUES POST PROCESS +// ---------------------------------------------------------------------- +$table_other->data[$row][0] = __('Custom values post process'); +$table_other->data[$row][1] = __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true); +$table_other->data[$row][2] = __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true); +$table_other->data[$row][2] .= ' '; +$table_other->data[$row][2] .= html_print_input_hidden( + 'custom_value_add', + '', + true +); +$table_other->data[$row][3] = html_print_button( + __('Add'), + 'custom_value_add_btn', + false, + '', + 'class="sub next"', + true +); - $table_vc->data[$row][0] = __('Default interval for refresh on Visual Console'); - $table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false); - $row++; +$row++; - $vc_favourite_view_array[0] = __('Classic view'); - $vc_favourite_view_array[1] = __('View of favorites'); - $table_vc->data[$row][0] = __('Type of view of visual consoles'); - $table_vc->data[$row][1] = html_print_select($vc_favourite_view_array, 'vc_favourite_view', $config['vc_favourite_view'], '', '', 0, true); - $row++; +$table_other->data[$row][0] = ''; +$table_other->data[$row][1] = __('Delete custom values').': '; +$table_other->data[$row][2] = html_print_select( + post_process_get_custom_values(), + 'custom_values', + '', + '', + '', + '', + true +); +$count_custom_postprocess = post_process_get_custom_values(); +$table_other->data[$row][3] = html_print_button( + __('Delete'), + 'custom_values_del_btn', + empty($count_custom_postprocess), + '', + 'class="sub cancel"', + true +); +// This hidden field will be filled from jQuery before submit +$table_other->data[$row][1] .= html_print_input_hidden( + 'custom_value_to_delete', + '', + true +); +$table_other->data[$row][3] .= '

'; - $table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu'); - $table_vc->data[$row][1] = ""; - $row++; +// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- +// CUSTOM INTERVAL VALUES +// ---------------------------------------------------------------------- +$row++; +$table_other->data[$row][0] = __('Interval values'); +$units = [ + 1 => __('seconds'), + SECONDS_1MINUTE => __('minutes'), + SECONDS_1HOUR => __('hours'), + SECONDS_1DAY => __('days'), + SECONDS_1MONTH => __('months'), + SECONDS_1YEAR => __('years'), +]; +$table_other->data[$row][1] = __('Value').': '; +$table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true); +$table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false); +$table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true); - $table_vc->data[$row][0] = __('Default line thickness for the Visual Console'); - $table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', (int) $config['vc_line_thickness'], '', 5, 5, true); +$row++; +$table_other->data[$row][0] = ''; +$table_other->data[$row][1] = __('Delete interval').': '; +$table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true); +$table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true); - echo '
'; - echo ''.__('Visual consoles configuration').' '.ui_print_help_icon('visual_consoles_conf_tab', true).''; - html_print_table($table_vc); - echo '
'; +$table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true); +// This hidden field will be filled from jQuery before submit +$table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true); +$table_other->data[$row][3] .= '

'; +// ---------------------------------------------------------------------- +$row++; - // ---------------------------------------------------------------------- - // Services - // ---------------------------------------------------------------------- - $table_ser = new stdClass(); - $table_ser->width = '100%'; - $table_ser->class = 'databox filters'; - $table_ser->style[0] = 'font-weight: bold'; - $table_ser->size[0] = '50%'; - $table_ser->data = []; +$table_other->data[$row][0] = __('Module units'); +$table_other->data[$row][1] = __('Value').': '; +$table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true); +$table_other->data[$row][2] = ''; +$table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true); - $table_ser->data['number'][0] = __('Number of favorite services to show in the menu'); - $table_ser->data['number'][1] = ""; +$row++; +$table_other->data[$row][0] = ''; +$table_other->data[$row][1] = __('Delete custom values').': '; +$table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p'); +$table_other->data[$row][3] = html_print_button( + __('Delete'), + 'custom_module_unit_del_btn', + empty($count_custom_postprocess), + '', + 'class="sub cancel"', + true +); - echo '
'; - echo ''.__('Services configuration').' '.ui_print_help_icon('services_conf_tab', true).''; - html_print_table($table_ser); - echo '
'; +$table_other->data[$row][3] .= html_print_input_hidden( + 'custom_module_unit_to_delete', + '', + true +); - // ---------------------------------------------------------------------- - // Reports - // ---------------------------------------------------------------------- - $table_report = new stdClass(); - $table_report->width = '100%'; - $table_report->class = 'databox filters'; - $table_report->style[0] = 'font-weight: bold;'; - $table_report->size[0] = '20%'; +$row++; - $table_report->data = []; - - $table_report->data[$row][0] = __('Show report info with description'); - $table_report->data[$row][1] = html_print_checkbox_switch( - 'custom_report_info', - 1, - $config['custom_report_info'], - true - ); - $row++; - - $table_report->data[$row][0] = __('Custom report front page'); - $table_report->data[$row][1] = html_print_checkbox_switch( - 'custom_report_front', - 1, - $config['custom_report_front'], - true - ); - - $row++; - - $table_report->data[$row][0] = __('PDF font size (px)'); - $table_report->data[$row][1] = ""; - - $row++; - - $table_report->data[$row][0] = __('HTML font size for SLA (em)'); - $table_report->data[$row][1] = ""; - - $row++; - - $table_report->data[$row][0] = __('PDF font family'); - $table_report->data[$row][1] = html_print_select( - $fonts, - 'custom_report_front_font', - $config['custom_report_front_font'], - false, - __('Default'), - '', - true - ); - - $row++; - - - $table_report->data[$row][0] = __('Graph image height for HTML reports'); - $table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true); - - $row++; - - $interval_description = [ - 'large' => 'Long', - 'tiny' => 'Short', - ]; - $table_report->data[$row][0] = __('Interval description'); - $table_report->data[$row][1] = html_print_select($interval_description, 'interval_description', $config['interval_description'], '', '', '', true, false, false); - - $row++; - - // ---------------------------------------------------------------------- - $dirItems = scandir($config['homedir'].'/images/custom_logo'); - foreach ($dirItems as $entryDir) { - if (strstr($entryDir, '.jpg') !== false || strstr($entryDir, '.png') !== false) { - $customLogos['images/custom_logo/'.$entryDir] = $entryDir; - } - } - - // Logo. - $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( - __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), - true - ); - - $table_report->data['custom_report_front-logo'][1] = html_print_select( - $customLogos, - 'custom_report_front_logo', - io_safe_output($config['custom_report_front_logo']), - 'showPreview()', - __('Default'), - '', - true - ); - // Preview. - $table_report->data['custom_report_front-preview'][0] = __('Custom report front').' - '.'Preview'; - if (empty($config['custom_report_front_logo'])) { - $config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg'; - } - - $table_report->data['custom_report_front-preview'][1] = ''.html_print_image($config['custom_report_front_logo'], true).''; - - // Header. - $table_report->data['custom_report_front-header'][0] = __('Custom report front').' - '.__('Header'); - - // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. - $table_report->data['custom_report_front-header'][1] = html_print_textarea( - 'custom_report_front_header', - 5, - 15, - io_safe_output($config['custom_report_front_header']), - 'class="w90p height_300px"', - true - ); - - // First page. - // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. - if ($config['custom_report_front']) { - $firstpage_content = $config['custom_report_front_firstpage']; - } else { - $firstpage_content = io_safe_output($config['custom_report_front_firstpage']); - } - - $table_report->data['custom_report_front-first_page'][0] = __('Custom report front').' - '.__('First page'); - $custom_report_front_firstpage = str_replace( - '(_URLIMAGE_)', - ui_get_full_url(false, true, false, false), - io_safe_output($firstpage_content) - ); - $table_report->data['custom_report_front-first_page'][1] = html_print_textarea( - 'custom_report_front_firstpage', - 15, - 15, - $custom_report_front_firstpage, - 'class="w90p height_300px"', - true - ); - - // Footer. - $table_report->data['custom_report_front-footer'][0] = __('Custom report front').' - '.__('Footer'); - - // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. - $table_report->data['custom_report_front-footer'][1] = html_print_textarea( - 'custom_report_front_footer', - 5, - 15, - io_safe_output($config['custom_report_front_footer']), - 'class="w90p height_300px""', - true - ); - - echo '
'; - echo ''.__('Reports configuration ').ui_print_help_icon('reports_configuration_tab', true).''; - html_print_table($table_report); - echo '
'; - - // ---------------------------------------------------------------------- - // OTHER CONFIGURATION - // ---------------------------------------------------------------------- - $table_other = new stdClass(); - $table_other->width = '100%'; - $table_other->class = 'databox filters'; - $table_other->style[0] = 'font-weight: bold;'; - $table_other->size[0] = '50%'; - $table_other->size[1] = '26%'; - $table_other->size[2] = '12%'; - $table_other->size[3] = '12%'; - $table_other->data = []; - - $row++; - - $table_other->data[$row][0] = __('Networkmap max width'); +$common_dividers = [ + ';' => ';', + ',' => ',', + '|' => '|', +]; +$table_other->data[$row][0] = __('CSV divider'); +if ($config['csv_divider'] != ';' && $config['csv_divider'] != ',' && $config['csv_divider'] != '|') { $table_other->data[$row][1] = html_print_input_text( - 'networkmap_max_width', - $config['networkmap_max_width'], + 'csv_divider', + $config['csv_divider'], '', - 10, 20, + 255, true ); - $row++; - - $table_other->data[$row][0] = __('Show only the group name'); - $table_other->data[$row][1] = html_print_checkbox_switch( - 'show_group_name', - 1, - $config['show_group_name'], - true - ); - $row++; - - $table_other->data[$row][0] = __('Date format string'); - $table_other->data[$row][1] = ''.__('Example').' '.date($config['date_format']); - $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); - $row++; - - if ($config['prominent_time'] == 'comparation') { - $timestamp = false; - $comparation = true; - $compact = false; - } else if ($config['prominent_time'] == 'timestamp') { - $timestamp = true; - $comparation = false; - $compact = false; - } else if ($config['prominent_time'] == 'compact') { - $timestamp = false; - $comparation = false; - $compact = true; - } - - $table_other->data[$row][0] = __('Timestamp, time comparison, or compact mode'); - $table_other->data[$row][1] = '
'; - $table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', __('Comparation in rollover'), $comparation, true); - $table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'timestamp', __('Timestamp in rollover'), $timestamp, true); - $table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'compact', __('Compact mode'), $compact, true); - $table_other->data[$row][1] .= '
'; - - $row++; - - // ---------------------------------------------------------------------- - // CUSTOM VALUES POST PROCESS - // ---------------------------------------------------------------------- - $table_other->data[$row][0] = __('Custom values post process'); - $table_other->data[$row][1] = __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true); - $table_other->data[$row][2] = __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true); - $table_other->data[$row][2] .= ' '; - $table_other->data[$row][2] .= html_print_input_hidden( - 'custom_value_add', + $table_other->data[$row][1] .= ''.html_print_image( + 'images/list.png', + true, + [ + 'id' => 'select', + 'class' => 'invert_filter', + ] + ).''; +} else { + $table_other->data[$row][1] = html_print_select( + $common_dividers, + 'csv_divider', + $config['csv_divider'], '', - true - ); - $table_other->data[$row][3] = html_print_button( - __('Add'), - 'custom_value_add_btn', + '', + '', + true, false, - '', - 'class="sub next"', - true + false ); + $table_other->data[$row][1] .= ''.html_print_image( + 'images/pencil.png', + true, + [ + 'id' => 'pencil', + 'class' => 'invert_filter', + ] + ).''; +} - $row++; +$row++; - $table_other->data[$row][0] = ''; - $table_other->data[$row][1] = __('Delete custom values').': '; - $table_other->data[$row][2] = html_print_select( - post_process_get_custom_values(), - 'custom_values', - '', - '', - '', - '', - true - ); - $count_custom_postprocess = post_process_get_custom_values(); - $table_other->data[$row][3] = html_print_button( - __('Delete'), - 'custom_values_del_btn', - empty($count_custom_postprocess), - '', - 'class="sub cancel"', - true - ); - // This hidden field will be filled from jQuery before submit - $table_other->data[$row][1] .= html_print_input_hidden( - 'custom_value_to_delete', - '', - true - ); - $table_other->data[$row][3] .= '

'; +$decimal_separator = [ + '.' => '.', + ',' => ',', +]; +$table_other->data[$row][0] = __('CSV decimal separator'); +$table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false); - // ---------------------------------------------------------------------- - // ---------------------------------------------------------------------- - // CUSTOM INTERVAL VALUES - // ---------------------------------------------------------------------- - $row++; - $table_other->data[$row][0] = __('Interval values'); - $units = [ - 1 => __('seconds'), - SECONDS_1MINUTE => __('minutes'), - SECONDS_1HOUR => __('hours'), - SECONDS_1DAY => __('days'), - SECONDS_1MONTH => __('months'), - SECONDS_1YEAR => __('years'), - ]; - $table_other->data[$row][1] = __('Value').': '; - $table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true); - $table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false); - $table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true); +$row++; - $row++; - - $table_other->data[$row][0] = ''; - $table_other->data[$row][1] = __('Delete interval').': '; - $table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true); - $table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true); - - $table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true); - // This hidden field will be filled from jQuery before submit - $table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true); - $table_other->data[$row][3] .= '

'; - // ---------------------------------------------------------------------- - $row++; - - $table_other->data[$row][0] = __('Module units'); - $table_other->data[$row][1] = __('Value').': '; - $table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true); - $table_other->data[$row][2] = ''; - $table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true); - - $row++; - $table_other->data[$row][0] = ''; - $table_other->data[$row][1] = __('Delete custom values').': '; - $table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p'); - $table_other->data[$row][3] = html_print_button( - __('Delete'), - 'custom_module_unit_del_btn', - empty($count_custom_postprocess), - '', - 'class="sub cancel"', - true - ); - - $table_other->data[$row][3] .= html_print_input_hidden( - 'custom_module_unit_to_delete', - '', - true - ); - - $row++; - - $common_dividers = [ - ';' => ';', - ',' => ',', - '|' => '|', - ]; - $table_other->data[$row][0] = __('CSV divider'); - if ($config['csv_divider'] != ';' && $config['csv_divider'] != ',' && $config['csv_divider'] != '|') { - $table_other->data[$row][1] = html_print_input_text( - 'csv_divider', - $config['csv_divider'], - '', - 20, - 255, - true - ); - $table_other->data[$row][1] .= ''.html_print_image( - 'images/list.png', - true, - [ - 'id' => 'select', - 'class' => 'invert_filter', - ] - ).''; - } else { - $table_other->data[$row][1] = html_print_select( - $common_dividers, - 'csv_divider', - $config['csv_divider'], - '', - '', - '', - true, - false, - false - ); - $table_other->data[$row][1] .= ''.html_print_image( - 'images/pencil.png', - true, - [ - 'id' => 'pencil', - 'class' => 'invert_filter', - ] - ).''; - } - - $row++; - - $decimal_separator = [ - '.' => '.', - ',' => ',', - ]; - $table_other->data[$row][0] = __('CSV decimal separator'); - $table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false); - - $row++; - - $table_other->data[$row][0] = __('Data multiplier to use in graphs/data'); - $options_data_multiplier = []; - $options_data_multiplier[0] = __('Use 1024 when module unit are bytes'); - $options_data_multiplier[1] = __('Use always 1000'); - $options_data_multiplier[2] = __('Use always 1024'); - - $table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false); +$table_other->data[$row][0] = __('Data multiplier to use in graphs/data'); +$options_data_multiplier = []; +$options_data_multiplier[0] = __('Use 1024 when module unit are bytes'); +$options_data_multiplier[1] = __('Use always 1000'); +$options_data_multiplier[2] = __('Use always 1024'); - echo '
'; - echo ''.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).''; - html_print_table($table_other); - echo '
'; +$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false);function load_fonts() +{ + global $config; + $home = str_replace('\\', '/', $config['homedir']); + $dir = scandir($home.'/include/fonts/'); - echo '
'; - html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); - echo '
'; - echo ''; + $fonts = []; - ui_require_css_file('color-picker', 'include/styles/js/'); - ui_require_jquery_file('colorpicker'); - - - function load_fonts() - { - global $config; - - $home = str_replace('\\', '/', $config['homedir']); - $dir = scandir($home.'/include/fonts/'); - - $fonts = []; - - foreach ($dir as $file) { - if (strstr($file, '.ttf') !== false) { - $fonts[$home.'/include/fonts/'.$file] = $file; - } + foreach ($dir as $file) { + if (strstr($file, '.ttf') !== false) { + $fonts[$home.'/include/fonts/'.$file] = $file; } - - return $fonts; } + return $fonts; +} - ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); - ui_require_javascript_file('pandora'); - ?> +/* + * + * PAINT HTML. + * + */ + +echo '
'; +echo ''.__('Behaviour configuration').' '.ui_print_help_icon('behavoir_conf_tab', true).''; +html_print_table($table_behaviour); +echo '
'; + +echo '
'; +echo ''.__('GIS configuration').' '.ui_print_help_icon('gis_conf_tab', true).''; +html_print_table($table_gis); +echo '
'; + +echo '
'; +echo ''.__('Style configuration').' '.ui_print_help_icon('style_conf_tab', true).''; +html_print_table($table_styles); +echo '
'; + +echo '
'; +echo ''.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).''; +html_print_table($table_chars); +echo '
'; + +echo '
'; +echo ''.__('Font and Text configuration').' '.ui_print_help_icon('front_and_text_conf_tab', true).''; +html_print_table($table_font); +echo '
'; + +echo '
'; +echo ''.__('Visual consoles configuration').' '.ui_print_help_icon('visual_consoles_conf_tab', true).''; +html_print_table($table_vc); +echo '
'; + +echo '
'; +echo ''.__('Reports configuration ').ui_print_help_icon('reports_configuration_tab', true).''; +html_print_table($table_report); +echo '
'; + +echo '
'; +echo ''.__('Services configuration').' '.ui_print_help_icon('services_conf_tab', true).''; +html_print_table($table_ser); +echo '
'; + +echo '
'; +echo ''.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).''; +html_print_table($table_other); +echo '
'; + +echo '
'; +html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); +echo '
'; +echo ''; + + +ui_require_css_file('color-picker', 'include/styles/js/'); +ui_require_jquery_file('colorpicker'); + +ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/'); +ui_require_javascript_file('pandora'); + +?> + + 0) { $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); } else { @@ -2328,7 +2331,10 @@ function modules_get_agentmodule_data_for_humans($module) switch ($module['id_tipo_modulo']) { case 15: $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { + if (($value == '.1.3.6.1.2.1.1.3.0' + || $value == '.1.3.6.1.2.1.25.1.1.0') + && modules_get_unit_macro($module['data'], $module['unit']) === true + ) { if ($module['post_process'] > 0) { $salida = human_milliseconds_to_string(($module['datos'] / $module['post_process'])); } else { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index e0700c93e0..5f04c852c9 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -189,6 +189,14 @@ function reporting_make_reporting_data( $metaconsole_on = is_metaconsole(); $index_content = 0; + + usort( + $contents, + function ($a, $b) { + return ($a['order'] <=> $b['order']); + } + ); + foreach ($contents as $content) { $content['name'] = io_safe_input($content['name']); $content['description'] = io_safe_input($content['description']); @@ -1828,9 +1836,8 @@ function reporting_event_report_group( $content['name'] = __('Event Report Group'); } - if ($config['metaconsole']) { + if (is_metaconsole() === true && empty($content['server_name']) === false) { $id_meta = metaconsole_get_id_server($content['server_name']); - $server = metaconsole_get_connection_by_id($id_meta); metaconsole_connect($server); } @@ -1924,7 +1931,7 @@ function reporting_event_report_group( $filter_event_filter_exclude ); - if (empty($data)) { + if (empty($data) === true) { $return['failed'] = __('No events'); } else { $return['data'] = array_reverse($data); @@ -1952,10 +1959,9 @@ function reporting_event_report_group( $return['chart']['by_criticity'] = null; $return['chart']['validated_vs_unvalidated'] = null; $server_name = $content['server_name']; - if (is_metaconsole() && $server_name != '') { + $metaconsole_dbtable = false; + if (is_metaconsole() === true && empty($server_name) === true) { $metaconsole_dbtable = true; - } else { - $metaconsole_dbtable = false; } if ($event_graph_by_agent) { @@ -2065,11 +2071,11 @@ function reporting_event_report_group( ); } - if ($config['metaconsole']) { + if (is_metaconsole() === true) { metaconsole_restore_db(); } - // total_events. + // Total events. if ($return['data'] != '') { $return['total_events'] = count($return['data']); } else { diff --git a/pandora_console/include/functions_tactical.php b/pandora_console/include/functions_tactical.php index 9cc891b1f1..2456f83491 100644 --- a/pandora_console/include/functions_tactical.php +++ b/pandora_console/include/functions_tactical.php @@ -458,7 +458,7 @@ function tactical_monitor_alerts($group_array, $strict_user=false, $id_group_str $sql = "SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente - AND tagente.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0 AND talert_template_modules.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo"; @@ -470,7 +470,7 @@ function tactical_monitor_alerts($group_array, $strict_user=false, $id_group_str "SELECT COUNT(talert_template_modules.id) FROM talert_template_modules, tagente_modulo, tagente_estado, tagente WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente - AND tagente.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0 AND talert_template_modules.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo" @@ -499,7 +499,8 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo - AND times_fired > 0 AND talert_template_modules.disabled = 0"; + AND times_fired > 0 AND talert_template_modules.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0"; $count = db_get_sql($sql); return $count; @@ -511,7 +512,8 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo - AND times_fired > 0 AND talert_template_modules.disabled = 0" + AND times_fired > 0 AND talert_template_modules.disabled = 0 + AND tagente.disabled = 0 AND tagente_modulo.disabled = 0" ); } diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index b641448af5..0b7b9d1235 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -763,7 +763,7 @@ function newsletter_wiz_modal( $output .= __('Do you want to be up to date?'); $output .= '" class="invisible">'; $output .= '
'; - $output .= html_print_image('image/pandora_big_circle.png', true); + $output .= html_print_image('images/pandora_circle_big.png', true); $output .= '
'; $output .= '
'.__('Search').' '; - $form .= html_print_input_text('search', $search, '', 100, 100, true); + $form .= html_print_input_text( + 'search', + $search, + '', + 100, + 100, + true + ); $form .= ''; $form .= ""; $form .= '