Merge remote-tracking branch 'origin/develop' into fix/uno

This commit is contained in:
fbsanchez 2019-05-23 18:46:56 +02:00
commit f46fdea220
148 changed files with 3731 additions and 778 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, AIX version # Version 7.0NG.735, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, FreeBSD Version # Version 7.0NG.735, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, HP-UX Version # Version 7.0NG.735, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, GNU/Linux # Version 7.0NG.735, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, GNU/Linux # Version 7.0NG.735, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, Solaris Version # Version 7.0NG.735, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.734 # Version 7.0NG.735
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.734, AIX version # Version 7.0NG.735, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.734 # Version 7.0NG.735
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.734, HPUX Version # Version 7.0NG.735, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734 # Version 7.0NG.735
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734 # Version 7.0NG.735
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734 # Version 7.0NG.735
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.734, Solaris version # Version 7.0NG.735, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, AIX version # Version 7.0NG.735, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.734-190520 Version: 7.0NG.735-190523
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.734-190520" pandora_version="7.0NG.735-190523"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, GNU/Linux # Version 7.0NG.735, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, FreeBSD Version # Version 7.0NG.735, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, HP-UX Version # Version 7.0NG.735, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, GNU/Linux # Version 7.0NG.735, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, GNU/Linux # Version 7.0NG.735, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, NetBSD Version # Version 7.0NG.735, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.734, Solaris Version # Version 7.0NG.735, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.734'; use constant AGENT_VERSION => '7.0NG.735';
use constant AGENT_BUILD => '190520'; use constant AGENT_BUILD => '190523';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.735
%define release 190520 %define release 190523
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.735
%define release 190520 %define release 190523
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.734" PI_VERSION="7.0NG.735"
PI_BUILD="190520" PI_BUILD="190523"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.734 # Version 7.0NG.735
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.734} {Pandora FMS Windows Agent v7.0NG.735}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190520} {190523}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.734(Build 190520)") #define PANDORA_VERSION ("7.0NG.735(Build 190523)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.734(Build 190520))" VALUE "ProductVersion", "(7.0NG.735(Build 190523))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.734-190520 Version: 7.0NG.735-190523
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.734-190520" pandora_version="7.0NG.735-190523"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -138,8 +138,15 @@ function mainAgentsAlerts()
$onheader['combo_refr'] = $comborefr; $onheader['combo_refr'] = $comborefr;
} }
// Header // Header.
ui_print_page_header(__('Agents/Alerts'), 'images/op_alerts.png', false, '', false, $updated_time); ui_print_page_header(
__('Agents/Alerts'),
'images/op_alerts.png',
false,
'agents_alerts_view',
false,
$updated_time
);
// Old style table, we need a lot of special formatting,don't use table function // Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table // Prepare old-style table

View File

@ -181,8 +181,15 @@ function mainAgentsModules()
// Old style table, we need a lot of special formatting,don't use table function // Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table // Prepare old-style table
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
// Header // Header.
ui_print_page_header(__('Agents/Modules'), 'images/module_mc.png', false, '', false, $updated_time); ui_print_page_header(
__('Agents/Modules'),
'images/module_mc.png',
false,
'agents_module_view',
false,
$updated_time
);
echo '<table style="width:100%;">'; echo '<table style="width:100%;">';
echo '<tr>'; echo '<tr>';
echo "<td> <span style='float: right;'>".$fullscreen['text'].'</span> </td>'; echo "<td> <span style='float: right;'>".$fullscreen['text'].'</span> </td>';
@ -826,4 +833,4 @@ $ignored_params['refresh'] = '';
} }
} }
</script> </script>

View File

@ -25,7 +25,7 @@ function extension_db_status()
__('DB Schema check'), __('DB Schema check'),
'images/extensions.png', 'images/extensions.png',
false, false,
'', 'db_status_tab',
true, true,
'' ''
); );

View File

@ -192,7 +192,14 @@ function mainModuleGroups()
$array_data[$value['id_grupo']][$value['id_mg']] = $value; $array_data[$value['id_grupo']][$value['id_mg']] = $value;
} }
ui_print_page_header(__('Combined table of agent group and module group'), 'images/module_group.png', false, '', false, ''); ui_print_page_header(
__('Combined table of agent group and module group'),
'images/module_group.png',
false,
'module_groups_view',
false,
''
);
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'> echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
<tr>"; <tr>";

View File

@ -29,7 +29,14 @@ function pandora_realtime_graphs()
$hide_header = get_parameter('hide_header', 0); $hide_header = get_parameter('hide_header', 0);
if (!$hide_header) { if (!$hide_header) {
ui_print_page_header(__('Realtime graphs'), 'images/extensions.png', false, '', false, $onheader); ui_print_page_header(
__('Realtime graphs'),
'images/extensions.png',
false,
'real_time_view',
false,
$onheader
);
} }
$chart[time()]['graph'] = '0'; $chart[time()]['graph'] = '0';

View File

@ -295,7 +295,7 @@ $key_buffer_size_min_rec_value = 256;
$read_buffer_size_min_rec_value = 32; $read_buffer_size_min_rec_value = 32;
$read_rnd_buffer_size_min_rec_value = 32; $read_rnd_buffer_size_min_rec_value = 32;
$query_cache_min_res_unit_min_rec_value = 2; $query_cache_min_res_unit_min_rec_value = 2;
$innodb_file_per_table_min_rec_value = 0; $innodb_file_per_table_min_rec_value = 1;
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation) function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation)
@ -345,15 +345,21 @@ if ($console_mode == 1) {
include '../include/config.php'; include '../include/config.php';
} }
// Not from console, this is a web session // Not from console, this is a web session.
if ((!isset($config['id_user'])) or (!check_acl($config['id_user'], 0, 'PM'))) { if ((!isset($config['id_user'])) || (!check_acl($config['id_user'], 0, 'PM'))) {
echo "<h2>You don't have privileges to use diagnostic tool</h2>"; echo "<h2>You don't have privileges to use diagnostic tool</h2>";
echo '<p>Please login with an administrator account before try to use this tool</p>'; echo '<p>Please login with an administrator account before try to use this tool</p>';
exit; exit;
} }
// Header // Header.
ui_print_page_header(__('Pandora FMS Diagnostic tool'), '', false, '', true); ui_print_page_header(
__('Pandora FMS Diagnostic tool'),
'',
false,
'diagnostic_tool_tab',
true
);
echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>"; echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>'; echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
@ -678,7 +684,7 @@ render_info_data(
$read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024); $read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024);
$query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024); $query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024);
$innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table'); $innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table');
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('MySQL Performance metrics').'</th></tr>'; echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).'</th></tr>';
render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size '); render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size ');
render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size '); render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size ');

View File

@ -143,6 +143,57 @@ if ($config['menu_type'] == 'classic') {
$_GET['sec2'] = ''; $_GET['sec2'] = '';
} }
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
// home screen chosen by the user
$home_page = '';
if (isset($config['id_user'])) {
$user_info = users_get_user_by_id($config['id_user']);
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
}
if ($home_page != '') {
switch ($home_page) {
case 'Event list':
$_GET['sec2'] = 'operation/events/events';
break;
case 'Group view':
$_GET['sec2'] = 'operation/agentes/group_view';
break;
case 'Alert detail':
$_GET['sec2'] = 'operation/agentes/alerts_status';
break;
case 'Tactical view':
$_GET['sec2'] = 'operation/agentes/tactical';
break;
case 'Default':
$_GET['sec2'] = 'general/logon_ok';
break;
case 'Dashboard':
$_GET['sec2'] = 'enterprise/dashboard/main_dashboard';
break;
case 'Visual console':
$_GET['sec2'] = 'operation/visual_console/render_view';
break;
case 'Other':
$home_url = io_safe_output($home_url);
$url_array = parse_url($home_url);
parse_str($url_array['query'], $res);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
break;
}
}
}
if (!isset($_GET['refr'])) { if (!isset($_GET['refr'])) {
$_GET['refr'] = null; $_GET['refr'] = null;
} }
@ -212,14 +263,21 @@ if ($config['menu_type'] == 'classic') {
); );
$autorefresh_additional .= '</span>'; $autorefresh_additional .= '</span>';
unset($values); unset($values);
if ($home_page != '') {
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">'; $autorefresh_link_open_img = '<a class="white autorefresh" href="index.php?refr=">';
} else {
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
}
if ($_GET['refr'] if ($_GET['refr']
|| ((isset($select[0]['time_autorefresh']) === true) || ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0) && $select[0]['time_autorefresh'] !== 0)
) { ) {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">'; if ($home_page != '') {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="index.php?refr=">';
} else {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
}
} else { } else {
$autorefresh_link_open_txt = '<a>'; $autorefresh_link_open_txt = '<a>';
} }
@ -614,7 +672,7 @@ if ($config['menu_type'] == 'classic') {
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr'] || $do_refresh === true) {
?> ?>
$("#header_autorefresh").css('padding-right', '5px'); $("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>; var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date(); var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({ $("#refrcounter").countdown ({

View File

@ -317,7 +317,6 @@ $table->data[0][0] = '<b>'.__('Target IP').'</b>';
$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true); $table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
$table->data[0][2] = '<b>'.__('Namespace').'</b>'; $table->data[0][2] = '<b>'.__('Namespace').'</b>';
$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[0][3] = html_print_input_text('tcp_send', $tcp_send, '', 15, 60, true);
$table->data[1][0] = '<b>'.__('Username').'</b>'; $table->data[1][0] = '<b>'.__('Username').'</b>';

View File

@ -579,11 +579,11 @@ if ($id_agente) {
switch ($tab) { switch ($tab) {
case 'main': case 'main':
$tab_description = '- '.__('Setup'); $tab_description = '- '.__('Setup');
$help_header = 'main_tab';
break; break;
case 'collection': case 'collection':
$tab_description = '- '.__('Collection'); $tab_description = '- '.__('Collection');
$help_header = 'collection_tab';
break; break;
case 'inventory': case 'inventory':
@ -601,6 +601,8 @@ if ($id_agente) {
$tab_description = '- '.__('Modules'); $tab_description = '- '.__('Modules');
if ($type_module_t == 'webux') { if ($type_module_t == 'webux') {
$help_header = 'wux_console'; $help_header = 'wux_console';
} else {
$help_header = 'local_module_tab';
} }
break; break;
@ -611,7 +613,6 @@ if ($id_agente) {
case 'template': case 'template':
$tab_description = '- '.__('Templates'); $tab_description = '- '.__('Templates');
$help_header = 'template_tab';
break; break;
case 'gis': case 'gis':
@ -631,14 +632,17 @@ if ($id_agente) {
switch (get_parameter('wizard_section')) { switch (get_parameter('wizard_section')) {
case 'snmp_explorer': case 'snmp_explorer':
$tab_description = '- '.__('SNMP Wizard'); $tab_description = '- '.__('SNMP Wizard');
$help_header = 'agent_snmp_explorer_tab';
break; break;
case 'snmp_interfaces_explorer': case 'snmp_interfaces_explorer':
$tab_description = '- '.__('SNMP Interfaces wizard'); $tab_description = '- '.__('SNMP Interfaces wizard');
$help_header = 'agent_snmp_interfaces_explorer_tab';
break; break;
case 'wmi_explorer': case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard'); $tab_description = '- '.__('WMI Wizard');
$help_header = 'agent_snmp_wmi_explorer_tab';
break; break;
default: default:
@ -1216,6 +1220,7 @@ if ($update_module || $create_module) {
// Get macros. // Get macros.
$macros = (string) get_parameter('macros'); $macros = (string) get_parameter('macros');
$macros_names = (array) get_parameter('macro_name', []);
if (!empty($macros)) { if (!empty($macros)) {
$macros = json_decode(base64_decode($macros), true); $macros = json_decode(base64_decode($macros), true);
@ -1226,10 +1231,18 @@ if ($update_module || $create_module) {
$m_hide = $m['hide']; $m_hide = $m['hide'];
} }
if ($m_hide == '1') { if ($update_module) {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], '')); if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
} else { } else {
$macros[$k]['value'] = get_parameter($m['macro'], ''); if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
} }
} }

View File

@ -591,7 +591,7 @@ ui_toggle(
); );
ui_toggle( ui_toggle(
html_print_table($table_macros, true), html_print_table($table_macros, true),
__('Custom macros').ui_print_help_icon('module_macros', true) __('Custom macros')
); );
if ($moduletype != 13) { if ($moduletype != 13) {

View File

@ -159,6 +159,7 @@ if ($disabledBecauseInPolicy) {
} }
$update_module_id = (int) get_parameter_get('update_module'); $update_module_id = (int) get_parameter_get('update_module');
$edit_module = (bool) get_parameter_get('edit_module');
$table_simple = new stdClass(); $table_simple = new stdClass();
$table_simple->id = 'simple'; $table_simple->id = 'simple';
$table_simple->width = '100%'; $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); $table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) { 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); $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) { if ($disabledBecauseInPolicy) {
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true); $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_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
var type_name_selected = type_names[type_selected]; var type_name_selected = type_names[type_selected];
var element = document.getElementById("module_type_help");
var language = "<?php echo $config['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) { if (type_name_selected.match(/_string$/) == null) {
// Numeric types // Numeric types
$('#string_critical').hide(); $('#string_critical').hide();

View File

@ -79,7 +79,7 @@ push_table_simple($data, 'plugin_1');
$data = []; $data = [];
$data[0] = 'macro_desc'; $data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip('macro_help', true); $data[0] .= ui_print_help_tip('macro_help', true);
$data[1] = html_print_input_text('macro_name', 'macro_value', '', 100, 1024, true); $data[1] = html_print_input_text('macro_name[]', 'macro_value', '', 100, 1024, true);
$table_simple->colspan['macro_field'][1] = 3; $table_simple->colspan['macro_field'][1] = 3;
$table_simple->rowstyle['macro_field'] = 'display:none'; $table_simple->rowstyle['macro_field'] = 'display:none';

View File

@ -42,7 +42,7 @@ if (empty($update_module_id)) {
} }
$data = []; $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[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[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
$data[3] = html_print_input_text( $data[3] = html_print_input_text(

View File

@ -1,16 +1,32 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Extension to manage a list of gateways and the node address where they should
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas * point to.
// Please see http://pandorafms.org for full contribution list *
// This program is free software; you can redistribute it and/or * @category Planned Donwtimes
// modify it under the terms of the GNU General Public License * @package Pandora FMS
// as published by the Free Software Foundation for version 2. * @subpackage Community
// This program is distributed in the hope that it will be useful, * @version 1.0.0
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @license See below
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
// GNU General Public License for more details. * ______ ___ _______ _______ ________
// Load global vars * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config; global $config;
check_login(); check_login();
@ -27,82 +43,119 @@ if (!$agent_d && !$agent_w) {
return; return;
} }
// Default // Default.
set_unless_defined($config['past_planned_downtimes'], 1); set_unless_defined($config['past_planned_downtimes'], 1);
require_once 'include/functions_users.php'; require_once 'include/functions_users.php';
// Buttons // Buttons.
$buttons = [ $buttons = [
'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image('images/list.png', true, ['title' => __('List')]).'</a>', 'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image(
'images/list.png',
true,
['title' => __('List')]
).'</a>',
]; ];
// Header // Header.
ui_print_page_header( ui_print_page_header(
__('Planned Downtime'), __('Planned Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
false, false,
'planned_downtime', 'planned_downtime_editor',
true, true,
$buttons $buttons
); );
// recursion group filter // Recursion group filter.
$recursion = get_parameter('recursion', $_POST['recursion']); $recursion = get_parameter('recursion', $_POST['recursion']);
// Initialize data // Initialize data.
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name'); $name = (string) get_parameter('name');
$description = (string) get_parameter('description'); $description = (string) get_parameter('description');
$type_downtime = (string) get_parameter('type_downtime', 'quiet'); $type_downtime = (string) get_parameter('type_downtime', 'quiet');
$type_execution = (string) get_parameter('type_execution', 'once'); $type_execution = (string) get_parameter('type_execution', 'once');
$type_periodicity = (string) get_parameter('type_periodicity', 'weekly'); $type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
$utimestamp = get_system_time(); $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()); $system_time = ($utimestamp - get_fixed_offset());
$once_date_from = (string) get_parameter('once_date_from', date(DATE_FORMAT, $utimestamp)); $once_date_from = (string) get_parameter(
$once_time_from = (string) get_parameter('once_time_from', date(TIME_FORMAT, $utimestamp)); 'once_date_from',
$once_date_to = (string) get_parameter('once_date_to', date(DATE_FORMAT, $utimestamp)); date(DATE_FORMAT, $utimestamp)
$once_time_to = (string) get_parameter('once_time_to', date(TIME_FORMAT, ($utimestamp + SECONDS_1HOUR))); );
$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_from = (int) get_parameter(
$periodically_day_to = (int) get_parameter('periodically_day_to', 31); 'periodically_day_from',
$periodically_time_from = (string) get_parameter('periodically_time_from', date(TIME_FORMAT, $system_time)); 1
$periodically_time_to = (string) get_parameter('periodically_time_to', date(TIME_FORMAT, ($system_time + SECONDS_1HOUR))); );
$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'); $monday = (bool) get_parameter('monday');
$tuesday = (bool) get_parameter('tuesday'); $tuesday = (bool) get_parameter('tuesday');
$wednesday = (bool) get_parameter('wednesday'); $wednesday = (bool) get_parameter('wednesday');
$thursday = (bool) get_parameter('thursday'); $thursday = (bool) get_parameter('thursday');
$friday = (bool) get_parameter('friday'); $friday = (bool) get_parameter('friday');
$saturday = (bool) get_parameter('saturday'); $saturday = (bool) get_parameter('saturday');
$sunday = (bool) get_parameter('sunday'); $sunday = (bool) get_parameter('sunday');
$first_create = (int) get_parameter('first_create'); $first_create = (int) get_parameter('first_create');
$create_downtime = (int) get_parameter('create_downtime'); $create_downtime = (int) get_parameter('create_downtime');
$update_downtime = (int) get_parameter('update_downtime'); $update_downtime = (int) get_parameter('update_downtime');
$edit_downtime = (int) get_parameter('edit_downtime'); $edit_downtime = (int) get_parameter('edit_downtime');
$id_downtime = (int) get_parameter('id_downtime'); $id_downtime = (int) get_parameter('id_downtime');
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$insert_downtime_agent = (int) get_parameter('insert_downtime_agent'); $insert_downtime_agent = (int) get_parameter('insert_downtime_agent');
$delete_downtime_agent = (int) get_parameter('delete_downtime_agent'); $delete_downtime_agent = (int) get_parameter('delete_downtime_agent');
$modules_selection_mode = (string) get_parameter('modules_selection_mode'); $modules_selection_mode = (string) get_parameter('modules_selection_mode');
// User groups with AD or AW permission for ACL checks // User groups with AD or AW permission for ACL checks.
$user_groups_ad = array_keys(users_get_groups($config['id_user'], $access)); $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) { if ($insert_downtime_agent === 1) {
// Check AD permission on downtime // Check AD permission on downtime.
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_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( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access downtime scheduler' 'Trying to access downtime scheduler'
@ -116,17 +169,27 @@ if ($insert_downtime_agent === 1) {
$all_modules = (empty($module_names) || ($module_names[0] === '0')); $all_modules = (empty($module_names) || ($module_names[0] === '0'));
// 'Is running' check // 'Is running' check.
$is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime); $is_running = (bool) db_get_value(
'executed',
'tplanned_downtime',
'id',
$id_downtime
);
if ($is_running) { 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 { } else {
foreach ($agents as $agent_id) { foreach ($agents as $agent_id) {
// check module belongs to the agent // Check module belongs to the agent.
if ($modules_selection_mode == 'all') { if ($modules_selection_mode == 'all') {
$check = false; $check = false;
foreach ($module_names as $module_name) { 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)) { if (!empty($check_module)) {
$check = true; $check = true;
} }
@ -137,10 +200,17 @@ if ($insert_downtime_agent === 1) {
} }
} }
// Check AD permission on agent // Check AD permission on agent.
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id); $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; continue;
} }
@ -149,11 +219,17 @@ if ($insert_downtime_agent === 1) {
'id_agent' => $agent_id, 'id_agent' => $agent_id,
'all_modules' => $all_modules, '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) { if ($result && !$all_modules) {
foreach ($module_names as $module_name) { 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)) { if (empty($module)) {
continue; continue;
@ -164,7 +240,10 @@ if ($insert_downtime_agent === 1) {
'id_agent' => $agent_id, 'id_agent' => $agent_id,
'id_agent_module' => $module['id_agente_modulo'], '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) { if ($result) {
$values = ['id_user' => $config['id_user']]; $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) { if ($delete_downtime_agent === 1) {
$id_da = (int) get_parameter('id_downtime_agent'); $id_da = (int) get_parameter('id_downtime_agent');
// Check AD permission on downtime // Check AD permission on downtime.
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_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( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access downtime scheduler' 'Trying to access downtime scheduler'
@ -196,10 +282,17 @@ if ($delete_downtime_agent === 1) {
return; return;
} }
// Check AD permission on agent // Check AD permission on agent.
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_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( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access downtime scheduler' 'Trying to access downtime scheduler'
@ -208,17 +301,27 @@ if ($delete_downtime_agent === 1) {
return; return;
} }
// 'Is running' check // 'Is running' check.
$is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime); $is_running = (bool) db_get_value(
'executed',
'tplanned_downtime',
'id',
$id_downtime
);
if ($is_running) { 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 { } else {
$row_to_delete = db_get_row('tplanned_downtime_agents', 'id', $id_da); $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) { if ($result) {
// Delete modules in downtime // Delete modules in downtime.
db_process_sql_delete( db_process_sql_delete(
'tplanned_downtime_modules', '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) { if ($create_downtime || $update_downtime) {
$check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $name); $check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $name);
@ -239,22 +342,32 @@ if ($create_downtime || $update_downtime) {
$now = time(); $now = time();
if ($type_execution == 'once' && !$config['past_planned_downtimes'] && $datetime_from < $now) { 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) { } 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']) { } 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' } else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to) && (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $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) { } 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 { } else {
$sql = ''; $sql = '';
if ($create_downtime) { if ($create_downtime) {
// Check AD permission on new downtime // Check AD permission on new downtime.
if (!in_array($id_group, $user_groups_ad)) { if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -295,7 +408,10 @@ if ($create_downtime || $update_downtime) {
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to']; $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 { } else {
ui_print_error_message( ui_print_error_message(
__('Each planned downtime must have a different name') __('Each planned downtime must have a different name')
@ -309,7 +425,7 @@ if ($create_downtime || $update_downtime) {
} else if ($update_downtime) { } else if ($update_downtime) {
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_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)) { if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -319,7 +435,7 @@ if ($create_downtime || $update_downtime) {
return; return;
} }
// Check AD permission on NEW downtime group // Check AD permission on NEW downtime group.
if (!in_array($id_group, $user_groups_ad)) { if (!in_array($id_group, $user_groups_ad)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -329,14 +445,17 @@ if ($create_downtime || $update_downtime) {
return; return;
} }
// 'Is running' check // 'Is running' check.
$is_running = (bool) $old_downtime['executed']; $is_running = (bool) $old_downtime['executed'];
$values = []; $values = [];
if (trim(io_safe_output($name)) == '') { 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') { else if ($is_running && $type_execution == 'once') {
$values = [ $values = [
'description' => $description, 'description' => $description,
@ -344,7 +463,9 @@ if ($create_downtime || $update_downtime) {
'id_user' => $config['id_user'], 'id_user' => $config['id_user'],
]; ];
} else if ($is_running) { } 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 { } else {
$values = [ $values = [
'name' => $name, 'name' => $name,
@ -376,7 +497,11 @@ if ($create_downtime || $update_downtime) {
} }
if (!empty($values)) { 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 ? // Have any data to show ?
if ($id_downtime > 0) { if ($id_downtime > 0) {
// Columns of the table tplanned_downtime // Columns of the table tplanned_downtime.
$columns = [ $columns = [
'id', 'id',
'name', 'name',
@ -436,7 +561,8 @@ if ($id_downtime > 0) {
break; break;
case 'oracle': 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_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"; $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']; $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; $disabled_in_execution = (int) $running;
$table = new StdClass(); $table = new StdClass();
@ -508,11 +635,40 @@ $table->class = 'databox filters';
$table->width = '100%'; $table->width = '100%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $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][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][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( $table->data[3][0] = __('Type').ui_print_help_tip(
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'), __('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('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)); $days = array_combine(range(1, 31), range(1, 31));
$table->data[5][0] = __('Configure the time').'&nbsp;'.ui_print_help_icon('planned_downtime_time', true); $table->data[5][0] = __('Configure the time').'&nbsp;';
; ;
$table->data[5][1] = " $table->data[5][1] = "
<div id='once_time' style='display: none;'> <div id='once_time' style='display: none;'>
@ -678,7 +834,7 @@ if ($id_downtime > 0) {
echo "<tr><td width=75% valign='top'>"; echo "<tr><td width=75% valign='top'>";
} }
// Editor form // Editor form.
html_print_table($table); html_print_table($table);
html_print_input_hidden('id_agent', $id_agent); html_print_input_hidden('id_agent', $id_agent);
@ -686,10 +842,20 @@ echo '<div class="action-buttons" style="width: 100%">';
if ($id_downtime > 0) { if ($id_downtime > 0) {
html_print_input_hidden('update_downtime', 1); html_print_input_hidden('update_downtime', 1);
html_print_input_hidden('id_downtime', $id_downtime); 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 { } else {
html_print_input_hidden('create_downtime', 1); 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 '</div>'; echo '</div>';
@ -700,11 +866,11 @@ if ($id_downtime > 0) {
$filter_group = (int) get_parameter('filter_group', 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); $id_groups_str = implode(',', $user_groups_ad);
if (empty($id_groups_str)) { 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'; $id_groups_str = '-1';
} }
@ -752,7 +918,7 @@ if ($id_downtime > 0) {
$agent_ids = extract_column($agents, 'id_agente'); $agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'alias'); $agent_names = extract_column($agents, 'alias');
// item[<id>] = <name>;
$agents = array_combine($agent_ids, $agent_names); $agents = array_combine($agent_ids, $agent_names);
if ($agents === false) { if ($agents === false) {
$agents = []; $agents = [];
@ -763,7 +929,6 @@ if ($id_downtime > 0) {
$disabled_add_button = true; $disabled_add_button = true;
} }
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>"; echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;'); html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
@ -803,7 +968,10 @@ if ($id_downtime > 0) {
); );
echo '</div>'; echo '</div>';
echo '<h4>'.__('Available modules:').ui_print_help_tip(__('Only for type Quiet for downtimes.'), true).'</h4>'; echo '<h4>'.__('Available modules:').ui_print_help_tip(
__('Only for type Quiet for downtimes.'),
true
).'</h4>';
if ($type_downtime != 'quiet') { if ($type_downtime != 'quiet') {
echo '<div id="available_modules" style="display: none;">'; echo '<div id="available_modules" style="display: none;">';
@ -811,17 +979,36 @@ if ($id_downtime > 0) {
echo '<div id="available_modules" style="">'; echo '<div id="available_modules" style="">';
} }
echo html_print_select([], 'module[]', '', '', '', 0, false, true, true, '', false, 'width: 180px;'); echo html_print_select(
[],
'module[]',
'',
'',
'',
0,
false,
true,
true,
'',
false,
'width: 180px;'
);
echo '</div>'; echo '</div>';
echo '<br /><br /><br />'; echo '<br /><br /><br />';
html_print_submit_button(__('Add'), 'add_item', $disabled_add_button, 'class="sub next"', false); html_print_submit_button(
__('Add'),
'add_item',
$disabled_add_button,
'class="sub next"',
false
);
echo '</form>'; echo '</form>';
echo '</table>'; echo '</table>';
// Start Overview of existing planned downtime // Start Overview of existing planned downtime.
echo '<h4>'.__('Agents planned for this downtime').':</h4>'; echo '<h4>'.__('Agents planned for this downtime').':</h4>';
// User the $id_groups_str built before // User the $id_groups_str built before.
$sql = sprintf( $sql = sprintf(
'SELECT ta.nombre, tpda.id, 'SELECT ta.nombre, tpda.id,
ta.id_os, ta.id_agente, ta.id_grupo, ta.id_os, ta.id_agente, ta.id_grupo,
@ -860,13 +1047,18 @@ if ($id_downtime > 0) {
foreach ($downtimes_agents as $downtime_agent) { foreach ($downtimes_agents as $downtime_agent) {
$data = []; $data = [];
$alias = db_get_value('alias', 'tagente', 'id_agente', $downtime_agent['id_agente']); $alias = db_get_value(
'alias',
'tagente',
'id_agente',
$downtime_agent['id_agente']
);
$data[0] = $alias; $data[0] = $alias;
$data[1] = db_get_sql( $data[1] = db_get_sql(
'SELECT nombre 'SELECT nombre
FROM tgrupo FROM tgrupo
WHERE id_grupo = '.$downtime_agent['id_grupo'] WHERE id_grupo = '.$downtime_agent['id_grupo']
); );
$data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true);
@ -887,7 +1079,9 @@ if ($id_downtime > 0) {
if (!$running) { if (!$running) {
$data[5] = ''; $data[5] = '';
if ($type_downtime != 'disable_agents_alerts' && $type_downtime != 'disable_agents') { if ($type_downtime != 'disable_agents_alerts'
&& $type_downtime != 'disable_agents'
) {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
} }

View File

@ -50,7 +50,7 @@ if ($migrate_malformed) {
} }
} }
// Header // Header.
ui_print_page_header( ui_print_page_header(
__('Planned Downtime'), __('Planned Downtime'),
'images/gm_monitoring.png', 'images/gm_monitoring.png',
@ -115,7 +115,7 @@ if ($delete_downtime) {
} }
} }
// Filter parameters // Filter parameters.
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$filter_params = []; $filter_params = [];
@ -131,7 +131,7 @@ $module_name = $filter_params['module_name'] = (string) (!empty($module_
$filter_params_str = http_build_query($filter_params); $filter_params_str = http_build_query($filter_params);
// Table filter // Table filter.
$table_form = new StdClass(); $table_form = new StdClass();
$table_form->class = 'databox filters'; $table_form->class = 'databox filters';
$table_form->width = '100%'; $table_form->width = '100%';
@ -143,9 +143,9 @@ $table_form->data = [];
$row = []; $row = [];
// Search text // Search text.
$row[] = __('Search').'&nbsp;'.html_print_input_text('search_text', $search_text, '', 50, 250, true); $row[] = __('Search').'&nbsp;'.html_print_input_text('search_text', $search_text, '', 50, 250, true);
// Dates // Dates.
$date_inputs = __('From').'&nbsp;'.html_print_input_text('date_from', $date_from, '', 10, 10, true); $date_inputs = __('From').'&nbsp;'.html_print_input_text('date_from', $date_from, '', 10, 10, true);
$date_inputs .= '&nbsp;&nbsp;'; $date_inputs .= '&nbsp;&nbsp;';
$date_inputs .= __('To').'&nbsp;'.html_print_input_text('date_to', $date_to, '', 10, 10, true); $date_inputs .= __('To').'&nbsp;'.html_print_input_text('date_to', $date_to, '', 10, 10, true);
@ -155,20 +155,20 @@ $table_form->data[] = $row;
$row = []; $row = [];
// Execution type // Execution type.
$execution_type_fields = [ $execution_type_fields = [
'once' => __('Once'), 'once' => __('Once'),
'periodically' => __('Periodically'), 'periodically' => __('Periodically'),
]; ];
$row[] = __('Execution type').'&nbsp;'.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false); $row[] = __('Execution type').'&nbsp;'.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
// Show past downtimes // Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;'.html_print_checkbox('archived', 1, $show_archived, true); $row[] = __('Show past downtimes').'&nbsp;'.html_print_checkbox('archived', 1, $show_archived, true);
$table_form->data[] = $row; $table_form->data[] = $row;
$row = []; $row = [];
// Agent // Agent.
$params = []; $params = [];
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'agent_name'; $params['input_name'] = 'agent_name';
@ -180,14 +180,14 @@ $params['hidden_input_idagent_value'] = $agent_id;
$agent_input = __('Agent').'&nbsp;'.ui_print_agent_autocomplete_input($params); $agent_input = __('Agent').'&nbsp;'.ui_print_agent_autocomplete_input($params);
$row[] = $agent_input; $row[] = $agent_input;
// Module // Module.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true); $row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true); $row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
$table_form->data[] = $row; $table_form->data[] = $row;
// End of table filter // End of table filter.
// Useful to know if the user has done a form filtering // Useful to know if the user has done a form filtering.
$filter_performed = false; $filter_performed = false;
$groups = users_get_groups(false, $access); $groups = users_get_groups(false, $access);
@ -197,7 +197,7 @@ if (!empty($groups)) {
$groups_string = implode(',', array_keys($groups)); $groups_string = implode(',', array_keys($groups));
$where_values .= " AND id_group IN ($groups_string)"; $where_values .= " AND id_group IN ($groups_string)";
// WARNING: add $filter_performed = true; to any future filter // WARNING: add $filter_performed = true; to any future filter.
if (!empty($search_text)) { if (!empty($search_text)) {
$filter_performed = true; $filter_performed = true;
@ -272,7 +272,7 @@ if (!empty($groups)) {
AND tpda.all_modules = 1))"; AND tpda.all_modules = 1))";
} }
// Columns of the table tplanned_downtime // Columns of the table tplanned_downtime.
$columns = [ $columns = [
'id', 'id',
'name', 'name',
@ -353,23 +353,23 @@ if (!empty($groups)) {
$downtimes = []; $downtimes = [];
} }
// No downtimes cause the user has not anyone // No downtimes cause the user has not anyone.
if (!$downtimes && !$filter_performed) { if (!$downtimes && !$filter_performed) {
include_once $config['homedir'].'/general/firts_task/planned_downtime.php'; include_once $config['homedir'].'/general/firts_task/planned_downtime.php';
} }
// No downtimes cause the user performed a search // No downtimes cause the user performed a search.
else if (!$downtimes) { else if (!$downtimes) {
// Filter form // Filter form.
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>"; echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
html_print_table($table_form); html_print_table($table_form);
echo '</form>'; echo '</form>';
// Info message // Info message.
echo '<div class="nf">'.__('No planned downtime').'</div>'; echo '<div class="nf">'.__('No planned downtime').'</div>';
echo '<div class="action-buttons" style="width: 100%">'; echo '<div class="action-buttons" style="width: 100%">';
// Create button // Create button.
if ($write_permisson) { if ($write_permisson) {
echo '&nbsp;'; echo '&nbsp;';
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">'; echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
@ -379,7 +379,7 @@ else if (!$downtimes) {
echo '</div>'; echo '</div>';
} }
// Has downtimes // Has downtimes.
else { else {
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>"; echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
html_print_table($table_form); html_print_table($table_form);
@ -387,11 +387,11 @@ else {
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
// User groups with AR, AD or AW permission // User groups with AR, AD or AW permission.
$groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = users_get_groups($config['id_user'], $access);
$groupsAD = array_keys($groupsAD); $groupsAD = array_keys($groupsAD);
// View available downtimes present in database (if any of them) // View available downtimes present in database (if any of them).
$table = new StdClass(); $table = new StdClass();
$table->class = 'info_table'; $table->class = 'info_table';
$table->width = '100%'; $table->width = '100%';
@ -475,7 +475,7 @@ else {
); );
} }
// If user have writting permissions // If user have writting permissions.
if (in_array($downtime['id_group'], $groupsAD)) { if (in_array($downtime['id_group'], $groupsAD)) {
// Stop button // Stop button
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) { if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
@ -484,16 +484,16 @@ else {
$data['stop'] = ''; $data['stop'] = '';
} }
// Edit & delete buttons // Edit & delete buttons.
if ($downtime['executed'] == 0) { if ($downtime['executed'] == 0) {
// Edit // Edit.
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>'; $data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete // Delete.
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]); $data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') { } else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
// Edit // Edit.
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>'; $data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete // Delete.
$data['delete'] = __('N/A'); $data['delete'] = __('N/A');
} else { } else {
$data['edit'] = ''; $data['edit'] = '';
@ -521,7 +521,7 @@ else {
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
// CSV export button // CSV export button.
echo '<div style="display: inline;">'; echo '<div style="display: inline;">';
html_print_button( html_print_button(
__('Export to CSV'), __('Export to CSV'),
@ -532,7 +532,7 @@ else {
); );
echo '</div>'; echo '</div>';
// Create button // Create button.
if ($write_permisson) { if ($write_permisson) {
echo '&nbsp;'; echo '&nbsp;';
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">'; echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';

View File

@ -62,7 +62,7 @@ if ((!$copy_action) && (!$delete_action)) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true); ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_action', true);
} }
} }

View File

@ -270,7 +270,13 @@ if ($update_command) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert commands'), 'images/gm_alerts.png', false, 'alerts_config', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert commands'),
'images/gm_alerts.png',
false,
'alerts_command_tab',
true
);
} }
if ($create_command) { if ($create_command) {

View File

@ -124,11 +124,7 @@ $table->data[1][1] .= __('Number of alerts match from').' ';
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true); $table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table->data[1][1] .= ' '.__('to').' '; $table->data[1][1] .= ' '.__('to').' ';
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true); $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= ui_print_help_icon(
'alert-matches',
true,
ui_get_full_url(false, false, false, false)
);
$table->data[1][1] .= '</span>'; $table->data[1][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) { if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">'; $table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
@ -172,8 +168,7 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$table->data[3][0] = __('Threshold'); $table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); $table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
$table->data[3][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true); $table->data[3][1] .= ' '.__('seconds');
if (!isset($step)) { if (!isset($step)) {
echo '<form class="add_alert_form" method="post">'; echo '<form class="add_alert_form" method="post">';

View File

@ -700,20 +700,41 @@ foreach ($simple_alerts as $alert) {
$data[2] .= '</tr>'; $data[2] .= '</tr>';
$data[2] .= '<tr class="datos">'; $data[2] .= '<tr class="datos">';
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">'; $data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Number of alerts match from').'&nbsp;'.ui_print_help_icon('alert-matches', true, ui_get_full_url(false, false, false, false)); $data[2] .= __('Number of alerts match from');
$data[2] .= '</td>'; $data[2] .= '</td>';
$data[2] .= '<td class="datos">'; $data[2] .= '<td class="datos">';
$data[2] .= html_print_input_text('fires_min', 0, '', 4, 10, true); $data[2] .= html_print_input_text(
'fires_min',
0,
'',
4,
10,
true
);
$data[2] .= ' '.__('to').' '; $data[2] .= ' '.__('to').' ';
$data[2] .= html_print_input_text('fires_max', 0, '', 4, 10, true); $data[2] .= html_print_input_text(
'fires_max',
0,
'',
4,
10,
true
);
$data[2] .= '</td>'; $data[2] .= '</td>';
$data[2] .= '</tr>'; $data[2] .= '</tr>';
$data[2] .= '<tr class="datos2">'; $data[2] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Threshold').'&nbsp;'.ui_print_help_icon('action_threshold', true, ui_get_full_url(false, false, false, false)); $data[2] .= __('Threshold');
$data[2] .= '</td>'; $data[2] .= '</td>';
$data[2] .= '<td class="datos2">'; $data[2] .= '<td class="datos2">';
$data[2] .= html_print_input_text('module_action_threshold', '', '', 4, 10, true); $data[2] .= html_print_input_text(
'module_action_threshold',
'',
'',
4,
10,
true
);
$data[2] .= '</td>'; $data[2] .= '</td>';
$data[2] .= '</tr>'; $data[2] .= '</tr>';
$data[2] .= '</table>'; $data[2] .= '</table>';

View File

@ -41,7 +41,13 @@ if (is_ajax()) {
} }
// Header // Header
ui_print_page_header(__('Alerts').' &raquo; '.__('Special days list'), 'images/gm_alerts.png', false, 'alert_special_days', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Special days list'),
'images/gm_alerts.png',
false,
'alert_special_days',
true
);
$update_special_day = (bool) get_parameter('update_special_day'); $update_special_day = (bool) get_parameter('update_special_day');
$create_special_day = (bool) get_parameter('create_special_day'); $create_special_day = (bool) get_parameter('create_special_day');

View File

@ -132,7 +132,13 @@ if (!$delete_template) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
// ~ ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true); // ~ ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert templates'), 'images/gm_alerts.png', false, '', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert templates'),
'images/gm_alerts.png',
false,
'alert_templates_tab',
true
);
} }
} }
@ -201,7 +207,13 @@ if ($delete_template) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert templates'), 'images/gm_alerts.png', false, 'alerts_config', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert templates'),
'images/gm_alerts.png',
false,
'alerts_config',
true
);
} }
} else { } else {
db_pandora_audit( db_pandora_audit(
@ -216,7 +228,13 @@ if ($delete_template) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert templates'), 'images/gm_alerts.png', false, 'alerts_config', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert templates'),
'images/gm_alerts.png',
false,
'alerts_config',
true
);
} }
} }

View File

@ -184,7 +184,6 @@ $table->colspan[2][1] = 2;
$table->data[3][0] = __('Threshold'); $table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true); $table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true);
$table->data[3][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true);
$table->colspan[3][1] = 2; $table->colspan[3][1] = 2;
$table->data[4][0] = ''; $table->data[4][0] = '';

View File

@ -43,7 +43,7 @@ if (defined('METACONSOLE')) {
__('Alerts').' &raquo; '.__('Configure alert command'), __('Alerts').' &raquo; '.__('Configure alert command'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'alerts_config', 'alerts_config_command_tab',
true true
); );
} }
@ -174,7 +174,6 @@ $table->data['name'][2] = html_print_input_text('name', $name, '', 35, 255, true
$table->colspan['command'][1] = 3; $table->colspan['command'][1] = 3;
$table->data['command'][0] = __('Command'); $table->data['command'][0] = __('Command');
$table->data['command'][0] .= ui_print_help_icon('alert_macros', true);
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true); $table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true);
$table->colspan['group'][1] = 3; $table->colspan['group'][1] = 3;
@ -199,11 +198,6 @@ $table->data['description'][1] = html_print_textarea('description', 10, 30, $des
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i); $table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
// Only show help on first row.
if ($i == 1) {
$table->data['field'.$i][0] .= ui_print_help_icon('alert_fields_description', true);
}
if (!empty($fields_descriptions)) { if (!empty($fields_descriptions)) {
$field_description = $fields_descriptions[($i - 1)]; $field_description = $fields_descriptions[($i - 1)];
} else { } else {
@ -214,11 +208,6 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i); $table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
// Only show help on first row.
if ($i == 1) {
$table->data['field'.$i][2] .= ui_print_help_icon('alert_fields_values', true);
}
if (!empty($fields_values)) { if (!empty($fields_values)) {
$field_values = $fields_values[($i - 1)]; $field_values = $fields_values[($i - 1)];
} else { } else {

View File

@ -56,14 +56,20 @@ if ($a_template !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
// ~ ui_print_page_header (__('Alerts') . $step = (int) get_parameter('step', 1);
// ~ ' &raquo; ' . __('Configure alert template'), "", if ($step == 1) {
// ~ false, "alerts_config", true); $help_header = 'configure_alert_template_step_1';
} else if ($step == 2) {
$help_header = 'configure_alert_template_step_2';
} else if ($step == 3) {
$help_header = 'configure_alert_template_step_3';
}
ui_print_page_header( ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts').' &raquo; '.__('Configure alert template'),
'', '',
false, false,
'', $help_header,
true true
); );
} }
@ -83,7 +89,13 @@ if ($a_template !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Configure alert template'), 'images/gm_alerts.png', false, 'conf_alert_template', true); ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'),
'images/gm_alerts.png',
false,
'conf_alert_template',
true
);
} }
} else { } else {
db_pandora_audit( db_pandora_audit(
@ -101,7 +113,22 @@ if ($a_template !== false) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Configure alert template'), 'images/gm_alerts.png', false, 'conf_alert_template', true); $step = (int) get_parameter('step', 1);
if ($step == 1) {
$help_header = 'configure_alert_template_step_1';
} else if ($step == 2) {
$help_header = 'configure_alert_template_step_2';
} else if ($step == 3) {
$help_header = 'configure_alert_template_step_3';
}
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'),
'images/gm_alerts.png',
false,
$help_header,
true
);
} }
} }

View File

@ -124,7 +124,7 @@ $data[3] .= '<span class="size">'.html_print_input_text('modal_height', $event_r
$table->data[2] = $data; $table->data[2] = $data;
$data = []; $data = [];
$data[0] = __('Parameters').ui_print_help_icon('response_parameters', true); $data[0] = __('Parameters');
$data[1] = html_print_input_text( $data[1] = html_print_input_text(
'params', 'params',
$event_response['params'], $event_response['params'],

View File

@ -77,6 +77,7 @@ switch ($section) {
case 'responses': case 'responses':
$buttons['responses']['active'] = true; $buttons['responses']['active'] = true;
$subpage = ' - '.__('Responses'); $subpage = ' - '.__('Responses');
$help_header = 'events_responses_tab';
break; break;
case 'view': case 'view':
@ -90,7 +91,14 @@ switch ($section) {
} }
if (! defined('METACONSOLE')) { if (! defined('METACONSOLE')) {
ui_print_page_header(__('Manage events').$subpage, 'images/gm_events.png', false, '', true, $buttons); ui_print_page_header(
__('Manage events').$subpage,
'images/gm_events.png',
false,
$help_header,
true,
$buttons
);
} else { } else {
ui_meta_print_header(__('Manage events').$subpage, '', $buttons); ui_meta_print_header(__('Manage events').$subpage, '', $buttons);
} }

View File

@ -277,7 +277,7 @@ ui_print_page_header(
__('GIS Maps builder'), __('GIS Maps builder'),
'images/gm_gis.png', 'images/gm_gis.png',
false, false,
'configure_gis_map', 'configure_gis_map_edit',
true, true,
$buttons $buttons
); );

View File

@ -87,7 +87,14 @@ if (defined('METACONSOLE')) {
$title_in_header = __('Create group'); $title_in_header = __('Create group');
} }
ui_print_page_header($title_in_header, 'images/group.png', false, '', true, ''); ui_print_page_header(
$title_in_header,
'images/group.png',
false,
'create_group_tab',
true,
''
);
$sec = 'gagente'; $sec = 'gagente';
} }
@ -175,11 +182,11 @@ if ($config['enterprise_installed']) {
} }
$table->data[$i][0] = __('Alerts'); $table->data[$i][0] = __('Alerts');
$table->data[$i][1] = html_print_checkbox('alerts_enabled', 1, ! $alerts_disabled, true); $table->data[$i][1] = html_print_checkbox_switch('alerts_enabled', 1, ! $alerts_disabled, true);
$i++; $i++;
$table->data[$i][0] = __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true); $table->data[$i][0] = __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true);
$table->data[$i][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon('propagate_acl', true); $table->data[$i][1] = html_print_checkbox_switch('propagate', 1, $propagate, true);
$i++; $i++;
$table->data[$i][0] = __('Custom ID'); $table->data[$i][0] = __('Custom ID');

View File

@ -275,7 +275,7 @@ if (defined('METACONSOLE')) {
__('Groups defined in %s', get_product_name()), __('Groups defined in %s', get_product_name()),
'images/group.png', 'images/group.png',
false, false,
'', 'group_list_tab',
true, true,
$buttons $buttons
); );

View File

@ -489,7 +489,7 @@ $params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= '<b>'.__('Cascade protection').'</b>&nbsp;'.ui_print_help_icon('cascade_protection', true).html_print_select( $table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
[ [
1 => __('Yes'), 1 => __('Yes'),
0 => __('No'), 0 => __('No'),
@ -587,7 +587,7 @@ $table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true); $table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
// Learn mode / Normal mode // Learn mode / Normal mode
$table->data[1][0] = __('Module definition').ui_print_help_icon('module_definition', true); $table->data[1][0] = __('Module definition');
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'style="margin-right: 40px;"', true); $table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'style="margin-right: 40px;"', true); $table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'style="margin-right: 40px;"', true); $table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'style="margin-right: 40px;"', true);

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Load global vars // Load global vars.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AW')) { if (! check_acl($config['id_user'], 0, 'AW')) {
@ -72,6 +72,7 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
$options_policies = []; $options_policies = [];
$policies_options = enterprise_hook('massive_policies_options'); $policies_options = enterprise_hook('massive_policies_options');
$policies_options = array_unique($policies_options);
if ($policies_options != ENTERPRISE_NOT_HOOK) { if ($policies_options != ENTERPRISE_NOT_HOOK) {
$options_policies = array_merge($options_policies, $policies_options); $options_policies = array_merge($options_policies, $policies_options);
@ -118,10 +119,12 @@ switch ($tab) {
case 'massive_agents': case 'massive_agents':
$options = $options_agents; $options = $options_agents;
$help_header = 'massive_agents_tab';
break; break;
case 'massive_modules': case 'massive_modules':
$options = $options_modules; $options = $options_modules;
$help_header = 'massive_modules_tab';
break; break;
case 'massive_users': case 'massive_users':
@ -130,6 +133,7 @@ switch ($tab) {
case 'massive_policies': case 'massive_policies':
$options = $options_policies; $options = $options_policies;
$help_header = 'massive_policies_tab';
break; break;
case 'massive_snmp': case 'massive_snmp':
@ -143,9 +147,13 @@ switch ($tab) {
case 'massive_plugins': case 'massive_plugins':
$options = $options_plugins; $options = $options_plugins;
break; break;
default:
// Default.
break;
} }
// Set the default option of the category // Set the default option of the category.
if ($option == '') { if ($option == '') {
$option = array_shift(array_keys($options)); $option = array_shift(array_keys($options));
} }
@ -235,16 +243,16 @@ ui_print_page_header(
__('Bulk operations').' &raquo; '.$options[$option], __('Bulk operations').' &raquo; '.$options[$option],
'images/gm_massive_operations.png', 'images/gm_massive_operations.png',
false, false,
'', $help_header,
true, true,
$onheader, $onheader,
true, true,
'massivemodal' 'massivemodal'
); );
// Checks if the PHP configuration is correctly // Checks if the PHP configuration is correctly.
if ((get_cfg_var('max_execution_time') != 0) if ((get_cfg_var('max_execution_time') != 0)
or (get_cfg_var('max_input_time') != -1) || (get_cfg_var('max_input_time') != -1)
) { ) {
echo '<div id="notify_conf" class="notify">'; echo '<div id="notify_conf" class="notify">';
echo __('In order to perform massive operations, PHP needs a correct configuration in timeout parameters. Please, open your PHP configuration file (php.ini) for example: <i>sudo vi /etc/php5/apache2/php.ini;</i><br> And set your timeout parameters to a correct value: <br><i> max_execution_time = 0</i> and <i>max_input_time = -1</i>'); echo __('In order to perform massive operations, PHP needs a correct configuration in timeout parameters. Please, open your PHP configuration file (php.ini) for example: <i>sudo vi /etc/php5/apache2/php.ini;</i><br> And set your timeout parameters to a correct value: <br><i> max_execution_time = 0</i> and <i>max_input_time = -1</i>');
@ -256,7 +264,7 @@ if ($tab == 'massive_policies' && is_central_policies_on_node()) {
return; return;
} }
// Catch all submit operations in this view to display Wait banner // Catch all submit operations in this view to display Wait banner.
$submit_action = get_parameter('go'); $submit_action = get_parameter('go');
$submit_update = get_parameter('updbutton'); $submit_update = get_parameter('updbutton');
$submit_del = get_parameter('del'); $submit_del = get_parameter('del');

View File

@ -36,7 +36,13 @@ if (defined('METACONSOLE')) {
components_meta_print_header(); components_meta_print_header();
$sec = 'advanced'; $sec = 'advanced';
} else { } else {
ui_print_page_header(__('Module management').' &raquo; '.__('Component group management'), '', false, 'component_groups', true); ui_print_page_header(
__('Module management').' &raquo; '.__('Component group management'),
'',
false,
'component_groups',
true
);
$sec = 'gmodules'; $sec = 'gmodules';
} }

View File

@ -46,11 +46,22 @@ if (defined('METACONSOLE')) {
*/ */
$id_modulo = (int) get_parameter('id_component_type');
$new_component = (bool) get_parameter('new_component');
if ($id_modulo == 2 || $id_modulo == 4 || $id_modulo == 6) {
$help_header = 'local_module_tab';
} else if (!$new_component) {
$help_header = 'network_component_tab';
} else {
$help_header = 'network_component_tab';
}
ui_print_page_header( ui_print_page_header(
__('Module management').' &raquo; '.__('Network component management'), __('Module management').' &raquo; '.__('Network component management'),
'', '',
false, false,
'network_component', $help_header,
true, true,
'', '',
false, false,
@ -90,7 +101,6 @@ if (!empty($macros)) {
$max_timeout = (int) get_parameter('max_timeout'); $max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries'); $max_retries = (int) get_parameter('max_retries');
$id_modulo = (int) get_parameter('id_component_type');
$id_plugin = (int) get_parameter('id_plugin'); $id_plugin = (int) get_parameter('id_plugin');
$dynamic_interval = (int) get_parameter('dynamic_interval'); $dynamic_interval = (int) get_parameter('dynamic_interval');
$dynamic_max = (int) get_parameter('dynamic_max'); $dynamic_max = (int) get_parameter('dynamic_max');
@ -150,7 +160,6 @@ $disabled_types_event = json_encode($disabled_types_event);
$create_component = (bool) get_parameter('create_component'); $create_component = (bool) get_parameter('create_component');
$update_component = (bool) get_parameter('update_component'); $update_component = (bool) get_parameter('update_component');
$delete_component = (bool) get_parameter('delete_component'); $delete_component = (bool) get_parameter('delete_component');
$new_component = (bool) get_parameter('new_component');
$duplicate_network_component = (bool) get_parameter('duplicate_network_component'); $duplicate_network_component = (bool) get_parameter('duplicate_network_component');
$delete_multiple = (bool) get_parameter('delete_multiple'); $delete_multiple = (bool) get_parameter('delete_multiple');
$multiple_delete = (bool) get_parameter('multiple_delete', 0); $multiple_delete = (bool) get_parameter('multiple_delete', 0);

View File

@ -72,7 +72,7 @@ if (enterprise_installed()) {
} }
} }
$table->data[1][0] = __('Type').' '.ui_print_help_icon('module_type', true); $table->data[1][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$sql = sprintf( $sql = sprintf(
'SELECT id_tipo, descripcion 'SELECT id_tipo, descripcion
FROM ttipo_modulo FROM ttipo_modulo
@ -396,6 +396,124 @@ $next_row++;
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val())); var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
var type_name_selected = type_names[type_selected]; var type_name_selected = type_names[type_selected];
console.log(type_name_selected);
var element = document.getElementById("module_type_help");
var language = "<?php echo $config['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) { if (type_name_selected.match(/_string$/) == null) {
// Numeric types // Numeric types

View File

@ -28,7 +28,7 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
$data = []; $data = [];
$data[0] = __('WMI query'); $data[0] = __('WMI query').' '.ui_print_help_icon('wmi_query_tab', true);
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 25, 255, true); $data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 25, 255, true);
$data[2] = __('Key string').' '.ui_print_help_icon('wmikey', true, ui_get_full_url(false, false, false, false)); $data[2] = __('Key string').' '.ui_print_help_icon('wmikey', true, ui_get_full_url(false, false, false, false));
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 25, 255, true); $data[3] = html_print_input_text('snmp_community', $snmp_community, '', 25, 255, true);

View File

@ -35,7 +35,16 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
*/ */
ui_print_page_header(__('Module management').' &raquo; '.__('Module template management'), 'images/gm_modules.png', false, 'template_tab', true, '', true, 'modulemodal'); ui_print_page_header(
__('Module management').' &raquo; '.__('Module template management'),
'images/gm_modules.png',
false,
'module_template_tab',
true,
'',
true,
'modulemodal'
);
require_once 'include/functions_network_profiles.php'; require_once 'include/functions_network_profiles.php';

View File

@ -34,7 +34,13 @@ $pure = get_parameter('pure', 0);
// Header // Header
if (! defined('METACONSOLE')) { if (! defined('METACONSOLE')) {
ui_print_page_header(__('Manage Netflow Filter'), 'images/gm_netflow.png', false, '', true); ui_print_page_header(
__('Manage Netflow Filter'),
'images/gm_netflow.png',
false,
'pcap_filter',
true
);
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
if ($is_windows) { if ($is_windows) {

View File

@ -54,7 +54,14 @@ if (! defined('METACONSOLE')) {
$buttons['add']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit_form">'.html_print_image('images/add_mc.png', true, ['title' => __('Add filter')]).'</a>'; $buttons['add']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_edit_form">'.html_print_image('images/add_mc.png', true, ['title' => __('Add filter')]).'</a>';
ui_print_page_header(__('Netflow Filter'), 'images/gm_netflow.png', false, '', true, $buttons); ui_print_page_header(
__('Netflow Filter'),
'images/gm_netflow.png',
false,
'pcap_filter',
true,
$buttons
);
} else { } else {
$nav_bar = [ $nav_bar = [
[ [
@ -230,10 +237,9 @@ $table->data[5][1] = html_print_input_text('dst_port', $dst_port, false, 40, 80,
$table->data[6][0] = __('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true); $table->data[6][0] = __('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true);
$table->data[6][1] = html_print_input_text('src_port', $src_port, false, 40, 80, true); $table->data[6][1] = html_print_input_text('src_port', $src_port, false, 40, 80, true);
$table->data[7][0] = ui_print_help_icon('pcap_filter', true);
$table->data[7][1] = html_print_textarea('advanced_filter', 4, 40, $advanced_filter, '', true); $table->data[7][1] = html_print_textarea('advanced_filter', 4, 40, $advanced_filter, '', true);
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true); $table->data[8][0] = '<b>'.__('Aggregate by').'</b>';
$aggregate_list = [ $aggregate_list = [
'srcip' => __('Src Ip Address'), 'srcip' => __('Src Ip Address'),
'dstip' => __('Dst Ip Address'), 'dstip' => __('Dst Ip Address'),

View File

@ -276,19 +276,30 @@ if (isset($name)) {
$head .= ' - '.$name; $head .= ' - '.$name;
} }
// Header // Header.
$tab = get_parameter('tab', ''); $tab = get_parameter('tab', '');
switch ($tab) { switch ($tab) {
default:
case 'main': case 'main':
ui_print_page_header($head, 'images/chart.png', false, 'graph_builder', false, $buttons); ui_print_page_header(
$head,
'images/chart.png',
false,
'graph_builder',
false,
$buttons
);
break; break;
case 'graph_editor': case 'graph_editor':
ui_print_page_header($head, 'images/chart.png', false, 'graph_editor', false, $buttons); ui_print_page_header(
break; $head,
'images/chart.png',
default: false,
ui_print_page_header($head, 'images/chart.png', false, 'graph_builder', false, $buttons); 'graph_editor',
false,
$buttons
);
break; break;
} }

View File

@ -15,7 +15,7 @@ global $config;
require_once $config['homedir'].'/include/functions_visual_map.php'; require_once $config['homedir'].'/include/functions_visual_map.php';
// ACL for the general permission // ACL for the general permission.
$vconsoles_read = check_acl($config['id_user'], 0, 'VR'); $vconsoles_read = check_acl($config['id_user'], 0, 'VR');
$vconsoles_write = check_acl($config['id_user'], 0, 'VW'); $vconsoles_write = check_acl($config['id_user'], 0, 'VW');
$vconsoles_manage = check_acl($config['id_user'], 0, 'VM'); $vconsoles_manage = check_acl($config['id_user'], 0, 'VM');
@ -84,7 +84,7 @@ if (!$is_metaconsole) {
__('Reporting').' &raquo; '.__('Visual Console'), __('Reporting').' &raquo; '.__('Visual Console'),
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'map_builder', 'map_builder_intro',
false, false,
$buttons $buttons
); );

View File

@ -820,7 +820,7 @@ $class = 'databox filters';
<tr id="row_name" style="" class="datos"> <tr id="row_name" style="" class="datos">
<td style="font-weight:bold;"> <td style="font-weight:bold;">
<?php echo __('Name').ui_print_help_icon('reports_label_field', true); ?> <?php echo __('Name'); ?>
</td> </td>
<td style=""> <td style="">
<?php <?php

View File

@ -745,7 +745,12 @@ function message_check_delete_items() {
} }
function added_ids_deleted_items_to_hidden_input() { function added_ids_deleted_items_to_hidden_input() {
message_check_delete_items(); var success = message_check_delete_items();
if(success === false){
$(".check_delete").prop("checked", false);
return false;
}
var ids = ''; var ids = '';
var first = true; var first = true;

View File

@ -480,6 +480,7 @@ switch ($action) {
} }
$subsection = ''; $subsection = '';
$helpers = '';
switch ($activeTab) { switch ($activeTab) {
case 'main': case 'main':
$buttons['list_reports']['active'] = true; $buttons['list_reports']['active'] = true;
@ -487,10 +488,14 @@ switch ($action) {
break; break;
default: default:
$subsection = reporting_enterprise_add_subsection_main( $data_tab = reporting_enterprise_add_subsection_main(
$activeTab, $activeTab,
$buttons $buttons
); );
$subsection = $data_tab['subsection'];
$buttons = $data_tab['buttons'];
$helpers = $data_tab['helpers'];
break; break;
} }
@ -2909,6 +2914,7 @@ switch ($action) {
$buttons = reporting_enterprise_add_main_Tabs($buttons); $buttons = reporting_enterprise_add_main_Tabs($buttons);
$subsection = ''; $subsection = '';
$helpers = '';
switch ($activeTab) { switch ($activeTab) {
case 'main': case 'main':
$buttons['list_reports']['active'] = true; $buttons['list_reports']['active'] = true;
@ -2916,10 +2922,14 @@ switch ($action) {
break; break;
default: default:
$subsection = reporting_enterprise_add_subsection_main( $data_tab = reporting_enterprise_add_subsection_main(
$activeTab, $activeTab,
$buttons $buttons
); );
$subsection = $data_tab['subsection'];
$buttons = $data_tab['buttons'];
$helpers = $data_tab['helper'];
break; break;
} }
@ -3027,11 +3037,21 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
// Print header. // Print header.
ui_meta_print_header(__('Reporting').$textReportName, '', $buttons); ui_meta_print_header(__('Reporting').$textReportName, '', $buttons);
} else { } else {
switch ($activeTab) {
case 'main':
$helpers = '';
break;
default:
$helpers = 'reporting_'.$activeTab.'_tab';
break;
}
ui_print_page_header( ui_print_page_header(
$textReportName, $textReportName,
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'reporting_'.$activeTab.'_tab', $helpers,
false, false,
$buttons, $buttons,
false, false,

View File

@ -78,7 +78,7 @@ if (!$is_metaconsole) {
__('Reporting').' &raquo; '.__('Visual Favourite Console'), __('Reporting').' &raquo; '.__('Visual Favourite Console'),
'images/op_reporting.png', 'images/op_reporting.png',
false, false,
'map_builder', 'map_builder_favorite',
false, false,
$buttons $buttons
); );

View File

@ -403,7 +403,7 @@ if (($create != '') || ($view != '')) {
$table->data['plugin_command'] = $data; $table->data['plugin_command'] = $data;
$data = []; $data = [];
$data[0] = __('Plug-in parameters').ui_print_help_icon('plugin_parameters', true); $data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>'; $data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>';
if ($locked) { if ($locked) {
$data[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf lock']); $data[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf lock']);
@ -549,7 +549,7 @@ if (($create != '') || ($view != '')) {
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
html_print_table($table); html_print_table($table);
} else { } else {
echo '<fieldset>'.'<legend>'.__('Parameters macros').ui_print_help_icon('macros', true).'</legend>'; echo '<fieldset>'.'<legend>'.__('Parameters macros').'</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
} }
@ -612,7 +612,16 @@ if (($create != '') || ($view != '')) {
config_update_value('metaconsole_deploy_plugin_server', 1); config_update_value('metaconsole_deploy_plugin_server', 1);
} }
} else { } else {
ui_print_page_header(__('Plug-ins registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true); ui_print_page_header(
__(
'Plug-ins registered on %s',
get_product_name()
),
'images/gm_servers.png',
false,
'',
true
);
$management_allowed = !is_central_policies_on_node(); $management_allowed = !is_central_policies_on_node();
if (!$management_allowed) { if (!$management_allowed) {

View File

@ -28,8 +28,14 @@ require_once 'include/functions_gis.php';
ui_require_javascript_file('openlayers.pandora'); ui_require_javascript_file('openlayers.pandora');
// Header // Header.
ui_print_page_header(__('Map conections GIS'), '', false, 'setup_gis_index', true); ui_print_page_header(
__('Map conections GIS'),
'',
false,
'',
true
);
$action = get_parameter('action'); $action = get_parameter('action');

View File

@ -13,7 +13,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
// Load global vars // Load global vars.
global $config; global $config;
check_login(); check_login();
@ -35,8 +35,14 @@ echo '<form action="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2" method="
switch ($action) { switch ($action) {
case 'create_connection_map': case 'create_connection_map':
// Header // Header.
ui_print_page_header(__('Create new map connection'), '', false, 'gis_setup_map_connection', true); ui_print_page_header(
__('Create new map connection'),
'',
false,
'',
true
);
$mapConnection_name = ''; $mapConnection_name = '';
$mapConnection_group = ''; $mapConnection_group = '';
@ -55,8 +61,14 @@ switch ($action) {
break; break;
case 'edit_connection_map': case 'edit_connection_map':
// Header // Header.
ui_print_page_header(__('Edit map connection'), '', false, 'gis_setup_map_connection', true); ui_print_page_header(
__('Edit map connection'),
'',
false,
'',
true
);
$idConnectionMap = get_parameter('id_connection_map'); $idConnectionMap = get_parameter('id_connection_map');
$mapConnection = db_get_row_sql('SELECT * FROM tgis_map_connection WHERE id_tmap_connection = '.$idConnectionMap); $mapConnection = db_get_row_sql('SELECT * FROM tgis_map_connection WHERE id_tmap_connection = '.$idConnectionMap);
@ -142,9 +154,13 @@ switch ($action) {
'layers' => $layers, 'layers' => $layers,
]; ];
break; break;
default:
// Default.
break;
} }
// TODO VALIDATE PARAMETERS // TODO VALIDATE PARAMETERS.
if ($mapConnection_name != '' && $mapConnection_type != '') { if ($mapConnection_name != '' && $mapConnection_type != '') {
gis_save_map_connection( gis_save_map_connection(
$mapConnection_name, $mapConnection_name,
@ -170,6 +186,9 @@ switch ($action) {
return; return;
break; break;
default:
// Default.
break;
} }
$table->width = '90%'; $table->width = '90%';
@ -188,7 +207,7 @@ $table->data[2][1] = html_print_input_text('num_levels_zoom', $mapConnection_num
$table->data[3][0] = __('Default zoom level').ui_print_help_tip(__('Zoom level used when the map is opened'), true).':'; $table->data[3][0] = __('Default zoom level').ui_print_help_tip(__('Zoom level used when the map is opened'), true).':';
$table->data[3][1] = html_print_input_text('initial_zoom', $mapConnection_defaultZoom, '', 4, 10, true); $table->data[3][1] = html_print_input_text('initial_zoom', $mapConnection_defaultZoom, '', 4, 10, true);
echo '<h4>'.__('Basic configuration').'</h4>'; echo '<h4>'.__('Basic configuration').' '.ui_print_help_icon('gis_basic_configurations_tab', true).'</h4>';
html_print_table($table); html_print_table($table);
$table->width = '60%'; $table->width = '60%';
@ -200,7 +219,7 @@ $types['WMS'] = __('WMS Server');
$table->data[0][0] = __('Type').':'; $table->data[0][0] = __('Type').':';
$table->data[0][1] = html_print_select($types, 'sel_type', $mapConnection_type, 'selMapConnectionType();', __('Please select the connection type'), 0, true); $table->data[0][1] = html_print_select($types, 'sel_type', $mapConnection_type, 'selMapConnectionType();', __('Please select the connection type'), 0, true);
echo '<h4>'.__('Map connection type').'</h4>'; echo '<h4>'.__('Map connection type').' '.ui_print_help_icon('gis_map_connection_tab', true).'</h4>';
html_print_table($table); html_print_table($table);
$optionsConnectionTypeTable = ''; $optionsConnectionTypeTable = '';
@ -239,22 +258,26 @@ if ($mapConnectionData != null) {
$mapConnectionDataUrl = $mapConnectionData['url']; $mapConnectionDataUrl = $mapConnectionData['url'];
$layers = $mapConnectionData['layers']; $layers = $mapConnectionData['layers'];
break; break;
default:
// Default.
break;
} }
} }
// Open Street Map Connection // Open Street Map Connection.
$optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.htmlentities(__('Tile Server URL'), ENT_QUOTES, 'UTF-8').':</td>'.'<td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 45, 90, true).'</td>'.'</tr>'.'</table>'; $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.htmlentities(__('Tile Server URL'), ENT_QUOTES, 'UTF-8').':</td>'.'<td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 45, 90, true).'</td>'.'</tr>'.'</table>';
// Google Maps Connection // Google Maps Connection.
$gmaps_types['G_PHYSICAL_MAP'] = __('Google Physical'); $gmaps_types['G_PHYSICAL_MAP'] = __('Google Physical');
$gmaps_types['G_HYBRID_MAP'] = __('Google Hybrid'); $gmaps_types['G_HYBRID_MAP'] = __('Google Hybrid');
$gmaps_types['G_SATELITE_MAP'] = __('Google Satelite'); $gmaps_types['G_SATELITE_MAP'] = __('Google Satelite');
// TODO: Use label tags for the forms. // TODO: Use label tags for the forms.
$optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%">'.'<tr class="row_0">'.'<td>'.__('Google Map Type').':</td>'.'<td><input id="type" type="hidden" name="type" value="Gmap" />'.trim(html_print_select($gmaps_types, 'gmap_type', $gmap_type, '', '', 0, true)).'</td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Google Maps Key').':</td>'.'</tr>'.'<tr class="row_3">'.'<td colspan="2">'.html_print_input_text('gmap_key', $gmap_key, '', 90, 128, true).'</td>'.'</tr>'.'</table>'; $optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%">'.'<tr class="row_0">'.'<td>'.__('Google Map Type').':</td>'.'<td><input id="type" type="hidden" name="type" value="Gmap" />'.trim(html_print_select($gmaps_types, 'gmap_type', $gmap_type, '', '', 0, true)).'</td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Google Maps Key').':</td>'.'</tr>'.'<tr class="row_3">'.'<td colspan="2">'.html_print_input_text('gmap_key', $gmap_key, '', 90, 128, true).'</td>'.'</tr>'.'</table>';
// Image Map Connection // Image Map Connection.
$optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('Image URL').':</td>'.'<td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 45, 90, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Left').':</td>'.'<td>'.html_print_input_text('bb_left', $bb_left, '', 25, 25, true).'</td>'.'<td>'.__('Bottom').':</td>'.'<td>'.html_print_input_text('bb_bottom', $bb_bottom, '', 25, 25, true).'</td>'.'</tr>'.'<tr class="row_3">'.'<td>'.__('Right').':</td>'.'<td>'.html_print_input_text('bb_right', $bb_right, '', 25, 25, true).'</td>'.'<td>'.__('Top').':</td>'.'<td>'.html_print_input_text('bb_top', $bb_top, '', 25, 25, true).'</td>'.'</tr>'.'<tr class="row_4">'.'<td colspan="4"><strong>'.__('Image Size').':</strong></td>'.'</tr>'.'<tr class="row_5">'.'<td>'.__('Width').':</td>'.'<td>'.html_print_input_text('image_width', $image_width, '', 25, 25, true).'</td>'.'<td>'.__('Height').':</td>'.'<td>'.html_print_input_text('image_height', $image_height, '', 25, 25, true).'</td>'.'</tr>'.'</table>'; $optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('Image URL').':</td>'.'<td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 45, 90, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Left').':</td>'.'<td>'.html_print_input_text('bb_left', $bb_left, '', 25, 25, true).'</td>'.'<td>'.__('Bottom').':</td>'.'<td>'.html_print_input_text('bb_bottom', $bb_bottom, '', 25, 25, true).'</td>'.'</tr>'.'<tr class="row_3">'.'<td>'.__('Right').':</td>'.'<td>'.html_print_input_text('bb_right', $bb_right, '', 25, 25, true).'</td>'.'<td>'.__('Top').':</td>'.'<td>'.html_print_input_text('bb_top', $bb_top, '', 25, 25, true).'</td>'.'</tr>'.'<tr class="row_4">'.'<td colspan="4"><strong>'.__('Image Size').':</strong></td>'.'</tr>'.'<tr class="row_5">'.'<td>'.__('Width').':</td>'.'<td>'.html_print_input_text('image_width', $image_width, '', 25, 25, true).'</td>'.'<td>'.__('Height').':</td>'.'<td>'.html_print_input_text('image_height', $image_height, '', 25, 25, true).'</td>'.'</tr>'.'</table>';
// WMS Server Connection // WMS Server Connection.
$optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('WMS Server URL').'</td>'.'<td>'.'<input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 90, 255, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td>'.__('Layers').ui_print_help_tip(__('Enter a single element or a comma separated list'), true).'</td>'.'<td>'.html_print_input_text('layers', $layers, '', 90, 255, true).'</td>'.'</tr>'.'</table>'; $optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('WMS Server URL').'</td>'.'<td>'.'<input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 90, 255, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td>'.__('Layers').ui_print_help_tip(__('Enter a single element or a comma separated list'), true).'</td>'.'<td>'.html_print_input_text('layers', $layers, '', 90, 255, true).'</td>'.'</tr>'.'</table>';
if ($mapConnectionData != null) { if ($mapConnectionData != null) {
@ -274,6 +297,10 @@ if ($mapConnectionData != null) {
case 'WMS': case 'WMS':
$optionsConnectionTypeTable = $optionsConnectionWMSTable; $optionsConnectionTypeTable = $optionsConnectionWMSTable;
break; break;
default:
// Default.
break;
} }
} }

View File

@ -628,7 +628,7 @@ $table_other->data[6][1] = html_print_input_text(
true true
); );
$table_other->data[7][0] = __('Use agent access graph').ui_print_help_icon('agent_access', true); $table_other->data[7][0] = __('Use agent access graph');
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true); $table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory'); $table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
@ -707,24 +707,24 @@ $table_other->data[13][1] = html_print_input_text(
echo '<form id="form_setup" method="post">'; echo '<form id="form_setup" method="post">';
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Database maintenance status').'</legend>'; echo '<legend>'.__('Database maintenance status').' '.ui_print_help_icon('database_maintenance_status_tab', true).'</legend>';
html_print_table($table_status); html_print_table($table_status);
echo '</fieldset>'; echo '</fieldset>';
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Database maintenance options').'</legend>'; echo '<legend>'.__('Database maintenance options').' '.ui_print_help_icon('database_maintenance_options_tab', true).'</legend>';
html_print_table($table); html_print_table($table);
echo '</fieldset>'; echo '</fieldset>';
if ($config['history_db_enabled'] == 1) { if ($config['history_db_enabled'] == 1) {
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Historical database maintenance options').'</legend>'; echo '<legend>'.__('Historical database maintenance options').' '.ui_print_help_icon('historical_database_maintenance_options_tab', true).'</legend>';
html_print_table($table_historical); html_print_table($table_historical);
echo '</fieldset>'; echo '</fieldset>';
} }
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Others').'</legend>'; echo '<legend>'.__('Others').' '.ui_print_help_icon('others_database_maintenance_options_tab', true).'</legend>';
html_print_table($table_other); html_print_table($table_other);
echo '</fieldset>'; echo '</fieldset>';

View File

@ -135,9 +135,9 @@ if (enterprise_installed()) {
switch ($section) { switch ($section) {
case 'general': case 'general':
default:
$buttons['general']['active'] = true; $buttons['general']['active'] = true;
$subpage = ' &raquo '.__('General'); $subpage = ' &raquo '.__('General');
$help_header = 'setup_general_tab';
break; break;
case 'auth': case 'auth':
@ -148,7 +148,7 @@ switch ($section) {
case 'perf': case 'perf':
$buttons['perf']['active'] = true; $buttons['perf']['active'] = true;
$subpage = ' &raquo '.__('Performance'); $subpage = ' &raquo '.__('Performance');
$help_header = 'performance'; $help_header = '';
break; break;
case 'vis': case 'vis':
@ -164,16 +164,34 @@ switch ($section) {
case 'ehorus': case 'ehorus':
$buttons['ehorus']['active'] = true; $buttons['ehorus']['active'] = true;
$subpage = ' &raquo '.__('eHorus'); $subpage = ' &raquo '.__('eHorus');
$help_header = 'setup_ehorus_tab';
break; break;
case 'notifications': case 'notifications':
$buttons['notifications']['active'] = true; $buttons['notifications']['active'] = true;
$subpage = ' &raquo '.__('Notifications'); $subpage = ' &raquo '.__('Notifications');
break; break;
case 'enterprise':
$buttons['enterprise']['active'] = true;
$subpage = ' &raquo '.__('Enterprise');
$help_header = 'setup_enterprise_tab';
break;
default:
// Default.
break;
} }
// Header. // Header.
ui_print_page_header(__('Configuration').$subpage, '', false, $help_header, true, $buttons); ui_print_page_header(
__('Configuration').$subpage,
'',
false,
$help_header,
true,
$buttons
);
if (isset($config['error_config_update_config'])) { if (isset($config['error_config_update_config'])) {
if ($config['error_config_update_config']['correct'] == false) { if ($config['error_config_update_config']['correct'] == false) {

View File

@ -82,7 +82,7 @@ $table->data[2][1] = html_print_input_text('phantomjs_bin', io_safe_output($conf
$table->data[6][0] = __('Auto login (hash) password'); $table->data[6][0] = __('Auto login (hash) password');
$table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true); $table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[9][0] = __('Time source').ui_print_help_icon('timesource', true); $table->data[9][0] = __('Time source');
$sources['system'] = __('System'); $sources['system'] = __('System');
$sources['sql'] = __('Database'); $sources['sql'] = __('Database');
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true); $table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
@ -107,7 +107,7 @@ $table->data[13][1] = html_print_input_text('cert_path', io_safe_output($config[
$table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true); $table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
$table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true); $table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[15][0] = __('IP list with API access').ui_print_help_icon('ip_api_list', true); $table->data[15][0] = __('IP list with API access');
if (isset($_POST['list_ACL_IPs_for_API'])) { if (isset($_POST['list_ACL_IPs_for_API'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else { } else {

View File

@ -117,7 +117,7 @@ if (enterprise_installed()) {
} }
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Behaviour configuration').'</legend>'; echo '<legend>'.__('Behaviour configuration').' '.ui_print_help_icon('behavoir_conf_tab', true).'</legend>';
html_print_table($table_behaviour); html_print_table($table_behaviour);
echo '</fieldset>'; echo '</fieldset>';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -263,12 +263,12 @@ function logo_custom_enterprise($name, $logo)
} }
$table_styles->data[$row][0] = __('Custom logo (menu)').ui_print_help_icon('custom_logo', true); $table_styles->data[$row][0] = __('Custom logo (menu)');
$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo', $config['custom_logo']); $table_styles->data[$row][1] = logo_custom_enterprise('custom_logo', $config['custom_logo']);
$table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal'); $table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$row++; $row++;
$table_styles->data[$row][0] = __('Custom logo collapsed (menu)').ui_print_help_icon('custom_logo_collapsed', true); $table_styles->data[$row][0] = __('Custom logo collapsed (menu)');
$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo_collapsed', $config['custom_logo_collapsed']); $table_styles->data[$row][1] = logo_custom_enterprise('custom_logo_collapsed', $config['custom_logo_collapsed']);
$table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_collapsed_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal'); $table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_collapsed_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$row++; $row++;
@ -312,7 +312,7 @@ if (enterprise_installed()) {
$table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_white_bg_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal'); $table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'custom_logo_white_bg_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$row++; $row++;
$table_styles->data[$row][0] = __('Custom logo (login)').ui_print_help_icon('custom_logo', true); $table_styles->data[$row][0] = __('Custom logo (login)');
if (enterprise_installed()) { if (enterprise_installed()) {
$table_styles->data[$row][1] = html_print_select( $table_styles->data[$row][1] = html_print_select(
@ -565,7 +565,7 @@ $row++;
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Style configuration').'</legend>'; echo '<legend>'.__('Style configuration').' '.ui_print_help_icon('style_conf_tab', true).'</legend>';
html_print_table($table_styles); html_print_table($table_styles);
echo '</fieldset>'; echo '</fieldset>';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -608,7 +608,7 @@ $row++;
$row++; $row++;
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('GIS configuration').'</legend>'; echo '<legend>'.__('GIS configuration').' '.ui_print_help_icon('gis_conf_tab', true).'</legend>';
html_print_table($table_gis); html_print_table($table_gis);
echo '</fieldset>'; echo '</fieldset>';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -702,7 +702,7 @@ $row++;
$row++; $row++;
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Font and Text configuration').'</legend>'; echo '<legend>'.__('Font and Text configuration').' '.ui_print_help_icon('front_and_text_conf_tab', true).'</legend>';
html_print_table($table_font); html_print_table($table_font);
echo '</fieldset>'; echo '</fieldset>';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -890,7 +890,7 @@ $row++;
*/ */
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Charts configuration').'</legend>'; echo '<legend>'.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).'</legend>';
html_print_table($table_chars); html_print_table($table_chars);
echo '</fieldset>'; echo '</fieldset>';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -937,7 +937,7 @@ $row++;
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Visual consoles configuration').'</legend>'; echo '<legend>'.__('Visual consoles configuration').' '.ui_print_help_icon('visual_consoles_conf_tab', true).'</legend>';
html_print_table($table_vc); html_print_table($table_vc);
echo '</fieldset>'; echo '</fieldset>';
@ -955,7 +955,7 @@ $row++;
$table_ser->data['number'][1] = "<input type ='number' value=".$config['ser_menu_items']." size='5' name='ser_menu_items' min='0' max='25'>"; $table_ser->data['number'][1] = "<input type ='number' value=".$config['ser_menu_items']." size='5' name='ser_menu_items' min='0' max='25'>";
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Services configuration').'</legend>'; echo '<legend>'.__('Services configuration').' '.ui_print_help_icon('services_conf_tab', true).'</legend>';
html_print_table($table_ser); html_print_table($table_ser);
echo '</fieldset>'; echo '</fieldset>';
@ -1134,7 +1134,7 @@ $row++;
); );
$row++; $row++;
$table_other->data[$row][0] = __('Date format string').ui_print_help_icon('date_format', true); $table_other->data[$row][0] = __('Date format string');
$table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_format']); $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_format']);
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++; $row++;
@ -1147,7 +1147,7 @@ $row++;
$comparation = false; $comparation = false;
} }
$table_other->data[$row][0] = __('Timestamp or time comparation').ui_print_help_icon('time_stamp-comparation', true); $table_other->data[$row][0] = __('Timestamp or time comparation');
$table_other->data[$row][1] = __('Comparation in rollover').' '; $table_other->data[$row][1] = __('Comparation in rollover').' ';
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', '', $comparation, true); $table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', '', $comparation, true);
$table_other->data[$row][1] .= '<br />'.__('Timestamp in rollover').' '; $table_other->data[$row][1] .= '<br />'.__('Timestamp in rollover').' ';
@ -1253,7 +1253,7 @@ $row++;
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Other configuration').'</legend>'; echo '<legend>'.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).'</legend>';
html_print_table($table_other); html_print_table($table_other);
echo '</fieldset>'; echo '</fieldset>';

View File

@ -76,7 +76,7 @@ if ($update_alert || $modify_alert) {
__('SNMP Console').' &raquo; '.__('Update alert'), __('SNMP Console').' &raquo; '.__('Update alert'),
'images/op_snmp.png', 'images/op_snmp.png',
false, false,
'snmp_alert', 'snmp_alert_update_tab',
false false
); );
} else if ($create_alert || $save_alert) { } else if ($create_alert || $save_alert) {
@ -84,7 +84,7 @@ if ($update_alert || $modify_alert) {
__('SNMP Console').' &raquo; '.__('Create alert'), __('SNMP Console').' &raquo; '.__('Create alert'),
'images/op_snmp.png', 'images/op_snmp.png',
false, false,
'snmp_alert', 'snmp_alert_overview_tab',
false false
); );
} else { } else {
@ -92,7 +92,7 @@ if ($update_alert || $modify_alert) {
__('SNMP Console').' &raquo; '.__('Alert overview'), __('SNMP Console').' &raquo; '.__('Alert overview'),
'images/op_snmp.png', 'images/op_snmp.png',
false, false,
'snmp_alert', 'snmp_alert_overview_tab',
false false
); );
} }
@ -757,7 +757,6 @@ if ($create_alert || $update_alert) {
// Custom // Custom
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom Value/OID'); echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom Value/OID');
echo ui_print_help_icon('snmp_alert_custom', true);
echo '</td><td class="datos">'; echo '</td><td class="datos">';
html_print_textarea('custom_value', 2, 2, $custom_value, 'style="width:400px;"'); html_print_textarea('custom_value', 2, 2, $custom_value, 'style="width:400px;"');
@ -804,7 +803,7 @@ if ($create_alert || $update_alert) {
echo '</td></tr>'; echo '</td></tr>';
// Variable bindings/Data #1 // Variable bindings/Data #1
echo '<tr id="tr-custom_value">'.'<td class="datos" valign="top">'.__('Variable bindings/Data').ui_print_help_icon('field_match_snmp', true).'</td>'.'<td class="datos">'; echo '<tr id="tr-custom_value">'.'<td class="datos" valign="top">'.__('Variable bindings/Data').'</td><td class="datos">';
echo '#'; echo '#';
html_print_input_text('order_1', $order_1, '', 4); html_print_input_text('order_1', $order_1, '', 4);
html_print_input_text('custom_oid_data_1', $custom_oid_data_1, '', 60); html_print_input_text('custom_oid_data_1', $custom_oid_data_1, '', 60);
@ -1077,7 +1076,7 @@ if ($create_alert || $update_alert) {
} }
echo '</td></tr>'; echo '</td></tr>';
echo '<tr><td class="datos">'.__('Position').ui_print_help_icon('snmp_alert_position', true).'</td><td class="datos">'; echo '<tr><td class="datos">'.__('Position').'</td><td class="datos">';
html_print_input_text('position', $position, '', 3); html_print_input_text('position', $position, '', 3);
echo '</td></tr>'; echo '</td></tr>';

View File

@ -33,7 +33,13 @@ $snmp_type = (int) get_parameter('snmp_type', 0);
$snmp_value = (string) get_parameter('snmp_value', ''); $snmp_value = (string) get_parameter('snmp_value', '');
$generate_trap = (bool) get_parameter('generate_trap', 0); $generate_trap = (bool) get_parameter('generate_trap', 0);
ui_print_page_header(__('SNMP Trap generator'), 'images/op_snmp.png', false, '', false); ui_print_page_header(
__('SNMP Trap generator'),
'images/op_snmp.png',
false,
'snmp_trap_generator_view',
false
);
if ($generate_trap) { if ($generate_trap) {
$result = true; $result = true;
@ -64,22 +70,64 @@ $table->size = [];
$table->data = []; $table->data = [];
$table->data[0][0] = __('Host address'); $table->data[0][0] = __('Host address');
$table->data[0][1] = html_print_input_text('snmp_host_address', $snmp_host_address, '', 50, 255, true); $table->data[0][1] = html_print_input_text(
'snmp_host_address',
$snmp_host_address,
'',
50,
255,
true
);
$table->data[0][2] = __('Community'); $table->data[0][2] = __('Community');
$table->data[0][3] = html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true); $table->data[0][3] = html_print_input_text(
'snmp_community',
$snmp_community,
'',
50,
255,
true
);
$table->data[2][0] = __('Enterprise String'); $table->data[2][0] = __('Enterprise String');
$table->data[2][1] = html_print_input_text('snmp_oid', $snmp_oid, '', 50, 255, true); $table->data[2][1] = html_print_input_text(
'snmp_oid',
$snmp_oid,
'',
50,
255,
true
);
$table->data[2][2] = __('Value'); $table->data[2][2] = __('Value');
$table->data[2][3] = html_print_input_text('snmp_value', $snmp_value, '', 50, 255, true); $table->data[2][3] = html_print_input_text(
'snmp_value',
$snmp_value,
'',
50,
255,
true
);
$table->data[3][0] = __('SNMP Agent'); $table->data[3][0] = __('SNMP Agent');
$table->data[3][1] = html_print_input_text('snmp_agent', $snmp_agent, '', 50, 255, true); $table->data[3][1] = html_print_input_text(
'snmp_agent',
$snmp_agent,
'',
50,
255,
true
);
$table->data[3][2] = __('SNMP Type').' '.ui_print_help_icon('snmp_trap_types', true); $table->data[3][2] = __('SNMP Type');
$table->data[3][3] = html_print_input_text('snmp_type', $snmp_type, '', 50, 255, true); $table->data[3][3] = html_print_input_text(
'snmp_type',
$snmp_type,
'',
50,
255,
true
);
$types = [ $types = [
0 => 'Cold start (0)', 0 => 'Cold start (0)',
@ -90,7 +138,17 @@ $types = [
5 => 'EGP neighbor loss (5)', 5 => 'EGP neighbor loss (5)',
6 => 'Enterprise (6)', 6 => 'Enterprise (6)',
]; ];
$table->data[3][3] = html_print_select($types, 'snmp_type', $snmp_type, '', __('Select'), -1, true, false, false); $table->data[3][3] = html_print_select(
$types,
'snmp_type',
$snmp_type,
'',
__('Select'),
-1,
true,
false,
false
);
$traps_generator .= html_print_table($table, true); $traps_generator .= html_print_table($table, true);

View File

@ -117,7 +117,14 @@ if (is_metaconsole()) {
// ui_meta_print_header(__('Tags'), "", $buttons); // ui_meta_print_header(__('Tags'), "", $buttons);
} else { } else {
// Header // Header
ui_print_page_header(__('Tags configuration'), 'images/tag.png', false, 'tags_config', true, $buttons); ui_print_page_header(
__('Tags configuration'),
'images/tag.png',
false,
'tags_config',
true,
$buttons
);
} }
// Two actions can performed in this page: search and delete tags // Two actions can performed in this page: search and delete tags

View File

@ -53,10 +53,12 @@ switch ($tab) {
case 'offline': case 'offline':
$title = __('Update manager » Offline'); $title = __('Update manager » Offline');
$help_header = 'update_manager_offline_tab';
break; break;
case 'online': case 'online':
$title = __('Update manager » Online'); $title = __('Update manager » Online');
$help_header = 'update_manager_online_tab';
break; break;
} }
@ -64,7 +66,7 @@ ui_print_page_header(
$title, $title,
'images/gm_setup.png', 'images/gm_setup.png',
false, false,
'', $help_header,
true, true,
$buttons $buttons
); );

View File

@ -47,7 +47,14 @@ if (!is_metaconsole()) {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
ui_print_page_header(__('User management').' &raquo; '.__('Profiles defined on %s', get_product_name()), 'images/gm_users.png', false, '', true, $buttons); ui_print_page_header(
__('User management').' &raquo; '.__('Profiles defined on %s', get_product_name()),
'images/gm_users.png',
false,
'configure_profiles_tab',
true,
$buttons
);
$sec2 = 'gusuarios'; $sec2 = 'gusuarios';
} else { } else {
user_meta_print_header(); user_meta_print_header();

View File

@ -90,7 +90,14 @@ if ($meta) {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
ui_print_page_header(__('User detail editor'), 'images/gm_users.png', false, '', true, $buttons); ui_print_page_header(
__('User detail editor'),
'images/gm_users.png',
false,
'profile_tab',
true,
$buttons
);
$sec = 'gusuarios'; $sec = 'gusuarios';
} }

View File

@ -51,7 +51,14 @@ if (!defined('METACONSOLE')) {
$buttons[$tab]['active'] = true; $buttons[$tab]['active'] = true;
ui_print_page_header(__('User management').' &raquo; '.__('Profiles defined on %s', get_product_name()), 'images/gm_users.png', false, 'profile', true, $buttons); ui_print_page_header(
__('User management').' &raquo; '.__('Profiles defined on %s', get_product_name()),
'images/gm_users.png',
false,
'profile_tab',
true,
$buttons
);
$sec = 'gusuarios'; $sec = 'gusuarios';
} else { } else {
user_meta_print_header(); user_meta_print_header();

View File

@ -594,106 +594,122 @@ class HostDevices extends Wizard
if (isset($this->page) === false if (isset($this->page) === false
|| $this->page == 0 || $this->page == 0
) { ) {
// Comment input $form = [];
$comment_input = '<div class="label_select"><label>'.__('Comment').':</label></div>';
$comment_input .= $this->printInput( $str = __('Next');
[
'name' => 'comment',
'rows' => 1,
'columns' => 1,
'value' => $this->task['description'],
'type' => 'textarea',
'size' => 25,
'class' => 'discovery_textarea_input',
'return' => true,
]
);
// Task input if (isset($this->task['id_rt']) === true) {
$taskname_input_label = '<div class="label_select"><label>'.__('Task name').':</label></div>'; $str = __('Update and continue');
}
$taskname_input = $this->printInput( // Interval and schedules.
[
'name' => 'taskname',
'value' => $this->task['name'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input',
]
);
// Network input
$network_input_label .= '<div class="label_select discovery_label_hint"><label>'.__('Network').':</label>'.ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true).'</div>';
$network_input = $this->printInput(
[
'name' => 'network',
'value' => $this->task['subnet'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input',
]
);
// Discovery server input
$discovery_server_select_label = '<div class="label_select discovery_label_hint"><label>'.__('Discovery server').':</label>'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'</div>';
$discovery_server_select = $this->printInput(
[
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
'style' => 'width: 100%',
]
);
// Interval input
$interv_manual = 0; $interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) { if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1; $interv_manual = 1;
} }
$interval_input_label = '<div class="label_select discovery_label_hint" style="padding-top: 6px;"><label>'.__('Interval').':</label>'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'</div>'; $form['rows'][0]['new_form_block'] = true;
$interval_input = $this->printInput( $form['rows'][0]['columns'][0] = [
[ 'width' => '30%',
'type' => 'select', 'style' => 'padding: 9px;',
'selected' => $interv_manual, 'inputs' => [
'fields' => [ '0' => [
0 => __('Defined'), 'arguments' => [
1 => __('Manual'), 'name' => 'submit',
'label' => $str,
'type' => 'submit',
'attributes' => 'class="sub next"',
'return' => true,
],
], ],
'name' => 'interval_manual_defined', '1' => '<div style="height: 50%; margin-bottom: 35px;">'.html_print_image('images/wizard/netscan_green.png', true, ['title' => __('Close')], false).'</div>',
'return' => true, '2' => [
'style' => 'float: right;', 'label' => '<b>'.__('Interval').':</b>'.ui_print_help_tip(
] __('Manual interval means that it will be executed only On-demand'),
); true
),
'arguments' => [
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
'',
'',
'0',
false,
true,
false,
false
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>',
$interval_input_extra = '<span id="interval_manual_container">'.html_print_extended_select_for_time( ],
'interval', ],
$this->task['interval_sweep'], ];
'',
'',
'0',
false,
true,
false,
false
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>';
// Group select $form['rows'][0]['columns'][1] = [
'width' => '40%',
'padding-right' => '12%',
'padding-left' => '5%',
'inputs' => [
'0' => [
'label' => '<b>'.__('Task name').':</b>',
'arguments' => [
'name' => 'taskname',
'value' => $this->task['name'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input',
],
],
'1' => [
'label' => '<b>'.__('Discovery server').':</b>'.ui_print_help_tip(
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
true
),
'arguments' => [
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'style' => 'width: 100%;',
'selected' => $this->task['id_recon_server'],
'return' => true,
],
],
'2' => [
'label' => '<b>'.__('Network').':</b>'.ui_print_help_tip(
__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'),
true
),
'arguments' => [
'name' => 'network',
'value' => $this->task['subnet'],
'type' => 'text',
'size' => 25,
'class' => 'discovery_full_width_input',
],
],
],
];
// Group select (custom for this section).
$group_select = '<div class="label_select"><label>'.__('Group').':</label></div>'; $group_select = '<div class="label_select"><label>'.__('Group').':</label></div>';
$group_select .= $this->printInput( $group_select .= $this->printInput(
@ -710,22 +726,41 @@ class HostDevices extends Wizard
] ]
); );
if (isset($this->task['id_rt']) === true) { $form['rows'][0]['columns'][2] = [
// Propagate ID 'width' => '30%',
$task_hidden = $this->printInput( 'inputs' => ['0' => $group_select],
[ ];
'name' => 'task',
'value' => $this->task['id_rt'], $form['rows'][1]['style'] = 'style de row';
'type' => 'hidden', $form['rows'][1]['columns'][0] = [
] 'padding-right' => '0',
); 'inputs' => [
} '0' => [
'label' => '<b>'.__('Comment').':</b>',
'arguments' => [
'name' => 'comment',
'rows' => 1,
'columns' => 1,
'value' => $this->task['description'],
'type' => 'textarea',
'size' => 25,
'class' => 'discovery_textarea_input',
'return' => true,
],
],
],
];
$task_url = ''; $task_url = '';
if (isset($this->task['id_rt'])) { if (isset($this->task['id_rt'])) {
$task_url = '&task='.$this->task['id_rt']; $task_url = '&task='.$this->task['id_rt'];
} }
$form['form'] = [
'method' => 'POST',
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).$task_url,
];
// Default. // Default.
$interval = 600; $interval = 600;
$unit = 60; $unit = 60;
@ -734,34 +769,7 @@ class HostDevices extends Wizard
$unit = $this->getTimeUnit($interval); $unit = $this->getTimeUnit($interval);
} }
// XXX: Could be improved validating inputs before continue (JS) $form['js'] = '
// Print NetScan page 0.
// $this->printForm($form);
echo '<form action="'.$this->url.'&mode=netscan&page='.($this->page + 1).$task_url.'" method="POST">';
echo $task_hidden;
echo '<div class="white_box">
<div class="edit_discovery_info" style="margin-bottom: 15px;">
<div style="width: 25%; padding: 9px;">'.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image('images/wizard/netscan_green.png', true, ['title' => __('Close')], false).'</div>'.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'.'</div>
<div style="width: 40%; padding-left: 5%; padding-right: 12%;">
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'.'</div>'.'<div style="width: 35%;">'.$group_select.'</div>'.'</div>'.'<div class="edit_discovery_info">
<div style="width: 100%;">
'.$comment_input.'
</div>
</div>'.'</div>';
$str = __('Next');
if (isset($this->task['id_rt']) === true) {
$str = __('Update and continue');
}
echo '<div class="action-buttons" style="width: 100%; margin-top: 10px;">'.html_print_submit_button($str, 'submit', false, 'class="sub next"', true).'</div>';
echo '</form>';
echo '<script>
$("select#interval_manual_defined").change(function() { $("select#interval_manual_defined").change(function() {
if ($("#interval_manual_defined").val() == 1) { if ($("#interval_manual_defined").val() == 1) {
$("#interval_manual_container").hide(); $("#interval_manual_container").hide();
@ -774,9 +782,9 @@ class HostDevices extends Wizard
$("#hidden-interval").val('.$interval.'); $("#hidden-interval").val('.$interval.');
$("#interval_units").val('.$unit.'); $("#interval_units").val('.$unit.');
} }
}).change(); }).change();';
</script>'; $this->printFormAsGrid($form);
} }
} }
@ -793,7 +801,6 @@ class HostDevices extends Wizard
], ],
]; ];
// Hidden, page.
$form['inputs'][] = [ $form['inputs'][] = [
'arguments' => [ 'arguments' => [
'name' => 'page', 'name' => 'page',
@ -807,7 +814,6 @@ class HostDevices extends Wizard
'extra' => '<p><h3>Please, configure task <b>'.io_safe_output($this->task['name']).'</b></h3></p>', 'extra' => '<p><h3>Please, configure task <b>'.io_safe_output($this->task['name']).'</b></h3></p>',
]; ];
// Input: Module template.
$form['inputs'][] = [ $form['inputs'][] = [
'label' => __('Module template'), 'label' => __('Module template'),
'arguments' => [ 'arguments' => [
@ -870,7 +876,7 @@ class HostDevices extends Wizard
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'], 'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
]; ];
$this->printForm($form, false, true); $this->printFormAsList($form);
} }
if ($this->page == 2) { if ($this->page == 2) {

View File

@ -624,6 +624,162 @@ class Wizard
} }
/**
* Print a block of inputs with grid format.
*
* @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML content.
*/
public function printBlockAsGrid(array $input, bool $return=false)
{
$output = '';
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
$class = '';
}
if (isset($input['class']) === true) {
$class = $input['class'].$class;
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">';
foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsGrid($input, $return);
}
$output .= '</ul></li>';
} else {
if ($input['arguments']['type'] != 'hidden') {
if ($input['arguments']['inline'] != 'true') {
$output .= '<div class="edit_discovery_input">';
} else {
$output .= '<div style="display: flex; margin-bottom: 25px;">';
if (!isset($input['extra'])) {
$output .= '<div style="width: 50%;">';
}
if (isset($input['extra'])) {
$output .= '<div style="width: 50%; display: flex;">';
}
}
if ($input['arguments']['inline'] == 'true' && isset($input['extra'])) {
$output .= '<div style="width: 50%">';
}
$output .= '<div class="label_select">';
$output .= $input['label'];
$output .= '</div>';
if ($input['arguments']['inline'] == 'true' && isset($input['extra'])) {
$output .= '</div>';
}
if ($input['arguments']['inline'] == 'true' && !isset($input['extra'])) {
$output .= '</div>';
}
if ($input['arguments']['type'] == 'text' || $input['arguments']['type'] == 'text_extended') {
$output .= '<div class="discovery_text_input">';
$output .= $this->printInput($input['arguments']);
$output .= '</div>';
} else if ($input['arguments']['inline'] == 'true') {
$output .= '<div style="width: 50%;">';
if (isset($input['extra'])) {
$output .= '<div style="float: center;">';
} else {
$output .= '<div style="float: right;">';
}
$output .= $this->printInput($input['arguments']);
$output .= '</div>';
$output .= '</div>';
if (isset($input['extra'])) {
$output .= '</div>';
}
} else {
$output .= $this->printInput($input['arguments']);
}
// Allow dynamic content.
$output .= $input['extra'];
$output .= '</div>';
} else {
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
}
}
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Print a block of inputs as a list element.
*
* @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML content.
*/
public function printBlockAsList(array $input, bool $return=false)
{
$output = '';
if ($input['hidden'] == 1) {
$class = ' hidden';
} else {
$class = '';
}
if (isset($input['class']) === true) {
$class = $input['class'].$class;
}
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">';
foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsList($input, $return);
}
$output .= '</ul></li>';
} else {
if ($input['arguments']['type'] != 'hidden') {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
$output .= '<label>'.$input['label'].'</label>';
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
$output .= '</li>';
} else {
$output .= $this->printInput($input['arguments']);
// Allow dynamic content.
$output .= $input['extra'];
}
}
if ($return === false) {
echo $output;
}
return $output;
}
/** /**
* Print a form. * Print a form.
* *
@ -694,6 +850,163 @@ class Wizard
} }
/**
* Print a form as a grid of inputs.
*
* @param array $data Definition of target form to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML code.
*/
public function printFormAsGrid(array $data, bool $return=false)
{
$form = $data['form'];
$rows = $data['rows'];
$js = $data['js'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
echo $output_head;
}
try {
if (isset($cb_function) === true) {
call_user_func_array(
$cb_function,
(isset($cb_args) === true) ? $cb_args : []
);
}
} catch (Exception $e) {
error_log('Error executing wizard callback: ', $e->getMessage());
}
$output_submit = '';
$output = '';
$first_block_printed = false;
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
$output .= '<div class="white_box" style="margin-top: 30px;">';
} else {
$output .= '<div class="white_box">';
}
$first_block_printed = true;
}
$output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
foreach ($row['columns'] as $column) {
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsGrid($input, true);
} else {
$output_submit .= $this->printBlockAsGrid($input, true);
}
} else {
$output .= $input;
}
}
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($return === false) {
echo $output;
}
return $output_head.$output;
}
/**
* Print a form as a list.
*
* @param array $data Definition of target form to be printed.
* @param boolean $return Return as string or direct output.
*
* @return string HTML code.
*/
public function printFormAsList(array $data, bool $return=false)
{
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$cb_function = $data['cb_function'];
$cb_args = $data['cb_args'];
$output_head = '<form enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>';
if ($return === false) {
echo $output_head;
}
try {
if (isset($cb_function) === true) {
call_user_func_array(
$cb_function,
(isset($cb_args) === true) ? $cb_args : []
);
}
} catch (Exception $e) {
error_log('Error executing wizard callback: ', $e->getMessage());
}
$output = '<div class="white_box">';
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsList($input, true);
} else {
$output_submit .= $this->printBlockAsList($input, true);
}
}
$output .= '</ul>';
$output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($return === false) {
echo $output;
}
return $output_head.$output;
}
/** /**
* Print a big button element (huge image, big text and link). * Print a big button element (huge image, big text and link).
* *

View File

@ -153,24 +153,48 @@ if ($show_update_action_menu) {
$id_alert = (int) get_parameter('id_alert'); $id_alert = (int) get_parameter('id_alert');
$module_name = modules_get_agentmodule_name($id_agent_module); $module_name = modules_get_agentmodule_name($id_agent_module);
$agent_alias = modules_get_agentmodule_agent_alias($id_agent);
$agent_alias = modules_get_agentmodule_agent_alias($id_agent_module);
$id_action = (int) get_parameter('id_action'); $id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert); $actions = alerts_get_alert_agent_module_actions($id_alert);
$action_opction = db_get_row('talert_template_module_actions', 'id_alert_template_module', $id_alert); $action_opction = db_get_row(
'talert_template_module_actions',
'id_alert_template_module',
$id_alert
);
$data .= '<form id="update_action-'.$alert['id'].'" method="post">'; $data .= '<form id="update_action-'.$alert['id'].'" method="post">';
$data .= '<table class="databox_color" style="width:100%">'; $data .= '<table class="databox_color" style="width:100%">';
$data .= html_print_input_hidden('update_action', 1, true); $data .= html_print_input_hidden(
$data .= html_print_input_hidden('id_module_action_ajax', $id_module_action, true); 'update_action',
1,
true
);
$data .= html_print_input_hidden(
'id_module_action_ajax',
$id_module_action,
true
);
if (! $id_agente) { if (! $id_agente) {
$data .= '<tr class="datos2">'; $data .= '<tr class="datos2">';
$data .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data .= __('Agent'); $data .= __('Agent').'&nbsp;'.ui_print_help_icon(
'alert_scalate',
true,
ui_get_full_url(false, false, false, false)
);
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos">'; $data .= '<td class="datos">';
$data .= ui_print_truncate_text($agent_alias, 'agent_small', false, true, true, '[&hellip;]'); $data .= ui_print_truncate_text(
$agent_alias,
'agent_small',
false,
true,
true,
'[&hellip;]'
);
$data .= '</td>'; $data .= '</td>';
$data .= '</tr>'; $data .= '</tr>';
} }
@ -180,7 +204,14 @@ if ($show_update_action_menu) {
$data .= __('Module'); $data .= __('Module');
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos">'; $data .= '<td class="datos">';
$data .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]'); $data .= ui_print_truncate_text(
$module_name,
'module_small',
false,
true,
true,
'[&hellip;]'
);
$data .= '</td>'; $data .= '</td>';
$data .= '</tr>'; $data .= '</tr>';
$data .= '<tr class="datos2">'; $data .= '<tr class="datos2">';
@ -188,29 +219,72 @@ if ($show_update_action_menu) {
$data .= __('Action'); $data .= __('Action');
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos2">'; $data .= '<td class="datos2">';
$data .= html_print_select($actions, 'action_select_ajax', $id_action, '', __('None'), 0, true, false, true, '', false, 'width:150px'); $data .= html_print_select(
$actions,
'action_select_ajax',
$id_action,
'',
__('None'),
0,
true,
false,
true,
'',
false,
'width:150px'
);
$data .= '</td>'; $data .= '</td>';
$data .= '</tr>'; $data .= '</tr>';
$data .= '<tr class="datos">'; $data .= '<tr class="datos">';
$data .= '<td class="datos" style="font-weight:bold;padding:6px;">'; $data .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data .= __('Number of alerts match from').'&nbsp;'.ui_print_help_icon('alert-matches', true, ui_get_full_url(false, false, false, false)); $data .= __('Number of alerts match from');
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos">'; $data .= '<td class="datos">';
$data .= html_print_input_text('fires_min_ajax', $action_opction['fires_min'], '', 4, 10, true); $data .= html_print_input_text(
'fires_min_ajax',
$action_opction['fires_min'],
'',
4,
10,
true
);
$data .= ' '.__('to').' '; $data .= ' '.__('to').' ';
$data .= html_print_input_text('fires_max_ajax', $action_opction['fires_max'], '', 4, 10, true); $data .= html_print_input_text(
'fires_max_ajax',
$action_opction['fires_max'],
'',
4,
10,
true
);
$data .= '</td>'; $data .= '</td>';
$data .= '</tr>'; $data .= '</tr>';
$data .= '<tr class="datos2">'; $data .= '<tr class="datos2">';
$data .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data .= __('Threshold').'&nbsp;'.ui_print_help_icon('action_threshold', true, ui_get_full_url(false, false, false, false)); $data .= __('Threshold');
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos2">'; $data .= '<td class="datos2">';
$data .= html_print_input_text('module_action_threshold_ajax', $action_opction['module_action_threshold'], '', 4, 10, true); $data .= html_print_input_text(
'module_action_threshold_ajax',
$action_opction['module_action_threshold'],
'',
4,
10,
true
);
$data .= '</td>'; $data .= '</td>';
$data .= '</tr>'; $data .= '</tr>';
$data .= '</table>'; $data .= '</table>';
$data .= html_print_submit_button(__('Update'), 'updbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true); $data .= html_print_submit_button(
__('Update'),
'updbutton',
false,
[
'class' => 'sub next',
'style' => 'float:right',
],
true
);
$data .= '</form>'; $data .= '</form>';
echo $data; echo $data;
return; return;

View File

@ -1254,11 +1254,49 @@ function fill_permissions_ldap($sr)
global $config; global $config;
$permissions = []; $permissions = [];
$permissions_profile = []; $permissions_profile = [];
if ((bool) $config['ldap_save_profile'] === false) { if (defined('METACONSOLE')) {
$meta = true;
}
if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) {
$result = 0;
$result = db_get_all_rows_filter( $result = db_get_all_rows_filter(
'tusuario_perfil', 'tusuario_perfil',
['id_usuario' => $sr['uid'][0]] ['id_usuario' => $sr['uid'][0]]
); );
if ($result == false) {
$permissions[0]['profile'] = $config['default_remote_profile'];
$permissions[0]['groups'][] = $config['default_remote_group'];
$permissions[0]['tags'] = $config['default_assign_tags'];
$permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
return $permissions;
}
foreach ($result as $perms) {
$permissions_profile[] = [
'profile' => $perms['id_perfil'],
'groups' => [$perms['id_grupo']],
'tags' => $perms['tags'],
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
];
}
return $permissions_profile;
}
if ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') {
$result = db_get_all_rows_filter(
'tusuario_perfil',
['id_usuario' => $sr['uid'][0]]
);
if ($result == false) {
$permissions[0]['profile'] = $config['default_remote_profile'];
$permissions[0]['groups'][] = $config['default_remote_group'];
$permissions[0]['tags'] = $config['default_assign_tags'];
$permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
return $permissions;
}
foreach ($result as $perms) { foreach ($result as $perms) {
$permissions_profile[] = [ $permissions_profile[] = [
'profile' => $perms['id_perfil'], 'profile' => $perms['id_perfil'],
@ -1268,18 +1306,54 @@ function fill_permissions_ldap($sr)
]; ];
} }
if (empty($permissions_profile)) { return $permissions_profile;
$permissions[0]['profile'] = $config['default_remote_profile'];
$permissions[0]['groups'][] = $config['default_remote_group'];
$permissions[0]['tags'] = $config['default_assign_tags'];
$permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
return $permissions;
} else {
return $permissions_profile;
}
} }
if ($config['autocreate_remote_users']) { if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 1) {
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$permissions[] = [
'profile' => $ldap_adv_perm['profile'],
'groups' => $ldap_adv_perm['group'],
'tags' => implode(',', $ldap_adv_perm['tags']),
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
];
}
return $permissions;
}
if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) {
$result = db_get_all_rows_filter(
'tusuario_perfil',
['id_usuario' => $sr['uid'][0]]
);
if ($result == false) {
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$permissions[] = [
'profile' => $ldap_adv_perm['profile'],
'groups' => $ldap_adv_perm['group'],
'tags' => implode(',', $ldap_adv_perm['tags']),
'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
];
return $permissions;
}
}
foreach ($result as $perms) {
$permissions_profile[] = [
'profile' => $perms['id_perfil'],
'groups' => [$perms['id_grupo']],
'tags' => $perms['tags'],
'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
];
};
return $permissions_profile;
}
if ($config['autocreate_remote_users'] && $config['ldap_save_profile'] == 1) {
$permissions[0]['profile'] = $config['default_remote_profile']; $permissions[0]['profile'] = $config['default_remote_profile'];
$permissions[0]['groups'][] = $config['default_remote_group']; $permissions[0]['groups'][] = $config['default_remote_group'];
$permissions[0]['tags'] = $config['default_assign_tags']; $permissions[0]['tags'] = $config['default_assign_tags'];

View File

@ -360,7 +360,7 @@ class CustomNetScan extends Wizard
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
// Header // Header.
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
@ -385,7 +385,7 @@ class CustomNetScan extends Wizard
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
// Header // Header.
ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
} }
@ -594,7 +594,7 @@ class CustomNetScan extends Wizard
// XXX: Could be improved validating inputs before continue (JS) // XXX: Could be improved validating inputs before continue (JS)
// Print NetScan page 0. // Print NetScan page 0.
$this->printForm($form, false, true); $this->printFormAsList($form);
} }
} }
@ -742,7 +742,7 @@ class CustomNetScan extends Wizard
get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'"); get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'");
})'.$change; })'.$change;
$this->printForm($form, false, true); $this->printFormAsList($form);
} }
if (isset($this->page) === true && $this->page === 2) { if (isset($this->page) === true && $this->page === 2) {

View File

@ -20,8 +20,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190520'; $build_version = 'PC190523';
$pandora_version = 'v7.0NG.734'; $pandora_version = 'v7.0NG.735';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

File diff suppressed because it is too large Load Diff

View File

@ -1266,11 +1266,11 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri
* *
* @return string The help tip * @return string The help tip
*/ */
function ui_print_help_icon($help_id, $return=false, $home_url='', $image='images/help_green.png', $is_relative=false) function ui_print_help_icon($help_id, $return=false, $home_url='', $image='images/help_green.png', $is_relative=false, $id='')
{ {
global $config; global $config;
// Do not display the help icon if help is disabled // Do not display the help icon if help is disabled.
if ($config['disable_help']) { if ($config['disable_help']) {
return ''; return '';
} }
@ -1283,13 +1283,16 @@ function ui_print_help_icon($help_id, $return=false, $home_url='', $image='image
$home_url = '../../'.$home_url; $home_url = '../../'.$home_url;
} }
$url = get_help_info($help_id);
$output = html_print_image( $output = html_print_image(
$image, $image,
true, true,
[ [
'class' => 'img_help', 'class' => 'img_help',
'title' => __('Help'), 'title' => __('Help'),
'onclick' => "open_help ('".$help_id."','".$home_url."','".$config['id_user']."')", 'onclick' => "open_help ('".$url."')",
'id' => $id,
], ],
false, false,
$is_relative && is_metaconsole() $is_relative && is_metaconsole()

Some files were not shown because too many files have changed in this diff Show More